Files
vue-desktop/src/apps/index.ts
2025-09-25 15:31:11 +08:00

100 lines
2.7 KiB
TypeScript

import { appRegistry } from './AppRegistry'
import { markRaw } from 'vue'
/**
* 注册所有内置应用
*/
export function registerBuiltInApps() {
// 注册计算器应用
appRegistry.registerApp({
manifest: {
id: 'calculator',
name: '计算器',
version: '1.0.0',
description: '简单而功能强大的计算器,支持基本数学运算',
author: 'System',
icon: '🧮',
permissions: ['storage'],
window: {
width: 400,
height: 600,
minWidth: 320,
minHeight: 480,
resizable: true,
minimizable: true,
maximizable: false,
},
category: 'utilities',
keywords: ['计算器', '数学', '运算', 'calculator', 'math'],
},
// 使用动态导入实现懒加载
component: async () => {
const { default: Calculator } = await import('./calculator/Calculator.vue')
return markRaw(Calculator)
},
isBuiltIn: true,
})
// 注册记事本应用
appRegistry.registerApp({
manifest: {
id: 'notepad',
name: '记事本',
version: '1.0.0',
description: '功能丰富的文本编辑器,支持文件管理和多种编辑选项',
author: 'System',
icon: '📝',
permissions: ['storage', 'notification'],
window: {
width: 800,
height: 600,
minWidth: 400,
minHeight: 300,
resizable: true,
},
category: 'productivity',
keywords: ['记事本', '文本编辑', '笔记', 'notepad', 'text', 'editor'],
},
// 使用动态导入实现懒加载
component: async () => {
const { default: Notepad } = await import('./notepad/Notepad.vue')
return markRaw(Notepad)
},
isBuiltIn: true,
})
// 注册待办事项应用
appRegistry.registerApp({
manifest: {
id: 'todo',
name: '待办事项',
version: '1.0.0',
description: '高效的任务管理工具,帮助您组织和跟踪日常任务',
author: 'System',
icon: '✅',
permissions: ['storage', 'notification'],
window: {
width: 600,
height: 700,
minWidth: 400,
minHeight: 500,
resizable: true,
},
category: 'productivity',
keywords: ['待办事项', '任务管理', 'todo', 'task', 'productivity'],
},
// 使用动态导入实现懒加载
component: async () => {
const { default: Todo } = await import('./todo/Todo.vue')
return markRaw(Todo)
},
isBuiltIn: true,
})
console.log('内置应用注册完成')
}
// 导出应用注册中心
export { appRegistry } from './AppRegistry'
export type { InternalAppManifest, AppRegistration } from './types/AppManifest'