@witchcraft/layout 0.3.1 → 0.4.1

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/README.md +62 -70
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +6 -1
  4. package/dist/runtime/components/FrameDragHandle.vue +1 -1
  5. package/dist/runtime/components/LayoutDecosEdges.d.vue.ts +15 -0
  6. package/dist/runtime/components/LayoutDecosEdges.vue +34 -0
  7. package/dist/runtime/components/LayoutDecosEdges.vue.d.ts +15 -0
  8. package/dist/runtime/components/LayoutDecosRects.d.vue.ts +15 -0
  9. package/dist/runtime/components/LayoutDecosRects.vue +37 -0
  10. package/dist/runtime/components/LayoutDecosRects.vue.d.ts +15 -0
  11. package/dist/runtime/components/LayoutDragEdgeGrabbed.d.vue.ts +2 -0
  12. package/dist/runtime/components/LayoutDragEdgeGrabbed.vue +43 -0
  13. package/dist/runtime/components/LayoutDragEdgeGrabbed.vue.d.ts +2 -0
  14. package/dist/runtime/components/LayoutDragEdgeHandle.d.vue.ts +9 -0
  15. package/dist/runtime/components/LayoutDragEdgeHandle.vue +44 -0
  16. package/dist/runtime/components/LayoutDragEdgeHandle.vue.d.ts +9 -0
  17. package/dist/runtime/components/{LayoutDecos.d.vue.ts → LayoutDragEdgeVisible.d.vue.ts} +3 -2
  18. package/dist/runtime/components/LayoutDragEdgeVisible.vue +38 -0
  19. package/dist/runtime/components/{LayoutDecos.vue.d.ts → LayoutDragEdgeVisible.vue.d.ts} +3 -2
  20. package/dist/runtime/components/LayoutDragEdges.d.vue.ts +21 -0
  21. package/dist/runtime/components/LayoutDragEdges.vue +67 -0
  22. package/dist/runtime/components/LayoutDragEdges.vue.d.ts +21 -0
  23. package/dist/runtime/components/LayoutEdgesActiveFrame.d.vue.ts +2 -0
  24. package/dist/runtime/components/LayoutEdgesActiveFrame.vue +35 -0
  25. package/dist/runtime/components/LayoutEdgesActiveFrame.vue.d.ts +2 -0
  26. package/dist/runtime/components/LayoutFrame.d.vue.ts +7 -6
  27. package/dist/runtime/components/LayoutFrame.vue +18 -14
  28. package/dist/runtime/components/LayoutFrame.vue.d.ts +7 -6
  29. package/dist/runtime/components/LayoutIntersectionHandle.d.vue.ts +10 -0
  30. package/dist/runtime/components/LayoutIntersectionHandle.vue +36 -0
  31. package/dist/runtime/components/LayoutIntersectionHandle.vue.d.ts +10 -0
  32. package/dist/runtime/components/LayoutIntersectionVisible.d.vue.ts +6 -0
  33. package/dist/runtime/components/LayoutIntersectionVisible.vue +34 -0
  34. package/dist/runtime/components/LayoutIntersectionVisible.vue.d.ts +6 -0
  35. package/dist/runtime/components/LayoutIntersections.d.vue.ts +21 -0
  36. package/dist/runtime/components/LayoutIntersections.vue +52 -0
  37. package/dist/runtime/components/LayoutIntersections.vue.d.ts +21 -0
  38. package/dist/runtime/components/{LayoutShapeSquare.d.vue.ts → LayoutShapeRect.d.vue.ts} +2 -2
  39. package/dist/runtime/components/{LayoutShapeSquare.vue.d.ts → LayoutShapeRect.vue.d.ts} +2 -2
  40. package/dist/runtime/components/LayoutWindow.d.vue.ts +252 -14
  41. package/dist/runtime/components/LayoutWindow.vue +27 -48
  42. package/dist/runtime/components/LayoutWindow.vue.d.ts +252 -14
  43. package/dist/runtime/composables/useFrames.d.ts +859 -2
  44. package/dist/runtime/composables/useFrames.js +2 -0
  45. package/dist/runtime/demo/App.vue +122 -74
  46. package/dist/runtime/demo/DemoControls.vue +7 -5
  47. package/dist/runtime/demo/index.html +12 -0
  48. package/dist/runtime/demo/tailwind.css +1 -1
  49. package/dist/runtime/drag/CloseAction.d.ts +1 -2
  50. package/dist/runtime/drag/CloseAction.js +1 -1
  51. package/dist/runtime/drag/DragActionHandler.d.ts +5 -3
  52. package/dist/runtime/drag/DragActionHandler.js +40 -6
  53. package/dist/runtime/drag/FrameDragAction.js +6 -7
  54. package/dist/runtime/drag/SplitAction.d.ts +1 -2
  55. package/dist/runtime/drag/SplitAction.js +1 -1
  56. package/dist/runtime/drag/createDefaultHandlers.d.ts +1 -1
  57. package/dist/runtime/drag/defaultDragActions.d.ts +1 -1
  58. package/dist/runtime/helpers/consoleDebugWindow.d.ts +43 -0
  59. package/dist/runtime/helpers/consoleDebugWindow.js +222 -0
  60. package/dist/runtime/helpers/convertLayoutWindowToWorkspace.js +2 -2
  61. package/dist/runtime/helpers/framesRedistributeFix.d.ts +87 -0
  62. package/dist/runtime/helpers/framesRedistributeFix.js +54 -0
  63. package/dist/runtime/helpers/getMoveEdgeInfo.d.ts +6 -2
  64. package/dist/runtime/helpers/getMoveEdgeInfo.js +11 -2
  65. package/dist/runtime/helpers/getPinnedEdgesForCollapsedFrames.d.ts +5 -0
  66. package/dist/runtime/helpers/getPinnedEdgesForCollapsedFrames.js +18 -0
  67. package/dist/runtime/helpers/getShapeRectCss.d.ts +7 -0
  68. package/dist/runtime/helpers/{getShapeSquareCss.js → getShapeRectCss.js} +1 -1
  69. package/dist/runtime/helpers/index.d.ts +3 -3
  70. package/dist/runtime/helpers/index.js +3 -3
  71. package/dist/runtime/helpers/moveEdge.js +3 -1
  72. package/dist/runtime/helpers/pxSizeToScaledSize.d.ts +2 -0
  73. package/dist/runtime/helpers/{numberToScaledSize.js → pxSizeToScaledSize.js} +1 -1
  74. package/dist/runtime/helpers/updateWindowSizeWithEvent.d.ts +3 -0
  75. package/dist/runtime/helpers/validateLayoutShape.d.ts +5 -0
  76. package/dist/runtime/helpers/validateLayoutShape.js +28 -0
  77. package/dist/runtime/layout/applyFrameChanges.js +6 -0
  78. package/dist/runtime/layout/createSplitDecoShapes.js +1 -1
  79. package/dist/runtime/layout/getFrameCollapseInfo.d.ts +5 -2
  80. package/dist/runtime/layout/getFrameCollapseInfo.js +16 -46
  81. package/dist/runtime/layout/getFrameDockInfo.d.ts +1 -1
  82. package/dist/runtime/layout/getFrameDockInfo.js +5 -1
  83. package/dist/runtime/layout/getFrameUncollapseInfo.d.ts +5 -2
  84. package/dist/runtime/layout/getFrameUncollapseInfo.js +16 -50
  85. package/dist/runtime/layout/getFrameUndockInfo.js +4 -1
  86. package/dist/runtime/layout/getFramesRedistributeInfo.d.ts +20 -4
  87. package/dist/runtime/layout/getFramesRedistributeInfo.js +31 -2
  88. package/dist/runtime/layout/getRelaxFramesInfo.d.ts +7 -0
  89. package/dist/runtime/layout/getRelaxFramesInfo.js +91 -0
  90. package/dist/runtime/layout/getUpdateWindowSizeInfo.d.ts +13 -0
  91. package/dist/runtime/layout/getUpdateWindowSizeInfo.js +65 -0
  92. package/dist/runtime/layout/index.d.ts +1 -0
  93. package/dist/runtime/layout/index.js +1 -0
  94. package/dist/runtime/layout/resizeFrame.js +1 -3
  95. package/dist/runtime/settings.d.ts +26 -19
  96. package/dist/runtime/settings.js +57 -22
  97. package/dist/runtime/types/index.d.ts +1243 -30
  98. package/dist/runtime/types/index.js +22 -8
  99. package/dist/runtime/types/vue.d.ts +41 -0
  100. package/dist/runtime/{drag/types.js → types/vue.js} +1 -0
  101. package/dist/runtime/utils/cssToKey.d.ts +5 -0
  102. package/dist/runtime/utils/cssToKey.js +3 -0
  103. package/package.json +11 -12
  104. package/src/module.ts +6 -1
  105. package/src/runtime/components/FrameDragHandle.vue +1 -1
  106. package/src/runtime/components/LayoutDecosEdges.vue +38 -0
  107. package/src/runtime/components/LayoutDecosRects.vue +42 -0
  108. package/src/runtime/components/LayoutDragEdgeGrabbed.vue +50 -0
  109. package/src/runtime/components/LayoutDragEdgeHandle.vue +52 -0
  110. package/src/runtime/components/LayoutDragEdgeVisible.vue +45 -0
  111. package/src/runtime/components/LayoutDragEdges.vue +78 -0
  112. package/src/runtime/components/LayoutEdgesActiveFrame.vue +43 -0
  113. package/src/runtime/components/LayoutFrame.vue +22 -15
  114. package/src/runtime/components/LayoutIntersectionHandle.vue +45 -0
  115. package/src/runtime/components/LayoutIntersectionVisible.vue +41 -0
  116. package/src/runtime/components/LayoutIntersections.vue +64 -0
  117. package/src/runtime/components/{LayoutShapeSquare.vue → LayoutShapeRect.vue} +2 -2
  118. package/src/runtime/components/LayoutWindow.vue +29 -49
  119. package/src/runtime/composables/useFrames.ts +7 -2
  120. package/src/runtime/demo/App.vue +128 -78
  121. package/src/runtime/demo/DemoControls.vue +7 -5
  122. package/src/runtime/demo/index.html +12 -0
  123. package/src/runtime/demo/tailwind.css +3 -0
  124. package/src/runtime/drag/CloseAction.ts +2 -3
  125. package/src/runtime/drag/DragActionHandler.ts +48 -10
  126. package/src/runtime/drag/FrameDragAction.ts +4 -5
  127. package/src/runtime/drag/SplitAction.ts +4 -3
  128. package/src/runtime/drag/createDefaultHandlers.ts +2 -1
  129. package/src/runtime/drag/defaultDragActions.ts +2 -1
  130. package/src/runtime/helpers/consoleDebugWindow.ts +331 -0
  131. package/src/runtime/helpers/convertLayoutWindowToWorkspace.ts +2 -2
  132. package/src/runtime/helpers/framesRedistributeFix.ts +162 -0
  133. package/src/runtime/helpers/getMoveEdgeInfo.ts +22 -5
  134. package/src/runtime/helpers/getPinnedEdgesForCollapsedFrames.ts +29 -0
  135. package/src/runtime/helpers/{getShapeSquareCss.ts → getShapeRectCss.ts} +3 -3
  136. package/src/runtime/helpers/index.ts +4 -3
  137. package/src/runtime/helpers/moveEdge.ts +3 -1
  138. package/src/runtime/helpers/{numberToScaledSize.ts → pxSizeToScaledSize.ts} +2 -2
  139. package/src/runtime/helpers/updateWindowSizeWithEvent.ts +3 -0
  140. package/src/runtime/helpers/validateLayoutShape.ts +46 -0
  141. package/src/runtime/layout/applyFrameChanges.ts +5 -0
  142. package/src/runtime/layout/createSplitDecoShapes.ts +1 -1
  143. package/src/runtime/layout/getFrameCollapseInfo.ts +26 -85
  144. package/src/runtime/layout/getFrameDockInfo.ts +8 -1
  145. package/src/runtime/layout/getFrameUncollapseInfo.ts +29 -96
  146. package/src/runtime/layout/getFrameUndockInfo.ts +7 -1
  147. package/src/runtime/layout/getFramesRedistributeInfo.ts +60 -5
  148. package/src/runtime/layout/getRelaxFramesInfo.ts +139 -0
  149. package/src/runtime/layout/getUpdateWindowSizeInfo.ts +105 -0
  150. package/src/runtime/layout/index.ts +1 -0
  151. package/src/runtime/layout/resizeFrame.ts +4 -3
  152. package/src/runtime/settings.ts +78 -25
  153. package/src/runtime/types/index.ts +205 -33
  154. package/src/runtime/types/vue.ts +41 -0
  155. package/src/runtime/utils/cssToKey.ts +8 -0
  156. package/dist/runtime/components/LayoutDecos.vue +0 -26
  157. package/dist/runtime/components/LayoutEdges.d.vue.ts +0 -17
  158. package/dist/runtime/components/LayoutEdges.vue +0 -144
  159. package/dist/runtime/components/LayoutEdges.vue.d.ts +0 -17
  160. package/dist/runtime/drag/types.d.ts +0 -161
  161. package/dist/runtime/helpers/clampNumber.d.ts +0 -1
  162. package/dist/runtime/helpers/clampNumber.js +0 -3
  163. package/dist/runtime/helpers/getShapeSquareCss.d.ts +0 -7
  164. package/dist/runtime/helpers/numberToScaledSize.d.ts +0 -2
  165. package/src/runtime/components/LayoutDecos.vue +0 -28
  166. package/src/runtime/components/LayoutEdges.vue +0 -170
  167. package/src/runtime/drag/types.ts +0 -177
  168. package/src/runtime/helpers/clampNumber.ts +0 -9
  169. /package/dist/runtime/components/{LayoutShapeSquare.vue → LayoutShapeRect.vue} +0 -0
@@ -1,6 +1,7 @@
1
1
  import { DragActionHandler } from "../drag/DragActionHandler";
2
- import { type DragState, type IDragAction } from "../drag/types.js";
3
- import type { LayoutEdgesProps, LayoutFrameProps, LayoutWindow } from "../types/index.js";
2
+ import { type DragState, type IDragAction } from "../types/index.js";
3
+ import { getUpdateWindowSizeInfo } from "../layout/getUpdateWindowSizeInfo.js";
4
+ import { type LayoutWindow } from "../types/index.js";
4
5
  type __VLS_Props = {
5
6
  /** Custom drag action handlers. Falls back to default split/close/frame handlers if not provided. */
6
7
  actionHandlers?: IDragAction[];
@@ -18,24 +19,17 @@ type __VLS_Props = {
18
19
  * When this is turned back on again, it will trigger an update. You can also trigger updates manually with the exposed updateWindowSize function.
19
20
  */
20
21
  allowWindowSizeUpdate?: boolean;
21
- frameProps?: Partial<Omit<LayoutFrameProps, "frame" | "isActiveFrame" | "onFocus">>;
22
- edgesProps?: Partial<Omit<LayoutEdgesProps, "edges" | "intersections" | "win">>;
23
22
  };
24
- declare function updateWindowSize(): void;
25
23
  type __VLS_PublicProps = __VLS_Props & {
26
24
  "win": LayoutWindow;
27
25
  };
28
- declare var __VLS_9: any, __VLS_10: {
29
- frame: any;
30
- }, __VLS_22: {}, __VLS_29: any, __VLS_30: {
26
+ declare var __VLS_1: {}, __VLS_8: any, __VLS_9: {
31
27
  id: any;
32
28
  };
33
29
  type __VLS_Slots = {} & {
34
- [K in NonNullable<typeof __VLS_9>]?: (props: typeof __VLS_10) => any;
30
+ [K in NonNullable<typeof __VLS_8>]?: (props: typeof __VLS_9) => any;
35
31
  } & {
36
- [K in NonNullable<typeof __VLS_29>]?: (props: typeof __VLS_30) => any;
37
- } & {
38
- 'extra-decos'?: (props: typeof __VLS_22) => any;
32
+ default?: (props: typeof __VLS_1) => any;
39
33
  };
40
34
  declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {
41
35
  state: import("vue").ComputedRef<{
@@ -55,6 +49,67 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
55
49
  startY: number;
56
50
  endX: number;
57
51
  endY: number;
52
+ error?: import("../utils/KnownError.js").KnownError<import("../types/index.js").LayoutError, {} | {
53
+ id: string | undefined;
54
+ } | {
55
+ id: string | undefined;
56
+ } | {
57
+ size: import("../types/index.js").Size;
58
+ } | Record<string, never> | {
59
+ frame: import("../types/index.js").LayoutFrame;
60
+ } | {
61
+ frame: import("../types/index.js").LayoutFrame;
62
+ nearbyFrames: import("../types/index.js").LayoutFrame[];
63
+ minSize: import("../types/index.js").Size;
64
+ } | {
65
+ frame: import("../types/index.js").LayoutFrame;
66
+ } | {
67
+ frame: import("../types/index.js").LayoutFrame;
68
+ newSize: number;
69
+ minSize: number;
70
+ } | {
71
+ frame: import("../types/index.js").LayoutFrame;
72
+ framesRequiredToBeDeleted: import("../types/index.js").LayoutFrame[];
73
+ } | {
74
+ frame: import("../types/index.js").LayoutFrame;
75
+ } | {
76
+ draggingFrameId: string;
77
+ hoveredFrameId: string;
78
+ zoneSide: import("../types/index.js").DragZone["side"];
79
+ } | {
80
+ draggingFrameId: string;
81
+ hoveredFrameId: string;
82
+ zoneSide: import("../types/index.js").DragZone["side"];
83
+ } | {
84
+ draggingFrameId: string;
85
+ hoveredFrameId: string;
86
+ zoneSide: import("../types/index.js").DragZone["side"];
87
+ } | {
88
+ frame: import("../types/index.js").LayoutFrame;
89
+ } | {
90
+ minFrameSize: number;
91
+ frameSizeNeeded: number;
92
+ } | {
93
+ min: number;
94
+ max: number;
95
+ wanted: number;
96
+ } | {
97
+ problemEdgeCoordinates: number[];
98
+ } | {
99
+ side: import("../types/index.js").EdgeSide;
100
+ id: string;
101
+ } | {
102
+ frame: string;
103
+ } | {
104
+ frame: import("../types/index.js").LayoutFrame;
105
+ } | {
106
+ frame: import("../types/index.js").LayoutFrame;
107
+ } | {
108
+ frame: import("../types/index.js").LayoutFrame;
109
+ }> | {
110
+ code: string;
111
+ message: string;
112
+ } | undefined;
58
113
  }[];
59
114
  draggingIntersection: {
60
115
  point: {
@@ -69,12 +124,134 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
69
124
  startY: number;
70
125
  endX: number;
71
126
  endY: number;
127
+ error?: import("../utils/KnownError.js").KnownError<import("../types/index.js").LayoutError, {} | {
128
+ id: string | undefined;
129
+ } | {
130
+ id: string | undefined;
131
+ } | {
132
+ size: import("../types/index.js").Size;
133
+ } | Record<string, never> | {
134
+ frame: import("../types/index.js").LayoutFrame;
135
+ } | {
136
+ frame: import("../types/index.js").LayoutFrame;
137
+ nearbyFrames: import("../types/index.js").LayoutFrame[];
138
+ minSize: import("../types/index.js").Size;
139
+ } | {
140
+ frame: import("../types/index.js").LayoutFrame;
141
+ } | {
142
+ frame: import("../types/index.js").LayoutFrame;
143
+ newSize: number;
144
+ minSize: number;
145
+ } | {
146
+ frame: import("../types/index.js").LayoutFrame;
147
+ framesRequiredToBeDeleted: import("../types/index.js").LayoutFrame[];
148
+ } | {
149
+ frame: import("../types/index.js").LayoutFrame;
150
+ } | {
151
+ draggingFrameId: string;
152
+ hoveredFrameId: string;
153
+ zoneSide: import("../types/index.js").DragZone["side"];
154
+ } | {
155
+ draggingFrameId: string;
156
+ hoveredFrameId: string;
157
+ zoneSide: import("../types/index.js").DragZone["side"];
158
+ } | {
159
+ draggingFrameId: string;
160
+ hoveredFrameId: string;
161
+ zoneSide: import("../types/index.js").DragZone["side"];
162
+ } | {
163
+ frame: import("../types/index.js").LayoutFrame;
164
+ } | {
165
+ minFrameSize: number;
166
+ frameSizeNeeded: number;
167
+ } | {
168
+ min: number;
169
+ max: number;
170
+ wanted: number;
171
+ } | {
172
+ problemEdgeCoordinates: number[];
173
+ } | {
174
+ side: import("../types/index.js").EdgeSide;
175
+ id: string;
176
+ } | {
177
+ frame: string;
178
+ } | {
179
+ frame: import("../types/index.js").LayoutFrame;
180
+ } | {
181
+ frame: import("../types/index.js").LayoutFrame;
182
+ } | {
183
+ frame: import("../types/index.js").LayoutFrame;
184
+ }> | {
185
+ code: string;
186
+ message: string;
187
+ } | undefined;
72
188
  }[];
73
189
  vertical: {
74
190
  startX: number;
75
191
  startY: number;
76
192
  endX: number;
77
193
  endY: number;
194
+ error?: import("../utils/KnownError.js").KnownError<import("../types/index.js").LayoutError, {} | {
195
+ id: string | undefined;
196
+ } | {
197
+ id: string | undefined;
198
+ } | {
199
+ size: import("../types/index.js").Size;
200
+ } | Record<string, never> | {
201
+ frame: import("../types/index.js").LayoutFrame;
202
+ } | {
203
+ frame: import("../types/index.js").LayoutFrame;
204
+ nearbyFrames: import("../types/index.js").LayoutFrame[];
205
+ minSize: import("../types/index.js").Size;
206
+ } | {
207
+ frame: import("../types/index.js").LayoutFrame;
208
+ } | {
209
+ frame: import("../types/index.js").LayoutFrame;
210
+ newSize: number;
211
+ minSize: number;
212
+ } | {
213
+ frame: import("../types/index.js").LayoutFrame;
214
+ framesRequiredToBeDeleted: import("../types/index.js").LayoutFrame[];
215
+ } | {
216
+ frame: import("../types/index.js").LayoutFrame;
217
+ } | {
218
+ draggingFrameId: string;
219
+ hoveredFrameId: string;
220
+ zoneSide: import("../types/index.js").DragZone["side"];
221
+ } | {
222
+ draggingFrameId: string;
223
+ hoveredFrameId: string;
224
+ zoneSide: import("../types/index.js").DragZone["side"];
225
+ } | {
226
+ draggingFrameId: string;
227
+ hoveredFrameId: string;
228
+ zoneSide: import("../types/index.js").DragZone["side"];
229
+ } | {
230
+ frame: import("../types/index.js").LayoutFrame;
231
+ } | {
232
+ minFrameSize: number;
233
+ frameSizeNeeded: number;
234
+ } | {
235
+ min: number;
236
+ max: number;
237
+ wanted: number;
238
+ } | {
239
+ problemEdgeCoordinates: number[];
240
+ } | {
241
+ side: import("../types/index.js").EdgeSide;
242
+ id: string;
243
+ } | {
244
+ frame: string;
245
+ } | {
246
+ frame: import("../types/index.js").LayoutFrame;
247
+ } | {
248
+ frame: import("../types/index.js").LayoutFrame;
249
+ } | {
250
+ frame: import("../types/index.js").LayoutFrame;
251
+ }> | {
252
+ code: string;
253
+ message: string;
254
+ } | undefined;
78
255
  }[];
79
256
  };
80
257
  isWindowEdge: boolean;
@@ -84,6 +261,67 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
84
261
  startY: number;
85
262
  endX: number;
86
263
  endY: number;
264
+ error?: import("../utils/KnownError.js").KnownError<import("../types/index.js").LayoutError, {} | {
265
+ id: string | undefined;
266
+ } | {
267
+ id: string | undefined;
268
+ } | {
269
+ size: import("../types/index.js").Size;
270
+ } | Record<string, never> | {
271
+ frame: import("../types/index.js").LayoutFrame;
272
+ } | {
273
+ frame: import("../types/index.js").LayoutFrame;
274
+ nearbyFrames: import("../types/index.js").LayoutFrame[];
275
+ minSize: import("../types/index.js").Size;
276
+ } | {
277
+ frame: import("../types/index.js").LayoutFrame;
278
+ } | {
279
+ frame: import("../types/index.js").LayoutFrame;
280
+ newSize: number;
281
+ minSize: number;
282
+ } | {
283
+ frame: import("../types/index.js").LayoutFrame;
284
+ framesRequiredToBeDeleted: import("../types/index.js").LayoutFrame[];
285
+ } | {
286
+ frame: import("../types/index.js").LayoutFrame;
287
+ } | {
288
+ draggingFrameId: string;
289
+ hoveredFrameId: string;
290
+ zoneSide: import("../types/index.js").DragZone["side"];
291
+ } | {
292
+ draggingFrameId: string;
293
+ hoveredFrameId: string;
294
+ zoneSide: import("../types/index.js").DragZone["side"];
295
+ } | {
296
+ draggingFrameId: string;
297
+ hoveredFrameId: string;
298
+ zoneSide: import("../types/index.js").DragZone["side"];
299
+ } | {
300
+ frame: import("../types/index.js").LayoutFrame;
301
+ } | {
302
+ minFrameSize: number;
303
+ frameSizeNeeded: number;
304
+ } | {
305
+ min: number;
306
+ max: number;
307
+ wanted: number;
308
+ } | {
309
+ problemEdgeCoordinates: number[];
310
+ } | {
311
+ side: import("../types/index.js").EdgeSide;
312
+ id: string;
313
+ } | {
314
+ frame: string;
315
+ } | {
316
+ frame: import("../types/index.js").LayoutFrame;
317
+ } | {
318
+ frame: import("../types/index.js").LayoutFrame;
319
+ } | {
320
+ frame: import("../types/index.js").LayoutFrame;
321
+ }> | {
322
+ code: string;
323
+ message: string;
324
+ } | undefined;
87
325
  }[];
88
326
  touchingFrames: Record<string, import("../types/index.js").LayoutFrame>[];
89
327
  touchingFramesArrays: import("../types/index.js").LayoutFrame[][];
@@ -94,8 +332,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
94
332
  win: import("../types/index.js").BaseLayoutWindow;
95
333
  }>;
96
334
  win: import("vue").ModelRef<import("../types/index.js").BaseLayoutWindow, string, import("../types/index.js").BaseLayoutWindow, import("../types/index.js").BaseLayoutWindow>;
97
- updateWindowSize: typeof updateWindowSize;
98
- dragActionHandler: DragActionHandler<IDragAction[], import("@alanscodelog/utils").RecordFromArray<IDragAction[], "name">>;
335
+ getUpdateWindowSizeInfo: typeof getUpdateWindowSizeInfo;
336
+ dragActionHandler: DragActionHandler<any, any>;
99
337
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
100
338
  "update:win": (value: import("../types/index.js").BaseLayoutWindow) => any;
101
339
  } & {
@@ -14,37 +14,12 @@
14
14
  v-bind="{ ...$attrs, class: void 0 }"
15
15
  >
16
16
  <!-- we need the size withot borders for correct px calculations -->
17
- <div class="
18
- layout-window
19
- relative
20
- overflow-hidden
21
- flex-1
22
- " ref="windowEl">
17
+ <div
18
+ class="layout-window relative overflow-hidden flex-1"
19
+ ref="windowEl"
20
+ >
23
21
  <template v-if="windowEl && win">
24
- <LayoutFrameComponent
25
- :frame="frame"
26
- :is-active-frame="frame.id === win.activeFrame"
27
- v-for="frame of frames"
28
- :key="frame.id"
29
- v-bind="frameProps"
30
- @focus="windowSetActiveFrame(win, frame.id)"
31
- >
32
- <slot :name="`frame-${frame.id}`" v-bind="{ frame }"/>
33
- </LayoutFrameComponent>
34
- <LayoutEdgesComponent
35
- :win="win"
36
- :active-frame="win.activeFrame ? frames[win.activeFrame] : void 0"
37
- :edges="visualEdges"
38
- :intersections="intersections"
39
- :dragging-edge="draggingEdges.length === 1 ? draggingEdges[0] : void 0"
40
- :dragging-intersection="draggingIntersection"
41
- v-bind="edgesProps"
42
- @drag-start="dragStart"
43
- />
44
- <LayoutDecosComponent
45
- :shapes="shapes"
46
- />
47
- <slot name="extra-decos"/>
22
+ <slot/>
48
23
  </template>
49
24
  </div>
50
25
  <Teleport
@@ -93,16 +68,17 @@
93
68
  import { useGlobalResizeObserver } from "@witchcraft/ui/composables/useGlobalResizeObserver";
94
69
  import { twMerge } from "@witchcraft/ui/utils/twMerge";
95
70
  import { computed, provide, reactive, ref, useAttrs, watch } from "vue";
96
- import LayoutDecosComponent from "./LayoutDecos.vue";
97
- import LayoutEdgesComponent from "./LayoutEdges.vue";
98
- import LayoutFrameComponent from "./LayoutFrame.vue";
99
71
  import { useFrames } from "../composables/useFrames.js";
100
72
  import { createDefaultHandlers } from "../drag/createDefaultHandlers.js";
101
73
  import { DragActionHandler } from "../drag/DragActionHandler";
102
- import { dragContextInjectionKey } from "../drag/types.js";
103
- import { updateWindowWithEvent } from "../helpers/updateWindowSizeWithEvent.js";
74
+ import { dragContextInjectionKey } from "../types/vue.js";
75
+ import {} from "../types/index.js";
76
+ import { getUpdateWindowSizeInfo } from "../layout/getUpdateWindowSizeInfo.js";
104
77
  import { windowSetActiveFrame } from "../layout/windowSetActiveFrame.js";
78
+ import {} from "../types/index.js";
79
+ import { layoutContextInjectionKey } from "../types/vue.js";
105
80
  import { settings } from "../settings.js";
81
+ import { applyFrameChanges } from "../layout/applyFrameChanges.js";
106
82
  const $attrs = useAttrs();
107
83
  const win = defineModel("win", { type: Object, ...{ required: true } });
108
84
  const props = defineProps({
@@ -110,9 +86,7 @@ const props = defineProps({
110
86
  textHints: { type: Array, required: false, default: () => [] },
111
87
  textHintsTeleportTo: { type: null, required: true, default: void 0 },
112
88
  ghostTeleportTo: { type: String, required: false, default: "#root" },
113
- allowWindowSizeUpdate: { type: Boolean, required: false, default: true },
114
- frameProps: { type: Object, required: false },
115
- edgesProps: { type: Object, required: false }
89
+ allowWindowSizeUpdate: { type: Boolean, required: false, default: true }
116
90
  });
117
91
  const emit = defineEmits(["isShowingDrag", "dragState"]);
118
92
  const windowEl = ref(null);
@@ -145,14 +119,9 @@ const dragContext = useFrames(
145
119
  dragActionHandler
146
120
  );
147
121
  const {
148
- dragStart,
149
122
  dragPoint,
150
- visualEdges,
151
123
  isDragging,
152
- draggingEdges,
153
- draggingIntersection,
154
124
  frames,
155
- intersections,
156
125
  state,
157
126
  frameDragFrameId,
158
127
  showDragging
@@ -172,23 +141,33 @@ function getWindowSize() {
172
141
  pxHeight: Math.floor(windowElRect.height)
173
142
  };
174
143
  }
175
- function updateWindowSize() {
144
+ function onWindowResize() {
176
145
  if (!props.allowWindowSizeUpdate) return;
177
146
  const newSize = { ...getWindowSize(), ...getWindowOffset() };
178
- updateWindowWithEvent(win.value, newSize);
147
+ win.value.pxX = newSize.pxX;
148
+ win.value.pxY = newSize.pxY;
149
+ applyFrameChanges(win.value, getUpdateWindowSizeInfo(win.value, newSize));
179
150
  }
180
- useGlobalResizeObserver(windowEl, updateWindowSize);
151
+ useGlobalResizeObserver(windowEl, onWindowResize);
181
152
  watch(() => props.allowWindowSizeUpdate, (newval, oldval) => {
182
153
  if (oldval === false && newval === true) {
183
- updateWindowSize();
154
+ onWindowResize();
184
155
  }
185
156
  });
186
157
  watch(state, () => emit("dragState", state.value));
187
158
  watch(showDragging, () => emit("isShowingDrag", showDragging.value));
159
+ const layoutContext = computed(() => {
160
+ return {
161
+ win: win.value,
162
+ shapes,
163
+ onFocus: (frameId) => windowSetActiveFrame(win.value, frameId)
164
+ };
165
+ });
166
+ provide(layoutContextInjectionKey, layoutContext);
188
167
  defineExpose({
189
168
  state,
190
169
  win,
191
- updateWindowSize,
170
+ getUpdateWindowSizeInfo,
192
171
  dragActionHandler
193
172
  });
194
173
  </script>