@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
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { Hookable } from 'hookable';
|
|
2
|
+
import { DesktopKernelEvent, DesktopRuntimeHooks, WindowConfig, WindowState, WindowLayout, DesktopWorkareaRect, SpatialTransform } from '../types/index.mjs';
|
|
3
|
+
|
|
4
|
+
type EventHandler = (event: DesktopKernelEvent) => void;
|
|
5
|
+
declare class CoreIPCBus {
|
|
6
|
+
private readonly maxEvents;
|
|
7
|
+
private events;
|
|
8
|
+
private readonly listeners;
|
|
9
|
+
private eventCounter;
|
|
10
|
+
private subscribers;
|
|
11
|
+
constructor(options?: {
|
|
12
|
+
maxEvents?: number;
|
|
13
|
+
});
|
|
14
|
+
emit(channel: string, payload?: any, options?: {
|
|
15
|
+
source?: string;
|
|
16
|
+
severity?: 'info' | 'warn' | 'error';
|
|
17
|
+
}): DesktopKernelEvent;
|
|
18
|
+
on(channel: string, handler: EventHandler): () => void;
|
|
19
|
+
off(channel: string, handler: EventHandler): void;
|
|
20
|
+
getEvents(): DesktopKernelEvent[];
|
|
21
|
+
getActiveChannels(): string[];
|
|
22
|
+
clear(): void;
|
|
23
|
+
subscribe(callback: (events: DesktopKernelEvent[]) => void): () => void;
|
|
24
|
+
}
|
|
25
|
+
declare const globalIPCBus: CoreIPCBus;
|
|
26
|
+
|
|
27
|
+
declare class WindowInstance {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly model: string;
|
|
30
|
+
readonly applicationId?: string;
|
|
31
|
+
config: WindowConfig;
|
|
32
|
+
state: WindowState;
|
|
33
|
+
meta: Record<string, any>;
|
|
34
|
+
private actor;
|
|
35
|
+
private isDisposed;
|
|
36
|
+
private subscribers;
|
|
37
|
+
constructor(options: {
|
|
38
|
+
id: string;
|
|
39
|
+
model: string;
|
|
40
|
+
applicationId?: string;
|
|
41
|
+
config: WindowConfig;
|
|
42
|
+
initialState?: Partial<WindowState>;
|
|
43
|
+
meta?: Record<string, any>;
|
|
44
|
+
workspace?: string;
|
|
45
|
+
});
|
|
46
|
+
private updateState;
|
|
47
|
+
getSnapshot(): WindowState;
|
|
48
|
+
subscribe(callback: (snapshot: WindowState) => void): () => void;
|
|
49
|
+
private notify;
|
|
50
|
+
get stateValue(): string;
|
|
51
|
+
setPosition(data: {
|
|
52
|
+
x: number;
|
|
53
|
+
y: number;
|
|
54
|
+
z?: number;
|
|
55
|
+
}): void;
|
|
56
|
+
setSize(data: {
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
}): void;
|
|
60
|
+
setFocus(value: boolean): void;
|
|
61
|
+
minimize(): boolean;
|
|
62
|
+
unminimize(): boolean;
|
|
63
|
+
maximize(): boolean;
|
|
64
|
+
unmaximize(): boolean;
|
|
65
|
+
toggleMaximize(): boolean;
|
|
66
|
+
startDrag(): void;
|
|
67
|
+
stopDrag(): void;
|
|
68
|
+
startResize(): void;
|
|
69
|
+
stopResize(): void;
|
|
70
|
+
setLayout(layout: WindowLayout, workarea?: DesktopWorkareaRect): boolean;
|
|
71
|
+
clearLayout(): boolean;
|
|
72
|
+
saveBoundsBeforeLayout(): void;
|
|
73
|
+
setWorkspace(workspaceId: string): void;
|
|
74
|
+
get workspace(): string;
|
|
75
|
+
setSpatialTransform(transform: SpatialTransform): void;
|
|
76
|
+
get spatial(): SpatialTransform | undefined;
|
|
77
|
+
dispose(): void;
|
|
78
|
+
}
|
|
79
|
+
declare class WindowManager {
|
|
80
|
+
private windows;
|
|
81
|
+
private snapshotCache;
|
|
82
|
+
private zIndexCounter;
|
|
83
|
+
private subscribers;
|
|
84
|
+
private hooks;
|
|
85
|
+
private ipc;
|
|
86
|
+
constructor(options?: {
|
|
87
|
+
hooks?: Hookable<DesktopRuntimeHooks>;
|
|
88
|
+
ipc?: CoreIPCBus;
|
|
89
|
+
});
|
|
90
|
+
getSnapshot(): WindowInstance[];
|
|
91
|
+
subscribe(callback: (windows: WindowInstance[]) => void): () => void;
|
|
92
|
+
private notify;
|
|
93
|
+
get(id: string): WindowInstance | undefined;
|
|
94
|
+
get focusedWindow(): WindowInstance | undefined;
|
|
95
|
+
incrementZIndex(): number;
|
|
96
|
+
addWindow(instance: WindowInstance): void;
|
|
97
|
+
createWindow(options: {
|
|
98
|
+
id: string;
|
|
99
|
+
model: string;
|
|
100
|
+
applicationId?: string;
|
|
101
|
+
config: WindowConfig;
|
|
102
|
+
initialState?: Partial<WindowState>;
|
|
103
|
+
meta?: Record<string, any>;
|
|
104
|
+
workspace?: string;
|
|
105
|
+
}): WindowInstance;
|
|
106
|
+
focusWindow(id: string): void;
|
|
107
|
+
closeWindow(id: string): boolean;
|
|
108
|
+
closeAllWindows(): void;
|
|
109
|
+
tileWindows(mode: "horizontal" | "vertical" | "grid" | undefined, workarea: DesktopWorkareaRect, workspaceId?: string, gap?: number): number;
|
|
110
|
+
setSpatialTransform(windowId: string, transform: SpatialTransform): void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { CoreIPCBus as C, WindowManager as W, WindowInstance as a, globalIPCBus as g };
|
|
114
|
+
export type { EventHandler as E };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createHooks } from 'hookable';
|
|
2
|
+
|
|
3
|
+
class CoreIPCBus {
|
|
4
|
+
maxEvents;
|
|
5
|
+
events = [];
|
|
6
|
+
listeners = /* @__PURE__ */ new Map();
|
|
7
|
+
eventCounter = 0;
|
|
8
|
+
subscribers = /* @__PURE__ */ new Set();
|
|
9
|
+
constructor(options) {
|
|
10
|
+
this.maxEvents = options?.maxEvents ?? 150;
|
|
11
|
+
}
|
|
12
|
+
emit(channel, payload, options) {
|
|
13
|
+
this.eventCounter++;
|
|
14
|
+
const event = {
|
|
15
|
+
id: `evt-${Date.now()}-${this.eventCounter}`,
|
|
16
|
+
timestamp: Date.now(),
|
|
17
|
+
channel,
|
|
18
|
+
source: options?.source ?? "kernel",
|
|
19
|
+
severity: options?.severity ?? "info",
|
|
20
|
+
payload
|
|
21
|
+
};
|
|
22
|
+
this.events = [event, ...this.events.slice(0, this.maxEvents - 1)];
|
|
23
|
+
const channelSet = this.listeners.get(channel);
|
|
24
|
+
if (channelSet) {
|
|
25
|
+
for (const handler of channelSet) {
|
|
26
|
+
try {
|
|
27
|
+
handler(event);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
console.error(`[@owdproject/core][IPC] Error in listener for "${channel}":`, err);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (channel !== "*") {
|
|
34
|
+
const wildcardSet = this.listeners.get("*");
|
|
35
|
+
if (wildcardSet) {
|
|
36
|
+
for (const handler of wildcardSet) {
|
|
37
|
+
try {
|
|
38
|
+
handler(event);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
console.error(`[@owdproject/core][IPC] Error in wildcard listener:`, err);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
for (const sub of this.subscribers) {
|
|
46
|
+
try {
|
|
47
|
+
sub(this.events);
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return event;
|
|
52
|
+
}
|
|
53
|
+
on(channel, handler) {
|
|
54
|
+
if (!this.listeners.has(channel)) {
|
|
55
|
+
this.listeners.set(channel, /* @__PURE__ */ new Set());
|
|
56
|
+
}
|
|
57
|
+
this.listeners.get(channel).add(handler);
|
|
58
|
+
return () => {
|
|
59
|
+
this.off(channel, handler);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
off(channel, handler) {
|
|
63
|
+
const channelSet = this.listeners.get(channel);
|
|
64
|
+
if (channelSet) {
|
|
65
|
+
channelSet.delete(handler);
|
|
66
|
+
if (channelSet.size === 0) {
|
|
67
|
+
this.listeners.delete(channel);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
getEvents() {
|
|
72
|
+
return this.events;
|
|
73
|
+
}
|
|
74
|
+
getActiveChannels() {
|
|
75
|
+
return Array.from(this.listeners.keys());
|
|
76
|
+
}
|
|
77
|
+
clear() {
|
|
78
|
+
this.events = [];
|
|
79
|
+
for (const sub of this.subscribers) {
|
|
80
|
+
try {
|
|
81
|
+
sub(this.events);
|
|
82
|
+
} catch {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
subscribe(callback) {
|
|
87
|
+
this.subscribers.add(callback);
|
|
88
|
+
callback(this.events);
|
|
89
|
+
return () => {
|
|
90
|
+
this.subscribers.delete(callback);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const globalIPCBus = new CoreIPCBus();
|
|
95
|
+
|
|
96
|
+
function createDesktopHooks() {
|
|
97
|
+
return createHooks();
|
|
98
|
+
}
|
|
99
|
+
const globalDesktopHooks = createDesktopHooks();
|
|
100
|
+
|
|
101
|
+
export { CoreIPCBus as C, globalIPCBus as a, createDesktopHooks as c, globalDesktopHooks as g };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { w as workareaBottom, a as workareaRight } from './core.CsDFgGnX.mjs';
|
|
2
|
+
|
|
3
|
+
const WINDOW_SNAP_EDGE_PX = 24;
|
|
4
|
+
const WORKSPACE_EDGE_DROP_PX = 32;
|
|
5
|
+
function detectSnapZone(clientX, clientY, workarea, options) {
|
|
6
|
+
const edge = options?.edgePx ?? WINDOW_SNAP_EDGE_PX;
|
|
7
|
+
const { x, y, width, height } = workarea;
|
|
8
|
+
if (width <= 0 || height <= 0) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const bottom = workareaBottom(workarea);
|
|
12
|
+
const right = workareaRight(workarea);
|
|
13
|
+
const nearTop = clientY <= y + edge;
|
|
14
|
+
const nearBottom = clientY >= bottom - edge;
|
|
15
|
+
const nearLeft = clientX <= x + edge;
|
|
16
|
+
const nearRight = clientX >= right - edge;
|
|
17
|
+
const inWorkspaceEdgeBand = options?.deferSideSnapForWorkspaceEdge === true && typeof globalThis !== "undefined" && "innerWidth" in globalThis && (clientX <= WORKSPACE_EDGE_DROP_PX || clientX >= globalThis.innerWidth - WORKSPACE_EDGE_DROP_PX);
|
|
18
|
+
if (nearTop && nearLeft) return "top-left";
|
|
19
|
+
if (nearTop && nearRight) return "top-right";
|
|
20
|
+
if (nearBottom && nearLeft) return "bottom-left";
|
|
21
|
+
if (nearBottom && nearRight) return "bottom-right";
|
|
22
|
+
if (nearTop) return "maximize";
|
|
23
|
+
if (nearBottom) return "bottom-half";
|
|
24
|
+
if (nearLeft && !inWorkspaceEdgeBand) return "left-half";
|
|
25
|
+
if (nearRight && !inWorkspaceEdgeBand) return "right-half";
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { WINDOW_SNAP_EDGE_PX as W, WORKSPACE_EDGE_DROP_PX as a, detectSnapZone as d };
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @owdproject/core - Framework-Agnostic Types
|
|
3
|
+
*/
|
|
4
|
+
type WindowLayout = 'normal' | 'maximize' | 'bottom-half' | 'left-half' | 'right-half' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
type SnapZoneHint = Exclude<WindowLayout, 'normal'>;
|
|
6
|
+
interface WindowBounds {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}
|
|
12
|
+
interface DesktopWorkareaRect {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}
|
|
18
|
+
type WindowSizeValue = number | string | undefined;
|
|
19
|
+
interface WindowSize {
|
|
20
|
+
width?: WindowSizeValue;
|
|
21
|
+
height?: WindowSizeValue;
|
|
22
|
+
minWidth?: WindowSizeValue;
|
|
23
|
+
minHeight?: WindowSizeValue;
|
|
24
|
+
maxWidth?: WindowSizeValue;
|
|
25
|
+
maxHeight?: WindowSizeValue;
|
|
26
|
+
}
|
|
27
|
+
interface WindowPosition {
|
|
28
|
+
x?: number;
|
|
29
|
+
y?: number;
|
|
30
|
+
z?: number;
|
|
31
|
+
}
|
|
32
|
+
interface SpatialPoint3D {
|
|
33
|
+
x: number;
|
|
34
|
+
y: number;
|
|
35
|
+
z: number;
|
|
36
|
+
}
|
|
37
|
+
interface SpatialEuler {
|
|
38
|
+
pitch: number;
|
|
39
|
+
yaw: number;
|
|
40
|
+
roll: number;
|
|
41
|
+
}
|
|
42
|
+
interface SpatialTransform {
|
|
43
|
+
position: SpatialPoint3D;
|
|
44
|
+
rotation?: SpatialEuler;
|
|
45
|
+
scale?: SpatialPoint3D;
|
|
46
|
+
distance?: number;
|
|
47
|
+
curveRadius?: number;
|
|
48
|
+
}
|
|
49
|
+
type SpatialLayoutMode = 'cylinder' | 'sphere' | 'carousel' | 'depth-stack';
|
|
50
|
+
interface WindowConfig {
|
|
51
|
+
title?: string;
|
|
52
|
+
category?: string;
|
|
53
|
+
icon?: string;
|
|
54
|
+
component?: any;
|
|
55
|
+
position?: WindowPosition;
|
|
56
|
+
size: WindowSize;
|
|
57
|
+
minimizable?: boolean;
|
|
58
|
+
maximized?: boolean;
|
|
59
|
+
maximizable?: boolean;
|
|
60
|
+
destroyable?: boolean;
|
|
61
|
+
draggable?: boolean;
|
|
62
|
+
resizable?: boolean;
|
|
63
|
+
spatial?: SpatialTransform;
|
|
64
|
+
overridable?: Partial<Record<'position' | 'size' | 'maximized' | 'draggable' | 'resizable' | 'destroyable' | 'minimizable', boolean>>;
|
|
65
|
+
}
|
|
66
|
+
interface WindowOverride {
|
|
67
|
+
title?: string;
|
|
68
|
+
windowTitle?: string;
|
|
69
|
+
icon?: string;
|
|
70
|
+
}
|
|
71
|
+
interface WindowState {
|
|
72
|
+
id: string;
|
|
73
|
+
createdAt: number;
|
|
74
|
+
category?: string;
|
|
75
|
+
workspace: string;
|
|
76
|
+
position?: WindowPosition;
|
|
77
|
+
size?: WindowSize;
|
|
78
|
+
spatial?: SpatialTransform;
|
|
79
|
+
focused: boolean;
|
|
80
|
+
dragging?: boolean;
|
|
81
|
+
resizing?: boolean;
|
|
82
|
+
active?: boolean;
|
|
83
|
+
minimizable?: boolean;
|
|
84
|
+
maximized?: boolean;
|
|
85
|
+
maximizable?: boolean;
|
|
86
|
+
destroyable?: boolean;
|
|
87
|
+
draggable?: boolean;
|
|
88
|
+
resizable?: boolean;
|
|
89
|
+
layout?: WindowLayout;
|
|
90
|
+
boundsBeforeLayout?: WindowBounds;
|
|
91
|
+
}
|
|
92
|
+
interface WindowStoredState {
|
|
93
|
+
model: string;
|
|
94
|
+
state: WindowState;
|
|
95
|
+
meta: any;
|
|
96
|
+
}
|
|
97
|
+
type ApplicationEntryVisibility = 'primary' | 'secondary' | 'hidden';
|
|
98
|
+
interface ApplicationEntry {
|
|
99
|
+
title?: string;
|
|
100
|
+
icon?: string;
|
|
101
|
+
category?: string;
|
|
102
|
+
visibility?: ApplicationEntryVisibility;
|
|
103
|
+
command: string | any;
|
|
104
|
+
}
|
|
105
|
+
type ApplicationPermission = string;
|
|
106
|
+
interface ApplicationConfigProvide {
|
|
107
|
+
name: string;
|
|
108
|
+
entry: string;
|
|
109
|
+
command?: string;
|
|
110
|
+
}
|
|
111
|
+
interface ApplicationConfig {
|
|
112
|
+
id: string;
|
|
113
|
+
title: string;
|
|
114
|
+
icon?: string;
|
|
115
|
+
category?: string;
|
|
116
|
+
version?: string;
|
|
117
|
+
description?: string;
|
|
118
|
+
provides?: ApplicationConfigProvide;
|
|
119
|
+
singleton?: boolean;
|
|
120
|
+
meta?: Record<string, any>;
|
|
121
|
+
permissions?: ApplicationPermission[];
|
|
122
|
+
windows?: {
|
|
123
|
+
[key: string]: WindowConfig;
|
|
124
|
+
};
|
|
125
|
+
entries: {
|
|
126
|
+
[key: string]: ApplicationEntry;
|
|
127
|
+
};
|
|
128
|
+
commands?: {
|
|
129
|
+
[key: string]: (app: any, args: any) => void;
|
|
130
|
+
};
|
|
131
|
+
terminal?: {
|
|
132
|
+
[commandName: string]: Omit<DesktopCommand, 'name' | 'applicationId'>;
|
|
133
|
+
};
|
|
134
|
+
onReady?(app: any): void | Promise<void>;
|
|
135
|
+
onLaunch?(app: any): void | Promise<void>;
|
|
136
|
+
onRestore?(app: any): void | Promise<void>;
|
|
137
|
+
onClose?(app: any): void | Promise<void>;
|
|
138
|
+
}
|
|
139
|
+
interface DesktopCommandArg {
|
|
140
|
+
name: string;
|
|
141
|
+
description?: string;
|
|
142
|
+
required?: boolean;
|
|
143
|
+
}
|
|
144
|
+
interface DesktopCommandOption {
|
|
145
|
+
flag: string;
|
|
146
|
+
description?: string;
|
|
147
|
+
}
|
|
148
|
+
interface DesktopCommand {
|
|
149
|
+
name: string;
|
|
150
|
+
applicationId: string;
|
|
151
|
+
description?: string;
|
|
152
|
+
usage?: string;
|
|
153
|
+
args?: DesktopCommandArg[];
|
|
154
|
+
options?: DesktopCommandOption[];
|
|
155
|
+
}
|
|
156
|
+
interface CommandOutput {
|
|
157
|
+
message: string;
|
|
158
|
+
isError?: boolean;
|
|
159
|
+
}
|
|
160
|
+
interface DesktopKernelEvent {
|
|
161
|
+
id: string;
|
|
162
|
+
timestamp: number;
|
|
163
|
+
channel: string;
|
|
164
|
+
source: string;
|
|
165
|
+
severity: 'info' | 'warn' | 'error';
|
|
166
|
+
payload?: any;
|
|
167
|
+
}
|
|
168
|
+
interface DesktopAppDefineContext {
|
|
169
|
+
id: string;
|
|
170
|
+
config: ApplicationConfig;
|
|
171
|
+
cancel?: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface DesktopAppLaunchContext {
|
|
174
|
+
app: any;
|
|
175
|
+
entryKey?: string;
|
|
176
|
+
argument?: string;
|
|
177
|
+
cancel?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface DesktopAppSignalContext {
|
|
180
|
+
app: any;
|
|
181
|
+
signal?: 'SIGTERM' | 'SIGKILL' | 'SIGSTOP' | 'SIGCONT';
|
|
182
|
+
cancel?: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface DesktopWindowOpenContext {
|
|
185
|
+
app: any;
|
|
186
|
+
model: string;
|
|
187
|
+
config: WindowConfig;
|
|
188
|
+
meta?: Record<string, any>;
|
|
189
|
+
cancel?: boolean;
|
|
190
|
+
}
|
|
191
|
+
interface DesktopWindowCloseContext {
|
|
192
|
+
window: any;
|
|
193
|
+
app: any;
|
|
194
|
+
cancel?: boolean;
|
|
195
|
+
}
|
|
196
|
+
interface DesktopCommandExecContext {
|
|
197
|
+
input: string;
|
|
198
|
+
commandName: string;
|
|
199
|
+
args: string[];
|
|
200
|
+
cancel?: boolean;
|
|
201
|
+
overrideOutput?: CommandOutput;
|
|
202
|
+
}
|
|
203
|
+
interface DesktopWorkspaceSwitchContext {
|
|
204
|
+
from: string;
|
|
205
|
+
to: string;
|
|
206
|
+
cancel?: boolean;
|
|
207
|
+
}
|
|
208
|
+
interface DesktopRuntimeHooks {
|
|
209
|
+
'app:before-define': (ctx: DesktopAppDefineContext) => Promise<void> | void;
|
|
210
|
+
'app:defined': (payload: {
|
|
211
|
+
app: any;
|
|
212
|
+
}) => Promise<void> | void;
|
|
213
|
+
'app:before-launch': (ctx: DesktopAppLaunchContext) => Promise<void> | void;
|
|
214
|
+
'app:launched': (payload: {
|
|
215
|
+
app: any;
|
|
216
|
+
pid: number | null;
|
|
217
|
+
}) => Promise<void> | void;
|
|
218
|
+
'app:before-suspend': (ctx: DesktopAppSignalContext) => Promise<void> | void;
|
|
219
|
+
'app:suspended': (payload: {
|
|
220
|
+
app: any;
|
|
221
|
+
}) => Promise<void> | void;
|
|
222
|
+
'app:before-resume': (ctx: DesktopAppSignalContext) => Promise<void> | void;
|
|
223
|
+
'app:resumed': (payload: {
|
|
224
|
+
app: any;
|
|
225
|
+
}) => Promise<void> | void;
|
|
226
|
+
'app:before-terminate': (ctx: DesktopAppSignalContext) => Promise<void> | void;
|
|
227
|
+
'app:terminated': (payload: {
|
|
228
|
+
id: string;
|
|
229
|
+
title: string;
|
|
230
|
+
pid: number | null;
|
|
231
|
+
}) => Promise<void> | void;
|
|
232
|
+
'window:before-open': (ctx: DesktopWindowOpenContext) => Promise<void> | void;
|
|
233
|
+
'window:opened': (payload: {
|
|
234
|
+
window: any;
|
|
235
|
+
app: any;
|
|
236
|
+
}) => Promise<void> | void;
|
|
237
|
+
'window:focused': (payload: {
|
|
238
|
+
window: any;
|
|
239
|
+
previousWindow?: any;
|
|
240
|
+
}) => Promise<void> | void;
|
|
241
|
+
'window:blurred': (payload: {
|
|
242
|
+
window: any;
|
|
243
|
+
}) => Promise<void> | void;
|
|
244
|
+
'window:layout-change': (payload: {
|
|
245
|
+
window: any;
|
|
246
|
+
layout: WindowLayout;
|
|
247
|
+
}) => Promise<void> | void;
|
|
248
|
+
'window:before-close': (ctx: DesktopWindowCloseContext) => Promise<void> | void;
|
|
249
|
+
'window:closed': (payload: {
|
|
250
|
+
windowId: string;
|
|
251
|
+
app: any;
|
|
252
|
+
}) => Promise<void> | void;
|
|
253
|
+
'command:before-exec': (ctx: DesktopCommandExecContext) => Promise<void> | void;
|
|
254
|
+
'command:after-exec': (payload: {
|
|
255
|
+
input: string;
|
|
256
|
+
commandName: string;
|
|
257
|
+
output: CommandOutput | void;
|
|
258
|
+
}) => Promise<void> | void;
|
|
259
|
+
'workspace:before-switch': (ctx: DesktopWorkspaceSwitchContext) => Promise<void> | void;
|
|
260
|
+
'workspace:switched': (payload: {
|
|
261
|
+
from: string;
|
|
262
|
+
to: string;
|
|
263
|
+
}) => Promise<void> | void;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type { ApplicationConfig, ApplicationConfigProvide, ApplicationEntry, ApplicationEntryVisibility, ApplicationPermission, CommandOutput, DesktopAppDefineContext, DesktopAppLaunchContext, DesktopAppSignalContext, DesktopCommand, DesktopCommandArg, DesktopCommandExecContext, DesktopCommandOption, DesktopKernelEvent, DesktopRuntimeHooks, DesktopWindowCloseContext, DesktopWindowOpenContext, DesktopWorkareaRect, DesktopWorkspaceSwitchContext, SnapZoneHint, SpatialEuler, SpatialLayoutMode, SpatialPoint3D, SpatialTransform, WindowBounds, WindowConfig, WindowLayout, WindowOverride, WindowPosition, WindowSize, WindowSizeValue, WindowState, WindowStoredState };
|