@owdproject/nuxt 0.0.0-stage → 4.0.0-alpha.4
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 +88 -0
- package/dist/kit/authoring.js +276 -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 +245 -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 +438 -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 +44 -0
- package/dist/runtime/internal/controllers/ApplicationController.js +470 -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 +30 -0
- package/dist/runtime/stores/storeApplicationWindows.d.ts +2 -0
- package/dist/runtime/stores/storeApplicationWindows.js +43 -0
- package/dist/runtime/stores/storeDesktop.d.ts +17 -0
- package/dist/runtime/stores/storeDesktop.js +29 -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 +103 -0
- package/dist/runtime/stores/storeNotification.d.ts +27 -0
- package/dist/runtime/stores/storeNotification.js +62 -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 +164 -0
- package/dist/types/index.js +1 -0
- package/dist/types.d.mts +2 -0
- package/package.json +151 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineStore } from "pinia";
|
|
2
|
+
import { useDesktopStore } from "./storeDesktop.js";
|
|
3
|
+
export const useDesktopDefaultAppsStore = defineStore(
|
|
4
|
+
"desktop/default-apps",
|
|
5
|
+
() => {
|
|
6
|
+
const desktopStore = useDesktopStore();
|
|
7
|
+
function getDefaultApp(feature) {
|
|
8
|
+
return desktopStore.state.defaultApps[feature];
|
|
9
|
+
}
|
|
10
|
+
function setDefaultApp(feature, application, entry) {
|
|
11
|
+
desktopStore.state.defaultApps[feature] = {
|
|
12
|
+
applicationId: application.id,
|
|
13
|
+
entry
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
getDefaultApp,
|
|
18
|
+
setDefaultApp
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DesktopTrayItem } from '../../types/index.js';
|
|
2
|
+
export declare const useDesktopTrayStore: import("pinia").SetupStoreDefinition<"desktop/tray", {
|
|
3
|
+
items: import("vue").Ref<any, any>;
|
|
4
|
+
registerIcon: (item: DesktopTrayItem) => void;
|
|
5
|
+
unregisterIcon: (id: string) => void;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
export const useDesktopTrayStore = defineStore("desktop/tray", () => {
|
|
4
|
+
const items = ref([]);
|
|
5
|
+
function registerIcon(item) {
|
|
6
|
+
const existingIdx = items.value.findIndex((i) => i.id === item.id);
|
|
7
|
+
if (existingIdx >= 0) {
|
|
8
|
+
items.value[existingIdx] = item;
|
|
9
|
+
} else {
|
|
10
|
+
items.value.push(item);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function unregisterIcon(id) {
|
|
14
|
+
items.value = items.value.filter((i) => i.id !== id);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
items,
|
|
18
|
+
registerIcon,
|
|
19
|
+
unregisterIcon
|
|
20
|
+
};
|
|
21
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { defineStore } from "pinia";
|
|
3
|
+
export const useDesktopVolumeStore = defineStore("desktop/volume", () => {
|
|
4
|
+
const master = ref(100);
|
|
5
|
+
function setMasterVolume(value) {
|
|
6
|
+
master.value = Math.max(0, Math.min(100, value));
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
master,
|
|
10
|
+
setMasterVolume
|
|
11
|
+
};
|
|
12
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { DesktopWorkareaRect } from '../../types/index.js';
|
|
2
|
+
export declare const EMPTY_DESKTOP_WORKAREA: DesktopWorkareaRect;
|
|
3
|
+
export declare const useDesktopWorkspaceStore: import("pinia").SetupStoreDefinition<"desktop/workspace", {
|
|
4
|
+
list: import("vue").Ref<string[], string[]>;
|
|
5
|
+
active: import("vue").Ref<string, string>;
|
|
6
|
+
overview: import("vue").Ref<boolean, boolean>;
|
|
7
|
+
workarea: import("vue").Ref<{
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}, DesktopWorkareaRect | {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}>;
|
|
18
|
+
workspaceActiveIndex: import("vue").ComputedRef<number>;
|
|
19
|
+
setWorkspace: (workspaceId: string) => boolean;
|
|
20
|
+
setOverview: (value: boolean) => void;
|
|
21
|
+
toggleOverview: () => void;
|
|
22
|
+
setWorkarea: (rect: DesktopWorkareaRect) => void;
|
|
23
|
+
addWorkspace: (id?: string) => string;
|
|
24
|
+
removeWorkspace: (workspaceId: string) => boolean;
|
|
25
|
+
resolveWorkspaceFallback: (removedId: string) => string | null;
|
|
26
|
+
}>;
|
|
@@ -0,0 +1,103 @@
|
|
|
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(
|
|
12
|
+
"desktop/workspace",
|
|
13
|
+
() => {
|
|
14
|
+
const list = ref([
|
|
15
|
+
"workspace-1",
|
|
16
|
+
"workspace-2",
|
|
17
|
+
"workspace-3",
|
|
18
|
+
"workspace-4"
|
|
19
|
+
]);
|
|
20
|
+
const active = ref("workspace-1");
|
|
21
|
+
const overview = ref(false);
|
|
22
|
+
const workarea = ref({ ...EMPTY_DESKTOP_WORKAREA });
|
|
23
|
+
const workspaceActiveIndex = computed(
|
|
24
|
+
() => list.value.indexOf(active.value)
|
|
25
|
+
);
|
|
26
|
+
function setWorkspace(workspaceId) {
|
|
27
|
+
if (!list.value.includes(workspaceId)) return false;
|
|
28
|
+
const previous = active.value;
|
|
29
|
+
if (previous === workspaceId) return true;
|
|
30
|
+
const { callHook } = useDesktopHooks();
|
|
31
|
+
const switchCtx = {
|
|
32
|
+
from: previous,
|
|
33
|
+
to: workspaceId,
|
|
34
|
+
cancel: false
|
|
35
|
+
};
|
|
36
|
+
void callHook("workspace:before-switch", switchCtx);
|
|
37
|
+
if (switchCtx.cancel) return false;
|
|
38
|
+
active.value = switchCtx.to;
|
|
39
|
+
void callHook("workspace:switched", { from: previous, to: switchCtx.to });
|
|
40
|
+
useDesktopIPC().emit(
|
|
41
|
+
"workspace:switched",
|
|
42
|
+
{ from: previous, to: switchCtx.to },
|
|
43
|
+
{ source: "workspace-store", severity: "info" }
|
|
44
|
+
);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function setOverview(value) {
|
|
48
|
+
overview.value = value;
|
|
49
|
+
}
|
|
50
|
+
function toggleOverview() {
|
|
51
|
+
overview.value = !overview.value;
|
|
52
|
+
}
|
|
53
|
+
function setWorkarea(rect) {
|
|
54
|
+
workarea.value = { ...rect };
|
|
55
|
+
}
|
|
56
|
+
function addWorkspace(id) {
|
|
57
|
+
const nextId = id || `workspace-${list.value.length + 1}`;
|
|
58
|
+
if (!list.value.includes(nextId)) {
|
|
59
|
+
list.value.push(nextId);
|
|
60
|
+
}
|
|
61
|
+
return nextId;
|
|
62
|
+
}
|
|
63
|
+
function resolveWorkspaceFallback(removedId) {
|
|
64
|
+
const remaining = list.value.filter((id) => id !== removedId);
|
|
65
|
+
if (remaining.length === 0) return null;
|
|
66
|
+
return remaining[remaining.length - 1] ?? remaining[0] ?? null;
|
|
67
|
+
}
|
|
68
|
+
function removeWorkspace(workspaceId) {
|
|
69
|
+
if (list.value.length <= 1) return false;
|
|
70
|
+
const idx = list.value.indexOf(workspaceId);
|
|
71
|
+
if (idx < 0) return false;
|
|
72
|
+
const fallback = resolveWorkspaceFallback(workspaceId);
|
|
73
|
+
list.value.splice(idx, 1);
|
|
74
|
+
if (active.value === workspaceId && fallback) {
|
|
75
|
+
active.value = fallback;
|
|
76
|
+
}
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
list,
|
|
81
|
+
active,
|
|
82
|
+
overview,
|
|
83
|
+
workarea,
|
|
84
|
+
workspaceActiveIndex,
|
|
85
|
+
setWorkspace,
|
|
86
|
+
setOverview,
|
|
87
|
+
toggleOverview,
|
|
88
|
+
setWorkarea,
|
|
89
|
+
addWorkspace,
|
|
90
|
+
removeWorkspace,
|
|
91
|
+
resolveWorkspaceFallback
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
// Inert unless an optional persistence module registers the adapter.
|
|
96
|
+
// @ts-expect-error pinia-plugin-persistedstate-2 store option
|
|
97
|
+
persistedState: {
|
|
98
|
+
persist: true,
|
|
99
|
+
// `overview` and `workarea` are runtime-only.
|
|
100
|
+
includePaths: ["list", "active"]
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
);
|
|
@@ -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,62 @@
|
|
|
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
|
+
// Inert unless an optional persistence module registers the adapter.
|
|
56
|
+
// @ts-expect-error pinia-plugin-persistedstate-2 store option
|
|
57
|
+
persistedState: {
|
|
58
|
+
persist: true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
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
|
+
}
|