@owdproject/core 3.1.4 → 3.3.0
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.
- package/README.md +6 -6
- package/bin/cli.js +395 -0
- package/bin/desktop.js +5 -0
- package/bin/lib/catalog.js +293 -0
- package/bin/lib/config.js +109 -0
- package/bin/lib/desktopConfig.js +56 -0
- package/bin/lib/generateTemplate.js +389 -0
- package/bin/lib/install.js +408 -0
- package/bin/lib/migrateModulePlayground.config.mjs +164 -0
- package/bin/lib/migrateModulePlayground.mjs +313 -0
- package/bin/lib/npmVersions.js +124 -0
- package/bin/lib/playgroundContext.js +188 -0
- package/bin/lib/scaffold.js +197 -0
- package/bin/lib/status.js +289 -0
- package/bin/lib/validateModule.js +697 -0
- package/bin/lib/workspace.js +182 -0
- package/bin/owd.js +2 -25
- package/bin/tui.js +1379 -0
- package/dist/module.d.mts +13 -0
- package/dist/module.json +9 -0
- package/dist/module.mjs +267 -0
- package/dist/types.d.mts +7 -0
- package/module.ts +69 -32
- package/package.json +81 -22
- package/runtime/components/{Core/Application/CoreApplicationRender.vue → Desktop/Application/DesktopApplicationRender.vue} +4 -2
- package/runtime/components/Desktop/Application/DesktopApplicationWindowsRender.vue +38 -0
- package/runtime/components/{Core/Window/CoreWindow.vue → Desktop/Window/DesktopWindow.vue} +42 -8
- package/runtime/components/{Core/Window/CoreWindowNav.vue → Desktop/Window/DesktopWindowNav.vue} +26 -8
- package/runtime/composables/useApplicationManager.ts +19 -14
- package/runtime/composables/useDesktopManager.ts +33 -9
- package/runtime/composables/useWorkspaceManager.ts +41 -0
- package/runtime/{core → internal}/controllers/ApplicationController.ts +114 -24
- package/runtime/{core → internal}/controllers/WindowController.ts +4 -9
- package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +17 -0
- package/runtime/stores/storeApplicationMeta.ts +56 -12
- package/runtime/stores/storeDesktop.ts +68 -2
- package/runtime/stores/storeDesktopDefaultApps.ts +2 -2
- package/runtime/stores/storeDesktopWorkspace.ts +14 -2
- package/runtime/utils/captureElementToCanvas.ts +21 -0
- package/runtime/utils/explorerEntryPath.ts +10 -0
- package/runtime/utils/resolveDesktopConfigPath.ts +52 -0
- package/runtime/utils/splitDesktopUserConfig.ts +85 -0
- package/runtime/utils/utilCommon.ts +0 -32
- package/runtime/utils/utilDesktop.ts +27 -2
- package/runtime/utils/validateDesktopUserConfig.ts +44 -0
- package/types/index.d.ts +45 -12
- package/CHANGELOG.md +0 -25
- package/project.json +0 -4
- package/runtime/components/Core/Application/CoreApplicationWindowsRender.vue +0 -19
- package/runtime/components/Core/Explorer/CoreExplorerFile.vue +0 -76
- package/runtime/components/Core/Explorer/CoreExplorerFolder.vue +0 -10
- package/runtime/stores/storeApplication.ts +0 -236
- package/test/basic.test.ts +0 -15
- package/test/fixtures/basic/app.vue +0 -5
- package/test/fixtures/basic/nuxt.config.ts +0 -5
- package/test/fixtures/basic/package.json +0 -5
- package/tsconfig.app.json +0 -31
- package/tsconfig.json +0 -12
- package/tsconfig.spec.json +0 -37
- package/vitest.config.ts +0 -24
- /package/runtime/components/{Core/Background/CoreBackground.vue → Desktop/Background/DesktopBackground.vue} +0 -0
- /package/runtime/components/{Core/Desktop/CoreDesktop.vue → Desktop/Core/DesktopCore.vue} +0 -0
- /package/runtime/components/{Core/Time/CoreTime.vue → Desktop/Time/DesktopTime.vue} +0 -0
- /package/runtime/components/{Core/Window/CoreWindowContent.vue → Desktop/Window/DesktopWindowContent.vue} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
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
ADDED
package/dist/module.mjs
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
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.0";
|
|
122
|
+
const pkg = {
|
|
123
|
+
version: version};
|
|
124
|
+
|
|
125
|
+
const module$1 = defineNuxtModule({
|
|
126
|
+
meta: {
|
|
127
|
+
name: "desktop",
|
|
128
|
+
configKey: "owd"
|
|
129
|
+
},
|
|
130
|
+
defaults: {
|
|
131
|
+
theme: "@owdproject/theme-nova",
|
|
132
|
+
apps: [],
|
|
133
|
+
modules: []
|
|
134
|
+
},
|
|
135
|
+
async setup(_options, _nuxt) {
|
|
136
|
+
const { resolve } = createResolver(import.meta.url);
|
|
137
|
+
_nuxt.options.experimental = {
|
|
138
|
+
..._nuxt.options.experimental,
|
|
139
|
+
viteEnvironmentApi: _nuxt.options.experimental?.viteEnvironmentApi ?? true
|
|
140
|
+
};
|
|
141
|
+
_nuxt.options.runtimeConfig.public.desktop = {};
|
|
142
|
+
let clientConfig;
|
|
143
|
+
const resolvedConfig = resolveDesktopConfigPath(_nuxt.options.rootDir);
|
|
144
|
+
if (!resolvedConfig) {
|
|
145
|
+
const hint = "Create desktop.config.ts next to your Nuxt root (e.g. desktop/desktop.config.ts), export default defineDesktopConfig({ theme, apps, modules }).";
|
|
146
|
+
throw new Error(`[@owdproject/core] Cannot find desktop.config.ts in ${_nuxt.options.rootDir}. ${hint}`);
|
|
147
|
+
}
|
|
148
|
+
warnLegacyDesktopConfig(resolvedConfig);
|
|
149
|
+
try {
|
|
150
|
+
clientConfig = (await import(resolvedConfig.path)).default;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
const hint = "Export default defineDesktopConfig({ theme, apps, modules }) from desktop.config.ts.";
|
|
153
|
+
throw new Error(
|
|
154
|
+
`[@owdproject/core] Cannot load ${resolvedConfig.file}. ${hint}`,
|
|
155
|
+
{ cause: e }
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
assertValidDesktopUserConfig(clientConfig, resolvedConfig.file);
|
|
159
|
+
if (!clientConfig.theme) {
|
|
160
|
+
clientConfig.theme = "@owdproject/theme-nova";
|
|
161
|
+
}
|
|
162
|
+
const {
|
|
163
|
+
theme: configTheme,
|
|
164
|
+
apps: configApps,
|
|
165
|
+
modules: configModules,
|
|
166
|
+
desktopRuntime
|
|
167
|
+
} = splitDesktopUserConfig(
|
|
168
|
+
clientConfig,
|
|
169
|
+
resolvedConfig.file
|
|
170
|
+
);
|
|
171
|
+
clientConfig.theme = configTheme ?? clientConfig.theme;
|
|
172
|
+
if (configApps) clientConfig.apps = configApps;
|
|
173
|
+
if (configModules) clientConfig.modules = configModules;
|
|
174
|
+
_nuxt.options.runtimeConfig.public.desktop = defu(
|
|
175
|
+
desktopRuntime,
|
|
176
|
+
{ coreVersion: pkg.version }
|
|
177
|
+
);
|
|
178
|
+
await installModule("@pinia/nuxt");
|
|
179
|
+
{
|
|
180
|
+
if (clientConfig.theme) {
|
|
181
|
+
await installModule(clientConfig.theme);
|
|
182
|
+
}
|
|
183
|
+
if (clientConfig.modules && Array.isArray(clientConfig.modules)) {
|
|
184
|
+
for (const modulePath of clientConfig.modules) {
|
|
185
|
+
await installModule(modulePath);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (clientConfig.apps && Array.isArray(clientConfig.apps)) {
|
|
189
|
+
for (const appPath of clientConfig.apps) {
|
|
190
|
+
await installModule(appPath);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
_nuxt.options.appConfig.desktop = _nuxt.options.runtimeConfig.public.desktop;
|
|
195
|
+
{
|
|
196
|
+
_nuxt.options.primevue = _nuxt.options.primevue || {};
|
|
197
|
+
_nuxt.options.primevue.options = _nuxt.options.primevue.options || {};
|
|
198
|
+
_nuxt.options.primevue.options.theme = _nuxt.options.primevue.options.theme || {};
|
|
199
|
+
_nuxt.options.primevue.components = _nuxt.options.primevue.components || {};
|
|
200
|
+
const include = _nuxt.options.primevue.components.include;
|
|
201
|
+
if (include && include !== "*" && Array.isArray(include)) {
|
|
202
|
+
if (!include.includes("ConfirmDialog")) {
|
|
203
|
+
include.push("ConfirmDialog");
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
await installModule("@primevue/nuxt-module");
|
|
207
|
+
}
|
|
208
|
+
{
|
|
209
|
+
const tailwindPaths = _nuxt.options.runtimeConfig.app.owd?.tailwindPaths || [];
|
|
210
|
+
tailwindPaths.push("./runtime/components/**/*.{vue,mjs,ts}");
|
|
211
|
+
_nuxt.options.tailwindcss = _nuxt.options.tailwindcss || {};
|
|
212
|
+
_nuxt.options.tailwindcss.config = _nuxt.options.tailwindcss.config || {};
|
|
213
|
+
_nuxt.options.tailwindcss.config.content = tailwindPaths;
|
|
214
|
+
await installModule("@nuxtjs/tailwindcss", {
|
|
215
|
+
viewer: false
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
{
|
|
219
|
+
await installModule("@nuxt/fonts");
|
|
220
|
+
}
|
|
221
|
+
{
|
|
222
|
+
await installModule("@nuxt/icon", {
|
|
223
|
+
clientBundle: {
|
|
224
|
+
scan: true,
|
|
225
|
+
sizeLimitKb: 256
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
{
|
|
230
|
+
await installModule("@vueuse/nuxt");
|
|
231
|
+
}
|
|
232
|
+
{
|
|
233
|
+
await installModule("@nuxtjs/i18n");
|
|
234
|
+
}
|
|
235
|
+
{
|
|
236
|
+
_nuxt.hook("vite:extendConfig", (viteConfig) => {
|
|
237
|
+
viteConfig.css = viteConfig.css || {};
|
|
238
|
+
viteConfig.css.preprocessorOptions = viteConfig.css.preprocessorOptions || {};
|
|
239
|
+
viteConfig.css.preprocessorOptions.scss = {
|
|
240
|
+
api: "modern-compiler"
|
|
241
|
+
};
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
{
|
|
245
|
+
_nuxt.options.css.push("sanitize.css");
|
|
246
|
+
}
|
|
247
|
+
{
|
|
248
|
+
addComponentsDir({
|
|
249
|
+
path: resolve("./runtime/components"),
|
|
250
|
+
prefix: "",
|
|
251
|
+
pathPrefix: false,
|
|
252
|
+
global: true
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
{
|
|
256
|
+
addPlugin(resolve("./runtime/plugins/resize.client.ts"));
|
|
257
|
+
addPlugin(
|
|
258
|
+
resolve("./runtime/plugins/02.desktop-register-desktop-apps.client.ts")
|
|
259
|
+
);
|
|
260
|
+
addImportsDir(resolve("./runtime/composables"));
|
|
261
|
+
addImportsDir(resolve("./runtime/stores"));
|
|
262
|
+
addImportsDir(resolve("./runtime/utils"));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
export { module$1 as default };
|
package/dist/types.d.mts
ADDED
package/module.ts
CHANGED
|
@@ -6,62 +6,94 @@ import {
|
|
|
6
6
|
installModule,
|
|
7
7
|
addPlugin
|
|
8
8
|
} from '@nuxt/kit'
|
|
9
|
-
import {
|
|
9
|
+
import { defu } from 'defu'
|
|
10
|
+
import { assertValidDesktopUserConfig } from './runtime/utils/validateDesktopUserConfig'
|
|
11
|
+
import {
|
|
12
|
+
resolveDesktopConfigPath,
|
|
13
|
+
warnLegacyDesktopConfig,
|
|
14
|
+
} from './runtime/utils/resolveDesktopConfigPath'
|
|
15
|
+
import { splitDesktopUserConfig } from './runtime/utils/splitDesktopUserConfig'
|
|
10
16
|
import pkg from './package.json'
|
|
11
17
|
|
|
12
18
|
export default defineNuxtModule({
|
|
13
19
|
meta: {
|
|
14
|
-
name: '
|
|
15
|
-
configKey: 'owd'
|
|
20
|
+
name: 'desktop',
|
|
21
|
+
configKey: 'owd',
|
|
16
22
|
},
|
|
17
23
|
defaults: {
|
|
18
|
-
theme: '@owdproject/theme-
|
|
24
|
+
theme: '@owdproject/theme-nova',
|
|
19
25
|
apps: [],
|
|
20
26
|
modules: [],
|
|
21
27
|
},
|
|
22
28
|
async setup(_options, _nuxt) {
|
|
23
29
|
const { resolve } = createResolver(import.meta.url)
|
|
24
30
|
|
|
31
|
+
// Required for Nuxt 4 dev (playgrounds, module graphs): avoids
|
|
32
|
+
// "Vite Node IPC socket path not configured" when using @nuxt/kit pipelines.
|
|
33
|
+
_nuxt.options.experimental = {
|
|
34
|
+
..._nuxt.options.experimental,
|
|
35
|
+
viteEnvironmentApi:
|
|
36
|
+
_nuxt.options.experimental?.viteEnvironmentApi ?? true,
|
|
37
|
+
}
|
|
38
|
+
|
|
25
39
|
_nuxt.options.runtimeConfig.public.desktop = {}
|
|
26
40
|
|
|
27
|
-
// get open web desktop config
|
|
41
|
+
// get open web desktop config (desktop.config.ts; owd.config.ts legacy)
|
|
28
42
|
|
|
29
43
|
let clientConfig
|
|
30
44
|
|
|
31
|
-
|
|
45
|
+
const resolvedConfig = resolveDesktopConfigPath(_nuxt.options.rootDir)
|
|
46
|
+
|
|
47
|
+
if (!resolvedConfig) {
|
|
48
|
+
const hint =
|
|
49
|
+
'Create desktop.config.ts next to your Nuxt root (e.g. desktop/desktop.config.ts), export default defineDesktopConfig({ theme, apps, modules }).'
|
|
50
|
+
throw new Error(`[@owdproject/core] Cannot find desktop.config.ts in ${_nuxt.options.rootDir}. ${hint}`)
|
|
51
|
+
}
|
|
32
52
|
|
|
33
|
-
|
|
34
|
-
await import(_nuxt.options.rootDir + '/owd.config.ts')
|
|
35
|
-
).default
|
|
53
|
+
warnLegacyDesktopConfig(resolvedConfig)
|
|
36
54
|
|
|
55
|
+
try {
|
|
56
|
+
clientConfig = (await import(resolvedConfig.path)).default
|
|
37
57
|
} catch (e) {
|
|
38
|
-
|
|
39
|
-
|
|
58
|
+
const hint =
|
|
59
|
+
'Export default defineDesktopConfig({ theme, apps, modules }) from desktop.config.ts.'
|
|
60
|
+
throw new Error(
|
|
61
|
+
`[@owdproject/core] Cannot load ${resolvedConfig.file}. ${hint}`,
|
|
62
|
+
{ cause: e },
|
|
63
|
+
)
|
|
40
64
|
}
|
|
41
65
|
|
|
66
|
+
assertValidDesktopUserConfig(clientConfig, resolvedConfig.file)
|
|
67
|
+
|
|
42
68
|
if (!clientConfig.theme) {
|
|
43
|
-
clientConfig.theme = '@owdproject/theme-
|
|
69
|
+
clientConfig.theme = '@owdproject/theme-nova'
|
|
44
70
|
}
|
|
45
71
|
|
|
46
|
-
|
|
72
|
+
const {
|
|
73
|
+
theme: configTheme,
|
|
74
|
+
apps: configApps,
|
|
75
|
+
modules: configModules,
|
|
76
|
+
desktopRuntime,
|
|
77
|
+
} = splitDesktopUserConfig(
|
|
78
|
+
clientConfig as Record<string, unknown>,
|
|
79
|
+
resolvedConfig.file,
|
|
80
|
+
)
|
|
47
81
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
82
|
+
clientConfig.theme = configTheme ?? clientConfig.theme
|
|
83
|
+
if (configApps) clientConfig.apps = configApps
|
|
84
|
+
if (configModules) clientConfig.modules = configModules
|
|
52
85
|
|
|
53
86
|
// init desktop runtime config and define core version
|
|
54
87
|
|
|
55
|
-
_nuxt.options.runtimeConfig.public.desktop =
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
// assign open web desktop config to runtime config
|
|
60
|
-
_nuxt.options.runtimeConfig.public.desktop = deepMerge(
|
|
61
|
-
_nuxt.options.runtimeConfig.public.desktop,
|
|
62
|
-
clientConfig
|
|
88
|
+
_nuxt.options.runtimeConfig.public.desktop = defu(
|
|
89
|
+
desktopRuntime,
|
|
90
|
+
{ coreVersion: pkg.version },
|
|
63
91
|
)
|
|
64
92
|
|
|
93
|
+
// Pinia before theme/modules/apps so defineDesktopApp can use stores when
|
|
94
|
+
// published app plugins register on app:created.
|
|
95
|
+
await installModule('@pinia/nuxt')
|
|
96
|
+
|
|
65
97
|
{
|
|
66
98
|
// install open web desktop theme
|
|
67
99
|
|
|
@@ -99,6 +131,14 @@ export default defineNuxtModule({
|
|
|
99
131
|
_nuxt.options.primevue.options = _nuxt.options.primevue.options || {}
|
|
100
132
|
_nuxt.options.primevue.options.theme =
|
|
101
133
|
_nuxt.options.primevue.options.theme || {}
|
|
134
|
+
_nuxt.options.primevue.components =
|
|
135
|
+
_nuxt.options.primevue.components || {}
|
|
136
|
+
const include = _nuxt.options.primevue.components.include
|
|
137
|
+
if (include && include !== '*' && Array.isArray(include)) {
|
|
138
|
+
if (!include.includes('ConfirmDialog')) {
|
|
139
|
+
include.push('ConfirmDialog')
|
|
140
|
+
}
|
|
141
|
+
}
|
|
102
142
|
|
|
103
143
|
await installModule('@primevue/nuxt-module')
|
|
104
144
|
}
|
|
@@ -120,12 +160,6 @@ export default defineNuxtModule({
|
|
|
120
160
|
})
|
|
121
161
|
}
|
|
122
162
|
|
|
123
|
-
{
|
|
124
|
-
// install pinia
|
|
125
|
-
|
|
126
|
-
await installModule('@pinia/nuxt')
|
|
127
|
-
}
|
|
128
|
-
|
|
129
163
|
{
|
|
130
164
|
// install @nuxt/fonts
|
|
131
165
|
|
|
@@ -180,17 +214,20 @@ export default defineNuxtModule({
|
|
|
180
214
|
addComponentsDir({
|
|
181
215
|
path: resolve('./runtime/components'),
|
|
182
216
|
prefix: '',
|
|
217
|
+
pathPrefix: false,
|
|
183
218
|
global: true
|
|
184
219
|
})
|
|
185
220
|
}
|
|
186
221
|
|
|
187
222
|
{
|
|
188
223
|
addPlugin(resolve('./runtime/plugins/resize.client.ts'))
|
|
224
|
+
addPlugin(
|
|
225
|
+
resolve('./runtime/plugins/02.desktop-register-desktop-apps.client.ts'),
|
|
226
|
+
)
|
|
189
227
|
|
|
190
228
|
// add other files
|
|
191
229
|
|
|
192
230
|
addImportsDir(resolve('./runtime/composables'))
|
|
193
|
-
addImportsDir(resolve('./runtime/core'))
|
|
194
231
|
addImportsDir(resolve('./runtime/stores'))
|
|
195
232
|
addImportsDir(resolve('./runtime/utils'))
|
|
196
233
|
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owdproject/core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
|
+
"description": "Nuxt Desktop module for browser desktop experiences (windows, shell, apps)",
|
|
4
5
|
"keywords": [
|
|
5
|
-
"web",
|
|
6
|
-
"desktop",
|
|
7
|
-
"vue",
|
|
8
6
|
"nuxt",
|
|
7
|
+
"nuxt-module",
|
|
8
|
+
"nuxt-desktop",
|
|
9
|
+
"desktop",
|
|
9
10
|
"web-desktop",
|
|
10
|
-
"
|
|
11
|
+
"vue",
|
|
12
|
+
"owd",
|
|
13
|
+
"open-web-desktop"
|
|
11
14
|
],
|
|
12
15
|
"homepage": "https://github.com/owdproject/client#readme",
|
|
13
16
|
"bugs": {
|
|
@@ -24,30 +27,86 @@
|
|
|
24
27
|
},
|
|
25
28
|
"type": "module",
|
|
26
29
|
"types": "types/index.d.ts",
|
|
30
|
+
"files": [
|
|
31
|
+
"bin",
|
|
32
|
+
"dist",
|
|
33
|
+
"runtime",
|
|
34
|
+
"types",
|
|
35
|
+
"index.ts",
|
|
36
|
+
"module.ts",
|
|
37
|
+
"package.json",
|
|
38
|
+
"README.md"
|
|
39
|
+
],
|
|
40
|
+
"scripts": {
|
|
41
|
+
"dev": "pnpm run dev:prepare",
|
|
42
|
+
"dev:prepare": "nuxt-module-build build --stub",
|
|
43
|
+
"build:module": "nuxt-module-build build",
|
|
44
|
+
"prepack": "nuxt-module-build build",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"test:watch": "vitest"
|
|
47
|
+
},
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./types/index.d.ts",
|
|
51
|
+
"default": "./index.ts"
|
|
52
|
+
},
|
|
53
|
+
"./module": {
|
|
54
|
+
"types": "./dist/types.d.mts",
|
|
55
|
+
"development": "./module.ts",
|
|
56
|
+
"import": "./module.ts",
|
|
57
|
+
"default": "./module.ts"
|
|
58
|
+
},
|
|
59
|
+
"./nuxt": {
|
|
60
|
+
"types": "./dist/types.d.mts",
|
|
61
|
+
"development": "./module.ts",
|
|
62
|
+
"import": "./module.ts",
|
|
63
|
+
"default": "./module.ts"
|
|
64
|
+
},
|
|
65
|
+
"./package.json": "./package.json",
|
|
66
|
+
"./runtime/*": {
|
|
67
|
+
"types": "./runtime/*",
|
|
68
|
+
"development": "./runtime/*",
|
|
69
|
+
"import": "./runtime/*",
|
|
70
|
+
"default": "./runtime/*"
|
|
71
|
+
}
|
|
72
|
+
},
|
|
27
73
|
"bin": {
|
|
74
|
+
"desktop": "bin/desktop.js",
|
|
28
75
|
"owd": "bin/owd.js"
|
|
29
76
|
},
|
|
30
77
|
"dependencies": {
|
|
31
|
-
"@nuxt/fonts": "^0.
|
|
32
|
-
"@nuxt/icon": "^
|
|
33
|
-
"@nuxt/kit": "^
|
|
34
|
-
"@nuxtjs/i18n": "^
|
|
78
|
+
"@nuxt/fonts": "^0.14.0",
|
|
79
|
+
"@nuxt/icon": "^2.2.1",
|
|
80
|
+
"@nuxt/kit": "^4.4.4",
|
|
81
|
+
"@nuxtjs/i18n": "^10.3.0",
|
|
35
82
|
"@nuxtjs/tailwindcss": "^6.14.0",
|
|
36
|
-
"@pinia/nuxt": "^0.11.
|
|
37
|
-
"@primeuix/themes": "^
|
|
38
|
-
"@primevue/forms": "^4.
|
|
39
|
-
"@primevue/nuxt-module": "^4.
|
|
40
|
-
"@vueuse/components": "^
|
|
41
|
-
"@vueuse/core": "^
|
|
42
|
-
"@vueuse/nuxt": "^
|
|
83
|
+
"@pinia/nuxt": "^0.11.3",
|
|
84
|
+
"@primeuix/themes": "^2.0.3",
|
|
85
|
+
"@primevue/forms": "^4.5.5",
|
|
86
|
+
"@primevue/nuxt-module": "^4.5.5",
|
|
87
|
+
"@vueuse/components": "^14.3.0",
|
|
88
|
+
"@vueuse/core": "^14.3.0",
|
|
89
|
+
"@vueuse/nuxt": "^14.3.0",
|
|
43
90
|
"mitt": "^3.0.1",
|
|
44
|
-
"nanoid": "^5.1.
|
|
45
|
-
"nuxt": "^
|
|
46
|
-
"pinia": "^3.0.
|
|
91
|
+
"nanoid": "^5.1.11",
|
|
92
|
+
"nuxt": "^4.4.4",
|
|
93
|
+
"pinia": "^3.0.4",
|
|
47
94
|
"sanitize.css": "^13.0.0",
|
|
48
|
-
"sass": "^1.
|
|
49
|
-
"shellwords": "^1.
|
|
95
|
+
"sass": "^1.99.0",
|
|
96
|
+
"shellwords": "^1.1.1",
|
|
50
97
|
"vue-resizable": "^2.1.7",
|
|
51
|
-
"getopts": "^2.3.0"
|
|
98
|
+
"getopts": "^2.3.0",
|
|
99
|
+
"defu": "^6.1.4",
|
|
100
|
+
"neo-blessed": "^0.2.0"
|
|
101
|
+
},
|
|
102
|
+
"optionalDependencies": {
|
|
103
|
+
"html2canvas": "^1.4.1"
|
|
104
|
+
},
|
|
105
|
+
"devDependencies": {
|
|
106
|
+
"@nuxt/devtools": "^3.2.4",
|
|
107
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
108
|
+
"@nuxt/schema": "^4.4.4",
|
|
109
|
+
"typescript": "~5.8.3",
|
|
110
|
+
"vue-tsc": "^2.2.10"
|
|
52
111
|
}
|
|
53
112
|
}
|
|
@@ -6,13 +6,15 @@ defineProps<{
|
|
|
6
6
|
}>()
|
|
7
7
|
|
|
8
8
|
const applicationManager = useApplicationManager()
|
|
9
|
+
const runningApps = applicationManager.appsRunning
|
|
9
10
|
</script>
|
|
10
11
|
|
|
11
12
|
<template>
|
|
12
|
-
<
|
|
13
|
-
v-for="app of
|
|
13
|
+
<DesktopApplicationWindowsRender
|
|
14
|
+
v-for="app of runningApps"
|
|
14
15
|
:key="app.id"
|
|
15
16
|
:workspace-filter="workspaceFilter"
|
|
16
17
|
:windows="app.windowsOpened"
|
|
18
|
+
:window-revision="app.openWindowCount.value"
|
|
17
19
|
/>
|
|
18
20
|
</template>
|
|
@@ -0,0 +1,38 @@
|
|
|
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>
|