@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.
- package/README.md +112 -13
- 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 +56 -112
- package/CHANGELOG.md +0 -98
- package/DESKTOP_KERNEL.md +0 -232
- package/MIGRATION_3.3.2.md +0 -23
- package/MIGRATION_3.4.md +0 -126
- package/PLAYGROUND.md +0 -91
- package/dist/module.d.mts +0 -13
- package/dist/module.json +0 -9
- package/dist/module.mjs +0 -254
- package/dist/types.d.mts +0 -7
- package/index.ts +0 -8
- package/kit/authoring.ts +0 -340
- package/kit/defineDesktopApp.ts +0 -56
- package/module.ts +0 -203
- package/runtime/components/Application/DesktopCoreApplicationRender.vue +0 -20
- package/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue +0 -38
- package/runtime/components/background/DesktopCoreBackground.vue +0 -16
- package/runtime/components/core/DesktopCore.vue +0 -43
- package/runtime/components/time/DesktopCoreTime.vue +0 -56
- package/runtime/components/window/DesktopCoreWindow.vue +0 -215
- package/runtime/components/window/DesktopCoreWindowContent.vue +0 -28
- package/runtime/components/window/DesktopCoreWindowNav.vue +0 -66
- package/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue +0 -74
- package/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue +0 -84
- package/runtime/composables/useApplicationEntries.ts +0 -51
- package/runtime/composables/useApplicationManager.ts +0 -285
- package/runtime/composables/useBlockNonInputContextMenu.ts +0 -30
- package/runtime/composables/useDesktopConfig.ts +0 -8
- package/runtime/composables/useDesktopDialogs.ts +0 -16
- package/runtime/composables/useDesktopExtension.ts +0 -8
- package/runtime/composables/useDesktopManager.ts +0 -51
- package/runtime/composables/useDesktopManifest.ts +0 -17
- package/runtime/composables/useDesktopSession.ts +0 -27
- package/runtime/composables/useDesktopShellIdentity.ts +0 -99
- package/runtime/composables/useDesktopShellOptions.ts +0 -36
- package/runtime/composables/useDesktopShellReady.ts +0 -7
- package/runtime/composables/useDesktopWorkArea.ts +0 -93
- package/runtime/composables/useTerminalManager.ts +0 -159
- package/runtime/composables/useToggleWindowMaximize.ts +0 -35
- package/runtime/composables/useWindowDragHandlers.ts +0 -47
- package/runtime/composables/useWindowSnapDrop.ts +0 -112
- package/runtime/composables/useWorkspaceEdgeDrop.ts +0 -176
- package/runtime/composables/useWorkspaceManager.ts +0 -67
- package/runtime/composables/useWorkspaceOverviewCapture.ts +0 -92
- package/runtime/composables/useWorkspaceOverviewLiveScale.ts +0 -151
- package/runtime/constants/desktopShellKeys.ts +0 -12
- package/runtime/constants/shellLayout.ts +0 -5
- package/runtime/dialogs/desktopDialogProvider.ts +0 -73
- package/runtime/internal/controllers/ApplicationController.ts +0 -351
- package/runtime/internal/controllers/WindowController.ts +0 -547
- package/runtime/plugins/01.desktop-shell-init.client.ts +0 -28
- package/runtime/plugins/02.desktop-register-desktop-apps.client.ts +0 -13
- package/runtime/plugins/resize.client.ts +0 -6
- package/runtime/stores/storeApplicationMeta.ts +0 -60
- package/runtime/stores/storeApplicationWindows.ts +0 -21
- package/runtime/stores/storeDesktop.ts +0 -71
- package/runtime/stores/storeDesktopDefaultApps.ts +0 -54
- package/runtime/stores/storeDesktopVolume.ts +0 -19
- package/runtime/stores/storeDesktopWindow.ts +0 -38
- package/runtime/stores/storeDesktopWorkspace.ts +0 -105
- package/runtime/stores/storeIds.ts +0 -35
- package/runtime/types/desktopMenu.ts +0 -10
- package/runtime/utils/initDesktopShell.ts +0 -80
- package/runtime/utils/migratePersistedStoreIds.ts +0 -57
- package/runtime/utils/utilApp.ts +0 -25
- package/runtime/utils/utilCaptureElementToCanvas.ts +0 -21
- package/runtime/utils/utilCommon.ts +0 -26
- package/runtime/utils/utilDebug.ts +0 -30
- package/runtime/utils/utilDetectSnapZone.ts +0 -57
- package/runtime/utils/utilTerminal.ts +0 -6
- package/runtime/utils/utilWindowControllerAdapter.ts +0 -15
- package/runtime/utils/utilWindowLayout.ts +0 -82
- package/runtime/utils/utilWindowMaximizeLayout.ts +0 -44
- package/runtime/utils/utilWorkspaceWindows.ts +0 -33
- package/types/index.d.ts +0 -531
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Hookable } from 'hookable';
|
|
2
|
+
import { DesktopRuntimeHooks, DesktopWorkareaRect, DesktopCommand, DesktopKernelEvent } from './types/index.mjs';
|
|
3
|
+
export { ApplicationConfig, ApplicationConfigProvide, ApplicationEntry, ApplicationEntryVisibility, ApplicationPermission, CommandOutput, DesktopAppDefineContext, DesktopAppLaunchContext, DesktopAppSignalContext, DesktopCommandArg, DesktopCommandExecContext, DesktopCommandOption, DesktopWindowCloseContext, DesktopWindowOpenContext, DesktopWorkspaceSwitchContext, SpatialEuler, SpatialLayoutMode, SpatialPoint3D, SpatialTransform, WindowBounds, WindowConfig, WindowLayout, WindowOverride, WindowPosition, WindowSize, WindowSizeValue, WindowState, WindowStoredState } from './types/index.mjs';
|
|
4
|
+
import { C as CoreIPCBus, W as WindowManager, a as WindowInstance } from './shared/core.Di1eFcr_.mjs';
|
|
5
|
+
export { E as EventHandler, g as globalIPCBus } from './shared/core.Di1eFcr_.mjs';
|
|
6
|
+
import { WorkspaceManager, ApplicationManager, ApplicationInstance, WorkspaceState } from './managers/index.mjs';
|
|
7
|
+
export { ApplicationProcessSnapshot } from './managers/index.mjs';
|
|
8
|
+
import { DesktopCommands, DesktopKeybindings } from './events/index.mjs';
|
|
9
|
+
export { DesktopCommandHandler, KeybindingActionContext, KeybindingHandler, RegisteredDesktopCommand, createDesktopHooks, formatDuration, globalDesktopHooks, padEnd, parseCommandLine, shellEscape } from './events/index.mjs';
|
|
10
|
+
import { DesktopSerializedSession } from './session/index.mjs';
|
|
11
|
+
export { DesktopSerializedWindow, DesktopSessionManager } from './session/index.mjs';
|
|
12
|
+
export { ApplicationMachine, WindowMachine, applicationMachine, windowMachine } from './machines/index.mjs';
|
|
13
|
+
export { DetectSnapZoneOptions, EMPTY_DESKTOP_WORKAREA, WINDOW_SNAP_EDGE_PX, WORKSPACE_EDGE_DROP_PX, computeCenteredPosition, computeSnapRect, detectSnapZone, parseWindowConfigSize, resolveDesktopWorkarea, resolveInitialWindowPosition, workareaBottom, workareaRight } from './layout/index.mjs';
|
|
14
|
+
export { DesktopPointerSession, DragSessionOptions, IframeGuard, ResizeDirection, ResizeSessionOptions } from './dom/index.mjs';
|
|
15
|
+
import 'xstate';
|
|
16
|
+
|
|
17
|
+
interface DesktopOptions {
|
|
18
|
+
workspaces?: string[];
|
|
19
|
+
activeWorkspace?: string;
|
|
20
|
+
workarea?: DesktopWorkareaRect;
|
|
21
|
+
maxIpcEvents?: number;
|
|
22
|
+
}
|
|
23
|
+
interface DesktopSnapshot {
|
|
24
|
+
readonly windows: readonly WindowInstance[];
|
|
25
|
+
readonly applications: readonly ApplicationInstance[];
|
|
26
|
+
readonly workspace: WorkspaceState;
|
|
27
|
+
readonly commands: readonly DesktopCommand[];
|
|
28
|
+
readonly events: readonly DesktopKernelEvent[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Unified, framework-independent Desktop instance.
|
|
32
|
+
* Encapsulates WindowManager, ApplicationManager, WorkspaceManager, DesktopCommands,
|
|
33
|
+
* Hookable lifecycle hooks, IPC event bus, session persistence, and service registry.
|
|
34
|
+
*/
|
|
35
|
+
declare class Desktop {
|
|
36
|
+
readonly hooks: Hookable<DesktopRuntimeHooks>;
|
|
37
|
+
readonly ipc: CoreIPCBus;
|
|
38
|
+
readonly windows: WindowManager;
|
|
39
|
+
readonly workspaces: WorkspaceManager;
|
|
40
|
+
readonly applications: ApplicationManager;
|
|
41
|
+
readonly commands: DesktopCommands;
|
|
42
|
+
readonly keybindings: DesktopKeybindings;
|
|
43
|
+
private serviceRegistry;
|
|
44
|
+
private snapshotCache;
|
|
45
|
+
private subscribers;
|
|
46
|
+
constructor(options?: DesktopOptions);
|
|
47
|
+
private buildSnapshot;
|
|
48
|
+
getSnapshot(): DesktopSnapshot;
|
|
49
|
+
subscribe(callback: (snapshot: DesktopSnapshot) => void): () => void;
|
|
50
|
+
readonly session: {
|
|
51
|
+
serialize: () => DesktopSerializedSession;
|
|
52
|
+
restore: (sessionData: DesktopSerializedSession, options?: {
|
|
53
|
+
componentResolver?: (model: string) => any;
|
|
54
|
+
}) => {
|
|
55
|
+
restoredCount: number;
|
|
56
|
+
errors: string[];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly services: {
|
|
60
|
+
provide: <T>(name: string, service: T) => void;
|
|
61
|
+
inject: <T = any>(name: string) => T | undefined;
|
|
62
|
+
has: (name: string) => boolean;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Primary factory to create an isolated, headless Desktop instance.
|
|
67
|
+
*/
|
|
68
|
+
declare function createDesktop(options?: DesktopOptions): Desktop;
|
|
69
|
+
declare const createDesktopKernel: typeof createDesktop;
|
|
70
|
+
type DesktopKernel = Desktop;
|
|
71
|
+
|
|
72
|
+
export { ApplicationInstance, ApplicationManager, CoreIPCBus, Desktop, DesktopCommand, DesktopCommands, DesktopKernelEvent, DesktopKeybindings, DesktopRuntimeHooks, DesktopSerializedSession, DesktopWorkareaRect, WindowInstance, WindowManager, WorkspaceManager, WorkspaceState, createDesktop, createDesktopKernel };
|
|
73
|
+
export type { DesktopKernel, DesktopOptions, DesktopSnapshot };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Hookable } from 'hookable';
|
|
2
|
+
import { DesktopRuntimeHooks, DesktopWorkareaRect, DesktopCommand, DesktopKernelEvent } from './types/index.js';
|
|
3
|
+
export { ApplicationConfig, ApplicationConfigProvide, ApplicationEntry, ApplicationEntryVisibility, ApplicationPermission, CommandOutput, DesktopAppDefineContext, DesktopAppLaunchContext, DesktopAppSignalContext, DesktopCommandArg, DesktopCommandExecContext, DesktopCommandOption, DesktopWindowCloseContext, DesktopWindowOpenContext, DesktopWorkspaceSwitchContext, SpatialEuler, SpatialLayoutMode, SpatialPoint3D, SpatialTransform, WindowBounds, WindowConfig, WindowLayout, WindowOverride, WindowPosition, WindowSize, WindowSizeValue, WindowState, WindowStoredState } from './types/index.js';
|
|
4
|
+
import { C as CoreIPCBus, W as WindowManager, a as WindowInstance } from './shared/core.BOvFdEVQ.js';
|
|
5
|
+
export { E as EventHandler, g as globalIPCBus } from './shared/core.BOvFdEVQ.js';
|
|
6
|
+
import { WorkspaceManager, ApplicationManager, ApplicationInstance, WorkspaceState } from './managers/index.js';
|
|
7
|
+
export { ApplicationProcessSnapshot } from './managers/index.js';
|
|
8
|
+
import { DesktopCommands, DesktopKeybindings } from './events/index.js';
|
|
9
|
+
export { DesktopCommandHandler, KeybindingActionContext, KeybindingHandler, RegisteredDesktopCommand, createDesktopHooks, formatDuration, globalDesktopHooks, padEnd, parseCommandLine, shellEscape } from './events/index.js';
|
|
10
|
+
import { DesktopSerializedSession } from './session/index.js';
|
|
11
|
+
export { DesktopSerializedWindow, DesktopSessionManager } from './session/index.js';
|
|
12
|
+
export { ApplicationMachine, WindowMachine, applicationMachine, windowMachine } from './machines/index.js';
|
|
13
|
+
export { DetectSnapZoneOptions, EMPTY_DESKTOP_WORKAREA, WINDOW_SNAP_EDGE_PX, WORKSPACE_EDGE_DROP_PX, computeCenteredPosition, computeSnapRect, detectSnapZone, parseWindowConfigSize, resolveDesktopWorkarea, resolveInitialWindowPosition, workareaBottom, workareaRight } from './layout/index.js';
|
|
14
|
+
export { DesktopPointerSession, DragSessionOptions, IframeGuard, ResizeDirection, ResizeSessionOptions } from './dom/index.js';
|
|
15
|
+
import 'xstate';
|
|
16
|
+
|
|
17
|
+
interface DesktopOptions {
|
|
18
|
+
workspaces?: string[];
|
|
19
|
+
activeWorkspace?: string;
|
|
20
|
+
workarea?: DesktopWorkareaRect;
|
|
21
|
+
maxIpcEvents?: number;
|
|
22
|
+
}
|
|
23
|
+
interface DesktopSnapshot {
|
|
24
|
+
readonly windows: readonly WindowInstance[];
|
|
25
|
+
readonly applications: readonly ApplicationInstance[];
|
|
26
|
+
readonly workspace: WorkspaceState;
|
|
27
|
+
readonly commands: readonly DesktopCommand[];
|
|
28
|
+
readonly events: readonly DesktopKernelEvent[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Unified, framework-independent Desktop instance.
|
|
32
|
+
* Encapsulates WindowManager, ApplicationManager, WorkspaceManager, DesktopCommands,
|
|
33
|
+
* Hookable lifecycle hooks, IPC event bus, session persistence, and service registry.
|
|
34
|
+
*/
|
|
35
|
+
declare class Desktop {
|
|
36
|
+
readonly hooks: Hookable<DesktopRuntimeHooks>;
|
|
37
|
+
readonly ipc: CoreIPCBus;
|
|
38
|
+
readonly windows: WindowManager;
|
|
39
|
+
readonly workspaces: WorkspaceManager;
|
|
40
|
+
readonly applications: ApplicationManager;
|
|
41
|
+
readonly commands: DesktopCommands;
|
|
42
|
+
readonly keybindings: DesktopKeybindings;
|
|
43
|
+
private serviceRegistry;
|
|
44
|
+
private snapshotCache;
|
|
45
|
+
private subscribers;
|
|
46
|
+
constructor(options?: DesktopOptions);
|
|
47
|
+
private buildSnapshot;
|
|
48
|
+
getSnapshot(): DesktopSnapshot;
|
|
49
|
+
subscribe(callback: (snapshot: DesktopSnapshot) => void): () => void;
|
|
50
|
+
readonly session: {
|
|
51
|
+
serialize: () => DesktopSerializedSession;
|
|
52
|
+
restore: (sessionData: DesktopSerializedSession, options?: {
|
|
53
|
+
componentResolver?: (model: string) => any;
|
|
54
|
+
}) => {
|
|
55
|
+
restoredCount: number;
|
|
56
|
+
errors: string[];
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
readonly services: {
|
|
60
|
+
provide: <T>(name: string, service: T) => void;
|
|
61
|
+
inject: <T = any>(name: string) => T | undefined;
|
|
62
|
+
has: (name: string) => boolean;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Primary factory to create an isolated, headless Desktop instance.
|
|
67
|
+
*/
|
|
68
|
+
declare function createDesktop(options?: DesktopOptions): Desktop;
|
|
69
|
+
declare const createDesktopKernel: typeof createDesktop;
|
|
70
|
+
type DesktopKernel = Desktop;
|
|
71
|
+
|
|
72
|
+
export { ApplicationInstance, ApplicationManager, CoreIPCBus, Desktop, DesktopCommand, DesktopCommands, DesktopKernelEvent, DesktopKeybindings, DesktopRuntimeHooks, DesktopSerializedSession, DesktopWorkareaRect, WindowInstance, WindowManager, WorkspaceManager, WorkspaceState, createDesktop, createDesktopKernel };
|
|
73
|
+
export type { DesktopKernel, DesktopOptions, DesktopSnapshot };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { c as WorkspaceManager, b as WindowManager, a as ApplicationManager } from './shared/core.B0B0KfVK.mjs';
|
|
2
|
+
export { A as ApplicationInstance, W as WindowInstance } from './shared/core.B0B0KfVK.mjs';
|
|
3
|
+
import { c as createDesktopHooks, C as CoreIPCBus } from './shared/core.Pd_Ogt4g.mjs';
|
|
4
|
+
export { g as globalDesktopHooks, a as globalIPCBus } from './shared/core.Pd_Ogt4g.mjs';
|
|
5
|
+
import { D as DesktopCommands, a as DesktopKeybindings } from './shared/core.B1XxB289.mjs';
|
|
6
|
+
export { f as formatDuration, p as padEnd, b as parseCommandLine, s as shellEscape } from './shared/core.B1XxB289.mjs';
|
|
7
|
+
import { DesktopSessionManager } from './session/index.mjs';
|
|
8
|
+
export { a as applicationMachine, w as windowMachine } from './shared/core.B3mp7ztE.mjs';
|
|
9
|
+
export { c as computeSnapRect, w as workareaBottom, a as workareaRight } from './shared/core.CsDFgGnX.mjs';
|
|
10
|
+
export { W as WINDOW_SNAP_EDGE_PX, a as WORKSPACE_EDGE_DROP_PX, d as detectSnapZone } from './shared/core.b3Xldzyu.mjs';
|
|
11
|
+
export { EMPTY_DESKTOP_WORKAREA, computeCenteredPosition, parseWindowConfigSize, resolveDesktopWorkarea, resolveInitialWindowPosition } from './layout/index.mjs';
|
|
12
|
+
export { DesktopPointerSession, IframeGuard } from './dom/index.mjs';
|
|
13
|
+
import 'xstate';
|
|
14
|
+
import 'hookable';
|
|
15
|
+
|
|
16
|
+
class Desktop {
|
|
17
|
+
hooks;
|
|
18
|
+
ipc;
|
|
19
|
+
windows;
|
|
20
|
+
workspaces;
|
|
21
|
+
applications;
|
|
22
|
+
commands;
|
|
23
|
+
keybindings;
|
|
24
|
+
serviceRegistry = /* @__PURE__ */ new Map();
|
|
25
|
+
snapshotCache;
|
|
26
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
27
|
+
constructor(options) {
|
|
28
|
+
this.hooks = createDesktopHooks();
|
|
29
|
+
this.ipc = new CoreIPCBus({ maxEvents: options?.maxIpcEvents ?? 150 });
|
|
30
|
+
this.workspaces = new WorkspaceManager({
|
|
31
|
+
workspaces: options?.workspaces,
|
|
32
|
+
active: options?.activeWorkspace,
|
|
33
|
+
workarea: options?.workarea,
|
|
34
|
+
hooks: this.hooks,
|
|
35
|
+
ipc: this.ipc
|
|
36
|
+
});
|
|
37
|
+
this.windows = new WindowManager({
|
|
38
|
+
hooks: this.hooks,
|
|
39
|
+
ipc: this.ipc
|
|
40
|
+
});
|
|
41
|
+
this.applications = new ApplicationManager({
|
|
42
|
+
windowManager: this.windows,
|
|
43
|
+
workspaceManager: this.workspaces,
|
|
44
|
+
hooks: this.hooks,
|
|
45
|
+
ipc: this.ipc
|
|
46
|
+
});
|
|
47
|
+
this.commands = new DesktopCommands({
|
|
48
|
+
hooks: this.hooks,
|
|
49
|
+
ipc: this.ipc
|
|
50
|
+
});
|
|
51
|
+
this.keybindings = new DesktopKeybindings(this.windows);
|
|
52
|
+
this.snapshotCache = this.buildSnapshot();
|
|
53
|
+
const refresh = () => {
|
|
54
|
+
this.snapshotCache = this.buildSnapshot();
|
|
55
|
+
for (const sub of this.subscribers) {
|
|
56
|
+
try {
|
|
57
|
+
sub(this.snapshotCache);
|
|
58
|
+
} catch {
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
this.windows.subscribe(refresh);
|
|
63
|
+
this.applications.subscribe(refresh);
|
|
64
|
+
this.workspaces.subscribe(refresh);
|
|
65
|
+
this.commands.subscribe(refresh);
|
|
66
|
+
this.ipc.subscribe(refresh);
|
|
67
|
+
}
|
|
68
|
+
buildSnapshot() {
|
|
69
|
+
return Object.freeze({
|
|
70
|
+
windows: this.windows.getSnapshot(),
|
|
71
|
+
applications: this.applications.getSnapshot(),
|
|
72
|
+
workspace: this.workspaces.getSnapshot(),
|
|
73
|
+
commands: this.commands.getSnapshot(),
|
|
74
|
+
events: Object.freeze([...this.ipc.getEvents()])
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getSnapshot() {
|
|
78
|
+
return this.snapshotCache;
|
|
79
|
+
}
|
|
80
|
+
subscribe(callback) {
|
|
81
|
+
this.subscribers.add(callback);
|
|
82
|
+
callback(this.snapshotCache);
|
|
83
|
+
return () => {
|
|
84
|
+
this.subscribers.delete(callback);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
session = {
|
|
88
|
+
serialize: () => DesktopSessionManager.serialize(this.windows, {
|
|
89
|
+
activeWorkspace: this.workspaces.activeWorkspace
|
|
90
|
+
}),
|
|
91
|
+
restore: (sessionData, options) => {
|
|
92
|
+
if (sessionData.activeWorkspace) {
|
|
93
|
+
void this.workspaces.setWorkspace(sessionData.activeWorkspace);
|
|
94
|
+
}
|
|
95
|
+
return DesktopSessionManager.restore(this.windows, sessionData, options);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
services = {
|
|
99
|
+
provide: (name, service) => {
|
|
100
|
+
this.serviceRegistry.set(name, service);
|
|
101
|
+
},
|
|
102
|
+
inject: (name) => {
|
|
103
|
+
return this.serviceRegistry.get(name);
|
|
104
|
+
},
|
|
105
|
+
has: (name) => {
|
|
106
|
+
return this.serviceRegistry.has(name);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function createDesktop(options) {
|
|
111
|
+
return new Desktop(options);
|
|
112
|
+
}
|
|
113
|
+
const createDesktopKernel = createDesktop;
|
|
114
|
+
|
|
115
|
+
export { ApplicationManager, CoreIPCBus, Desktop, DesktopCommands, DesktopKeybindings, DesktopSessionManager, WindowManager, WorkspaceManager, createDesktop, createDesktopHooks, createDesktopKernel };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WindowLayout, DesktopWorkareaRect, WindowBounds, WindowConfig } from '../types/index.mjs';
|
|
2
|
+
|
|
3
|
+
declare function workareaBottom(workarea: DesktopWorkareaRect): number;
|
|
4
|
+
declare function workareaRight(workarea: DesktopWorkareaRect): number;
|
|
5
|
+
/**
|
|
6
|
+
* Pure math: Viewport rectangle for a snap zone inside the shell work area.
|
|
7
|
+
*/
|
|
8
|
+
declare function computeSnapRect(zone: Exclude<WindowLayout, 'normal'>, workarea: DesktopWorkareaRect): WindowBounds;
|
|
9
|
+
|
|
10
|
+
type SnapZoneHint = Exclude<WindowLayout, 'normal'>;
|
|
11
|
+
declare const WINDOW_SNAP_EDGE_PX = 24;
|
|
12
|
+
declare const WORKSPACE_EDGE_DROP_PX = 32;
|
|
13
|
+
type DetectSnapZoneOptions = {
|
|
14
|
+
edgePx?: number;
|
|
15
|
+
/** When true, left/right half snap is suppressed in the outer workspace-edge band. */
|
|
16
|
+
deferSideSnapForWorkspaceEdge?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Pure math: Resolve snap zone from pointer position and shell work area.
|
|
20
|
+
* Returns null when the pointer is not in a snap band.
|
|
21
|
+
*/
|
|
22
|
+
declare function detectSnapZone(clientX: number, clientY: number, workarea: DesktopWorkareaRect, options?: DetectSnapZoneOptions): SnapZoneHint | null;
|
|
23
|
+
|
|
24
|
+
declare const EMPTY_DESKTOP_WORKAREA: DesktopWorkareaRect;
|
|
25
|
+
declare function parseWindowConfigSize(value: number | string | undefined, fallback: number): number;
|
|
26
|
+
declare function resolveDesktopWorkarea(workarea?: DesktopWorkareaRect): DesktopWorkareaRect;
|
|
27
|
+
declare function computeCenteredPosition(workarea: DesktopWorkareaRect, windowWidth: number, windowHeight: number): {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
declare function resolveInitialWindowPosition(options: {
|
|
32
|
+
windowConfig: WindowConfig;
|
|
33
|
+
workarea?: DesktopWorkareaRect;
|
|
34
|
+
cascadeOffset?: number;
|
|
35
|
+
}): {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { DesktopWorkareaRect, EMPTY_DESKTOP_WORKAREA, WINDOW_SNAP_EDGE_PX, WORKSPACE_EDGE_DROP_PX, WindowBounds, WindowLayout, computeCenteredPosition, computeSnapRect, detectSnapZone, parseWindowConfigSize, resolveDesktopWorkarea, resolveInitialWindowPosition, workareaBottom, workareaRight };
|
|
41
|
+
export type { DetectSnapZoneOptions, SnapZoneHint };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { WindowLayout, DesktopWorkareaRect, WindowBounds, WindowConfig } from '../types/index.js';
|
|
2
|
+
|
|
3
|
+
declare function workareaBottom(workarea: DesktopWorkareaRect): number;
|
|
4
|
+
declare function workareaRight(workarea: DesktopWorkareaRect): number;
|
|
5
|
+
/**
|
|
6
|
+
* Pure math: Viewport rectangle for a snap zone inside the shell work area.
|
|
7
|
+
*/
|
|
8
|
+
declare function computeSnapRect(zone: Exclude<WindowLayout, 'normal'>, workarea: DesktopWorkareaRect): WindowBounds;
|
|
9
|
+
|
|
10
|
+
type SnapZoneHint = Exclude<WindowLayout, 'normal'>;
|
|
11
|
+
declare const WINDOW_SNAP_EDGE_PX = 24;
|
|
12
|
+
declare const WORKSPACE_EDGE_DROP_PX = 32;
|
|
13
|
+
type DetectSnapZoneOptions = {
|
|
14
|
+
edgePx?: number;
|
|
15
|
+
/** When true, left/right half snap is suppressed in the outer workspace-edge band. */
|
|
16
|
+
deferSideSnapForWorkspaceEdge?: boolean;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Pure math: Resolve snap zone from pointer position and shell work area.
|
|
20
|
+
* Returns null when the pointer is not in a snap band.
|
|
21
|
+
*/
|
|
22
|
+
declare function detectSnapZone(clientX: number, clientY: number, workarea: DesktopWorkareaRect, options?: DetectSnapZoneOptions): SnapZoneHint | null;
|
|
23
|
+
|
|
24
|
+
declare const EMPTY_DESKTOP_WORKAREA: DesktopWorkareaRect;
|
|
25
|
+
declare function parseWindowConfigSize(value: number | string | undefined, fallback: number): number;
|
|
26
|
+
declare function resolveDesktopWorkarea(workarea?: DesktopWorkareaRect): DesktopWorkareaRect;
|
|
27
|
+
declare function computeCenteredPosition(workarea: DesktopWorkareaRect, windowWidth: number, windowHeight: number): {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
declare function resolveInitialWindowPosition(options: {
|
|
32
|
+
windowConfig: WindowConfig;
|
|
33
|
+
workarea?: DesktopWorkareaRect;
|
|
34
|
+
cascadeOffset?: number;
|
|
35
|
+
}): {
|
|
36
|
+
x: number;
|
|
37
|
+
y: number;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { DesktopWorkareaRect, EMPTY_DESKTOP_WORKAREA, WINDOW_SNAP_EDGE_PX, WORKSPACE_EDGE_DROP_PX, WindowBounds, WindowLayout, computeCenteredPosition, computeSnapRect, detectSnapZone, parseWindowConfigSize, resolveDesktopWorkarea, resolveInitialWindowPosition, workareaBottom, workareaRight };
|
|
41
|
+
export type { DetectSnapZoneOptions, SnapZoneHint };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export { c as computeSnapRect, w as workareaBottom, a as workareaRight } from '../shared/core.CsDFgGnX.mjs';
|
|
2
|
+
export { W as WINDOW_SNAP_EDGE_PX, a as WORKSPACE_EDGE_DROP_PX, d as detectSnapZone } from '../shared/core.b3Xldzyu.mjs';
|
|
3
|
+
|
|
4
|
+
const EMPTY_DESKTOP_WORKAREA = {
|
|
5
|
+
x: 0,
|
|
6
|
+
y: 0,
|
|
7
|
+
width: 0,
|
|
8
|
+
height: 0
|
|
9
|
+
};
|
|
10
|
+
function parseWindowConfigSize(value, fallback) {
|
|
11
|
+
if (typeof value === "number") {
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
if (typeof value === "string" && /^\d+$/.test(value)) {
|
|
15
|
+
return Number(value);
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === "string") {
|
|
18
|
+
const parsed = Number.parseFloat(value);
|
|
19
|
+
if (!Number.isNaN(parsed)) {
|
|
20
|
+
return parsed;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
function resolveDesktopWorkarea(workarea = EMPTY_DESKTOP_WORKAREA) {
|
|
26
|
+
if (workarea.width > 0 && workarea.height > 0) {
|
|
27
|
+
return workarea;
|
|
28
|
+
}
|
|
29
|
+
if (typeof globalThis === "undefined" || !("innerWidth" in globalThis)) {
|
|
30
|
+
return workarea;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0,
|
|
35
|
+
width: globalThis.innerWidth,
|
|
36
|
+
height: globalThis.innerHeight
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function computeCenteredPosition(workarea, windowWidth, windowHeight) {
|
|
40
|
+
return {
|
|
41
|
+
x: workarea.x + (workarea.width - windowWidth) / 2,
|
|
42
|
+
y: workarea.y + (workarea.height - windowHeight) / 2
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function resolveInitialWindowPosition(options) {
|
|
46
|
+
const { windowConfig, cascadeOffset = 0 } = options;
|
|
47
|
+
const workarea = resolveDesktopWorkarea(options.workarea);
|
|
48
|
+
const layoutWidth = parseWindowConfigSize(windowConfig.size?.width, 400);
|
|
49
|
+
const layoutHeight = parseWindowConfigSize(windowConfig.size?.height, 240);
|
|
50
|
+
const hasExplicitPosition = windowConfig.position?.x !== void 0 || windowConfig.position?.y !== void 0;
|
|
51
|
+
if (!hasExplicitPosition) {
|
|
52
|
+
const { x, y } = computeCenteredPosition(workarea, layoutWidth, layoutHeight);
|
|
53
|
+
return { x: x + cascadeOffset, y: y + cascadeOffset };
|
|
54
|
+
}
|
|
55
|
+
const scrollY = typeof globalThis !== "undefined" && "scrollY" in globalThis ? globalThis.scrollY : 0;
|
|
56
|
+
const baseX = windowConfig.position?.x ?? 0;
|
|
57
|
+
const baseY = windowConfig.position?.y !== void 0 ? scrollY + windowConfig.position.y : scrollY;
|
|
58
|
+
return {
|
|
59
|
+
x: baseX + cascadeOffset,
|
|
60
|
+
y: baseY + cascadeOffset
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export { EMPTY_DESKTOP_WORKAREA, computeCenteredPosition, parseWindowConfigSize, resolveDesktopWorkarea, resolveInitialWindowPosition };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as xstate from 'xstate';
|
|
2
|
+
|
|
3
|
+
declare const windowMachine: xstate.StateMachine<({ input }: {
|
|
4
|
+
input?: {
|
|
5
|
+
config?: any;
|
|
6
|
+
};
|
|
7
|
+
}) => {
|
|
8
|
+
wasMaximized: boolean;
|
|
9
|
+
config: any;
|
|
10
|
+
}, xstate.AnyEventObject, Record<string, xstate.AnyActorRef>, xstate.ProvidedActor, xstate.ParameterizedObject, xstate.ParameterizedObject, string, xstate.StateValue, string, {
|
|
11
|
+
config?: any;
|
|
12
|
+
} | undefined, xstate.NonReducibleUnknown, xstate.EventObject, any, any, any>;
|
|
13
|
+
type WindowMachine = typeof windowMachine;
|
|
14
|
+
|
|
15
|
+
declare const applicationMachine: xstate.StateMachine<({ input }: {
|
|
16
|
+
input?: {
|
|
17
|
+
id?: string;
|
|
18
|
+
config?: any;
|
|
19
|
+
};
|
|
20
|
+
}) => {
|
|
21
|
+
id: string;
|
|
22
|
+
config: any;
|
|
23
|
+
windowCount: number;
|
|
24
|
+
}, xstate.AnyEventObject, Record<string, xstate.AnyActorRef>, xstate.ProvidedActor, xstate.ParameterizedObject, xstate.ParameterizedObject, string, xstate.StateValue, string, {
|
|
25
|
+
id?: string;
|
|
26
|
+
config?: any;
|
|
27
|
+
} | undefined, xstate.NonReducibleUnknown, xstate.EventObject, any, any, any>;
|
|
28
|
+
type ApplicationMachine = typeof applicationMachine;
|
|
29
|
+
|
|
30
|
+
export { applicationMachine, windowMachine };
|
|
31
|
+
export type { ApplicationMachine, WindowMachine };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as xstate from 'xstate';
|
|
2
|
+
|
|
3
|
+
declare const windowMachine: xstate.StateMachine<({ input }: {
|
|
4
|
+
input?: {
|
|
5
|
+
config?: any;
|
|
6
|
+
};
|
|
7
|
+
}) => {
|
|
8
|
+
wasMaximized: boolean;
|
|
9
|
+
config: any;
|
|
10
|
+
}, xstate.AnyEventObject, Record<string, xstate.AnyActorRef>, xstate.ProvidedActor, xstate.ParameterizedObject, xstate.ParameterizedObject, string, xstate.StateValue, string, {
|
|
11
|
+
config?: any;
|
|
12
|
+
} | undefined, xstate.NonReducibleUnknown, xstate.EventObject, any, any, any>;
|
|
13
|
+
type WindowMachine = typeof windowMachine;
|
|
14
|
+
|
|
15
|
+
declare const applicationMachine: xstate.StateMachine<({ input }: {
|
|
16
|
+
input?: {
|
|
17
|
+
id?: string;
|
|
18
|
+
config?: any;
|
|
19
|
+
};
|
|
20
|
+
}) => {
|
|
21
|
+
id: string;
|
|
22
|
+
config: any;
|
|
23
|
+
windowCount: number;
|
|
24
|
+
}, xstate.AnyEventObject, Record<string, xstate.AnyActorRef>, xstate.ProvidedActor, xstate.ParameterizedObject, xstate.ParameterizedObject, string, xstate.StateValue, string, {
|
|
25
|
+
id?: string;
|
|
26
|
+
config?: any;
|
|
27
|
+
} | undefined, xstate.NonReducibleUnknown, xstate.EventObject, any, any, any>;
|
|
28
|
+
type ApplicationMachine = typeof applicationMachine;
|
|
29
|
+
|
|
30
|
+
export { applicationMachine, windowMachine };
|
|
31
|
+
export type { ApplicationMachine, WindowMachine };
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { W as WindowManager, a as WindowInstance } from '../shared/core.Di1eFcr_.mjs';
|
|
2
|
+
import { CoreIPCBus } from '../events/index.mjs';
|
|
3
|
+
import { Hookable } from 'hookable';
|
|
4
|
+
import { DesktopWorkareaRect, DesktopRuntimeHooks, ApplicationConfig, ApplicationPermission, WindowState } from '../types/index.mjs';
|
|
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 };
|