@witchcraft/layout 0.1.2 → 0.2.0

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 (190) hide show
  1. package/README.md +27 -24
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/FrameDragHandle.d.vue.ts +15 -0
  4. package/dist/runtime/components/FrameDragHandle.vue +28 -0
  5. package/dist/runtime/components/FrameDragHandle.vue.d.ts +15 -0
  6. package/dist/runtime/components/LayoutDecos.d.vue.ts +2 -4
  7. package/dist/runtime/components/LayoutDecos.vue +10 -29
  8. package/dist/runtime/components/LayoutDecos.vue.d.ts +2 -4
  9. package/dist/runtime/components/LayoutEdges.d.vue.ts +3 -3
  10. package/dist/runtime/components/LayoutEdges.vue +9 -10
  11. package/dist/runtime/components/LayoutEdges.vue.d.ts +3 -3
  12. package/dist/runtime/components/LayoutFrame.d.vue.ts +1 -1
  13. package/dist/runtime/components/LayoutFrame.vue +1 -4
  14. package/dist/runtime/components/LayoutFrame.vue.d.ts +1 -1
  15. package/dist/runtime/components/LayoutShapeSquare.d.vue.ts +3 -1
  16. package/dist/runtime/components/LayoutShapeSquare.vue +3 -5
  17. package/dist/runtime/components/LayoutShapeSquare.vue.d.ts +3 -1
  18. package/dist/runtime/components/LayoutWindow.d.vue.ts +26 -12
  19. package/dist/runtime/components/LayoutWindow.vue +95 -84
  20. package/dist/runtime/components/LayoutWindow.vue.d.ts +26 -12
  21. package/dist/runtime/composables/useFrames.d.ts +15 -13
  22. package/dist/runtime/composables/useFrames.js +59 -39
  23. package/dist/runtime/demo/App.vue +116 -30
  24. package/dist/runtime/demo/DemoControls.d.vue.ts +4 -1
  25. package/dist/runtime/demo/DemoControls.vue +98 -4
  26. package/dist/runtime/demo/DemoControls.vue.d.ts +4 -1
  27. package/dist/runtime/drag/CloseAction.d.ts +26 -5
  28. package/dist/runtime/drag/CloseAction.js +87 -40
  29. package/dist/runtime/drag/DragActionHandler.d.ts +20 -8
  30. package/dist/runtime/drag/DragActionHandler.js +47 -12
  31. package/dist/runtime/drag/FrameDragAction.d.ts +45 -0
  32. package/dist/runtime/drag/FrameDragAction.js +143 -0
  33. package/dist/runtime/drag/SplitAction.d.ts +32 -11
  34. package/dist/runtime/drag/SplitAction.js +82 -24
  35. package/dist/runtime/drag/createDefaultHandlers.d.ts +9 -0
  36. package/dist/runtime/drag/createDefaultHandlers.js +10 -0
  37. package/dist/runtime/drag/defaultDragActions.d.ts +9 -0
  38. package/dist/runtime/drag/defaultDragActions.js +10 -0
  39. package/dist/runtime/drag/types.d.ts +82 -13
  40. package/dist/runtime/drag/types.js +1 -0
  41. package/dist/runtime/helpers/createZoneSideClipPath.d.ts +12 -0
  42. package/dist/runtime/helpers/createZoneSideClipPath.js +17 -0
  43. package/dist/runtime/helpers/doEdgesOverlap.d.ts +3 -1
  44. package/dist/runtime/helpers/doEdgesOverlap.js +5 -5
  45. package/dist/runtime/helpers/getDockBoundaries.d.ts +19 -0
  46. package/dist/runtime/helpers/getDockBoundaries.js +14 -0
  47. package/dist/runtime/helpers/getEdgeLength.d.ts +2 -0
  48. package/dist/runtime/helpers/getEdgeLength.js +5 -0
  49. package/dist/runtime/helpers/getIntersections.js +2 -2
  50. package/dist/runtime/helpers/getIntersectionsCss.js +2 -2
  51. package/dist/runtime/helpers/getMoveEdgeInfo.js +2 -2
  52. package/dist/runtime/helpers/getResizeLimit.js +2 -2
  53. package/dist/runtime/helpers/getShapeSquareCss.js +2 -2
  54. package/dist/runtime/helpers/getVisualEdgeCss.js +2 -2
  55. package/dist/runtime/helpers/getVisualEdges.d.ts +1 -1
  56. package/dist/runtime/helpers/getVisualEdges.js +4 -3
  57. package/dist/runtime/helpers/index.d.ts +4 -0
  58. package/dist/runtime/helpers/index.js +4 -0
  59. package/dist/runtime/helpers/isEdgeEqual.js +2 -4
  60. package/dist/runtime/helpers/isWindowEdge.js +2 -2
  61. package/dist/runtime/helpers/isWindowEdgePoint.js +2 -2
  62. package/dist/runtime/helpers/moveEdge.js +2 -2
  63. package/dist/runtime/helpers/numberToScaledPercent.d.ts +1 -1
  64. package/dist/runtime/helpers/numberToScaledPercent.js +2 -2
  65. package/dist/runtime/helpers/numberToScaledSize.js +2 -2
  66. package/dist/runtime/helpers/rotateFrames.d.ts +7 -0
  67. package/dist/runtime/helpers/rotateFrames.js +36 -0
  68. package/dist/runtime/helpers/scaledPointToPx.d.ts +13 -0
  69. package/dist/runtime/helpers/scaledPointToPx.js +7 -0
  70. package/dist/runtime/helpers/toWindowCoord.js +2 -2
  71. package/dist/runtime/layout/applyFrameChanges.d.ts +10 -0
  72. package/dist/runtime/layout/applyFrameChanges.js +29 -0
  73. package/dist/runtime/layout/createSplitDecoFromDrag.d.ts +6 -1
  74. package/dist/runtime/layout/createSplitDecoFromDrag.js +4 -4
  75. package/dist/runtime/layout/createSplitDecoShapes.d.ts +7 -0
  76. package/dist/runtime/layout/{createSplitDecoEdge.js → createSplitDecoShapes.js} +6 -3
  77. package/dist/runtime/layout/debugFrame.js +2 -1
  78. package/dist/runtime/layout/findSafeSplitEdge.js +2 -2
  79. package/dist/runtime/layout/frameCreate.js +2 -2
  80. package/dist/runtime/layout/getCloseFrameInfo.d.ts +7 -6
  81. package/dist/runtime/layout/getCloseFrameInfo.js +10 -3
  82. package/dist/runtime/layout/getDragZones.d.ts +8 -0
  83. package/dist/runtime/layout/getDragZones.js +32 -0
  84. package/dist/runtime/layout/getFillEmptySpaceInfo.d.ts +65 -0
  85. package/dist/runtime/layout/getFillEmptySpaceInfo.js +69 -0
  86. package/dist/runtime/layout/getFrameCollapseInfo.d.ts +13 -0
  87. package/dist/runtime/layout/getFrameCollapseInfo.js +93 -0
  88. package/dist/runtime/layout/getFrameDockInfo.d.ts +9 -0
  89. package/dist/runtime/layout/getFrameDockInfo.js +82 -0
  90. package/dist/runtime/layout/getFrameDragZones.d.ts +16 -0
  91. package/dist/runtime/layout/getFrameDragZones.js +74 -0
  92. package/dist/runtime/layout/getFrameRearrangeInfo.d.ts +139 -0
  93. package/dist/runtime/layout/getFrameRearrangeInfo.js +87 -0
  94. package/dist/runtime/layout/getFrameSplitInfo.d.ts +7 -5
  95. package/dist/runtime/layout/getFrameSplitInfo.js +10 -3
  96. package/dist/runtime/layout/getFrameSwapInfo.d.ts +9 -0
  97. package/dist/runtime/layout/getFrameSwapInfo.js +27 -0
  98. package/dist/runtime/layout/getFrameTo.js +2 -2
  99. package/dist/runtime/layout/getFrameUncollapseInfo.d.ts +12 -0
  100. package/dist/runtime/layout/getFrameUncollapseInfo.js +88 -0
  101. package/dist/runtime/layout/getFrameUndockInfo.d.ts +13 -0
  102. package/dist/runtime/layout/getFrameUndockInfo.js +51 -0
  103. package/dist/runtime/layout/getFramesRedistributeInfo.d.ts +29 -0
  104. package/dist/runtime/layout/getFramesRedistributeInfo.js +53 -0
  105. package/dist/runtime/layout/getWindowDragZones.d.ts +6 -0
  106. package/dist/runtime/layout/getWindowDragZones.js +49 -0
  107. package/dist/runtime/layout/index.d.ts +14 -5
  108. package/dist/runtime/layout/index.js +14 -5
  109. package/dist/runtime/layout/isPointInRect.d.ts +7 -0
  110. package/dist/runtime/layout/{isPointInFrame.js → isPointInRect.js} +1 -1
  111. package/dist/runtime/layout/resizeFrame.js +2 -2
  112. package/dist/runtime/settings.d.ts +41 -16
  113. package/dist/runtime/settings.js +95 -53
  114. package/dist/runtime/types/index.d.ts +324 -55
  115. package/dist/runtime/types/index.js +54 -20
  116. package/package.json +28 -29
  117. package/src/runtime/components/FrameDragHandle.vue +30 -0
  118. package/src/runtime/components/LayoutDecos.vue +12 -36
  119. package/src/runtime/components/LayoutEdges.vue +27 -22
  120. package/src/runtime/components/LayoutFrame.vue +6 -5
  121. package/src/runtime/components/LayoutShapeSquare.vue +11 -5
  122. package/src/runtime/components/LayoutWindow.vue +110 -101
  123. package/src/runtime/composables/useFrames.ts +80 -50
  124. package/src/runtime/demo/App.vue +126 -36
  125. package/src/runtime/demo/DemoControls.vue +115 -6
  126. package/src/runtime/drag/CloseAction.ts +106 -44
  127. package/src/runtime/drag/DragActionHandler.ts +71 -20
  128. package/src/runtime/drag/FrameDragAction.ts +202 -0
  129. package/src/runtime/drag/SplitAction.ts +106 -34
  130. package/src/runtime/drag/createDefaultHandlers.ts +19 -0
  131. package/src/runtime/drag/defaultDragActions.ts +19 -0
  132. package/src/runtime/drag/types.ts +90 -20
  133. package/src/runtime/helpers/createZoneSideClipPath.ts +41 -0
  134. package/src/runtime/helpers/doEdgesOverlap.ts +11 -5
  135. package/src/runtime/helpers/getDockBoundaries.ts +36 -0
  136. package/src/runtime/helpers/getEdgeLength.ts +10 -0
  137. package/src/runtime/helpers/getIntersections.ts +2 -2
  138. package/src/runtime/helpers/getIntersectionsCss.ts +2 -2
  139. package/src/runtime/helpers/getMoveEdgeInfo.ts +2 -2
  140. package/src/runtime/helpers/getResizeLimit.ts +2 -2
  141. package/src/runtime/helpers/getShapeSquareCss.ts +2 -2
  142. package/src/runtime/helpers/getVisualEdgeCss.ts +2 -2
  143. package/src/runtime/helpers/getVisualEdges.ts +5 -4
  144. package/src/runtime/helpers/index.ts +4 -0
  145. package/src/runtime/helpers/isEdgeEqual.ts +2 -4
  146. package/src/runtime/helpers/isWindowEdge.ts +2 -2
  147. package/src/runtime/helpers/isWindowEdgePoint.ts +2 -2
  148. package/src/runtime/helpers/moveEdge.ts +2 -2
  149. package/src/runtime/helpers/numberToScaledPercent.ts +3 -3
  150. package/src/runtime/helpers/numberToScaledSize.ts +2 -2
  151. package/src/runtime/helpers/rotateFrames.ts +45 -0
  152. package/src/runtime/helpers/scaledPointToPx.ts +13 -0
  153. package/src/runtime/helpers/toWindowCoord.ts +2 -2
  154. package/src/runtime/layout/applyFrameChanges.ts +39 -0
  155. package/src/runtime/layout/createSplitDecoFromDrag.ts +12 -6
  156. package/src/runtime/layout/{createSplitDecoEdge.ts → createSplitDecoShapes.ts} +17 -7
  157. package/src/runtime/layout/debugFrame.ts +1 -1
  158. package/src/runtime/layout/findSafeSplitEdge.ts +3 -3
  159. package/src/runtime/layout/frameCreate.ts +2 -2
  160. package/src/runtime/layout/getCloseFrameInfo.ts +21 -8
  161. package/src/runtime/layout/getDragZones.ts +48 -0
  162. package/src/runtime/layout/getFillEmptySpaceInfo.ts +177 -0
  163. package/src/runtime/layout/getFrameCollapseInfo.ts +164 -0
  164. package/src/runtime/layout/getFrameDockInfo.ts +126 -0
  165. package/src/runtime/layout/getFrameDragZones.ts +100 -0
  166. package/src/runtime/layout/getFrameRearrangeInfo.ts +261 -0
  167. package/src/runtime/layout/getFrameSplitInfo.ts +21 -8
  168. package/src/runtime/layout/getFrameSwapInfo.ts +45 -0
  169. package/src/runtime/layout/getFrameTo.ts +2 -2
  170. package/src/runtime/layout/getFrameUncollapseInfo.ts +160 -0
  171. package/src/runtime/layout/getFrameUndockInfo.ts +97 -0
  172. package/src/runtime/layout/getFramesRedistributeInfo.ts +98 -0
  173. package/src/runtime/layout/getWindowDragZones.ts +59 -0
  174. package/src/runtime/layout/index.ts +14 -5
  175. package/src/runtime/layout/isPointInRect.ts +7 -0
  176. package/src/runtime/layout/resizeFrame.ts +2 -2
  177. package/src/runtime/settings.ts +69 -49
  178. package/src/runtime/types/index.ts +143 -28
  179. package/dist/runtime/layout/closeFrame.d.ts +0 -5
  180. package/dist/runtime/layout/closeFrame.js +0 -13
  181. package/dist/runtime/layout/closeFrames.d.ts +0 -2
  182. package/dist/runtime/layout/closeFrames.js +0 -8
  183. package/dist/runtime/layout/createSplitDecoEdge.d.ts +0 -2
  184. package/dist/runtime/layout/frameSplit.d.ts +0 -16
  185. package/dist/runtime/layout/frameSplit.js +0 -9
  186. package/dist/runtime/layout/isPointInFrame.d.ts +0 -2
  187. package/src/runtime/layout/closeFrame.ts +0 -33
  188. package/src/runtime/layout/closeFrames.ts +0 -14
  189. package/src/runtime/layout/frameSplit.ts +0 -31
  190. package/src/runtime/layout/isPointInFrame.ts +0 -7
@@ -1,7 +1,6 @@
1
1
  import type { EnumLike } from "@alanscodelog/utils";
2
2
  import { z } from "zod";
3
3
  export * from "../drag/types.js";
4
- import type { HTMLAttributes, StyleValue } from "vue";
5
4
  export declare const zUuid: z.ZodUUID;
6
5
  export type AnyUuid = z.infer<typeof zUuid>;
7
6
  export declare const zWindowIdConstants: z.ZodEnum<{
@@ -122,18 +121,32 @@ export type IntersectionEntry = {
122
121
  isWindowEdge: boolean;
123
122
  };
124
123
  export declare const zLayoutFrame: z.ZodObject<{
125
- id: z.ZodUUID;
126
124
  width: z.ZodNumber;
127
125
  height: z.ZodNumber;
128
126
  x: z.ZodNumber;
129
127
  y: z.ZodNumber;
128
+ id: z.ZodUUID;
129
+ docked: z.ZodOptional<z.ZodEnum<{
130
+ left: "left";
131
+ right: "right";
132
+ top: "top";
133
+ bottom: "bottom";
134
+ }>>;
135
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
130
136
  }, z.core.$loose>;
131
137
  export declare const zLayoutFrameLoose: z.ZodObject<{
132
- id: z.ZodUUID;
133
138
  width: z.ZodNumber;
134
139
  height: z.ZodNumber;
135
140
  x: z.ZodNumber;
136
141
  y: z.ZodNumber;
142
+ id: z.ZodUUID;
143
+ docked: z.ZodOptional<z.ZodEnum<{
144
+ left: "left";
145
+ right: "right";
146
+ top: "top";
147
+ bottom: "bottom";
148
+ }>>;
149
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
137
150
  }, z.core.$loose>;
138
151
  export interface Register {
139
152
  }
@@ -151,6 +164,8 @@ export type ExtendedWorkspace = Register extends {
151
164
  } ? T : unknown;
152
165
  export type BaseLayoutFrame = Size & Pos & {
153
166
  id: FrameId;
167
+ docked?: EdgeSide | false;
168
+ collapsed?: false | number;
154
169
  };
155
170
  export type LayoutFrame = ExtendedLayoutFrame & BaseLayoutFrame;
156
171
  export type LayoutFrames = Record<string, LayoutFrame>;
@@ -158,11 +173,18 @@ export declare const zLayoutWindow: z.ZodObject<{
158
173
  id: z.ZodUUID;
159
174
  activeFrame: z.ZodOptional<z.ZodString>;
160
175
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
161
- id: z.ZodUUID;
162
176
  width: z.ZodNumber;
163
177
  height: z.ZodNumber;
164
178
  x: z.ZodNumber;
165
179
  y: z.ZodNumber;
180
+ id: z.ZodUUID;
181
+ docked: z.ZodOptional<z.ZodEnum<{
182
+ left: "left";
183
+ right: "right";
184
+ top: "top";
185
+ bottom: "bottom";
186
+ }>>;
187
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
166
188
  }, z.core.$loose>>;
167
189
  pxWidth: z.ZodNumber;
168
190
  pxHeight: z.ZodNumber;
@@ -173,11 +195,18 @@ export declare const zLayoutWindowLoose: z.ZodObject<{
173
195
  id: z.ZodUUID;
174
196
  activeFrame: z.ZodOptional<z.ZodString>;
175
197
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
176
- id: z.ZodUUID;
177
198
  width: z.ZodNumber;
178
199
  height: z.ZodNumber;
179
200
  x: z.ZodNumber;
180
201
  y: z.ZodNumber;
202
+ id: z.ZodUUID;
203
+ docked: z.ZodOptional<z.ZodEnum<{
204
+ left: "left";
205
+ right: "right";
206
+ top: "top";
207
+ bottom: "bottom";
208
+ }>>;
209
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
181
210
  }, z.core.$loose>>;
182
211
  pxWidth: z.ZodNumber;
183
212
  pxHeight: z.ZodNumber;
@@ -198,21 +227,35 @@ export type LayoutWindows = Record<string, LayoutWindow>;
198
227
  export declare const zWorkspace: z.ZodObject<{
199
228
  activeFrame: z.ZodOptional<z.ZodString>;
200
229
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
201
- id: z.ZodUUID;
202
230
  width: z.ZodNumber;
203
231
  height: z.ZodNumber;
204
232
  x: z.ZodNumber;
205
233
  y: z.ZodNumber;
234
+ id: z.ZodUUID;
235
+ docked: z.ZodOptional<z.ZodEnum<{
236
+ left: "left";
237
+ right: "right";
238
+ top: "top";
239
+ bottom: "bottom";
240
+ }>>;
241
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
206
242
  }, z.core.$loose>>;
207
243
  }, z.core.$strict>;
208
244
  export declare const zWorkspaceLoose: z.ZodObject<{
209
245
  activeFrame: z.ZodOptional<z.ZodString>;
210
246
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
211
- id: z.ZodUUID;
212
247
  width: z.ZodNumber;
213
248
  height: z.ZodNumber;
214
249
  x: z.ZodNumber;
215
250
  y: z.ZodNumber;
251
+ id: z.ZodUUID;
252
+ docked: z.ZodOptional<z.ZodEnum<{
253
+ left: "left";
254
+ right: "right";
255
+ top: "top";
256
+ bottom: "bottom";
257
+ }>>;
258
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
216
259
  }, z.core.$loose>>;
217
260
  }, z.core.$loose>;
218
261
  export type Workspace = Pick<LayoutWindow, "activeFrame" | "frames"> & ExtendedWorkspace;
@@ -222,11 +265,18 @@ export declare const zLayout: z.ZodObject<{
222
265
  id: z.ZodUUID;
223
266
  activeFrame: z.ZodOptional<z.ZodString>;
224
267
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
225
- id: z.ZodUUID;
226
268
  width: z.ZodNumber;
227
269
  height: z.ZodNumber;
228
270
  x: z.ZodNumber;
229
271
  y: z.ZodNumber;
272
+ id: z.ZodUUID;
273
+ docked: z.ZodOptional<z.ZodEnum<{
274
+ left: "left";
275
+ right: "right";
276
+ top: "top";
277
+ bottom: "bottom";
278
+ }>>;
279
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
230
280
  }, z.core.$loose>>;
231
281
  pxWidth: z.ZodNumber;
232
282
  pxHeight: z.ZodNumber;
@@ -240,11 +290,18 @@ export declare const zInitializedLayout: z.ZodObject<{
240
290
  id: z.ZodUUID;
241
291
  activeFrame: z.ZodOptional<z.ZodString>;
242
292
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
243
- id: z.ZodUUID;
244
293
  width: z.ZodNumber;
245
294
  height: z.ZodNumber;
246
295
  x: z.ZodNumber;
247
296
  y: z.ZodNumber;
297
+ id: z.ZodUUID;
298
+ docked: z.ZodOptional<z.ZodEnum<{
299
+ left: "left";
300
+ right: "right";
301
+ top: "top";
302
+ bottom: "bottom";
303
+ }>>;
304
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
248
305
  }, z.core.$loose>>;
249
306
  pxWidth: z.ZodNumber;
250
307
  pxHeight: z.ZodNumber;
@@ -256,46 +313,78 @@ export type Layout = ExtendedLayout & {
256
313
  activeWindow?: string;
257
314
  windows: LayoutWindows;
258
315
  };
259
- export declare const zSplitDecoShapes: z.ZodObject<{
260
- edge: z.ZodObject<{
261
- startX: z.ZodNumber;
262
- startY: z.ZodNumber;
263
- endX: z.ZodNumber;
264
- endY: z.ZodNumber;
265
- }, z.core.$strip>;
266
- newFrame: z.ZodObject<{
316
+ declare const zLayoutShape: z.ZodDiscriminatedUnion<[z.ZodObject<{
317
+ type: z.ZodLiteral<"square">;
318
+ data: z.ZodObject<{
267
319
  width: z.ZodNumber;
268
320
  height: z.ZodNumber;
269
321
  x: z.ZodNumber;
270
322
  y: z.ZodNumber;
271
323
  }, z.core.$strip>;
272
- }, z.core.$strict>;
273
- export type SplitDecoShapes = z.infer<typeof zSplitDecoShapes>;
274
- export declare const zSplitDeco: z.ZodObject<{
275
- id: z.ZodUUID;
276
- type: z.ZodLiteral<"split">;
277
- position: z.ZodNumber;
278
- direction: z.ZodEnum<{
279
- up: "up";
280
- down: "down";
281
- left: "left";
282
- right: "right";
283
- }>;
284
- shapes: z.ZodObject<{
285
- edge: z.ZodObject<{
324
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
325
+ }, z.core.$strip>, z.ZodObject<{
326
+ type: z.ZodLiteral<"edge">;
327
+ data: z.ZodObject<{
328
+ startX: z.ZodNumber;
329
+ startY: z.ZodNumber;
330
+ endX: z.ZodNumber;
331
+ endY: z.ZodNumber;
332
+ }, z.core.$strip>;
333
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
334
+ }, z.core.$strip>], "type">;
335
+ export type LayoutShape = z.infer<typeof zLayoutShape>;
336
+ declare const zBaseDeco: z.ZodObject<{
337
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
338
+ type: z.ZodLiteral<"square">;
339
+ data: z.ZodObject<{
340
+ width: z.ZodNumber;
341
+ height: z.ZodNumber;
342
+ x: z.ZodNumber;
343
+ y: z.ZodNumber;
344
+ }, z.core.$strip>;
345
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
346
+ }, z.core.$strip>, z.ZodObject<{
347
+ type: z.ZodLiteral<"edge">;
348
+ data: z.ZodObject<{
286
349
  startX: z.ZodNumber;
287
350
  startY: z.ZodNumber;
288
351
  endX: z.ZodNumber;
289
352
  endY: z.ZodNumber;
290
353
  }, z.core.$strip>;
291
- newFrame: z.ZodObject<{
354
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
355
+ }, z.core.$strip>], "type">>>;
356
+ }, z.core.$strip>;
357
+ export type BaseDeco = z.infer<typeof zBaseDeco>;
358
+ export declare const zSplitDeco: z.ZodObject<{
359
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
360
+ type: z.ZodLiteral<"square">;
361
+ data: z.ZodObject<{
292
362
  width: z.ZodNumber;
293
363
  height: z.ZodNumber;
294
364
  x: z.ZodNumber;
295
365
  y: z.ZodNumber;
296
366
  }, z.core.$strip>;
297
- }, z.core.$strict>;
298
- }, z.core.$strict>;
367
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
368
+ }, z.core.$strip>, z.ZodObject<{
369
+ type: z.ZodLiteral<"edge">;
370
+ data: z.ZodObject<{
371
+ startX: z.ZodNumber;
372
+ startY: z.ZodNumber;
373
+ endX: z.ZodNumber;
374
+ endY: z.ZodNumber;
375
+ }, z.core.$strip>;
376
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
377
+ }, z.core.$strip>], "type">>>;
378
+ id: z.ZodUUID;
379
+ type: z.ZodLiteral<"split">;
380
+ position: z.ZodNumber;
381
+ direction: z.ZodEnum<{
382
+ up: "up";
383
+ down: "down";
384
+ left: "left";
385
+ right: "right";
386
+ }>;
387
+ }, z.core.$strip>;
299
388
  export declare const zRawSplitDeco: z.ZodObject<{
300
389
  type: z.ZodLiteral<"split">;
301
390
  id: z.ZodUUID;
@@ -306,16 +395,54 @@ export declare const zRawSplitDeco: z.ZodObject<{
306
395
  left: "left";
307
396
  right: "right";
308
397
  }>;
309
- }, z.core.$strict>;
398
+ }, z.core.$strip>;
310
399
  export type RawSplitDeco = z.infer<typeof zRawSplitDeco>;
311
400
  export type SplitDeco = z.infer<typeof zSplitDeco>;
312
401
  declare const zCloseDeco: z.ZodObject<{
402
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
403
+ type: z.ZodLiteral<"square">;
404
+ data: z.ZodObject<{
405
+ width: z.ZodNumber;
406
+ height: z.ZodNumber;
407
+ x: z.ZodNumber;
408
+ y: z.ZodNumber;
409
+ }, z.core.$strip>;
410
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
411
+ }, z.core.$strip>, z.ZodObject<{
412
+ type: z.ZodLiteral<"edge">;
413
+ data: z.ZodObject<{
414
+ startX: z.ZodNumber;
415
+ startY: z.ZodNumber;
416
+ endX: z.ZodNumber;
417
+ endY: z.ZodNumber;
418
+ }, z.core.$strip>;
419
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
420
+ }, z.core.$strip>], "type">>>;
313
421
  id: z.ZodUUID;
314
422
  type: z.ZodLiteral<"close">;
315
423
  force: z.ZodOptional<z.ZodBoolean>;
316
- }, z.core.$strict>;
424
+ }, z.core.$strip>;
317
425
  export type CloseDeco = z.infer<typeof zCloseDeco>;
318
- declare const zDropDeco: z.ZodObject<{
426
+ declare const zFrameDragDeco: z.ZodObject<{
427
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
428
+ type: z.ZodLiteral<"square">;
429
+ data: z.ZodObject<{
430
+ width: z.ZodNumber;
431
+ height: z.ZodNumber;
432
+ x: z.ZodNumber;
433
+ y: z.ZodNumber;
434
+ }, z.core.$strip>;
435
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
436
+ }, z.core.$strip>, z.ZodObject<{
437
+ type: z.ZodLiteral<"edge">;
438
+ data: z.ZodObject<{
439
+ startX: z.ZodNumber;
440
+ startY: z.ZodNumber;
441
+ endX: z.ZodNumber;
442
+ endY: z.ZodNumber;
443
+ }, z.core.$strip>;
444
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
445
+ }, z.core.$strip>], "type">>>;
319
446
  id: z.ZodUUID;
320
447
  type: z.ZodLiteral<"drop">;
321
448
  position: z.ZodUnion<[z.ZodEnum<{
@@ -326,9 +453,28 @@ declare const zDropDeco: z.ZodObject<{
326
453
  }>, z.ZodEnum<{
327
454
  center: "center";
328
455
  }>]>;
329
- }, z.core.$strict>;
330
- export type DropDeco = z.infer<typeof zDropDeco>;
456
+ }, z.core.$strip>;
457
+ export type FrameDragDeco = z.infer<typeof zFrameDragDeco>;
331
458
  export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
459
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
460
+ type: z.ZodLiteral<"square">;
461
+ data: z.ZodObject<{
462
+ width: z.ZodNumber;
463
+ height: z.ZodNumber;
464
+ x: z.ZodNumber;
465
+ y: z.ZodNumber;
466
+ }, z.core.$strip>;
467
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
468
+ }, z.core.$strip>, z.ZodObject<{
469
+ type: z.ZodLiteral<"edge">;
470
+ data: z.ZodObject<{
471
+ startX: z.ZodNumber;
472
+ startY: z.ZodNumber;
473
+ endX: z.ZodNumber;
474
+ endY: z.ZodNumber;
475
+ }, z.core.$strip>;
476
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
477
+ }, z.core.$strip>], "type">>>;
332
478
  id: z.ZodUUID;
333
479
  type: z.ZodLiteral<"split">;
334
480
  position: z.ZodNumber;
@@ -338,25 +484,49 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
338
484
  left: "left";
339
485
  right: "right";
340
486
  }>;
341
- shapes: z.ZodObject<{
342
- edge: z.ZodObject<{
487
+ }, z.core.$strip>, z.ZodObject<{
488
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
489
+ type: z.ZodLiteral<"square">;
490
+ data: z.ZodObject<{
491
+ width: z.ZodNumber;
492
+ height: z.ZodNumber;
493
+ x: z.ZodNumber;
494
+ y: z.ZodNumber;
495
+ }, z.core.$strip>;
496
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
497
+ }, z.core.$strip>, z.ZodObject<{
498
+ type: z.ZodLiteral<"edge">;
499
+ data: z.ZodObject<{
343
500
  startX: z.ZodNumber;
344
501
  startY: z.ZodNumber;
345
502
  endX: z.ZodNumber;
346
503
  endY: z.ZodNumber;
347
504
  }, z.core.$strip>;
348
- newFrame: z.ZodObject<{
505
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
506
+ }, z.core.$strip>], "type">>>;
507
+ id: z.ZodUUID;
508
+ type: z.ZodLiteral<"close">;
509
+ force: z.ZodOptional<z.ZodBoolean>;
510
+ }, z.core.$strip>, z.ZodObject<{
511
+ shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
512
+ type: z.ZodLiteral<"square">;
513
+ data: z.ZodObject<{
349
514
  width: z.ZodNumber;
350
515
  height: z.ZodNumber;
351
516
  x: z.ZodNumber;
352
517
  y: z.ZodNumber;
353
518
  }, z.core.$strip>;
354
- }, z.core.$strict>;
355
- }, z.core.$strict>, z.ZodObject<{
356
- id: z.ZodUUID;
357
- type: z.ZodLiteral<"close">;
358
- force: z.ZodOptional<z.ZodBoolean>;
359
- }, z.core.$strict>, z.ZodObject<{
519
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
520
+ }, z.core.$strip>, z.ZodObject<{
521
+ type: z.ZodLiteral<"edge">;
522
+ data: z.ZodObject<{
523
+ startX: z.ZodNumber;
524
+ startY: z.ZodNumber;
525
+ endX: z.ZodNumber;
526
+ endY: z.ZodNumber;
527
+ }, z.core.$strip>;
528
+ attrs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
529
+ }, z.core.$strip>], "type">>>;
360
530
  id: z.ZodUUID;
361
531
  type: z.ZodLiteral<"drop">;
362
532
  position: z.ZodUnion<[z.ZodEnum<{
@@ -367,7 +537,7 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
367
537
  }>, z.ZodEnum<{
368
538
  center: "center";
369
539
  }>]>;
370
- }, z.core.$strict>]>;
540
+ }, z.core.$strip>]>;
371
541
  export type Deco = z.infer<typeof zDeco>;
372
542
  export declare const LAYOUT_ERROR: {
373
543
  INVALID_ID: "INVALID_ID";
@@ -380,6 +550,19 @@ export declare const LAYOUT_ERROR: {
380
550
  CANT_CLOSE_SINGLE_FRAME: "CANT_CLOSE_SINGLE_FRAME";
381
551
  CANT_SPLIT_FRAME_TOO_SMALL: "CANT_SPLIT_FRAME_TOO_SMALL";
382
552
  CANT_CLOSE_WITHOUT_FORCE: "CANT_CLOSE_WITHOUT_FORCE";
553
+ CANT_SWAP_WITH_SELF: "CANT_SWAP_WITH_SELF";
554
+ CANT_REARRANGE_TO_SAME_RELATIVE_POSITION: "CANT_REARRANGE_TO_SAME_RELATIVE_POSITION";
555
+ CANT_REARRANGE_WITH_DOCKED_EDGES: "CANT_REARRANGE_WITH_DOCKED_EDGES";
556
+ CANT_REARRANGE_DOCKED_WITH_NON_DOCKED: "CANT_REARRANGE_DOCKED_WITH_NON_DOCKED";
557
+ CANT_SPLIT_DOCKED_FRAME: "CANT_SPLIT_DOCKED_FRAME";
558
+ NO_SPACE_TO_REDISTRIBUTE: "NO_SPACE_TO_REDISTRIBUTE";
559
+ REDISTRIBUTE_OUT_OF_BOUNDS: "REDISTRIBUTE_OUT_OF_BOUNDS";
560
+ FRAME_ALREADY_DOCKED_ON_SIDE: "FRAME_ALREADY_DOCKED_ON_SIDE";
561
+ CANT_LEAVE_NO_UNDOCKED_FRAMES: "CANT_LEAVE_NO_UNDOCKED_FRAMES";
562
+ CANT_UNDOCK_COLLAPSED_FRAME: "CANT_UNDOCK_COLLAPSED_FRAME";
563
+ CANT_COLLAPSE_NOT_DOCKED: "CANT_COLLAPSE_NOT_DOCKED";
564
+ CANT_UNCOLLAPSE_NOT_COLLAPSED: "CANT_UNCOLLAPSE_NOT_COLLAPSED";
565
+ NO_FILL_CANDIDATES: "NO_FILL_CANDIDATES";
383
566
  };
384
567
  export type LayoutError = EnumLike<typeof LAYOUT_ERROR>;
385
568
  export type LayoutErrorInfo<T extends LayoutError> = LayoutErrorsInfo[T] extends undefined ? never : LayoutErrorsInfo[T];
@@ -415,8 +598,70 @@ export type LayoutErrorsInfo = {
415
598
  frame: LayoutFrame;
416
599
  framesRequiredToBeDeleted: LayoutFrame[];
417
600
  };
601
+ [LAYOUT_ERROR.CANT_SWAP_WITH_SELF]: {
602
+ frame: LayoutFrame;
603
+ };
604
+ [LAYOUT_ERROR.CANT_REARRANGE_TO_SAME_RELATIVE_POSITION]: {
605
+ draggingFrameId: string;
606
+ hoveredFrameId: string;
607
+ zoneSide: DragZone["side"];
608
+ };
609
+ [LAYOUT_ERROR.CANT_REARRANGE_WITH_DOCKED_EDGES]: {
610
+ draggingFrameId: string;
611
+ hoveredFrameId: string;
612
+ zoneSide: DragZone["side"];
613
+ };
614
+ [LAYOUT_ERROR.CANT_REARRANGE_DOCKED_WITH_NON_DOCKED]: {
615
+ draggingFrameId: string;
616
+ hoveredFrameId: string;
617
+ zoneSide: DragZone["side"];
618
+ };
619
+ [LAYOUT_ERROR.CANT_SPLIT_DOCKED_FRAME]: {
620
+ frame: LayoutFrame;
621
+ };
622
+ [LAYOUT_ERROR.NO_SPACE_TO_REDISTRIBUTE]: {
623
+ minFrameSize: number;
624
+ frameSizeNeeded: number;
625
+ };
626
+ [LAYOUT_ERROR.REDISTRIBUTE_OUT_OF_BOUNDS]: {
627
+ min: number;
628
+ max: number;
629
+ wanted: number;
630
+ };
631
+ [LAYOUT_ERROR.FRAME_ALREADY_DOCKED_ON_SIDE]: {
632
+ side: EdgeSide;
633
+ id: string;
634
+ };
635
+ [LAYOUT_ERROR.CANT_LEAVE_NO_UNDOCKED_FRAMES]: {};
636
+ [LAYOUT_ERROR.CANT_UNDOCK_COLLAPSED_FRAME]: {
637
+ frame: string;
638
+ };
639
+ [LAYOUT_ERROR.CANT_COLLAPSE_NOT_DOCKED]: {
640
+ frame: LayoutFrame;
641
+ };
642
+ [LAYOUT_ERROR.CANT_UNCOLLAPSE_NOT_COLLAPSED]: {
643
+ frame: LayoutFrame;
644
+ };
645
+ [LAYOUT_ERROR.NO_FILL_CANDIDATES]: {};
418
646
  };
419
647
  export type HasOpposite = Direction | EdgeSide | ExtendedDirection | ExtendedEdgeSide | keyof Point | keyof Size;
648
+ export type BaseDragZone = {
649
+ x: number;
650
+ y: number;
651
+ width: number;
652
+ height: number;
653
+ pxWidth: number;
654
+ pxHeight: number;
655
+ };
656
+ export type FrameDragZone = BaseDragZone & {
657
+ type: "frame";
658
+ side: EdgeSide | "center";
659
+ };
660
+ export type WindowEdgeZone = BaseDragZone & {
661
+ type: "window";
662
+ side: EdgeSide;
663
+ };
664
+ export type DragZone = FrameDragZone | WindowEdgeZone;
420
665
  export declare const zWindowCreate: z.ZodObject<{
421
666
  id: z.ZodOptional<z.ZodUUID>;
422
667
  activeFrame: z.ZodOptional<z.ZodString>;
@@ -425,11 +670,18 @@ export declare const zWindowCreate: z.ZodObject<{
425
670
  pxX: z.ZodOptional<z.ZodNumber>;
426
671
  pxY: z.ZodOptional<z.ZodNumber>;
427
672
  frames: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
428
- id: z.ZodUUID;
429
673
  width: z.ZodNumber;
430
674
  height: z.ZodNumber;
431
675
  x: z.ZodNumber;
432
676
  y: z.ZodNumber;
677
+ id: z.ZodUUID;
678
+ docked: z.ZodOptional<z.ZodEnum<{
679
+ left: "left";
680
+ right: "right";
681
+ top: "top";
682
+ bottom: "bottom";
683
+ }>>;
684
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
433
685
  }, z.core.$loose>>>;
434
686
  }, z.core.$loose>;
435
687
  export declare const zLayoutCreate: z.ZodObject<{
@@ -438,11 +690,18 @@ export declare const zLayoutCreate: z.ZodObject<{
438
690
  id: z.ZodUUID;
439
691
  activeFrame: z.ZodOptional<z.ZodString>;
440
692
  frames: z.ZodRecord<z.ZodString, z.ZodObject<{
441
- id: z.ZodUUID;
442
693
  width: z.ZodNumber;
443
694
  height: z.ZodNumber;
444
695
  x: z.ZodNumber;
445
696
  y: z.ZodNumber;
697
+ id: z.ZodUUID;
698
+ docked: z.ZodOptional<z.ZodEnum<{
699
+ left: "left";
700
+ right: "right";
701
+ top: "top";
702
+ bottom: "bottom";
703
+ }>>;
704
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
446
705
  }, z.core.$loose>>;
447
706
  pxWidth: z.ZodNumber;
448
707
  pxHeight: z.ZodNumber;
@@ -451,17 +710,21 @@ export declare const zLayoutCreate: z.ZodObject<{
451
710
  }, z.core.$strip>>>;
452
711
  }, z.core.$loose>;
453
712
  export declare const zFrameCreate: z.ZodObject<{
454
- id: z.ZodOptional<z.ZodUUID>;
455
713
  width: z.ZodOptional<z.ZodNumber>;
456
714
  height: z.ZodOptional<z.ZodNumber>;
457
715
  x: z.ZodOptional<z.ZodNumber>;
458
716
  y: z.ZodOptional<z.ZodNumber>;
717
+ id: z.ZodOptional<z.ZodUUID>;
718
+ docked: z.ZodOptional<z.ZodEnum<{
719
+ left: "left";
720
+ right: "right";
721
+ top: "top";
722
+ bottom: "bottom";
723
+ }>>;
724
+ collapsed: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<false>, z.ZodNumber]>>;
459
725
  }, z.core.$loose>;
460
726
  export type LayoutShapeSquareProps = {
461
727
  css: BaseSquareCss;
462
- style?: StyleValue;
463
- } & /** @vue-ignore */ Omit<HTMLAttributes, "class" | "onFocus"> & {
464
- class?: string;
465
728
  };
466
729
  export type LayoutEdgesProps = {
467
730
  edges: Edge[];
@@ -473,6 +736,12 @@ export type LayoutEdgesProps = {
473
736
  draggingEdge?: Edge;
474
737
  draggingIntersection?: IntersectionEntry;
475
738
  } & Partial<LayoutShapeSquareProps>;
739
+ export type LayoutChange<TInfo = never> = {
740
+ modified: LayoutFrame[];
741
+ created: LayoutFrame[];
742
+ deleted: LayoutFrame[];
743
+ info?: TInfo;
744
+ };
476
745
  export type LayoutFrameProps = {
477
746
  frame: LayoutFrame;
478
747
  isActiveFrame: boolean;