@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.
Files changed (169) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +77 -2
  3. package/dist/kit/authoring.d.ts +88 -0
  4. package/dist/kit/authoring.js +276 -0
  5. package/dist/kit/defineDesktopApp.d.ts +1 -0
  6. package/dist/kit/defineDesktopApp.js +1 -0
  7. package/dist/kit/defineDesktopPlugin.d.ts +1 -0
  8. package/dist/kit/defineDesktopPlugin.js +1 -0
  9. package/dist/module.d.mts +245 -0
  10. package/dist/module.json +12 -0
  11. package/dist/module.mjs +681 -0
  12. package/dist/runtime/components/Application/DesktopCoreApplicationRender.d.vue.ts +6 -0
  13. package/dist/runtime/components/Application/DesktopCoreApplicationRender.vue +18 -0
  14. package/dist/runtime/components/Application/DesktopCoreApplicationRender.vue.d.ts +6 -0
  15. package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.d.vue.ts +9 -0
  16. package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue +31 -0
  17. package/dist/runtime/components/Application/DesktopCoreApplicationWindowsRender.vue.d.ts +9 -0
  18. package/dist/runtime/components/DesktopCore.d.vue.ts +19 -0
  19. package/dist/runtime/components/DesktopCore.vue +37 -0
  20. package/dist/runtime/components/DesktopCore.vue.d.ts +19 -0
  21. package/dist/runtime/components/background/DesktopCoreBackground.d.vue.ts +13 -0
  22. package/dist/runtime/components/background/DesktopCoreBackground.vue +16 -0
  23. package/dist/runtime/components/background/DesktopCoreBackground.vue.d.ts +13 -0
  24. package/dist/runtime/components/time/DesktopCoreTime.d.vue.ts +3 -0
  25. package/dist/runtime/components/time/DesktopCoreTime.vue +44 -0
  26. package/dist/runtime/components/time/DesktopCoreTime.vue.d.ts +3 -0
  27. package/dist/runtime/components/window/DesktopCoreWindow.d.vue.ts +49 -0
  28. package/dist/runtime/components/window/DesktopCoreWindow.vue +438 -0
  29. package/dist/runtime/components/window/DesktopCoreWindow.vue.d.ts +49 -0
  30. package/dist/runtime/components/window/DesktopCoreWindowContent.d.vue.ts +13 -0
  31. package/dist/runtime/components/window/DesktopCoreWindowContent.vue +34 -0
  32. package/dist/runtime/components/window/DesktopCoreWindowContent.vue.d.ts +13 -0
  33. package/dist/runtime/components/window/DesktopCoreWindowNav.d.vue.ts +13 -0
  34. package/dist/runtime/components/window/DesktopCoreWindowNav.vue +54 -0
  35. package/dist/runtime/components/window/DesktopCoreWindowNav.vue.d.ts +13 -0
  36. package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.d.vue.ts +19 -0
  37. package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue +46 -0
  38. package/dist/runtime/components/window/DesktopCoreWindowSnapHintsBase.vue.d.ts +19 -0
  39. package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.d.vue.ts +24 -0
  40. package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue +50 -0
  41. package/dist/runtime/components/workspace/DesktopCoreWorkspaceEdgeHintsBase.vue.d.ts +24 -0
  42. package/dist/runtime/composables/application/state.d.ts +1 -0
  43. package/dist/runtime/composables/application/state.js +2 -0
  44. package/dist/runtime/composables/application/useDesktopApplicationDefine.d.ts +4 -0
  45. package/dist/runtime/composables/application/useDesktopApplicationDefine.js +36 -0
  46. package/dist/runtime/composables/application/useDesktopApplicationExec.d.ts +3 -0
  47. package/dist/runtime/composables/application/useDesktopApplicationExec.js +26 -0
  48. package/dist/runtime/composables/application/useDesktopApplicationProcess.d.ts +24 -0
  49. package/dist/runtime/composables/application/useDesktopApplicationProcess.js +140 -0
  50. package/dist/runtime/composables/application/useDesktopApplicationRegistry.d.ts +11 -0
  51. package/dist/runtime/composables/application/useDesktopApplicationRegistry.js +60 -0
  52. package/dist/runtime/composables/useApplicationEntries.d.ts +5 -0
  53. package/dist/runtime/composables/useApplicationEntries.js +10 -0
  54. package/dist/runtime/composables/useApplicationManager.d.ts +16 -0
  55. package/dist/runtime/composables/useApplicationManager.js +30 -0
  56. package/dist/runtime/composables/useBlockNonInputContextMenu.d.ts +5 -0
  57. package/dist/runtime/composables/useBlockNonInputContextMenu.js +19 -0
  58. package/dist/runtime/composables/useDesktop.d.ts +210 -0
  59. package/dist/runtime/composables/useDesktop.js +52 -0
  60. package/dist/runtime/composables/useDesktopApplication.d.ts +34 -0
  61. package/dist/runtime/composables/useDesktopApplication.js +17 -0
  62. package/dist/runtime/composables/useDesktopCommands.d.ts +12 -0
  63. package/dist/runtime/composables/useDesktopCommands.js +348 -0
  64. package/dist/runtime/composables/useDesktopConfig.d.ts +3 -0
  65. package/dist/runtime/composables/useDesktopConfig.js +10 -0
  66. package/dist/runtime/composables/useDesktopDefaultApps.d.ts +15 -0
  67. package/dist/runtime/composables/useDesktopDefaultApps.js +21 -0
  68. package/dist/runtime/composables/useDesktopDialogs.d.ts +5 -0
  69. package/dist/runtime/composables/useDesktopDialogs.js +8 -0
  70. package/dist/runtime/composables/useDesktopDrag.d.ts +1 -0
  71. package/dist/runtime/composables/useDesktopDrag.js +1 -0
  72. package/dist/runtime/composables/useDesktopHooks.d.ts +15 -0
  73. package/dist/runtime/composables/useDesktopHooks.js +12 -0
  74. package/dist/runtime/composables/useDesktopIPC.d.ts +35 -0
  75. package/dist/runtime/composables/useDesktopIPC.js +72 -0
  76. package/dist/runtime/composables/useDesktopIdentity.d.ts +22 -0
  77. package/dist/runtime/composables/useDesktopIdentity.js +65 -0
  78. package/dist/runtime/composables/useDesktopManifest.d.ts +6 -0
  79. package/dist/runtime/composables/useDesktopManifest.js +17 -0
  80. package/dist/runtime/composables/useDesktopNotification.d.ts +13 -0
  81. package/dist/runtime/composables/useDesktopNotification.js +13 -0
  82. package/dist/runtime/composables/useDesktopResize.d.ts +1 -0
  83. package/dist/runtime/composables/useDesktopResize.js +1 -0
  84. package/dist/runtime/composables/useDesktopSession.d.ts +4 -0
  85. package/dist/runtime/composables/useDesktopSession.js +17 -0
  86. package/dist/runtime/composables/useDesktopShellIdentity.d.ts +1 -0
  87. package/dist/runtime/composables/useDesktopShellIdentity.js +3 -0
  88. package/dist/runtime/composables/useDesktopShellOptions.d.ts +5 -0
  89. package/dist/runtime/composables/useDesktopShellOptions.js +18 -0
  90. package/dist/runtime/composables/useDesktopTray.d.ts +5 -0
  91. package/dist/runtime/composables/useDesktopTray.js +10 -0
  92. package/dist/runtime/composables/useDesktopVolume.d.ts +4 -0
  93. package/dist/runtime/composables/useDesktopVolume.js +9 -0
  94. package/dist/runtime/composables/useDesktopWorkArea.d.ts +1 -0
  95. package/dist/runtime/composables/useDesktopWorkArea.js +3 -0
  96. package/dist/runtime/composables/useDesktopWorkarea.d.ts +12 -0
  97. package/dist/runtime/composables/useDesktopWorkarea.js +72 -0
  98. package/dist/runtime/composables/useTerminalManager.d.ts +15 -0
  99. package/dist/runtime/composables/useTerminalManager.js +9 -0
  100. package/dist/runtime/composables/useToggleWindowMaximize.d.ts +1 -0
  101. package/dist/runtime/composables/useToggleWindowMaximize.js +12 -0
  102. package/dist/runtime/composables/useWindowDragHandlers.d.ts +7 -0
  103. package/dist/runtime/composables/useWindowDragHandlers.js +7 -0
  104. package/dist/runtime/composables/window/useDesktopWindow.d.ts +14 -0
  105. package/dist/runtime/composables/window/useDesktopWindow.js +192 -0
  106. package/dist/runtime/composables/window/useDesktopWindowSnapDrop.d.ts +13 -0
  107. package/dist/runtime/composables/window/useDesktopWindowSnapDrop.js +78 -0
  108. package/dist/runtime/composables/workspace/useDesktopWorkspaceEdgeDrop.d.ts +25 -0
  109. package/dist/runtime/composables/workspace/useDesktopWorkspaceEdgeDrop.js +119 -0
  110. package/dist/runtime/composables/workspace/useDesktopWorkspaceManager.d.ts +8 -0
  111. package/dist/runtime/composables/workspace/useDesktopWorkspaceManager.js +46 -0
  112. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewCapture.d.ts +20 -0
  113. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewCapture.js +60 -0
  114. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewLiveScale.d.ts +31 -0
  115. package/dist/runtime/composables/workspace/useDesktopWorkspaceOverviewLiveScale.js +92 -0
  116. package/dist/runtime/constants/desktopShellKeys.d.ts +5 -0
  117. package/dist/runtime/constants/desktopShellKeys.js +2 -0
  118. package/dist/runtime/constants/shellLayout.d.ts +4 -0
  119. package/dist/runtime/constants/shellLayout.js +2 -0
  120. package/dist/runtime/dialogs/desktopDialogProvider.d.ts +6 -0
  121. package/dist/runtime/dialogs/desktopDialogProvider.js +12 -0
  122. package/dist/runtime/internal/controllers/ApplicationController.d.ts +44 -0
  123. package/dist/runtime/internal/controllers/ApplicationController.js +470 -0
  124. package/dist/runtime/internal/controllers/WindowController.d.ts +83 -0
  125. package/dist/runtime/internal/controllers/WindowController.js +435 -0
  126. package/dist/runtime/plugins/01.desktop-shell-init.client.d.ts +2 -0
  127. package/dist/runtime/plugins/01.desktop-shell-init.client.js +18 -0
  128. package/dist/runtime/plugins/02.desktop-register-desktop-apps.client.d.ts +2 -0
  129. package/dist/runtime/plugins/02.desktop-register-desktop-apps.client.js +7 -0
  130. package/dist/runtime/stores/storeApplicationMeta.d.ts +2 -0
  131. package/dist/runtime/stores/storeApplicationMeta.js +30 -0
  132. package/dist/runtime/stores/storeApplicationWindows.d.ts +2 -0
  133. package/dist/runtime/stores/storeApplicationWindows.js +43 -0
  134. package/dist/runtime/stores/storeDesktop.d.ts +17 -0
  135. package/dist/runtime/stores/storeDesktop.js +29 -0
  136. package/dist/runtime/stores/storeDesktopDefaultApps.d.ts +8 -0
  137. package/dist/runtime/stores/storeDesktopDefaultApps.js +21 -0
  138. package/dist/runtime/stores/storeDesktopTray.d.ts +6 -0
  139. package/dist/runtime/stores/storeDesktopTray.js +21 -0
  140. package/dist/runtime/stores/storeDesktopVolume.d.ts +4 -0
  141. package/dist/runtime/stores/storeDesktopVolume.js +12 -0
  142. package/dist/runtime/stores/storeDesktopWorkspace.d.ts +26 -0
  143. package/dist/runtime/stores/storeDesktopWorkspace.js +103 -0
  144. package/dist/runtime/stores/storeNotification.d.ts +27 -0
  145. package/dist/runtime/stores/storeNotification.js +62 -0
  146. package/dist/runtime/types/index.d.ts +1 -0
  147. package/dist/runtime/types/index.js +1 -0
  148. package/dist/runtime/utils/defineDesktopApp.d.ts +2 -0
  149. package/dist/runtime/utils/defineDesktopApp.js +5 -0
  150. package/dist/runtime/utils/defineDesktopPlugin.d.ts +19 -0
  151. package/dist/runtime/utils/defineDesktopPlugin.js +29 -0
  152. package/dist/runtime/utils/utilApp.d.ts +2 -0
  153. package/dist/runtime/utils/utilApp.js +9 -0
  154. package/dist/runtime/utils/utilCaptureElementToCanvas.d.ts +1 -0
  155. package/dist/runtime/utils/utilCaptureElementToCanvas.js +21 -0
  156. package/dist/runtime/utils/utilDebug.d.ts +4 -0
  157. package/dist/runtime/utils/utilDebug.js +24 -0
  158. package/dist/runtime/utils/utilDetectSnapZone.d.ts +1 -0
  159. package/dist/runtime/utils/utilDetectSnapZone.js +5 -0
  160. package/dist/runtime/utils/utilWindowControllerAdapter.d.ts +2 -0
  161. package/dist/runtime/utils/utilWindowControllerAdapter.js +151 -0
  162. package/dist/runtime/utils/utilWindowLayout.d.ts +4 -0
  163. package/dist/runtime/utils/utilWindowLayout.js +34 -0
  164. package/dist/runtime/utils/utilWorkspaceWindows.d.ts +2 -0
  165. package/dist/runtime/utils/utilWorkspaceWindows.js +12 -0
  166. package/dist/types/index.d.ts +164 -0
  167. package/dist/types/index.js +1 -0
  168. package/dist/types.d.mts +2 -0
  169. package/package.json +151 -4
@@ -0,0 +1,46 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useDesktopWorkspaceStore } from "../../stores/storeDesktopWorkspace";
4
+ import { useDesktopWindowSnapDrop } from "../../composables/window/useDesktopWindowSnapDrop";
5
+ const props = defineProps({
6
+ enabled: { type: Boolean, required: false }
7
+ });
8
+ const desktopWorkspaceStore = useDesktopWorkspaceStore();
9
+ const { snapHint, snapHintRect, isSnapDragActive } = useDesktopWindowSnapDrop();
10
+ const visible = computed(
11
+ () => props.enabled !== false && !desktopWorkspaceStore.overview && isSnapDragActive.value && snapHint.value !== null && snapHintRect.value !== null
12
+ );
13
+ const hintStyle = computed(() => {
14
+ const rect = snapHintRect.value;
15
+ if (!rect) return void 0;
16
+ return {
17
+ left: `${rect.x}px`,
18
+ top: `${rect.y}px`,
19
+ width: `${rect.width}px`,
20
+ height: `${rect.height}px`
21
+ };
22
+ });
23
+ </script>
24
+
25
+ <template>
26
+ <div
27
+ v-if="visible"
28
+ class="desktop-window-snap-hints"
29
+ aria-hidden="true"
30
+ >
31
+ <div
32
+ class="desktop-window-snap-hints__zone"
33
+ :class="`desktop-window-snap-hints__zone--${snapHint}`"
34
+ :style="hintStyle"
35
+ >
36
+ <slot
37
+ :zone="snapHint"
38
+ :rect="snapHintRect"
39
+ />
40
+ </div>
41
+ </div>
42
+ </template>
43
+
44
+ <style scoped>
45
+ .desktop-window-snap-hints{inset:0;pointer-events:none;position:fixed;z-index:999998}.desktop-window-snap-hints__zone{background:rgba(96,165,250,.18);border:2px solid rgba(96,165,250,.85);border-radius:4px;box-sizing:border-box;position:fixed;transition:left 80ms ease,top 80ms ease,width 80ms ease,height 80ms ease}
46
+ </style>
@@ -0,0 +1,19 @@
1
+ type __VLS_Props = {
2
+ enabled?: boolean;
3
+ };
4
+ declare var __VLS_1: {
5
+ zone: any;
6
+ rect: import("@owdproject/core").WindowBounds | null;
7
+ };
8
+ type __VLS_Slots = {} & {
9
+ default?: (props: typeof __VLS_1) => any;
10
+ };
11
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
13
+ declare const _default: typeof __VLS_export;
14
+ export default _default;
15
+ type __VLS_WithSlots<T, S> = T & {
16
+ new (): {
17
+ $slots: S;
18
+ };
19
+ };
@@ -0,0 +1,24 @@
1
+ type __VLS_Props = {
2
+ enabled?: boolean;
3
+ };
4
+ declare var __VLS_1: {
5
+ desktopIndex: number | null;
6
+ side: "left";
7
+ }, __VLS_3: {
8
+ desktopIndex: number | null;
9
+ side: "right";
10
+ };
11
+ type __VLS_Slots = {} & {
12
+ left?: (props: typeof __VLS_1) => any;
13
+ } & {
14
+ right?: (props: typeof __VLS_3) => any;
15
+ };
16
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1,50 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { useDesktopWorkspaceEdgeDrop } from "../../composables/workspace/useDesktopWorkspaceEdgeDrop";
4
+ import { useDesktopWorkspaceStore } from "../../stores/storeDesktopWorkspace";
5
+ const props = defineProps({
6
+ enabled: { type: Boolean, required: false }
7
+ });
8
+ const desktopWorkspaceStore = useDesktopWorkspaceStore();
9
+ const { edgeHint, edgeTargetDesktopIndex } = useDesktopWorkspaceEdgeDrop();
10
+ const visible = computed(
11
+ () => props.enabled !== false && !desktopWorkspaceStore.overview && desktopWorkspaceStore.list.length > 1 && edgeHint.value !== null && edgeTargetDesktopIndex.value !== null
12
+ );
13
+ </script>
14
+
15
+ <template>
16
+ <div
17
+ v-if="visible"
18
+ class="desktop-workspace-edge-hints"
19
+ aria-hidden="true"
20
+ >
21
+ <div
22
+ class="desktop-workspace-edge-hints__zone desktop-workspace-edge-hints__zone--left"
23
+ :class="{
24
+ 'desktop-workspace-edge-hints__zone--active': edgeHint === 'left'
25
+ }"
26
+ >
27
+ <slot
28
+ name="left"
29
+ :desktop-index="edgeTargetDesktopIndex"
30
+ :side="'left'"
31
+ />
32
+ </div>
33
+ <div
34
+ class="desktop-workspace-edge-hints__zone desktop-workspace-edge-hints__zone--right"
35
+ :class="{
36
+ 'desktop-workspace-edge-hints__zone--active': edgeHint === 'right'
37
+ }"
38
+ >
39
+ <slot
40
+ name="right"
41
+ :desktop-index="edgeTargetDesktopIndex"
42
+ :side="'right'"
43
+ />
44
+ </div>
45
+ </div>
46
+ </template>
47
+
48
+ <style scoped>
49
+ .desktop-workspace-edge-hints{inset:0;pointer-events:none;position:fixed;z-index:999998}.desktop-workspace-edge-hints__zone{bottom:0;opacity:0;position:fixed;top:0;transition:opacity .12s ease;width:72px}.desktop-top-workspace-edge-hints__zone--left{left:0}.desktop-workspace-edge-hints__zone--right{right:0}.desktop-workspace-edge-hints__zone--active{opacity:1}
50
+ </style>
@@ -0,0 +1,24 @@
1
+ type __VLS_Props = {
2
+ enabled?: boolean;
3
+ };
4
+ declare var __VLS_1: {
5
+ desktopIndex: number | null;
6
+ side: "left";
7
+ }, __VLS_3: {
8
+ desktopIndex: number | null;
9
+ side: "right";
10
+ };
11
+ type __VLS_Slots = {} & {
12
+ left?: (props: typeof __VLS_1) => any;
13
+ } & {
14
+ right?: (props: typeof __VLS_3) => any;
15
+ };
16
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
17
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
18
+ declare const _default: typeof __VLS_export;
19
+ export default _default;
20
+ type __VLS_WithSlots<T, S> = T & {
21
+ new (): {
22
+ $slots: S;
23
+ };
24
+ };
@@ -0,0 +1 @@
1
+ export declare const apps: import("vue").Reactive<Map<string, IApplicationController>>;
@@ -0,0 +1,2 @@
1
+ import { reactive } from "vue";
2
+ export const apps = reactive(/* @__PURE__ */ new Map());
@@ -0,0 +1,4 @@
1
+ export declare function useDesktopApplicationDefine(): {
2
+ define: (id: string, config: ApplicationConfig) => Promise<any>;
3
+ defineApp: (id: string, config: ApplicationConfig) => Promise<any>;
4
+ };
@@ -0,0 +1,36 @@
1
+ import { markRaw } from "vue";
2
+ import { ApplicationController } from "../../internal/controllers/ApplicationController.js";
3
+ import { normalizeApplicationConfig } from "../../utils/utilApp.js";
4
+ import { debugLog } from "../../utils/utilDebug.js";
5
+ import { useDesktopHooks } from "../useDesktopHooks.js";
6
+ import { apps } from "./state.js";
7
+ export function useDesktopApplicationDefine() {
8
+ async function define(id, config) {
9
+ if (apps.has(id)) {
10
+ debugLog(`App "${id}" is already defined`);
11
+ return apps.get(id);
12
+ }
13
+ const { callHook } = useDesktopHooks();
14
+ const defineCtx = {
15
+ id,
16
+ config,
17
+ cancel: false
18
+ };
19
+ await callHook("app:before-define", defineCtx);
20
+ if (defineCtx.cancel) {
21
+ return void 0;
22
+ }
23
+ const normalizedConfig = normalizeApplicationConfig(defineCtx.config);
24
+ const applicationConfig = markRaw(normalizedConfig);
25
+ const applicationController = new ApplicationController(defineCtx.id, applicationConfig);
26
+ await applicationController.initApplication();
27
+ const rawController = markRaw(applicationController);
28
+ apps.set(defineCtx.id, rawController);
29
+ await callHook("app:defined", { app: rawController });
30
+ return rawController;
31
+ }
32
+ return {
33
+ define,
34
+ defineApp: define
35
+ };
36
+ }
@@ -0,0 +1,3 @@
1
+ export declare function useDesktopApplicationExec(): {
2
+ exec: (id: string, rawCommand: string) => Promise<CommandOutput>;
3
+ };
@@ -0,0 +1,26 @@
1
+ import * as shellwords from "shellwords";
2
+ import getopts from "getopts";
3
+ import { apps } from "./state.js";
4
+ export function useDesktopApplicationExec() {
5
+ async function exec(id, rawCommand) {
6
+ const app = apps.get(id);
7
+ if (!app) {
8
+ throw Error(`App "${id}" is not defined`);
9
+ }
10
+ const args = shellwords.split(rawCommand);
11
+ const parsed = getopts(args);
12
+ const command = parsed._[0];
13
+ if (!app.config.commands || !Object.prototype.hasOwnProperty.call(app.config.commands, command)) {
14
+ throw Error(
15
+ `App command "${command}" is not defined in ${id} application`
16
+ );
17
+ }
18
+ const commandFn = app.config.commands[command];
19
+ const commandOutput = await commandFn(app, parsed);
20
+ app.setRunning(true);
21
+ return commandOutput;
22
+ }
23
+ return {
24
+ exec
25
+ };
26
+ }
@@ -0,0 +1,24 @@
1
+ export declare function useDesktopApplicationProcess(): {
2
+ running: import("vue").ComputedRef<IApplicationController[]>;
3
+ processes: import("vue").ComputedRef<{
4
+ id: string;
5
+ title: string;
6
+ icon?: string;
7
+ category?: string;
8
+ pid: number | null;
9
+ state: string;
10
+ isRunning: boolean;
11
+ isSuspended: boolean;
12
+ windowCount: number;
13
+ startedAt: number | null;
14
+ controller: IApplicationController;
15
+ }[]>;
16
+ isRunning: (id: string | undefined) => boolean;
17
+ findByPid: (pid: number) => IApplicationController | undefined;
18
+ resolveApp: (idOrPid: string | number) => IApplicationController | undefined;
19
+ launch: (id: string, entryKey?: string, argument?: string) => Promise<any>;
20
+ suspend: (idOrPid: string | number) => boolean;
21
+ resume: (idOrPid: string | number) => boolean;
22
+ kill: (idOrPid: string | number, signal?: "SIGTERM" | "SIGKILL" | "SIGSTOP" | "SIGCONT") => boolean;
23
+ close: (id: string) => void;
24
+ };
@@ -0,0 +1,140 @@
1
+ import { computed } from "vue";
2
+ import { apps } from "./state.js";
3
+ import { useDesktopApplicationExec } from "./useDesktopApplicationExec.js";
4
+ import { useDesktopHooks } from "../useDesktopHooks.js";
5
+ const sharedRunningApps = computed(() => {
6
+ const runningApps = [];
7
+ for (const app of apps.values()) {
8
+ const openCount = app.openWindowCount.value;
9
+ if (app.isRunning || openCount > 0) {
10
+ runningApps.push(app);
11
+ }
12
+ }
13
+ return runningApps;
14
+ });
15
+ const sharedProcesses = computed(() => {
16
+ const allProcesses = [];
17
+ for (const app of apps.values()) {
18
+ allProcesses.push({
19
+ id: app.id,
20
+ title: app.config.title,
21
+ icon: app.config.icon,
22
+ category: app.config.category,
23
+ pid: app.pid,
24
+ state: app.stateValue,
25
+ isRunning: app.isRunning,
26
+ isSuspended: app.isSuspended,
27
+ windowCount: app.openWindowCount.value,
28
+ startedAt: app.startedAt,
29
+ controller: app
30
+ });
31
+ }
32
+ return allProcesses.sort((a, b) => {
33
+ if (a.isRunning !== b.isRunning) return a.isRunning ? -1 : 1;
34
+ return (a.pid ?? 99999) - (b.pid ?? 99999);
35
+ });
36
+ });
37
+ export function useDesktopApplicationProcess() {
38
+ const { exec } = useDesktopApplicationExec();
39
+ function isRunning(id) {
40
+ if (!id) return false;
41
+ const app = apps.get(id);
42
+ return !!app?.isRunning;
43
+ }
44
+ function findByPid(pid) {
45
+ for (const app of apps.values()) {
46
+ if (app.pid === pid) {
47
+ return app;
48
+ }
49
+ }
50
+ return void 0;
51
+ }
52
+ function resolveApp(idOrPid) {
53
+ if (typeof idOrPid === "number") {
54
+ return findByPid(idOrPid);
55
+ }
56
+ const asNumber = Number(idOrPid);
57
+ if (!Number.isNaN(asNumber) && String(asNumber) === idOrPid.trim()) {
58
+ const byPid = findByPid(asNumber);
59
+ if (byPid) return byPid;
60
+ }
61
+ if (apps.has(idOrPid)) {
62
+ return apps.get(idOrPid);
63
+ }
64
+ const lower = idOrPid.toLowerCase();
65
+ for (const app of apps.values()) {
66
+ if (app.id.toLowerCase() === lower || app.id.toLowerCase().endsWith(`.${lower}`) || app.config.title.toLowerCase() === lower) {
67
+ return app;
68
+ }
69
+ }
70
+ return void 0;
71
+ }
72
+ async function launch(id, entryKey, argument = "") {
73
+ const app = resolveApp(id);
74
+ if (!app) {
75
+ throw Error(`App "${id}" is not defined`);
76
+ }
77
+ const { callHook } = useDesktopHooks();
78
+ const beforeLaunchCtx = {
79
+ app,
80
+ entryKey,
81
+ argument,
82
+ cancel: false
83
+ };
84
+ await callHook("app:before-launch", beforeLaunchCtx);
85
+ if (beforeLaunchCtx.cancel) {
86
+ return;
87
+ }
88
+ const entries = app.config.entries || {};
89
+ const resolvedKey = beforeLaunchCtx.entryKey || Object.keys(entries)[0];
90
+ if (!resolvedKey || !entries.hasOwnProperty(resolvedKey)) {
91
+ if (app.config.windows && Object.keys(app.config.windows).length > 0) {
92
+ const firstModel = Object.keys(app.config.windows)[0];
93
+ return app.openWindow(firstModel);
94
+ }
95
+ throw Error(`App entry "${resolvedKey}" is not defined in ${app.id} application`);
96
+ }
97
+ const entry = entries[resolvedKey];
98
+ const finalArg = beforeLaunchCtx.argument ?? argument;
99
+ const suffix = finalArg ? ` ${finalArg}` : "";
100
+ await exec(app.id, entry.command + suffix);
101
+ }
102
+ function suspend(idOrPid) {
103
+ const app = resolveApp(idOrPid);
104
+ if (!app || !app.isRunning) return false;
105
+ app.suspend();
106
+ return true;
107
+ }
108
+ function resume(idOrPid) {
109
+ const app = resolveApp(idOrPid);
110
+ if (!app || !app.isRunning) return false;
111
+ app.resume();
112
+ return true;
113
+ }
114
+ function kill(idOrPid, signal = "SIGTERM") {
115
+ const app = resolveApp(idOrPid);
116
+ if (!app) return false;
117
+ app.sendSignal(signal);
118
+ return true;
119
+ }
120
+ function close(id) {
121
+ const app = resolveApp(id);
122
+ if (!app) {
123
+ throw Error(`App "${id}" is not defined`);
124
+ }
125
+ app.closeAllWindows();
126
+ app.setRunning(false);
127
+ }
128
+ return {
129
+ running: sharedRunningApps,
130
+ processes: sharedProcesses,
131
+ isRunning,
132
+ findByPid,
133
+ resolveApp,
134
+ launch,
135
+ suspend,
136
+ resume,
137
+ kill,
138
+ close
139
+ };
140
+ }
@@ -0,0 +1,11 @@
1
+ import { type ComputedRef } from 'vue';
2
+ export type SortBy = 'title' | 'category' | ((a: any, b: any) => number);
3
+ export type Visibility = 'primary' | 'all' | ((entry: any) => boolean);
4
+ export declare function useDesktopApplicationRegistry(): {
5
+ list: ComputedRef<any[]>;
6
+ categories: ComputedRef<Record<string, IApplicationController[]>>;
7
+ apps: import("vue").Reactive<Map<string, IApplicationController>>;
8
+ get: (id: string) => any;
9
+ isAppDefined: (id: string) => boolean;
10
+ getSortedEntries: (sortBy?: SortBy, visibility?: Visibility) => ComputedRef<any[]>;
11
+ };
@@ -0,0 +1,60 @@
1
+ import { computed } from "vue";
2
+ import { apps } from "./state.js";
3
+ const sharedRegistryList = computed(() => {
4
+ const entries = [];
5
+ for (const app of apps.values()) {
6
+ if (!app.config.entries) {
7
+ continue;
8
+ }
9
+ for (const entryKey of Object.keys(app.config.entries)) {
10
+ const entry = app.config.entries[entryKey];
11
+ entries.push({
12
+ application: app,
13
+ title: entry.title ?? app.config.title,
14
+ icon: entry.icon ?? app.config.icon,
15
+ category: entry.category ?? app.config.category,
16
+ visibility: entry.visibility ?? "primary",
17
+ command: entry.command
18
+ });
19
+ }
20
+ }
21
+ return entries;
22
+ });
23
+ const sharedCategories = computed(() => {
24
+ const categorizedApps = {};
25
+ for (const app of apps.values()) {
26
+ const category = app.config.category || "other";
27
+ if (!categorizedApps[category]) {
28
+ categorizedApps[category] = [];
29
+ }
30
+ categorizedApps[category].push(app);
31
+ }
32
+ for (const category in categorizedApps) {
33
+ categorizedApps[category].sort(
34
+ (a, b) => a.config.title.localeCompare(b.config.title)
35
+ );
36
+ }
37
+ return categorizedApps;
38
+ });
39
+ export function useDesktopApplicationRegistry() {
40
+ function getSortedEntries(sortBy = "title", visibility = "primary") {
41
+ return computed(() => {
42
+ const currentEntries = [...sharedRegistryList.value];
43
+ const filtered = typeof visibility === "function" ? currentEntries.filter(visibility) : visibility === "primary" ? currentEntries.filter((e) => e.visibility !== "secondary") : currentEntries;
44
+ const sorted = typeof sortBy === "function" ? filtered.sort(sortBy) : sortBy === "title" ? filtered.sort(
45
+ (a, b) => (a.title || "").localeCompare(b.title || "")
46
+ ) : filtered.sort(
47
+ (a, b) => (a.category || "").localeCompare(b.category || "")
48
+ );
49
+ return sorted;
50
+ });
51
+ }
52
+ return {
53
+ list: sharedRegistryList,
54
+ categories: sharedCategories,
55
+ apps,
56
+ get: (id) => apps.get(id),
57
+ isAppDefined: (id) => apps.has(id),
58
+ getSortedEntries
59
+ };
60
+ }
@@ -0,0 +1,5 @@
1
+ import { type Ref } from 'vue';
2
+ import { type SortBy, type Visibility } from './application/useDesktopApplicationRegistry.js';
3
+ export declare function useApplicationEntries(): {
4
+ sortedAppEntries: (sortBy?: SortBy, visibility?: Visibility) => Ref<any[]>;
5
+ };
@@ -0,0 +1,10 @@
1
+ import {
2
+ useDesktopApplicationRegistry
3
+ } from "./application/useDesktopApplicationRegistry.js";
4
+ export function useApplicationEntries() {
5
+ const registry = useDesktopApplicationRegistry();
6
+ const sortedAppEntries = function(sortBy = "title", visibility = "primary") {
7
+ return registry.getSortedEntries(sortBy, visibility);
8
+ };
9
+ return { sortedAppEntries };
10
+ }
@@ -0,0 +1,16 @@
1
+ export declare function useApplicationManager(): {
2
+ defineApp: (id: string, config: ApplicationConfig) => Promise<any>;
3
+ isAppDefined: (id: string) => boolean;
4
+ getAppById: (id: string) => any;
5
+ isAppRunning: (id: string | undefined) => boolean;
6
+ launchAppEntry: (id: string, entryKey?: string, argument?: string) => Promise<any>;
7
+ execAppCommand: (id: string, rawCommand: string) => Promise<CommandOutput>;
8
+ closeApp: (id: string) => void;
9
+ getWindowOpenedId: (windowId: string) => IWindowController | undefined;
10
+ apps: import("vue").Reactive<Map<string, IApplicationController>>;
11
+ appsEntries: import("vue").ComputedRef<any[]>;
12
+ appsRunning: import("vue").ComputedRef<IApplicationController[]>;
13
+ windowsOpened: import("vue").ComputedRef<Map<string, IWindowController>>;
14
+ appCategories: import("vue").ComputedRef<string[]>;
15
+ appsByCategory: import("vue").ComputedRef<Record<string, IApplicationController[]>>;
16
+ };
@@ -0,0 +1,30 @@
1
+ import { computed } from "vue";
2
+ import { apps } from "./application/state.js";
3
+ import { useDesktopApplicationProcess } from "./application/useDesktopApplicationProcess.js";
4
+ import { useDesktopApplicationExec } from "./application/useDesktopApplicationExec.js";
5
+ import { useDesktopApplicationDefine } from "./application/useDesktopApplicationDefine.js";
6
+ import { useDesktopApplicationRegistry } from "./application/useDesktopApplicationRegistry.js";
7
+ import { useDesktopWindow } from "./window/useDesktopWindow.js";
8
+ export function useApplicationManager() {
9
+ const process = useDesktopApplicationProcess();
10
+ const exec = useDesktopApplicationExec();
11
+ const define = useDesktopApplicationDefine();
12
+ const registry = useDesktopApplicationRegistry();
13
+ const windowService = useDesktopWindow();
14
+ return {
15
+ defineApp: define.defineApp,
16
+ isAppDefined: (id) => apps.has(id),
17
+ getAppById: (id) => apps.get(id),
18
+ isAppRunning: process.isRunning,
19
+ launchAppEntry: process.launch,
20
+ execAppCommand: exec.exec,
21
+ closeApp: process.close,
22
+ getWindowOpenedId: windowService.get,
23
+ apps,
24
+ appsEntries: registry.list,
25
+ appsRunning: process.running,
26
+ windowsOpened: windowService.index,
27
+ appCategories: computed(() => Object.keys(registry.categories.value)),
28
+ appsByCategory: registry.categories
29
+ };
30
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Blocks the browser context menu on non-input elements (typical desktop shell behaviour).
3
+ * Debug builds skip blocking so DevTools stay usable when {@link isDebugMode} is true.
4
+ */
5
+ export declare function useBlockNonInputContextMenu(): void;
@@ -0,0 +1,19 @@
1
+ import { useEventListener } from "@vueuse/core";
2
+ import { isDebugMode } from "../utils/utilDebug.js";
3
+ export function useBlockNonInputContextMenu() {
4
+ useEventListener(
5
+ document,
6
+ "contextmenu",
7
+ (event) => {
8
+ if (isDebugMode()) return;
9
+ const target = event.target;
10
+ if (!target) return;
11
+ const tag = target.tagName?.toLowerCase();
12
+ const isInput = tag === "input" || tag === "textarea" || Boolean(target.isContentEditable);
13
+ if (!isInput) {
14
+ event.preventDefault();
15
+ }
16
+ },
17
+ { passive: false }
18
+ );
19
+ }