@owdproject/nuxt 0.0.0-stage → 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/LICENSE +20 -0
- package/README.md +77 -2
- package/dist/kit/authoring.d.ts +96 -0
- package/dist/kit/authoring.js +260 -0
- package/dist/kit/defineDesktopApp.d.ts +1 -0
- package/dist/kit/defineDesktopApp.js +1 -0
- package/dist/kit/defineDesktopPlugin.d.ts +1 -0
- package/dist/kit/defineDesktopPlugin.js +1 -0
- package/dist/module.d.mts +239 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +681 -0
- package/dist/runtime/components/Application/DesktopCoreApplicationRender.d.vue.ts +6 -0
- package/dist/runtime/components/Application/DesktopCoreApplicationRender.vue +18 -0
- package/dist/runtime/components/Application/DesktopCoreApplicationRender.vue.d.ts +6 -0
- package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.d.vue.ts +9 -0
- package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue +31 -0
- package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue.d.ts +9 -0
- package/dist/runtime/components/DesktopCore.d.vue.ts +19 -0
- package/dist/runtime/components/DesktopCore.vue +37 -0
- package/dist/runtime/components/DesktopCore.vue.d.ts +19 -0
- package/dist/runtime/components/background/DesktopCoreBackground.d.vue.ts +13 -0
- package/dist/runtime/components/background/DesktopCoreBackground.vue +16 -0
- package/dist/runtime/components/background/DesktopCoreBackground.vue.d.ts +13 -0
- package/dist/runtime/components/time/DesktopCoreTime.d.vue.ts +3 -0
- package/dist/runtime/components/time/DesktopCoreTime.vue +44 -0
- package/dist/runtime/components/time/DesktopCoreTime.vue.d.ts +3 -0
- package/dist/runtime/components/window/DesktopCoreWindow.d.vue.ts +49 -0
- package/dist/runtime/components/window/DesktopCoreWindow.vue +403 -0
- package/dist/runtime/components/window/DesktopCoreWindow.vue.d.ts +49 -0
- package/dist/runtime/components/window/DesktopCoreWindowContent.d.vue.ts +13 -0
- package/dist/runtime/components/window/DesktopCoreWindowContent.vue +34 -0
- package/dist/runtime/components/window/DesktopCoreWindowContent.vue.d.ts +13 -0
- package/dist/runtime/components/window/DesktopCoreWindowNav.d.vue.ts +13 -0
- package/dist/runtime/components/window/DesktopCoreWindowNav.vue +54 -0
- package/dist/runtime/components/window/DesktopCoreWindowNav.vue.d.ts +13 -0
- package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.d.vue.ts +19 -0
- package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue +46 -0
- package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue.d.ts +19 -0
- package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.d.vue.ts +24 -0
- package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue +50 -0
- package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue.d.ts +24 -0
- package/dist/runtime/composables/application/state.d.ts +1 -0
- package/dist/runtime/composables/application/state.js +2 -0
- package/dist/runtime/composables/application/useDesktopApplicationDefine.d.ts +4 -0
- package/dist/runtime/composables/application/useDesktopApplicationDefine.js +36 -0
- package/dist/runtime/composables/application/useDesktopApplicationExec.d.ts +3 -0
- package/dist/runtime/composables/application/useDesktopApplicationExec.js +26 -0
- package/dist/runtime/composables/application/useDesktopApplicationProcess.d.ts +24 -0
- package/dist/runtime/composables/application/useDesktopApplicationProcess.js +140 -0
- package/dist/runtime/composables/application/useDesktopApplicationRegistry.d.ts +11 -0
- package/dist/runtime/composables/application/useDesktopApplicationRegistry.js +60 -0
- package/dist/runtime/composables/useApplicationEntries.d.ts +5 -0
- package/dist/runtime/composables/useApplicationEntries.js +10 -0
- package/dist/runtime/composables/useApplicationManager.d.ts +16 -0
- package/dist/runtime/composables/useApplicationManager.js +30 -0
- package/dist/runtime/composables/useBlockNonInputContextMenu.d.ts +5 -0
- package/dist/runtime/composables/useBlockNonInputContextMenu.js +19 -0
- package/dist/runtime/composables/useDesktop.d.ts +210 -0
- package/dist/runtime/composables/useDesktop.js +52 -0
- package/dist/runtime/composables/useDesktopApplication.d.ts +34 -0
- package/dist/runtime/composables/useDesktopApplication.js +17 -0
- package/dist/runtime/composables/useDesktopCommands.d.ts +12 -0
- package/dist/runtime/composables/useDesktopCommands.js +348 -0
- package/dist/runtime/composables/useDesktopConfig.d.ts +3 -0
- package/dist/runtime/composables/useDesktopConfig.js +10 -0
- package/dist/runtime/composables/useDesktopDefaultApps.d.ts +15 -0
- package/dist/runtime/composables/useDesktopDefaultApps.js +21 -0
- package/dist/runtime/composables/useDesktopDialogs.d.ts +5 -0
- package/dist/runtime/composables/useDesktopDialogs.js +8 -0
- package/dist/runtime/composables/useDesktopDrag.d.ts +1 -0
- package/dist/runtime/composables/useDesktopDrag.js +1 -0
- package/dist/runtime/composables/useDesktopHooks.d.ts +15 -0
- package/dist/runtime/composables/useDesktopHooks.js +12 -0
- package/dist/runtime/composables/useDesktopIPC.d.ts +35 -0
- package/dist/runtime/composables/useDesktopIPC.js +72 -0
- package/dist/runtime/composables/useDesktopIdentity.d.ts +22 -0
- package/dist/runtime/composables/useDesktopIdentity.js +65 -0
- package/dist/runtime/composables/useDesktopManifest.d.ts +6 -0
- package/dist/runtime/composables/useDesktopManifest.js +17 -0
- package/dist/runtime/composables/useDesktopNotification.d.ts +13 -0
- package/dist/runtime/composables/useDesktopNotification.js +13 -0
- package/dist/runtime/composables/useDesktopResize.d.ts +1 -0
- package/dist/runtime/composables/useDesktopResize.js +1 -0
- package/dist/runtime/composables/useDesktopSession.d.ts +4 -0
- package/dist/runtime/composables/useDesktopSession.js +17 -0
- package/dist/runtime/composables/useDesktopShellIdentity.d.ts +1 -0
- package/dist/runtime/composables/useDesktopShellIdentity.js +3 -0
- package/dist/runtime/composables/useDesktopShellOptions.d.ts +5 -0
- package/dist/runtime/composables/useDesktopShellOptions.js +18 -0
- package/dist/runtime/composables/useDesktopTray.d.ts +5 -0
- package/dist/runtime/composables/useDesktopTray.js +10 -0
- package/dist/runtime/composables/useDesktopVolume.d.ts +4 -0
- package/dist/runtime/composables/useDesktopVolume.js +9 -0
- package/dist/runtime/composables/useDesktopWorkArea.d.ts +1 -0
- package/dist/runtime/composables/useDesktopWorkArea.js +3 -0
- package/dist/runtime/composables/useDesktopWorkarea.d.ts +12 -0
- package/dist/runtime/composables/useDesktopWorkarea.js +72 -0
- package/dist/runtime/composables/useTerminalManager.d.ts +15 -0
- package/dist/runtime/composables/useTerminalManager.js +9 -0
- package/dist/runtime/composables/useToggleWindowMaximize.d.ts +1 -0
- package/dist/runtime/composables/useToggleWindowMaximize.js +12 -0
- package/dist/runtime/composables/useWindowDragHandlers.d.ts +7 -0
- package/dist/runtime/composables/useWindowDragHandlers.js +7 -0
- package/dist/runtime/composables/window/useDesktopWindow.d.ts +14 -0
- package/dist/runtime/composables/window/useDesktopWindow.js +192 -0
- package/dist/runtime/composables/window/useDesktopWindowSnapDrop.d.ts +13 -0
- package/dist/runtime/composables/window/useDesktopWindowSnapDrop.js +78 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceEdgeDrop.d.ts +25 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceEdgeDrop.js +119 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceManager.d.ts +8 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceManager.js +46 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewCapture.d.ts +20 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewCapture.js +60 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewLiveScale.d.ts +31 -0
- package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewLiveScale.js +92 -0
- package/dist/runtime/constants/desktopShellKeys.d.ts +5 -0
- package/dist/runtime/constants/desktopShellKeys.js +2 -0
- package/dist/runtime/constants/shellLayout.d.ts +4 -0
- package/dist/runtime/constants/shellLayout.js +2 -0
- package/dist/runtime/dialogs/desktopDialogProvider.d.ts +6 -0
- package/dist/runtime/dialogs/desktopDialogProvider.js +12 -0
- package/dist/runtime/internal/controllers/ApplicationController.d.ts +37 -0
- package/dist/runtime/internal/controllers/ApplicationController.js +434 -0
- package/dist/runtime/internal/controllers/WindowController.d.ts +83 -0
- package/dist/runtime/internal/controllers/WindowController.js +435 -0
- package/dist/runtime/plugins/01.desktop-shell-init.client.d.ts +2 -0
- package/dist/runtime/plugins/01.desktop-shell-init.client.js +18 -0
- package/dist/runtime/plugins/02.desktop-register-desktop-apps.client.d.ts +2 -0
- package/dist/runtime/plugins/02.desktop-register-desktop-apps.client.js +7 -0
- package/dist/runtime/stores/storeApplicationMeta.d.ts +2 -0
- package/dist/runtime/stores/storeApplicationMeta.js +20 -0
- package/dist/runtime/stores/storeApplicationWindows.d.ts +2 -0
- package/dist/runtime/stores/storeApplicationWindows.js +33 -0
- package/dist/runtime/stores/storeDesktop.d.ts +17 -0
- package/dist/runtime/stores/storeDesktop.js +16 -0
- package/dist/runtime/stores/storeDesktopDefaultApps.d.ts +8 -0
- package/dist/runtime/stores/storeDesktopDefaultApps.js +21 -0
- package/dist/runtime/stores/storeDesktopTray.d.ts +6 -0
- package/dist/runtime/stores/storeDesktopTray.js +21 -0
- package/dist/runtime/stores/storeDesktopVolume.d.ts +4 -0
- package/dist/runtime/stores/storeDesktopVolume.js +12 -0
- package/dist/runtime/stores/storeDesktopWorkspace.d.ts +26 -0
- package/dist/runtime/stores/storeDesktopWorkspace.js +91 -0
- package/dist/runtime/stores/storeNotification.d.ts +27 -0
- package/dist/runtime/stores/storeNotification.js +55 -0
- package/dist/runtime/types/index.d.ts +1 -0
- package/dist/runtime/types/index.js +1 -0
- package/dist/runtime/utils/defineDesktopApp.d.ts +2 -0
- package/dist/runtime/utils/defineDesktopApp.js +5 -0
- package/dist/runtime/utils/defineDesktopPlugin.d.ts +19 -0
- package/dist/runtime/utils/defineDesktopPlugin.js +29 -0
- package/dist/runtime/utils/utilApp.d.ts +2 -0
- package/dist/runtime/utils/utilApp.js +9 -0
- package/dist/runtime/utils/utilCaptureElementToCanvas.d.ts +1 -0
- package/dist/runtime/utils/utilCaptureElementToCanvas.js +21 -0
- package/dist/runtime/utils/utilDebug.d.ts +4 -0
- package/dist/runtime/utils/utilDebug.js +24 -0
- package/dist/runtime/utils/utilDetectSnapZone.d.ts +1 -0
- package/dist/runtime/utils/utilDetectSnapZone.js +5 -0
- package/dist/runtime/utils/utilWindowControllerAdapter.d.ts +2 -0
- package/dist/runtime/utils/utilWindowControllerAdapter.js +151 -0
- package/dist/runtime/utils/utilWindowLayout.d.ts +4 -0
- package/dist/runtime/utils/utilWindowLayout.js +34 -0
- package/dist/runtime/utils/utilWorkspaceWindows.d.ts +2 -0
- package/dist/runtime/utils/utilWorkspaceWindows.js +12 -0
- package/dist/types/index.d.ts +156 -0
- package/dist/types/index.js +1 -0
- package/dist/types.d.mts +2 -0
- package/package.json +145 -4
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
import { useDesktopHooks } from "../composables/useDesktopHooks.js";
|
|
4
|
+
import { useDesktopIPC } from "../composables/useDesktopIPC.js";
|
|
5
|
+
export const EMPTY_DESKTOP_WORKAREA = {
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0
|
|
10
|
+
};
|
|
11
|
+
export const useDesktopWorkspaceStore = defineStore("desktop/workspace", () => {
|
|
12
|
+
const list = ref([
|
|
13
|
+
"workspace-1",
|
|
14
|
+
"workspace-2",
|
|
15
|
+
"workspace-3",
|
|
16
|
+
"workspace-4"
|
|
17
|
+
]);
|
|
18
|
+
const active = ref("workspace-1");
|
|
19
|
+
const overview = ref(false);
|
|
20
|
+
const workarea = ref({ ...EMPTY_DESKTOP_WORKAREA });
|
|
21
|
+
const workspaceActiveIndex = computed(
|
|
22
|
+
() => list.value.indexOf(active.value)
|
|
23
|
+
);
|
|
24
|
+
function setWorkspace(workspaceId) {
|
|
25
|
+
if (!list.value.includes(workspaceId)) return false;
|
|
26
|
+
const previous = active.value;
|
|
27
|
+
if (previous === workspaceId) return true;
|
|
28
|
+
const { callHook } = useDesktopHooks();
|
|
29
|
+
const switchCtx = {
|
|
30
|
+
from: previous,
|
|
31
|
+
to: workspaceId,
|
|
32
|
+
cancel: false
|
|
33
|
+
};
|
|
34
|
+
void callHook("workspace:before-switch", switchCtx);
|
|
35
|
+
if (switchCtx.cancel) return false;
|
|
36
|
+
active.value = switchCtx.to;
|
|
37
|
+
void callHook("workspace:switched", { from: previous, to: switchCtx.to });
|
|
38
|
+
useDesktopIPC().emit(
|
|
39
|
+
"workspace:switched",
|
|
40
|
+
{ from: previous, to: switchCtx.to },
|
|
41
|
+
{ source: "workspace-store", severity: "info" }
|
|
42
|
+
);
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
45
|
+
function setOverview(value) {
|
|
46
|
+
overview.value = value;
|
|
47
|
+
}
|
|
48
|
+
function toggleOverview() {
|
|
49
|
+
overview.value = !overview.value;
|
|
50
|
+
}
|
|
51
|
+
function setWorkarea(rect) {
|
|
52
|
+
workarea.value = { ...rect };
|
|
53
|
+
}
|
|
54
|
+
function addWorkspace(id) {
|
|
55
|
+
const nextId = id || `workspace-${list.value.length + 1}`;
|
|
56
|
+
if (!list.value.includes(nextId)) {
|
|
57
|
+
list.value.push(nextId);
|
|
58
|
+
}
|
|
59
|
+
return nextId;
|
|
60
|
+
}
|
|
61
|
+
function resolveWorkspaceFallback(removedId) {
|
|
62
|
+
const remaining = list.value.filter((id) => id !== removedId);
|
|
63
|
+
if (remaining.length === 0) return null;
|
|
64
|
+
return remaining[remaining.length - 1] ?? remaining[0] ?? null;
|
|
65
|
+
}
|
|
66
|
+
function removeWorkspace(workspaceId) {
|
|
67
|
+
if (list.value.length <= 1) return false;
|
|
68
|
+
const idx = list.value.indexOf(workspaceId);
|
|
69
|
+
if (idx < 0) return false;
|
|
70
|
+
const fallback = resolveWorkspaceFallback(workspaceId);
|
|
71
|
+
list.value.splice(idx, 1);
|
|
72
|
+
if (active.value === workspaceId && fallback) {
|
|
73
|
+
active.value = fallback;
|
|
74
|
+
}
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
list,
|
|
79
|
+
active,
|
|
80
|
+
overview,
|
|
81
|
+
workarea,
|
|
82
|
+
workspaceActiveIndex,
|
|
83
|
+
setWorkspace,
|
|
84
|
+
setOverview,
|
|
85
|
+
toggleOverview,
|
|
86
|
+
setWorkarea,
|
|
87
|
+
addWorkspace,
|
|
88
|
+
removeWorkspace,
|
|
89
|
+
resolveWorkspaceFallback
|
|
90
|
+
};
|
|
91
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DesktopNotificationItem } from '../../types/index.js';
|
|
2
|
+
export declare const useDesktopNotificationStore: import("pinia").SetupStoreDefinition<"desktop/notification", {
|
|
3
|
+
list: import("vue").Ref<any, any>;
|
|
4
|
+
add: (payload: {
|
|
5
|
+
title: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
icon?: string;
|
|
8
|
+
appId?: string;
|
|
9
|
+
}) => DesktopNotificationItem;
|
|
10
|
+
remove: (id: string) => void;
|
|
11
|
+
clear: () => void;
|
|
12
|
+
markAsRead: (id: string) => void;
|
|
13
|
+
markAllAsRead: () => void;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const useNotificationStore: import("pinia").SetupStoreDefinition<"desktop/notification", {
|
|
16
|
+
list: import("vue").Ref<any, any>;
|
|
17
|
+
add: (payload: {
|
|
18
|
+
title: string;
|
|
19
|
+
body?: string;
|
|
20
|
+
icon?: string;
|
|
21
|
+
appId?: string;
|
|
22
|
+
}) => DesktopNotificationItem;
|
|
23
|
+
remove: (id: string) => void;
|
|
24
|
+
clear: () => void;
|
|
25
|
+
markAsRead: (id: string) => void;
|
|
26
|
+
markAllAsRead: () => void;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
import { useDesktopIPC } from "../composables/useDesktopIPC.js";
|
|
4
|
+
let notificationCounter = 0;
|
|
5
|
+
export const useDesktopNotificationStore = defineStore(
|
|
6
|
+
"desktop/notification",
|
|
7
|
+
() => {
|
|
8
|
+
const list = ref([]);
|
|
9
|
+
function add(payload) {
|
|
10
|
+
notificationCounter += 1;
|
|
11
|
+
const item = {
|
|
12
|
+
id: `notif-${Date.now()}-${notificationCounter}`,
|
|
13
|
+
title: payload.title,
|
|
14
|
+
body: payload.body,
|
|
15
|
+
icon: payload.icon,
|
|
16
|
+
appId: payload.appId,
|
|
17
|
+
timestamp: Date.now(),
|
|
18
|
+
read: false
|
|
19
|
+
};
|
|
20
|
+
list.value = [item, ...list.value.slice(0, 99)];
|
|
21
|
+
useDesktopIPC().emit(
|
|
22
|
+
"notification:added",
|
|
23
|
+
{ id: item.id, title: item.title, appId: item.appId },
|
|
24
|
+
{ source: payload.appId || "notification-store", severity: "info" }
|
|
25
|
+
);
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
28
|
+
function remove(id) {
|
|
29
|
+
list.value = list.value.filter((item) => item.id !== id);
|
|
30
|
+
}
|
|
31
|
+
function clear() {
|
|
32
|
+
list.value = [];
|
|
33
|
+
}
|
|
34
|
+
function markAsRead(id) {
|
|
35
|
+
const target = list.value.find((item) => item.id === id);
|
|
36
|
+
if (target) {
|
|
37
|
+
target.read = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function markAllAsRead() {
|
|
41
|
+
for (const item of list.value) {
|
|
42
|
+
item.read = true;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
list,
|
|
47
|
+
add,
|
|
48
|
+
remove,
|
|
49
|
+
clear,
|
|
50
|
+
markAsRead,
|
|
51
|
+
markAllAsRead
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
export const useNotificationStore = useDesktopNotificationStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../types/index.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../types";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useDesktop, registerDesktopExtension } from '../composables/useDesktop.js';
|
|
2
|
+
import { useDesktopHooks } from '../composables/useDesktopHooks.js';
|
|
3
|
+
import { useDesktopIPC } from '../composables/useDesktopIPC.js';
|
|
4
|
+
import { useDesktopCommands } from '../composables/useDesktopCommands.js';
|
|
5
|
+
import { useDesktopApplication } from '../composables/useDesktopApplication.js';
|
|
6
|
+
import { useDesktopWindow } from '../composables/window/useDesktopWindow.js';
|
|
7
|
+
import { useDesktopWorkspaceStore } from '../stores/storeDesktopWorkspace.js';
|
|
8
|
+
export interface DesktopPluginContext {
|
|
9
|
+
desktop: ReturnType<typeof useDesktop>;
|
|
10
|
+
hooks: ReturnType<typeof useDesktopHooks>;
|
|
11
|
+
ipc: ReturnType<typeof useDesktopIPC>;
|
|
12
|
+
commands: ReturnType<typeof useDesktopCommands>;
|
|
13
|
+
applications: ReturnType<typeof useDesktopApplication>;
|
|
14
|
+
windows: ReturnType<typeof useDesktopWindow>;
|
|
15
|
+
workspace: ReturnType<typeof useDesktopWorkspaceStore>;
|
|
16
|
+
services: ReturnType<typeof useDesktop>['services'];
|
|
17
|
+
registerExtension: typeof registerDesktopExtension;
|
|
18
|
+
}
|
|
19
|
+
export declare function defineDesktopPlugin(setup: (ctx: DesktopPluginContext) => void | Promise<void>): import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
2
|
+
import { useDesktop, registerDesktopExtension } from "../composables/useDesktop.js";
|
|
3
|
+
import { useDesktopHooks } from "../composables/useDesktopHooks.js";
|
|
4
|
+
import { useDesktopIPC } from "../composables/useDesktopIPC.js";
|
|
5
|
+
import { useDesktopCommands } from "../composables/useDesktopCommands.js";
|
|
6
|
+
import { useDesktopApplication } from "../composables/useDesktopApplication.js";
|
|
7
|
+
import { useDesktopWindow } from "../composables/window/useDesktopWindow.js";
|
|
8
|
+
import { useDesktopWorkspaceStore } from "../stores/storeDesktopWorkspace.js";
|
|
9
|
+
export function defineDesktopPlugin(setup) {
|
|
10
|
+
return defineNuxtPlugin({
|
|
11
|
+
dependsOn: ["pinia", "desktop-shell-init"],
|
|
12
|
+
async setup() {
|
|
13
|
+
if (import.meta.server) return;
|
|
14
|
+
const desktop = useDesktop();
|
|
15
|
+
const ctx = {
|
|
16
|
+
desktop,
|
|
17
|
+
hooks: useDesktopHooks(),
|
|
18
|
+
ipc: useDesktopIPC(),
|
|
19
|
+
commands: useDesktopCommands(),
|
|
20
|
+
applications: useDesktopApplication(),
|
|
21
|
+
windows: useDesktopWindow(),
|
|
22
|
+
workspace: useDesktopWorkspaceStore(),
|
|
23
|
+
services: desktop.services,
|
|
24
|
+
registerExtension: registerDesktopExtension
|
|
25
|
+
};
|
|
26
|
+
await setup(ctx);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function captureElementToCanvas(element: HTMLElement | null | undefined, _options?: Record<string, unknown>): Promise<HTMLCanvasElement | null>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export async function captureElementToCanvas(element, _options) {
|
|
2
|
+
if (!element || typeof document === "undefined") {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
try {
|
|
6
|
+
const rect = element.getBoundingClientRect();
|
|
7
|
+
const width = Math.max(1, Math.round(rect.width || element.clientWidth || 320));
|
|
8
|
+
const height = Math.max(1, Math.round(rect.height || element.clientHeight || 200));
|
|
9
|
+
const canvas = document.createElement("canvas");
|
|
10
|
+
canvas.width = width;
|
|
11
|
+
canvas.height = height;
|
|
12
|
+
const ctx = canvas.getContext("2d");
|
|
13
|
+
if (ctx) {
|
|
14
|
+
ctx.fillStyle = "#0f172a";
|
|
15
|
+
ctx.fillRect(0, 0, width, height);
|
|
16
|
+
}
|
|
17
|
+
return canvas;
|
|
18
|
+
} catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
2
|
+
export function isDebugMode() {
|
|
3
|
+
try {
|
|
4
|
+
const config = useRuntimeConfig();
|
|
5
|
+
return Boolean(config.public.desktop?.debug);
|
|
6
|
+
} catch {
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function debugLog(...args) {
|
|
11
|
+
if (isDebugMode()) {
|
|
12
|
+
console.debug("[@owdproject/nuxt]", ...args);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function debugWarn(...args) {
|
|
16
|
+
if (isDebugMode()) {
|
|
17
|
+
console.warn("[@owdproject/nuxt]", ...args);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export function debugError(...args) {
|
|
21
|
+
if (isDebugMode()) {
|
|
22
|
+
console.error("[@owdproject/nuxt]", ...args);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { detectSnapZone, WINDOW_SNAP_EDGE_PX, WORKSPACE_EDGE_DROP_PX, type SnapZoneHint, type DetectSnapZoneOptions, } from '@owdproject/core';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { reactive } from "vue";
|
|
2
|
+
export function handleWindowControllerProps(windowProp) {
|
|
3
|
+
if (windowProp) {
|
|
4
|
+
return windowProp;
|
|
5
|
+
}
|
|
6
|
+
const state = reactive({
|
|
7
|
+
id: "standalone-window",
|
|
8
|
+
createdAt: Date.now(),
|
|
9
|
+
workspace: "workspace-1",
|
|
10
|
+
position: { x: 80, y: 80, z: 10 },
|
|
11
|
+
size: { width: 420, height: 320 },
|
|
12
|
+
focused: true,
|
|
13
|
+
active: true,
|
|
14
|
+
maximized: false,
|
|
15
|
+
minimizable: true,
|
|
16
|
+
maximizable: true,
|
|
17
|
+
destroyable: true,
|
|
18
|
+
draggable: true,
|
|
19
|
+
resizable: true,
|
|
20
|
+
dragging: false,
|
|
21
|
+
resizing: false,
|
|
22
|
+
layout: "normal"
|
|
23
|
+
});
|
|
24
|
+
const fallback = {
|
|
25
|
+
application: void 0,
|
|
26
|
+
instanced: false,
|
|
27
|
+
model: "standalone",
|
|
28
|
+
stateValue: "normal.focused.idle",
|
|
29
|
+
config: {
|
|
30
|
+
title: "Window",
|
|
31
|
+
size: { width: 420, height: 320 },
|
|
32
|
+
position: { x: 80, y: 80, z: 10 }
|
|
33
|
+
},
|
|
34
|
+
override: {},
|
|
35
|
+
state,
|
|
36
|
+
meta: {},
|
|
37
|
+
title: "Window",
|
|
38
|
+
windowTitle: "Window",
|
|
39
|
+
icon: void 0,
|
|
40
|
+
size: state.size,
|
|
41
|
+
position: state.position,
|
|
42
|
+
isMinimizable: true,
|
|
43
|
+
isMaximizable: true,
|
|
44
|
+
isMaximized: false,
|
|
45
|
+
isDestroyable: true,
|
|
46
|
+
isDraggable: true,
|
|
47
|
+
isResizable: true,
|
|
48
|
+
menu: [],
|
|
49
|
+
setMenu() {
|
|
50
|
+
},
|
|
51
|
+
dispose() {
|
|
52
|
+
},
|
|
53
|
+
destroy() {
|
|
54
|
+
return false;
|
|
55
|
+
},
|
|
56
|
+
startDrag() {
|
|
57
|
+
state.dragging = true;
|
|
58
|
+
},
|
|
59
|
+
stopDrag() {
|
|
60
|
+
state.dragging = false;
|
|
61
|
+
},
|
|
62
|
+
startResize() {
|
|
63
|
+
state.resizing = true;
|
|
64
|
+
},
|
|
65
|
+
stopResize() {
|
|
66
|
+
state.resizing = false;
|
|
67
|
+
},
|
|
68
|
+
actions: {
|
|
69
|
+
setActive(v) {
|
|
70
|
+
state.active = v;
|
|
71
|
+
},
|
|
72
|
+
setFocus(v) {
|
|
73
|
+
state.focused = v;
|
|
74
|
+
},
|
|
75
|
+
bringToFront() {
|
|
76
|
+
state.focused = true;
|
|
77
|
+
},
|
|
78
|
+
focus() {
|
|
79
|
+
state.focused = true;
|
|
80
|
+
},
|
|
81
|
+
setPosition(pos) {
|
|
82
|
+
state.position.x = pos.x;
|
|
83
|
+
state.position.y = pos.y;
|
|
84
|
+
},
|
|
85
|
+
startDrag() {
|
|
86
|
+
state.dragging = true;
|
|
87
|
+
},
|
|
88
|
+
stopDrag() {
|
|
89
|
+
state.dragging = false;
|
|
90
|
+
},
|
|
91
|
+
startResize() {
|
|
92
|
+
state.resizing = true;
|
|
93
|
+
},
|
|
94
|
+
stopResize() {
|
|
95
|
+
state.resizing = false;
|
|
96
|
+
},
|
|
97
|
+
setSize(sz) {
|
|
98
|
+
state.size.width = sz.width;
|
|
99
|
+
state.size.height = sz.height;
|
|
100
|
+
},
|
|
101
|
+
minimize() {
|
|
102
|
+
state.active = false;
|
|
103
|
+
return true;
|
|
104
|
+
},
|
|
105
|
+
unminimize() {
|
|
106
|
+
state.active = true;
|
|
107
|
+
return true;
|
|
108
|
+
},
|
|
109
|
+
toggleMinimize() {
|
|
110
|
+
state.active = !state.active;
|
|
111
|
+
},
|
|
112
|
+
toggleMaximize() {
|
|
113
|
+
state.maximized = !state.maximized;
|
|
114
|
+
return true;
|
|
115
|
+
},
|
|
116
|
+
maximize() {
|
|
117
|
+
state.maximized = true;
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
unmaximize() {
|
|
121
|
+
state.maximized = false;
|
|
122
|
+
return true;
|
|
123
|
+
},
|
|
124
|
+
setLayout(layout) {
|
|
125
|
+
state.layout = layout;
|
|
126
|
+
return true;
|
|
127
|
+
},
|
|
128
|
+
clearLayout() {
|
|
129
|
+
state.layout = "normal";
|
|
130
|
+
return true;
|
|
131
|
+
},
|
|
132
|
+
saveBoundsBeforeLayout() {
|
|
133
|
+
},
|
|
134
|
+
destroy() {
|
|
135
|
+
return false;
|
|
136
|
+
},
|
|
137
|
+
setWorkspace(ws) {
|
|
138
|
+
state.workspace = ws;
|
|
139
|
+
},
|
|
140
|
+
setTitleOverride() {
|
|
141
|
+
},
|
|
142
|
+
resetTitleOverride() {
|
|
143
|
+
},
|
|
144
|
+
setWindowTitleOverride() {
|
|
145
|
+
},
|
|
146
|
+
resetWindowTitleOverride() {
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
return fallback;
|
|
151
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { computeSnapRect, workareaBottom, workareaRight, type DesktopWorkareaRect, type SnapZoneHint, type WindowBounds, type WindowLayout } from '@owdproject/core';
|
|
2
|
+
import type { IWindowController } from '../../types/index.js';
|
|
3
|
+
export { computeSnapRect, workareaBottom, workareaRight, type DesktopWorkareaRect, type WindowBounds, type WindowLayout, };
|
|
4
|
+
export declare function applySnapToWindow(win: IWindowController, zone: SnapZoneHint, workarea: DesktopWorkareaRect): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
computeSnapRect,
|
|
3
|
+
workareaBottom,
|
|
4
|
+
workareaRight
|
|
5
|
+
} from "@owdproject/core";
|
|
6
|
+
import { useDesktopHooks } from "../composables/useDesktopHooks.js";
|
|
7
|
+
import { useDesktopIPC } from "../composables/useDesktopIPC.js";
|
|
8
|
+
export {
|
|
9
|
+
computeSnapRect,
|
|
10
|
+
workareaBottom,
|
|
11
|
+
workareaRight
|
|
12
|
+
};
|
|
13
|
+
export function applySnapToWindow(win, zone, workarea) {
|
|
14
|
+
if (!win.isMaximizable) return false;
|
|
15
|
+
if (workarea.width <= 0 || workarea.height <= 0) return false;
|
|
16
|
+
const rect = computeSnapRect(zone, workarea);
|
|
17
|
+
win.actions.setLayout(zone);
|
|
18
|
+
win.actions.setPosition({ x: rect.x, y: rect.y });
|
|
19
|
+
win.actions.setSize({ width: rect.width, height: rect.height });
|
|
20
|
+
void useDesktopHooks().callHook("window:layout-change", {
|
|
21
|
+
window: win,
|
|
22
|
+
layout: zone
|
|
23
|
+
});
|
|
24
|
+
useDesktopIPC().emit(
|
|
25
|
+
"window:layout-change",
|
|
26
|
+
{
|
|
27
|
+
windowId: win.state.id,
|
|
28
|
+
title: win.title,
|
|
29
|
+
layout: zone
|
|
30
|
+
},
|
|
31
|
+
{ source: "display-server", severity: "info" }
|
|
32
|
+
);
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function collectWindowsOnWorkspace(appsIterable, workspaceId, activeWorkspaceId) {
|
|
2
|
+
const result = [];
|
|
3
|
+
for (const app of appsIterable) {
|
|
4
|
+
for (const win of app.windows.values()) {
|
|
5
|
+
const ws = win.state.workspace || activeWorkspaceId;
|
|
6
|
+
if (ws === workspaceId) {
|
|
7
|
+
result.push(win);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return result;
|
|
12
|
+
}
|