@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
package/bin/lib/workspace.js
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { dirname, join } from 'node:path'
|
|
3
|
-
import { execSync } from 'node:child_process'
|
|
4
|
-
import {
|
|
5
|
-
resolveDesktopConfigPath,
|
|
6
|
-
desktopConfigWritePath,
|
|
7
|
-
} from './desktopConfig.js'
|
|
8
|
-
|
|
9
|
-
export const SCOPE = '@owdproject/'
|
|
10
|
-
|
|
11
|
-
/** Not loadable via desktop.config `modules` (core is the shell). */
|
|
12
|
-
export const DESKTOP_NON_INSTALLABLE = new Set([
|
|
13
|
-
'@owdproject/core',
|
|
14
|
-
])
|
|
15
|
-
|
|
16
|
-
/** Installed documentation modules (current + deprecated package name). */
|
|
17
|
-
export const DOCS_MODULE_PACKAGES = [
|
|
18
|
-
'@owdproject/module-docs',
|
|
19
|
-
'@owdproject/docs',
|
|
20
|
-
]
|
|
21
|
-
|
|
22
|
-
export function hasDocsModuleInstalled(config, deps = {}) {
|
|
23
|
-
return DOCS_MODULE_PACKAGES.some(
|
|
24
|
-
(name) => config?.modules?.includes(name) || deps[name],
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function docsBasePathFromConfig(config) {
|
|
29
|
-
const base = config?.docs?.basePath
|
|
30
|
-
if (typeof base === 'string' && base.startsWith('/')) return base
|
|
31
|
-
return '/docs'
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** Theme-internal UI kits — pulled in by themes, not listed as desktop modules. */
|
|
35
|
-
export function isDesktopKitPackage(pkgName) {
|
|
36
|
-
const short = pkgName.startsWith(SCOPE) ? pkgName.slice(SCOPE.length) : pkgName
|
|
37
|
-
return short.startsWith('kit-')
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Scaffold / blueprint packages — not loadable desktop modules. */
|
|
41
|
-
export function isDesktopTemplatePackage(pkgName) {
|
|
42
|
-
const short = pkgName.startsWith(SCOPE) ? pkgName.slice(SCOPE.length) : pkgName
|
|
43
|
-
return short.endsWith('-template')
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function isInstallableDesktopModule(pkgName) {
|
|
47
|
-
return (
|
|
48
|
-
!DESKTOP_NON_INSTALLABLE.has(pkgName) &&
|
|
49
|
-
!isDesktopKitPackage(pkgName) &&
|
|
50
|
-
!isDesktopTemplatePackage(pkgName)
|
|
51
|
-
)
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const KINDS = {
|
|
55
|
-
app: {
|
|
56
|
-
label: 'Apps',
|
|
57
|
-
topic: 'owd-apps',
|
|
58
|
-
workspaceDir: 'apps',
|
|
59
|
-
configKey: 'apps',
|
|
60
|
-
nx: 'desktop:install-app',
|
|
61
|
-
},
|
|
62
|
-
module: {
|
|
63
|
-
label: 'Modules',
|
|
64
|
-
topic: 'owd-modules',
|
|
65
|
-
workspaceDir: 'packages',
|
|
66
|
-
configKey: 'modules',
|
|
67
|
-
nx: 'desktop:install-module',
|
|
68
|
-
},
|
|
69
|
-
theme: {
|
|
70
|
-
label: 'Themes',
|
|
71
|
-
topic: 'owd-themes',
|
|
72
|
-
workspaceDir: 'themes',
|
|
73
|
-
configKey: 'theme',
|
|
74
|
-
nx: 'desktop:install-theme',
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export function findWorkspaceRoot(startDir = process.cwd()) {
|
|
79
|
-
let dir = startDir
|
|
80
|
-
for (;;) {
|
|
81
|
-
if (
|
|
82
|
-
existsSync(join(dir, 'pnpm-workspace.yaml')) &&
|
|
83
|
-
existsSync(join(dir, 'nx.json'))
|
|
84
|
-
) {
|
|
85
|
-
return dir
|
|
86
|
-
}
|
|
87
|
-
const parent = dirname(dir)
|
|
88
|
-
if (parent === dir) return null
|
|
89
|
-
dir = parent
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export function desktopMetaDir(workspaceRoot) {
|
|
94
|
-
return join(workspaceRoot, '.desktop')
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
export function settingsPath(workspaceRoot) {
|
|
98
|
-
return join(desktopMetaDir(workspaceRoot), 'settings.json')
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/** @typedef {'npm' | 'workspace'} InstallMode */
|
|
102
|
-
|
|
103
|
-
export function normalizeInstallMode(value) {
|
|
104
|
-
if (value === 'workspace' || value === 'dev') return 'workspace'
|
|
105
|
-
return 'npm'
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export function isWorkspaceInstallMode(settings) {
|
|
109
|
-
return normalizeInstallMode(settings?.installMode) === 'workspace'
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export function loadSettings(workspaceRoot) {
|
|
113
|
-
const defaults = {
|
|
114
|
-
devPort: 3000,
|
|
115
|
-
githubUser: null,
|
|
116
|
-
githubOrgs: ['owdproject'],
|
|
117
|
-
installMode: /** @type {InstallMode} */ ('npm'),
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
try {
|
|
121
|
-
const path = settingsPath(workspaceRoot)
|
|
122
|
-
if (!existsSync(path)) {
|
|
123
|
-
return { ...defaults, ...detectGithubUser(), installMode: 'npm' }
|
|
124
|
-
}
|
|
125
|
-
const merged = { ...defaults, ...detectGithubUser(), ...JSON.parse(readFileSync(path, 'utf8')) }
|
|
126
|
-
merged.installMode = normalizeInstallMode(merged.installMode)
|
|
127
|
-
return merged
|
|
128
|
-
} catch {
|
|
129
|
-
return { ...defaults, ...detectGithubUser(), installMode: 'npm' }
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function detectGithubUser() {
|
|
134
|
-
const fromEnv = process.env.OWD_GITHUB_USER?.trim()
|
|
135
|
-
if (fromEnv) return { githubUser: fromEnv }
|
|
136
|
-
|
|
137
|
-
try {
|
|
138
|
-
const user = execSync('git config --get github.user || git config --get user.username', {
|
|
139
|
-
encoding: 'utf8',
|
|
140
|
-
stdio: ['ignore', 'pipe', 'ignore'],
|
|
141
|
-
}).trim()
|
|
142
|
-
if (user) return { githubUser: user }
|
|
143
|
-
} catch {
|
|
144
|
-
/* ignore */
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return {}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
export function saveSettings(workspaceRoot, settings) {
|
|
151
|
-
const dir = desktopMetaDir(workspaceRoot)
|
|
152
|
-
mkdirSync(dir, { recursive: true })
|
|
153
|
-
writeFileSync(settingsPath(workspaceRoot), JSON.stringify(settings, null, 2) + '\n')
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function desktopPaths(workspaceRoot) {
|
|
157
|
-
const desktop = join(workspaceRoot, 'desktop')
|
|
158
|
-
const resolved = resolveDesktopConfigPath(desktop)
|
|
159
|
-
const configWrite = desktopConfigWritePath(desktop)
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
desktop,
|
|
163
|
-
config: resolved?.path ?? configWrite,
|
|
164
|
-
configWrite,
|
|
165
|
-
configLegacy: resolved?.legacy ?? false,
|
|
166
|
-
packageJson: join(desktop, 'package.json'),
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export function shortName(pkgName) {
|
|
171
|
-
return pkgName.startsWith(SCOPE) ? pkgName.slice(SCOPE.length) : pkgName
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export function fullName(short) {
|
|
175
|
-
return short.startsWith(SCOPE) ? short : `${SCOPE}${short}`
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export function inferKind(shortName) {
|
|
179
|
-
if (shortName.startsWith('app-')) return 'app'
|
|
180
|
-
if (shortName.startsWith('theme-')) return 'theme'
|
|
181
|
-
return 'module'
|
|
182
|
-
}
|