@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,10 @@
|
|
|
1
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
export function useDesktopConfig() {
|
|
4
|
+
const runtimeConfig = useRuntimeConfig();
|
|
5
|
+
return computed(() => runtimeConfig.public.desktop);
|
|
6
|
+
}
|
|
7
|
+
export function useDesktopExtension(key) {
|
|
8
|
+
const desktop = useDesktopConfig();
|
|
9
|
+
return computed(() => desktop.value?.[key]);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Desktop Default Apps composable (singleton pattern via Pinia).
|
|
3
|
+
* Exposes default-app routing for features like terminal, browser, editor.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useDesktopDefaultApps(): {
|
|
6
|
+
defaultApps: import("vue").ComputedRef<Record<string, {
|
|
7
|
+
applicationId: string;
|
|
8
|
+
entry: string;
|
|
9
|
+
}>>;
|
|
10
|
+
getDefaultApp: (feature: string) => {
|
|
11
|
+
applicationId: string;
|
|
12
|
+
entry: string;
|
|
13
|
+
};
|
|
14
|
+
setDefaultApp: (feature: string, application: IApplicationController, entry: string) => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useDesktopStore } from "../stores/storeDesktop.js";
|
|
3
|
+
import { useDesktopDefaultAppsStore } from "../stores/storeDesktopDefaultApps.js";
|
|
4
|
+
export function useDesktopDefaultApps() {
|
|
5
|
+
const desktopStore = useDesktopStore();
|
|
6
|
+
const defaultAppsStore = useDesktopDefaultAppsStore();
|
|
7
|
+
const defaultApps = computed(
|
|
8
|
+
() => desktopStore.state.defaultApps
|
|
9
|
+
);
|
|
10
|
+
function getDefaultApp(feature) {
|
|
11
|
+
return defaultAppsStore.getDefaultApp(feature);
|
|
12
|
+
}
|
|
13
|
+
function setDefaultApp(feature, application, entry) {
|
|
14
|
+
defaultAppsStore.setDefaultApp(feature, application, entry);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
defaultApps,
|
|
18
|
+
getDefaultApp,
|
|
19
|
+
setDefaultApp
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { DESKTOP_DIALOG_PROVIDER_KEY } from "../constants/desktopShellKeys.js";
|
|
3
|
+
import {
|
|
4
|
+
createBrowserFallbackDialogProvider
|
|
5
|
+
} from "../dialogs/desktopDialogProvider.js";
|
|
6
|
+
export function useDesktopDialogs() {
|
|
7
|
+
return inject(DESKTOP_DIALOG_PROVIDER_KEY, null) ?? createBrowserFallbackDialogProvider();
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDesktopDrag, type DesktopDragOptions } from '../../composables/useDesktopPointer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDesktopDrag } from "../../composables/useDesktopPointer";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Hookable } from 'hookable';
|
|
2
|
+
import { type DesktopRuntimeHooks } from '@owdproject/core';
|
|
3
|
+
import type { DesktopAppDefineContext, DesktopAppLaunchContext, DesktopAppSignalContext, DesktopWindowOpenContext, DesktopWindowCloseContext, DesktopCommandExecContext, DesktopWorkspaceSwitchContext } from '@owdproject/core';
|
|
4
|
+
export type { DesktopRuntimeHooks, DesktopAppDefineContext, DesktopAppLaunchContext, DesktopAppSignalContext, DesktopWindowOpenContext, DesktopWindowCloseContext, DesktopCommandExecContext, DesktopWorkspaceSwitchContext, };
|
|
5
|
+
type DesktopHookBus = Hookable<DesktopRuntimeHooks>;
|
|
6
|
+
export interface DesktopHooksAPI {
|
|
7
|
+
hooks: DesktopHookBus;
|
|
8
|
+
hook: DesktopHookBus['hook'];
|
|
9
|
+
hookOnce: DesktopHookBus['hookOnce'];
|
|
10
|
+
callHook: DesktopHookBus['callHook'];
|
|
11
|
+
callHookParallel: DesktopHookBus['callHookParallel'];
|
|
12
|
+
removeHook: DesktopHookBus['removeHook'];
|
|
13
|
+
removeAllHooks: DesktopHookBus['removeAllHooks'];
|
|
14
|
+
}
|
|
15
|
+
export declare function useDesktopHooks(): DesktopHooksAPI;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { globalDesktopHooks } from "@owdproject/core";
|
|
2
|
+
export function useDesktopHooks() {
|
|
3
|
+
return {
|
|
4
|
+
hooks: globalDesktopHooks,
|
|
5
|
+
hook: globalDesktopHooks.hook.bind(globalDesktopHooks),
|
|
6
|
+
hookOnce: globalDesktopHooks.hookOnce.bind(globalDesktopHooks),
|
|
7
|
+
callHook: globalDesktopHooks.callHook.bind(globalDesktopHooks),
|
|
8
|
+
callHookParallel: globalDesktopHooks.callHookParallel.bind(globalDesktopHooks),
|
|
9
|
+
removeHook: globalDesktopHooks.removeHook.bind(globalDesktopHooks),
|
|
10
|
+
removeAllHooks: globalDesktopHooks.removeAllHooks.bind(globalDesktopHooks)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface DesktopKernelEvent {
|
|
2
|
+
id: string;
|
|
3
|
+
timestamp: number;
|
|
4
|
+
channel: string;
|
|
5
|
+
source: string;
|
|
6
|
+
severity: 'info' | 'warn' | 'error';
|
|
7
|
+
payload?: any;
|
|
8
|
+
}
|
|
9
|
+
type EventHandler = (event: DesktopKernelEvent) => void;
|
|
10
|
+
export declare function useDesktopIPC(): {
|
|
11
|
+
events: import("vue").Ref<{
|
|
12
|
+
id: string;
|
|
13
|
+
timestamp: number;
|
|
14
|
+
channel: string;
|
|
15
|
+
source: string;
|
|
16
|
+
severity: "info" | "warn" | "error";
|
|
17
|
+
payload?: any;
|
|
18
|
+
}[], DesktopKernelEvent[] | {
|
|
19
|
+
id: string;
|
|
20
|
+
timestamp: number;
|
|
21
|
+
channel: string;
|
|
22
|
+
source: string;
|
|
23
|
+
severity: "info" | "warn" | "error";
|
|
24
|
+
payload?: any;
|
|
25
|
+
}[]>;
|
|
26
|
+
activeChannels: import("vue").ComputedRef<string[]>;
|
|
27
|
+
emit: (channel: string, payload?: any, options?: {
|
|
28
|
+
source?: string;
|
|
29
|
+
severity?: "info" | "warn" | "error";
|
|
30
|
+
}) => DesktopKernelEvent;
|
|
31
|
+
on: (channel: string, handler: EventHandler) => () => void;
|
|
32
|
+
off: (channel: string, handler: EventHandler) => void;
|
|
33
|
+
clearEvents: () => void;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { ref, computed } from "vue";
|
|
2
|
+
const MAX_EVENTS = 150;
|
|
3
|
+
const events = ref([]);
|
|
4
|
+
const listeners = /* @__PURE__ */ new Map();
|
|
5
|
+
let eventCounter = 0;
|
|
6
|
+
export function useDesktopIPC() {
|
|
7
|
+
function emit(channel, payload, options) {
|
|
8
|
+
eventCounter++;
|
|
9
|
+
const event = {
|
|
10
|
+
id: `evt-${Date.now()}-${eventCounter}`,
|
|
11
|
+
timestamp: Date.now(),
|
|
12
|
+
channel,
|
|
13
|
+
source: options?.source ?? "kernel",
|
|
14
|
+
severity: options?.severity ?? "info",
|
|
15
|
+
payload
|
|
16
|
+
};
|
|
17
|
+
events.value = [event, ...events.value.slice(0, MAX_EVENTS - 1)];
|
|
18
|
+
const channelSet = listeners.get(channel);
|
|
19
|
+
if (channelSet) {
|
|
20
|
+
for (const handler of channelSet) {
|
|
21
|
+
try {
|
|
22
|
+
handler(event);
|
|
23
|
+
} catch (err) {
|
|
24
|
+
console.error(`[@owdproject/nuxt][IPC] Error in listener for "${channel}":`, err);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (channel !== "*") {
|
|
29
|
+
const wildcardSet = listeners.get("*");
|
|
30
|
+
if (wildcardSet) {
|
|
31
|
+
for (const handler of wildcardSet) {
|
|
32
|
+
try {
|
|
33
|
+
handler(event);
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error(`[@owdproject/nuxt][IPC] Error in wildcard listener:`, err);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return event;
|
|
41
|
+
}
|
|
42
|
+
function on(channel, handler) {
|
|
43
|
+
if (!listeners.has(channel)) {
|
|
44
|
+
listeners.set(channel, /* @__PURE__ */ new Set());
|
|
45
|
+
}
|
|
46
|
+
listeners.get(channel).add(handler);
|
|
47
|
+
return () => {
|
|
48
|
+
off(channel, handler);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function off(channel, handler) {
|
|
52
|
+
const channelSet = listeners.get(channel);
|
|
53
|
+
if (channelSet) {
|
|
54
|
+
channelSet.delete(handler);
|
|
55
|
+
if (channelSet.size === 0) {
|
|
56
|
+
listeners.delete(channel);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function clearEvents() {
|
|
61
|
+
events.value = [];
|
|
62
|
+
}
|
|
63
|
+
const activeChannels = computed(() => Array.from(listeners.keys()));
|
|
64
|
+
return {
|
|
65
|
+
events,
|
|
66
|
+
activeChannels,
|
|
67
|
+
emit,
|
|
68
|
+
on,
|
|
69
|
+
off,
|
|
70
|
+
clearEvents
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ShellIdentity = {
|
|
2
|
+
userId: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
avatarUrl: string | null;
|
|
5
|
+
userHome: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function sanitizeUserHomeSegment(input: string): string;
|
|
8
|
+
/** Build a VFS home path from an auth handle (e.g. Bluesky `@alice.bsky.social`). */
|
|
9
|
+
export declare function userHomeFromHandle(handle: string, base?: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Shell session identity (display + VFS home). Auth modules call {@link setShellIdentity}
|
|
12
|
+
* after login; defaults to Guest.
|
|
13
|
+
*/
|
|
14
|
+
export declare function useDesktopIdentity(): {
|
|
15
|
+
userId: import("vue").ComputedRef<string>;
|
|
16
|
+
displayName: import("vue").ComputedRef<string>;
|
|
17
|
+
avatarUrl: import("vue").ComputedRef<string | null>;
|
|
18
|
+
userHome: import("vue").ComputedRef<string>;
|
|
19
|
+
isGuest: import("vue").ComputedRef<boolean>;
|
|
20
|
+
setDesktopIdentity: (partial: Partial<ShellIdentity>) => void;
|
|
21
|
+
clear: () => void;
|
|
22
|
+
};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
import { useRuntimeConfig } from "nuxt/app";
|
|
3
|
+
const GUEST_USER_ID = "guest";
|
|
4
|
+
const identity = ref(null);
|
|
5
|
+
export function sanitizeUserHomeSegment(input) {
|
|
6
|
+
const cleaned = input.trim().replace(/^@/, "").replace(/[^\w.\-]/g, "_").slice(0, 64);
|
|
7
|
+
return cleaned || "user";
|
|
8
|
+
}
|
|
9
|
+
export function userHomeFromHandle(handle, base = "/home") {
|
|
10
|
+
const baseNorm = base.endsWith("/") ? base.slice(0, -1) : base;
|
|
11
|
+
return `${baseNorm}/${sanitizeUserHomeSegment(handle)}`;
|
|
12
|
+
}
|
|
13
|
+
function resolveDefaultHome() {
|
|
14
|
+
try {
|
|
15
|
+
const config = useRuntimeConfig();
|
|
16
|
+
const desktop = config.public.desktop;
|
|
17
|
+
const home = desktop.fs?.defaultUserHome?.trim();
|
|
18
|
+
if (home) return home.startsWith("/") ? home : `/${home}`;
|
|
19
|
+
} catch {
|
|
20
|
+
}
|
|
21
|
+
return "/home/Guest";
|
|
22
|
+
}
|
|
23
|
+
function guestIdentity(defaultHome) {
|
|
24
|
+
return {
|
|
25
|
+
userId: GUEST_USER_ID,
|
|
26
|
+
displayName: "Guest",
|
|
27
|
+
avatarUrl: null,
|
|
28
|
+
userHome: defaultHome
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function useDesktopIdentity() {
|
|
32
|
+
function ensureIdentity() {
|
|
33
|
+
if (!identity.value) {
|
|
34
|
+
identity.value = guestIdentity(resolveDefaultHome());
|
|
35
|
+
}
|
|
36
|
+
return identity.value;
|
|
37
|
+
}
|
|
38
|
+
const userId = computed(() => ensureIdentity().userId);
|
|
39
|
+
const displayName = computed(() => ensureIdentity().displayName);
|
|
40
|
+
const avatarUrl = computed(() => ensureIdentity().avatarUrl);
|
|
41
|
+
const userHome = computed(() => ensureIdentity().userHome);
|
|
42
|
+
const isGuest = computed(() => userId.value === GUEST_USER_ID);
|
|
43
|
+
function setDesktopIdentity(partial) {
|
|
44
|
+
const current = ensureIdentity();
|
|
45
|
+
identity.value = {
|
|
46
|
+
...current,
|
|
47
|
+
...partial,
|
|
48
|
+
userId: partial.userId?.trim() || current.userId,
|
|
49
|
+
displayName: partial.displayName?.trim() || current.displayName,
|
|
50
|
+
userHome: partial.userHome?.trim() ? partial.userHome.startsWith("/") ? partial.userHome : `/${partial.userHome}` : current.userHome
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function clear() {
|
|
54
|
+
identity.value = guestIdentity(resolveDefaultHome());
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
userId,
|
|
58
|
+
displayName,
|
|
59
|
+
avatarUrl,
|
|
60
|
+
userHome,
|
|
61
|
+
isGuest,
|
|
62
|
+
setDesktopIdentity,
|
|
63
|
+
clear
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function useHasDesktopModule(pkg: string): import("vue").ComputedRef<any>;
|
|
2
|
+
export declare function useHasDesktopApp(pkg: string): import("vue").ComputedRef<any>;
|
|
3
|
+
export declare function useHasDesktopExtension(key: string): import("vue").ComputedRef<boolean>;
|
|
4
|
+
export declare const hasDesktopModule: typeof useHasDesktopModule;
|
|
5
|
+
export declare const hasDesktopApp: typeof useHasDesktopApp;
|
|
6
|
+
export declare const hasDesktopExtension: typeof useHasDesktopExtension;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useDesktopConfig } from "./useDesktopConfig.js";
|
|
3
|
+
export function useHasDesktopModule(pkg) {
|
|
4
|
+
const desktop = useDesktopConfig();
|
|
5
|
+
return computed(() => desktop.value?.modules?.includes(pkg) ?? false);
|
|
6
|
+
}
|
|
7
|
+
export function useHasDesktopApp(pkg) {
|
|
8
|
+
const desktop = useDesktopConfig();
|
|
9
|
+
return computed(() => desktop.value?.apps?.includes(pkg) ?? false);
|
|
10
|
+
}
|
|
11
|
+
export function useHasDesktopExtension(key) {
|
|
12
|
+
const desktop = useDesktopConfig();
|
|
13
|
+
return computed(() => Boolean(desktop.value?.[key]));
|
|
14
|
+
}
|
|
15
|
+
export const hasDesktopModule = useHasDesktopModule;
|
|
16
|
+
export const hasDesktopApp = useHasDesktopApp;
|
|
17
|
+
export const hasDesktopExtension = useHasDesktopExtension;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function useDesktopNotification(): {
|
|
2
|
+
list: any;
|
|
3
|
+
add: (payload: {
|
|
4
|
+
title: string;
|
|
5
|
+
body?: string;
|
|
6
|
+
icon?: string;
|
|
7
|
+
appId?: string;
|
|
8
|
+
}) => DesktopNotificationItem;
|
|
9
|
+
remove: (id: string) => void;
|
|
10
|
+
clear: () => void;
|
|
11
|
+
markAsRead: (id: string) => void;
|
|
12
|
+
markAllAsRead: () => void;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { toRef } from "vue";
|
|
2
|
+
import { useDesktopNotificationStore } from "../stores/storeNotification.js";
|
|
3
|
+
export function useDesktopNotification() {
|
|
4
|
+
const notificationStore = useDesktopNotificationStore();
|
|
5
|
+
return {
|
|
6
|
+
list: toRef(notificationStore, "list"),
|
|
7
|
+
add: notificationStore.add,
|
|
8
|
+
remove: notificationStore.remove,
|
|
9
|
+
clear: notificationStore.clear,
|
|
10
|
+
markAsRead: notificationStore.markAsRead,
|
|
11
|
+
markAllAsRead: notificationStore.markAllAsRead
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDesktopResize, type DesktopResizeOptions } from '../../composables/useDesktopPointer.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDesktopResize } from "../../composables/useDesktopPointer";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useRouter } from "nuxt/app";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
const shuttingDown = ref(false);
|
|
4
|
+
export function useDesktopSession() {
|
|
5
|
+
const initiateShutdownToStart = () => {
|
|
6
|
+
shuttingDown.value = true;
|
|
7
|
+
setTimeout(() => {
|
|
8
|
+
useRouter().push("/start").then(() => {
|
|
9
|
+
shuttingDown.value = false;
|
|
10
|
+
});
|
|
11
|
+
}, 2e3);
|
|
12
|
+
};
|
|
13
|
+
return {
|
|
14
|
+
shuttingDown,
|
|
15
|
+
initiateShutdownToStart
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDesktopIdentity as useDesktopShellIdentity, type ShellIdentity, } from './useDesktopIdentity.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useAppConfig } from "nuxt/app";
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
export function useDesktopShellOptions() {
|
|
4
|
+
const appConfig = useAppConfig();
|
|
5
|
+
const desktop = () => appConfig.desktop;
|
|
6
|
+
const systemBarEnabled = computed(
|
|
7
|
+
() => desktop()?.systemBar?.enabled !== false
|
|
8
|
+
);
|
|
9
|
+
const systemBarPosition = computed(() => desktop()?.systemBar?.position);
|
|
10
|
+
const startButtonEnabled = computed(
|
|
11
|
+
() => desktop()?.systemBar?.startButton !== false
|
|
12
|
+
);
|
|
13
|
+
return {
|
|
14
|
+
systemBarEnabled,
|
|
15
|
+
systemBarPosition,
|
|
16
|
+
startButtonEnabled
|
|
17
|
+
};
|
|
18
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useDesktopTrayStore } from "../stores/storeDesktopTray.js";
|
|
3
|
+
export function useDesktopTray() {
|
|
4
|
+
const trayStore = useDesktopTrayStore();
|
|
5
|
+
return {
|
|
6
|
+
items: computed(() => trayStore.items),
|
|
7
|
+
registerIcon: trayStore.registerIcon,
|
|
8
|
+
unregisterIcon: trayStore.unregisterIcon
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { useDesktopVolumeStore } from "../stores/storeDesktopVolume.js";
|
|
3
|
+
export function useDesktopVolume() {
|
|
4
|
+
const volumeStore = useDesktopVolumeStore();
|
|
5
|
+
return {
|
|
6
|
+
master: computed(() => volumeStore.master),
|
|
7
|
+
setMaster: volumeStore.setMasterVolume
|
|
8
|
+
};
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useDesktopWorkarea as useDesktopWorkArea, } from './useDesktopWorkarea.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Tracks the desktop shell stage rectangle (area under system bar, above dock).
|
|
4
|
+
* When called with no arguments, returns the read-only workarea ref.
|
|
5
|
+
* When passed a shellStageRef, also registers the resize observer to update the workarea.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useDesktopWorkarea(shellStageRef?: Ref<HTMLElement | null | undefined>): {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { onScopeDispose, watch } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
EMPTY_DESKTOP_WORKAREA,
|
|
4
|
+
useDesktopWorkspaceStore
|
|
5
|
+
} from "../stores/storeDesktopWorkspace.js";
|
|
6
|
+
function measureElement(el) {
|
|
7
|
+
const rect = el.getBoundingClientRect();
|
|
8
|
+
return {
|
|
9
|
+
x: rect.left,
|
|
10
|
+
y: rect.top,
|
|
11
|
+
width: rect.width,
|
|
12
|
+
height: rect.height
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function useDesktopWorkarea(shellStageRef) {
|
|
16
|
+
const desktopWorkspaceStore = useDesktopWorkspaceStore();
|
|
17
|
+
if (!shellStageRef) {
|
|
18
|
+
return desktopWorkspaceStore.workarea;
|
|
19
|
+
}
|
|
20
|
+
let resizeObserver = null;
|
|
21
|
+
function refreshWorkarea() {
|
|
22
|
+
const el = shellStageRef.value;
|
|
23
|
+
if (!el) {
|
|
24
|
+
desktopWorkspaceStore.setWorkarea({ ...EMPTY_DESKTOP_WORKAREA });
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
desktopWorkspaceStore.setWorkarea(measureElement(el));
|
|
28
|
+
}
|
|
29
|
+
function disconnectObserver() {
|
|
30
|
+
resizeObserver?.disconnect();
|
|
31
|
+
resizeObserver = null;
|
|
32
|
+
}
|
|
33
|
+
function observeStage(el) {
|
|
34
|
+
disconnectObserver();
|
|
35
|
+
refreshWorkarea();
|
|
36
|
+
if (typeof ResizeObserver === "undefined") {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
resizeObserver = new ResizeObserver(() => refreshWorkarea());
|
|
40
|
+
resizeObserver.observe(el);
|
|
41
|
+
}
|
|
42
|
+
watch(
|
|
43
|
+
shellStageRef,
|
|
44
|
+
(el) => {
|
|
45
|
+
disconnectObserver();
|
|
46
|
+
if (typeof HTMLElement !== "undefined" && el instanceof HTMLElement) {
|
|
47
|
+
observeStage(el);
|
|
48
|
+
} else {
|
|
49
|
+
desktopWorkspaceStore.setWorkarea({ ...EMPTY_DESKTOP_WORKAREA });
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{ immediate: true }
|
|
53
|
+
);
|
|
54
|
+
watch(
|
|
55
|
+
() => desktopWorkspaceStore.overview,
|
|
56
|
+
(open) => {
|
|
57
|
+
if (!open) {
|
|
58
|
+
refreshWorkarea();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
if (typeof window !== "undefined") {
|
|
63
|
+
window.addEventListener("resize", refreshWorkarea);
|
|
64
|
+
onScopeDispose(() => {
|
|
65
|
+
window.removeEventListener("resize", refreshWorkarea);
|
|
66
|
+
disconnectObserver();
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
onScopeDispose(disconnectObserver);
|
|
70
|
+
}
|
|
71
|
+
return desktopWorkspaceStore.workarea;
|
|
72
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Use useDesktopCommands instead
|
|
3
|
+
*/
|
|
4
|
+
export declare function useTerminalManager(): {
|
|
5
|
+
register: (command: DesktopCommand) => void;
|
|
6
|
+
list: () => string[];
|
|
7
|
+
get: (name: string) => DesktopCommand | undefined;
|
|
8
|
+
all: () => DesktopCommand[];
|
|
9
|
+
exec: (input: string) => Promise<CommandOutput | void>;
|
|
10
|
+
addCommand: (command: DesktopCommand) => void;
|
|
11
|
+
listCommands: () => string[];
|
|
12
|
+
getCommand: (name: string) => DesktopCommand | undefined;
|
|
13
|
+
getAllCommands: () => DesktopCommand[];
|
|
14
|
+
execCommand: (input: string) => Promise<CommandOutput | void>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useDesktopCommands } from "./useDesktopCommands.js";
|
|
2
|
+
export function useTerminalManager() {
|
|
3
|
+
if (process.dev) {
|
|
4
|
+
console.warn(
|
|
5
|
+
"[@owdproject/nuxt] useTerminalManager() is deprecated. Please use useDesktopCommands() or useDesktop().commands instead."
|
|
6
|
+
);
|
|
7
|
+
}
|
|
8
|
+
return useDesktopCommands();
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useToggleWindowMaximize(): (win: any) => any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function useToggleWindowMaximize() {
|
|
2
|
+
return function toggle(win) {
|
|
3
|
+
if (!win) return false;
|
|
4
|
+
if (typeof win.toggleMaximize === "function") {
|
|
5
|
+
return win.toggleMaximize();
|
|
6
|
+
}
|
|
7
|
+
if (typeof win.actions?.toggleMaximize === "function") {
|
|
8
|
+
return win.actions.toggleMaximize();
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function useDesktopWindow(): {
|
|
2
|
+
list: import("vue").ComputedRef<IWindowController[]>;
|
|
3
|
+
index: import("vue").ComputedRef<Map<string, IWindowController>>;
|
|
4
|
+
activeWorkspaceWindows: import("vue").ComputedRef<IWindowController[]>;
|
|
5
|
+
focused: import("vue").ComputedRef<any>;
|
|
6
|
+
topMaximizedWindow: import("vue").ComputedRef<any>;
|
|
7
|
+
get: (windowId: string) => IWindowController | undefined;
|
|
8
|
+
tileWindows: (mode?: "horizontal" | "vertical" | "grid", workspaceId?: string) => number;
|
|
9
|
+
minimizeAll: (workspaceId?: string) => void;
|
|
10
|
+
restoreAll: (workspaceId?: string) => void;
|
|
11
|
+
close: (windowId: string) => void;
|
|
12
|
+
closeAll: (appId?: string) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const useDesktopWindows: typeof useDesktopWindow;
|