@owdproject/core 3.4.0 → 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.
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 +117 -0
  18. package/dist/managers/index.d.ts +117 -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.B0B0KfVK.mjs +865 -0
  24. package/dist/shared/core.B1XxB289.mjs +239 -0
  25. package/dist/shared/core.B3mp7ztE.mjs +237 -0
  26. package/dist/shared/core.BOvFdEVQ.d.ts +114 -0
  27. package/dist/shared/core.CsDFgGnX.mjs +40 -0
  28. package/dist/shared/core.Di1eFcr_.d.mts +114 -0
  29. package/dist/shared/core.Pd_Ogt4g.mjs +101 -0
  30. package/dist/shared/core.b3Xldzyu.mjs +29 -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
@@ -0,0 +1,117 @@
1
+ import { W as WindowManager, a as WindowInstance } from '../shared/core.BOvFdEVQ.js';
2
+ import { CoreIPCBus } from '../events/index.js';
3
+ import { Hookable } from 'hookable';
4
+ import { DesktopWorkareaRect, DesktopRuntimeHooks, ApplicationConfig, ApplicationPermission, WindowState } from '../types/index.js';
5
+
6
+ interface WorkspaceState {
7
+ readonly workspaces: readonly string[];
8
+ readonly active: string;
9
+ readonly workarea: DesktopWorkareaRect;
10
+ }
11
+ declare class WorkspaceManager {
12
+ private state;
13
+ private subscribers;
14
+ private hooks;
15
+ private ipc;
16
+ constructor(options?: {
17
+ workspaces?: string[];
18
+ active?: string;
19
+ workarea?: DesktopWorkareaRect;
20
+ hooks?: Hookable<DesktopRuntimeHooks>;
21
+ ipc?: CoreIPCBus;
22
+ });
23
+ private updateState;
24
+ getSnapshot(): WorkspaceState;
25
+ subscribe(callback: (state: WorkspaceState) => void): () => void;
26
+ private notify;
27
+ get activeWorkspace(): string;
28
+ get workspaces(): string[];
29
+ get workarea(): DesktopWorkareaRect;
30
+ setWorkspace(workspaceId: string): Promise<boolean>;
31
+ setWorkarea(workarea: DesktopWorkareaRect): void;
32
+ addWorkspace(id: string): void;
33
+ removeWorkspace(id: string): boolean;
34
+ }
35
+
36
+ interface ApplicationProcessSnapshot {
37
+ readonly id: string;
38
+ readonly title: string;
39
+ readonly icon?: string;
40
+ readonly category?: string;
41
+ readonly stateValue: string;
42
+ readonly pid: number | null;
43
+ readonly startedAt: number | null;
44
+ readonly isRunning: boolean;
45
+ readonly isSuspended: boolean;
46
+ readonly windowIds: readonly string[];
47
+ }
48
+ declare class ApplicationInstance {
49
+ readonly id: string;
50
+ readonly config: ApplicationConfig;
51
+ private actor;
52
+ private _pid;
53
+ private _startedAt;
54
+ private _windowIds;
55
+ private snapshot;
56
+ private subscribers;
57
+ private windowManager;
58
+ private workspaceManager?;
59
+ private hooks;
60
+ private ipc;
61
+ private allocatePid;
62
+ constructor(options: {
63
+ config: ApplicationConfig;
64
+ windowManager: WindowManager;
65
+ workspaceManager?: WorkspaceManager;
66
+ hooks?: Hookable<DesktopRuntimeHooks>;
67
+ ipc?: CoreIPCBus;
68
+ allocatePid: () => number;
69
+ });
70
+ private computeSnapshot;
71
+ private refreshSnapshot;
72
+ private notify;
73
+ getSnapshot(): ApplicationProcessSnapshot;
74
+ subscribe(callback: (snapshot: ApplicationProcessSnapshot) => void): () => void;
75
+ get pid(): number | null;
76
+ get startedAt(): number | null;
77
+ get stateValue(): string;
78
+ get isRunning(): boolean;
79
+ get isSuspended(): boolean;
80
+ hasPermission(permission: ApplicationPermission): boolean;
81
+ private ensureProcessStarted;
82
+ launch(entryKey?: string, argument?: string): Promise<boolean>;
83
+ openWindow(model: string, meta?: Record<string, any>, initialState?: Partial<WindowState>): Promise<WindowInstance | undefined>;
84
+ closeWindow(windowId: string): Promise<boolean>;
85
+ closeAllWindows(): void;
86
+ suspend(): Promise<boolean>;
87
+ resume(): Promise<boolean>;
88
+ terminate(signal?: 'SIGTERM' | 'SIGKILL'): Promise<boolean>;
89
+ }
90
+ declare class ApplicationManager {
91
+ private apps;
92
+ private snapshotCache;
93
+ private pidCounter;
94
+ private subscribers;
95
+ private windowManager;
96
+ private workspaceManager?;
97
+ private hooks;
98
+ private ipc;
99
+ constructor(options: {
100
+ windowManager: WindowManager;
101
+ workspaceManager?: WorkspaceManager;
102
+ hooks?: Hookable<DesktopRuntimeHooks>;
103
+ ipc?: CoreIPCBus;
104
+ });
105
+ getSnapshot(): ApplicationInstance[];
106
+ subscribe(callback: (apps: ApplicationInstance[]) => void): () => void;
107
+ private notify;
108
+ register(config: ApplicationConfig): ApplicationInstance;
109
+ get(id: string): ApplicationInstance | undefined;
110
+ getByPid(pid: number): ApplicationInstance | undefined;
111
+ get runningApps(): ApplicationInstance[];
112
+ launch(id: string, entryKey?: string, argument?: string): Promise<boolean>;
113
+ terminate(idOrPid: string | number, signal?: 'SIGTERM' | 'SIGKILL'): Promise<boolean>;
114
+ }
115
+
116
+ export { ApplicationInstance, ApplicationManager, WindowInstance, WindowManager, WorkspaceManager };
117
+ export type { ApplicationProcessSnapshot, WorkspaceState };
@@ -0,0 +1,6 @@
1
+ export { A as ApplicationInstance, a as ApplicationManager, W as WindowInstance, b as WindowManager, c as WorkspaceManager } from '../shared/core.B0B0KfVK.mjs';
2
+ import 'xstate';
3
+ import '../shared/core.B3mp7ztE.mjs';
4
+ import '../shared/core.CsDFgGnX.mjs';
5
+ import '../shared/core.Pd_Ogt4g.mjs';
6
+ import 'hookable';
@@ -0,0 +1,57 @@
1
+ import { WindowManager } from '../index.mjs';
2
+ import 'hookable';
3
+ import '../types/index.mjs';
4
+
5
+ /**
6
+ * @owdproject/core - Desktop Session Serializer & Hydration Engine
7
+ * Allows full state capture, persistence (LocalStorage / Database), and instant restore
8
+ * across sessions, devices, and frameworks.
9
+ */
10
+
11
+ interface DesktopSerializedWindow {
12
+ id: string;
13
+ model: string;
14
+ workspace: string;
15
+ title?: string;
16
+ position?: {
17
+ x?: number;
18
+ y?: number;
19
+ z?: number;
20
+ };
21
+ size?: {
22
+ width?: any;
23
+ height?: any;
24
+ };
25
+ maximized?: boolean;
26
+ layout?: any;
27
+ spatial?: any;
28
+ focused?: boolean;
29
+ meta?: Record<string, any>;
30
+ }
31
+ interface DesktopSerializedSession {
32
+ version: number;
33
+ timestamp: number;
34
+ activeWorkspace?: string;
35
+ windows: DesktopSerializedWindow[];
36
+ }
37
+ declare class DesktopSessionManager {
38
+ static readonly CURRENT_VERSION = 1;
39
+ /**
40
+ * Serializes current WindowManager state into a JSON-compatible object.
41
+ */
42
+ static serialize(windowManager: WindowManager, options?: {
43
+ activeWorkspace?: string;
44
+ }): DesktopSerializedSession;
45
+ /**
46
+ * Restores windows from a serialized session into a WindowManager instance.
47
+ */
48
+ static restore(windowManager: WindowManager, session: DesktopSerializedSession, options?: {
49
+ componentResolver?: (model: string) => any;
50
+ }): {
51
+ restoredCount: number;
52
+ errors: string[];
53
+ };
54
+ }
55
+
56
+ export { DesktopSessionManager };
57
+ export type { DesktopSerializedSession, DesktopSerializedWindow };
@@ -0,0 +1,57 @@
1
+ import { WindowManager } from '../index.js';
2
+ import 'hookable';
3
+ import '../types/index.js';
4
+
5
+ /**
6
+ * @owdproject/core - Desktop Session Serializer & Hydration Engine
7
+ * Allows full state capture, persistence (LocalStorage / Database), and instant restore
8
+ * across sessions, devices, and frameworks.
9
+ */
10
+
11
+ interface DesktopSerializedWindow {
12
+ id: string;
13
+ model: string;
14
+ workspace: string;
15
+ title?: string;
16
+ position?: {
17
+ x?: number;
18
+ y?: number;
19
+ z?: number;
20
+ };
21
+ size?: {
22
+ width?: any;
23
+ height?: any;
24
+ };
25
+ maximized?: boolean;
26
+ layout?: any;
27
+ spatial?: any;
28
+ focused?: boolean;
29
+ meta?: Record<string, any>;
30
+ }
31
+ interface DesktopSerializedSession {
32
+ version: number;
33
+ timestamp: number;
34
+ activeWorkspace?: string;
35
+ windows: DesktopSerializedWindow[];
36
+ }
37
+ declare class DesktopSessionManager {
38
+ static readonly CURRENT_VERSION = 1;
39
+ /**
40
+ * Serializes current WindowManager state into a JSON-compatible object.
41
+ */
42
+ static serialize(windowManager: WindowManager, options?: {
43
+ activeWorkspace?: string;
44
+ }): DesktopSerializedSession;
45
+ /**
46
+ * Restores windows from a serialized session into a WindowManager instance.
47
+ */
48
+ static restore(windowManager: WindowManager, session: DesktopSerializedSession, options?: {
49
+ componentResolver?: (model: string) => any;
50
+ }): {
51
+ restoredCount: number;
52
+ errors: string[];
53
+ };
54
+ }
55
+
56
+ export { DesktopSessionManager };
57
+ export type { DesktopSerializedSession, DesktopSerializedWindow };
@@ -0,0 +1,65 @@
1
+ class DesktopSessionManager {
2
+ static CURRENT_VERSION = 1;
3
+ /**
4
+ * Serializes current WindowManager state into a JSON-compatible object.
5
+ */
6
+ static serialize(windowManager, options) {
7
+ const windows = windowManager.getSnapshot();
8
+ const serializedWindows = windows.filter((win) => win.state.active).map((win) => {
9
+ return {
10
+ id: win.id,
11
+ model: win.model ?? "window",
12
+ workspace: win.state.workspace,
13
+ title: win.config.title,
14
+ position: win.state.position,
15
+ size: win.state.size,
16
+ maximized: win.state.maximized,
17
+ layout: win.state.layout,
18
+ spatial: win.state.spatial,
19
+ focused: win.state.focused
20
+ };
21
+ });
22
+ return {
23
+ version: DesktopSessionManager.CURRENT_VERSION,
24
+ timestamp: Date.now(),
25
+ activeWorkspace: options?.activeWorkspace,
26
+ windows: serializedWindows
27
+ };
28
+ }
29
+ /**
30
+ * Restores windows from a serialized session into a WindowManager instance.
31
+ */
32
+ static restore(windowManager, session, options) {
33
+ const errors = [];
34
+ let restoredCount = 0;
35
+ if (!session || typeof session !== "object" || !Array.isArray(session.windows)) {
36
+ return { restoredCount: 0, errors: ["Invalid session format"] };
37
+ }
38
+ for (const item of session.windows) {
39
+ try {
40
+ const component = options?.componentResolver?.(item.model);
41
+ windowManager.createWindow({
42
+ id: item.id,
43
+ model: item.model,
44
+ config: {
45
+ title: item.title,
46
+ component
47
+ },
48
+ initialState: {
49
+ workspace: item.workspace,
50
+ position: item.position,
51
+ size: item.size ?? { width: 640, height: 480 },
52
+ maximized: item.maximized,
53
+ spatial: item.spatial
54
+ }
55
+ });
56
+ restoredCount++;
57
+ } catch (err) {
58
+ errors.push(`Failed to restore window ${item.id}: ${err?.message || String(err)}`);
59
+ }
60
+ }
61
+ return { restoredCount, errors };
62
+ }
63
+ }
64
+
65
+ export { DesktopSessionManager };