@owdproject/core 3.4.0 → 4.0.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/README.md +112 -13
  2. package/dist/dom/index.d.mts +65 -0
  3. package/dist/dom/index.d.ts +65 -0
  4. package/dist/dom/index.mjs +224 -0
  5. package/dist/events/index.d.mts +70 -0
  6. package/dist/events/index.d.ts +70 -0
  7. package/dist/events/index.mjs +3 -0
  8. package/dist/index.d.mts +73 -0
  9. package/dist/index.d.ts +73 -0
  10. package/dist/index.mjs +115 -0
  11. package/dist/layout/index.d.mts +41 -0
  12. package/dist/layout/index.d.ts +41 -0
  13. package/dist/layout/index.mjs +64 -0
  14. package/dist/machines/index.d.mts +31 -0
  15. package/dist/machines/index.d.ts +31 -0
  16. package/dist/machines/index.mjs +2 -0
  17. package/dist/managers/index.d.mts +118 -0
  18. package/dist/managers/index.d.ts +118 -0
  19. package/dist/managers/index.mjs +6 -0
  20. package/dist/session/index.d.mts +57 -0
  21. package/dist/session/index.d.ts +57 -0
  22. package/dist/session/index.mjs +65 -0
  23. package/dist/shared/core.B1XxB289.mjs +239 -0
  24. package/dist/shared/core.B3mp7ztE.mjs +237 -0
  25. package/dist/shared/core.BOvFdEVQ.d.ts +114 -0
  26. package/dist/shared/core.CsDFgGnX.mjs +40 -0
  27. package/dist/shared/core.Di1eFcr_.d.mts +114 -0
  28. package/dist/shared/core.Pd_Ogt4g.mjs +101 -0
  29. package/dist/shared/core.b3Xldzyu.mjs +29 -0
  30. package/dist/shared/core.d_A3q1kZ.mjs +869 -0
  31. package/dist/types/index.d.mts +266 -0
  32. package/dist/types/index.d.ts +266 -0
  33. package/dist/types/index.mjs +1 -0
  34. package/package.json +56 -112
  35. package/CHANGELOG.md +0 -98
  36. package/DESKTOP_KERNEL.md +0 -232
  37. package/MIGRATION_3.3.2.md +0 -23
  38. package/MIGRATION_3.4.md +0 -126
  39. package/PLAYGROUND.md +0 -91
  40. package/dist/module.d.mts +0 -13
  41. package/dist/module.json +0 -9
  42. package/dist/module.mjs +0 -254
  43. package/dist/types.d.mts +0 -7
  44. package/index.ts +0 -8
  45. package/kit/authoring.ts +0 -340
  46. package/kit/defineDesktopApp.ts +0 -56
  47. package/module.ts +0 -203
  48. package/runtime/components/Application/DesktopCoreApplicationRender.vue +0 -20
  49. package/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue +0 -38
  50. package/runtime/components/background/DesktopCoreBackground.vue +0 -16
  51. package/runtime/components/core/DesktopCore.vue +0 -43
  52. package/runtime/components/time/DesktopCoreTime.vue +0 -56
  53. package/runtime/components/window/DesktopCoreWindow.vue +0 -215
  54. package/runtime/components/window/DesktopCoreWindowContent.vue +0 -28
  55. package/runtime/components/window/DesktopCoreWindowNav.vue +0 -66
  56. package/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue +0 -74
  57. package/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue +0 -84
  58. package/runtime/composables/useApplicationEntries.ts +0 -51
  59. package/runtime/composables/useApplicationManager.ts +0 -285
  60. package/runtime/composables/useBlockNonInputContextMenu.ts +0 -30
  61. package/runtime/composables/useDesktopConfig.ts +0 -8
  62. package/runtime/composables/useDesktopDialogs.ts +0 -16
  63. package/runtime/composables/useDesktopExtension.ts +0 -8
  64. package/runtime/composables/useDesktopManager.ts +0 -51
  65. package/runtime/composables/useDesktopManifest.ts +0 -17
  66. package/runtime/composables/useDesktopSession.ts +0 -27
  67. package/runtime/composables/useDesktopShellIdentity.ts +0 -99
  68. package/runtime/composables/useDesktopShellOptions.ts +0 -36
  69. package/runtime/composables/useDesktopShellReady.ts +0 -7
  70. package/runtime/composables/useDesktopWorkArea.ts +0 -93
  71. package/runtime/composables/useTerminalManager.ts +0 -159
  72. package/runtime/composables/useToggleWindowMaximize.ts +0 -35
  73. package/runtime/composables/useWindowDragHandlers.ts +0 -47
  74. package/runtime/composables/useWindowSnapDrop.ts +0 -112
  75. package/runtime/composables/useWorkspaceEdgeDrop.ts +0 -176
  76. package/runtime/composables/useWorkspaceManager.ts +0 -67
  77. package/runtime/composables/useWorkspaceOverviewCapture.ts +0 -92
  78. package/runtime/composables/useWorkspaceOverviewLiveScale.ts +0 -151
  79. package/runtime/constants/desktopShellKeys.ts +0 -12
  80. package/runtime/constants/shellLayout.ts +0 -5
  81. package/runtime/dialogs/desktopDialogProvider.ts +0 -73
  82. package/runtime/internal/controllers/ApplicationController.ts +0 -351
  83. package/runtime/internal/controllers/WindowController.ts +0 -547
  84. package/runtime/plugins/01.desktop-shell-init.client.ts +0 -28
  85. package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +0 -13
  86. package/runtime/plugins/resize.client.ts +0 -6
  87. package/runtime/stores/storeApplicationMeta.ts +0 -60
  88. package/runtime/stores/storeApplicationWindows.ts +0 -21
  89. package/runtime/stores/storeDesktop.ts +0 -71
  90. package/runtime/stores/storeDesktopDefaultApps.ts +0 -54
  91. package/runtime/stores/storeDesktopVolume.ts +0 -19
  92. package/runtime/stores/storeDesktopWindow.ts +0 -38
  93. package/runtime/stores/storeDesktopWorkspace.ts +0 -105
  94. package/runtime/stores/storeIds.ts +0 -35
  95. package/runtime/types/desktopMenu.ts +0 -10
  96. package/runtime/utils/initDesktopShell.ts +0 -80
  97. package/runtime/utils/migratePersistedStoreIds.ts +0 -57
  98. package/runtime/utils/utilApp.ts +0 -25
  99. package/runtime/utils/utilCaptureElementToCanvas.ts +0 -21
  100. package/runtime/utils/utilCommon.ts +0 -26
  101. package/runtime/utils/utilDebug.ts +0 -30
  102. package/runtime/utils/utilDetectSnapZone.ts +0 -57
  103. package/runtime/utils/utilTerminal.ts +0 -6
  104. package/runtime/utils/utilWindowControllerAdapter.ts +0 -15
  105. package/runtime/utils/utilWindowLayout.ts +0 -82
  106. package/runtime/utils/utilWindowMaximizeLayout.ts +0 -44
  107. package/runtime/utils/utilWorkspaceWindows.ts +0 -33
  108. package/types/index.d.ts +0 -531
package/kit/authoring.ts DELETED
@@ -1,340 +0,0 @@
1
- import { existsSync } from 'node:fs'
2
- import { join } from 'node:path'
3
-
4
- import {
5
- defineNuxtModule,
6
- installModule,
7
- type NuxtModule,
8
- } from '@nuxt/kit'
9
- import type { Nuxt } from '@nuxt/schema'
10
- import { defu } from 'defu'
11
-
12
- /** Root `desktop.config.ts` helper — keep this file free of `import.meta` for jiti. */
13
- export function defineDesktopConfig(config: DesktopConfig) {
14
- return config
15
- }
16
-
17
- /**
18
- * Runtime validation for the object exported from `desktop.config.ts`
19
- * (or legacy `owd.config.ts`).
20
- */
21
- export function assertValidDesktopUserConfig(
22
- config: unknown,
23
- configFile = 'desktop.config.ts',
24
- ): void {
25
- if (!config || typeof config !== 'object' || Array.isArray(config)) {
26
- throw new Error(
27
- `[@owdproject/core] ${configFile} must default-export a non-array object from defineDesktopConfig({ ... }).`,
28
- )
29
- }
30
-
31
- const c = config as Record<string, unknown>
32
-
33
- if (c.theme != null && typeof c.theme !== 'string') {
34
- throw new Error(
35
- `[@owdproject/core] ${configFile}: \`theme\` must be a string (npm package name of the theme module).`,
36
- )
37
- }
38
-
39
- if (c.apps !== undefined) {
40
- if (
41
- !Array.isArray(c.apps) ||
42
- !(c.apps as unknown[]).every((item) => typeof item === 'string')
43
- ) {
44
- throw new Error(
45
- `[@owdproject/core] ${configFile}: \`apps\` must be an array of strings (Nuxt module package names).`,
46
- )
47
- }
48
- }
49
-
50
- if (c.modules !== undefined) {
51
- if (
52
- !Array.isArray(c.modules) ||
53
- !(c.modules as unknown[]).every((item) => typeof item === 'string')
54
- ) {
55
- throw new Error(
56
- `[@owdproject/core] ${configFile}: \`modules\` must be an array of strings (Nuxt module package names).`,
57
- )
58
- }
59
- }
60
- }
61
-
62
- export const DESKTOP_CONFIG_FILENAME = 'desktop.config.ts'
63
- export const LEGACY_DESKTOP_CONFIG_FILENAME = 'owd.config.ts'
64
-
65
- export const LEGACY_CONFIG_DEPRECATION =
66
- '[@owdproject/core] owd.config.ts is deprecated and kept only for backward compatibility; rename to desktop.config.ts (required from @owdproject/core 3.2).'
67
-
68
- export type ResolvedDesktopConfigPath = {
69
- path: string
70
- file: string
71
- legacy: boolean
72
- }
73
-
74
- export function resolveDesktopConfigPath(
75
- rootDir: string,
76
- ): ResolvedDesktopConfigPath | null {
77
- const desktopPath = join(rootDir, DESKTOP_CONFIG_FILENAME)
78
- const legacyPath = join(rootDir, LEGACY_DESKTOP_CONFIG_FILENAME)
79
- const hasDesktop = existsSync(desktopPath)
80
- const hasLegacy = existsSync(legacyPath)
81
-
82
- if (hasDesktop && hasLegacy) {
83
- console.warn(
84
- '[@owdproject/core] Both desktop.config.ts and owd.config.ts exist; using desktop.config.ts. Remove owd.config.ts.',
85
- )
86
- return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false }
87
- }
88
-
89
- if (hasDesktop) {
90
- return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false }
91
- }
92
-
93
- if (hasLegacy) {
94
- return {
95
- path: legacyPath,
96
- file: LEGACY_DESKTOP_CONFIG_FILENAME,
97
- legacy: true,
98
- }
99
- }
100
-
101
- return null
102
- }
103
-
104
- export function warnLegacyDesktopConfig(
105
- resolved: ResolvedDesktopConfigPath | null | undefined,
106
- ): void {
107
- if (resolved?.legacy) {
108
- console.warn(LEGACY_CONFIG_DEPRECATION)
109
- }
110
- }
111
-
112
- /** Path used when creating or updating config from the CLI (always the new filename). */
113
- export function desktopConfigWritePath(desktopDir: string): string {
114
- return join(desktopDir, DESKTOP_CONFIG_FILENAME)
115
- }
116
-
117
- /** Nuxt top-level option names — warn if present in desktop.config (likely misconfiguration). */
118
- const NUXT_OPTION_KEYS = new Set([
119
- 'ssr',
120
- 'devtools',
121
- 'vite',
122
- 'nitro',
123
- 'runtimeConfig',
124
- 'app',
125
- 'appConfig',
126
- 'css',
127
- 'plugins',
128
- 'hooks',
129
- 'extends',
130
- 'compatibilityDate',
131
- 'experimental',
132
- 'future',
133
- 'i18n',
134
- 'tailwindcss',
135
- 'primevue',
136
- ])
137
-
138
- /**
139
- * Warn when desktop.config.ts contains keys that look like Nuxt options.
140
- * Extension keys (fs, terminal, custom app namespaces) are intentionally not validated here.
141
- */
142
- export function warnDesktopConfigKeys(
143
- config: Record<string, unknown>,
144
- configFile = 'desktop.config.ts',
145
- ): void {
146
- for (const key of Object.keys(config)) {
147
- if (NUXT_OPTION_KEYS.has(key)) {
148
- console.warn(
149
- `[@owdproject/core] ${configFile}: key "${key}" looks like a Nuxt option and is ignored for _nuxt.options. Move it to nuxt.config.ts; shell values belong under defineDesktopConfig({ systemBar, workspaces, ... }).`,
150
- )
151
- }
152
- }
153
- }
154
-
155
- /**
156
- * Writes a resolved extension namespace to `runtimeConfig.public.desktop[configKey]`.
157
- * Used by {@link defineDesktopModule} after Nuxt merges inline options with module defaults.
158
- */
159
- export function setDesktopExtensionConfig(
160
- nuxt: Nuxt,
161
- configKey: string,
162
- resolved: Record<string, unknown>,
163
- ): void {
164
- const pub = (nuxt.options.runtimeConfig.public ??= {}) as {
165
- desktop?: Record<string, unknown>
166
- }
167
- const desktop = (pub.desktop ??= {})
168
- desktop[configKey] = resolved
169
- }
170
-
171
- /**
172
- * Merges theme or module defaults into an extension namespace on `public.desktop`.
173
- * User values from desktop.config win over `partial` (defu: partial fills undefined only).
174
- */
175
- export function mergeDesktopExtensionConfig(
176
- nuxt: Nuxt,
177
- configKey: string,
178
- partial: Record<string, unknown>,
179
- ): void {
180
- const pub = (nuxt.options.runtimeConfig.public ??= {}) as {
181
- desktop?: Record<string, unknown>
182
- }
183
- const desktop = (pub.desktop ??= {})
184
- const existing = desktop[configKey]
185
- const base =
186
- existing && typeof existing === 'object' && !Array.isArray(existing)
187
- ? (existing as Record<string, unknown>)
188
- : {}
189
- desktop[configKey] = defu(partial, base)
190
- }
191
-
192
- type ModuleLike = {
193
- meta?: { configKey?: string }
194
- default?: { meta?: { configKey?: string } }
195
- }
196
-
197
- function readConfigKey(mod: ModuleLike | undefined): string | undefined {
198
- const key = mod?.meta?.configKey ?? mod?.default?.meta?.configKey
199
- return typeof key === 'string' && key.length > 0 ? key : undefined
200
- }
201
-
202
- async function loadModuleDescriptor(
203
- modulePath: string,
204
- ): Promise<ModuleLike | undefined> {
205
- try {
206
- const imported = await import(modulePath)
207
- return (imported as { default?: ModuleLike }).default ?? imported
208
- } catch (e: any) {
209
- console.warn(`[@owdproject/core] Failed to load module descriptor for "${modulePath}":`, e.message || e)
210
- return undefined
211
- }
212
- }
213
-
214
- /**
215
- * Installs a desktop theme, module, or app package.
216
- * When the package exposes `meta.configKey`, passes `desktop[configKey]` to `installModule`
217
- * so Nuxt merges desktop.config with module defaults.
218
- */
219
- export async function installDesktopPackage(
220
- nuxt: Nuxt,
221
- modulePath: string,
222
- desktop?: Record<string, unknown>,
223
- ): Promise<void> {
224
- const descriptor = await loadModuleDescriptor(modulePath)
225
- const configKey = readConfigKey(descriptor)
226
-
227
- if (configKey && desktop) {
228
- const slice = desktop[configKey]
229
- const inline =
230
- slice && typeof slice === 'object' && !Array.isArray(slice)
231
- ? (slice as Record<string, unknown>)
232
- : {}
233
- await installModule(modulePath, inline)
234
- return
235
- }
236
-
237
- await installModule(modulePath)
238
- }
239
-
240
- type DesktopModuleMeta = {
241
- name: string
242
- configKey: string
243
- }
244
-
245
- type DesktopModuleDefinition = NuxtModule<
246
- Record<string, unknown>,
247
- Record<string, unknown>,
248
- false
249
- > & {
250
- meta: DesktopModuleMeta
251
- }
252
-
253
- /**
254
- * Nuxt module wrapper for desktop apps and extension modules (`configKey` → desktop.config namespace).
255
- * Publishes merged options to `runtimeConfig.public.desktop[configKey]` after setup runs.
256
- */
257
- export function defineDesktopModule(
258
- definition: DesktopModuleDefinition,
259
- ): ReturnType<typeof defineNuxtModule> {
260
- const configKey = definition.meta.configKey
261
- if (!configKey) {
262
- throw new Error(
263
- '[@owdproject/core] defineDesktopModule requires meta.configKey (e.g. "terminal", "fs").',
264
- )
265
- }
266
-
267
- const userSetup = definition.setup
268
-
269
- return defineNuxtModule({
270
- ...definition,
271
- async setup(options, nuxt) {
272
- const pub = (nuxt.options.runtimeConfig.public ??= {}) as {
273
- desktop?: Record<string, unknown>
274
- }
275
- const desktop = (pub.desktop ??= {})
276
- const userConfig = desktop[configKey]
277
-
278
- // Merge userConfig (wins) with options (defaults / inline)
279
- const merged = defu(
280
- userConfig && typeof userConfig === 'object' ? userConfig : {},
281
- options as Record<string, unknown>,
282
- )
283
-
284
- // Mutate options in place so userSetup receives the fully merged options
285
- Object.assign(options, merged)
286
-
287
- // Set/update the merged config on public.desktop
288
- desktop[configKey] = options
289
-
290
- if (typeof userSetup === 'function') {
291
- return userSetup(options, nuxt)
292
- }
293
- },
294
- } as NuxtModule)
295
- }
296
-
297
- type DesktopThemeDefinition = NuxtModule<
298
- Record<string, unknown>,
299
- Record<string, unknown>,
300
- false
301
- >
302
-
303
- /**
304
- * Nuxt module wrapper for desktop themes.
305
- * Merges theme shell defaults into `runtimeConfig.public.desktop` (user desktop.config wins).
306
- *
307
- * Tailwind content for theme Vue templates is registered via
308
- * `@owdproject/kit-primevue/kit/registerTailwindPath` after installing kit-primevue.
309
- */
310
- export function defineDesktopTheme(
311
- definition: DesktopThemeDefinition,
312
- ): ReturnType<typeof defineNuxtModule> {
313
- const userSetup = definition.setup
314
-
315
- return defineNuxtModule({
316
- ...definition,
317
- meta: {
318
- ...definition.meta,
319
- configKey: 'desktop',
320
- },
321
- async setup(options, nuxt) {
322
- const pub = (nuxt.options.runtimeConfig.public ??= {}) as {
323
- desktop?: Record<string, unknown>
324
- }
325
-
326
- // Automatically merge userConfig (pub.desktop) with theme defaults (options)
327
- pub.desktop = defu(
328
- (pub.desktop ?? {}) as Record<string, unknown>,
329
- options as Record<string, unknown>,
330
- )
331
-
332
- // Mutate options in place so userSetup receives the fully merged options
333
- Object.assign(options, pub.desktop)
334
-
335
- if (typeof userSetup === 'function') {
336
- return userSetup(options, nuxt)
337
- }
338
- },
339
- } as NuxtModule)
340
- }
@@ -1,56 +0,0 @@
1
- import { getActivePinia, setActivePinia } from 'pinia'
2
- import type { Pinia } from 'pinia'
3
- import { useApplicationManager } from '../runtime/composables/useApplicationManager'
4
-
5
- const pendingDesktopApps: ApplicationConfig[] = []
6
-
7
- let pluginPiniaInstance: Pinia | undefined
8
-
9
- /** Set by desktop-shell-init; avoids importing nuxt/app during jiti config load. */
10
- export function registerDesktopPluginPinia(pinia: Pinia | undefined) {
11
- pluginPiniaInstance = pinia
12
- }
13
-
14
- function resolveActivePinia() {
15
- const active = getActivePinia()
16
- if (active) return active
17
-
18
- if (pluginPiniaInstance) {
19
- setActivePinia(pluginPiniaInstance)
20
- return pluginPiniaInstance
21
- }
22
-
23
- return undefined
24
- }
25
-
26
- let isBooted = false
27
-
28
- /**
29
- * Register a desktop app. Queues until Pinia is active when theme/app plugins
30
- * run before shell-init (legacy published apps using synchronous setup).
31
- */
32
- export async function defineDesktopApp(config: ApplicationConfig) {
33
- if (import.meta.server) return undefined
34
-
35
- if (isBooted && resolveActivePinia()) {
36
- const applicationManager = useApplicationManager()
37
- return applicationManager.defineApp(config.id, config)
38
- }
39
-
40
- pendingDesktopApps.push(config)
41
- return undefined
42
- }
43
-
44
- export async function flushPendingDesktopApps() {
45
- isBooted = true
46
- if (pendingDesktopApps.length === 0) return
47
-
48
- if (!resolveActivePinia()) return
49
-
50
- const queue = pendingDesktopApps.splice(0, pendingDesktopApps.length)
51
- const applicationManager = useApplicationManager()
52
-
53
- for (const config of queue) {
54
- await applicationManager.defineApp(config.id, config)
55
- }
56
- }
package/module.ts DELETED
@@ -1,203 +0,0 @@
1
- import {
2
- defineNuxtModule,
3
- createResolver,
4
- addComponentsDir,
5
- addImportsDir,
6
- installModule,
7
- addPlugin,
8
- resolvePath
9
- } from '@nuxt/kit'
10
- import { defu } from 'defu'
11
- import {
12
- assertValidDesktopUserConfig,
13
- installDesktopPackage,
14
- resolveDesktopConfigPath,
15
- warnDesktopConfigKeys,
16
- warnLegacyDesktopConfig,
17
- } from './kit/authoring'
18
- import pkg from './package.json'
19
-
20
- export default defineNuxtModule({
21
- meta: {
22
- name: 'desktop',
23
- configKey: 'desktop',
24
- },
25
- defaults: {
26
- theme: '@owdproject/theme-nova',
27
- apps: [],
28
- modules: [],
29
- },
30
- moduleDependencies: {
31
- '@pinia/nuxt': {},
32
- '@nuxt/fonts': {},
33
- '@nuxt/icon': {
34
- defaults: {
35
- clientBundle: {
36
- scan: true,
37
- sizeLimitKb: 256,
38
- },
39
- },
40
- },
41
- '@vueuse/nuxt': {},
42
- '@nuxtjs/i18n': {},
43
- },
44
- async setup(_options, _nuxt) {
45
- const { resolve } = createResolver(import.meta.url)
46
-
47
- let resolvedNanoid: string | null = null
48
- try {
49
- resolvedNanoid = await resolvePath('nanoid', { url: import.meta.url })
50
- } catch (e) {
51
- // ignore
52
- }
53
-
54
- // Required for Nuxt 4 dev (playgrounds, module graphs): avoids
55
- // "Vite Node IPC socket path not configured" when using @nuxt/kit pipelines.
56
- _nuxt.options.experimental = {
57
- ..._nuxt.options.experimental,
58
- viteEnvironmentApi:
59
- _nuxt.options.experimental?.viteEnvironmentApi ?? true,
60
- }
61
-
62
- _nuxt.options.runtimeConfig.public.desktop = {}
63
-
64
- // get open web desktop config (desktop.config.ts; owd.config.ts legacy)
65
-
66
- let clientConfig
67
-
68
- const resolvedConfig = resolveDesktopConfigPath(_nuxt.options.rootDir)
69
-
70
- if (!resolvedConfig) {
71
- const hint =
72
- 'Create desktop.config.ts next to your Nuxt root (e.g. desktop/desktop.config.ts), export default defineDesktopConfig({ theme, apps, modules }).'
73
- throw new Error(`[@owdproject/core] Cannot find desktop.config.ts in ${_nuxt.options.rootDir}. ${hint}`)
74
- }
75
-
76
- warnLegacyDesktopConfig(resolvedConfig)
77
-
78
- // Nuxt dev restart + ℹ log (same as nuxt.config.ts); avoid builder:watch + restart (silent / double).
79
- _nuxt.options.watch ??= []
80
- _nuxt.options.watch.push(resolvedConfig.path)
81
-
82
- try {
83
- clientConfig = (await import(resolvedConfig.path)).default
84
- } catch (e) {
85
- const hint =
86
- 'Export default defineDesktopConfig({ theme, apps, modules }) from desktop.config.ts.'
87
- throw new Error(
88
- `[@owdproject/core] Cannot load ${resolvedConfig.file}. ${hint}`,
89
- { cause: e },
90
- )
91
- }
92
-
93
- assertValidDesktopUserConfig(clientConfig, resolvedConfig.file)
94
-
95
- if (!clientConfig.theme) {
96
- clientConfig.theme = '@owdproject/theme-nova'
97
- }
98
-
99
- const configRecord = clientConfig as Record<string, unknown>
100
- warnDesktopConfigKeys(configRecord, resolvedConfig.file)
101
-
102
- const desktop = defu(configRecord, { coreVersion: pkg.version }) as Record<
103
- string,
104
- unknown
105
- > & {
106
- theme?: string
107
- apps?: string[]
108
- modules?: string[]
109
- }
110
-
111
- _nuxt.options.runtimeConfig.public.desktop = desktop
112
-
113
- {
114
- if (desktop.theme) {
115
- try {
116
- await installDesktopPackage(_nuxt, desktop.theme, desktop)
117
- } catch (e) {
118
- const msg = e instanceof Error ? e.message : String(e)
119
- console.warn(`[@owdproject/core] Warning: Could not load theme "${desktop.theme}". Details: ${msg}`)
120
- }
121
- }
122
-
123
- if (Array.isArray(desktop.modules)) {
124
- for (const modulePath of desktop.modules) {
125
- try {
126
- await installDesktopPackage(_nuxt, modulePath, desktop)
127
- } catch (e) {
128
- const msg = e instanceof Error ? e.message : String(e)
129
- console.warn(`[@owdproject/core] Warning: Could not load module "${modulePath}". Details: ${msg}`)
130
- }
131
- }
132
- }
133
-
134
- if (Array.isArray(desktop.apps)) {
135
- for (const appPath of desktop.apps) {
136
- try {
137
- await installDesktopPackage(_nuxt, appPath, desktop)
138
- } catch (e) {
139
- const msg = e instanceof Error ? e.message : String(e)
140
- console.warn(`[@owdproject/core] Warning: Could not load app "${appPath}". Details: ${msg}`)
141
- }
142
- }
143
- }
144
- }
145
-
146
- // assign runtimeConfig desktop prop to appConfig
147
- // to make it overwritable by components later
148
- // via useDesktopManager
149
- _nuxt.options.appConfig.desktop = _nuxt.options.runtimeConfig.public.desktop
150
-
151
- {
152
- // configure scss for vite
153
-
154
- _nuxt.hook('vite:extendConfig', (viteConfig) => {
155
- viteConfig.css = viteConfig.css || {}
156
- viteConfig.css.preprocessorOptions =
157
- viteConfig.css.preprocessorOptions || {}
158
- viteConfig.css.preprocessorOptions.scss = {
159
- api: 'modern-compiler'
160
- }
161
-
162
- viteConfig.optimizeDeps = viteConfig.optimizeDeps || {}
163
- viteConfig.optimizeDeps.include = viteConfig.optimizeDeps.include || []
164
- if (resolvedNanoid && !viteConfig.optimizeDeps.include.includes(resolvedNanoid)) {
165
- viteConfig.optimizeDeps.include.push(resolvedNanoid)
166
- }
167
- })
168
- }
169
-
170
- {
171
- // add css
172
-
173
- _nuxt.options.css.push('sanitize.css')
174
- }
175
-
176
- {
177
- // add components
178
-
179
- addComponentsDir({
180
- path: resolve('./runtime/components'),
181
- prefix: 'Desktop',
182
- pathPrefix: false,
183
- global: true
184
- })
185
- }
186
-
187
- {
188
- addPlugin(resolve('./runtime/plugins/resize.client.ts'))
189
- addPlugin(
190
- resolve('./runtime/plugins/01.desktop-shell-init.client.ts'),
191
- )
192
- addPlugin(
193
- resolve('./runtime/plugins/02.desktop-register-desktop-apps.client.ts'),
194
- )
195
-
196
- // add other files
197
-
198
- addImportsDir(resolve('./runtime/composables'))
199
- addImportsDir(resolve('./runtime/stores'))
200
- addImportsDir(resolve('./runtime/utils'))
201
- }
202
- }
203
- })
@@ -1,20 +0,0 @@
1
- <script setup lang="ts">
2
- import { useApplicationManager } from '../../composables/useApplicationManager'
3
-
4
- defineProps<{
5
- workspaceFilter?: string
6
- }>()
7
-
8
- const applicationManager = useApplicationManager()
9
- const runningApps = applicationManager.appsRunning
10
- </script>
11
-
12
- <template>
13
- <DesktopCoreApplicationWindowsRender
14
- v-for="app of runningApps"
15
- :key="app.id"
16
- :workspace-filter="workspaceFilter"
17
- :windows="app.windowsOpened"
18
- :window-revision="app.openWindowCount.value"
19
- />
20
- </template>
@@ -1,38 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed } from 'vue'
3
- import { useDesktopWorkspaceStore } from '../../stores/storeDesktopWorkspace'
4
-
5
- const props = defineProps<{
6
- workspaceFilter?: string
7
- windows: Map<string, IWindowController>
8
- /** Tracks ApplicationController.openWindowCount so Vue re-renders when the map is replaced. */
9
- windowRevision?: number
10
- }>()
11
-
12
- const desktopWorkspaceStore = useDesktopWorkspaceStore()
13
-
14
- const windowEntries = computed(() => {
15
- void props.windowRevision
16
- return Array.from(props.windows.entries())
17
- })
18
-
19
- function matchesWorkspace(window: IWindowController): boolean {
20
- const filter = props.workspaceFilter
21
- if (!filter) return true
22
-
23
- const ws = window.state.workspace
24
- if (!ws) {
25
- return filter === desktopWorkspaceStore.active
26
- }
27
-
28
- return ws === filter
29
- }
30
- </script>
31
-
32
- <template>
33
- <template v-for="[windowId, window] in windowEntries" :key="windowId">
34
- <Suspense v-if="matchesWorkspace(window)">
35
- <component :window="window" :is="window.config.component" />
36
- </Suspense>
37
- </template>
38
- </template>
@@ -1,16 +0,0 @@
1
- <template>
2
- <div class="owd-background">
3
- <slot />
4
- </div>
5
- </template>
6
-
7
- <style scoped lang="scss">
8
- .owd-background {
9
- position: fixed;
10
- top: 0;
11
- left: 0;
12
- right: 0;
13
- bottom: 0;
14
- background-color: var(--owd-background-color);
15
- }
16
- </style>