@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.
- package/README.md +91 -59
- package/dist/dom/index.d.mts +65 -0
- package/dist/dom/index.d.ts +65 -0
- package/dist/dom/index.mjs +224 -0
- package/dist/events/index.d.mts +70 -0
- package/dist/events/index.d.ts +70 -0
- package/dist/events/index.mjs +3 -0
- package/dist/index.d.mts +73 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.mjs +115 -0
- package/dist/layout/index.d.mts +41 -0
- package/dist/layout/index.d.ts +41 -0
- package/dist/layout/index.mjs +64 -0
- package/dist/machines/index.d.mts +31 -0
- package/dist/machines/index.d.ts +31 -0
- package/dist/machines/index.mjs +2 -0
- package/dist/managers/index.d.mts +117 -0
- package/dist/managers/index.d.ts +117 -0
- package/dist/managers/index.mjs +6 -0
- package/dist/session/index.d.mts +57 -0
- package/dist/session/index.d.ts +57 -0
- package/dist/session/index.mjs +65 -0
- package/dist/shared/core.B0B0KfVK.mjs +865 -0
- package/dist/shared/core.B1XxB289.mjs +239 -0
- package/dist/shared/core.B3mp7ztE.mjs +237 -0
- package/dist/shared/core.BOvFdEVQ.d.ts +114 -0
- package/dist/shared/core.CsDFgGnX.mjs +40 -0
- package/dist/shared/core.Di1eFcr_.d.mts +114 -0
- package/dist/shared/core.Pd_Ogt4g.mjs +101 -0
- package/dist/shared/core.b3Xldzyu.mjs +29 -0
- package/dist/types/index.d.mts +266 -0
- package/dist/types/index.d.ts +266 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +60 -87
- package/bin/cli.js +0 -395
- package/bin/desktop.js +0 -5
- package/bin/lib/catalog.js +0 -293
- package/bin/lib/config.js +0 -109
- package/bin/lib/desktopConfig.js +0 -56
- package/bin/lib/generateTemplate.js +0 -389
- package/bin/lib/install.js +0 -408
- package/bin/lib/migrateModulePlayground.config.mjs +0 -164
- package/bin/lib/migrateModulePlayground.mjs +0 -313
- package/bin/lib/npmVersions.js +0 -124
- package/bin/lib/playgroundContext.js +0 -188
- package/bin/lib/scaffold.js +0 -197
- package/bin/lib/status.js +0 -289
- package/bin/lib/validateModule.js +0 -697
- package/bin/lib/workspace.js +0 -182
- package/bin/owd.js +0 -5
- package/bin/tui.js +0 -1379
- package/dist/module.d.mts +0 -13
- package/dist/module.json +0 -9
- package/dist/module.mjs +0 -268
- package/dist/types.d.mts +0 -7
- package/index.ts +0 -5
- package/module.ts +0 -223
- package/runtime/components/Desktop/Application/DesktopApplicationRender.vue +0 -20
- package/runtime/components/Desktop/Application/DesktopApplicationWindowsRender.vue +0 -38
- package/runtime/components/Desktop/Background/DesktopBackground.vue +0 -16
- package/runtime/components/Desktop/Core/DesktopCore.vue +0 -90
- package/runtime/components/Desktop/Time/DesktopTime.vue +0 -56
- package/runtime/components/Desktop/Window/DesktopWindow.vue +0 -204
- package/runtime/components/Desktop/Window/DesktopWindowContent.vue +0 -28
- package/runtime/components/Desktop/Window/DesktopWindowNav.vue +0 -66
- package/runtime/composables/useApplicationEntries.ts +0 -51
- package/runtime/composables/useApplicationManager.ts +0 -285
- package/runtime/composables/useDesktopManager.ts +0 -49
- package/runtime/composables/useTerminalManager.ts +0 -66
- package/runtime/composables/useWorkspaceManager.ts +0 -41
- package/runtime/internal/controllers/ApplicationController.ts +0 -345
- package/runtime/internal/controllers/WindowController.ts +0 -462
- package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +0 -17
- package/runtime/plugins/resize.client.ts +0 -6
- package/runtime/stores/storeApplicationMeta.ts +0 -59
- package/runtime/stores/storeApplicationWindows.ts +0 -20
- package/runtime/stores/storeDesktop.ts +0 -111
- package/runtime/stores/storeDesktopDefaultApps.ts +0 -53
- package/runtime/stores/storeDesktopVolume.ts +0 -18
- package/runtime/stores/storeDesktopWindow.ts +0 -20
- package/runtime/stores/storeDesktopWorkspace.ts +0 -75
- package/runtime/utils/captureElementToCanvas.ts +0 -21
- package/runtime/utils/explorerEntryPath.ts +0 -10
- package/runtime/utils/resolveDesktopConfigPath.ts +0 -52
- package/runtime/utils/splitDesktopUserConfig.ts +0 -85
- package/runtime/utils/utilApp.ts +0 -37
- package/runtime/utils/utilCommon.ts +0 -26
- package/runtime/utils/utilDebug.ts +0 -30
- package/runtime/utils/utilDesktop.ts +0 -35
- package/runtime/utils/utilTerminal.ts +0 -6
- package/runtime/utils/utilWindow.ts +0 -15
- package/runtime/utils/validateDesktopUserConfig.ts +0 -44
- package/types/index.d.ts +0 -420
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { useDesktopStore } from './storeDesktop'
|
|
3
|
-
|
|
4
|
-
export const useDesktopDefaultAppsStore = defineStore(
|
|
5
|
-
'owd/desktop/defaultApps',
|
|
6
|
-
() => {
|
|
7
|
-
const desktopStore = useDesktopStore()
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Sets a default app for a given feature
|
|
11
|
-
*/
|
|
12
|
-
function setDefaultApp(
|
|
13
|
-
feature: string,
|
|
14
|
-
application: IApplicationController,
|
|
15
|
-
entry: string,
|
|
16
|
-
) {
|
|
17
|
-
if (!desktopStore.state.hasOwnProperty('defaultApps')) {
|
|
18
|
-
desktopStore.state.defaultApps = {}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
desktopStore.state.defaultApps[feature] = {
|
|
22
|
-
applicationId: application.id,
|
|
23
|
-
entry,
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Gets the default app config for a given feature
|
|
29
|
-
*/
|
|
30
|
-
function getDefaultApp(feature: string): DefaultAppConfig | undefined {
|
|
31
|
-
if (!desktopStore.state.hasOwnProperty('defaultApps')) {
|
|
32
|
-
desktopStore.state.defaultApps = {}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return desktopStore.state.defaultApps[feature]
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Loads default apps from current config
|
|
40
|
-
*/
|
|
41
|
-
function loadDefaultAppsFromConfig(runtimeConfig) {
|
|
42
|
-
if (runtimeConfig.public.desktop.defaultApps) {
|
|
43
|
-
desktopStore.state.defaultApps = runtimeConfig.public.desktop.defaultApps
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
setDefaultApp,
|
|
49
|
-
getDefaultApp,
|
|
50
|
-
loadDefaultAppsFromConfig,
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { useDesktopStore } from './storeDesktop'
|
|
4
|
-
|
|
5
|
-
export const useDesktopVolumeStore = defineStore('owd/desktop/volume', () => {
|
|
6
|
-
const desktopStore = useDesktopStore()
|
|
7
|
-
|
|
8
|
-
const master = computed(() => desktopStore.state.volume.master)
|
|
9
|
-
|
|
10
|
-
function setMasterVolume(value: number) {
|
|
11
|
-
desktopStore.state.volume.master = value
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
master,
|
|
16
|
-
setMasterVolume,
|
|
17
|
-
}
|
|
18
|
-
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { useDesktopStore } from './storeDesktop'
|
|
4
|
-
|
|
5
|
-
export const useDesktopWindowStore = defineStore('owd/desktop/window', () => {
|
|
6
|
-
const desktopStore = useDesktopStore()
|
|
7
|
-
|
|
8
|
-
const positionZ = computed(() => desktopStore.state.window.positionZ)
|
|
9
|
-
|
|
10
|
-
function incrementPositionZ() {
|
|
11
|
-
desktopStore.state.window.positionZ++
|
|
12
|
-
|
|
13
|
-
return desktopStore.state.window.positionZ
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
positionZ,
|
|
18
|
-
incrementPositionZ,
|
|
19
|
-
}
|
|
20
|
-
})
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { defineStore } from 'pinia'
|
|
2
|
-
import { computed } from 'vue'
|
|
3
|
-
import { useDesktopStore } from './storeDesktop'
|
|
4
|
-
import { nanoid } from 'nanoid'
|
|
5
|
-
|
|
6
|
-
export const useDesktopWorkspaceStore = defineStore(
|
|
7
|
-
'owd/desktop/workspace',
|
|
8
|
-
() => {
|
|
9
|
-
const desktopStore = useDesktopStore()
|
|
10
|
-
|
|
11
|
-
const active = computed(() => {
|
|
12
|
-
return desktopStore.state.workspace.active
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
const overview = computed(() => {
|
|
16
|
-
return desktopStore.state.workspace.overview
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
const list = computed(() => {
|
|
20
|
-
return desktopStore.state.workspace.list
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
function setupWorkspaces() {
|
|
24
|
-
if (desktopStore.state.workspace.list.length === 0) {
|
|
25
|
-
createWorkspace()
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (desktopStore.state.workspace.list.length === 1) {
|
|
29
|
-
createWorkspace()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const list = desktopStore.state.workspace.list
|
|
33
|
-
const active = desktopStore.state.workspace.active
|
|
34
|
-
if (!active || !list.includes(active)) {
|
|
35
|
-
desktopStore.state.workspace.active = list[0] ?? ''
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** Id of the workspace new windows should use (after setupWorkspaces). */
|
|
40
|
-
function resolveActiveWorkspaceId(): string {
|
|
41
|
-
setupWorkspaces()
|
|
42
|
-
return desktopStore.state.workspace.active || desktopStore.state.workspace.list[0] || ''
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function setOverview(value: boolean) {
|
|
46
|
-
desktopStore.state.workspace.overview = value
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function setWorkspace(value: string) {
|
|
50
|
-
desktopStore.state.workspace.active = value
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function createWorkspace() {
|
|
54
|
-
desktopStore.state.workspace.list.push(nanoid(8))
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const workspaceActiveIndex = computed(() => {
|
|
58
|
-
return desktopStore.state.workspace.list.findIndex(
|
|
59
|
-
(workspace) => workspace === desktopStore.state.workspace.active,
|
|
60
|
-
)
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
active,
|
|
65
|
-
overview,
|
|
66
|
-
list,
|
|
67
|
-
workspaceActiveIndex,
|
|
68
|
-
setupWorkspaces,
|
|
69
|
-
resolveActiveWorkspaceId,
|
|
70
|
-
setOverview,
|
|
71
|
-
setWorkspace,
|
|
72
|
-
createWorkspace,
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
)
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Renders a DOM subtree to a canvas via html2canvas (optional dependency).
|
|
3
|
-
* Used for workspace thumbnails / previews; returns null if capture fails or html2canvas is missing.
|
|
4
|
-
*/
|
|
5
|
-
export async function captureElementToCanvas(
|
|
6
|
-
element: HTMLElement | null | undefined,
|
|
7
|
-
options?: Record<string, unknown>,
|
|
8
|
-
): Promise<HTMLCanvasElement | null> {
|
|
9
|
-
if (!element || typeof window === 'undefined') {
|
|
10
|
-
return null
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
const { default: html2canvas } = await import('html2canvas')
|
|
14
|
-
return await html2canvas(element, {
|
|
15
|
-
allowTaint: true,
|
|
16
|
-
...(options as object),
|
|
17
|
-
})
|
|
18
|
-
} catch {
|
|
19
|
-
return null
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Absolute path for a listing entry under `basePath` (virtual FS paths).
|
|
3
|
-
* Avoids `//fileName` when `basePath` is `/` or has trailing slashes.
|
|
4
|
-
*/
|
|
5
|
-
export function explorerEntryAbsolutePath(basePath: string, fileName: string): string {
|
|
6
|
-
const normalizedBase = (basePath ?? '/').replace(/\/+$/, '') || '/'
|
|
7
|
-
const tail = fileName.replace(/^\/+/, '')
|
|
8
|
-
if (normalizedBase === '/') return `/${tail}`
|
|
9
|
-
return `${normalizedBase}/${tail}`
|
|
10
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import { join } from 'node:path'
|
|
3
|
-
|
|
4
|
-
export const DESKTOP_CONFIG_FILENAME = 'desktop.config.ts'
|
|
5
|
-
export const LEGACY_DESKTOP_CONFIG_FILENAME = 'owd.config.ts'
|
|
6
|
-
|
|
7
|
-
export const LEGACY_CONFIG_DEPRECATION =
|
|
8
|
-
'[@owdproject/core] owd.config.ts is deprecated and kept only for backward compatibility; rename to desktop.config.ts (required from @owdproject/core 3.2).'
|
|
9
|
-
|
|
10
|
-
export type ResolvedDesktopConfigPath = {
|
|
11
|
-
path: string
|
|
12
|
-
file: string
|
|
13
|
-
legacy: boolean
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export function resolveDesktopConfigPath(
|
|
17
|
-
rootDir: string,
|
|
18
|
-
): ResolvedDesktopConfigPath | null {
|
|
19
|
-
const desktopPath = join(rootDir, DESKTOP_CONFIG_FILENAME)
|
|
20
|
-
const legacyPath = join(rootDir, LEGACY_DESKTOP_CONFIG_FILENAME)
|
|
21
|
-
const hasDesktop = existsSync(desktopPath)
|
|
22
|
-
const hasLegacy = existsSync(legacyPath)
|
|
23
|
-
|
|
24
|
-
if (hasDesktop && hasLegacy) {
|
|
25
|
-
console.warn(
|
|
26
|
-
'[@owdproject/core] Both desktop.config.ts and owd.config.ts exist; using desktop.config.ts. Remove owd.config.ts.',
|
|
27
|
-
)
|
|
28
|
-
return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false }
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (hasDesktop) {
|
|
32
|
-
return { path: desktopPath, file: DESKTOP_CONFIG_FILENAME, legacy: false }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (hasLegacy) {
|
|
36
|
-
return {
|
|
37
|
-
path: legacyPath,
|
|
38
|
-
file: LEGACY_DESKTOP_CONFIG_FILENAME,
|
|
39
|
-
legacy: true,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return null
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function warnLegacyDesktopConfig(
|
|
47
|
-
resolved: ResolvedDesktopConfigPath | null | undefined,
|
|
48
|
-
): void {
|
|
49
|
-
if (resolved?.legacy) {
|
|
50
|
-
console.warn(LEGACY_CONFIG_DEPRECATION)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Keys consumed by {@link @owdproject/core} module setup (install order).
|
|
3
|
-
* Must not be spread onto `_nuxt.options`.
|
|
4
|
-
*/
|
|
5
|
-
export const DESKTOP_MODULE_KEYS = ['theme', 'apps', 'modules'] as const
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Known desktop shell keys merged into `runtimeConfig.public.desktop` / `appConfig.desktop`.
|
|
9
|
-
* Additional keys are merged with a dev warning (extensions, theme overrides).
|
|
10
|
-
*/
|
|
11
|
-
export const DESKTOP_RUNTIME_KEYS = new Set([
|
|
12
|
-
...DESKTOP_MODULE_KEYS,
|
|
13
|
-
'docs',
|
|
14
|
-
'name',
|
|
15
|
-
'defaultApps',
|
|
16
|
-
'features',
|
|
17
|
-
'explorer',
|
|
18
|
-
'systemBar',
|
|
19
|
-
'dockBar',
|
|
20
|
-
'workspaces',
|
|
21
|
-
])
|
|
22
|
-
|
|
23
|
-
/** Nuxt top-level option names — warn if present in desktop.config (likely misconfiguration). */
|
|
24
|
-
const NUXT_OPTION_KEYS = new Set([
|
|
25
|
-
'ssr',
|
|
26
|
-
'modules',
|
|
27
|
-
'devtools',
|
|
28
|
-
'vite',
|
|
29
|
-
'nitro',
|
|
30
|
-
'runtimeConfig',
|
|
31
|
-
'app',
|
|
32
|
-
'appConfig',
|
|
33
|
-
'css',
|
|
34
|
-
'plugins',
|
|
35
|
-
'hooks',
|
|
36
|
-
'extends',
|
|
37
|
-
'compatibilityDate',
|
|
38
|
-
'experimental',
|
|
39
|
-
'future',
|
|
40
|
-
'i18n',
|
|
41
|
-
'tailwindcss',
|
|
42
|
-
'primevue',
|
|
43
|
-
])
|
|
44
|
-
|
|
45
|
-
export type SplitDesktopUserConfigResult = {
|
|
46
|
-
theme?: string
|
|
47
|
-
apps?: string[]
|
|
48
|
-
modules?: string[]
|
|
49
|
-
desktopRuntime: Record<string, unknown>
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function splitDesktopUserConfig(
|
|
53
|
-
config: Record<string, unknown>,
|
|
54
|
-
configFile = 'desktop.config.ts',
|
|
55
|
-
): SplitDesktopUserConfigResult {
|
|
56
|
-
const theme =
|
|
57
|
-
typeof config.theme === 'string' ? config.theme : undefined
|
|
58
|
-
const apps = Array.isArray(config.apps)
|
|
59
|
-
? (config.apps as string[])
|
|
60
|
-
: undefined
|
|
61
|
-
const modules = Array.isArray(config.modules)
|
|
62
|
-
? (config.modules as string[])
|
|
63
|
-
: undefined
|
|
64
|
-
|
|
65
|
-
const desktopRuntime: Record<string, unknown> = {}
|
|
66
|
-
|
|
67
|
-
for (const [key, value] of Object.entries(config)) {
|
|
68
|
-
if (DESKTOP_MODULE_KEYS.includes(key as (typeof DESKTOP_MODULE_KEYS)[number])) {
|
|
69
|
-
continue
|
|
70
|
-
}
|
|
71
|
-
desktopRuntime[key] = value
|
|
72
|
-
|
|
73
|
-
if (NUXT_OPTION_KEYS.has(key)) {
|
|
74
|
-
console.warn(
|
|
75
|
-
`[@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, ... }).`,
|
|
76
|
-
)
|
|
77
|
-
} else if (!DESKTOP_RUNTIME_KEYS.has(key)) {
|
|
78
|
-
console.warn(
|
|
79
|
-
`[@owdproject/core] ${configFile}: unknown desktop key "${key}" — merged into runtimeConfig.public.desktop only.`,
|
|
80
|
-
)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return { theme, apps, modules, desktopRuntime }
|
|
85
|
-
}
|
package/runtime/utils/utilApp.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { Nuxt } from '@nuxt/schema'
|
|
2
|
-
|
|
3
|
-
export function normalizeApplicationConfig(
|
|
4
|
-
config: ApplicationConfig,
|
|
5
|
-
): ApplicationConfig {
|
|
6
|
-
const normalizedEntries: Record<string, ApplicationEntry> = {}
|
|
7
|
-
|
|
8
|
-
if (config.entries) {
|
|
9
|
-
for (const [key, entry] of Object.entries(config.entries)) {
|
|
10
|
-
normalizedEntries[key] = {
|
|
11
|
-
...entry,
|
|
12
|
-
title: entry.title ?? config.title,
|
|
13
|
-
icon: entry.icon ?? config.icon,
|
|
14
|
-
category: entry.category ?? config.category,
|
|
15
|
-
visibility: entry.visibility ?? 'primary',
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
...config,
|
|
22
|
-
version: config.version ?? 'unknown',
|
|
23
|
-
description: config.description ?? '',
|
|
24
|
-
category: config.category ?? 'other',
|
|
25
|
-
entries: normalizedEntries,
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function registerTailwindPath(nuxt: Nuxt, path: string) {
|
|
30
|
-
nuxt.options.runtimeConfig.app.owd = nuxt.options.runtimeConfig.app.owd || {}
|
|
31
|
-
nuxt.options.runtimeConfig.app.owd.tailwindPaths =
|
|
32
|
-
nuxt.options.runtimeConfig.app.owd.tailwindPaths || []
|
|
33
|
-
|
|
34
|
-
if (!nuxt.options.runtimeConfig.app.owd.tailwindPaths.includes(path)) {
|
|
35
|
-
nuxt.options.runtimeConfig.app.owd.tailwindPaths.push(path)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
export function deepClone<T>(obj: T): T {
|
|
2
|
-
return JSON.parse(JSON.stringify(obj))
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function deepEqual(obj1: any, obj2: any) {
|
|
6
|
-
const keys1 = Object.keys(obj1)
|
|
7
|
-
const keys2 = Object.keys(obj2)
|
|
8
|
-
if (keys1.length !== keys2.length) {
|
|
9
|
-
return false
|
|
10
|
-
}
|
|
11
|
-
for (const key of keys1) {
|
|
12
|
-
if (!obj2.hasOwnProperty(key)) {
|
|
13
|
-
return false
|
|
14
|
-
}
|
|
15
|
-
if (typeof obj1[key] === 'object' && typeof obj2[key] === 'object') {
|
|
16
|
-
if (!deepEqual(obj1[key], obj2[key])) {
|
|
17
|
-
return false
|
|
18
|
-
}
|
|
19
|
-
} else {
|
|
20
|
-
if (obj1[key] !== obj2[key]) {
|
|
21
|
-
return false
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return true
|
|
26
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export function isDebugMode() {
|
|
2
|
-
return import.meta.env.MODE === 'development'
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function debugLog(...messages: any[]) {
|
|
6
|
-
if (!isDebugMode()) {
|
|
7
|
-
return false
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
console.log('[OWD]', ...messages)
|
|
11
|
-
return true
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function debugWarn(...messages: any[]) {
|
|
15
|
-
if (!isDebugMode()) {
|
|
16
|
-
return false
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
console.warn('[OWD]', ...messages)
|
|
20
|
-
return true
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function debugError(...messages: any[]) {
|
|
24
|
-
if (!isDebugMode()) {
|
|
25
|
-
return false
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
console.error('[OWD]', ...messages)
|
|
29
|
-
return true
|
|
30
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { getActivePinia } from 'pinia'
|
|
2
|
-
import { useApplicationManager } from '../composables/useApplicationManager'
|
|
3
|
-
|
|
4
|
-
const pendingDesktopApps: ApplicationConfig[] = []
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Register a desktop app. Queues until Pinia is active when theme/app plugins
|
|
8
|
-
* run before @pinia/nuxt (e.g. published apps using `app:created`).
|
|
9
|
-
*/
|
|
10
|
-
export async function defineDesktopApp(config: ApplicationConfig) {
|
|
11
|
-
if (import.meta.server) return undefined
|
|
12
|
-
|
|
13
|
-
if (getActivePinia()) {
|
|
14
|
-
const applicationManager = useApplicationManager()
|
|
15
|
-
return applicationManager.defineApp(config.id, config)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
pendingDesktopApps.push(config)
|
|
19
|
-
return undefined
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export async function flushPendingDesktopApps() {
|
|
23
|
-
if (pendingDesktopApps.length === 0 || !getActivePinia()) return
|
|
24
|
-
|
|
25
|
-
const queue = pendingDesktopApps.splice(0, pendingDesktopApps.length)
|
|
26
|
-
const applicationManager = useApplicationManager()
|
|
27
|
-
|
|
28
|
-
for (const config of queue) {
|
|
29
|
-
await applicationManager.defineApp(config.id, config)
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function defineDesktopConfig(config: DesktopConfig) {
|
|
34
|
-
return config
|
|
35
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// support for controller-less windows
|
|
2
|
-
// (for example: dummy windows in docs)
|
|
3
|
-
export function handleWindowControllerProps(windowController: any) {
|
|
4
|
-
if (windowController.instanced) {
|
|
5
|
-
return windowController
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
...windowController,
|
|
10
|
-
...windowController.config,
|
|
11
|
-
state: {
|
|
12
|
-
...windowController.config,
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Runtime validation for the object exported from `desktop.config.ts`
|
|
3
|
-
* (or legacy `owd.config.ts`).
|
|
4
|
-
*/
|
|
5
|
-
export function assertValidDesktopUserConfig(
|
|
6
|
-
config: unknown,
|
|
7
|
-
configFile = 'desktop.config.ts',
|
|
8
|
-
): void {
|
|
9
|
-
if (!config || typeof config !== 'object' || Array.isArray(config)) {
|
|
10
|
-
throw new Error(
|
|
11
|
-
`[@owdproject/core] ${configFile} must default-export a non-array object from defineDesktopConfig({ ... }).`,
|
|
12
|
-
)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const c = config as Record<string, unknown>
|
|
16
|
-
|
|
17
|
-
if (c.theme != null && typeof c.theme !== 'string') {
|
|
18
|
-
throw new Error(
|
|
19
|
-
`[@owdproject/core] ${configFile}: \`theme\` must be a string (npm package name of the theme module).`,
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (c.apps !== undefined) {
|
|
24
|
-
if (
|
|
25
|
-
!Array.isArray(c.apps) ||
|
|
26
|
-
!(c.apps as unknown[]).every((item) => typeof item === 'string')
|
|
27
|
-
) {
|
|
28
|
-
throw new Error(
|
|
29
|
-
`[@owdproject/core] ${configFile}: \`apps\` must be an array of strings (Nuxt module package names).`,
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (c.modules !== undefined) {
|
|
35
|
-
if (
|
|
36
|
-
!Array.isArray(c.modules) ||
|
|
37
|
-
!(c.modules as unknown[]).every((item) => typeof item === 'string')
|
|
38
|
-
) {
|
|
39
|
-
throw new Error(
|
|
40
|
-
`[@owdproject/core] ${configFile}: \`modules\` must be an array of strings (Nuxt module package names).`,
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|