@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.
Files changed (49) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +6 -7
  3. package/bin/owd.js +14 -14
  4. package/index.ts +5 -2
  5. package/module.ts +64 -55
  6. package/package.json +19 -17
  7. package/project.json +4 -0
  8. package/runtime/components/Core/Application/CoreApplicationRender.vue +6 -5
  9. package/runtime/components/Core/Application/CoreApplicationWindowsRender.vue +8 -8
  10. package/runtime/components/Core/Background/CoreBackground.vue +1 -1
  11. package/runtime/components/Core/Desktop/CoreDesktop.vue +23 -20
  12. package/runtime/components/Core/Explorer/CoreExplorerFile.vue +47 -38
  13. package/runtime/components/Core/Explorer/CoreExplorerFolder.vue +0 -1
  14. package/runtime/components/Core/Time/CoreTime.vue +10 -7
  15. package/runtime/components/Core/Window/CoreWindow.vue +46 -34
  16. package/runtime/components/Core/Window/CoreWindowContent.vue +3 -5
  17. package/runtime/components/Core/Window/CoreWindowNav.vue +12 -7
  18. package/runtime/composables/useApplicationEntries.ts +51 -0
  19. package/runtime/composables/useApplicationManager.ts +3 -3
  20. package/runtime/composables/useClipboardFs.ts +11 -11
  21. package/runtime/composables/useDesktopManager.ts +2 -2
  22. package/runtime/composables/useTerminalManager.ts +3 -3
  23. package/runtime/core/controllers/ApplicationController.ts +211 -200
  24. package/runtime/core/controllers/WindowController.ts +342 -334
  25. package/runtime/core/managers/ApplicationManager.ts +240 -196
  26. package/runtime/core/managers/DesktopManager.ts +35 -25
  27. package/runtime/core/managers/TerminalManager.ts +36 -32
  28. package/runtime/plugins/resize.client.ts +4 -4
  29. package/runtime/stores/storeApplication.ts +235 -0
  30. package/runtime/stores/storeApplicationMeta.ts +12 -8
  31. package/runtime/stores/storeApplicationWindows.ts +16 -12
  32. package/runtime/stores/storeDesktop.ts +33 -29
  33. package/runtime/stores/storeDesktopVolume.ts +12 -12
  34. package/runtime/stores/storeDesktopWindow.ts +13 -13
  35. package/runtime/stores/storeDesktopWorkspace.ts +35 -31
  36. package/runtime/utils/utilApp.ts +27 -22
  37. package/runtime/utils/utilCommon.ts +43 -43
  38. package/runtime/utils/utilDebug.ts +17 -17
  39. package/runtime/utils/utilDesktop.ts +4 -4
  40. package/runtime/utils/utilTerminal.ts +6 -5
  41. package/runtime/utils/utilWindow.ts +11 -11
  42. package/test/fixtures/basic/app.vue +1 -2
  43. package/test/fixtures/basic/nuxt.config.ts +1 -3
  44. package/tsconfig.app.json +1 -1
  45. package/tsconfig.json +1 -1
  46. package/types/index.d.ts +235 -207
  47. package/vitest.config.ts +3 -3
  48. package/eslint.config.mjs +0 -30
  49. package/runtime/composables/useAppEntries.ts +0 -36
@@ -1,58 +1,58 @@
1
1
  export function deepClone<T>(obj: T): T {
2
- return JSON.parse(JSON.stringify(obj))
2
+ return JSON.parse(JSON.stringify(obj))
3
3
  }
4
4
 
5
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;
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
- 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
- }
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
- return true;
24
+ }
25
+ return true
26
26
  }
27
27
 
28
28
  export function deepMerge<T>(target: T, source: Partial<T>): T {
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
- }
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
- for (const key in source) {
43
- const targetValue = (target as any)[key]
44
- const sourceValue = (source as any)[key]
39
+ if (isObject(target) && isObject(source)) {
40
+ const result = { ...target }
45
41
 
46
- if (isObject(sourceValue) && isObject(targetValue)) {
47
- // @ts-ignore
48
- result[key] = deepMerge(targetValue, sourceValue)
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
- return result
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 source as T
54
+ return result
55
+ }
56
+
57
+ return source as T
58
58
  }
@@ -1,30 +1,30 @@
1
1
  export function isDebugMode() {
2
- return import.meta.env.MODE === 'development'
2
+ return import.meta.env.MODE === 'development'
3
3
  }
4
4
 
5
5
  export function debugLog(...messages: any[]) {
6
- if (!isDebugMode()) {
7
- return false;
8
- }
6
+ if (!isDebugMode()) {
7
+ return false
8
+ }
9
9
 
10
- console.log(`[OWD]`, ...messages);
11
- return true
10
+ console.log('[OWD]', ...messages)
11
+ return true
12
12
  }
13
13
 
14
14
  export function debugWarn(...messages: any[]) {
15
- if (!isDebugMode()) {
16
- return false;
17
- }
15
+ if (!isDebugMode()) {
16
+ return false
17
+ }
18
18
 
19
- console.warn(`[OWD]`, ...messages);
20
- return true
19
+ console.warn('[OWD]', ...messages)
20
+ return true
21
21
  }
22
22
 
23
23
  export function debugError(...messages: any[]) {
24
- if (!isDebugMode()) {
25
- return false;
26
- }
24
+ if (!isDebugMode()) {
25
+ return false
26
+ }
27
27
 
28
- console.error(`[OWD]`, ...messages);
29
- return true
30
- }
28
+ console.error('[OWD]', ...messages)
29
+ return true
30
+ }
@@ -1,10 +1,10 @@
1
- import {useApplicationManager} from "../composables/useApplicationManager";
1
+ import { useApplicationManager } from '../composables/useApplicationManager'
2
2
 
3
3
  export function defineDesktopApp(config: ApplicationConfig) {
4
- const applicationManager = useApplicationManager()
5
- return applicationManager.defineApp(config.id, config)
4
+ const applicationManager = useApplicationManager()
5
+ return applicationManager.defineApp(config.id, config)
6
6
  }
7
7
 
8
8
  export function defineDesktopConfig(config: DesktopConfig) {
9
- return config
9
+ return config
10
10
  }
@@ -1,5 +1,6 @@
1
- export function parseInput(input: string): { command: string; args: string[] } | null {
2
- const match = input.match(/(?:[^\s"]+|"[^"]*")+/g)
3
- if (!match) return null
4
- return { command: match[0], args: match.slice(1).map(arg => arg.replace(/"/g, "")) }
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
- if (windowController.instanced) {
5
- return windowController
6
- }
4
+ if (windowController.instanced) {
5
+ return windowController
6
+ }
7
7
 
8
- return {
9
- ...windowController,
10
- ...windowController.config,
11
- state: {
12
- ...windowController.config,
13
- },
14
- }
15
- }
8
+ return {
9
+ ...windowController,
10
+ ...windowController.config,
11
+ state: {
12
+ ...windowController.config,
13
+ },
14
+ }
15
+ }
@@ -2,5 +2,4 @@
2
2
  <div>basic</div>
3
3
  </template>
4
4
 
5
- <script setup>
6
- </script>
5
+ <script setup></script>
@@ -1,7 +1,5 @@
1
1
  import MyModule from '../../../module'
2
2
 
3
3
  export default defineNuxtConfig({
4
- modules: [
5
- MyModule,
6
- ],
4
+ modules: [MyModule],
7
5
  })
package/tsconfig.app.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "extends": "../../tsconfig.base.json",
3
3
  "compilerOptions": {
4
4
  "outDir": "dist",
5
- "rootDir": "src",
5
+ "rootDir": "runtime",
6
6
  "jsx": "preserve",
7
7
  "jsxImportSource": "vue",
8
8
  "resolveJsonModule": true,
package/tsconfig.json CHANGED
@@ -6,7 +6,7 @@
6
6
  },
7
7
  {
8
8
  "path": "./tsconfig.spec.json"
9
- },
9
+ }
10
10
  ],
11
11
  "extends": "../../tsconfig.base.json"
12
12
  }