@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,438 @@
1
+ <script setup>
2
+ import { ref, provide, onMounted, computed, watch } from "vue";
3
+ import { useAppConfig } from "#imports";
4
+ import { useDraggable, useEventListener } from "@vueuse/core";
5
+ import { handleWindowControllerProps } from "../../utils/utilWindowControllerAdapter";
6
+ import { useDesktopWorkspaceStore } from "../../stores/storeDesktopWorkspace";
7
+ import { useDesktopWorkspaceEdgeDrop } from "../../composables/workspace/useDesktopWorkspaceEdgeDrop";
8
+ import { useDesktopWindowSnapDrop } from "../../composables/window/useDesktopWindowSnapDrop";
9
+ import { useDesktopWindow } from "../../composables/window/useDesktopWindow";
10
+ const props = defineProps({
11
+ window: { type: null, required: false },
12
+ content: { type: null, required: false }
13
+ });
14
+ const desktopWorkspaceStore = useDesktopWorkspaceStore();
15
+ const { topMaximizedWindow } = useDesktopWindow();
16
+ const { beginWindowDrag, endWindowDrag } = useDesktopWorkspaceEdgeDrop();
17
+ const { beginWindowSnapDrag, endWindowSnapDrag } = useDesktopWindowSnapDrop();
18
+ const emit = defineEmits([
19
+ "resize:start",
20
+ "resize:move",
21
+ "resize:end",
22
+ "drag:start",
23
+ "drag:move",
24
+ "drag:end",
25
+ "close",
26
+ "open",
27
+ "blur",
28
+ "focus",
29
+ "minimize",
30
+ "restore",
31
+ "maximize",
32
+ "unmaximize",
33
+ "toggle-maximize"
34
+ ]);
35
+ const appConfig = useAppConfig();
36
+ const windowController = handleWindowControllerProps(
37
+ props.window
38
+ );
39
+ const isHovered = ref(false);
40
+ const isDragging = computed(() => !!windowController?.state?.dragging);
41
+ const isResizing = computed(() => !!windowController?.state?.resizing);
42
+ const isHibernated = computed(() => {
43
+ if (!windowController?.state) return false;
44
+ if (windowController.state.active === false) return true;
45
+ if (!desktopWorkspaceStore.overview) {
46
+ const winWorkspace = windowController.state.workspace;
47
+ if (winWorkspace && winWorkspace !== desktopWorkspaceStore.active) {
48
+ return true;
49
+ }
50
+ const topMax = topMaximizedWindow.value;
51
+ if (topMax && topMax.state.id !== windowController.state.id && (topMax.position?.z ?? 0) > (windowController.position?.z ?? 0)) {
52
+ return true;
53
+ }
54
+ }
55
+ return false;
56
+ });
57
+ const showResizeHandles = computed(
58
+ () => Boolean(
59
+ windowController?.isResizable && !desktopWorkspaceStore.overview && !windowController?.state?.maximized && !isHibernated.value && (windowController?.state?.focused || isHovered.value || isResizing.value)
60
+ )
61
+ );
62
+ provide("windowController", windowController);
63
+ provide("windowContent", props.content ?? {});
64
+ provide("windowHibernated", isHibernated);
65
+ const windowRef = ref(null);
66
+ const dragHandleRef = ref(null);
67
+ onMounted(() => {
68
+ if (windowController?.state?.focused) {
69
+ windowController.actions.bringToFront();
70
+ }
71
+ if (windowRef.value) {
72
+ dragHandleRef.value = windowRef.value.querySelector(".desktop-window-nav__draggable");
73
+ }
74
+ clampIntoWorkarea();
75
+ });
76
+ function clampIntoWorkarea() {
77
+ const area = desktopWorkspaceStore.workarea;
78
+ if (!area || area.width <= 0 || area.height <= 0) return;
79
+ const state = windowController?.state;
80
+ if (!state || state.maximized) return;
81
+ const size = state.size ?? {};
82
+ const rect = windowRef.value?.getBoundingClientRect();
83
+ const width2 = typeof size.width === "number" ? size.width : rect?.width;
84
+ const height2 = typeof size.height === "number" ? size.height : rect?.height;
85
+ if (!width2 || !height2 || !Number.isFinite(width2) || !Number.isFinite(height2)) return;
86
+ const nextWidth = Math.min(width2, area.width);
87
+ const nextHeight = Math.min(height2, area.height);
88
+ const pos = state.position ?? {};
89
+ const maxX = area.x + area.width - nextWidth;
90
+ const maxY = area.y + area.height - nextHeight;
91
+ const nextX = Math.min(Math.max(pos.x ?? area.x, area.x), maxX);
92
+ const nextY = Math.min(Math.max(pos.y ?? area.y, area.y), maxY);
93
+ if (nextWidth !== width2 || nextHeight !== height2) {
94
+ windowController.actions.setSize({ width: nextWidth, height: nextHeight });
95
+ }
96
+ if (nextX !== pos.x || nextY !== pos.y) {
97
+ windowController.actions.setPosition({ x: nextX, y: nextY });
98
+ }
99
+ }
100
+ watch(
101
+ () => [
102
+ desktopWorkspaceStore.workarea.x,
103
+ desktopWorkspaceStore.workarea.y,
104
+ desktopWorkspaceStore.workarea.width,
105
+ desktopWorkspaceStore.workarea.height
106
+ ],
107
+ () => clampIntoWorkarea(),
108
+ { immediate: true }
109
+ );
110
+ const { x, y } = useDraggable(windowRef, {
111
+ handle: dragHandleRef,
112
+ initialValue: {
113
+ x: windowController?.position?.x ?? 0,
114
+ y: windowController?.position?.y ?? 0
115
+ },
116
+ onStart(event) {
117
+ if (!windowController?.isDraggable || desktopWorkspaceStore.overview || windowController?.state?.maximized) {
118
+ return false;
119
+ }
120
+ onWindowPointerDown();
121
+ windowController?.startDrag();
122
+ beginWindowDrag(windowController.state.id);
123
+ beginWindowSnapDrag(
124
+ windowController.state.id,
125
+ desktopWorkspaceStore.workarea,
126
+ windowController.isMaximizable
127
+ );
128
+ emit("drag:start", event);
129
+ },
130
+ onMove(position, event) {
131
+ emit("drag:move", { left: position.x, top: position.y });
132
+ },
133
+ onEnd(position, event) {
134
+ windowController?.stopDrag();
135
+ if (!desktopWorkspaceStore.overview) {
136
+ const snapped = endWindowSnapDrag(windowController);
137
+ if (!snapped) {
138
+ const moved = endWindowDrag(windowController);
139
+ if (!moved) {
140
+ windowController?.actions?.setPosition({
141
+ x: position.x,
142
+ y: position.y
143
+ });
144
+ if (windowController.state.layout && windowController.state.layout !== "normal") {
145
+ windowController.actions.clearLayout();
146
+ }
147
+ }
148
+ }
149
+ } else {
150
+ windowController?.actions?.setPosition({
151
+ x: position.x,
152
+ y: position.y
153
+ });
154
+ }
155
+ emit("drag:end", { left: position.x, top: position.y });
156
+ }
157
+ });
158
+ watch(
159
+ () => [
160
+ windowController?.state?.position?.x ?? windowController?.position?.x,
161
+ windowController?.state?.position?.y ?? windowController?.position?.y
162
+ ],
163
+ ([posX, posY]) => {
164
+ x.value = posX ?? 0;
165
+ y.value = posY ?? 0;
166
+ }
167
+ );
168
+ const width = ref(windowController?.size?.width ?? 300);
169
+ const height = ref(windowController?.size?.height ?? 200);
170
+ watch(
171
+ () => [
172
+ windowController?.state?.size?.width ?? windowController?.size?.width,
173
+ windowController?.state?.size?.height ?? windowController?.size?.height
174
+ ],
175
+ ([w, h]) => {
176
+ width.value = w ?? 300;
177
+ height.value = h ?? 200;
178
+ },
179
+ { immediate: true }
180
+ );
181
+ function onWindowPointerDown() {
182
+ windowController?.actions?.setActive(true);
183
+ windowController?.actions?.bringToFront();
184
+ }
185
+ function startResize(e, direction) {
186
+ if (!windowController) return;
187
+ e.stopPropagation();
188
+ e.preventDefault();
189
+ onWindowPointerDown();
190
+ windowController.startResize();
191
+ emit("resize:start", e);
192
+ const startX = e.clientX;
193
+ const startY = e.clientY;
194
+ const startWidth = windowRef.value ? windowRef.value.offsetWidth : windowController.size.width ?? 300;
195
+ const startHeight = windowRef.value ? windowRef.value.offsetHeight : windowController.size.height ?? 200;
196
+ const startLeft = windowController.position?.x ?? 0;
197
+ const startTop = windowController.position?.y ?? 0;
198
+ const minWidth = windowController.size.minWidth ?? 150;
199
+ const minHeight = windowController.size.minHeight ?? 150;
200
+ const maxWidth = windowController.size.maxWidth ?? Infinity;
201
+ const maxHeight = windowController.size.maxHeight ?? Infinity;
202
+ let currentLeft = startLeft;
203
+ let currentTop = startTop;
204
+ let currentWidth = startWidth;
205
+ let currentHeight = startHeight;
206
+ const cleanupMove = useEventListener(window, "pointermove", (event) => {
207
+ const deltaX = event.clientX - startX;
208
+ const deltaY = event.clientY - startY;
209
+ let nextWidth = startWidth;
210
+ let nextHeight = startHeight;
211
+ let nextLeft = startLeft;
212
+ let nextTop = startTop;
213
+ if (direction.includes("e")) {
214
+ nextWidth = Math.max(minWidth, Math.min(maxWidth, startWidth + deltaX));
215
+ }
216
+ if (direction.includes("w")) {
217
+ const proposedWidth = startWidth - deltaX;
218
+ nextWidth = Math.max(minWidth, Math.min(maxWidth, proposedWidth));
219
+ if (proposedWidth >= minWidth && proposedWidth <= maxWidth) {
220
+ nextLeft = startLeft + deltaX;
221
+ }
222
+ }
223
+ if (direction.includes("s")) {
224
+ nextHeight = Math.max(minHeight, Math.min(maxHeight, startHeight + deltaY));
225
+ }
226
+ if (direction.includes("n")) {
227
+ const proposedHeight = startHeight - deltaY;
228
+ nextHeight = Math.max(minHeight, Math.min(maxHeight, proposedHeight));
229
+ if (proposedHeight >= minHeight && proposedHeight <= maxHeight) {
230
+ nextTop = startTop + deltaY;
231
+ }
232
+ }
233
+ currentLeft = nextLeft;
234
+ currentTop = nextTop;
235
+ currentWidth = nextWidth;
236
+ currentHeight = nextHeight;
237
+ x.value = nextLeft;
238
+ y.value = nextTop;
239
+ width.value = nextWidth;
240
+ height.value = nextHeight;
241
+ emit("resize:move", { left: nextLeft, top: nextTop, width: nextWidth, height: nextHeight });
242
+ });
243
+ const cleanupUp = useEventListener(window, "pointerup", (event) => {
244
+ cleanupMove();
245
+ cleanupUp();
246
+ windowController.actions.setPosition({
247
+ x: currentLeft,
248
+ y: currentTop
249
+ });
250
+ windowController.actions.setSize({
251
+ width: currentWidth,
252
+ height: currentHeight
253
+ });
254
+ windowController.stopResize();
255
+ emit("resize:end", { left: currentLeft, top: currentTop, width: currentWidth, height: currentHeight });
256
+ });
257
+ }
258
+ const classes = computed(() => {
259
+ const list = ["desktop-window", "resizable-component"];
260
+ if (windowController?.state.focused) {
261
+ list.push("desktop-window--focused");
262
+ }
263
+ if (isDragging.value) {
264
+ list.push("desktop-window--dragging");
265
+ }
266
+ if (isResizing.value) {
267
+ list.push("desktop-window--resizing");
268
+ }
269
+ if (isHibernated.value) {
270
+ list.push("desktop-window--hibernated");
271
+ }
272
+ return list;
273
+ });
274
+ function onOverviewNativeDragStart(e) {
275
+ if (!desktopWorkspaceStore.overview || !windowController) return;
276
+ e.stopPropagation();
277
+ e.dataTransfer?.setData("text/plain", windowController.state.id);
278
+ e.dataTransfer.effectAllowed = "move";
279
+ try {
280
+ const img = new Image();
281
+ img.src = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
282
+ e.dataTransfer?.setDragImage(img, 0, 0);
283
+ } catch {
284
+ }
285
+ }
286
+ const windowPositionMode = computed(
287
+ () => appConfig.desktop?.windows?.position ?? "fixed"
288
+ );
289
+ </script>
290
+
291
+ <template>
292
+ <div
293
+ ref="windowRef"
294
+ :class="classes"
295
+ :style="{
296
+ left: `${x}px`,
297
+ top: `${y}px`,
298
+ width: typeof width === 'number' ? `${width}px` : width,
299
+ height: typeof height === 'number' ? `${height}px` : height,
300
+ zIndex: windowController?.position?.z,
301
+ position: windowPositionMode
302
+ }"
303
+ :draggable="desktopWorkspaceStore.overview"
304
+ :aria-hidden="isHibernated ? 'true' : void 0"
305
+ @pointerenter="isHovered = true"
306
+ @pointerleave="isHovered = false"
307
+ @pointerdown="onWindowPointerDown"
308
+ @dragstart="onOverviewNativeDragStart"
309
+ >
310
+ <!-- 8-way Lazy Resize Handles (mounted only when focused, hovered, or resizing) -->
311
+ <div v-if="showResizeHandles" class="window-resize-handles">
312
+ <div class="resize-handle handle-t" @pointerdown.stop.prevent="startResize($event, 't')"></div>
313
+ <div class="resize-handle handle-b" @pointerdown.stop.prevent="startResize($event, 'b')"></div>
314
+ <div class="resize-handle handle-r" @pointerdown.stop.prevent="startResize($event, 'r')"></div>
315
+ <div class="resize-handle handle-l" @pointerdown.stop.prevent="startResize($event, 'l')"></div>
316
+ <div class="resize-handle handle-tl" @pointerdown.stop.prevent="startResize($event, 'tl')"></div>
317
+ <div class="resize-handle handle-tr" @pointerdown.stop.prevent="startResize($event, 'tr')"></div>
318
+ <div class="resize-handle handle-bl" @pointerdown.stop.prevent="startResize($event, 'bl')"></div>
319
+ <div class="resize-handle handle-br" @pointerdown.stop.prevent="startResize($event, 'br')"></div>
320
+ </div>
321
+
322
+ <slot />
323
+ </div>
324
+ </template>
325
+
326
+ <style scoped>
327
+ .desktop-window {
328
+ position: v-bind("windowPositionMode");
329
+ box-sizing: border-box;
330
+ /* Native CSS Containment: isolates layout, style, and paint calculations per window */
331
+ contain: layout paint style;
332
+ /* Relax paint containment on focused/hovered/resizing windows so -4px outer resize handles remain interactive */
333
+ }
334
+ .desktop-window--focused, .desktop-window--resizing, .desktop-window:hover {
335
+ contain: layout style;
336
+ }
337
+ .desktop-window--dragging, .desktop-window--resizing {
338
+ will-change: left, top, width, height;
339
+ }
340
+ .desktop-window--dragging :deep(.desktop-window__content), .desktop-window--resizing :deep(.desktop-window__content) {
341
+ pointer-events: none;
342
+ }
343
+ .desktop-window {
344
+ /* Window Hibernation / Occlusion Culling: skips layout & paint for minimized, off-workspace, or fully occluded windows */
345
+ }
346
+ .desktop-window--hibernated {
347
+ content-visibility: hidden;
348
+ pointer-events: none;
349
+ }
350
+ .desktop-window :deep(.desktop-window__content) {
351
+ overflow-y: auto;
352
+ height: 100%;
353
+ min-height: 0;
354
+ contain: layout paint style;
355
+ content-visibility: auto;
356
+ }
357
+
358
+ .window-resize-handles {
359
+ position: absolute;
360
+ top: 0;
361
+ left: 0;
362
+ right: 0;
363
+ bottom: 0;
364
+ pointer-events: none;
365
+ z-index: 9999;
366
+ }
367
+
368
+ .resize-handle {
369
+ position: absolute;
370
+ pointer-events: auto;
371
+ }
372
+
373
+ /* Borders */
374
+ .handle-t {
375
+ top: -4px;
376
+ left: 4px;
377
+ right: 4px;
378
+ height: 8px;
379
+ cursor: ns-resize;
380
+ }
381
+
382
+ .handle-b {
383
+ bottom: -4px;
384
+ left: 4px;
385
+ right: 4px;
386
+ height: 8px;
387
+ cursor: ns-resize;
388
+ }
389
+
390
+ .handle-r {
391
+ right: -4px;
392
+ top: 4px;
393
+ bottom: 4px;
394
+ width: 8px;
395
+ cursor: ew-resize;
396
+ }
397
+
398
+ .handle-l {
399
+ left: -4px;
400
+ top: 4px;
401
+ bottom: 4px;
402
+ width: 8px;
403
+ cursor: ew-resize;
404
+ }
405
+
406
+ /* Angles */
407
+ .handle-tl {
408
+ top: -4px;
409
+ left: -4px;
410
+ width: 8px;
411
+ height: 8px;
412
+ cursor: nwse-resize;
413
+ }
414
+
415
+ .handle-tr {
416
+ top: -4px;
417
+ right: -4px;
418
+ width: 8px;
419
+ height: 8px;
420
+ cursor: nesw-resize;
421
+ }
422
+
423
+ .handle-bl {
424
+ bottom: -4px;
425
+ left: -4px;
426
+ width: 8px;
427
+ height: 8px;
428
+ cursor: nesw-resize;
429
+ }
430
+
431
+ .handle-br {
432
+ bottom: -4px;
433
+ right: -4px;
434
+ width: 8px;
435
+ height: 8px;
436
+ cursor: nwse-resize;
437
+ }
438
+ </style>
@@ -0,0 +1,49 @@
1
+ type __VLS_Props = {
2
+ window?: IWindowController;
3
+ content?: WindowContent;
4
+ };
5
+ declare var __VLS_1: {};
6
+ type __VLS_Slots = {} & {
7
+ default?: (props: typeof __VLS_1) => any;
8
+ };
9
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ maximize: (...args: any[]) => void;
11
+ focus: (...args: any[]) => void;
12
+ minimize: (...args: any[]) => void;
13
+ unmaximize: (...args: any[]) => void;
14
+ open: (...args: any[]) => void;
15
+ blur: (...args: any[]) => void;
16
+ close: (...args: any[]) => void;
17
+ "resize:start": (...args: any[]) => void;
18
+ "resize:move": (...args: any[]) => void;
19
+ "resize:end": (...args: any[]) => void;
20
+ "drag:start": (...args: any[]) => void;
21
+ "drag:move": (...args: any[]) => void;
22
+ "drag:end": (...args: any[]) => void;
23
+ restore: (...args: any[]) => void;
24
+ "toggle-maximize": (...args: any[]) => void;
25
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
26
+ onMaximize?: ((...args: any[]) => any) | undefined;
27
+ onFocus?: ((...args: any[]) => any) | undefined;
28
+ onMinimize?: ((...args: any[]) => any) | undefined;
29
+ onUnmaximize?: ((...args: any[]) => any) | undefined;
30
+ onOpen?: ((...args: any[]) => any) | undefined;
31
+ onBlur?: ((...args: any[]) => any) | undefined;
32
+ onClose?: ((...args: any[]) => any) | undefined;
33
+ "onResize:start"?: ((...args: any[]) => any) | undefined;
34
+ "onResize:move"?: ((...args: any[]) => any) | undefined;
35
+ "onResize:end"?: ((...args: any[]) => any) | undefined;
36
+ "onDrag:start"?: ((...args: any[]) => any) | undefined;
37
+ "onDrag:move"?: ((...args: any[]) => any) | undefined;
38
+ "onDrag:end"?: ((...args: any[]) => any) | undefined;
39
+ onRestore?: ((...args: any[]) => any) | undefined;
40
+ "onToggle-maximize"?: ((...args: any[]) => any) | undefined;
41
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
43
+ declare const _default: typeof __VLS_export;
44
+ export default _default;
45
+ type __VLS_WithSlots<T, S> = T & {
46
+ new (): {
47
+ $slots: S;
48
+ };
49
+ };
@@ -0,0 +1,13 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ type __VLS_WithSlots<T, S> = T & {
10
+ new (): {
11
+ $slots: S;
12
+ };
13
+ };
@@ -0,0 +1,34 @@
1
+ <script setup>
2
+ import { inject, computed } from "vue";
3
+ const windowContent = inject("windowContent");
4
+ const windowHibernated = inject("windowHibernated", void 0);
5
+ const classes = computed(() => {
6
+ const list = ["desktop-window__content"];
7
+ if (windowContent?.centered) {
8
+ list.push("desktop-window__content--centered");
9
+ }
10
+ if (windowContent?.padded) {
11
+ list.push("desktop-window__content--padded");
12
+ }
13
+ if (windowHibernated?.value) {
14
+ list.push("desktop-window__content--hibernated");
15
+ }
16
+ return list;
17
+ });
18
+ </script>
19
+
20
+ <template>
21
+ <div :class="classes">
22
+ <slot />
23
+ </div>
24
+ </template>
25
+
26
+ <style scoped>
27
+ .desktop-window__content {
28
+ contain: layout paint style;
29
+ content-visibility: auto;
30
+ }
31
+ .desktop-window__content--hibernated {
32
+ content-visibility: hidden;
33
+ }
34
+ </style>
@@ -0,0 +1,13 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ type __VLS_WithSlots<T, S> = T & {
10
+ new (): {
11
+ $slots: S;
12
+ };
13
+ };
@@ -0,0 +1,13 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ type __VLS_WithSlots<T, S> = T & {
10
+ new (): {
11
+ $slots: S;
12
+ };
13
+ };
@@ -0,0 +1,54 @@
1
+ <script setup>
2
+ import { inject } from "vue";
3
+ import { computed } from "@vue/reactivity";
4
+ const windowController = inject("windowController");
5
+ const classes = computed(() => {
6
+ const list = ["desktop-window-nav"];
7
+ if (typeof windowController?.state.active === "undefined" || !!windowController?.state.active) {
8
+ list.push("desktop-window-nav--active");
9
+ }
10
+ if (windowController?.state.focused) {
11
+ list.push("desktop-window-nav--focused");
12
+ }
13
+ return list;
14
+ });
15
+ </script>
16
+
17
+ <template>
18
+ <div :class="classes">
19
+ <div class="desktop-window-nav__draggable" />
20
+
21
+ <slot />
22
+ </div>
23
+ </template>
24
+
25
+ <style>
26
+ /**
27
+ * Title/icon sit above the drag layer in DOM order; use pointer-events so
28
+ * mousedown reaches `.desktop-window-nav__draggable` for vue-resizable. Window
29
+ * controls stay clickable.
30
+ */
31
+ .desktop-window-nav {
32
+ position: relative;
33
+ display: flex;
34
+ align-items: stretch;
35
+ width: 100%;
36
+ min-height: 0;
37
+ }
38
+ .desktop-window-nav__draggable {
39
+ position: absolute;
40
+ inset: 0;
41
+ z-index: 1;
42
+ }
43
+ .desktop-window-nav > :not(.desktop-window-nav__draggable) {
44
+ position: relative;
45
+ z-index: 2;
46
+ pointer-events: none;
47
+ }
48
+ .desktop-window-nav > .desktop-window-nav__btn-group {
49
+ pointer-events: auto;
50
+ }
51
+ .desktop-window-nav > .desktop-window-nav__interactive {
52
+ pointer-events: auto;
53
+ }
54
+ </style>
@@ -0,0 +1,13 @@
1
+ declare var __VLS_1: {};
2
+ type __VLS_Slots = {} & {
3
+ default?: (props: typeof __VLS_1) => any;
4
+ };
5
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
7
+ declare const _default: typeof __VLS_export;
8
+ export default _default;
9
+ type __VLS_WithSlots<T, S> = T & {
10
+ new (): {
11
+ $slots: S;
12
+ };
13
+ };
@@ -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
+ };