@owdproject/core 3.1.3 → 3.1.4-beta.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/CHANGELOG.md +25 -0
- package/README.md +6 -7
- package/bin/owd.js +14 -14
- package/index.ts +5 -2
- package/module.ts +64 -55
- package/package.json +19 -17
- package/project.json +4 -0
- package/runtime/components/Core/Application/CoreApplicationRender.vue +6 -5
- package/runtime/components/Core/Application/CoreApplicationWindowsRender.vue +8 -8
- package/runtime/components/Core/Background/CoreBackground.vue +1 -1
- package/runtime/components/Core/Desktop/CoreDesktop.vue +23 -20
- package/runtime/components/Core/Explorer/CoreExplorerFile.vue +47 -38
- package/runtime/components/Core/Explorer/CoreExplorerFolder.vue +0 -1
- package/runtime/components/Core/Time/CoreTime.vue +10 -7
- package/runtime/components/Core/Window/CoreWindow.vue +46 -34
- package/runtime/components/Core/Window/CoreWindowContent.vue +3 -5
- package/runtime/components/Core/Window/CoreWindowNav.vue +12 -7
- package/runtime/composables/useApplicationEntries.ts +51 -0
- package/runtime/composables/useApplicationManager.ts +3 -3
- package/runtime/composables/useClipboardFs.ts +11 -11
- package/runtime/composables/useDesktopManager.ts +2 -2
- package/runtime/composables/useTerminalManager.ts +3 -3
- package/runtime/core/controllers/ApplicationController.ts +211 -200
- package/runtime/core/controllers/WindowController.ts +342 -334
- package/runtime/core/managers/ApplicationManager.ts +240 -196
- package/runtime/core/managers/DesktopManager.ts +35 -25
- package/runtime/core/managers/TerminalManager.ts +36 -32
- package/runtime/plugins/resize.client.ts +4 -4
- package/runtime/stores/storeApplication.ts +235 -0
- package/runtime/stores/storeApplicationMeta.ts +12 -8
- package/runtime/stores/storeApplicationWindows.ts +16 -12
- package/runtime/stores/storeDesktop.ts +33 -29
- package/runtime/stores/storeDesktopVolume.ts +12 -12
- package/runtime/stores/storeDesktopWindow.ts +13 -13
- package/runtime/stores/storeDesktopWorkspace.ts +35 -31
- package/runtime/utils/utilApp.ts +27 -22
- package/runtime/utils/utilCommon.ts +43 -43
- package/runtime/utils/utilDebug.ts +17 -17
- package/runtime/utils/utilDesktop.ts +4 -4
- package/runtime/utils/utilTerminal.ts +6 -5
- package/runtime/utils/utilWindow.ts +11 -11
- package/test/fixtures/basic/app.vue +1 -2
- package/test/fixtures/basic/nuxt.config.ts +1 -3
- package/tsconfig.app.json +1 -1
- package/tsconfig.json +1 -1
- package/types/index.d.ts +235 -207
- package/vitest.config.ts +3 -3
- package/eslint.config.mjs +0 -30
- package/runtime/composables/useAppEntries.ts +0 -36
|
@@ -1,58 +1,58 @@
|
|
|
1
1
|
export function deepClone<T>(obj: T): T {
|
|
2
|
-
|
|
2
|
+
return JSON.parse(JSON.stringify(obj))
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export function deepEqual(obj1: any, obj2: any) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
10
14
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} else {
|
|
20
|
-
if (obj1[key] !== obj2[key]) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
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
|
+
}
|
|
24
23
|
}
|
|
25
|
-
|
|
24
|
+
}
|
|
25
|
+
return true
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function deepMerge<T>(target: T, source: Partial<T>): T {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
if (isObject(target) && isObject(source)) {
|
|
40
|
-
const result = { ...target }
|
|
29
|
+
function isObject(value: any): value is Record<string, any> {
|
|
30
|
+
return (
|
|
31
|
+
value !== null &&
|
|
32
|
+
typeof value === 'object' &&
|
|
33
|
+
!Array.isArray(value) &&
|
|
34
|
+
!(value instanceof Date) &&
|
|
35
|
+
!(value instanceof RegExp)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
41
38
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const sourceValue = (source as any)[key]
|
|
39
|
+
if (isObject(target) && isObject(source)) {
|
|
40
|
+
const result = { ...target }
|
|
45
41
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
result[key] = sourceValue
|
|
51
|
-
}
|
|
52
|
-
}
|
|
42
|
+
for (const key in source) {
|
|
43
|
+
const targetValue = (target as any)[key]
|
|
44
|
+
const sourceValue = (source as any)[key]
|
|
53
45
|
|
|
54
|
-
|
|
46
|
+
if (isObject(sourceValue) && isObject(targetValue)) {
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
result[key] = deepMerge(targetValue, sourceValue)
|
|
49
|
+
} else {
|
|
50
|
+
result[key] = sourceValue
|
|
51
|
+
}
|
|
55
52
|
}
|
|
56
53
|
|
|
57
|
-
return
|
|
54
|
+
return result
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return source as T
|
|
58
58
|
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
export function isDebugMode() {
|
|
2
|
-
|
|
2
|
+
return import.meta.env.MODE === 'development'
|
|
3
3
|
}
|
|
4
4
|
|
|
5
5
|
export function debugLog(...messages: any[]) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
if (!isDebugMode()) {
|
|
7
|
+
return false
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
console.log('[OWD]', ...messages)
|
|
11
|
+
return true
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function debugWarn(...messages: any[]) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
if (!isDebugMode()) {
|
|
16
|
+
return false
|
|
17
|
+
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
console.warn('[OWD]', ...messages)
|
|
20
|
+
return true
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function debugError(...messages: any[]) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (!isDebugMode()) {
|
|
25
|
+
return false
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
28
|
+
console.error('[OWD]', ...messages)
|
|
29
|
+
return true
|
|
30
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {useApplicationManager} from
|
|
1
|
+
import { useApplicationManager } from '../composables/useApplicationManager'
|
|
2
2
|
|
|
3
3
|
export function defineDesktopApp(config: ApplicationConfig) {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const applicationManager = useApplicationManager()
|
|
5
|
+
return applicationManager.defineApp(config.id, config)
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function defineDesktopConfig(config: DesktopConfig) {
|
|
9
|
-
|
|
9
|
+
return config
|
|
10
10
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
export function shellEscape(str: string): string {
|
|
2
|
+
if (str === '') {
|
|
3
|
+
return "''";
|
|
4
|
+
}
|
|
5
|
+
return `${str.replace(/'/g, `'\\''`)}`;
|
|
6
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// support for controller-less windows
|
|
2
2
|
// (for example: dummy windows in docs)
|
|
3
3
|
export function handleWindowControllerProps(windowController: any) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
if (windowController.instanced) {
|
|
5
|
+
return windowController
|
|
6
|
+
}
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
8
|
+
return {
|
|
9
|
+
...windowController,
|
|
10
|
+
...windowController.config,
|
|
11
|
+
state: {
|
|
12
|
+
...windowController.config,
|
|
13
|
+
},
|
|
14
|
+
}
|
|
15
|
+
}
|
package/tsconfig.app.json
CHANGED