@owdproject/core 3.3.1 → 4.0.0-alpha.3

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 (93) hide show
  1. package/README.md +91 -59
  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 +117 -0
  18. package/dist/managers/index.d.ts +117 -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.B0B0KfVK.mjs +865 -0
  24. package/dist/shared/core.B1XxB289.mjs +239 -0
  25. package/dist/shared/core.B3mp7ztE.mjs +237 -0
  26. package/dist/shared/core.BOvFdEVQ.d.ts +114 -0
  27. package/dist/shared/core.CsDFgGnX.mjs +40 -0
  28. package/dist/shared/core.Di1eFcr_.d.mts +114 -0
  29. package/dist/shared/core.Pd_Ogt4g.mjs +101 -0
  30. package/dist/shared/core.b3Xldzyu.mjs +29 -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 +60 -87
  35. package/bin/cli.js +0 -395
  36. package/bin/desktop.js +0 -5
  37. package/bin/lib/catalog.js +0 -293
  38. package/bin/lib/config.js +0 -109
  39. package/bin/lib/desktopConfig.js +0 -56
  40. package/bin/lib/generateTemplate.js +0 -389
  41. package/bin/lib/install.js +0 -408
  42. package/bin/lib/migrateModulePlayground.config.mjs +0 -164
  43. package/bin/lib/migrateModulePlayground.mjs +0 -313
  44. package/bin/lib/npmVersions.js +0 -124
  45. package/bin/lib/playgroundContext.js +0 -188
  46. package/bin/lib/scaffold.js +0 -197
  47. package/bin/lib/status.js +0 -289
  48. package/bin/lib/validateModule.js +0 -697
  49. package/bin/lib/workspace.js +0 -182
  50. package/bin/owd.js +0 -5
  51. package/bin/tui.js +0 -1379
  52. package/dist/module.d.mts +0 -13
  53. package/dist/module.json +0 -9
  54. package/dist/module.mjs +0 -268
  55. package/dist/types.d.mts +0 -7
  56. package/index.ts +0 -5
  57. package/module.ts +0 -223
  58. package/runtime/components/Desktop/Application/DesktopApplicationRender.vue +0 -20
  59. package/runtime/components/Desktop/Application/DesktopApplicationWindowsRender.vue +0 -38
  60. package/runtime/components/Desktop/Background/DesktopBackground.vue +0 -16
  61. package/runtime/components/Desktop/Core/DesktopCore.vue +0 -90
  62. package/runtime/components/Desktop/Time/DesktopTime.vue +0 -56
  63. package/runtime/components/Desktop/Window/DesktopWindow.vue +0 -204
  64. package/runtime/components/Desktop/Window/DesktopWindowContent.vue +0 -28
  65. package/runtime/components/Desktop/Window/DesktopWindowNav.vue +0 -66
  66. package/runtime/composables/useApplicationEntries.ts +0 -51
  67. package/runtime/composables/useApplicationManager.ts +0 -285
  68. package/runtime/composables/useDesktopManager.ts +0 -49
  69. package/runtime/composables/useTerminalManager.ts +0 -66
  70. package/runtime/composables/useWorkspaceManager.ts +0 -41
  71. package/runtime/internal/controllers/ApplicationController.ts +0 -345
  72. package/runtime/internal/controllers/WindowController.ts +0 -462
  73. package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +0 -17
  74. package/runtime/plugins/resize.client.ts +0 -6
  75. package/runtime/stores/storeApplicationMeta.ts +0 -59
  76. package/runtime/stores/storeApplicationWindows.ts +0 -20
  77. package/runtime/stores/storeDesktop.ts +0 -111
  78. package/runtime/stores/storeDesktopDefaultApps.ts +0 -53
  79. package/runtime/stores/storeDesktopVolume.ts +0 -18
  80. package/runtime/stores/storeDesktopWindow.ts +0 -20
  81. package/runtime/stores/storeDesktopWorkspace.ts +0 -75
  82. package/runtime/utils/captureElementToCanvas.ts +0 -21
  83. package/runtime/utils/explorerEntryPath.ts +0 -10
  84. package/runtime/utils/resolveDesktopConfigPath.ts +0 -52
  85. package/runtime/utils/splitDesktopUserConfig.ts +0 -85
  86. package/runtime/utils/utilApp.ts +0 -37
  87. package/runtime/utils/utilCommon.ts +0 -26
  88. package/runtime/utils/utilDebug.ts +0 -30
  89. package/runtime/utils/utilDesktop.ts +0 -35
  90. package/runtime/utils/utilTerminal.ts +0 -6
  91. package/runtime/utils/utilWindow.ts +0 -15
  92. package/runtime/utils/validateDesktopUserConfig.ts +0 -44
  93. package/types/index.d.ts +0 -420
package/dist/module.d.mts DELETED
@@ -1,13 +0,0 @@
1
- import * as _nuxt_schema from '@nuxt/schema';
2
-
3
- declare const _default: _nuxt_schema.NuxtModule<{
4
- theme: string;
5
- apps: never[];
6
- modules: never[];
7
- }, {
8
- theme: string;
9
- apps: never[];
10
- modules: never[];
11
- }, false>;
12
-
13
- export { _default as default };
package/dist/module.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "name": "desktop",
3
- "configKey": "owd",
4
- "version": "3.3.1",
5
- "builder": {
6
- "@nuxt/module-builder": "1.0.2",
7
- "unbuild": "3.6.1"
8
- }
9
- }
package/dist/module.mjs DELETED
@@ -1,268 +0,0 @@
1
- import { defineNuxtModule, createResolver, installModule, addComponentsDir, addPlugin, addImportsDir } from '@nuxt/kit';
2
- import { defu } from 'defu';
3
- import { existsSync } from 'node:fs';
4
- import { join } from 'node:path';
5
-
6
- function assertValidDesktopUserConfig(config, configFile = "desktop.config.ts") {
7
- if (!config || typeof config !== "object" || Array.isArray(config)) {
8
- throw new Error(
9
- `[@owdproject/core] ${configFile} must default-export a non-array object from defineDesktopConfig({ ... }).`
10
- );
11
- }
12
- const c = config;
13
- if (c.theme != null && typeof c.theme !== "string") {
14
- throw new Error(
15
- `[@owdproject/core] ${configFile}: \`theme\` must be a string (npm package name of the theme module).`
16
- );
17
- }
18
- if (c.apps !== void 0) {
19
- if (!Array.isArray(c.apps) || !c.apps.every((item) => typeof item === "string")) {
20
- throw new Error(
21
- `[@owdproject/core] ${configFile}: \`apps\` must be an array of strings (Nuxt module package names).`
22
- );
23
- }
24
- }
25
- if (c.modules !== void 0) {
26
- if (!Array.isArray(c.modules) || !c.modules.every((item) => typeof item === "string")) {
27
- throw new Error(
28
- `[@owdproject/core] ${configFile}: \`modules\` must be an array of strings (Nuxt module package names).`
29
- );
30
- }
31
- }
32
- }
33
-
34
- const DESKTOP_CONFIG_FILENAME = "desktop.config.ts";
35
- const LEGACY_DESKTOP_CONFIG_FILENAME = "owd.config.ts";
36
- const LEGACY_CONFIG_DEPRECATION = "[@owdproject/core] owd.config.ts is deprecated and kept only for backward compatibility; rename to desktop.config.ts (required from @owdproject/core 3.2).";
37
- function resolveDesktopConfigPath(rootDir) {
38
- const desktopPath = join(rootDir, DESKTOP_CONFIG_FILENAME);
39
- const legacyPath = join(rootDir, LEGACY_DESKTOP_CONFIG_FILENAME);
40
- const hasDesktop = existsSync(desktopPath);
41
- const hasLegacy = existsSync(legacyPath);
42
- if (hasDesktop && hasLegacy) {
43
- console.warn(
44
- "[@owdproject/core] Both desktop.config.ts and owd.config.ts exist; using desktop.config.ts. Remove owd.config.ts."
45
- );
46
- return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false };
47
- }
48
- if (hasDesktop) {
49
- return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false };
50
- }
51
- if (hasLegacy) {
52
- return {
53
- path: legacyPath,
54
- file: LEGACY_DESKTOP_CONFIG_FILENAME,
55
- legacy: true
56
- };
57
- }
58
- return null;
59
- }
60
- function warnLegacyDesktopConfig(resolved) {
61
- if (resolved?.legacy) {
62
- console.warn(LEGACY_CONFIG_DEPRECATION);
63
- }
64
- }
65
-
66
- const DESKTOP_MODULE_KEYS = ["theme", "apps", "modules"];
67
- const DESKTOP_RUNTIME_KEYS = /* @__PURE__ */ new Set([
68
- ...DESKTOP_MODULE_KEYS,
69
- "docs",
70
- "name",
71
- "defaultApps",
72
- "features",
73
- "explorer",
74
- "systemBar",
75
- "dockBar",
76
- "workspaces"
77
- ]);
78
- const NUXT_OPTION_KEYS = /* @__PURE__ */ new Set([
79
- "ssr",
80
- "modules",
81
- "devtools",
82
- "vite",
83
- "nitro",
84
- "runtimeConfig",
85
- "app",
86
- "appConfig",
87
- "css",
88
- "plugins",
89
- "hooks",
90
- "extends",
91
- "compatibilityDate",
92
- "experimental",
93
- "future",
94
- "i18n",
95
- "tailwindcss",
96
- "primevue"
97
- ]);
98
- function splitDesktopUserConfig(config, configFile = "desktop.config.ts") {
99
- const theme = typeof config.theme === "string" ? config.theme : void 0;
100
- const apps = Array.isArray(config.apps) ? config.apps : void 0;
101
- const modules = Array.isArray(config.modules) ? config.modules : void 0;
102
- const desktopRuntime = {};
103
- for (const [key, value] of Object.entries(config)) {
104
- if (DESKTOP_MODULE_KEYS.includes(key)) {
105
- continue;
106
- }
107
- desktopRuntime[key] = value;
108
- if (NUXT_OPTION_KEYS.has(key)) {
109
- console.warn(
110
- `[@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, ... }).`
111
- );
112
- } else if (!DESKTOP_RUNTIME_KEYS.has(key)) {
113
- console.warn(
114
- `[@owdproject/core] ${configFile}: unknown desktop key "${key}" \u2014 merged into runtimeConfig.public.desktop only.`
115
- );
116
- }
117
- }
118
- return { theme, apps, modules, desktopRuntime };
119
- }
120
-
121
- const version = "3.3.1";
122
- const pkg = {
123
- version: version};
124
-
125
- function primevueModuleDependency(nuxt) {
126
- const existing = nuxt.options.primevue ?? {};
127
- const components = { ...existing.components ?? {} };
128
- const include = components.include;
129
- if (include && include !== "*" && Array.isArray(include) && !include.includes("ConfirmDialog")) {
130
- components.include = [...include, "ConfirmDialog"];
131
- }
132
- return {
133
- defaults: defu(
134
- {
135
- options: { theme: {} },
136
- components
137
- },
138
- existing
139
- )
140
- };
141
- }
142
- const module$1 = defineNuxtModule({
143
- meta: {
144
- name: "desktop",
145
- configKey: "owd"
146
- },
147
- defaults: {
148
- theme: "@owdproject/theme-nova",
149
- apps: [],
150
- modules: []
151
- },
152
- moduleDependencies: (nuxt) => ({
153
- "@pinia/nuxt": {},
154
- "@primevue/nuxt-module": primevueModuleDependency(nuxt),
155
- "@nuxt/fonts": {},
156
- "@nuxt/icon": {
157
- defaults: {
158
- clientBundle: {
159
- scan: true,
160
- sizeLimitKb: 256
161
- }
162
- }
163
- },
164
- "@vueuse/nuxt": {},
165
- "@nuxtjs/i18n": {}
166
- }),
167
- async setup(_options, _nuxt) {
168
- const { resolve } = createResolver(import.meta.url);
169
- _nuxt.options.experimental = {
170
- ..._nuxt.options.experimental,
171
- viteEnvironmentApi: _nuxt.options.experimental?.viteEnvironmentApi ?? true
172
- };
173
- _nuxt.options.runtimeConfig.public.desktop = {};
174
- let clientConfig;
175
- const resolvedConfig = resolveDesktopConfigPath(_nuxt.options.rootDir);
176
- if (!resolvedConfig) {
177
- const hint = "Create desktop.config.ts next to your Nuxt root (e.g. desktop/desktop.config.ts), export default defineDesktopConfig({ theme, apps, modules }).";
178
- throw new Error(`[@owdproject/core] Cannot find desktop.config.ts in ${_nuxt.options.rootDir}. ${hint}`);
179
- }
180
- warnLegacyDesktopConfig(resolvedConfig);
181
- try {
182
- clientConfig = (await import(resolvedConfig.path)).default;
183
- } catch (e) {
184
- const hint = "Export default defineDesktopConfig({ theme, apps, modules }) from desktop.config.ts.";
185
- throw new Error(
186
- `[@owdproject/core] Cannot load ${resolvedConfig.file}. ${hint}`,
187
- { cause: e }
188
- );
189
- }
190
- assertValidDesktopUserConfig(clientConfig, resolvedConfig.file);
191
- if (!clientConfig.theme) {
192
- clientConfig.theme = "@owdproject/theme-nova";
193
- }
194
- const {
195
- theme: configTheme,
196
- apps: configApps,
197
- modules: configModules,
198
- desktopRuntime
199
- } = splitDesktopUserConfig(
200
- clientConfig,
201
- resolvedConfig.file
202
- );
203
- clientConfig.theme = configTheme ?? clientConfig.theme;
204
- if (configApps) clientConfig.apps = configApps;
205
- if (configModules) clientConfig.modules = configModules;
206
- _nuxt.options.runtimeConfig.public.desktop = defu(
207
- desktopRuntime,
208
- { coreVersion: pkg.version }
209
- );
210
- {
211
- if (clientConfig.theme) {
212
- await installModule(clientConfig.theme);
213
- }
214
- if (clientConfig.modules && Array.isArray(clientConfig.modules)) {
215
- for (const modulePath of clientConfig.modules) {
216
- await installModule(modulePath);
217
- }
218
- }
219
- if (clientConfig.apps && Array.isArray(clientConfig.apps)) {
220
- for (const appPath of clientConfig.apps) {
221
- await installModule(appPath);
222
- }
223
- }
224
- }
225
- _nuxt.options.appConfig.desktop = _nuxt.options.runtimeConfig.public.desktop;
226
- {
227
- const tailwindPaths = _nuxt.options.runtimeConfig.app.owd?.tailwindPaths || [];
228
- tailwindPaths.push("./runtime/components/**/*.{vue,mjs,ts}");
229
- _nuxt.options.tailwindcss = _nuxt.options.tailwindcss || {};
230
- _nuxt.options.tailwindcss.config = _nuxt.options.tailwindcss.config || {};
231
- _nuxt.options.tailwindcss.config.content = tailwindPaths;
232
- await installModule("@nuxtjs/tailwindcss", {
233
- viewer: false
234
- });
235
- }
236
- {
237
- _nuxt.hook("vite:extendConfig", (viteConfig) => {
238
- viteConfig.css = viteConfig.css || {};
239
- viteConfig.css.preprocessorOptions = viteConfig.css.preprocessorOptions || {};
240
- viteConfig.css.preprocessorOptions.scss = {
241
- api: "modern-compiler"
242
- };
243
- });
244
- }
245
- {
246
- _nuxt.options.css.push("sanitize.css");
247
- }
248
- {
249
- addComponentsDir({
250
- path: resolve("./runtime/components"),
251
- prefix: "",
252
- pathPrefix: false,
253
- global: true
254
- });
255
- }
256
- {
257
- addPlugin(resolve("./runtime/plugins/resize.client.ts"));
258
- addPlugin(
259
- resolve("./runtime/plugins/02.desktop-register-desktop-apps.client.ts")
260
- );
261
- addImportsDir(resolve("./runtime/composables"));
262
- addImportsDir(resolve("./runtime/stores"));
263
- addImportsDir(resolve("./runtime/utils"));
264
- }
265
- }
266
- });
267
-
268
- export { module$1 as default };
package/dist/types.d.mts DELETED
@@ -1,7 +0,0 @@
1
- import type { NuxtModule } from '@nuxt/schema'
2
-
3
- import type { default as Module } from './module.mjs'
4
-
5
- export type ModuleOptions = typeof Module extends NuxtModule<infer O> ? Partial<O> : Record<string, any>
6
-
7
- export { default } from './module.mjs'
package/index.ts DELETED
@@ -1,5 +0,0 @@
1
- export {
2
- defineDesktopApp,
3
- defineDesktopConfig,
4
- } from './runtime/utils/utilDesktop'
5
- export { registerTailwindPath } from './runtime/utils/utilApp'
package/module.ts DELETED
@@ -1,223 +0,0 @@
1
- import {
2
- defineNuxtModule,
3
- createResolver,
4
- addComponentsDir,
5
- addImportsDir,
6
- installModule,
7
- addPlugin
8
- } from '@nuxt/kit'
9
- import { defu } from 'defu'
10
- import type { Nuxt } from '@nuxt/schema'
11
- import { assertValidDesktopUserConfig } from './runtime/utils/validateDesktopUserConfig'
12
- import {
13
- resolveDesktopConfigPath,
14
- warnLegacyDesktopConfig,
15
- } from './runtime/utils/resolveDesktopConfigPath'
16
- import { splitDesktopUserConfig } from './runtime/utils/splitDesktopUserConfig'
17
- import pkg from './package.json'
18
-
19
- function primevueModuleDependency(nuxt: Nuxt) {
20
- const existing = nuxt.options.primevue ?? {}
21
- const components = { ...(existing.components ?? {}) }
22
- const include = components.include
23
- if (
24
- include &&
25
- include !== '*' &&
26
- Array.isArray(include) &&
27
- !include.includes('ConfirmDialog')
28
- ) {
29
- components.include = [...include, 'ConfirmDialog']
30
- }
31
-
32
- return {
33
- defaults: defu(
34
- {
35
- options: { theme: {} },
36
- components,
37
- },
38
- existing,
39
- ),
40
- }
41
- }
42
-
43
- export default defineNuxtModule({
44
- meta: {
45
- name: 'desktop',
46
- configKey: 'owd',
47
- },
48
- defaults: {
49
- theme: '@owdproject/theme-nova',
50
- apps: [],
51
- modules: [],
52
- },
53
- moduleDependencies: (nuxt) => ({
54
- '@pinia/nuxt': {},
55
- '@primevue/nuxt-module': primevueModuleDependency(nuxt),
56
- '@nuxt/fonts': {},
57
- '@nuxt/icon': {
58
- defaults: {
59
- clientBundle: {
60
- scan: true,
61
- sizeLimitKb: 256,
62
- },
63
- },
64
- },
65
- '@vueuse/nuxt': {},
66
- '@nuxtjs/i18n': {},
67
- }),
68
- async setup(_options, _nuxt) {
69
- const { resolve } = createResolver(import.meta.url)
70
-
71
- // Required for Nuxt 4 dev (playgrounds, module graphs): avoids
72
- // "Vite Node IPC socket path not configured" when using @nuxt/kit pipelines.
73
- _nuxt.options.experimental = {
74
- ..._nuxt.options.experimental,
75
- viteEnvironmentApi:
76
- _nuxt.options.experimental?.viteEnvironmentApi ?? true,
77
- }
78
-
79
- _nuxt.options.runtimeConfig.public.desktop = {}
80
-
81
- // get open web desktop config (desktop.config.ts; owd.config.ts legacy)
82
-
83
- let clientConfig
84
-
85
- const resolvedConfig = resolveDesktopConfigPath(_nuxt.options.rootDir)
86
-
87
- if (!resolvedConfig) {
88
- const hint =
89
- 'Create desktop.config.ts next to your Nuxt root (e.g. desktop/desktop.config.ts), export default defineDesktopConfig({ theme, apps, modules }).'
90
- throw new Error(`[@owdproject/core] Cannot find desktop.config.ts in ${_nuxt.options.rootDir}. ${hint}`)
91
- }
92
-
93
- warnLegacyDesktopConfig(resolvedConfig)
94
-
95
- try {
96
- clientConfig = (await import(resolvedConfig.path)).default
97
- } catch (e) {
98
- const hint =
99
- 'Export default defineDesktopConfig({ theme, apps, modules }) from desktop.config.ts.'
100
- throw new Error(
101
- `[@owdproject/core] Cannot load ${resolvedConfig.file}. ${hint}`,
102
- { cause: e },
103
- )
104
- }
105
-
106
- assertValidDesktopUserConfig(clientConfig, resolvedConfig.file)
107
-
108
- if (!clientConfig.theme) {
109
- clientConfig.theme = '@owdproject/theme-nova'
110
- }
111
-
112
- const {
113
- theme: configTheme,
114
- apps: configApps,
115
- modules: configModules,
116
- desktopRuntime,
117
- } = splitDesktopUserConfig(
118
- clientConfig as Record<string, unknown>,
119
- resolvedConfig.file,
120
- )
121
-
122
- clientConfig.theme = configTheme ?? clientConfig.theme
123
- if (configApps) clientConfig.apps = configApps
124
- if (configModules) clientConfig.modules = configModules
125
-
126
- // init desktop runtime config and define core version
127
-
128
- _nuxt.options.runtimeConfig.public.desktop = defu(
129
- desktopRuntime,
130
- { coreVersion: pkg.version },
131
- )
132
-
133
- {
134
- // install open web desktop theme
135
-
136
- if (clientConfig.theme) {
137
- await installModule(clientConfig.theme)
138
- }
139
-
140
- // install open web desktop modules
141
-
142
- if (clientConfig.modules && Array.isArray(clientConfig.modules)) {
143
- for (const modulePath of clientConfig.modules) {
144
- await installModule(modulePath)
145
- }
146
- }
147
-
148
- // install open web desktop apps
149
-
150
- if (clientConfig.apps && Array.isArray(clientConfig.apps)) {
151
- for (const appPath of clientConfig.apps) {
152
- await installModule(appPath)
153
- }
154
- }
155
-
156
- }
157
-
158
- // assign runtimeConfig desktop prop to appConfig
159
- // to make it overwritable by components later
160
- // via useDesktopManager
161
- _nuxt.options.appConfig.desktop = _nuxt.options.runtimeConfig.public.desktop
162
-
163
- {
164
- // Tailwind after theme/apps so registerTailwindPath paths are collected first.
165
-
166
- const tailwindPaths =
167
- _nuxt.options.runtimeConfig.app.owd?.tailwindPaths || []
168
- tailwindPaths.push('./runtime/components/**/*.{vue,mjs,ts}') // Aggiungi sempre questo al core
169
-
170
- _nuxt.options.tailwindcss = _nuxt.options.tailwindcss || {}
171
- _nuxt.options.tailwindcss.config = _nuxt.options.tailwindcss.config || {}
172
- // @ts-ignore
173
- _nuxt.options.tailwindcss.config.content = tailwindPaths
174
-
175
- await installModule('@nuxtjs/tailwindcss', {
176
- viewer: false
177
- })
178
- }
179
-
180
- {
181
- // configure scss for vite
182
-
183
- _nuxt.hook('vite:extendConfig', (viteConfig) => {
184
- viteConfig.css = viteConfig.css || {}
185
- viteConfig.css.preprocessorOptions =
186
- viteConfig.css.preprocessorOptions || {}
187
- viteConfig.css.preprocessorOptions.scss = {
188
- api: 'modern-compiler'
189
- }
190
- })
191
- }
192
-
193
- {
194
- // add css
195
-
196
- _nuxt.options.css.push('sanitize.css')
197
- }
198
-
199
- {
200
- // add components
201
-
202
- addComponentsDir({
203
- path: resolve('./runtime/components'),
204
- prefix: '',
205
- pathPrefix: false,
206
- global: true
207
- })
208
- }
209
-
210
- {
211
- addPlugin(resolve('./runtime/plugins/resize.client.ts'))
212
- addPlugin(
213
- resolve('./runtime/plugins/02.desktop-register-desktop-apps.client.ts'),
214
- )
215
-
216
- // add other files
217
-
218
- addImportsDir(resolve('./runtime/composables'))
219
- addImportsDir(resolve('./runtime/stores'))
220
- addImportsDir(resolve('./runtime/utils'))
221
- }
222
- }
223
- })
@@ -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
- <DesktopApplicationWindowsRender
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>
@@ -1,90 +0,0 @@
1
- <script setup lang="ts">
2
- import { onBeforeMount, onMounted, onUnmounted } from 'vue'
3
- import { useAppConfig, useRuntimeConfig } from 'nuxt/app'
4
- import { computed, toRaw } from '@vue/reactivity'
5
- import { useDesktopManager } from '../../../composables/useDesktopManager'
6
- import { useDesktopStore } from '../../../stores/storeDesktop'
7
- import { useDesktopDefaultAppsStore } from '../../../stores/storeDesktopDefaultApps'
8
- import { useDesktopWorkspaceStore } from '../../../stores/storeDesktopWorkspace'
9
-
10
- const props = withDefaults(
11
- defineProps<{
12
- windows?: DesktopWindowsConfig
13
- systemBar?: DesktopSystemBarConfig
14
- dockBar?: DesktopDockBarConfig
15
- workspaces?: DesktopWorkspacesConfig
16
- }>(),
17
- {
18
- windows: {
19
- position: 'fixed',
20
- },
21
- systemBar: {},
22
- dockBar: {},
23
- workspaces: {},
24
- },
25
- )
26
-
27
- // todo move to owd initialization
28
- // perhaps in a plugin
29
-
30
- const appConfig = useAppConfig()
31
- const desktopManager = useDesktopManager()
32
- const desktopDefaultAppsStore = useDesktopDefaultAppsStore()
33
- const runtimeConfig = useRuntimeConfig()
34
-
35
- // create firsts workspaces if not available
36
- const desktopStore = useDesktopStore()
37
- const desktopWorkspaceStore = useDesktopWorkspaceStore()
38
-
39
- if (desktopStore.$persistedState) {
40
- desktopStore.$persistedState.isReady().then(() => {
41
- desktopWorkspaceStore.setupWorkspaces()
42
- })
43
- } else {
44
- desktopWorkspaceStore.setupWorkspaces()
45
- }
46
-
47
- // override desktop configurations
48
- desktopManager.setConfig({
49
- windows: toRaw(props.windows),
50
- systemBar: toRaw(props.systemBar),
51
- dockBar: toRaw(props.dockBar),
52
- workspaces: toRaw(props.workspaces),
53
- })
54
-
55
- // desktop resize
56
- // todo move to composable
57
-
58
- onMounted(() => window.addEventListener('resize', handleDesktopResize))
59
- onUnmounted(() => window.removeEventListener('resize', handleDesktopResize))
60
-
61
- function handleDesktopResize() {
62
- //store.dispatch('core/window/windowsAdjustPosition')
63
- }
64
-
65
- const classes = computed(() => {
66
- const list = ['owd-desktop']
67
-
68
- list.push(`owd-desktop--${appConfig.desktop.name}`)
69
-
70
- return list
71
- })
72
-
73
- onBeforeMount(() => {
74
- desktopDefaultAppsStore.loadDefaultAppsFromConfig(runtimeConfig)
75
- })
76
- </script>
77
-
78
- <template>
79
- <div :class="classes">
80
- <slot />
81
- </div>
82
- </template>
83
-
84
- <style scoped lang="scss">
85
- .owd-desktop {
86
- width: 100vw;
87
- height: 100dvh;
88
- user-select: none;
89
- }
90
- </style>