@witchcraft/layout 0.4.4 → 0.5.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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/FrameDragHandle.vue +3 -3
- package/dist/runtime/components/LayoutDragEdgeGrabbed.vue +3 -3
- package/dist/runtime/components/LayoutDragEdgeHandle.d.vue.ts +2 -2
- package/dist/runtime/components/LayoutDragEdgeHandle.vue +2 -2
- package/dist/runtime/components/LayoutDragEdgeHandle.vue.d.ts +2 -2
- package/dist/runtime/components/LayoutDragEdges.vue +5 -5
- package/dist/runtime/components/LayoutEdgesActiveFrame.vue +2 -2
- package/dist/runtime/components/LayoutFrame.vue +2 -2
- package/dist/runtime/components/LayoutIntersectionHandle.d.vue.ts +2 -2
- package/dist/runtime/components/LayoutIntersectionHandle.vue +2 -2
- package/dist/runtime/components/LayoutIntersectionHandle.vue.d.ts +2 -2
- package/dist/runtime/components/LayoutIntersections.vue +4 -4
- package/dist/runtime/components/LayoutWindow.d.vue.ts +44 -44
- package/dist/runtime/components/LayoutWindow.vue +27 -27
- package/dist/runtime/components/LayoutWindow.vue.d.ts +44 -44
- package/dist/runtime/composables/useFrames.d.ts +107 -109
- package/dist/runtime/composables/useFrames.js +103 -99
- package/dist/runtime/demo/App.vue +16 -16
- package/dist/runtime/demo/DemoControls.d.vue.ts +2 -2
- package/dist/runtime/demo/DemoControls.vue +4 -4
- package/dist/runtime/demo/DemoControls.vue.d.ts +2 -2
- package/dist/runtime/helpers/createZoneSideClipPath.d.ts +2 -2
- package/dist/runtime/helpers/{findFrameDraggableEdges.d.ts → findFrameMoveableEdges.d.ts} +2 -2
- package/dist/runtime/helpers/{findFrameDraggableEdges.js → findFrameMoveableEdges.js} +3 -3
- package/dist/runtime/helpers/{findDraggableEdge.d.ts → findMoveableEdge.d.ts} +1 -1
- package/dist/runtime/helpers/{findDraggableEdge.js → findMoveableEdge.js} +1 -1
- package/dist/runtime/helpers/index.d.ts +2 -2
- package/dist/runtime/helpers/index.js +2 -2
- package/dist/runtime/layout/createSplitDecoFromDrag.d.ts +1 -1
- package/dist/runtime/layout/createSplitDecoFromDrag.js +2 -2
- package/dist/runtime/layout/findSafeSplitEdge.d.ts +1 -1
- package/dist/runtime/layout/findSafeSplitEdge.js +2 -2
- package/dist/runtime/layout/getCloseFrameInfo.js +4 -4
- package/dist/runtime/layout/getFrameRearrangeInfo.d.ts +2 -2
- package/dist/runtime/layout/getFrameRearrangeInfo.js +8 -8
- package/dist/runtime/layout/getFrameSplitInfo.d.ts +1 -1
- package/dist/runtime/layout/getFrameSplitInfo.js +2 -2
- package/dist/runtime/layout/{getFrameDragZones.d.ts → getFrameZones.d.ts} +3 -3
- package/dist/runtime/layout/{getFrameDragZones.js → getFrameZones.js} +1 -1
- package/dist/runtime/layout/{getWindowDragZones.d.ts → getWindowZones.d.ts} +1 -1
- package/dist/runtime/layout/{getWindowDragZones.js → getWindowZones.js} +1 -1
- package/dist/runtime/layout/getZones.d.ts +8 -0
- package/dist/runtime/layout/getZones.js +32 -0
- package/dist/runtime/layout/index.d.ts +3 -3
- package/dist/runtime/layout/index.js +3 -3
- package/dist/runtime/{drag/DragActionHandler.d.ts → move/ActionHandler.d.ts} +18 -21
- package/dist/runtime/{drag/DragActionHandler.js → move/ActionHandler.js} +17 -17
- package/dist/runtime/{drag → move}/CloseAction.d.ts +8 -8
- package/dist/runtime/{drag → move}/CloseAction.js +29 -26
- package/dist/runtime/{drag → move}/FrameDragAction.d.ts +8 -8
- package/dist/runtime/{drag → move}/FrameDragAction.js +23 -21
- package/dist/runtime/{drag/DragDirectionStore.d.ts → move/MoveDirectionStore.d.ts} +4 -4
- package/dist/runtime/{drag/DragDirectionStore.js → move/MoveDirectionStore.js} +9 -9
- package/dist/runtime/{drag → move}/SplitAction.d.ts +9 -9
- package/dist/runtime/{drag → move}/SplitAction.js +46 -43
- package/dist/runtime/{drag → move}/createDefaultHandlers.d.ts +2 -2
- package/dist/runtime/types/index.d.ts +185 -171
- package/dist/runtime/types/index.js +2 -2
- package/dist/runtime/types/vue.d.ts +14 -16
- package/dist/runtime/types/vue.js +1 -1
- package/package.json +1 -1
- package/src/runtime/components/FrameDragHandle.vue +3 -3
- package/src/runtime/components/LayoutDragEdgeGrabbed.vue +3 -3
- package/src/runtime/components/LayoutDragEdgeHandle.vue +4 -4
- package/src/runtime/components/LayoutDragEdges.vue +5 -5
- package/src/runtime/components/LayoutEdgesActiveFrame.vue +2 -2
- package/src/runtime/components/LayoutFrame.vue +2 -2
- package/src/runtime/components/LayoutIntersectionHandle.vue +4 -4
- package/src/runtime/components/LayoutIntersections.vue +4 -4
- package/src/runtime/components/LayoutWindow.vue +32 -32
- package/src/runtime/composables/useFrames.ts +108 -102
- package/src/runtime/demo/App.vue +18 -18
- package/src/runtime/demo/DemoControls.vue +5 -5
- package/src/runtime/helpers/createZoneSideClipPath.ts +2 -2
- package/src/runtime/helpers/{findFrameDraggableEdges.ts → findFrameMoveableEdges.ts} +4 -4
- package/src/runtime/helpers/{findDraggableEdge.ts → findMoveableEdge.ts} +1 -1
- package/src/runtime/helpers/index.ts +2 -2
- package/src/runtime/layout/createSplitDecoFromDrag.ts +2 -2
- package/src/runtime/layout/findSafeSplitEdge.ts +4 -4
- package/src/runtime/layout/getCloseFrameInfo.ts +4 -4
- package/src/runtime/layout/getFrameRearrangeInfo.ts +10 -10
- package/src/runtime/layout/getFrameSplitInfo.ts +5 -5
- package/src/runtime/layout/{getFrameDragZones.ts → getFrameZones.ts} +4 -4
- package/src/runtime/layout/{getWindowDragZones.ts → getWindowZones.ts} +1 -1
- package/src/runtime/layout/getZones.ts +48 -0
- package/src/runtime/layout/index.ts +3 -3
- package/src/runtime/{drag/DragActionHandler.ts → move/ActionHandler.ts} +42 -40
- package/src/runtime/{drag → move}/CloseAction.ts +39 -36
- package/src/runtime/{drag → move}/FrameDragAction.ts +36 -35
- package/src/runtime/{drag/DragDirectionStore.ts → move/MoveDirectionStore.ts} +10 -10
- package/src/runtime/{drag → move}/SplitAction.ts +56 -53
- package/src/runtime/{drag → move}/createDefaultHandlers.ts +2 -2
- package/src/runtime/types/index.ts +80 -69
- package/src/runtime/types/vue.ts +14 -14
- package/dist/runtime/layout/getDragZones.d.ts +0 -8
- package/dist/runtime/layout/getDragZones.js +0 -32
- package/src/runtime/layout/getDragZones.ts +0 -48
- /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
|
-
|
|
75
|
+
movingFrameId: string;
|
|
76
76
|
hoveredFrameId: string;
|
|
77
|
-
zoneSide:
|
|
77
|
+
zoneSide: Zone["side"];
|
|
78
78
|
} | {
|
|
79
|
-
|
|
79
|
+
movingFrameId: string;
|
|
80
80
|
hoveredFrameId: string;
|
|
81
|
-
zoneSide:
|
|
81
|
+
zoneSide: Zone["side"];
|
|
82
82
|
} | {
|
|
83
|
-
|
|
83
|
+
movingFrameId: string;
|
|
84
84
|
hoveredFrameId: string;
|
|
85
|
-
zoneSide:
|
|
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
|
-
|
|
134
|
+
movingFrameId: string;
|
|
135
135
|
hoveredFrameId: string;
|
|
136
|
-
zoneSide:
|
|
136
|
+
zoneSide: Zone["side"];
|
|
137
137
|
} | {
|
|
138
|
-
|
|
138
|
+
movingFrameId: string;
|
|
139
139
|
hoveredFrameId: string;
|
|
140
|
-
zoneSide:
|
|
140
|
+
zoneSide: Zone["side"];
|
|
141
141
|
} | {
|
|
142
|
-
|
|
142
|
+
movingFrameId: string;
|
|
143
143
|
hoveredFrameId: string;
|
|
144
|
-
zoneSide:
|
|
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
|
-
|
|
478
|
+
movingFrameId: string;
|
|
479
479
|
hoveredFrameId: string;
|
|
480
|
-
zoneSide:
|
|
480
|
+
zoneSide: Zone["side"];
|
|
481
481
|
} | {
|
|
482
|
-
|
|
482
|
+
movingFrameId: string;
|
|
483
483
|
hoveredFrameId: string;
|
|
484
|
-
zoneSide:
|
|
484
|
+
zoneSide: Zone["side"];
|
|
485
485
|
} | {
|
|
486
|
-
|
|
486
|
+
movingFrameId: string;
|
|
487
487
|
hoveredFrameId: string;
|
|
488
|
-
zoneSide:
|
|
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
|
-
|
|
537
|
+
movingFrameId: string;
|
|
538
538
|
hoveredFrameId: string;
|
|
539
|
-
zoneSide:
|
|
539
|
+
zoneSide: Zone["side"];
|
|
540
540
|
} | {
|
|
541
|
-
|
|
541
|
+
movingFrameId: string;
|
|
542
542
|
hoveredFrameId: string;
|
|
543
|
-
zoneSide:
|
|
543
|
+
zoneSide: Zone["side"];
|
|
544
544
|
} | {
|
|
545
|
-
|
|
545
|
+
movingFrameId: string;
|
|
546
546
|
hoveredFrameId: string;
|
|
547
|
-
zoneSide:
|
|
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
|
-
|
|
621
|
+
movingFrameId: string;
|
|
622
622
|
hoveredFrameId: string;
|
|
623
|
-
zoneSide:
|
|
623
|
+
zoneSide: Zone["side"];
|
|
624
624
|
} | {
|
|
625
|
-
|
|
625
|
+
movingFrameId: string;
|
|
626
626
|
hoveredFrameId: string;
|
|
627
|
-
zoneSide:
|
|
627
|
+
zoneSide: Zone["side"];
|
|
628
628
|
} | {
|
|
629
|
-
|
|
629
|
+
movingFrameId: string;
|
|
630
630
|
hoveredFrameId: string;
|
|
631
|
-
zoneSide:
|
|
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
|
-
|
|
680
|
+
movingFrameId: string;
|
|
681
681
|
hoveredFrameId: string;
|
|
682
|
-
zoneSide:
|
|
682
|
+
zoneSide: Zone["side"];
|
|
683
683
|
} | {
|
|
684
|
-
|
|
684
|
+
movingFrameId: string;
|
|
685
685
|
hoveredFrameId: string;
|
|
686
|
-
zoneSide:
|
|
686
|
+
zoneSide: Zone["side"];
|
|
687
687
|
} | {
|
|
688
|
-
|
|
688
|
+
movingFrameId: string;
|
|
689
689
|
hoveredFrameId: string;
|
|
690
|
-
zoneSide:
|
|
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
|
-
|
|
765
|
+
movingFrameId: string;
|
|
766
766
|
hoveredFrameId: string;
|
|
767
|
-
zoneSide:
|
|
767
|
+
zoneSide: Zone["side"];
|
|
768
768
|
} | {
|
|
769
|
-
|
|
769
|
+
movingFrameId: string;
|
|
770
770
|
hoveredFrameId: string;
|
|
771
|
-
zoneSide:
|
|
771
|
+
zoneSide: Zone["side"];
|
|
772
772
|
} | {
|
|
773
|
-
|
|
773
|
+
movingFrameId: string;
|
|
774
774
|
hoveredFrameId: string;
|
|
775
|
-
zoneSide:
|
|
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
|
-
|
|
824
|
+
movingFrameId: string;
|
|
825
825
|
hoveredFrameId: string;
|
|
826
|
-
zoneSide:
|
|
826
|
+
zoneSide: Zone["side"];
|
|
827
827
|
} | {
|
|
828
|
-
|
|
828
|
+
movingFrameId: string;
|
|
829
829
|
hoveredFrameId: string;
|
|
830
|
-
zoneSide:
|
|
830
|
+
zoneSide: Zone["side"];
|
|
831
831
|
} | {
|
|
832
|
-
|
|
832
|
+
movingFrameId: string;
|
|
833
833
|
hoveredFrameId: string;
|
|
834
|
-
zoneSide:
|
|
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
|
-
|
|
930
|
+
movingFrameId: string;
|
|
931
931
|
hoveredFrameId: string;
|
|
932
|
-
zoneSide:
|
|
932
|
+
zoneSide: Zone["side"];
|
|
933
933
|
} | {
|
|
934
|
-
|
|
934
|
+
movingFrameId: string;
|
|
935
935
|
hoveredFrameId: string;
|
|
936
|
-
zoneSide:
|
|
936
|
+
zoneSide: Zone["side"];
|
|
937
937
|
} | {
|
|
938
|
-
|
|
938
|
+
movingFrameId: string;
|
|
939
939
|
hoveredFrameId: string;
|
|
940
|
-
zoneSide:
|
|
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
|
-
|
|
989
|
+
movingFrameId: string;
|
|
990
990
|
hoveredFrameId: string;
|
|
991
|
-
zoneSide:
|
|
991
|
+
zoneSide: Zone["side"];
|
|
992
992
|
} | {
|
|
993
|
-
|
|
993
|
+
movingFrameId: string;
|
|
994
994
|
hoveredFrameId: string;
|
|
995
|
-
zoneSide:
|
|
995
|
+
zoneSide: Zone["side"];
|
|
996
996
|
} | {
|
|
997
|
-
|
|
997
|
+
movingFrameId: string;
|
|
998
998
|
hoveredFrameId: string;
|
|
999
|
-
zoneSide:
|
|
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
|
|
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
|
-
|
|
1077
|
+
movingFrameId: string;
|
|
1078
1078
|
hoveredFrameId: string;
|
|
1079
|
-
zoneSide:
|
|
1079
|
+
zoneSide: Zone["side"];
|
|
1080
1080
|
} | {
|
|
1081
|
-
|
|
1081
|
+
movingFrameId: string;
|
|
1082
1082
|
hoveredFrameId: string;
|
|
1083
|
-
zoneSide:
|
|
1083
|
+
zoneSide: Zone["side"];
|
|
1084
1084
|
} | {
|
|
1085
|
-
|
|
1085
|
+
movingFrameId: string;
|
|
1086
1086
|
hoveredFrameId: string;
|
|
1087
|
-
zoneSide:
|
|
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
|
-
|
|
1136
|
+
movingFrameId: string;
|
|
1137
1137
|
hoveredFrameId: string;
|
|
1138
|
-
zoneSide:
|
|
1138
|
+
zoneSide: Zone["side"];
|
|
1139
1139
|
} | {
|
|
1140
|
-
|
|
1140
|
+
movingFrameId: string;
|
|
1141
1141
|
hoveredFrameId: string;
|
|
1142
|
-
zoneSide:
|
|
1142
|
+
zoneSide: Zone["side"];
|
|
1143
1143
|
} | {
|
|
1144
|
-
|
|
1144
|
+
movingFrameId: string;
|
|
1145
1145
|
hoveredFrameId: string;
|
|
1146
|
-
zoneSide:
|
|
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
|
|
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
|
-
|
|
1231
|
+
movingFrameId: string;
|
|
1232
1232
|
hoveredFrameId: string;
|
|
1233
|
-
zoneSide:
|
|
1233
|
+
zoneSide: Zone["side"];
|
|
1234
1234
|
} | {
|
|
1235
|
-
|
|
1235
|
+
movingFrameId: string;
|
|
1236
1236
|
hoveredFrameId: string;
|
|
1237
|
-
zoneSide:
|
|
1237
|
+
zoneSide: Zone["side"];
|
|
1238
1238
|
} | {
|
|
1239
|
-
|
|
1239
|
+
movingFrameId: string;
|
|
1240
1240
|
hoveredFrameId: string;
|
|
1241
|
-
zoneSide:
|
|
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
|
-
|
|
1290
|
+
movingFrameId: string;
|
|
1291
1291
|
hoveredFrameId: string;
|
|
1292
|
-
zoneSide:
|
|
1292
|
+
zoneSide: Zone["side"];
|
|
1293
1293
|
} | {
|
|
1294
|
-
|
|
1294
|
+
movingFrameId: string;
|
|
1295
1295
|
hoveredFrameId: string;
|
|
1296
|
-
zoneSide:
|
|
1296
|
+
zoneSide: Zone["side"];
|
|
1297
1297
|
} | {
|
|
1298
|
-
|
|
1298
|
+
movingFrameId: string;
|
|
1299
1299
|
hoveredFrameId: string;
|
|
1300
|
-
zoneSide:
|
|
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
|
-
|
|
1382
|
+
movingFrameId: string;
|
|
1383
1383
|
hoveredFrameId: string;
|
|
1384
|
-
zoneSide:
|
|
1384
|
+
zoneSide: Zone["side"];
|
|
1385
1385
|
} | {
|
|
1386
|
-
|
|
1386
|
+
movingFrameId: string;
|
|
1387
1387
|
hoveredFrameId: string;
|
|
1388
|
-
zoneSide:
|
|
1388
|
+
zoneSide: Zone["side"];
|
|
1389
1389
|
} | {
|
|
1390
|
-
|
|
1390
|
+
movingFrameId: string;
|
|
1391
1391
|
hoveredFrameId: string;
|
|
1392
|
-
zoneSide:
|
|
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
|
-
|
|
1441
|
+
movingFrameId: string;
|
|
1442
1442
|
hoveredFrameId: string;
|
|
1443
|
-
zoneSide:
|
|
1443
|
+
zoneSide: Zone["side"];
|
|
1444
1444
|
} | {
|
|
1445
|
-
|
|
1445
|
+
movingFrameId: string;
|
|
1446
1446
|
hoveredFrameId: string;
|
|
1447
|
-
zoneSide:
|
|
1447
|
+
zoneSide: Zone["side"];
|
|
1448
1448
|
} | {
|
|
1449
|
-
|
|
1449
|
+
movingFrameId: string;
|
|
1450
1450
|
hoveredFrameId: string;
|
|
1451
|
-
zoneSide:
|
|
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
|
-
|
|
1527
|
+
movingFrameId: string;
|
|
1528
1528
|
hoveredFrameId: string;
|
|
1529
|
-
zoneSide:
|
|
1529
|
+
zoneSide: Zone["side"];
|
|
1530
1530
|
} | {
|
|
1531
|
-
|
|
1531
|
+
movingFrameId: string;
|
|
1532
1532
|
hoveredFrameId: string;
|
|
1533
|
-
zoneSide:
|
|
1533
|
+
zoneSide: Zone["side"];
|
|
1534
1534
|
} | {
|
|
1535
|
-
|
|
1535
|
+
movingFrameId: string;
|
|
1536
1536
|
hoveredFrameId: string;
|
|
1537
|
-
zoneSide:
|
|
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
|
-
|
|
1586
|
+
movingFrameId: string;
|
|
1587
1587
|
hoveredFrameId: string;
|
|
1588
|
-
zoneSide:
|
|
1588
|
+
zoneSide: Zone["side"];
|
|
1589
1589
|
} | {
|
|
1590
|
-
|
|
1590
|
+
movingFrameId: string;
|
|
1591
1591
|
hoveredFrameId: string;
|
|
1592
|
-
zoneSide:
|
|
1592
|
+
zoneSide: Zone["side"];
|
|
1593
1593
|
} | {
|
|
1594
|
-
|
|
1594
|
+
movingFrameId: string;
|
|
1595
1595
|
hoveredFrameId: string;
|
|
1596
|
-
zoneSide:
|
|
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
|
-
|
|
1706
|
+
movingFrameId: string;
|
|
1707
1707
|
hoveredFrameId: string;
|
|
1708
|
-
zoneSide:
|
|
1708
|
+
zoneSide: Zone["side"];
|
|
1709
1709
|
};
|
|
1710
1710
|
[LAYOUT_ERROR.CANT_REARRANGE_WITH_DOCKED_EDGES]: {
|
|
1711
|
-
|
|
1711
|
+
movingFrameId: string;
|
|
1712
1712
|
hoveredFrameId: string;
|
|
1713
|
-
zoneSide:
|
|
1713
|
+
zoneSide: Zone["side"];
|
|
1714
1714
|
};
|
|
1715
1715
|
[LAYOUT_ERROR.CANT_REARRANGE_DOCKED_WITH_NON_DOCKED]: {
|
|
1716
|
-
|
|
1716
|
+
movingFrameId: string;
|
|
1717
1717
|
hoveredFrameId: string;
|
|
1718
|
-
zoneSide:
|
|
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
|
|
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
|
|
1766
|
+
export type FrameZone = BaseZone & {
|
|
1767
1767
|
type: "frame";
|
|
1768
1768
|
side: EdgeSide | "center";
|
|
1769
1769
|
};
|
|
1770
|
-
export type WindowEdgeZone =
|
|
1770
|
+
export type WindowEdgeZone = BaseZone & {
|
|
1771
1771
|
type: "window";
|
|
1772
1772
|
side: EdgeSide;
|
|
1773
1773
|
};
|
|
1774
|
-
export type
|
|
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
|
|
1846
|
+
export type MoveState = {
|
|
1847
1847
|
/** The current directions in the corresponding orientations that the user is dragging in. */
|
|
1848
|
-
|
|
1848
|
+
moveDirections: Record<Orientation, Direction | undefined>;
|
|
1849
1849
|
/** The curren point (in scaled window coordinates) the user is dragging at. */
|
|
1850
|
-
|
|
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
|
-
|
|
1852
|
+
moveDistance: number;
|
|
1853
1853
|
/** Whether the user is currently dragging and what type of drag. Is truthy string during all drag events. */
|
|
1854
|
-
|
|
1854
|
+
isMoving: boolean | "frame" | "edge";
|
|
1855
1855
|
/** Whether to show the moved frames while dragging. */
|
|
1856
|
-
|
|
1857
|
-
/** The frame being dragged during a frame drag. Only set when
|
|
1858
|
-
|
|
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
|
-
|
|
1862
|
+
movingEdges: Edge[];
|
|
1863
1863
|
/**
|
|
1864
1864
|
* The intersection that is currently being dragged.
|
|
1865
1865
|
*/
|
|
1866
|
-
|
|
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
|
|
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 `
|
|
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 `
|
|
1884
|
+
* The frame that is currently being hovered over (according to whether `movePoint` in in the frame or not).
|
|
1885
1885
|
*/
|
|
1886
|
-
|
|
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
|
-
|
|
1895
|
-
/** Custom context passed to
|
|
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
|
|
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
|
-
|
|
1905
|
+
showMoving?: boolean;
|
|
1906
1906
|
}
|
|
1907
|
-
export type
|
|
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
|
|
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 */
|
|
1921
|
+
cancel: T extends "end" ? undefined : (e: PointerEvent | KeyboardEvent | undefined, state: MoveState) => void,
|
|
1922
|
+
/** Saves result to resolve moveStart promise with then calls moveEnd with given apply. */
|
|
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
|
|
1934
|
+
export interface IAction {
|
|
1924
1935
|
/** A unique name for your action. */
|
|
1925
1936
|
name: string;
|
|
1926
|
-
|
|
1937
|
+
onMoveChange: MoveChangeHandler;
|
|
1927
1938
|
/**
|
|
1928
1939
|
*
|
|
1929
|
-
* Is called
|
|
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
|
-
*
|
|
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
|
-
|
|
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:
|
|
1956
|
+
canHandleRequest(e: KeyboardEvent | PointerEvent, state: MoveState, forceRecalculateEdges: () => void): boolean;
|
|
1944
1957
|
/**
|
|
1945
|
-
*
|
|
1946
|
-
*
|
|
1947
|
-
* You should reset your state here.
|
|
1948
|
-
*/
|
|
1949
|
-
cancel(e: PointerEvent | KeyboardEvent | undefined, state: DragState): void;
|
|
1950
|
-
/**
|
|
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
|
-
*
|
|
1963
|
+
* ActionHandler.debugState(this.name, "before", state, this.state, this.debug)
|
|
1957
1964
|
* ```
|
|
1958
1965
|
*/
|
|
1959
1966
|
debug: boolean | string;
|
|
@@ -1991,43 +1998,50 @@ export interface IDragAction {
|
|
|
1991
1998
|
*/
|
|
1992
1999
|
annotateEdge?(edge: Edge, frames: LayoutFrame[]): void;
|
|
1993
2000
|
}
|
|
1994
|
-
export type
|
|
2001
|
+
export type EdgeMoveStartData = {
|
|
1995
2002
|
edge?: Edge;
|
|
1996
2003
|
intersection?: IntersectionEntry;
|
|
1997
2004
|
};
|
|
1998
|
-
export type
|
|
2005
|
+
export type FrameMoveStartData = {
|
|
1999
2006
|
frameId: FrameId;
|
|
2000
2007
|
};
|
|
2008
|
+
export type ActionHandlerApplyResult = {
|
|
2009
|
+
/** Whether to apply the regular drag end changes. Return false to reset to the position before dragging. */
|
|
2010
|
+
apply: boolean;
|
|
2011
|
+
/** Value to resolve the drag promise with. Ignored if `apply` is false. */
|
|
2012
|
+
result: any;
|
|
2013
|
+
};
|
|
2001
2014
|
/**
|
|
2002
2015
|
* Handler interface for drag actions.
|
|
2003
2016
|
*/
|
|
2004
2017
|
export interface ActionHandler {
|
|
2005
|
-
eventHandler: (e: KeyboardEvent, state:
|
|
2018
|
+
eventHandler: (e: KeyboardEvent, state: MoveState, forceRecalculateEdges: () => void) => void;
|
|
2006
2019
|
/**
|
|
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.
|
|
2020
|
+
* 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. Note that the return only affects the move event but it's typed like this for ease of use. See also {@link MoveChangeHandler}.
|
|
2008
2021
|
*
|
|
2009
|
-
* Can
|
|
2022
|
+
* Can be used to save some context/info to later apply safely during onMoveApply.
|
|
2010
2023
|
*
|
|
2011
|
-
*
|
|
2024
|
+
* The call order is:
|
|
2025
|
+
* - onMoveChange("start", ...)
|
|
2026
|
+
* - onMoveChange("move", ...)
|
|
2027
|
+
* - onMoveApply(...) (IF moveEnd was called with apply: true, otherwise this is skipped)
|
|
2028
|
+
* - onMoveChange("end", ...) // always called last, do cleanup here
|
|
2012
2029
|
*/
|
|
2013
|
-
|
|
2030
|
+
onMoveChange: (...args: Parameters<MoveChangeHandler>) => MoveChangeResult;
|
|
2014
2031
|
/**
|
|
2015
|
-
* Called when drag will be applied. If
|
|
2032
|
+
* Called when drag will be applied. If moveEnd was called with apply false, it will not be called.
|
|
2016
2033
|
* Return false to not apply the regular drag end changes (i.e. return false to reset to the position before dragging).
|
|
2034
|
+
*
|
|
2035
|
+
* Do not use for resetting handler state, use onMoveChange("end", ...) for that.
|
|
2017
2036
|
*/
|
|
2018
|
-
|
|
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
|
-
};
|
|
2037
|
+
onMoveApply: (state: MoveState, forceRecalculateEdges: () => void) => ActionHandlerApplyResult;
|
|
2024
2038
|
/**
|
|
2025
2039
|
* Called after visual edges are recalculated. Action handlers can annotate edges with error info.
|
|
2026
2040
|
*/
|
|
2027
2041
|
annotateEdges?: (edges: Edge[], frames: LayoutFrame[]) => void;
|
|
2028
2042
|
}
|
|
2029
|
-
export type
|
|
2030
|
-
(e: PointerEvent, type: "edge", data:
|
|
2031
|
-
(e: PointerEvent, type: "frame", data:
|
|
2043
|
+
export type MoveStartFn = {
|
|
2044
|
+
(e: PointerEvent, type: "edge", data: EdgeMoveStartData): void;
|
|
2045
|
+
(e: PointerEvent, type: "frame", data: FrameMoveStartData): void;
|
|
2032
2046
|
};
|
|
2033
2047
|
export type * from "./vue.js";
|