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