@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/MIGRATION_3.4.md DELETED
@@ -1,126 +0,0 @@
1
- # Migration 3.4 — PrimeVue out of core
2
-
3
- ## Summary
4
-
5
- - **@owdproject/core** no longer installs PrimeVue. Module-time authoring lives in `kit/` (not auto-imported). Shell composables, utils, and hint components use `runtime/` (`composables`, `utils`, `constants`, `components/Desktop/`).
6
- - **@owdproject/module-fs** — ZenFS virtual filesystem + headless explorer (composables, stores, utils; no `.vue`).
7
- - **@owdproject/kit-primevue** — Nuxt PrimeVue module, `tailwindcss-primeui`, `createDesktopDialogs`, optional explorer UI (`DesktopExplorer*`; `{ explorer: false }` for dialogs only). Installs Tailwind today (duplicate of kit-tailwind; target: depend on `@owdproject/kit-tailwind`).
8
- - **@owdproject/kit-tailwind** — optional kit for Tailwind content registration (`registerTailwindPath`, `@nuxtjs/tailwindcss`). Canonical import for apps/themes with utility classes. Used alone on Nuxt UI stacks; PV themes should layer PrimeVue on top.
9
- - **Tailwind** — no longer installed by core. Register globs from `@owdproject/kit-tailwind/kit/registerTailwindPath`; PV themes also run `installModule('@owdproject/kit-primevue')` which installs Tailwind + PrimeUI preset.
10
- - **@owdproject/kit-theme**, **kit-fs**, **kit-explorer** — deprecated (empty Nuxt modules). **No Vite import shims** — update sources to explicit paths below.
11
-
12
- ## Stacks (what is optional)
13
-
14
- | Stack | `desktop.config` `modules` | Theme |
15
- |-------|---------------------------|--------|
16
- | Desktop only | — (no `module-fs`) | theme only |
17
- | PV dialogs | — | `installModule('@owdproject/kit-primevue', { explorer: false })` |
18
- | PV file explorer | `['@owdproject/module-fs', …]` | `installModule('@owdproject/kit-primevue')` |
19
-
20
- `module-fs` is optional at the **app** level (omit from `desktop.config` if you do not need a VFS). It is **required** when you mount `DesktopExplorer*` (default `kit-primevue`).
21
-
22
- ## Themes (demo PV)
23
-
24
- ```ts
25
- await installModule('@owdproject/kit-primevue')
26
- ```
27
-
28
- Dialogs only (no explorer components, no `module-fs`):
29
-
30
- ```ts
31
- await installModule('@owdproject/kit-primevue', { explorer: false })
32
- ```
33
-
34
- Remove `kit-theme`, `kit-explorer` from `package.json` / `installModule`. Keep mounting theme `<ConfirmDialog />` groups.
35
-
36
- Dialog plugin example (core inject key):
37
-
38
- ```ts
39
- import { DESKTOP_DIALOG_PROVIDER_KEY } from '@owdproject/core/runtime/constants/desktopShellKeys'
40
- import { createDesktopDialogs } from '@owdproject/kit-primevue/runtime/dialogs/createDesktopDialogs'
41
- ```
42
-
43
- Or rely on kit-primevue client plugin (no theme plugin needed).
44
-
45
- ## Imports
46
-
47
- | Old | New |
48
- |-----|-----|
49
- | `@owdproject/kit-theme/runtime/composables/*` | `@owdproject/core/runtime/composables/*` |
50
- | `@owdproject/kit-fs/runtime/*` (headless) | `@owdproject/module-fs/runtime/*` |
51
- | `@owdproject/kit-explorer/runtime/composables/*` | `@owdproject/module-fs/runtime/composables/*` |
52
- | `@owdproject/kit-explorer/runtime/components/*` | `@owdproject/kit-primevue/runtime/components/explorer/*` |
53
- | `@owdproject/kit-fs/runtime/components/*` | `@owdproject/kit-primevue/runtime/components/explorer/*` |
54
- | `createDesktopDialogs` from kit-theme | `@owdproject/kit-primevue/runtime/dialogs/createDesktopDialogs` |
55
- | PV explorer UI (Workspace, FileEntry, Frame, …) | `@owdproject/kit-primevue` (`DesktopExplorer*`) |
56
- | Shell snap/edge hints | `@owdproject/core` (`DesktopWindowSnapHintsBase`, `DesktopWorkspaceEdgeHintsBase`) |
57
- | `provideDesktopWorkArea` / `desktopWorkAreaKey` | `useDesktopWorkArea(shellStageRef)` → `useDesktopWindowStore.workArea` |
58
- | `useDesktopWindowDragHandlers` / `*Injected` | `useWindowDragHandlers` |
59
- | `useFileSystemExplorer` | `useExplorerWindow` |
60
- | `@owdproject/core/runtime/utils/defineDesktop*` | `@owdproject/core/kit/authoring` |
61
- | `@owdproject/core/runtime/utils/utilDesktop` (`defineDesktopApp`) | `@owdproject/core/kit/defineDesktopApp` |
62
- | `registerTailwindPath` from core | `@owdproject/kit-tailwind/kit/registerTailwindPath` (canonical; also re-exported from kit-primevue during transition) |
63
- | `defineDesktopTheme(definition, import.meta.url)` (auto Tailwind) | `defineDesktopTheme(definition)` + `registerThemeTailwindPath(nuxt, import.meta.url)` from kit-tailwind after theme installs its UI kit |
64
- | `runtime/utils/utilHasDesktop` | `runtime/composables/useDesktopManifest` (`hasDesktop*`) |
65
- | `runtime/utils/windowMaximizeLayout` | `runtime/utils/utilWindowMaximizeLayout` |
66
- | `runtime/utils/utilWindow` | `runtime/utils/utilWindowControllerAdapter` |
67
-
68
- ### Tailwind content registration
69
-
70
- `@nuxtjs/tailwindcss` is installed by `kit-tailwind` or `kit-primevue` during kit `setup` (not by core). Register globs during each module's `setup`; the active kit merges them on `tailwindcss:config`.
71
-
72
- | Caller | API |
73
- |--------|-----|
74
- | Theme `module.ts` (after installing its UI kit) | `registerThemeTailwindPath(nuxt, import.meta.url)` from `@owdproject/kit-tailwind/kit/registerTailwindPath` |
75
- | Apps / extension modules with utility classes | `registerTailwindPath(nuxt, resolve('./path/to/glob'))` from `@owdproject/kit-tailwind/kit/registerTailwindPath` + `"@owdproject/kit-tailwind"` in app `dependencies` |
76
-
77
- Registered paths merge into `content.files` (not a plain array — that breaks the generated PostCSS template). Duplicate globs are deduplicated.
78
-
79
- ## module-fs
80
-
81
- Use `useDesktopShellIdentity` from `@owdproject/core/runtime/composables/useDesktopShellIdentity`.
82
-
83
- **ZenFS boundary:** `@zenfs/core` (and `@zenfs/dom`, `@zenfs/archives`) are imported only inside `@owdproject/module-fs`. Do not import `@zenfs/*` from `kit-primevue`, themes, or core — use module-fs runtime APIs (e.g. `fetchExplorerEntryMetadata`, `useExplorerWindow`).
84
-
85
- Headless explorer: `useExplorerTabs`, `createExplorerWindowMenuItems`, `useExplorerStore`, DnD composables — all from `@owdproject/module-fs/runtime/...`. `useExplorerWindow(window, t)` defaults to `createExplorerFsOperations`.
86
-
87
- ## Shell identity
88
-
89
- See `DESKTOP_KERNEL.md` (`useDesktopShellIdentity`).
90
-
91
- ## Module naming (3.4)
92
-
93
- Runtime identifiers use the `desktop-` prefix. The npm scope `@owdproject/*` and CSS classes/tokens (`.owd-*`, `--owd-*`) are unchanged.
94
-
95
- | Surface | 3.4 convention | Legacy (warn only) |
96
- |---------|----------------|-------------------|
97
- | Core Nuxt module `configKey` | `desktop` | `owd` (nuxt.config module options) |
98
- | App `plugin.ts` `name` | `desktop-<slug>-register` | `owd-<slug>-register` |
99
- | App/module `meta.name` | `desktop-app-<slug>` / `desktop-module-<slug>` | `owd-app-*` / `owd-module-*` |
100
- | Theme `meta.name` | `desktop-theme-<slug>` | `owd-theme-*` |
101
- | Desktop manifest file | `desktop.config.ts` | `owd.config.ts` |
102
- | Kernel Vue source files | `runtime/components/<area>/<Name>.vue` + `prefix: 'Desktop'` | `runtime/components/Desktop/<area>/Desktop<Name>.vue` |
103
-
104
- Global component names (`DesktopWindow`, `DesktopCore`, …) are unchanged. Deep imports of hint bases: `runtime/components/workspace/WorkspaceEdgeHintsBase.vue`, `runtime/components/window/WindowSnapHintsBase.vue`.
105
-
106
- ## Pinia store ids (3.4.1)
107
-
108
- Pinia store ids were renamed to match the `desktop-*` runtime naming. CSS classes (`.owd-*`) and npm scope (`@owdproject/*`) are unchanged.
109
-
110
- | Legacy id | New id |
111
- |-----------|--------|
112
- | `owd/desktop` | `desktop` |
113
- | `owd/desktop/workspace` | `desktop/workspace` |
114
- | `owd/desktop/window` | `desktop/window` |
115
- | `owd/desktop/volume` | `desktop/volume` |
116
- | `owd/desktop/defaultApps` | `desktop/defaultApps` |
117
- | `owd/application/${appId}/windows` | `desktop/application/${appId}/windows` |
118
- | `owd/application/${appId}/meta` | `desktop/application/${appId}/meta` |
119
-
120
- When `@owdproject/module-persistence` is installed, persisted state is migrated automatically on the first client boot (`desktop-shell-init` runs `migratePersistedStoreIds` before Pinia hydration). No app or theme code changes are required.
121
-
122
- **Breaking only for tools that read raw localStorage keys** (e.g. custom debug scripts expecting `owd/desktop`). In-browser state is preserved via migration.
123
-
124
- `pnpm validate:modules` (or `desktop validate`) warns when a package still uses legacy `meta.name: "owd-*"` or Pinia `defineStore` ids containing `owd/`.
125
-
126
- Extension modules with their own persisted stores should use the `desktop/<module>/…` id pattern (e.g. `@owdproject/module-fs` explorer: `desktop/module-fs/explorer`). Core migrates only kernel ids (`owd/desktop`, `owd/application/*`); extension packages may omit a localStorage migration — users who already had legacy keys may see a one-time reset of that module's persisted prefs.
package/PLAYGROUND.md DELETED
@@ -1,91 +0,0 @@
1
- # App and theme module playground
2
-
3
- Checklist for `@owdproject/app-*`, `@owdproject/theme-*`, and `@owdproject/module-*` packages.
4
-
5
- ## Layout
6
-
7
- ```
8
- package/
9
- src/
10
- module.ts # Nuxt module (defineNuxtModule / defineDesktopModule / defineDesktopTheme)
11
- runtime/
12
- plugin.ts # apps: defineDesktopApp + name: desktop-<slug>-register
13
- components/ # optional Vue UI
14
- playground/
15
- desktop.config.ts # defineDesktopConfig({ theme, apps, modules, ... })
16
- nuxt.config.ts # ssr: false, modules: ['@owdproject/core']
17
- package.json
18
- dist/module.mjs # after dev:prepare / prepack
19
- ```
20
-
21
- ## Apps (`@owdproject/app-*`)
22
-
23
- - `src/runtime/plugin.ts` calls `defineDesktopApp` from `@owdproject/core/kit/defineDesktopApp`
24
- - Plugin `name`: `desktop-<slug>-register` (required for `dependsOn` ordering)
25
- - `src/module.ts` `meta.name`: `desktop-app-<slug>`
26
- - Tailwind utilities in Vue: `registerTailwindPath` from `@owdproject/kit-tailwind/kit/registerTailwindPath`
27
- - `"@owdproject/kit-tailwind": "workspace:*"` in app **`dependencies`** (build-time; not replaced by the playground theme)
28
- - Playground lists the app in `desktop.config.ts` `apps: ['@owdproject/app-<slug>']`
29
-
30
- ### Theme UI stack vs app Tailwind
31
-
32
- | Concern | Package | Who declares it |
33
- |---------|---------|-----------------|
34
- | Tailwind content globs (`registerTailwindPath`) | `kit-tailwind` | **App** (and theme) `module.ts` + app `dependencies` |
35
- | PrimeVue auto-import (`InputText`, `Button`, …) | `kit-primevue` | **PV theme** via `installModule('@owdproject/kit-primevue')` — not all themes |
36
- | Nuxt UI components | `kit-nuxt-ui` | **`theme-nuxt`** — no PrimeVue |
37
-
38
- PrimeVue markup in an app requires a PV theme at runtime. `@owdproject/theme-nuxt` does not install `kit-primevue`.
39
-
40
- ## Themes (`@owdproject/theme-*`)
41
-
42
- - `defineDesktopTheme` from `@owdproject/core`
43
- - **PrimeVue themes:** `installModule('@owdproject/kit-primevue')` then `registerThemeTailwindPath(nuxt, import.meta.url)` from `@owdproject/kit-tailwind/kit/registerTailwindPath`
44
- - **Nuxt UI themes:** install `@owdproject/kit-nuxt-ui` (optional) — no PrimeVue
45
- - `meta.name`: `desktop-theme-<slug>`
46
-
47
- ## Extension modules (`@owdproject/module-*`)
48
-
49
- - `defineDesktopModule` with `meta.configKey` (e.g. `fs`, `terminal`)
50
- - Module augmentation in `types/desktop.d.ts`
51
- - Headless modules skip Tailwind registration
52
-
53
- ## Scripts (publishable packages)
54
-
55
- | Script | Purpose |
56
- |--------|---------|
57
- | `dev:prepare` | `nuxt-module-build build --stub` + playground `nuxt prepare` |
58
- | `dev` | Local playground dev server |
59
- | `dev:generate` | Static GH Pages build (`NUXT_APP_BASE_URL=/<slug>/`) |
60
- | `prepack` | Full `nuxt-module-build build` before npm publish |
61
- | `validate` | `desktop validate .` |
62
-
63
- Do **not** add a `prepare` script on publishable packages.
64
-
65
- ## Validate
66
-
67
- From package root:
68
-
69
- ```bash
70
- pnpm run dev:prepare
71
- desktop validate .
72
- ```
73
-
74
- From monorepo client root:
75
-
76
- ```bash
77
- pnpm run validate:modules
78
- ```
79
-
80
- See [`MIGRATION_3.4.md`](./MIGRATION_3.4.md) for import path changes (kit-primevue, module-fs).
81
-
82
- ## Desktop control panel (TUI)
83
-
84
- Run `pnpm desktop` from the client monorepo root.
85
-
86
- - Toggle apps/modules in the catalog (tabs `1`/`2`), pick a theme in tab `3`, then press `w` to review installs.
87
- - Each **new** package opens an install wizard: choose **npm**, **GitHub HTTPS**, or **GitHub SSH** (when SSH auth is detected).
88
- - Catalog columns: `[+]` add, `[-]` remove, `[*]` on desktop; `NPM` / `GIT` / `LOC` source slots; yellow publisher = untrusted.
89
- - Sort: `o` cycle, `O` open sort picker (Updated, Name, Stars, Installed). Pending toggles affect Installed sort.
90
- - Settings (`g`): GitHub username (fork clones), trusted orgs list, SSH test (`t`).
91
- - CLI: `desktop add <pkg> --npm`, `--dev`, `--from <user>`, `--protocol ssh`.
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": "desktop",
4
- "version": "3.4.0",
5
- "builder": {
6
- "@nuxt/module-builder": "1.0.2",
7
- "unbuild": "unknown"
8
- }
9
- }
package/dist/module.mjs DELETED
@@ -1,254 +0,0 @@
1
- import { installModule, defineNuxtModule, createResolver, resolvePath, 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
- const DESKTOP_CONFIG_FILENAME = "desktop.config.ts";
34
- const LEGACY_DESKTOP_CONFIG_FILENAME = "owd.config.ts";
35
- 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).";
36
- function resolveDesktopConfigPath(rootDir) {
37
- const desktopPath = join(rootDir, DESKTOP_CONFIG_FILENAME);
38
- const legacyPath = join(rootDir, LEGACY_DESKTOP_CONFIG_FILENAME);
39
- const hasDesktop = existsSync(desktopPath);
40
- const hasLegacy = existsSync(legacyPath);
41
- if (hasDesktop && hasLegacy) {
42
- console.warn(
43
- "[@owdproject/core] Both desktop.config.ts and owd.config.ts exist; using desktop.config.ts. Remove owd.config.ts."
44
- );
45
- return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false };
46
- }
47
- if (hasDesktop) {
48
- return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false };
49
- }
50
- if (hasLegacy) {
51
- return {
52
- path: legacyPath,
53
- file: LEGACY_DESKTOP_CONFIG_FILENAME,
54
- legacy: true
55
- };
56
- }
57
- return null;
58
- }
59
- function warnLegacyDesktopConfig(resolved) {
60
- if (resolved?.legacy) {
61
- console.warn(LEGACY_CONFIG_DEPRECATION);
62
- }
63
- }
64
- const NUXT_OPTION_KEYS = /* @__PURE__ */ new Set([
65
- "ssr",
66
- "devtools",
67
- "vite",
68
- "nitro",
69
- "runtimeConfig",
70
- "app",
71
- "appConfig",
72
- "css",
73
- "plugins",
74
- "hooks",
75
- "extends",
76
- "compatibilityDate",
77
- "experimental",
78
- "future",
79
- "i18n",
80
- "tailwindcss",
81
- "primevue"
82
- ]);
83
- function warnDesktopConfigKeys(config, configFile = "desktop.config.ts") {
84
- for (const key of Object.keys(config)) {
85
- if (NUXT_OPTION_KEYS.has(key)) {
86
- console.warn(
87
- `[@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, ... }).`
88
- );
89
- }
90
- }
91
- }
92
- function readConfigKey(mod) {
93
- const key = mod?.meta?.configKey ?? mod?.default?.meta?.configKey;
94
- return typeof key === "string" && key.length > 0 ? key : void 0;
95
- }
96
- async function loadModuleDescriptor(modulePath) {
97
- try {
98
- const imported = await import(modulePath);
99
- return imported.default ?? imported;
100
- } catch (e) {
101
- console.warn(`[@owdproject/core] Failed to load module descriptor for "${modulePath}":`, e.message || e);
102
- return void 0;
103
- }
104
- }
105
- async function installDesktopPackage(nuxt, modulePath, desktop) {
106
- const descriptor = await loadModuleDescriptor(modulePath);
107
- const configKey = readConfigKey(descriptor);
108
- if (configKey && desktop) {
109
- const slice = desktop[configKey];
110
- const inline = slice && typeof slice === "object" && !Array.isArray(slice) ? slice : {};
111
- await installModule(modulePath, inline);
112
- return;
113
- }
114
- await installModule(modulePath);
115
- }
116
-
117
- const version = "3.4.0";
118
- const pkg = {
119
- version: version};
120
-
121
- const module$1 = defineNuxtModule({
122
- meta: {
123
- name: "desktop",
124
- configKey: "desktop"
125
- },
126
- defaults: {
127
- theme: "@owdproject/theme-nova",
128
- apps: [],
129
- modules: []
130
- },
131
- moduleDependencies: {
132
- "@pinia/nuxt": {},
133
- "@nuxt/fonts": {},
134
- "@nuxt/icon": {
135
- defaults: {
136
- clientBundle: {
137
- scan: true,
138
- sizeLimitKb: 256
139
- }
140
- }
141
- },
142
- "@vueuse/nuxt": {},
143
- "@nuxtjs/i18n": {}
144
- },
145
- async setup(_options, _nuxt) {
146
- const { resolve } = createResolver(import.meta.url);
147
- let resolvedNanoid = null;
148
- try {
149
- resolvedNanoid = await resolvePath("nanoid", { url: import.meta.url });
150
- } catch (e) {
151
- }
152
- _nuxt.options.experimental = {
153
- ..._nuxt.options.experimental,
154
- viteEnvironmentApi: _nuxt.options.experimental?.viteEnvironmentApi ?? true
155
- };
156
- _nuxt.options.runtimeConfig.public.desktop = {};
157
- let clientConfig;
158
- const resolvedConfig = resolveDesktopConfigPath(_nuxt.options.rootDir);
159
- if (!resolvedConfig) {
160
- const hint = "Create desktop.config.ts next to your Nuxt root (e.g. desktop/desktop.config.ts), export default defineDesktopConfig({ theme, apps, modules }).";
161
- throw new Error(`[@owdproject/core] Cannot find desktop.config.ts in ${_nuxt.options.rootDir}. ${hint}`);
162
- }
163
- warnLegacyDesktopConfig(resolvedConfig);
164
- _nuxt.options.watch ??= [];
165
- _nuxt.options.watch.push(resolvedConfig.path);
166
- try {
167
- clientConfig = (await import(resolvedConfig.path)).default;
168
- } catch (e) {
169
- const hint = "Export default defineDesktopConfig({ theme, apps, modules }) from desktop.config.ts.";
170
- throw new Error(
171
- `[@owdproject/core] Cannot load ${resolvedConfig.file}. ${hint}`,
172
- { cause: e }
173
- );
174
- }
175
- assertValidDesktopUserConfig(clientConfig, resolvedConfig.file);
176
- if (!clientConfig.theme) {
177
- clientConfig.theme = "@owdproject/theme-nova";
178
- }
179
- const configRecord = clientConfig;
180
- warnDesktopConfigKeys(configRecord, resolvedConfig.file);
181
- const desktop = defu(configRecord, { coreVersion: pkg.version });
182
- _nuxt.options.runtimeConfig.public.desktop = desktop;
183
- {
184
- if (desktop.theme) {
185
- try {
186
- await installDesktopPackage(_nuxt, desktop.theme, desktop);
187
- } catch (e) {
188
- const msg = e instanceof Error ? e.message : String(e);
189
- console.warn(`[@owdproject/core] Warning: Could not load theme "${desktop.theme}". Details: ${msg}`);
190
- }
191
- }
192
- if (Array.isArray(desktop.modules)) {
193
- for (const modulePath of desktop.modules) {
194
- try {
195
- await installDesktopPackage(_nuxt, modulePath, desktop);
196
- } catch (e) {
197
- const msg = e instanceof Error ? e.message : String(e);
198
- console.warn(`[@owdproject/core] Warning: Could not load module "${modulePath}". Details: ${msg}`);
199
- }
200
- }
201
- }
202
- if (Array.isArray(desktop.apps)) {
203
- for (const appPath of desktop.apps) {
204
- try {
205
- await installDesktopPackage(_nuxt, appPath, desktop);
206
- } catch (e) {
207
- const msg = e instanceof Error ? e.message : String(e);
208
- console.warn(`[@owdproject/core] Warning: Could not load app "${appPath}". Details: ${msg}`);
209
- }
210
- }
211
- }
212
- }
213
- _nuxt.options.appConfig.desktop = _nuxt.options.runtimeConfig.public.desktop;
214
- {
215
- _nuxt.hook("vite:extendConfig", (viteConfig) => {
216
- viteConfig.css = viteConfig.css || {};
217
- viteConfig.css.preprocessorOptions = viteConfig.css.preprocessorOptions || {};
218
- viteConfig.css.preprocessorOptions.scss = {
219
- api: "modern-compiler"
220
- };
221
- viteConfig.optimizeDeps = viteConfig.optimizeDeps || {};
222
- viteConfig.optimizeDeps.include = viteConfig.optimizeDeps.include || [];
223
- if (resolvedNanoid && !viteConfig.optimizeDeps.include.includes(resolvedNanoid)) {
224
- viteConfig.optimizeDeps.include.push(resolvedNanoid);
225
- }
226
- });
227
- }
228
- {
229
- _nuxt.options.css.push("sanitize.css");
230
- }
231
- {
232
- addComponentsDir({
233
- path: resolve("./runtime/components"),
234
- prefix: "Desktop",
235
- pathPrefix: false,
236
- global: true
237
- });
238
- }
239
- {
240
- addPlugin(resolve("./runtime/plugins/resize.client.ts"));
241
- addPlugin(
242
- resolve("./runtime/plugins/01.desktop-shell-init.client.ts")
243
- );
244
- addPlugin(
245
- resolve("./runtime/plugins/02.desktop-register-desktop-apps.client.ts")
246
- );
247
- addImportsDir(resolve("./runtime/composables"));
248
- addImportsDir(resolve("./runtime/stores"));
249
- addImportsDir(resolve("./runtime/utils"));
250
- }
251
- }
252
- });
253
-
254
- 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,8 +0,0 @@
1
- export { defineDesktopApp } from './kit/defineDesktopApp'
2
- export {
3
- defineDesktopConfig,
4
- defineDesktopModule,
5
- defineDesktopTheme,
6
- mergeDesktopExtensionConfig,
7
- setDesktopExtensionConfig,
8
- } from './kit/authoring'