@witchcraft/layout 0.4.4 → 0.5.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 (99) hide show
  1. package/dist/module.json +1 -1
  2. package/dist/runtime/components/FrameDragHandle.vue +3 -3
  3. package/dist/runtime/components/LayoutDragEdgeGrabbed.vue +3 -3
  4. package/dist/runtime/components/LayoutDragEdgeHandle.d.vue.ts +2 -2
  5. package/dist/runtime/components/LayoutDragEdgeHandle.vue +2 -2
  6. package/dist/runtime/components/LayoutDragEdgeHandle.vue.d.ts +2 -2
  7. package/dist/runtime/components/LayoutDragEdges.vue +5 -5
  8. package/dist/runtime/components/LayoutEdgesActiveFrame.vue +2 -2
  9. package/dist/runtime/components/LayoutFrame.vue +2 -2
  10. package/dist/runtime/components/LayoutIntersectionHandle.d.vue.ts +2 -2
  11. package/dist/runtime/components/LayoutIntersectionHandle.vue +2 -2
  12. package/dist/runtime/components/LayoutIntersectionHandle.vue.d.ts +2 -2
  13. package/dist/runtime/components/LayoutIntersections.vue +4 -4
  14. package/dist/runtime/components/LayoutWindow.d.vue.ts +44 -44
  15. package/dist/runtime/components/LayoutWindow.vue +27 -27
  16. package/dist/runtime/components/LayoutWindow.vue.d.ts +44 -44
  17. package/dist/runtime/composables/useFrames.d.ts +107 -109
  18. package/dist/runtime/composables/useFrames.js +107 -99
  19. package/dist/runtime/demo/App.vue +16 -16
  20. package/dist/runtime/demo/DemoControls.d.vue.ts +2 -2
  21. package/dist/runtime/demo/DemoControls.vue +4 -4
  22. package/dist/runtime/demo/DemoControls.vue.d.ts +2 -2
  23. package/dist/runtime/helpers/createZoneSideClipPath.d.ts +2 -2
  24. package/dist/runtime/helpers/{findFrameDraggableEdges.d.ts → findFrameMoveableEdges.d.ts} +2 -2
  25. package/dist/runtime/helpers/{findFrameDraggableEdges.js → findFrameMoveableEdges.js} +3 -3
  26. package/dist/runtime/helpers/{findDraggableEdge.d.ts → findMoveableEdge.d.ts} +1 -1
  27. package/dist/runtime/helpers/{findDraggableEdge.js → findMoveableEdge.js} +1 -1
  28. package/dist/runtime/helpers/index.d.ts +2 -2
  29. package/dist/runtime/helpers/index.js +2 -2
  30. package/dist/runtime/layout/createSplitDecoFromDrag.d.ts +1 -1
  31. package/dist/runtime/layout/createSplitDecoFromDrag.js +2 -2
  32. package/dist/runtime/layout/findSafeSplitEdge.d.ts +1 -1
  33. package/dist/runtime/layout/findSafeSplitEdge.js +2 -2
  34. package/dist/runtime/layout/getCloseFrameInfo.js +4 -4
  35. package/dist/runtime/layout/getFrameRearrangeInfo.d.ts +2 -2
  36. package/dist/runtime/layout/getFrameRearrangeInfo.js +8 -8
  37. package/dist/runtime/layout/getFrameSplitInfo.d.ts +1 -1
  38. package/dist/runtime/layout/getFrameSplitInfo.js +2 -2
  39. package/dist/runtime/layout/{getFrameDragZones.d.ts → getFrameZones.d.ts} +3 -3
  40. package/dist/runtime/layout/{getFrameDragZones.js → getFrameZones.js} +1 -1
  41. package/dist/runtime/layout/{getWindowDragZones.d.ts → getWindowZones.d.ts} +1 -1
  42. package/dist/runtime/layout/{getWindowDragZones.js → getWindowZones.js} +1 -1
  43. package/dist/runtime/layout/getZones.d.ts +8 -0
  44. package/dist/runtime/layout/getZones.js +32 -0
  45. package/dist/runtime/layout/index.d.ts +3 -3
  46. package/dist/runtime/layout/index.js +3 -3
  47. package/dist/runtime/{drag/DragActionHandler.d.ts → move/ActionHandler.d.ts} +19 -21
  48. package/dist/runtime/{drag/DragActionHandler.js → move/ActionHandler.js} +21 -18
  49. package/dist/runtime/{drag → move}/CloseAction.d.ts +9 -8
  50. package/dist/runtime/{drag → move}/CloseAction.js +31 -27
  51. package/dist/runtime/{drag → move}/FrameDragAction.d.ts +9 -8
  52. package/dist/runtime/{drag → move}/FrameDragAction.js +23 -22
  53. package/dist/runtime/{drag/DragDirectionStore.d.ts → move/MoveDirectionStore.d.ts} +4 -4
  54. package/dist/runtime/{drag/DragDirectionStore.js → move/MoveDirectionStore.js} +9 -9
  55. package/dist/runtime/{drag → move}/SplitAction.d.ts +10 -9
  56. package/dist/runtime/{drag → move}/SplitAction.js +53 -44
  57. package/dist/runtime/{drag → move}/createDefaultHandlers.d.ts +2 -2
  58. package/dist/runtime/types/index.d.ts +192 -171
  59. package/dist/runtime/types/index.js +2 -2
  60. package/dist/runtime/types/vue.d.ts +14 -16
  61. package/dist/runtime/types/vue.js +1 -1
  62. package/package.json +1 -1
  63. package/src/runtime/components/FrameDragHandle.vue +3 -3
  64. package/src/runtime/components/LayoutDragEdgeGrabbed.vue +3 -3
  65. package/src/runtime/components/LayoutDragEdgeHandle.vue +4 -4
  66. package/src/runtime/components/LayoutDragEdges.vue +5 -5
  67. package/src/runtime/components/LayoutEdgesActiveFrame.vue +2 -2
  68. package/src/runtime/components/LayoutFrame.vue +2 -2
  69. package/src/runtime/components/LayoutIntersectionHandle.vue +4 -4
  70. package/src/runtime/components/LayoutIntersections.vue +4 -4
  71. package/src/runtime/components/LayoutWindow.vue +32 -32
  72. package/src/runtime/composables/useFrames.ts +115 -104
  73. package/src/runtime/demo/App.vue +18 -18
  74. package/src/runtime/demo/DemoControls.vue +5 -5
  75. package/src/runtime/helpers/createZoneSideClipPath.ts +2 -2
  76. package/src/runtime/helpers/{findFrameDraggableEdges.ts → findFrameMoveableEdges.ts} +4 -4
  77. package/src/runtime/helpers/{findDraggableEdge.ts → findMoveableEdge.ts} +1 -1
  78. package/src/runtime/helpers/index.ts +2 -2
  79. package/src/runtime/layout/createSplitDecoFromDrag.ts +2 -2
  80. package/src/runtime/layout/findSafeSplitEdge.ts +4 -4
  81. package/src/runtime/layout/getCloseFrameInfo.ts +4 -4
  82. package/src/runtime/layout/getFrameRearrangeInfo.ts +10 -10
  83. package/src/runtime/layout/getFrameSplitInfo.ts +5 -5
  84. package/src/runtime/layout/{getFrameDragZones.ts → getFrameZones.ts} +4 -4
  85. package/src/runtime/layout/{getWindowDragZones.ts → getWindowZones.ts} +1 -1
  86. package/src/runtime/layout/getZones.ts +48 -0
  87. package/src/runtime/layout/index.ts +3 -3
  88. package/src/runtime/{drag/DragActionHandler.ts → move/ActionHandler.ts} +48 -41
  89. package/src/runtime/{drag → move}/CloseAction.ts +42 -37
  90. package/src/runtime/{drag → move}/FrameDragAction.ts +37 -36
  91. package/src/runtime/{drag/DragDirectionStore.ts → move/MoveDirectionStore.ts} +10 -10
  92. package/src/runtime/{drag → move}/SplitAction.ts +64 -54
  93. package/src/runtime/{drag → move}/createDefaultHandlers.ts +2 -2
  94. package/src/runtime/types/index.ts +90 -69
  95. package/src/runtime/types/vue.ts +14 -14
  96. package/dist/runtime/layout/getDragZones.d.ts +0 -8
  97. package/dist/runtime/layout/getDragZones.js +0 -32
  98. package/src/runtime/layout/getDragZones.ts +0 -48
  99. /package/dist/runtime/{drag → move}/createDefaultHandlers.js +0 -0
@@ -72,17 +72,17 @@ export declare const zEdge: z.ZodObject<{
72
72
  } | {
73
73
  frame: LayoutFrame;
74
74
  } | {
75
- draggingFrameId: string;
75
+ movingFrameId: string;
76
76
  hoveredFrameId: string;
77
- zoneSide: DragZone["side"];
77
+ zoneSide: Zone["side"];
78
78
  } | {
79
- draggingFrameId: string;
79
+ movingFrameId: string;
80
80
  hoveredFrameId: string;
81
- zoneSide: DragZone["side"];
81
+ zoneSide: Zone["side"];
82
82
  } | {
83
- draggingFrameId: string;
83
+ movingFrameId: string;
84
84
  hoveredFrameId: string;
85
- zoneSide: DragZone["side"];
85
+ zoneSide: Zone["side"];
86
86
  } | {
87
87
  frame: LayoutFrame;
88
88
  } | {
@@ -131,17 +131,17 @@ export declare const zEdge: z.ZodObject<{
131
131
  } | {
132
132
  frame: LayoutFrame;
133
133
  } | {
134
- draggingFrameId: string;
134
+ movingFrameId: string;
135
135
  hoveredFrameId: string;
136
- zoneSide: DragZone["side"];
136
+ zoneSide: Zone["side"];
137
137
  } | {
138
- draggingFrameId: string;
138
+ movingFrameId: string;
139
139
  hoveredFrameId: string;
140
- zoneSide: DragZone["side"];
140
+ zoneSide: Zone["side"];
141
141
  } | {
142
- draggingFrameId: string;
142
+ movingFrameId: string;
143
143
  hoveredFrameId: string;
144
- zoneSide: DragZone["side"];
144
+ zoneSide: Zone["side"];
145
145
  } | {
146
146
  frame: LayoutFrame;
147
147
  } | {
@@ -475,17 +475,17 @@ declare const zLayoutShape: z.ZodDiscriminatedUnion<[z.ZodObject<{
475
475
  } | {
476
476
  frame: LayoutFrame;
477
477
  } | {
478
- draggingFrameId: string;
478
+ movingFrameId: string;
479
479
  hoveredFrameId: string;
480
- zoneSide: DragZone["side"];
480
+ zoneSide: Zone["side"];
481
481
  } | {
482
- draggingFrameId: string;
482
+ movingFrameId: string;
483
483
  hoveredFrameId: string;
484
- zoneSide: DragZone["side"];
484
+ zoneSide: Zone["side"];
485
485
  } | {
486
- draggingFrameId: string;
486
+ movingFrameId: string;
487
487
  hoveredFrameId: string;
488
- zoneSide: DragZone["side"];
488
+ zoneSide: Zone["side"];
489
489
  } | {
490
490
  frame: LayoutFrame;
491
491
  } | {
@@ -534,17 +534,17 @@ declare const zLayoutShape: z.ZodDiscriminatedUnion<[z.ZodObject<{
534
534
  } | {
535
535
  frame: LayoutFrame;
536
536
  } | {
537
- draggingFrameId: string;
537
+ movingFrameId: string;
538
538
  hoveredFrameId: string;
539
- zoneSide: DragZone["side"];
539
+ zoneSide: Zone["side"];
540
540
  } | {
541
- draggingFrameId: string;
541
+ movingFrameId: string;
542
542
  hoveredFrameId: string;
543
- zoneSide: DragZone["side"];
543
+ zoneSide: Zone["side"];
544
544
  } | {
545
- draggingFrameId: string;
545
+ movingFrameId: string;
546
546
  hoveredFrameId: string;
547
- zoneSide: DragZone["side"];
547
+ zoneSide: Zone["side"];
548
548
  } | {
549
549
  frame: LayoutFrame;
550
550
  } | {
@@ -618,17 +618,17 @@ declare const zBaseDeco: z.ZodObject<{
618
618
  } | {
619
619
  frame: LayoutFrame;
620
620
  } | {
621
- draggingFrameId: string;
621
+ movingFrameId: string;
622
622
  hoveredFrameId: string;
623
- zoneSide: DragZone["side"];
623
+ zoneSide: Zone["side"];
624
624
  } | {
625
- draggingFrameId: string;
625
+ movingFrameId: string;
626
626
  hoveredFrameId: string;
627
- zoneSide: DragZone["side"];
627
+ zoneSide: Zone["side"];
628
628
  } | {
629
- draggingFrameId: string;
629
+ movingFrameId: string;
630
630
  hoveredFrameId: string;
631
- zoneSide: DragZone["side"];
631
+ zoneSide: Zone["side"];
632
632
  } | {
633
633
  frame: LayoutFrame;
634
634
  } | {
@@ -677,17 +677,17 @@ declare const zBaseDeco: z.ZodObject<{
677
677
  } | {
678
678
  frame: LayoutFrame;
679
679
  } | {
680
- draggingFrameId: string;
680
+ movingFrameId: string;
681
681
  hoveredFrameId: string;
682
- zoneSide: DragZone["side"];
682
+ zoneSide: Zone["side"];
683
683
  } | {
684
- draggingFrameId: string;
684
+ movingFrameId: string;
685
685
  hoveredFrameId: string;
686
- zoneSide: DragZone["side"];
686
+ zoneSide: Zone["side"];
687
687
  } | {
688
- draggingFrameId: string;
688
+ movingFrameId: string;
689
689
  hoveredFrameId: string;
690
- zoneSide: DragZone["side"];
690
+ zoneSide: Zone["side"];
691
691
  } | {
692
692
  frame: LayoutFrame;
693
693
  } | {
@@ -762,17 +762,17 @@ export declare const zSplitDeco: z.ZodObject<{
762
762
  } | {
763
763
  frame: LayoutFrame;
764
764
  } | {
765
- draggingFrameId: string;
765
+ movingFrameId: string;
766
766
  hoveredFrameId: string;
767
- zoneSide: DragZone["side"];
767
+ zoneSide: Zone["side"];
768
768
  } | {
769
- draggingFrameId: string;
769
+ movingFrameId: string;
770
770
  hoveredFrameId: string;
771
- zoneSide: DragZone["side"];
771
+ zoneSide: Zone["side"];
772
772
  } | {
773
- draggingFrameId: string;
773
+ movingFrameId: string;
774
774
  hoveredFrameId: string;
775
- zoneSide: DragZone["side"];
775
+ zoneSide: Zone["side"];
776
776
  } | {
777
777
  frame: LayoutFrame;
778
778
  } | {
@@ -821,17 +821,17 @@ export declare const zSplitDeco: z.ZodObject<{
821
821
  } | {
822
822
  frame: LayoutFrame;
823
823
  } | {
824
- draggingFrameId: string;
824
+ movingFrameId: string;
825
825
  hoveredFrameId: string;
826
- zoneSide: DragZone["side"];
826
+ zoneSide: Zone["side"];
827
827
  } | {
828
- draggingFrameId: string;
828
+ movingFrameId: string;
829
829
  hoveredFrameId: string;
830
- zoneSide: DragZone["side"];
830
+ zoneSide: Zone["side"];
831
831
  } | {
832
- draggingFrameId: string;
832
+ movingFrameId: string;
833
833
  hoveredFrameId: string;
834
- zoneSide: DragZone["side"];
834
+ zoneSide: Zone["side"];
835
835
  } | {
836
836
  frame: LayoutFrame;
837
837
  } | {
@@ -927,17 +927,17 @@ declare const zCloseDeco: z.ZodObject<{
927
927
  } | {
928
928
  frame: LayoutFrame;
929
929
  } | {
930
- draggingFrameId: string;
930
+ movingFrameId: string;
931
931
  hoveredFrameId: string;
932
- zoneSide: DragZone["side"];
932
+ zoneSide: Zone["side"];
933
933
  } | {
934
- draggingFrameId: string;
934
+ movingFrameId: string;
935
935
  hoveredFrameId: string;
936
- zoneSide: DragZone["side"];
936
+ zoneSide: Zone["side"];
937
937
  } | {
938
- draggingFrameId: string;
938
+ movingFrameId: string;
939
939
  hoveredFrameId: string;
940
- zoneSide: DragZone["side"];
940
+ zoneSide: Zone["side"];
941
941
  } | {
942
942
  frame: LayoutFrame;
943
943
  } | {
@@ -986,17 +986,17 @@ declare const zCloseDeco: z.ZodObject<{
986
986
  } | {
987
987
  frame: LayoutFrame;
988
988
  } | {
989
- draggingFrameId: string;
989
+ movingFrameId: string;
990
990
  hoveredFrameId: string;
991
- zoneSide: DragZone["side"];
991
+ zoneSide: Zone["side"];
992
992
  } | {
993
- draggingFrameId: string;
993
+ movingFrameId: string;
994
994
  hoveredFrameId: string;
995
- zoneSide: DragZone["side"];
995
+ zoneSide: Zone["side"];
996
996
  } | {
997
- draggingFrameId: string;
997
+ movingFrameId: string;
998
998
  hoveredFrameId: string;
999
- zoneSide: DragZone["side"];
999
+ zoneSide: Zone["side"];
1000
1000
  } | {
1001
1001
  frame: LayoutFrame;
1002
1002
  } | {
@@ -1033,7 +1033,7 @@ declare const zCloseDeco: z.ZodObject<{
1033
1033
  force: z.ZodOptional<z.ZodBoolean>;
1034
1034
  }, z.core.$strip>;
1035
1035
  export type CloseDeco = z.infer<typeof zCloseDeco>;
1036
- declare const zFrameDragDeco: z.ZodObject<{
1036
+ declare const zFrameDeco: z.ZodObject<{
1037
1037
  shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1038
1038
  type: z.ZodLiteral<"rect">;
1039
1039
  data: z.ZodObject<{
@@ -1074,17 +1074,17 @@ declare const zFrameDragDeco: z.ZodObject<{
1074
1074
  } | {
1075
1075
  frame: LayoutFrame;
1076
1076
  } | {
1077
- draggingFrameId: string;
1077
+ movingFrameId: string;
1078
1078
  hoveredFrameId: string;
1079
- zoneSide: DragZone["side"];
1079
+ zoneSide: Zone["side"];
1080
1080
  } | {
1081
- draggingFrameId: string;
1081
+ movingFrameId: string;
1082
1082
  hoveredFrameId: string;
1083
- zoneSide: DragZone["side"];
1083
+ zoneSide: Zone["side"];
1084
1084
  } | {
1085
- draggingFrameId: string;
1085
+ movingFrameId: string;
1086
1086
  hoveredFrameId: string;
1087
- zoneSide: DragZone["side"];
1087
+ zoneSide: Zone["side"];
1088
1088
  } | {
1089
1089
  frame: LayoutFrame;
1090
1090
  } | {
@@ -1133,17 +1133,17 @@ declare const zFrameDragDeco: z.ZodObject<{
1133
1133
  } | {
1134
1134
  frame: LayoutFrame;
1135
1135
  } | {
1136
- draggingFrameId: string;
1136
+ movingFrameId: string;
1137
1137
  hoveredFrameId: string;
1138
- zoneSide: DragZone["side"];
1138
+ zoneSide: Zone["side"];
1139
1139
  } | {
1140
- draggingFrameId: string;
1140
+ movingFrameId: string;
1141
1141
  hoveredFrameId: string;
1142
- zoneSide: DragZone["side"];
1142
+ zoneSide: Zone["side"];
1143
1143
  } | {
1144
- draggingFrameId: string;
1144
+ movingFrameId: string;
1145
1145
  hoveredFrameId: string;
1146
- zoneSide: DragZone["side"];
1146
+ zoneSide: Zone["side"];
1147
1147
  } | {
1148
1148
  frame: LayoutFrame;
1149
1149
  } | {
@@ -1186,7 +1186,7 @@ declare const zFrameDragDeco: z.ZodObject<{
1186
1186
  center: "center";
1187
1187
  }>]>;
1188
1188
  }, z.core.$strip>;
1189
- export type FrameDragDeco = z.infer<typeof zFrameDragDeco>;
1189
+ export type FrameDeco = z.infer<typeof zFrameDeco>;
1190
1190
  export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1191
1191
  shapes: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1192
1192
  type: z.ZodLiteral<"rect">;
@@ -1228,17 +1228,17 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1228
1228
  } | {
1229
1229
  frame: LayoutFrame;
1230
1230
  } | {
1231
- draggingFrameId: string;
1231
+ movingFrameId: string;
1232
1232
  hoveredFrameId: string;
1233
- zoneSide: DragZone["side"];
1233
+ zoneSide: Zone["side"];
1234
1234
  } | {
1235
- draggingFrameId: string;
1235
+ movingFrameId: string;
1236
1236
  hoveredFrameId: string;
1237
- zoneSide: DragZone["side"];
1237
+ zoneSide: Zone["side"];
1238
1238
  } | {
1239
- draggingFrameId: string;
1239
+ movingFrameId: string;
1240
1240
  hoveredFrameId: string;
1241
- zoneSide: DragZone["side"];
1241
+ zoneSide: Zone["side"];
1242
1242
  } | {
1243
1243
  frame: LayoutFrame;
1244
1244
  } | {
@@ -1287,17 +1287,17 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1287
1287
  } | {
1288
1288
  frame: LayoutFrame;
1289
1289
  } | {
1290
- draggingFrameId: string;
1290
+ movingFrameId: string;
1291
1291
  hoveredFrameId: string;
1292
- zoneSide: DragZone["side"];
1292
+ zoneSide: Zone["side"];
1293
1293
  } | {
1294
- draggingFrameId: string;
1294
+ movingFrameId: string;
1295
1295
  hoveredFrameId: string;
1296
- zoneSide: DragZone["side"];
1296
+ zoneSide: Zone["side"];
1297
1297
  } | {
1298
- draggingFrameId: string;
1298
+ movingFrameId: string;
1299
1299
  hoveredFrameId: string;
1300
- zoneSide: DragZone["side"];
1300
+ zoneSide: Zone["side"];
1301
1301
  } | {
1302
1302
  frame: LayoutFrame;
1303
1303
  } | {
@@ -1379,17 +1379,17 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1379
1379
  } | {
1380
1380
  frame: LayoutFrame;
1381
1381
  } | {
1382
- draggingFrameId: string;
1382
+ movingFrameId: string;
1383
1383
  hoveredFrameId: string;
1384
- zoneSide: DragZone["side"];
1384
+ zoneSide: Zone["side"];
1385
1385
  } | {
1386
- draggingFrameId: string;
1386
+ movingFrameId: string;
1387
1387
  hoveredFrameId: string;
1388
- zoneSide: DragZone["side"];
1388
+ zoneSide: Zone["side"];
1389
1389
  } | {
1390
- draggingFrameId: string;
1390
+ movingFrameId: string;
1391
1391
  hoveredFrameId: string;
1392
- zoneSide: DragZone["side"];
1392
+ zoneSide: Zone["side"];
1393
1393
  } | {
1394
1394
  frame: LayoutFrame;
1395
1395
  } | {
@@ -1438,17 +1438,17 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1438
1438
  } | {
1439
1439
  frame: LayoutFrame;
1440
1440
  } | {
1441
- draggingFrameId: string;
1441
+ movingFrameId: string;
1442
1442
  hoveredFrameId: string;
1443
- zoneSide: DragZone["side"];
1443
+ zoneSide: Zone["side"];
1444
1444
  } | {
1445
- draggingFrameId: string;
1445
+ movingFrameId: string;
1446
1446
  hoveredFrameId: string;
1447
- zoneSide: DragZone["side"];
1447
+ zoneSide: Zone["side"];
1448
1448
  } | {
1449
- draggingFrameId: string;
1449
+ movingFrameId: string;
1450
1450
  hoveredFrameId: string;
1451
- zoneSide: DragZone["side"];
1451
+ zoneSide: Zone["side"];
1452
1452
  } | {
1453
1453
  frame: LayoutFrame;
1454
1454
  } | {
@@ -1524,17 +1524,17 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1524
1524
  } | {
1525
1525
  frame: LayoutFrame;
1526
1526
  } | {
1527
- draggingFrameId: string;
1527
+ movingFrameId: string;
1528
1528
  hoveredFrameId: string;
1529
- zoneSide: DragZone["side"];
1529
+ zoneSide: Zone["side"];
1530
1530
  } | {
1531
- draggingFrameId: string;
1531
+ movingFrameId: string;
1532
1532
  hoveredFrameId: string;
1533
- zoneSide: DragZone["side"];
1533
+ zoneSide: Zone["side"];
1534
1534
  } | {
1535
- draggingFrameId: string;
1535
+ movingFrameId: string;
1536
1536
  hoveredFrameId: string;
1537
- zoneSide: DragZone["side"];
1537
+ zoneSide: Zone["side"];
1538
1538
  } | {
1539
1539
  frame: LayoutFrame;
1540
1540
  } | {
@@ -1583,17 +1583,17 @@ export declare const zDeco: z.ZodUnion<readonly [z.ZodObject<{
1583
1583
  } | {
1584
1584
  frame: LayoutFrame;
1585
1585
  } | {
1586
- draggingFrameId: string;
1586
+ movingFrameId: string;
1587
1587
  hoveredFrameId: string;
1588
- zoneSide: DragZone["side"];
1588
+ zoneSide: Zone["side"];
1589
1589
  } | {
1590
- draggingFrameId: string;
1590
+ movingFrameId: string;
1591
1591
  hoveredFrameId: string;
1592
- zoneSide: DragZone["side"];
1592
+ zoneSide: Zone["side"];
1593
1593
  } | {
1594
- draggingFrameId: string;
1594
+ movingFrameId: string;
1595
1595
  hoveredFrameId: string;
1596
- zoneSide: DragZone["side"];
1596
+ zoneSide: Zone["side"];
1597
1597
  } | {
1598
1598
  frame: LayoutFrame;
1599
1599
  } | {
@@ -1703,19 +1703,19 @@ export type LayoutErrorsInfo = {
1703
1703
  frame: LayoutFrame;
1704
1704
  };
1705
1705
  [LAYOUT_ERROR.CANT_REARRANGE_TO_SAME_RELATIVE_POSITION]: {
1706
- draggingFrameId: string;
1706
+ movingFrameId: string;
1707
1707
  hoveredFrameId: string;
1708
- zoneSide: DragZone["side"];
1708
+ zoneSide: Zone["side"];
1709
1709
  };
1710
1710
  [LAYOUT_ERROR.CANT_REARRANGE_WITH_DOCKED_EDGES]: {
1711
- draggingFrameId: string;
1711
+ movingFrameId: string;
1712
1712
  hoveredFrameId: string;
1713
- zoneSide: DragZone["side"];
1713
+ zoneSide: Zone["side"];
1714
1714
  };
1715
1715
  [LAYOUT_ERROR.CANT_REARRANGE_DOCKED_WITH_NON_DOCKED]: {
1716
- draggingFrameId: string;
1716
+ movingFrameId: string;
1717
1717
  hoveredFrameId: string;
1718
- zoneSide: DragZone["side"];
1718
+ zoneSide: Zone["side"];
1719
1719
  };
1720
1720
  [LAYOUT_ERROR.CANT_SPLIT_DOCKED_FRAME]: {
1721
1721
  frame: LayoutFrame;
@@ -1755,7 +1755,7 @@ export type LayoutErrorsInfo = {
1755
1755
  };
1756
1756
  };
1757
1757
  export type HasOpposite = Direction | EdgeSide | ExtendedDirection | ExtendedEdgeSide | keyof Point | keyof Size;
1758
- export type BaseDragZone = {
1758
+ export type BaseZone = {
1759
1759
  x: number;
1760
1760
  y: number;
1761
1761
  width: number;
@@ -1763,15 +1763,15 @@ export type BaseDragZone = {
1763
1763
  pxWidth: number;
1764
1764
  pxHeight: number;
1765
1765
  };
1766
- export type FrameDragZone = BaseDragZone & {
1766
+ export type FrameZone = BaseZone & {
1767
1767
  type: "frame";
1768
1768
  side: EdgeSide | "center";
1769
1769
  };
1770
- export type WindowEdgeZone = BaseDragZone & {
1770
+ export type WindowEdgeZone = BaseZone & {
1771
1771
  type: "window";
1772
1772
  side: EdgeSide;
1773
1773
  };
1774
- export type DragZone = FrameDragZone | WindowEdgeZone;
1774
+ export type Zone = FrameZone | WindowEdgeZone;
1775
1775
  export declare const zWindowCreate: z.ZodObject<{
1776
1776
  id: z.ZodOptional<z.ZodUUID>;
1777
1777
  activeFrame: z.ZodOptional<z.ZodString>;
@@ -1843,33 +1843,33 @@ export type LayoutChange<TInfo = never> = {
1843
1843
  window?: Partial<LayoutWindow>;
1844
1844
  info?: TInfo;
1845
1845
  };
1846
- export type DragState = {
1846
+ export type MoveState = {
1847
1847
  /** The current directions in the corresponding orientations that the user is dragging in. */
1848
- dragDirections: Record<Orientation, Direction | undefined>;
1848
+ moveDirections: Record<Orientation, Direction | undefined>;
1849
1849
  /** The curren point (in scaled window coordinates) the user is dragging at. */
1850
- dragPoint?: Point;
1850
+ movePoint?: Point;
1851
1851
  /** Cumulative pixel distance the user has dragged from the initial click point. 0 on start, increases on each move. */
1852
- dragDistance: number;
1852
+ moveDistance: number;
1853
1853
  /** Whether the user is currently dragging and what type of drag. Is truthy string during all drag events. */
1854
- isDragging: boolean | "frame" | "edge";
1854
+ isMoving: boolean | "frame" | "edge";
1855
1855
  /** Whether to show the moved frames while dragging. */
1856
- showDragging: boolean;
1857
- /** The frame being dragged during a frame drag. Only set when isDragging is "frame". */
1858
- draggingFrameId?: FrameId;
1856
+ showMoving: boolean;
1857
+ /** The frame being dragged during a frame drag. Only set when isMoving is "frame". */
1858
+ movingFrameId?: FrameId;
1859
1859
  /**
1860
1860
  * The edges that are currently being dragged. There are multiple edges if they drag an intersection since what's actually happening is we're just dragging the closest horizontal and vertical edges.
1861
1861
  */
1862
- draggingEdges: Edge[];
1862
+ movingEdges: Edge[];
1863
1863
  /**
1864
1864
  * The intersection that is currently being dragged.
1865
1865
  */
1866
- draggingIntersection?: IntersectionEntry;
1866
+ movingIntersection?: IntersectionEntry;
1867
1867
  /** The "visual" edges that can be displayed for dragging. See {@link getVisualEdges} */
1868
1868
  visualEdges: Edge[];
1869
1869
  /**
1870
1870
  * The frames touching the currently dragged edges. Each entry corresponds to the frames touching the corresponding dragging edge.
1871
1871
  *
1872
- * So you can use the index in draggingEdges to get the corresponding frames.
1872
+ * So you can use the index in movingEdges to get the corresponding frames.
1873
1873
  */
1874
1874
  touchingFrames: Record<string, LayoutFrame>[];
1875
1875
  /**
@@ -1877,13 +1877,13 @@ export type DragState = {
1877
1877
  */
1878
1878
  touchingFramesArrays: LayoutFrame[][];
1879
1879
  /**
1880
- * All the frames, with/without the currently dragged frames depending on if `showDragging` is true.
1880
+ * All the frames, with/without the currently dragged frames depending on if `showMoving` is true.
1881
1881
  */
1882
1882
  frames: Record<string, LayoutFrame>;
1883
1883
  /**
1884
- * The frame that is currently being hovered over (according to whether `dragPoint` in in the frame or not).
1884
+ * The frame that is currently being hovered over (according to whether `movePoint` in in the frame or not).
1885
1885
  */
1886
- dragHoveredFrame: LayoutFrame | undefined;
1886
+ moveHoveredFrame: LayoutFrame | undefined;
1887
1887
  /**
1888
1888
  * A list of corner intersections. Frames can also be dragged by these.
1889
1889
  */
@@ -1891,28 +1891,39 @@ export type DragState = {
1891
1891
  /**
1892
1892
  * Whether the drag was initiated from a point along the window edge.
1893
1893
  */
1894
- isDraggingFromWindowEdge: boolean;
1895
- /** Custom context passed to dragStart, available to action handlers via state.eventContext. */
1894
+ isMovingFromWindowEdge: boolean;
1895
+ /** Custom context passed to moveStart, available to action handlers via state.eventContext. */
1896
1896
  eventContext?: Record<string, unknown>;
1897
1897
  win: LayoutWindow;
1898
1898
  };
1899
- export interface ActionDragChangeResult {
1899
+ export interface ActionChangeResult {
1900
1900
  /** Whether the drag should update the edges. Defaults to false. */
1901
1901
  updateEdges?: boolean;
1902
1902
  /** Deco shapes produced by this action during this drag step. */
1903
1903
  shapes: LayoutShape[];
1904
1904
  /** Whether to show the moved edges while dragging. Defaults to true. */
1905
- showDragging?: boolean;
1905
+ showMoving?: boolean;
1906
1906
  }
1907
- export type DragChangeResult = Omit<ActionDragChangeResult, "shapes">;
1907
+ export type MoveChangeResult = Omit<ActionChangeResult, "shapes">;
1908
1908
  /**
1909
1909
  * Called when the drag coordinates change (during any event).
1910
1910
  *
1911
1911
  * Should return `{ allowed: true/false, shapes: LayoutShape[] }` to control whether the action is allowed and edges update and what deco shapes to render.
1912
1912
  *
1913
1913
  * Note that the allowed return type only affect the `move` event but is also typed as `boolean` for other events for ease of use.
1914
+ *
1915
+ * Use also to cleanup your action when type is "end".
1916
+ *
1917
+ * See also {@link ActionHandler.onMoveChange} to understand it's lifecycle as it is the extended version of.
1914
1918
  */
1915
- export type DragChangeHandler = <T extends "start" | "move" | "end">(type: T, e: T extends "end" ? PointerEvent | undefined : PointerEvent, state: DragState, forceRecalculateEdges: () => void, cancel: (e: PointerEvent | KeyboardEvent | undefined, state: DragState) => void) => ActionDragChangeResult;
1919
+ export type MoveChangeHandler = <T extends "start" | "move" | "end">(type: T, e: T extends "end" ? PointerEvent | undefined : PointerEvent, state: MoveState, forceRecalculateEdges: () => void,
1920
+ /** Calls moveEnd with apply: false. This can technically be called from "end", it should still work. */
1921
+ cancel: (e: PointerEvent | KeyboardEvent | undefined, state: MoveState) => void,
1922
+ /** Saves result to resolve moveStart promise with then calls moveEnd with given apply. Not available during "end" event. It's designed for resolving from other external evente (e.g. key events). */
1923
+ resolve: T extends "end" ? undefined : ({ apply, result }: {
1924
+ apply: boolean;
1925
+ result: any;
1926
+ }) => void) => ActionChangeResult;
1916
1927
  /**
1917
1928
  * A drag action describes when and how to handle a drag event.
1918
1929
  *
@@ -1920,19 +1931,21 @@ export type DragChangeHandler = <T extends "start" | "move" | "end">(type: T, e:
1920
1931
  *
1921
1932
  * Each action should handle it's configuration and saving/caching any state it needs. See {@link SplitAction} and {@link CloseAction} for examples.
1922
1933
  */
1923
- export interface IDragAction {
1934
+ export interface IAction {
1924
1935
  /** A unique name for your action. */
1925
1936
  name: string;
1926
- onDragChange: DragChangeHandler;
1937
+ onMoveChange: MoveChangeHandler;
1927
1938
  /**
1928
1939
  *
1929
- * Is called after `onDragChange("end")` with the same event. Might not be called if the request was cancelled.
1940
+ * Is called before `onMoveChange("end")` with the same event. Might not be called if the request was cancelled.
1930
1941
  *
1931
1942
  * You should apply your action if possible and return whether it was applied.
1932
1943
  *
1933
- * This is also a good place to reset your state.
1944
+ * Do not reset state here, use onMoveChange ("end").
1945
+ *
1946
+ * See also {@link ActionHandler.onMoveApply} which this is the extended version of.
1934
1947
  */
1935
- onDragApply: (state: DragState, forceRecalculateEdges: () => void) => boolean;
1948
+ onMoveApply: (state: MoveState, forceRecalculateEdges: () => void) => boolean;
1936
1949
  /**
1937
1950
  * Should return true if it should handle the "request"/event (e.g. some modifier is being pressed => user is requesting x action).
1938
1951
  *
@@ -1940,20 +1953,14 @@ export interface IDragAction {
1940
1953
  *
1941
1954
  * Here is where you should initiate your state. Don't allow the action by default unless it can always be allowed.
1942
1955
  */
1943
- canHandleRequest(e: KeyboardEvent | PointerEvent, state: DragState, forceRecalculateEdges: () => void): boolean;
1944
- /**
1945
- * Called when a user cancels the drag action.
1946
- *
1947
- * You should reset your state here.
1948
- */
1949
- cancel(e: PointerEvent | KeyboardEvent | undefined, state: DragState): void;
1956
+ canHandleRequest(e: KeyboardEvent | PointerEvent, state: MoveState, forceRecalculateEdges: () => void): boolean;
1950
1957
  /**
1951
- * Plugins should implement some basic debug logs by calling {@link DragActionHandler.debugState } at least before and after applying actions in onDragApply. Debug can be a string because it can be an object key to filter on (see the debugState function).
1958
+ * Plugins should implement some basic debug logs by calling {@link ActionHandler.debugState } at least before and after applying actions in onMoveApply. Debug can be a string because it can be an object key to filter on (see the debugState function).
1952
1959
  *
1953
1960
  *
1954
1961
  * Calls look like this usually, where this.state is the plugin state:
1955
1962
  * ```ts
1956
- * DragActionHandler.debugState(this.name, "before", state, this.state, this.debug)
1963
+ * ActionHandler.debugState(this.name, "before", state, this.state, this.debug)
1957
1964
  * ```
1958
1965
  */
1959
1966
  debug: boolean | string;
@@ -1970,6 +1977,10 @@ export interface IDragAction {
1970
1977
  /** Error texts/hints to display when the action produces an error. */
1971
1978
  errors?: string[];
1972
1979
  };
1980
+ /**
1981
+ * Called when an action is cancelled. Call action specific onCancel hooks here.
1982
+ */
1983
+ cancel(e: PointerEvent | KeyboardEvent | undefined, state: MoveState): void;
1973
1984
  /**
1974
1985
  * Called after visual edges are recalculated, once per edge. Action handlers can annotate edges with error info here ({@link Edge.error}).
1975
1986
  *
@@ -1991,43 +2002,53 @@ export interface IDragAction {
1991
2002
  */
1992
2003
  annotateEdge?(edge: Edge, frames: LayoutFrame[]): void;
1993
2004
  }
1994
- export type EdgeDragStartData = {
2005
+ export type EdgeMoveStartData = {
1995
2006
  edge?: Edge;
1996
2007
  intersection?: IntersectionEntry;
1997
2008
  };
1998
- export type FrameDragStartData = {
2009
+ export type FrameMoveStartData = {
1999
2010
  frameId: FrameId;
2000
2011
  };
2012
+ export type ActionHandlerApplyResult = {
2013
+ /** Whether to apply the regular drag end changes. Return false to reset to the position before dragging. */
2014
+ apply: boolean;
2015
+ /** Value to resolve the drag promise with. Ignored if `apply` is false. */
2016
+ result: any;
2017
+ };
2001
2018
  /**
2002
2019
  * Handler interface for drag actions.
2003
2020
  */
2004
2021
  export interface ActionHandler {
2005
- eventHandler: (e: KeyboardEvent, state: DragState, forceRecalculateEdges: () => void) => void;
2022
+ eventHandler: (e: KeyboardEvent, state: MoveState, forceRecalculateEdges: () => void) => void;
2006
2023
  /**
2007
- * Called when the drag coordinates change (during any event). Should return true to allow the edges to be updated/moved, or false to prevent it.
2024
+ * Called when the drag coordinates change (during any event). Should return true to allow the edges to be updated/moved, or false to prevent it. See also {@link MoveChangeHandler} for the built in action handler.
2008
2025
  *
2009
- * Can return anything for the end event as it's ignored.
2026
+ * Can be used to save some context/info to later apply safely during onMoveApply.
2010
2027
  *
2011
- * Can be used to save some context/info to later apply safely during onDragApply.
2028
+ * The call order is:
2029
+ * - onMoveChange("start", ...)
2030
+ * - onMoveChange("move", ...)
2031
+ * - onMoveChange("end", ...)
2032
+ * - onMoveApply(...) (IF moveEnd was called with apply: true, otherwise this is skipped)
2033
+ * - onMoveEnded() // do cleanup here
2012
2034
  */
2013
- onDragChange: (...args: Parameters<DragChangeHandler>) => DragChangeResult;
2035
+ onMoveChange: (...args: Parameters<MoveChangeHandler>) => MoveChangeResult;
2014
2036
  /**
2015
- * Called when drag will be applied. If dragEnd was called with apply false, it will not be called.
2037
+ * Called when drag will be applied. If moveEnd was called with apply false, it will not be called.
2016
2038
  * Return false to not apply the regular drag end changes (i.e. return false to reset to the position before dragging).
2039
+ *
2040
+ * Do not use for resetting handler state, use onMoveEnded for that.
2017
2041
  */
2018
- onDragApply: (state: DragState, forceRecalculateEdges: () => void) => {
2019
- /** Whether to apply the regular drag end changes. Return false to reset to the position before dragging. */
2020
- apply: boolean;
2021
- /** Value to resolve the drag promise with. Ignored if `apply` is false. */
2022
- result: any;
2023
- };
2042
+ onMoveApply: (state: MoveState, forceRecalculateEdges: () => void) => ActionHandlerApplyResult;
2043
+ /** For doing cleanup */
2044
+ onMoveEnded: () => void;
2024
2045
  /**
2025
2046
  * Called after visual edges are recalculated. Action handlers can annotate edges with error info.
2026
2047
  */
2027
2048
  annotateEdges?: (edges: Edge[], frames: LayoutFrame[]) => void;
2028
2049
  }
2029
- export type DragStartFn = {
2030
- (e: PointerEvent, type: "edge", data: EdgeDragStartData): void;
2031
- (e: PointerEvent, type: "frame", data: FrameDragStartData): void;
2050
+ export type MoveStartFn = {
2051
+ (e: PointerEvent, type: "edge", data: EdgeMoveStartData): void;
2052
+ (e: PointerEvent, type: "frame", data: FrameMoveStartData): void;
2032
2053
  };
2033
2054
  export type * from "./vue.js";