react-resizable-panels 3.0.6 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +296 -238
- package/dist/react-resizable-panels.cjs +2 -0
- package/dist/react-resizable-panels.cjs.map +1 -0
- package/dist/react-resizable-panels.d.ts +387 -2
- package/dist/react-resizable-panels.js +1659 -2344
- package/dist/react-resizable-panels.js.map +1 -0
- package/package.json +97 -66
- package/dist/declarations/src/Panel.d.ts +0 -70
- package/dist/declarations/src/PanelGroup.d.ts +0 -38
- package/dist/declarations/src/PanelResizeHandle.d.ts +0 -23
- package/dist/declarations/src/PanelResizeHandleRegistry.d.ts +0 -19
- package/dist/declarations/src/constants.d.ts +0 -15
- package/dist/declarations/src/hooks/usePanelGroupContext.d.ts +0 -4
- package/dist/declarations/src/index.d.ts +0 -23
- package/dist/declarations/src/types.d.ts +0 -3
- package/dist/declarations/src/utils/assert.d.ts +0 -1
- package/dist/declarations/src/utils/csp.d.ts +0 -2
- package/dist/declarations/src/utils/cursor.d.ts +0 -18
- package/dist/declarations/src/utils/dom/getPanelElement.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getPanelElementsForGroup.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getPanelGroupElement.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElement.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElementIndex.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandleElementsForGroup.d.ts +0 -1
- package/dist/declarations/src/utils/dom/getResizeHandlePanelIds.d.ts +0 -2
- package/dist/declarations/src/utils/rects/getIntersectingRectangle.d.ts +0 -2
- package/dist/declarations/src/utils/rects/intersects.d.ts +0 -2
- package/dist/declarations/src/utils/rects/types.d.ts +0 -6
- package/dist/react-resizable-panels.browser.development.js +0 -2592
- package/dist/react-resizable-panels.browser.js +0 -2486
- package/dist/react-resizable-panels.development.edge-light.js +0 -2365
- package/dist/react-resizable-panels.development.js +0 -2599
- package/dist/react-resizable-panels.edge-light.js +0 -2264
|
@@ -1,2488 +1,1803 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const DATA_ATTRIBUTES = {
|
|
12
|
-
group: "data-panel-group",
|
|
13
|
-
groupDirection: "data-panel-group-direction",
|
|
14
|
-
groupId: "data-panel-group-id",
|
|
15
|
-
panel: "data-panel",
|
|
16
|
-
panelCollapsible: "data-panel-collapsible",
|
|
17
|
-
panelId: "data-panel-id",
|
|
18
|
-
panelSize: "data-panel-size",
|
|
19
|
-
resizeHandle: "data-resize-handle",
|
|
20
|
-
resizeHandleActive: "data-resize-handle-active",
|
|
21
|
-
resizeHandleEnabled: "data-panel-resize-handle-enabled",
|
|
22
|
-
resizeHandleId: "data-panel-resize-handle-id",
|
|
23
|
-
resizeHandleState: "data-resize-handle-state"
|
|
24
|
-
};
|
|
25
|
-
const PRECISION = 10;
|
|
26
|
-
|
|
27
|
-
const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : () => {};
|
|
28
|
-
|
|
29
|
-
const useId = React["useId".toString()];
|
|
30
|
-
const wrappedUseId = typeof useId === "function" ? useId : () => null;
|
|
31
|
-
let counter = 0;
|
|
32
|
-
function useUniqueId(idFromParams = null) {
|
|
33
|
-
const idFromUseId = wrappedUseId();
|
|
34
|
-
const idRef = useRef(idFromParams || idFromUseId || null);
|
|
35
|
-
if (idRef.current === null) {
|
|
36
|
-
idRef.current = "" + counter++;
|
|
37
|
-
}
|
|
38
|
-
return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function PanelWithForwardedRef({
|
|
42
|
-
children,
|
|
43
|
-
className: classNameFromProps = "",
|
|
44
|
-
collapsedSize,
|
|
45
|
-
collapsible,
|
|
46
|
-
defaultSize,
|
|
47
|
-
forwardedRef,
|
|
48
|
-
id: idFromProps,
|
|
49
|
-
maxSize,
|
|
50
|
-
minSize,
|
|
51
|
-
onCollapse,
|
|
52
|
-
onExpand,
|
|
53
|
-
onResize,
|
|
54
|
-
order,
|
|
55
|
-
style: styleFromProps,
|
|
56
|
-
tagName: Type = "div",
|
|
57
|
-
...rest
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as X } from "react/jsx-runtime";
|
|
3
|
+
import { useId as Ke, useLayoutEffect as Xe, useEffect as Ce, useRef as I, useCallback as qe, createContext as Ye, useImperativeHandle as Ee, useState as D, useMemo as se, useSyncExternalStore as Ze, useContext as Je } from "react";
|
|
4
|
+
function z(e, t = "Assertion error") {
|
|
5
|
+
if (!e)
|
|
6
|
+
throw Error(t);
|
|
7
|
+
}
|
|
8
|
+
function U({
|
|
9
|
+
group: e
|
|
58
10
|
}) {
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
throw Error(`Panel components must be rendered within a PanelGroup container`);
|
|
62
|
-
}
|
|
63
|
-
const {
|
|
64
|
-
collapsePanel,
|
|
65
|
-
expandPanel,
|
|
66
|
-
getPanelSize,
|
|
67
|
-
getPanelStyle,
|
|
68
|
-
groupId,
|
|
69
|
-
isPanelCollapsed,
|
|
70
|
-
reevaluatePanelConstraints,
|
|
71
|
-
registerPanel,
|
|
72
|
-
resizePanel,
|
|
73
|
-
unregisterPanel
|
|
74
|
-
} = context;
|
|
75
|
-
const panelId = useUniqueId(idFromProps);
|
|
76
|
-
const panelDataRef = useRef({
|
|
77
|
-
callbacks: {
|
|
78
|
-
onCollapse,
|
|
79
|
-
onExpand,
|
|
80
|
-
onResize
|
|
81
|
-
},
|
|
82
|
-
constraints: {
|
|
83
|
-
collapsedSize,
|
|
84
|
-
collapsible,
|
|
85
|
-
defaultSize,
|
|
86
|
-
maxSize,
|
|
87
|
-
minSize
|
|
88
|
-
},
|
|
89
|
-
id: panelId,
|
|
90
|
-
idIsFromProps: idFromProps !== undefined,
|
|
91
|
-
order
|
|
92
|
-
});
|
|
93
|
-
useRef({
|
|
94
|
-
didLogMissingDefaultSizeWarning: false
|
|
95
|
-
});
|
|
96
|
-
useIsomorphicLayoutEffect(() => {
|
|
97
|
-
const {
|
|
98
|
-
callbacks,
|
|
99
|
-
constraints
|
|
100
|
-
} = panelDataRef.current;
|
|
101
|
-
const prevConstraints = {
|
|
102
|
-
...constraints
|
|
103
|
-
};
|
|
104
|
-
panelDataRef.current.id = panelId;
|
|
105
|
-
panelDataRef.current.idIsFromProps = idFromProps !== undefined;
|
|
106
|
-
panelDataRef.current.order = order;
|
|
107
|
-
callbacks.onCollapse = onCollapse;
|
|
108
|
-
callbacks.onExpand = onExpand;
|
|
109
|
-
callbacks.onResize = onResize;
|
|
110
|
-
constraints.collapsedSize = collapsedSize;
|
|
111
|
-
constraints.collapsible = collapsible;
|
|
112
|
-
constraints.defaultSize = defaultSize;
|
|
113
|
-
constraints.maxSize = maxSize;
|
|
114
|
-
constraints.minSize = minSize;
|
|
115
|
-
|
|
116
|
-
// If constraints have changed, we should revisit panel sizes.
|
|
117
|
-
// This is uncommon but may happen if people are trying to implement pixel based constraints.
|
|
118
|
-
if (prevConstraints.collapsedSize !== constraints.collapsedSize || prevConstraints.collapsible !== constraints.collapsible || prevConstraints.maxSize !== constraints.maxSize || prevConstraints.minSize !== constraints.minSize) {
|
|
119
|
-
reevaluatePanelConstraints(panelDataRef.current, prevConstraints);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
useIsomorphicLayoutEffect(() => {
|
|
123
|
-
const panelData = panelDataRef.current;
|
|
124
|
-
registerPanel(panelData);
|
|
125
|
-
return () => {
|
|
126
|
-
unregisterPanel(panelData);
|
|
127
|
-
};
|
|
128
|
-
}, [order, panelId, registerPanel, unregisterPanel]);
|
|
129
|
-
useImperativeHandle(forwardedRef, () => ({
|
|
130
|
-
collapse: () => {
|
|
131
|
-
collapsePanel(panelDataRef.current);
|
|
132
|
-
},
|
|
133
|
-
expand: minSize => {
|
|
134
|
-
expandPanel(panelDataRef.current, minSize);
|
|
135
|
-
},
|
|
136
|
-
getId() {
|
|
137
|
-
return panelId;
|
|
138
|
-
},
|
|
139
|
-
getSize() {
|
|
140
|
-
return getPanelSize(panelDataRef.current);
|
|
141
|
-
},
|
|
142
|
-
isCollapsed() {
|
|
143
|
-
return isPanelCollapsed(panelDataRef.current);
|
|
144
|
-
},
|
|
145
|
-
isExpanded() {
|
|
146
|
-
return !isPanelCollapsed(panelDataRef.current);
|
|
147
|
-
},
|
|
148
|
-
resize: size => {
|
|
149
|
-
resizePanel(panelDataRef.current, size);
|
|
150
|
-
}
|
|
151
|
-
}), [collapsePanel, expandPanel, getPanelSize, isPanelCollapsed, panelId, resizePanel]);
|
|
152
|
-
const style = getPanelStyle(panelDataRef.current, defaultSize);
|
|
153
|
-
return createElement(Type, {
|
|
154
|
-
...rest,
|
|
155
|
-
children,
|
|
156
|
-
className: classNameFromProps,
|
|
157
|
-
id: panelId,
|
|
158
|
-
style: {
|
|
159
|
-
...style,
|
|
160
|
-
...styleFromProps
|
|
161
|
-
},
|
|
162
|
-
// CSS selectors
|
|
163
|
-
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
164
|
-
[DATA_ATTRIBUTES.panel]: "",
|
|
165
|
-
[DATA_ATTRIBUTES.panelCollapsible]: collapsible || undefined,
|
|
166
|
-
[DATA_ATTRIBUTES.panelId]: panelId,
|
|
167
|
-
[DATA_ATTRIBUTES.panelSize]: parseFloat("" + style.flexGrow).toFixed(1)
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
const Panel = forwardRef((props, ref) => createElement(PanelWithForwardedRef, {
|
|
171
|
-
...props,
|
|
172
|
-
forwardedRef: ref
|
|
173
|
-
}));
|
|
174
|
-
PanelWithForwardedRef.displayName = "Panel";
|
|
175
|
-
Panel.displayName = "forwardRef(Panel)";
|
|
176
|
-
|
|
177
|
-
let nonce;
|
|
178
|
-
function getNonce() {
|
|
179
|
-
return nonce;
|
|
180
|
-
}
|
|
181
|
-
function setNonce(value) {
|
|
182
|
-
nonce = value;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
let currentCursorStyle = null;
|
|
186
|
-
let enabled = true;
|
|
187
|
-
let getCustomCursorStyleFunction = null;
|
|
188
|
-
let prevRuleIndex = -1;
|
|
189
|
-
let styleElement = null;
|
|
190
|
-
function customizeGlobalCursorStyles(callback) {
|
|
191
|
-
getCustomCursorStyleFunction = callback;
|
|
192
|
-
}
|
|
193
|
-
function disableGlobalCursorStyles() {
|
|
194
|
-
enabled = false;
|
|
195
|
-
}
|
|
196
|
-
function enableGlobalCursorStyles() {
|
|
197
|
-
enabled = true;
|
|
198
|
-
}
|
|
199
|
-
function getCursorStyle(state, constraintFlags, isPointerDown) {
|
|
200
|
-
const horizontalMin = (constraintFlags & EXCEEDED_HORIZONTAL_MIN) !== 0;
|
|
201
|
-
const horizontalMax = (constraintFlags & EXCEEDED_HORIZONTAL_MAX) !== 0;
|
|
202
|
-
const verticalMin = (constraintFlags & EXCEEDED_VERTICAL_MIN) !== 0;
|
|
203
|
-
const verticalMax = (constraintFlags & EXCEEDED_VERTICAL_MAX) !== 0;
|
|
204
|
-
if (getCustomCursorStyleFunction) {
|
|
205
|
-
return getCustomCursorStyleFunction({
|
|
206
|
-
exceedsHorizontalMaximum: horizontalMax,
|
|
207
|
-
exceedsHorizontalMinimum: horizontalMin,
|
|
208
|
-
exceedsVerticalMaximum: verticalMax,
|
|
209
|
-
exceedsVerticalMinimum: verticalMin,
|
|
210
|
-
intersectsHorizontalDragHandle: state === "horizontal" || state === "intersection",
|
|
211
|
-
intersectsVerticalDragHandle: state === "vertical" || state === "intersection",
|
|
212
|
-
isPointerDown
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
if (constraintFlags) {
|
|
216
|
-
if (horizontalMin) {
|
|
217
|
-
if (verticalMin) {
|
|
218
|
-
return "se-resize";
|
|
219
|
-
} else if (verticalMax) {
|
|
220
|
-
return "ne-resize";
|
|
221
|
-
} else {
|
|
222
|
-
return "e-resize";
|
|
223
|
-
}
|
|
224
|
-
} else if (horizontalMax) {
|
|
225
|
-
if (verticalMin) {
|
|
226
|
-
return "sw-resize";
|
|
227
|
-
} else if (verticalMax) {
|
|
228
|
-
return "nw-resize";
|
|
229
|
-
} else {
|
|
230
|
-
return "w-resize";
|
|
231
|
-
}
|
|
232
|
-
} else if (verticalMin) {
|
|
233
|
-
return "s-resize";
|
|
234
|
-
} else if (verticalMax) {
|
|
235
|
-
return "n-resize";
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
switch (state) {
|
|
239
|
-
case "horizontal":
|
|
240
|
-
return "ew-resize";
|
|
241
|
-
case "intersection":
|
|
242
|
-
return "move";
|
|
243
|
-
case "vertical":
|
|
244
|
-
return "ns-resize";
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
function resetGlobalCursorStyle() {
|
|
248
|
-
if (styleElement !== null) {
|
|
249
|
-
document.head.removeChild(styleElement);
|
|
250
|
-
currentCursorStyle = null;
|
|
251
|
-
styleElement = null;
|
|
252
|
-
prevRuleIndex = -1;
|
|
253
|
-
}
|
|
11
|
+
const { orientation: t, panels: n } = e;
|
|
12
|
+
return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
|
|
254
13
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
const style = getCursorStyle(state, constraintFlags, isPointerDown);
|
|
261
|
-
if (currentCursorStyle === style) {
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
currentCursorStyle = style;
|
|
265
|
-
if (styleElement === null) {
|
|
266
|
-
styleElement = document.createElement("style");
|
|
267
|
-
const nonce = getNonce();
|
|
268
|
-
if (nonce) {
|
|
269
|
-
styleElement.setAttribute("nonce", nonce);
|
|
270
|
-
}
|
|
271
|
-
document.head.appendChild(styleElement);
|
|
272
|
-
}
|
|
273
|
-
if (prevRuleIndex >= 0) {
|
|
274
|
-
var _styleElement$sheet;
|
|
275
|
-
(_styleElement$sheet = styleElement.sheet) === null || _styleElement$sheet === void 0 ? void 0 : _styleElement$sheet.removeRule(prevRuleIndex);
|
|
276
|
-
}
|
|
277
|
-
prevRuleIndex = (_styleElement$sheet$i = (_styleElement$sheet2 = styleElement.sheet) === null || _styleElement$sheet2 === void 0 ? void 0 : _styleElement$sheet2.insertRule(`*{cursor: ${style} !important;}`)) !== null && _styleElement$sheet$i !== void 0 ? _styleElement$sheet$i : -1;
|
|
14
|
+
function ae(e, t) {
|
|
15
|
+
return t.sort(
|
|
16
|
+
e === "horizontal" ? Qe : et
|
|
17
|
+
);
|
|
278
18
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return
|
|
19
|
+
function Qe(e, t) {
|
|
20
|
+
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
21
|
+
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
282
22
|
}
|
|
283
|
-
function
|
|
284
|
-
|
|
23
|
+
function et(e, t) {
|
|
24
|
+
const n = e.element.offsetTop - t.element.offsetTop;
|
|
25
|
+
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
285
26
|
}
|
|
286
|
-
function
|
|
287
|
-
return
|
|
27
|
+
function Me(e) {
|
|
28
|
+
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.ELEMENT_NODE;
|
|
288
29
|
}
|
|
289
|
-
|
|
290
|
-
function getResizeEventCoordinates(event) {
|
|
291
|
-
if (isPointerEvent(event)) {
|
|
292
|
-
if (event.isPrimary) {
|
|
293
|
-
return {
|
|
294
|
-
x: event.clientX,
|
|
295
|
-
y: event.clientY
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
} else if (isMouseEvent(event)) {
|
|
299
|
-
return {
|
|
300
|
-
x: event.clientX,
|
|
301
|
-
y: event.clientY
|
|
302
|
-
};
|
|
303
|
-
}
|
|
30
|
+
function Ie(e, t) {
|
|
304
31
|
return {
|
|
305
|
-
x:
|
|
306
|
-
|
|
32
|
+
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
33
|
+
Math.abs(e.x - t.left),
|
|
34
|
+
Math.abs(e.x - t.right)
|
|
35
|
+
),
|
|
36
|
+
y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(
|
|
37
|
+
Math.abs(e.y - t.top),
|
|
38
|
+
Math.abs(e.y - t.bottom)
|
|
39
|
+
)
|
|
307
40
|
};
|
|
308
41
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
if (strict) {
|
|
318
|
-
return rectOne.x < rectTwo.x + rectTwo.width && rectOne.x + rectOne.width > rectTwo.x && rectOne.y < rectTwo.y + rectTwo.height && rectOne.y + rectOne.height > rectTwo.y;
|
|
319
|
-
} else {
|
|
320
|
-
return rectOne.x <= rectTwo.x + rectTwo.width && rectOne.x + rectOne.width >= rectTwo.x && rectOne.y <= rectTwo.y + rectTwo.height && rectOne.y + rectOne.height >= rectTwo.y;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// Forked from NPM stacking-order@2.0.0
|
|
325
|
-
|
|
326
|
-
/**
|
|
327
|
-
* Determine which of two nodes appears in front of the other —
|
|
328
|
-
* if `a` is in front, returns 1, otherwise returns -1
|
|
329
|
-
* @param {HTMLElement | SVGElement} a
|
|
330
|
-
* @param {HTMLElement | SVGElement} b
|
|
331
|
-
*/
|
|
332
|
-
function compare(a, b) {
|
|
333
|
-
if (a === b) throw new Error("Cannot compare node with itself");
|
|
334
|
-
const ancestors = {
|
|
335
|
-
a: get_ancestors(a),
|
|
336
|
-
b: get_ancestors(b)
|
|
42
|
+
function tt({
|
|
43
|
+
orientation: e,
|
|
44
|
+
rects: t,
|
|
45
|
+
targetRect: n
|
|
46
|
+
}) {
|
|
47
|
+
const o = {
|
|
48
|
+
x: n.x + n.width / 2,
|
|
49
|
+
y: n.y + n.height / 2
|
|
337
50
|
};
|
|
338
|
-
let
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
a = ancestors.a.pop();
|
|
343
|
-
b = ancestors.b.pop();
|
|
344
|
-
common_ancestor = a;
|
|
51
|
+
let r, s = Number.MAX_VALUE;
|
|
52
|
+
for (const l of t) {
|
|
53
|
+
const { x: i, y: a } = Ie(o, l), u = e === "horizontal" ? i : a;
|
|
54
|
+
u < s && (s = u, r = l);
|
|
345
55
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
56
|
+
return z(r, "No rect found"), r;
|
|
57
|
+
}
|
|
58
|
+
function ke(e) {
|
|
59
|
+
const { element: t, orientation: n, panels: o, separators: r } = e, s = ae(
|
|
60
|
+
n,
|
|
61
|
+
Array.from(t.children).filter(Me).map((f) => ({ element: f }))
|
|
62
|
+
).map(({ element: f }) => f), l = [];
|
|
63
|
+
let i = !1, a, u = [];
|
|
64
|
+
for (const f of s)
|
|
65
|
+
if (f.hasAttribute("data-panel")) {
|
|
66
|
+
const p = o.find(
|
|
67
|
+
(m) => m.element === f
|
|
68
|
+
);
|
|
69
|
+
if (p) {
|
|
70
|
+
if (a) {
|
|
71
|
+
const m = a.element.getBoundingClientRect(), h = f.getBoundingClientRect();
|
|
72
|
+
let c;
|
|
73
|
+
if (i) {
|
|
74
|
+
const d = n === "horizontal" ? new DOMRect(m.right, m.top, 0, m.height) : new DOMRect(
|
|
75
|
+
m.left,
|
|
76
|
+
m.bottom,
|
|
77
|
+
m.width,
|
|
78
|
+
0
|
|
79
|
+
), y = n === "horizontal" ? new DOMRect(h.left, h.top, 0, h.height) : new DOMRect(h.left, h.top, h.width, 0);
|
|
80
|
+
switch (u.length) {
|
|
81
|
+
case 0: {
|
|
82
|
+
c = [
|
|
83
|
+
d,
|
|
84
|
+
y
|
|
85
|
+
];
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
case 1: {
|
|
89
|
+
const v = u[0], S = tt({
|
|
90
|
+
orientation: n,
|
|
91
|
+
rects: [m, h],
|
|
92
|
+
targetRect: v.element.getBoundingClientRect()
|
|
93
|
+
});
|
|
94
|
+
c = [
|
|
95
|
+
v,
|
|
96
|
+
S === m ? y : d
|
|
97
|
+
];
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
default: {
|
|
101
|
+
c = u;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} else
|
|
106
|
+
u.length ? c = u : c = [
|
|
107
|
+
n === "horizontal" ? new DOMRect(
|
|
108
|
+
m.right,
|
|
109
|
+
h.top,
|
|
110
|
+
h.left - m.right,
|
|
111
|
+
h.height
|
|
112
|
+
) : new DOMRect(
|
|
113
|
+
h.left,
|
|
114
|
+
m.bottom,
|
|
115
|
+
h.width,
|
|
116
|
+
h.top - m.bottom
|
|
117
|
+
)
|
|
118
|
+
];
|
|
119
|
+
for (const d of c)
|
|
120
|
+
l.push({
|
|
121
|
+
group: e,
|
|
122
|
+
groupSize: U({ group: e }),
|
|
123
|
+
panels: [a, p],
|
|
124
|
+
separator: "width" in d ? void 0 : d,
|
|
125
|
+
rect: "width" in d ? d : d.element.getBoundingClientRect()
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
i = !1, a = p, u = [];
|
|
129
|
+
}
|
|
130
|
+
} else if (f.hasAttribute("data-separator")) {
|
|
131
|
+
const p = r.find(
|
|
132
|
+
(m) => m.element === f
|
|
133
|
+
);
|
|
134
|
+
p ? u.push(p) : (a = void 0, u = []);
|
|
135
|
+
} else
|
|
136
|
+
i = !0;
|
|
137
|
+
return l;
|
|
138
|
+
}
|
|
139
|
+
function nt(e, t) {
|
|
140
|
+
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
141
|
+
return t * o;
|
|
142
|
+
}
|
|
143
|
+
function ot(e, t) {
|
|
144
|
+
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
145
|
+
return t * o;
|
|
146
|
+
}
|
|
147
|
+
function it(e) {
|
|
148
|
+
return e / 100 * window.innerHeight;
|
|
149
|
+
}
|
|
150
|
+
function rt(e) {
|
|
151
|
+
return e / 100 * window.innerWidth;
|
|
152
|
+
}
|
|
153
|
+
function st(e) {
|
|
154
|
+
switch (typeof e) {
|
|
155
|
+
case "number":
|
|
156
|
+
return [e, "px"];
|
|
157
|
+
case "string": {
|
|
158
|
+
const t = parseFloat(e);
|
|
159
|
+
return e.endsWith("%") ? [t, "%"] : e.endsWith("px") ? [t, "px"] : e.endsWith("rem") ? [t, "rem"] : e.endsWith("em") ? [t, "em"] : e.endsWith("vh") ? [t, "vh"] : e.endsWith("vw") ? [t, "vw"] : [t, "%"];
|
|
362
160
|
}
|
|
363
161
|
}
|
|
364
|
-
return Math.sign(z_indexes.a - z_indexes.b);
|
|
365
|
-
}
|
|
366
|
-
const props = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
367
|
-
|
|
368
|
-
/** @param {HTMLElement | SVGElement} node */
|
|
369
|
-
function is_flex_item(node) {
|
|
370
|
-
var _get_parent;
|
|
371
|
-
// @ts-ignore
|
|
372
|
-
const display = getComputedStyle((_get_parent = get_parent(node)) !== null && _get_parent !== void 0 ? _get_parent : node).display;
|
|
373
|
-
return display === "flex" || display === "inline-flex";
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
/** @param {HTMLElement | SVGElement} node */
|
|
377
|
-
function creates_stacking_context(node) {
|
|
378
|
-
const style = getComputedStyle(node);
|
|
379
|
-
|
|
380
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
|
|
381
|
-
if (style.position === "fixed") return true;
|
|
382
|
-
// Forked to fix upstream bug https://github.com/Rich-Harris/stacking-order/issues/3
|
|
383
|
-
// if (
|
|
384
|
-
// (style.zIndex !== "auto" && style.position !== "static") ||
|
|
385
|
-
// is_flex_item(node)
|
|
386
|
-
// )
|
|
387
|
-
if (style.zIndex !== "auto" && (style.position !== "static" || is_flex_item(node))) return true;
|
|
388
|
-
if (+style.opacity < 1) return true;
|
|
389
|
-
if ("transform" in style && style.transform !== "none") return true;
|
|
390
|
-
if ("webkitTransform" in style && style.webkitTransform !== "none") return true;
|
|
391
|
-
if ("mixBlendMode" in style && style.mixBlendMode !== "normal") return true;
|
|
392
|
-
if ("filter" in style && style.filter !== "none") return true;
|
|
393
|
-
if ("webkitFilter" in style && style.webkitFilter !== "none") return true;
|
|
394
|
-
if ("isolation" in style && style.isolation === "isolate") return true;
|
|
395
|
-
if (props.test(style.willChange)) return true;
|
|
396
|
-
// @ts-expect-error
|
|
397
|
-
if (style.webkitOverflowScrolling === "touch") return true;
|
|
398
|
-
return false;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
/** @param {(HTMLElement| SVGElement)[]} nodes */
|
|
402
|
-
function find_stacking_context(nodes) {
|
|
403
|
-
let i = nodes.length;
|
|
404
|
-
while (i--) {
|
|
405
|
-
const node = nodes[i];
|
|
406
|
-
assert(node, "Missing node");
|
|
407
|
-
if (creates_stacking_context(node)) return node;
|
|
408
|
-
}
|
|
409
|
-
return null;
|
|
410
162
|
}
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
// @ts-ignore
|
|
423
|
-
node = get_parent(node);
|
|
424
|
-
}
|
|
425
|
-
return ancestors; // [ node, ... <body>, <html>, document ]
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/** @param {HTMLElement} node */
|
|
429
|
-
function get_parent(node) {
|
|
430
|
-
const {
|
|
431
|
-
parentNode
|
|
432
|
-
} = node;
|
|
433
|
-
if (parentNode && parentNode instanceof ShadowRoot) {
|
|
434
|
-
return parentNode.host;
|
|
435
|
-
}
|
|
436
|
-
return parentNode;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const EXCEEDED_HORIZONTAL_MIN = 0b0001;
|
|
440
|
-
const EXCEEDED_HORIZONTAL_MAX = 0b0010;
|
|
441
|
-
const EXCEEDED_VERTICAL_MIN = 0b0100;
|
|
442
|
-
const EXCEEDED_VERTICAL_MAX = 0b1000;
|
|
443
|
-
const isCoarsePointer = getInputType() === "coarse";
|
|
444
|
-
let intersectingHandles = [];
|
|
445
|
-
let isPointerDown = false;
|
|
446
|
-
let ownerDocumentCounts = new Map();
|
|
447
|
-
let panelConstraintFlags = new Map();
|
|
448
|
-
const registeredResizeHandlers = new Set();
|
|
449
|
-
function registerResizeHandle(resizeHandleId, element, direction, hitAreaMargins, setResizeHandlerState) {
|
|
450
|
-
var _ownerDocumentCounts$;
|
|
451
|
-
const {
|
|
452
|
-
ownerDocument
|
|
453
|
-
} = element;
|
|
454
|
-
const data = {
|
|
455
|
-
direction,
|
|
456
|
-
element,
|
|
457
|
-
hitAreaMargins,
|
|
458
|
-
setResizeHandlerState
|
|
459
|
-
};
|
|
460
|
-
const count = (_ownerDocumentCounts$ = ownerDocumentCounts.get(ownerDocument)) !== null && _ownerDocumentCounts$ !== void 0 ? _ownerDocumentCounts$ : 0;
|
|
461
|
-
ownerDocumentCounts.set(ownerDocument, count + 1);
|
|
462
|
-
registeredResizeHandlers.add(data);
|
|
463
|
-
updateListeners();
|
|
464
|
-
return function unregisterResizeHandle() {
|
|
465
|
-
var _ownerDocumentCounts$2;
|
|
466
|
-
panelConstraintFlags.delete(resizeHandleId);
|
|
467
|
-
registeredResizeHandlers.delete(data);
|
|
468
|
-
const count = (_ownerDocumentCounts$2 = ownerDocumentCounts.get(ownerDocument)) !== null && _ownerDocumentCounts$2 !== void 0 ? _ownerDocumentCounts$2 : 1;
|
|
469
|
-
ownerDocumentCounts.set(ownerDocument, count - 1);
|
|
470
|
-
updateListeners();
|
|
471
|
-
if (count === 1) {
|
|
472
|
-
ownerDocumentCounts.delete(ownerDocument);
|
|
163
|
+
function ee({
|
|
164
|
+
groupSize: e,
|
|
165
|
+
panelElement: t,
|
|
166
|
+
styleProp: n
|
|
167
|
+
}) {
|
|
168
|
+
let o;
|
|
169
|
+
const [r, s] = st(n);
|
|
170
|
+
switch (s) {
|
|
171
|
+
case "%": {
|
|
172
|
+
o = r / 100 * e;
|
|
173
|
+
break;
|
|
473
174
|
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
if (intersectingHandles.includes(data)) {
|
|
478
|
-
const index = intersectingHandles.indexOf(data);
|
|
479
|
-
if (index >= 0) {
|
|
480
|
-
intersectingHandles.splice(index, 1);
|
|
481
|
-
}
|
|
482
|
-
updateCursor();
|
|
483
|
-
|
|
484
|
-
// Also instruct the handle to stop dragging; this prevents the parent group from being left in an inconsistent state
|
|
485
|
-
// See github.com/bvaughn/react-resizable-panels/issues/402
|
|
486
|
-
setResizeHandlerState("up", true, null);
|
|
175
|
+
case "px": {
|
|
176
|
+
o = r;
|
|
177
|
+
break;
|
|
487
178
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const {
|
|
492
|
-
target
|
|
493
|
-
} = event;
|
|
494
|
-
const {
|
|
495
|
-
x,
|
|
496
|
-
y
|
|
497
|
-
} = getResizeEventCoordinates(event);
|
|
498
|
-
isPointerDown = true;
|
|
499
|
-
recalculateIntersectingHandles({
|
|
500
|
-
target,
|
|
501
|
-
x,
|
|
502
|
-
y
|
|
503
|
-
});
|
|
504
|
-
updateListeners();
|
|
505
|
-
if (intersectingHandles.length > 0) {
|
|
506
|
-
updateResizeHandlerStates("down", event);
|
|
507
|
-
|
|
508
|
-
// Update cursor based on return value(s) from active handles
|
|
509
|
-
updateCursor();
|
|
510
|
-
event.preventDefault();
|
|
511
|
-
if (!isWithinResizeHandle(target)) {
|
|
512
|
-
event.stopImmediatePropagation();
|
|
179
|
+
case "rem": {
|
|
180
|
+
o = ot(t, r);
|
|
181
|
+
break;
|
|
513
182
|
}
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
const {
|
|
518
|
-
x,
|
|
519
|
-
y
|
|
520
|
-
} = getResizeEventCoordinates(event);
|
|
521
|
-
|
|
522
|
-
// Edge case (see #340)
|
|
523
|
-
// Detect when the pointer has been released outside an iframe on a different domain
|
|
524
|
-
if (isPointerDown &&
|
|
525
|
-
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
526
|
-
event.type !== "pointerleave" && event.buttons === 0) {
|
|
527
|
-
isPointerDown = false;
|
|
528
|
-
updateResizeHandlerStates("up", event);
|
|
529
|
-
}
|
|
530
|
-
if (!isPointerDown) {
|
|
531
|
-
const {
|
|
532
|
-
target
|
|
533
|
-
} = event;
|
|
534
|
-
|
|
535
|
-
// Recalculate intersecting handles whenever the pointer moves, except if it has already been pressed
|
|
536
|
-
// at that point, the handles may not move with the pointer (depending on constraints)
|
|
537
|
-
// but the same set of active handles should be locked until the pointer is released
|
|
538
|
-
recalculateIntersectingHandles({
|
|
539
|
-
target,
|
|
540
|
-
x,
|
|
541
|
-
y
|
|
542
|
-
});
|
|
543
|
-
}
|
|
544
|
-
updateResizeHandlerStates("move", event);
|
|
545
|
-
|
|
546
|
-
// Update cursor based on return value(s) from active handles
|
|
547
|
-
updateCursor();
|
|
548
|
-
if (intersectingHandles.length > 0) {
|
|
549
|
-
event.preventDefault();
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
function handlePointerUp(event) {
|
|
553
|
-
const {
|
|
554
|
-
target
|
|
555
|
-
} = event;
|
|
556
|
-
const {
|
|
557
|
-
x,
|
|
558
|
-
y
|
|
559
|
-
} = getResizeEventCoordinates(event);
|
|
560
|
-
panelConstraintFlags.clear();
|
|
561
|
-
isPointerDown = false;
|
|
562
|
-
if (intersectingHandles.length > 0) {
|
|
563
|
-
event.preventDefault();
|
|
564
|
-
if (!isWithinResizeHandle(target)) {
|
|
565
|
-
event.stopImmediatePropagation();
|
|
183
|
+
case "em": {
|
|
184
|
+
o = nt(t, r);
|
|
185
|
+
break;
|
|
566
186
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
updateCursor();
|
|
575
|
-
updateListeners();
|
|
576
|
-
}
|
|
577
|
-
function isWithinResizeHandle(element) {
|
|
578
|
-
let currentElement = element;
|
|
579
|
-
while (currentElement) {
|
|
580
|
-
if (currentElement.hasAttribute(DATA_ATTRIBUTES.resizeHandle)) {
|
|
581
|
-
return true;
|
|
187
|
+
case "vh": {
|
|
188
|
+
o = it(r);
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
191
|
+
case "vw": {
|
|
192
|
+
o = rt(r);
|
|
193
|
+
break;
|
|
582
194
|
}
|
|
583
|
-
currentElement = currentElement.parentElement;
|
|
584
|
-
}
|
|
585
|
-
return false;
|
|
586
|
-
}
|
|
587
|
-
function recalculateIntersectingHandles({
|
|
588
|
-
target,
|
|
589
|
-
x,
|
|
590
|
-
y
|
|
591
|
-
}) {
|
|
592
|
-
intersectingHandles.splice(0);
|
|
593
|
-
let targetElement = null;
|
|
594
|
-
if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
595
|
-
targetElement = target;
|
|
596
195
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
// and why we skip if the event target is within the handle's DOM
|
|
622
|
-
compare(targetElement, dragHandleElement) > 0) {
|
|
623
|
-
// If the target is above the drag handle, then we also need to confirm they overlap
|
|
624
|
-
// If they are beside each other (e.g. a panel and its drag handle) then the handle is still interactive
|
|
625
|
-
//
|
|
626
|
-
// It's not enough to compare only the target
|
|
627
|
-
// The target might be a small element inside of a larger container
|
|
628
|
-
// (For example, a SPAN or a DIV inside of a larger modal dialog)
|
|
629
|
-
let currentElement = targetElement;
|
|
630
|
-
let didIntersect = false;
|
|
631
|
-
while (currentElement) {
|
|
632
|
-
if (currentElement.contains(dragHandleElement)) {
|
|
633
|
-
break;
|
|
634
|
-
} else if (intersects(currentElement.getBoundingClientRect(), dragHandleRect, true)) {
|
|
635
|
-
didIntersect = true;
|
|
636
|
-
break;
|
|
637
|
-
}
|
|
638
|
-
currentElement = currentElement.parentElement;
|
|
639
|
-
}
|
|
640
|
-
if (didIntersect) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
}
|
|
644
|
-
intersectingHandles.push(data);
|
|
196
|
+
return o;
|
|
197
|
+
}
|
|
198
|
+
function k(e) {
|
|
199
|
+
return parseFloat(e.toFixed(3));
|
|
200
|
+
}
|
|
201
|
+
function he(e) {
|
|
202
|
+
const { panels: t } = e, n = U({ group: e });
|
|
203
|
+
return n === 0 ? t.map((o) => ({
|
|
204
|
+
collapsedSize: 0,
|
|
205
|
+
collapsible: o.panelConstraints.collapsible === !0,
|
|
206
|
+
defaultSize: void 0,
|
|
207
|
+
minSize: 0,
|
|
208
|
+
maxSize: 100,
|
|
209
|
+
panelId: o.id
|
|
210
|
+
})) : t.map((o) => {
|
|
211
|
+
const { element: r, panelConstraints: s } = o;
|
|
212
|
+
let l = 0;
|
|
213
|
+
if (s.collapsedSize) {
|
|
214
|
+
const f = ee({
|
|
215
|
+
groupSize: n,
|
|
216
|
+
panelElement: r,
|
|
217
|
+
styleProp: s.collapsedSize
|
|
218
|
+
});
|
|
219
|
+
l = k(f / n * 100);
|
|
645
220
|
}
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
intersectingHandles.forEach(data => {
|
|
655
|
-
const {
|
|
656
|
-
direction
|
|
657
|
-
} = data;
|
|
658
|
-
if (direction === "horizontal") {
|
|
659
|
-
intersectsHorizontal = true;
|
|
660
|
-
} else {
|
|
661
|
-
intersectsVertical = true;
|
|
221
|
+
let i;
|
|
222
|
+
if (s.defaultSize) {
|
|
223
|
+
const f = ee({
|
|
224
|
+
groupSize: n,
|
|
225
|
+
panelElement: r,
|
|
226
|
+
styleProp: s.defaultSize
|
|
227
|
+
});
|
|
228
|
+
i = k(f / n * 100);
|
|
662
229
|
}
|
|
230
|
+
let a = 0;
|
|
231
|
+
if (s.minSize) {
|
|
232
|
+
const f = ee({
|
|
233
|
+
groupSize: n,
|
|
234
|
+
panelElement: r,
|
|
235
|
+
styleProp: s.minSize
|
|
236
|
+
});
|
|
237
|
+
a = k(f / n * 100);
|
|
238
|
+
}
|
|
239
|
+
let u = 100;
|
|
240
|
+
if (s.maxSize) {
|
|
241
|
+
const f = ee({
|
|
242
|
+
groupSize: n,
|
|
243
|
+
panelElement: r,
|
|
244
|
+
styleProp: s.maxSize
|
|
245
|
+
});
|
|
246
|
+
u = k(f / n * 100);
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
collapsedSize: l,
|
|
250
|
+
collapsible: s.collapsible === !0,
|
|
251
|
+
defaultSize: i,
|
|
252
|
+
minSize: a,
|
|
253
|
+
maxSize: u,
|
|
254
|
+
panelId: o.id
|
|
255
|
+
};
|
|
663
256
|
});
|
|
664
|
-
let constraintFlags = 0;
|
|
665
|
-
panelConstraintFlags.forEach(flag => {
|
|
666
|
-
constraintFlags |= flag;
|
|
667
|
-
});
|
|
668
|
-
if (intersectsHorizontal && intersectsVertical) {
|
|
669
|
-
setGlobalCursorStyle("intersection", constraintFlags, isPointerDown);
|
|
670
|
-
} else if (intersectsHorizontal) {
|
|
671
|
-
setGlobalCursorStyle("horizontal", constraintFlags, isPointerDown);
|
|
672
|
-
} else if (intersectsVertical) {
|
|
673
|
-
setGlobalCursorStyle("vertical", constraintFlags, isPointerDown);
|
|
674
|
-
} else {
|
|
675
|
-
resetGlobalCursorStyle();
|
|
676
|
-
}
|
|
677
257
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
signal: listenersAbortController.signal
|
|
686
|
-
};
|
|
687
|
-
if (!registeredResizeHandlers.size) {
|
|
688
|
-
return;
|
|
258
|
+
class at {
|
|
259
|
+
#e = {};
|
|
260
|
+
addListener(t, n) {
|
|
261
|
+
const o = this.#e[t];
|
|
262
|
+
return o === void 0 ? this.#e[t] = [n] : o.includes(n) || o.push(n), () => {
|
|
263
|
+
this.removeListener(t, n);
|
|
264
|
+
};
|
|
689
265
|
}
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
266
|
+
emit(t, n) {
|
|
267
|
+
const o = this.#e[t];
|
|
268
|
+
if (o !== void 0)
|
|
269
|
+
if (o.length === 1)
|
|
270
|
+
o[0].call(null, n);
|
|
271
|
+
else {
|
|
272
|
+
let r = !1, s = null;
|
|
273
|
+
const l = Array.from(o);
|
|
274
|
+
for (let i = 0; i < l.length; i++) {
|
|
275
|
+
const a = l[i];
|
|
276
|
+
try {
|
|
277
|
+
a.call(null, n);
|
|
278
|
+
} catch (u) {
|
|
279
|
+
s === null && (r = !0, s = u);
|
|
280
|
+
}
|
|
700
281
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
ownerDocumentCounts.forEach((_, ownerDocument) => {
|
|
704
|
-
const {
|
|
705
|
-
body
|
|
706
|
-
} = ownerDocument;
|
|
707
|
-
body.addEventListener("pointerup", handlePointerUp, options);
|
|
708
|
-
body.addEventListener("pointercancel", handlePointerUp, options);
|
|
709
|
-
});
|
|
710
|
-
} else {
|
|
711
|
-
ownerDocumentCounts.forEach((count, ownerDocument) => {
|
|
712
|
-
const {
|
|
713
|
-
body
|
|
714
|
-
} = ownerDocument;
|
|
715
|
-
if (count > 0) {
|
|
716
|
-
body.addEventListener("pointerdown", handlePointerDown, options);
|
|
717
|
-
body.addEventListener("pointermove", handlePointerMove, options);
|
|
282
|
+
if (r)
|
|
283
|
+
throw s;
|
|
718
284
|
}
|
|
719
|
-
});
|
|
720
285
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
registeredResizeHandlers.forEach(data => {
|
|
724
|
-
const {
|
|
725
|
-
setResizeHandlerState
|
|
726
|
-
} = data;
|
|
727
|
-
const isActive = intersectingHandles.includes(data);
|
|
728
|
-
setResizeHandlerState(action, isActive, event);
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
function useForceUpdate() {
|
|
733
|
-
const [_, setCount] = useState(0);
|
|
734
|
-
return useCallback(() => setCount(prevCount => prevCount + 1), []);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
function assert(expectedCondition, message) {
|
|
738
|
-
if (!expectedCondition) {
|
|
739
|
-
console.error(message);
|
|
740
|
-
throw Error(message);
|
|
286
|
+
removeAllListeners() {
|
|
287
|
+
this.#e = {};
|
|
741
288
|
}
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
return actual > expected ? 1 : -1;
|
|
289
|
+
removeListener(t, n) {
|
|
290
|
+
const o = this.#e[t];
|
|
291
|
+
if (o !== void 0) {
|
|
292
|
+
const r = o.indexOf(n);
|
|
293
|
+
r >= 0 && o.splice(r, 1);
|
|
294
|
+
}
|
|
749
295
|
}
|
|
750
296
|
}
|
|
751
|
-
function
|
|
752
|
-
return
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
function fuzzyNumbersEqual(actual, expected, fractionDigits) {
|
|
756
|
-
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
297
|
+
function R(e, t, n = 0) {
|
|
298
|
+
return Math.abs(k(e) - k(t)) <= n;
|
|
757
299
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
}
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
if (fuzzyCompareNumbers(size, halfwayPoint) < 0) {
|
|
792
|
-
size = collapsedSize;
|
|
793
|
-
} else {
|
|
794
|
-
size = minSize;
|
|
300
|
+
let E = {
|
|
301
|
+
cursorFlags: 0,
|
|
302
|
+
interactionState: {
|
|
303
|
+
state: "inactive"
|
|
304
|
+
},
|
|
305
|
+
mountedGroups: /* @__PURE__ */ new Map()
|
|
306
|
+
};
|
|
307
|
+
const _ = new at();
|
|
308
|
+
function G() {
|
|
309
|
+
return E;
|
|
310
|
+
}
|
|
311
|
+
function M(e) {
|
|
312
|
+
const t = typeof e == "function" ? e(E) : e;
|
|
313
|
+
if (E === t)
|
|
314
|
+
return E;
|
|
315
|
+
const n = E;
|
|
316
|
+
return E = {
|
|
317
|
+
...E,
|
|
318
|
+
...t
|
|
319
|
+
}, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange", E.cursorFlags), t.interactionState !== void 0 && _.emit("interactionStateChange", E.interactionState), t.mountedGroups !== void 0 && (E.mountedGroups.forEach((o, r) => {
|
|
320
|
+
o.derivedPanelConstraints.forEach((s) => {
|
|
321
|
+
if (s.collapsible) {
|
|
322
|
+
const { layout: l } = n.mountedGroups.get(r) ?? {};
|
|
323
|
+
if (l) {
|
|
324
|
+
const i = R(
|
|
325
|
+
s.collapsedSize,
|
|
326
|
+
o.layout[s.panelId]
|
|
327
|
+
), a = R(
|
|
328
|
+
s.collapsedSize,
|
|
329
|
+
l[s.panelId]
|
|
330
|
+
);
|
|
331
|
+
i && !a && (r.inMemoryLastExpandedPanelSizes[s.panelId] = l[s.panelId]);
|
|
332
|
+
}
|
|
795
333
|
}
|
|
796
|
-
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
334
|
+
});
|
|
335
|
+
}), _.emit("mountedGroupsChange", E.mountedGroups)), E;
|
|
336
|
+
}
|
|
337
|
+
function lt(e, t) {
|
|
338
|
+
if (e.length !== t.length)
|
|
339
|
+
return !1;
|
|
340
|
+
for (let n = 0; n < e.length; n++)
|
|
341
|
+
if (e[n] != t[n])
|
|
342
|
+
return !1;
|
|
343
|
+
return !0;
|
|
344
|
+
}
|
|
345
|
+
function q(e, t) {
|
|
346
|
+
return R(e, t) ? 0 : e > t ? 1 : -1;
|
|
347
|
+
}
|
|
348
|
+
function W({
|
|
349
|
+
panelConstraints: e,
|
|
350
|
+
size: t
|
|
813
351
|
}) {
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
const localDelta = minSize - prevSize;
|
|
862
|
-
// DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
863
|
-
|
|
864
|
-
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
865
|
-
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
866
|
-
// DEBUG.push(` -> delta: ${delta}`);
|
|
867
|
-
}
|
|
868
|
-
}
|
|
352
|
+
const {
|
|
353
|
+
collapsedSize: n = 0,
|
|
354
|
+
collapsible: o,
|
|
355
|
+
maxSize: r = 100,
|
|
356
|
+
minSize: s = 0
|
|
357
|
+
} = e;
|
|
358
|
+
if (q(t, s) < 0)
|
|
359
|
+
if (o) {
|
|
360
|
+
const l = (n + s) / 2;
|
|
361
|
+
q(t, l) < 0 ? t = n : t = s;
|
|
362
|
+
} else
|
|
363
|
+
t = s;
|
|
364
|
+
return t = Math.min(r, t), t = k(t), t;
|
|
365
|
+
}
|
|
366
|
+
function Y({
|
|
367
|
+
delta: e,
|
|
368
|
+
initialLayout: t,
|
|
369
|
+
panelConstraints: n,
|
|
370
|
+
pivotIndices: o,
|
|
371
|
+
prevLayout: r,
|
|
372
|
+
trigger: s
|
|
373
|
+
}) {
|
|
374
|
+
if (R(e, 0))
|
|
375
|
+
return t;
|
|
376
|
+
const l = Object.values(t), i = Object.values(r), a = [...l], [u, f] = o;
|
|
377
|
+
z(u != null, "Invalid first pivot index"), z(f != null, "Invalid second pivot index");
|
|
378
|
+
let p = 0;
|
|
379
|
+
if (s === "keyboard") {
|
|
380
|
+
{
|
|
381
|
+
const c = e < 0 ? f : u, d = n[c];
|
|
382
|
+
z(
|
|
383
|
+
d,
|
|
384
|
+
`Panel constraints not found for index ${c}`
|
|
385
|
+
);
|
|
386
|
+
const {
|
|
387
|
+
collapsedSize: y = 0,
|
|
388
|
+
collapsible: v,
|
|
389
|
+
minSize: S = 0
|
|
390
|
+
} = d;
|
|
391
|
+
if (v) {
|
|
392
|
+
const x = l[c];
|
|
393
|
+
if (z(
|
|
394
|
+
x != null,
|
|
395
|
+
`Previous layout not found for panel index ${c}`
|
|
396
|
+
), R(x, y)) {
|
|
397
|
+
const g = S - x;
|
|
398
|
+
q(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
869
399
|
}
|
|
870
400
|
}
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
if (
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
893
|
-
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
894
|
-
// DEBUG.push(` -> delta: ${delta}`);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
401
|
+
}
|
|
402
|
+
{
|
|
403
|
+
const c = e < 0 ? u : f, d = n[c];
|
|
404
|
+
z(
|
|
405
|
+
d,
|
|
406
|
+
`No panel constraints found for index ${c}`
|
|
407
|
+
);
|
|
408
|
+
const {
|
|
409
|
+
collapsedSize: y = 0,
|
|
410
|
+
collapsible: v,
|
|
411
|
+
minSize: S = 0
|
|
412
|
+
} = d;
|
|
413
|
+
if (v) {
|
|
414
|
+
const x = l[c];
|
|
415
|
+
if (z(
|
|
416
|
+
x != null,
|
|
417
|
+
`Previous layout not found for panel index ${c}`
|
|
418
|
+
), R(x, S)) {
|
|
419
|
+
const g = x - y;
|
|
420
|
+
q(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
897
421
|
}
|
|
898
422
|
}
|
|
899
423
|
}
|
|
900
|
-
// DEBUG.push("");
|
|
901
424
|
}
|
|
902
|
-
|
|
903
425
|
{
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
// DEBUG.push("pre calc...");
|
|
915
|
-
while (true) {
|
|
916
|
-
const prevSize = initialLayout[index];
|
|
917
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
918
|
-
const maxSafeSize = resizePanel({
|
|
919
|
-
panelConstraints: panelConstraintsArray,
|
|
920
|
-
panelIndex: index,
|
|
426
|
+
const c = e < 0 ? 1 : -1;
|
|
427
|
+
let d = e < 0 ? f : u, y = 0;
|
|
428
|
+
for (; ; ) {
|
|
429
|
+
const S = l[d];
|
|
430
|
+
z(
|
|
431
|
+
S != null,
|
|
432
|
+
`Previous layout not found for panel index ${d}`
|
|
433
|
+
);
|
|
434
|
+
const g = W({
|
|
435
|
+
panelConstraints: n[d],
|
|
921
436
|
size: 100
|
|
922
|
-
});
|
|
923
|
-
|
|
924
|
-
// DEBUG.push(` ${index}: ${prevSize} -> ${maxSafeSize}`);
|
|
925
|
-
|
|
926
|
-
maxAvailableDelta += delta;
|
|
927
|
-
index += increment;
|
|
928
|
-
if (index < 0 || index >= panelConstraintsArray.length) {
|
|
437
|
+
}) - S;
|
|
438
|
+
if (y += g, d += c, d < 0 || d >= n.length)
|
|
929
439
|
break;
|
|
930
|
-
}
|
|
931
440
|
}
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
const minAbsDelta = Math.min(Math.abs(delta), Math.abs(maxAvailableDelta));
|
|
935
|
-
delta = delta < 0 ? 0 - minAbsDelta : minAbsDelta;
|
|
936
|
-
// DEBUG.push(` -> adjusted delta: ${delta}`);
|
|
937
|
-
// DEBUG.push("");
|
|
441
|
+
const v = Math.min(Math.abs(e), Math.abs(y));
|
|
442
|
+
e = e < 0 ? 0 - v : v;
|
|
938
443
|
}
|
|
939
|
-
|
|
940
444
|
{
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
panelConstraints: panelConstraintsArray,
|
|
952
|
-
panelIndex: index,
|
|
953
|
-
size: unsafeSize
|
|
445
|
+
let d = e < 0 ? u : f;
|
|
446
|
+
for (; d >= 0 && d < n.length; ) {
|
|
447
|
+
const y = Math.abs(e) - Math.abs(p), v = l[d];
|
|
448
|
+
z(
|
|
449
|
+
v != null,
|
|
450
|
+
`Previous layout not found for panel index ${d}`
|
|
451
|
+
);
|
|
452
|
+
const S = v - y, x = W({
|
|
453
|
+
panelConstraints: n[d],
|
|
454
|
+
size: S
|
|
954
455
|
});
|
|
955
|
-
if (!
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}) >= 0) {
|
|
961
|
-
break;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
if (delta < 0) {
|
|
965
|
-
index--;
|
|
966
|
-
} else {
|
|
967
|
-
index++;
|
|
968
|
-
}
|
|
456
|
+
if (!R(v, x) && (p += v - x, a[d] = x, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
457
|
+
numeric: !0
|
|
458
|
+
}) >= 0))
|
|
459
|
+
break;
|
|
460
|
+
e < 0 ? d-- : d++;
|
|
969
461
|
}
|
|
970
462
|
}
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
// DEBUG.push("");
|
|
974
|
-
|
|
975
|
-
// If we were unable to resize any of the panels panels, return the previous state.
|
|
976
|
-
// This will essentially bailout and ignore e.g. drags past a panel's boundaries
|
|
977
|
-
if (fuzzyLayoutsEqual(prevLayout, nextLayout)) {
|
|
978
|
-
// DEBUG.push(`bailout to previous layout: ${prevLayout.join(", ")}`);
|
|
979
|
-
// console.log(DEBUG.join("\n"));
|
|
980
|
-
|
|
981
|
-
return prevLayout;
|
|
982
|
-
}
|
|
463
|
+
if (lt(i, a))
|
|
464
|
+
return r;
|
|
983
465
|
{
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
const
|
|
990
|
-
panelConstraints:
|
|
991
|
-
|
|
992
|
-
size: unsafeSize
|
|
466
|
+
const c = e < 0 ? f : u, d = l[c];
|
|
467
|
+
z(
|
|
468
|
+
d != null,
|
|
469
|
+
`Previous layout not found for panel index ${c}`
|
|
470
|
+
);
|
|
471
|
+
const y = d + p, v = W({
|
|
472
|
+
panelConstraints: n[c],
|
|
473
|
+
size: y
|
|
993
474
|
});
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
1006
|
-
const unsafeSize = prevSize + deltaRemaining;
|
|
1007
|
-
const safeSize = resizePanel({
|
|
1008
|
-
panelConstraints: panelConstraintsArray,
|
|
1009
|
-
panelIndex: index,
|
|
1010
|
-
size: unsafeSize
|
|
475
|
+
if (a[c] = v, !R(v, y)) {
|
|
476
|
+
let S = y - v, g = e < 0 ? f : u;
|
|
477
|
+
for (; g >= 0 && g < n.length; ) {
|
|
478
|
+
const b = a[g];
|
|
479
|
+
z(
|
|
480
|
+
b != null,
|
|
481
|
+
`Previous layout not found for panel index ${g}`
|
|
482
|
+
);
|
|
483
|
+
const w = b + S, C = W({
|
|
484
|
+
panelConstraints: n[g],
|
|
485
|
+
size: w
|
|
1011
486
|
});
|
|
1012
|
-
if (
|
|
1013
|
-
deltaRemaining -= safeSize - prevSize;
|
|
1014
|
-
nextLayout[index] = safeSize;
|
|
1015
|
-
}
|
|
1016
|
-
if (fuzzyNumbersEqual(deltaRemaining, 0)) {
|
|
487
|
+
if (R(b, C) || (S -= C - b, a[g] = C), R(S, 0))
|
|
1017
488
|
break;
|
|
1018
|
-
|
|
1019
|
-
if (delta > 0) {
|
|
1020
|
-
index--;
|
|
1021
|
-
} else {
|
|
1022
|
-
index++;
|
|
1023
|
-
}
|
|
489
|
+
e > 0 ? g-- : g++;
|
|
1024
490
|
}
|
|
1025
491
|
}
|
|
1026
492
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
493
|
+
const m = Object.values(a).reduce(
|
|
494
|
+
(c, d) => d + c,
|
|
495
|
+
0
|
|
496
|
+
);
|
|
497
|
+
if (!R(m, 100, 0.1))
|
|
498
|
+
return r;
|
|
499
|
+
const h = Object.keys(r);
|
|
500
|
+
return a.reduce((c, d, y) => (c[h[y]] = d, c), {});
|
|
501
|
+
}
|
|
502
|
+
function ne(e) {
|
|
503
|
+
const t = e.parentElement;
|
|
504
|
+
z(t, "Parent group element not found");
|
|
505
|
+
const { mountedGroups: n } = G();
|
|
506
|
+
for (const [o] of n)
|
|
507
|
+
if (o.element === t)
|
|
508
|
+
return o;
|
|
509
|
+
throw Error("Could not find parent Group for separator element");
|
|
510
|
+
}
|
|
511
|
+
function K(e, t) {
|
|
512
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
513
|
+
return !1;
|
|
514
|
+
for (const n in e)
|
|
515
|
+
if (t[n] === void 0 || q(e[n], t[n]) !== 0)
|
|
516
|
+
return !1;
|
|
517
|
+
return !0;
|
|
518
|
+
}
|
|
519
|
+
function N({
|
|
520
|
+
layout: e,
|
|
521
|
+
panelConstraints: t
|
|
1051
522
|
}) {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
minSize = 0
|
|
1067
|
-
} = constraints;
|
|
1068
|
-
if (index === firstIndex) {
|
|
1069
|
-
currentMinSize = minSize;
|
|
1070
|
-
currentMaxSize = maxSize;
|
|
1071
|
-
} else {
|
|
1072
|
-
totalMinSize += minSize;
|
|
1073
|
-
totalMaxSize += maxSize;
|
|
523
|
+
const o = [...Object.values(e)], r = o.reduce(
|
|
524
|
+
(i, a) => i + a,
|
|
525
|
+
0
|
|
526
|
+
);
|
|
527
|
+
if (o.length !== t.length)
|
|
528
|
+
throw Error(
|
|
529
|
+
`Invalid ${t.length} panel layout: ${o.map((i) => `${i}%`).join(", ")}`
|
|
530
|
+
);
|
|
531
|
+
if (!R(r, 100) && o.length > 0)
|
|
532
|
+
for (let i = 0; i < t.length; i++) {
|
|
533
|
+
const a = o[i];
|
|
534
|
+
z(a != null, `No layout data found for index ${i}`);
|
|
535
|
+
const u = 100 / r * a;
|
|
536
|
+
o[i] = u;
|
|
1074
537
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
function getResizeHandleElementsForGroup(groupId, scope = document) {
|
|
1087
|
-
return Array.from(scope.querySelectorAll(`[${DATA_ATTRIBUTES.resizeHandleId}][data-panel-group-id="${groupId}"]`));
|
|
1088
|
-
}
|
|
1089
|
-
|
|
1090
|
-
function getResizeHandleElementIndex(groupId, id, scope = document) {
|
|
1091
|
-
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
1092
|
-
const index = handles.findIndex(handle => handle.getAttribute(DATA_ATTRIBUTES.resizeHandleId) === id);
|
|
1093
|
-
return index !== null && index !== void 0 ? index : null;
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
function determinePivotIndices(groupId, dragHandleId, panelGroupElement) {
|
|
1097
|
-
const index = getResizeHandleElementIndex(groupId, dragHandleId, panelGroupElement);
|
|
1098
|
-
return index != null ? [index, index + 1] : [-1, -1];
|
|
1099
|
-
}
|
|
1100
|
-
|
|
1101
|
-
function isHTMLElement(target) {
|
|
1102
|
-
if (target instanceof HTMLElement) {
|
|
1103
|
-
return true;
|
|
1104
|
-
}
|
|
1105
|
-
|
|
1106
|
-
// Fallback to duck typing to handle edge case of portals within a popup window
|
|
1107
|
-
return typeof target === "object" && target !== null && "tagName" in target && "getAttribute" in target;
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
function getPanelGroupElement(id, rootElement = document) {
|
|
1111
|
-
// If the root element is the PanelGroup
|
|
1112
|
-
if (isHTMLElement(rootElement) && rootElement.dataset.panelGroupId == id) {
|
|
1113
|
-
return rootElement;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
// Else query children
|
|
1117
|
-
const element = rootElement.querySelector(`[data-panel-group][data-panel-group-id="${id}"]`);
|
|
1118
|
-
if (element) {
|
|
1119
|
-
return element;
|
|
1120
|
-
}
|
|
1121
|
-
return null;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
function getResizeHandleElement(id, scope = document) {
|
|
1125
|
-
const element = scope.querySelector(`[${DATA_ATTRIBUTES.resizeHandleId}="${id}"]`);
|
|
1126
|
-
if (element) {
|
|
1127
|
-
return element;
|
|
538
|
+
let s = 0;
|
|
539
|
+
for (let i = 0; i < t.length; i++) {
|
|
540
|
+
const a = o[i];
|
|
541
|
+
z(a != null, `No layout data found for index ${i}`);
|
|
542
|
+
const u = W({
|
|
543
|
+
panelConstraints: t[i],
|
|
544
|
+
size: a
|
|
545
|
+
});
|
|
546
|
+
a != u && (s += a - u, o[i] = u);
|
|
1128
547
|
}
|
|
1129
|
-
|
|
548
|
+
if (!R(s, 0))
|
|
549
|
+
for (let i = 0; i < t.length; i++) {
|
|
550
|
+
const a = o[i];
|
|
551
|
+
z(a != null, `No layout data found for index ${i}`);
|
|
552
|
+
const u = a + s, f = W({
|
|
553
|
+
panelConstraints: t[i],
|
|
554
|
+
size: u
|
|
555
|
+
});
|
|
556
|
+
if (a !== f && (s -= f - a, o[i] = f, R(s, 0)))
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
const l = Object.keys(e);
|
|
560
|
+
return o.reduce((i, a, u) => (i[l[u]] = a, i), {});
|
|
1130
561
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
var _panelsArray$index$id, _panelsArray$index, _panelsArray$id, _panelsArray;
|
|
1134
|
-
const handle = getResizeHandleElement(handleId, scope);
|
|
1135
|
-
const handles = getResizeHandleElementsForGroup(groupId, scope);
|
|
1136
|
-
const index = handle ? handles.indexOf(handle) : -1;
|
|
1137
|
-
const idBefore = (_panelsArray$index$id = (_panelsArray$index = panelsArray[index]) === null || _panelsArray$index === void 0 ? void 0 : _panelsArray$index.id) !== null && _panelsArray$index$id !== void 0 ? _panelsArray$index$id : null;
|
|
1138
|
-
const idAfter = (_panelsArray$id = (_panelsArray = panelsArray[index + 1]) === null || _panelsArray === void 0 ? void 0 : _panelsArray.id) !== null && _panelsArray$id !== void 0 ? _panelsArray$id : null;
|
|
1139
|
-
return [idBefore, idAfter];
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
// https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/
|
|
1143
|
-
|
|
1144
|
-
function useWindowSplitterPanelGroupBehavior({
|
|
1145
|
-
committedValuesRef,
|
|
1146
|
-
eagerValuesRef,
|
|
1147
|
-
groupId,
|
|
1148
|
-
layout,
|
|
1149
|
-
panelDataArray,
|
|
1150
|
-
panelGroupElement,
|
|
1151
|
-
setLayout
|
|
562
|
+
function Ge({
|
|
563
|
+
groupId: e
|
|
1152
564
|
}) {
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
565
|
+
const t = () => {
|
|
566
|
+
const { mountedGroups: n } = G();
|
|
567
|
+
for (const [o, r] of n)
|
|
568
|
+
if (o.id === e)
|
|
569
|
+
return { group: o, ...r };
|
|
570
|
+
throw Error(`Could not find Group with id "${e}"`);
|
|
571
|
+
};
|
|
572
|
+
return {
|
|
573
|
+
getLayout() {
|
|
574
|
+
const { defaultLayoutDeferred: n, layout: o } = t();
|
|
575
|
+
return n ? {} : o;
|
|
576
|
+
},
|
|
577
|
+
setLayout(n) {
|
|
1162
578
|
const {
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
const resizeHandleElement = resizeHandleElements[index];
|
|
1172
|
-
if (resizeHandleElement == null) ; else {
|
|
1173
|
-
const panelData = panelDataArray[index];
|
|
1174
|
-
assert(panelData, `No panel data found for index "${index}"`);
|
|
1175
|
-
resizeHandleElement.setAttribute("aria-controls", panelData.id);
|
|
1176
|
-
resizeHandleElement.setAttribute("aria-valuemax", "" + Math.round(valueMax));
|
|
1177
|
-
resizeHandleElement.setAttribute("aria-valuemin", "" + Math.round(valueMin));
|
|
1178
|
-
resizeHandleElement.setAttribute("aria-valuenow", valueNow != null ? "" + Math.round(valueNow) : "");
|
|
1179
|
-
}
|
|
1180
|
-
}
|
|
1181
|
-
return () => {
|
|
1182
|
-
resizeHandleElements.forEach((resizeHandleElement, index) => {
|
|
1183
|
-
resizeHandleElement.removeAttribute("aria-controls");
|
|
1184
|
-
resizeHandleElement.removeAttribute("aria-valuemax");
|
|
1185
|
-
resizeHandleElement.removeAttribute("aria-valuemin");
|
|
1186
|
-
resizeHandleElement.removeAttribute("aria-valuenow");
|
|
579
|
+
defaultLayoutDeferred: o,
|
|
580
|
+
derivedPanelConstraints: r,
|
|
581
|
+
group: s,
|
|
582
|
+
layout: l,
|
|
583
|
+
separatorToPanels: i
|
|
584
|
+
} = t(), a = N({
|
|
585
|
+
layout: n,
|
|
586
|
+
panelConstraints: r
|
|
1187
587
|
});
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
588
|
+
return o ? l : (K(l, a) || M((u) => ({
|
|
589
|
+
mountedGroups: new Map(u.mountedGroups).set(s, {
|
|
590
|
+
defaultLayoutDeferred: o,
|
|
591
|
+
derivedPanelConstraints: r,
|
|
592
|
+
layout: a,
|
|
593
|
+
separatorToPanels: i
|
|
594
|
+
})
|
|
595
|
+
})), a);
|
|
1193
596
|
}
|
|
1194
|
-
|
|
1195
|
-
assert(eagerValues, `Eager values not found`);
|
|
1196
|
-
const {
|
|
1197
|
-
panelDataArray
|
|
1198
|
-
} = eagerValues;
|
|
1199
|
-
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1200
|
-
assert(groupElement != null, `No group found for id "${groupId}"`);
|
|
1201
|
-
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1202
|
-
assert(handles, `No resize handles found for group id "${groupId}"`);
|
|
1203
|
-
const cleanupFunctions = handles.map(handle => {
|
|
1204
|
-
const handleId = handle.getAttribute(DATA_ATTRIBUTES.resizeHandleId);
|
|
1205
|
-
assert(handleId, `Resize handle element has no handle id attribute`);
|
|
1206
|
-
const [idBefore, idAfter] = getResizeHandlePanelIds(groupId, handleId, panelDataArray, panelGroupElement);
|
|
1207
|
-
if (idBefore == null || idAfter == null) {
|
|
1208
|
-
return () => {};
|
|
1209
|
-
}
|
|
1210
|
-
const onKeyDown = event => {
|
|
1211
|
-
if (event.defaultPrevented) {
|
|
1212
|
-
return;
|
|
1213
|
-
}
|
|
1214
|
-
switch (event.key) {
|
|
1215
|
-
case "Enter":
|
|
1216
|
-
{
|
|
1217
|
-
event.preventDefault();
|
|
1218
|
-
const index = panelDataArray.findIndex(panelData => panelData.id === idBefore);
|
|
1219
|
-
if (index >= 0) {
|
|
1220
|
-
const panelData = panelDataArray[index];
|
|
1221
|
-
assert(panelData, `No panel data found for index ${index}`);
|
|
1222
|
-
const size = layout[index];
|
|
1223
|
-
const {
|
|
1224
|
-
collapsedSize = 0,
|
|
1225
|
-
collapsible,
|
|
1226
|
-
minSize = 0
|
|
1227
|
-
} = panelData.constraints;
|
|
1228
|
-
if (size != null && collapsible) {
|
|
1229
|
-
const nextLayout = adjustLayoutByDelta({
|
|
1230
|
-
delta: fuzzyNumbersEqual(size, collapsedSize) ? minSize - collapsedSize : collapsedSize - size,
|
|
1231
|
-
initialLayout: layout,
|
|
1232
|
-
panelConstraints: panelDataArray.map(panelData => panelData.constraints),
|
|
1233
|
-
pivotIndices: determinePivotIndices(groupId, handleId, panelGroupElement),
|
|
1234
|
-
prevLayout: layout,
|
|
1235
|
-
trigger: "keyboard"
|
|
1236
|
-
});
|
|
1237
|
-
if (layout !== nextLayout) {
|
|
1238
|
-
setLayout(nextLayout);
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
break;
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
};
|
|
1246
|
-
handle.addEventListener("keydown", onKeyDown);
|
|
1247
|
-
return () => {
|
|
1248
|
-
handle.removeEventListener("keydown", onKeyDown);
|
|
1249
|
-
};
|
|
1250
|
-
});
|
|
1251
|
-
return () => {
|
|
1252
|
-
cleanupFunctions.forEach(cleanupFunction => cleanupFunction());
|
|
1253
|
-
};
|
|
1254
|
-
}, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
597
|
+
};
|
|
1255
598
|
}
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
599
|
+
function De(e) {
|
|
600
|
+
const { mountedGroups: t } = G(), n = t.get(e);
|
|
601
|
+
return z(n, `Mounted Group ${e.id} not found`), n;
|
|
602
|
+
}
|
|
603
|
+
function T(e, t) {
|
|
604
|
+
const n = ne(e), o = De(n), r = n.separators.find(
|
|
605
|
+
(p) => p.element === e
|
|
606
|
+
);
|
|
607
|
+
z(r, "Matching separator not found");
|
|
608
|
+
const s = o.separatorToPanels.get(r);
|
|
609
|
+
z(s, "Matching panels not found");
|
|
610
|
+
const l = s.map((p) => n.panels.indexOf(p)), a = Ge({ groupId: n.id }).getLayout(), u = Y({
|
|
611
|
+
delta: t,
|
|
612
|
+
initialLayout: a,
|
|
613
|
+
panelConstraints: o.derivedPanelConstraints,
|
|
614
|
+
pivotIndices: l,
|
|
615
|
+
prevLayout: a,
|
|
616
|
+
trigger: "keyboard"
|
|
617
|
+
}), f = N({
|
|
618
|
+
layout: u,
|
|
619
|
+
panelConstraints: o.derivedPanelConstraints
|
|
620
|
+
});
|
|
621
|
+
K(a, f) || M((p) => ({
|
|
622
|
+
mountedGroups: new Map(p.mountedGroups).set(n, {
|
|
623
|
+
defaultLayoutDeferred: o.defaultLayoutDeferred,
|
|
624
|
+
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
625
|
+
layout: f,
|
|
626
|
+
separatorToPanels: o.separatorToPanels
|
|
627
|
+
})
|
|
628
|
+
}));
|
|
1267
629
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
const
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
function calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement) {
|
|
1279
|
-
const isHorizontal = direction === "horizontal";
|
|
1280
|
-
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElement);
|
|
1281
|
-
assert(handleElement, `No resize handle element found for id "${dragHandleId}"`);
|
|
1282
|
-
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
1283
|
-
assert(groupId, `Resize handle element has no group id attribute`);
|
|
1284
|
-
let {
|
|
1285
|
-
initialCursorPosition
|
|
1286
|
-
} = initialDragState;
|
|
1287
|
-
const cursorPosition = getResizeEventCursorPosition(direction, event);
|
|
1288
|
-
const groupElement = getPanelGroupElement(groupId, panelGroupElement);
|
|
1289
|
-
assert(groupElement, `No group element found for id "${groupId}"`);
|
|
1290
|
-
const groupRect = groupElement.getBoundingClientRect();
|
|
1291
|
-
const groupSizeInPixels = isHorizontal ? groupRect.width : groupRect.height;
|
|
1292
|
-
const offsetPixels = cursorPosition - initialCursorPosition;
|
|
1293
|
-
const offsetPercentage = offsetPixels / groupSizeInPixels * 100;
|
|
1294
|
-
return offsetPercentage;
|
|
1295
|
-
}
|
|
1296
|
-
|
|
1297
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/movementX
|
|
1298
|
-
function calculateDeltaPercentage(event, dragHandleId, direction, initialDragState, keyboardResizeBy, panelGroupElement) {
|
|
1299
|
-
if (isKeyDown(event)) {
|
|
1300
|
-
const isHorizontal = direction === "horizontal";
|
|
1301
|
-
let delta = 0;
|
|
1302
|
-
if (event.shiftKey) {
|
|
1303
|
-
delta = 100;
|
|
1304
|
-
} else if (keyboardResizeBy != null) {
|
|
1305
|
-
delta = keyboardResizeBy;
|
|
1306
|
-
} else {
|
|
1307
|
-
delta = 10;
|
|
1308
|
-
}
|
|
1309
|
-
let movement = 0;
|
|
1310
|
-
switch (event.key) {
|
|
1311
|
-
case "ArrowDown":
|
|
1312
|
-
movement = isHorizontal ? 0 : delta;
|
|
1313
|
-
break;
|
|
1314
|
-
case "ArrowLeft":
|
|
1315
|
-
movement = isHorizontal ? -delta : 0;
|
|
630
|
+
function ye(e) {
|
|
631
|
+
if (e.defaultPrevented)
|
|
632
|
+
return;
|
|
633
|
+
const t = e.currentTarget, n = ne(t);
|
|
634
|
+
if (!n.disabled)
|
|
635
|
+
switch (e.key) {
|
|
636
|
+
case "ArrowDown": {
|
|
637
|
+
e.preventDefault(), n.orientation === "vertical" && T(t, 5);
|
|
1316
638
|
break;
|
|
1317
|
-
|
|
1318
|
-
|
|
639
|
+
}
|
|
640
|
+
case "ArrowLeft": {
|
|
641
|
+
e.preventDefault(), n.orientation === "horizontal" && T(t, -5);
|
|
1319
642
|
break;
|
|
1320
|
-
|
|
1321
|
-
|
|
643
|
+
}
|
|
644
|
+
case "ArrowRight": {
|
|
645
|
+
e.preventDefault(), n.orientation === "horizontal" && T(t, 5);
|
|
1322
646
|
break;
|
|
1323
|
-
|
|
1324
|
-
|
|
647
|
+
}
|
|
648
|
+
case "ArrowUp": {
|
|
649
|
+
e.preventDefault(), n.orientation === "vertical" && T(t, -5);
|
|
1325
650
|
break;
|
|
1326
|
-
|
|
1327
|
-
|
|
651
|
+
}
|
|
652
|
+
case "End": {
|
|
653
|
+
e.preventDefault(), T(t, 100);
|
|
1328
654
|
break;
|
|
1329
|
-
}
|
|
1330
|
-
return movement;
|
|
1331
|
-
} else {
|
|
1332
|
-
if (initialDragState == null) {
|
|
1333
|
-
return 0;
|
|
1334
|
-
}
|
|
1335
|
-
return calculateDragOffsetPercentage(event, dragHandleId, direction, initialDragState, panelGroupElement);
|
|
1336
|
-
}
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
|
-
function calculateUnsafeDefaultLayout({
|
|
1340
|
-
panelDataArray
|
|
1341
|
-
}) {
|
|
1342
|
-
const layout = Array(panelDataArray.length);
|
|
1343
|
-
const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
|
|
1344
|
-
let numPanelsWithSizes = 0;
|
|
1345
|
-
let remainingSize = 100;
|
|
1346
|
-
|
|
1347
|
-
// Distribute default sizes first
|
|
1348
|
-
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1349
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
1350
|
-
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1351
|
-
const {
|
|
1352
|
-
defaultSize
|
|
1353
|
-
} = panelConstraints;
|
|
1354
|
-
if (defaultSize != null) {
|
|
1355
|
-
numPanelsWithSizes++;
|
|
1356
|
-
layout[index] = defaultSize;
|
|
1357
|
-
remainingSize -= defaultSize;
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
// Remaining size should be distributed evenly between panels without default sizes
|
|
1362
|
-
for (let index = 0; index < panelDataArray.length; index++) {
|
|
1363
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
1364
|
-
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
1365
|
-
const {
|
|
1366
|
-
defaultSize
|
|
1367
|
-
} = panelConstraints;
|
|
1368
|
-
if (defaultSize != null) {
|
|
1369
|
-
continue;
|
|
1370
|
-
}
|
|
1371
|
-
const numRemainingPanels = panelDataArray.length - numPanelsWithSizes;
|
|
1372
|
-
const size = remainingSize / numRemainingPanels;
|
|
1373
|
-
numPanelsWithSizes++;
|
|
1374
|
-
layout[index] = size;
|
|
1375
|
-
remainingSize -= size;
|
|
1376
|
-
}
|
|
1377
|
-
return layout;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
|
-
// Layout should be pre-converted into percentages
|
|
1381
|
-
function callPanelCallbacks(panelsArray, layout, panelIdToLastNotifiedSizeMap) {
|
|
1382
|
-
layout.forEach((size, index) => {
|
|
1383
|
-
const panelData = panelsArray[index];
|
|
1384
|
-
assert(panelData, `Panel data not found for index ${index}`);
|
|
1385
|
-
const {
|
|
1386
|
-
callbacks,
|
|
1387
|
-
constraints,
|
|
1388
|
-
id: panelId
|
|
1389
|
-
} = panelData;
|
|
1390
|
-
const {
|
|
1391
|
-
collapsedSize = 0,
|
|
1392
|
-
collapsible
|
|
1393
|
-
} = constraints;
|
|
1394
|
-
const lastNotifiedSize = panelIdToLastNotifiedSizeMap[panelId];
|
|
1395
|
-
if (lastNotifiedSize == null || size !== lastNotifiedSize) {
|
|
1396
|
-
panelIdToLastNotifiedSizeMap[panelId] = size;
|
|
1397
|
-
const {
|
|
1398
|
-
onCollapse,
|
|
1399
|
-
onExpand,
|
|
1400
|
-
onResize
|
|
1401
|
-
} = callbacks;
|
|
1402
|
-
if (onResize) {
|
|
1403
|
-
onResize(size, lastNotifiedSize);
|
|
1404
655
|
}
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
656
|
+
case "Enter": {
|
|
657
|
+
e.preventDefault();
|
|
658
|
+
const o = ne(t), { derivedPanelConstraints: r, layout: s, separatorToPanels: l } = De(o), i = o.separators.find(
|
|
659
|
+
(p) => p.element === t
|
|
660
|
+
);
|
|
661
|
+
z(i, "Matching separator not found");
|
|
662
|
+
const a = l.get(i);
|
|
663
|
+
z(a, "Matching panels not found");
|
|
664
|
+
const u = a[0], f = r.find(
|
|
665
|
+
(p) => p.panelId === u.id
|
|
666
|
+
);
|
|
667
|
+
if (z(f, "Panel metadata not found"), f.collapsible) {
|
|
668
|
+
const p = s[u.id], m = f.collapsedSize === p ? o.inMemoryLastExpandedPanelSizes[u.id] ?? f.minSize : f.collapsedSize;
|
|
669
|
+
T(t, m - p);
|
|
1411
670
|
}
|
|
671
|
+
break;
|
|
672
|
+
}
|
|
673
|
+
case "F6": {
|
|
674
|
+
e.preventDefault();
|
|
675
|
+
const r = ne(t).separators.map(
|
|
676
|
+
(a) => a.element
|
|
677
|
+
), s = Array.from(r).findIndex(
|
|
678
|
+
(a) => a === e.currentTarget
|
|
679
|
+
);
|
|
680
|
+
z(s !== null, "Index not found");
|
|
681
|
+
const l = e.shiftKey ? s > 0 ? s - 1 : r.length - 1 : s + 1 < r.length ? s + 1 : 0;
|
|
682
|
+
r[l].focus();
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
case "Home": {
|
|
686
|
+
e.preventDefault(), T(t, -100);
|
|
687
|
+
break;
|
|
1412
688
|
}
|
|
1413
689
|
}
|
|
1414
|
-
});
|
|
1415
690
|
}
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
691
|
+
const ut = (e) => e, ie = () => {
|
|
692
|
+
}, Oe = 1, Te = 2, _e = 4, Ne = 8, ge = {
|
|
693
|
+
coarse: 10,
|
|
694
|
+
precise: 5
|
|
695
|
+
};
|
|
696
|
+
function ct(e, t, n) {
|
|
697
|
+
let o, r = {
|
|
698
|
+
x: 1 / 0,
|
|
699
|
+
y: 1 / 0
|
|
700
|
+
};
|
|
701
|
+
for (const s of t) {
|
|
702
|
+
const l = Ie(n, s.rect);
|
|
703
|
+
switch (e) {
|
|
704
|
+
case "horizontal": {
|
|
705
|
+
l.x <= r.x && (o = s, r = l);
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
case "vertical": {
|
|
709
|
+
l.y <= r.y && (o = s, r = l);
|
|
710
|
+
break;
|
|
1424
711
|
}
|
|
1425
712
|
}
|
|
1426
713
|
}
|
|
1427
|
-
return
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
function
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
const
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
// Initial render (before panels have registered themselves)
|
|
1445
|
-
// In order to support server rendering, fall back to default size if provided
|
|
1446
|
-
flexGrow = defaultSize != undefined ? defaultSize.toFixed(precision) : "1";
|
|
1447
|
-
} else if (panelData.length === 1) {
|
|
1448
|
-
// Special case: Single panel group should always fill full width/height
|
|
1449
|
-
flexGrow = "1";
|
|
1450
|
-
} else {
|
|
1451
|
-
flexGrow = size.toFixed(precision);
|
|
1452
|
-
}
|
|
1453
|
-
return {
|
|
1454
|
-
flexBasis: 0,
|
|
1455
|
-
flexGrow,
|
|
1456
|
-
flexShrink: 1,
|
|
1457
|
-
// Without this, Panel sizes may be unintentionally overridden by their content
|
|
1458
|
-
overflow: "hidden",
|
|
1459
|
-
// Disable pointer events inside of a panel during resize
|
|
1460
|
-
// This avoid edge cases like nested iframes
|
|
1461
|
-
pointerEvents: dragState !== null ? "none" : undefined
|
|
714
|
+
return o ? {
|
|
715
|
+
distance: r,
|
|
716
|
+
hitRegion: o
|
|
717
|
+
} : void 0;
|
|
718
|
+
}
|
|
719
|
+
let te;
|
|
720
|
+
function ft() {
|
|
721
|
+
return te === void 0 && (typeof matchMedia == "function" ? te = !!matchMedia("(pointer:coarse)").matches : te = !1), te;
|
|
722
|
+
}
|
|
723
|
+
function dt(e) {
|
|
724
|
+
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
725
|
+
}
|
|
726
|
+
function pt(e, t) {
|
|
727
|
+
if (e === t) throw new Error("Cannot compare node with itself");
|
|
728
|
+
const n = {
|
|
729
|
+
a: xe(e),
|
|
730
|
+
b: xe(t)
|
|
1462
731
|
};
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
}, durationMs);
|
|
732
|
+
let o;
|
|
733
|
+
for (; n.a.at(-1) === n.b.at(-1); )
|
|
734
|
+
e = n.a.pop(), t = n.b.pop(), o = e;
|
|
735
|
+
z(
|
|
736
|
+
o,
|
|
737
|
+
"Stacking order can only be calculated for elements with a common ancestor"
|
|
738
|
+
);
|
|
739
|
+
const r = {
|
|
740
|
+
a: Se(ve(n.a)),
|
|
741
|
+
b: Se(ve(n.b))
|
|
1474
742
|
};
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
// Bypass this check for future calls
|
|
1486
|
-
storageObject.getItem = name => {
|
|
1487
|
-
return localStorage.getItem(name);
|
|
1488
|
-
};
|
|
1489
|
-
storageObject.setItem = (name, value) => {
|
|
1490
|
-
localStorage.setItem(name, value);
|
|
1491
|
-
};
|
|
1492
|
-
} else {
|
|
1493
|
-
throw new Error("localStorage not supported in this environment");
|
|
743
|
+
if (r.a === r.b) {
|
|
744
|
+
const s = o.childNodes, l = {
|
|
745
|
+
a: n.a.at(-1),
|
|
746
|
+
b: n.b.at(-1)
|
|
747
|
+
};
|
|
748
|
+
let i = s.length;
|
|
749
|
+
for (; i--; ) {
|
|
750
|
+
const a = s[i];
|
|
751
|
+
if (a === l.a) return 1;
|
|
752
|
+
if (a === l.b) return -1;
|
|
1494
753
|
}
|
|
1495
|
-
} catch (error) {
|
|
1496
|
-
console.error(error);
|
|
1497
|
-
storageObject.getItem = () => null;
|
|
1498
|
-
storageObject.setItem = () => {};
|
|
1499
754
|
}
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
} = panel;
|
|
1518
|
-
if (idIsFromProps) {
|
|
1519
|
-
return id;
|
|
1520
|
-
} else {
|
|
1521
|
-
return order ? `${order}:${JSON.stringify(constraints)}` : JSON.stringify(constraints);
|
|
1522
|
-
}
|
|
1523
|
-
}).sort((a, b) => a.localeCompare(b)).join(",");
|
|
1524
|
-
}
|
|
1525
|
-
function loadSerializedPanelGroupState(autoSaveId, storage) {
|
|
1526
|
-
try {
|
|
1527
|
-
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
1528
|
-
const serialized = storage.getItem(panelGroupKey);
|
|
1529
|
-
if (serialized) {
|
|
1530
|
-
const parsed = JSON.parse(serialized);
|
|
1531
|
-
if (typeof parsed === "object" && parsed != null) {
|
|
1532
|
-
return parsed;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
} catch (error) {}
|
|
755
|
+
return Math.sign(r.a - r.b);
|
|
756
|
+
}
|
|
757
|
+
const mt = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
758
|
+
function ht(e) {
|
|
759
|
+
const t = getComputedStyle(Ae(e) ?? e).display;
|
|
760
|
+
return t === "flex" || t === "inline-flex";
|
|
761
|
+
}
|
|
762
|
+
function yt(e) {
|
|
763
|
+
const t = getComputedStyle(e);
|
|
764
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ht(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || mt.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
765
|
+
}
|
|
766
|
+
function ve(e) {
|
|
767
|
+
let t = e.length;
|
|
768
|
+
for (; t--; ) {
|
|
769
|
+
const n = e[t];
|
|
770
|
+
if (z(n, "Missing node"), yt(n)) return n;
|
|
771
|
+
}
|
|
1536
772
|
return null;
|
|
1537
773
|
}
|
|
1538
|
-
function
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
const
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
try {
|
|
1554
|
-
storage.setItem(panelGroupKey, JSON.stringify(state));
|
|
1555
|
-
} catch (error) {
|
|
1556
|
-
console.error(error);
|
|
1557
|
-
}
|
|
774
|
+
function Se(e) {
|
|
775
|
+
return e && Number(getComputedStyle(e).zIndex) || 0;
|
|
776
|
+
}
|
|
777
|
+
function xe(e) {
|
|
778
|
+
const t = [];
|
|
779
|
+
for (; e; )
|
|
780
|
+
t.push(e), e = Ae(e);
|
|
781
|
+
return t;
|
|
782
|
+
}
|
|
783
|
+
function Ae(e) {
|
|
784
|
+
const { parentNode: t } = e;
|
|
785
|
+
return dt(t) ? t.host : t;
|
|
786
|
+
}
|
|
787
|
+
function gt(e, t) {
|
|
788
|
+
return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
|
|
1558
789
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
panelConstraints
|
|
790
|
+
function vt({
|
|
791
|
+
groupElement: e,
|
|
792
|
+
hitRegion: t,
|
|
793
|
+
pointerEventTarget: n
|
|
1564
794
|
}) {
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
const safeSize = 100 / nextLayoutTotalSize * unsafeSize;
|
|
1576
|
-
nextLayout[index] = safeSize;
|
|
795
|
+
if (!Me(n) || n.contains(e) || e.contains(n))
|
|
796
|
+
return !0;
|
|
797
|
+
if (pt(n, e) > 0) {
|
|
798
|
+
let o = n;
|
|
799
|
+
for (; o; ) {
|
|
800
|
+
if (o.contains(e))
|
|
801
|
+
return !0;
|
|
802
|
+
if (gt(o.getBoundingClientRect(), t))
|
|
803
|
+
return !1;
|
|
804
|
+
o = o.parentElement;
|
|
1577
805
|
}
|
|
1578
806
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
807
|
+
return !0;
|
|
808
|
+
}
|
|
809
|
+
function $e(e, t) {
|
|
810
|
+
const n = [];
|
|
811
|
+
return t.forEach((o, r) => {
|
|
812
|
+
if (r.disabled)
|
|
813
|
+
return;
|
|
814
|
+
const s = ft() ? ge.coarse : ge.precise, l = ke(r), i = ct(r.orientation, l, {
|
|
815
|
+
x: e.clientX,
|
|
816
|
+
y: e.clientY
|
|
1589
817
|
});
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
818
|
+
i && i.distance.x <= s && i.distance.y <= s && vt({
|
|
819
|
+
groupElement: r.element,
|
|
820
|
+
hitRegion: i.hitRegion.rect,
|
|
821
|
+
pointerEventTarget: e.target
|
|
822
|
+
}) && n.push(i.hitRegion);
|
|
823
|
+
}), n;
|
|
824
|
+
}
|
|
825
|
+
function ze(e) {
|
|
826
|
+
if (e.defaultPrevented)
|
|
827
|
+
return;
|
|
828
|
+
const { mountedGroups: t } = G(), n = $e(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
829
|
+
let i = !1;
|
|
830
|
+
n.forEach((a) => {
|
|
831
|
+
o.add(a.group), a.panels.forEach((f) => {
|
|
832
|
+
r.add(f);
|
|
833
|
+
}), a.separator && (s.add(a.separator), i || (i = !0, a.separator.element.focus()));
|
|
834
|
+
const u = t.get(a.group);
|
|
835
|
+
u && l.set(a.group, u.layout);
|
|
836
|
+
}), M({
|
|
837
|
+
interactionState: {
|
|
838
|
+
hitRegions: n,
|
|
839
|
+
initialLayoutMap: l,
|
|
840
|
+
pointerDownAtPoint: { x: e.clientX, y: e.clientY },
|
|
841
|
+
state: "active"
|
|
1593
842
|
}
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
843
|
+
}), n.length && e.preventDefault();
|
|
844
|
+
}
|
|
845
|
+
function St({
|
|
846
|
+
cursorFlags: e,
|
|
847
|
+
groups: t,
|
|
848
|
+
state: n
|
|
849
|
+
}) {
|
|
850
|
+
let o = 0, r = 0;
|
|
851
|
+
switch (n) {
|
|
852
|
+
case "active":
|
|
853
|
+
case "hover":
|
|
854
|
+
t.forEach((s) => {
|
|
855
|
+
if (!s.disableCursor)
|
|
856
|
+
switch (s.orientation) {
|
|
857
|
+
case "horizontal": {
|
|
858
|
+
o++;
|
|
859
|
+
break;
|
|
860
|
+
}
|
|
861
|
+
case "vertical": {
|
|
862
|
+
r++;
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
1607
866
|
});
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
867
|
+
}
|
|
868
|
+
if (o === 0 && r === 0)
|
|
869
|
+
return null;
|
|
870
|
+
switch (n) {
|
|
871
|
+
case "active": {
|
|
872
|
+
const s = (e & Oe) !== 0, l = (e & Te) !== 0, i = (e & _e) !== 0, a = (e & Ne) !== 0;
|
|
873
|
+
if (e) {
|
|
874
|
+
if (s)
|
|
875
|
+
return i ? "se-resize" : a ? "ne-resize" : "e-resize";
|
|
876
|
+
if (l)
|
|
877
|
+
return i ? "sw-resize" : a ? "nw-resize" : "w-resize";
|
|
878
|
+
if (i)
|
|
879
|
+
return "s-resize";
|
|
880
|
+
if (a)
|
|
881
|
+
return "n-resize";
|
|
1616
882
|
}
|
|
883
|
+
break;
|
|
1617
884
|
}
|
|
1618
885
|
}
|
|
1619
|
-
return
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
}
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
886
|
+
return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
887
|
+
}
|
|
888
|
+
const be = /* @__PURE__ */ new WeakMap();
|
|
889
|
+
function le(e) {
|
|
890
|
+
if (e.defaultView === null || e.defaultView === void 0)
|
|
891
|
+
return;
|
|
892
|
+
let { prevStyle: t, styleSheet: n } = be.get(e) ?? {};
|
|
893
|
+
n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets = [n]);
|
|
894
|
+
const { cursorFlags: o, interactionState: r } = G();
|
|
895
|
+
switch (r.state) {
|
|
896
|
+
case "active":
|
|
897
|
+
case "hover": {
|
|
898
|
+
const s = St({
|
|
899
|
+
cursorFlags: o,
|
|
900
|
+
groups: r.hitRegions.map((i) => i.group),
|
|
901
|
+
state: r.state
|
|
902
|
+
}), l = `*{cursor: ${s} !important; ${r.state === "active" ? "touch-action: none;" : ""} }`;
|
|
903
|
+
if (t === l)
|
|
904
|
+
return;
|
|
905
|
+
t = l, s ? n.cssRules.length === 0 ? n.insertRule(l) : n.replaceSync(l) : n.cssRules.length === 1 && n.deleteRule(0);
|
|
906
|
+
break;
|
|
907
|
+
}
|
|
908
|
+
case "inactive": {
|
|
909
|
+
t = void 0, n.cssRules.length === 1 && n.deleteRule(0);
|
|
910
|
+
break;
|
|
911
|
+
}
|
|
1631
912
|
}
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
autoSaveId = null,
|
|
1636
|
-
children,
|
|
1637
|
-
className: classNameFromProps = "",
|
|
1638
|
-
direction,
|
|
1639
|
-
forwardedRef,
|
|
1640
|
-
id: idFromProps = null,
|
|
1641
|
-
onLayout = null,
|
|
1642
|
-
keyboardResizeBy = null,
|
|
1643
|
-
storage = defaultStorage,
|
|
1644
|
-
style: styleFromProps,
|
|
1645
|
-
tagName: Type = "div",
|
|
1646
|
-
...rest
|
|
1647
|
-
}) {
|
|
1648
|
-
const groupId = useUniqueId(idFromProps);
|
|
1649
|
-
const panelGroupElementRef = useRef(null);
|
|
1650
|
-
const [dragState, setDragState] = useState(null);
|
|
1651
|
-
const [layout, setLayout] = useState([]);
|
|
1652
|
-
const forceUpdate = useForceUpdate();
|
|
1653
|
-
const panelIdToLastNotifiedSizeMapRef = useRef({});
|
|
1654
|
-
const panelSizeBeforeCollapseRef = useRef(new Map());
|
|
1655
|
-
const prevDeltaRef = useRef(0);
|
|
1656
|
-
const committedValuesRef = useRef({
|
|
1657
|
-
autoSaveId,
|
|
1658
|
-
direction,
|
|
1659
|
-
dragState,
|
|
1660
|
-
id: groupId,
|
|
1661
|
-
keyboardResizeBy,
|
|
1662
|
-
onLayout,
|
|
1663
|
-
storage
|
|
1664
|
-
});
|
|
1665
|
-
const eagerValuesRef = useRef({
|
|
1666
|
-
layout,
|
|
1667
|
-
panelDataArray: [],
|
|
1668
|
-
panelDataArrayChanged: false
|
|
1669
|
-
});
|
|
1670
|
-
useRef({
|
|
1671
|
-
didLogIdAndOrderWarning: false,
|
|
1672
|
-
didLogPanelConstraintsWarning: false,
|
|
1673
|
-
prevPanelIds: []
|
|
913
|
+
be.set(e, {
|
|
914
|
+
prevStyle: t,
|
|
915
|
+
styleSheet: n
|
|
1674
916
|
});
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
917
|
+
}
|
|
918
|
+
function Fe({
|
|
919
|
+
document: e,
|
|
920
|
+
event: t,
|
|
921
|
+
hitRegions: n,
|
|
922
|
+
initialLayoutMap: o,
|
|
923
|
+
mountedGroups: r,
|
|
924
|
+
pointerDownAtPoint: s
|
|
925
|
+
}) {
|
|
926
|
+
let l = 0;
|
|
927
|
+
const i = new Map(r);
|
|
928
|
+
n.forEach((a) => {
|
|
929
|
+
const { group: u, groupSize: f } = a, { disableCursor: p, orientation: m, panels: h } = u;
|
|
930
|
+
let c = 0;
|
|
931
|
+
s ? m === "horizontal" ? c = (t.clientX - s.x) / f * 100 : c = (t.clientY - s.y) / f * 100 : m === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
|
|
932
|
+
const d = o.get(u), {
|
|
933
|
+
defaultLayoutDeferred: y,
|
|
934
|
+
derivedPanelConstraints: v,
|
|
935
|
+
layout: S,
|
|
936
|
+
separatorToPanels: x
|
|
937
|
+
} = r.get(u) ?? { defaultLayoutDeferred: !1 };
|
|
938
|
+
if (v && d && S && x) {
|
|
939
|
+
const g = Y({
|
|
940
|
+
delta: c,
|
|
941
|
+
initialLayout: d,
|
|
942
|
+
panelConstraints: v,
|
|
943
|
+
pivotIndices: a.panels.map((b) => h.indexOf(b)),
|
|
944
|
+
prevLayout: S,
|
|
945
|
+
trigger: "mouse-or-touch"
|
|
1694
946
|
});
|
|
1695
|
-
if (
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
groupId,
|
|
1717
|
-
layout,
|
|
1718
|
-
panelDataArray: eagerValuesRef.current.panelDataArray,
|
|
1719
|
-
setLayout,
|
|
1720
|
-
panelGroupElement: panelGroupElementRef.current
|
|
1721
|
-
});
|
|
1722
|
-
useEffect(() => {
|
|
1723
|
-
const {
|
|
1724
|
-
panelDataArray
|
|
1725
|
-
} = eagerValuesRef.current;
|
|
1726
|
-
|
|
1727
|
-
// If this panel has been configured to persist sizing information, save sizes to local storage.
|
|
1728
|
-
if (autoSaveId) {
|
|
1729
|
-
if (layout.length === 0 || layout.length !== panelDataArray.length) {
|
|
1730
|
-
return;
|
|
1731
|
-
}
|
|
1732
|
-
let debouncedSave = debounceMap[autoSaveId];
|
|
1733
|
-
|
|
1734
|
-
// Limit the frequency of localStorage updates.
|
|
1735
|
-
if (debouncedSave == null) {
|
|
1736
|
-
debouncedSave = debounce(savePanelGroupState, LOCAL_STORAGE_DEBOUNCE_INTERVAL);
|
|
1737
|
-
debounceMap[autoSaveId] = debouncedSave;
|
|
947
|
+
if (K(g, S)) {
|
|
948
|
+
if (c !== 0 && !p)
|
|
949
|
+
switch (m) {
|
|
950
|
+
case "horizontal": {
|
|
951
|
+
l |= c < 0 ? Oe : Te;
|
|
952
|
+
break;
|
|
953
|
+
}
|
|
954
|
+
case "vertical": {
|
|
955
|
+
l |= c < 0 ? _e : Ne;
|
|
956
|
+
break;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
} else {
|
|
960
|
+
i.set(a.group, {
|
|
961
|
+
defaultLayoutDeferred: y,
|
|
962
|
+
derivedPanelConstraints: v,
|
|
963
|
+
layout: g,
|
|
964
|
+
separatorToPanels: x
|
|
965
|
+
});
|
|
966
|
+
const b = a.group.panels.map(({ id: w }) => w).join(",");
|
|
967
|
+
a.group.inMemoryLayouts[b] = g;
|
|
1738
968
|
}
|
|
1739
|
-
|
|
1740
|
-
// Clone mutable data before passing to the debounced function,
|
|
1741
|
-
// else we run the risk of saving an incorrect combination of mutable and immutable values to state.
|
|
1742
|
-
const clonedPanelDataArray = [...panelDataArray];
|
|
1743
|
-
const clonedPanelSizesBeforeCollapse = new Map(panelSizeBeforeCollapseRef.current);
|
|
1744
|
-
debouncedSave(autoSaveId, clonedPanelDataArray, clonedPanelSizesBeforeCollapse, layout, storage);
|
|
1745
969
|
}
|
|
1746
|
-
},
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
//
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
prevLayout,
|
|
1781
|
-
trigger: "imperative-api"
|
|
1782
|
-
});
|
|
1783
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
1784
|
-
setLayout(nextLayout);
|
|
1785
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
1786
|
-
if (onLayout) {
|
|
1787
|
-
onLayout(nextLayout);
|
|
970
|
+
}), M({
|
|
971
|
+
cursorFlags: l,
|
|
972
|
+
mountedGroups: i
|
|
973
|
+
}), le(e);
|
|
974
|
+
}
|
|
975
|
+
function we(e) {
|
|
976
|
+
const { interactionState: t, mountedGroups: n } = G();
|
|
977
|
+
switch (t.state) {
|
|
978
|
+
case "active":
|
|
979
|
+
Fe({
|
|
980
|
+
document: e.currentTarget,
|
|
981
|
+
event: e,
|
|
982
|
+
hitRegions: t.hitRegions,
|
|
983
|
+
initialLayoutMap: t.initialLayoutMap,
|
|
984
|
+
mountedGroups: n
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
function Le(e) {
|
|
989
|
+
if (e.defaultPrevented)
|
|
990
|
+
return;
|
|
991
|
+
const { interactionState: t, mountedGroups: n } = G();
|
|
992
|
+
switch (t.state) {
|
|
993
|
+
case "active": {
|
|
994
|
+
if (
|
|
995
|
+
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
996
|
+
e.buttons === 0
|
|
997
|
+
) {
|
|
998
|
+
M(
|
|
999
|
+
(o) => o.interactionState.state === "inactive" ? o : {
|
|
1000
|
+
cursorFlags: 0,
|
|
1001
|
+
interactionState: {
|
|
1002
|
+
state: "inactive"
|
|
1003
|
+
}
|
|
1788
1004
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1005
|
+
);
|
|
1006
|
+
return;
|
|
1791
1007
|
}
|
|
1008
|
+
Fe({
|
|
1009
|
+
document: e.currentTarget,
|
|
1010
|
+
event: e,
|
|
1011
|
+
hitRegions: t.hitRegions,
|
|
1012
|
+
initialLayoutMap: t.initialLayoutMap,
|
|
1013
|
+
mountedGroups: n,
|
|
1014
|
+
pointerDownAtPoint: t.pointerDownAtPoint
|
|
1015
|
+
});
|
|
1016
|
+
break;
|
|
1792
1017
|
}
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
layout: prevLayout,
|
|
1802
|
-
panelDataArray
|
|
1803
|
-
} = eagerValuesRef.current;
|
|
1804
|
-
if (panelData.constraints.collapsible) {
|
|
1805
|
-
const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
|
|
1806
|
-
const {
|
|
1807
|
-
collapsedSize = 0,
|
|
1808
|
-
panelSize = 0,
|
|
1809
|
-
minSize: minSizeFromProps = 0,
|
|
1810
|
-
pivotIndices
|
|
1811
|
-
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
1812
|
-
const minSize = minSizeOverride !== null && minSizeOverride !== void 0 ? minSizeOverride : minSizeFromProps;
|
|
1813
|
-
if (fuzzyNumbersEqual$1(panelSize, collapsedSize)) {
|
|
1814
|
-
// Restore this panel to the size it was before it was collapsed, if possible.
|
|
1815
|
-
const prevPanelSize = panelSizeBeforeCollapseRef.current.get(panelData.id);
|
|
1816
|
-
const baseSize = prevPanelSize != null && prevPanelSize >= minSize ? prevPanelSize : minSize;
|
|
1817
|
-
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
1818
|
-
const delta = isLastPanel ? panelSize - baseSize : baseSize - panelSize;
|
|
1819
|
-
const nextLayout = adjustLayoutByDelta({
|
|
1820
|
-
delta,
|
|
1821
|
-
initialLayout: prevLayout,
|
|
1822
|
-
panelConstraints: panelConstraintsArray,
|
|
1823
|
-
pivotIndices,
|
|
1824
|
-
prevLayout,
|
|
1825
|
-
trigger: "imperative-api"
|
|
1826
|
-
});
|
|
1827
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
1828
|
-
setLayout(nextLayout);
|
|
1829
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
1830
|
-
if (onLayout) {
|
|
1831
|
-
onLayout(nextLayout);
|
|
1832
|
-
}
|
|
1833
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
1018
|
+
default: {
|
|
1019
|
+
const o = $e(e, n);
|
|
1020
|
+
o.length === 0 ? t.state !== "inactive" && M({
|
|
1021
|
+
interactionState: { state: "inactive" }
|
|
1022
|
+
}) : M({
|
|
1023
|
+
interactionState: {
|
|
1024
|
+
hitRegions: o,
|
|
1025
|
+
state: "hover"
|
|
1834
1026
|
}
|
|
1835
|
-
}
|
|
1027
|
+
}), le(e.currentTarget);
|
|
1028
|
+
break;
|
|
1836
1029
|
}
|
|
1837
|
-
}
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
}, []);
|
|
1851
|
-
|
|
1852
|
-
// This API should never read from committedValuesRef
|
|
1853
|
-
const getPanelStyle = useCallback((panelData, defaultSize) => {
|
|
1854
|
-
const {
|
|
1855
|
-
panelDataArray
|
|
1856
|
-
} = eagerValuesRef.current;
|
|
1857
|
-
const panelIndex = findPanelDataIndex(panelDataArray, panelData);
|
|
1858
|
-
return computePanelFlexBoxStyle({
|
|
1859
|
-
defaultSize,
|
|
1860
|
-
dragState,
|
|
1861
|
-
layout,
|
|
1862
|
-
panelData: panelDataArray,
|
|
1863
|
-
panelIndex
|
|
1864
|
-
});
|
|
1865
|
-
}, [dragState, layout]);
|
|
1866
|
-
|
|
1867
|
-
// External APIs are safe to memoize via committed values ref
|
|
1868
|
-
const isPanelCollapsed = useCallback(panelData => {
|
|
1869
|
-
const {
|
|
1870
|
-
layout,
|
|
1871
|
-
panelDataArray
|
|
1872
|
-
} = eagerValuesRef.current;
|
|
1873
|
-
const {
|
|
1874
|
-
collapsedSize = 0,
|
|
1875
|
-
collapsible,
|
|
1876
|
-
panelSize
|
|
1877
|
-
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1878
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1879
|
-
return collapsible === true && fuzzyNumbersEqual$1(panelSize, collapsedSize);
|
|
1880
|
-
}, []);
|
|
1881
|
-
|
|
1882
|
-
// External APIs are safe to memoize via committed values ref
|
|
1883
|
-
const isPanelExpanded = useCallback(panelData => {
|
|
1884
|
-
const {
|
|
1885
|
-
layout,
|
|
1886
|
-
panelDataArray
|
|
1887
|
-
} = eagerValuesRef.current;
|
|
1888
|
-
const {
|
|
1889
|
-
collapsedSize = 0,
|
|
1890
|
-
collapsible,
|
|
1891
|
-
panelSize
|
|
1892
|
-
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1893
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1894
|
-
return !collapsible || fuzzyCompareNumbers(panelSize, collapsedSize) > 0;
|
|
1895
|
-
}, []);
|
|
1896
|
-
const registerPanel = useCallback(panelData => {
|
|
1897
|
-
const {
|
|
1898
|
-
panelDataArray
|
|
1899
|
-
} = eagerValuesRef.current;
|
|
1900
|
-
panelDataArray.push(panelData);
|
|
1901
|
-
panelDataArray.sort((panelA, panelB) => {
|
|
1902
|
-
const orderA = panelA.order;
|
|
1903
|
-
const orderB = panelB.order;
|
|
1904
|
-
if (orderA == null && orderB == null) {
|
|
1905
|
-
return 0;
|
|
1906
|
-
} else if (orderA == null) {
|
|
1907
|
-
return -1;
|
|
1908
|
-
} else if (orderB == null) {
|
|
1909
|
-
return 1;
|
|
1910
|
-
} else {
|
|
1911
|
-
return orderA - orderB;
|
|
1912
|
-
}
|
|
1913
|
-
});
|
|
1914
|
-
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
1915
|
-
forceUpdate();
|
|
1916
|
-
}, [forceUpdate]);
|
|
1917
|
-
|
|
1918
|
-
// (Re)calculate group layout whenever panels are registered or unregistered.
|
|
1919
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1920
|
-
useIsomorphicLayoutEffect(() => {
|
|
1921
|
-
if (eagerValuesRef.current.panelDataArrayChanged) {
|
|
1922
|
-
eagerValuesRef.current.panelDataArrayChanged = false;
|
|
1923
|
-
const {
|
|
1924
|
-
autoSaveId,
|
|
1925
|
-
onLayout,
|
|
1926
|
-
storage
|
|
1927
|
-
} = committedValuesRef.current;
|
|
1928
|
-
const {
|
|
1929
|
-
layout: prevLayout,
|
|
1930
|
-
panelDataArray
|
|
1931
|
-
} = eagerValuesRef.current;
|
|
1932
|
-
|
|
1933
|
-
// If this panel has been configured to persist sizing information,
|
|
1934
|
-
// default size should be restored from local storage if possible.
|
|
1935
|
-
let unsafeLayout = null;
|
|
1936
|
-
if (autoSaveId) {
|
|
1937
|
-
const state = loadPanelGroupState(autoSaveId, panelDataArray, storage);
|
|
1938
|
-
if (state) {
|
|
1939
|
-
panelSizeBeforeCollapseRef.current = new Map(Object.entries(state.expandToSizes));
|
|
1940
|
-
unsafeLayout = state.layout;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
function Pe(e) {
|
|
1033
|
+
if (e.defaultPrevented)
|
|
1034
|
+
return;
|
|
1035
|
+
e.preventDefault();
|
|
1036
|
+
const { interactionState: t } = G();
|
|
1037
|
+
switch (t.state) {
|
|
1038
|
+
case "active":
|
|
1039
|
+
M({
|
|
1040
|
+
cursorFlags: 0,
|
|
1041
|
+
interactionState: {
|
|
1042
|
+
state: "inactive"
|
|
1941
1043
|
}
|
|
1942
|
-
}
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
const
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1044
|
+
}), le(e.currentTarget);
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
function Re(e) {
|
|
1048
|
+
let t = 0, n = 0;
|
|
1049
|
+
const o = {};
|
|
1050
|
+
for (const s of e)
|
|
1051
|
+
if (s.defaultSize !== void 0) {
|
|
1052
|
+
t++;
|
|
1053
|
+
const l = k(s.defaultSize);
|
|
1054
|
+
n += l, o[s.panelId] = l;
|
|
1055
|
+
} else
|
|
1056
|
+
o[s.panelId] = void 0;
|
|
1057
|
+
const r = e.length - t;
|
|
1058
|
+
if (r !== 0) {
|
|
1059
|
+
const s = k((100 - n) / r);
|
|
1060
|
+
for (const l of e)
|
|
1061
|
+
l.defaultSize === void 0 && (o[l.panelId] = s);
|
|
1062
|
+
}
|
|
1063
|
+
return o;
|
|
1064
|
+
}
|
|
1065
|
+
function xt(e, t, n) {
|
|
1066
|
+
const o = n[0];
|
|
1067
|
+
if (!o)
|
|
1068
|
+
return;
|
|
1069
|
+
const r = e.panels.find((a) => a.element === t);
|
|
1070
|
+
if (!r || !r.onResize)
|
|
1071
|
+
return;
|
|
1072
|
+
const s = U({ group: e }), l = r.mutableValues.prevSize, i = {
|
|
1073
|
+
asPercentage: k(
|
|
1074
|
+
o.inlineSize / s * 100
|
|
1075
|
+
),
|
|
1076
|
+
inPixels: o.inlineSize
|
|
1077
|
+
};
|
|
1078
|
+
r.mutableValues.prevSize = i, r.onResize(i, r.id, l);
|
|
1079
|
+
}
|
|
1080
|
+
function zt(e, t) {
|
|
1081
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
1082
|
+
return !1;
|
|
1083
|
+
for (const o in e)
|
|
1084
|
+
if (e[o] !== t[o])
|
|
1085
|
+
return !1;
|
|
1086
|
+
return !0;
|
|
1087
|
+
}
|
|
1088
|
+
function bt(e, t) {
|
|
1089
|
+
const n = e.map((r) => r.id), o = Object.keys(t);
|
|
1090
|
+
if (n.length !== o.length)
|
|
1091
|
+
return !1;
|
|
1092
|
+
for (const r of n)
|
|
1093
|
+
if (!o.includes(r))
|
|
1094
|
+
return !1;
|
|
1095
|
+
return !0;
|
|
1096
|
+
}
|
|
1097
|
+
const B = /* @__PURE__ */ new Map();
|
|
1098
|
+
function wt(e) {
|
|
1099
|
+
let t = !0;
|
|
1100
|
+
z(
|
|
1101
|
+
e.element.ownerDocument.defaultView,
|
|
1102
|
+
"Cannot register an unmounted Group"
|
|
1103
|
+
);
|
|
1104
|
+
const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), s = new n((c) => {
|
|
1105
|
+
for (const d of c) {
|
|
1106
|
+
const { borderBoxSize: y, target: v } = d;
|
|
1107
|
+
if (v === e.element) {
|
|
1108
|
+
if (t) {
|
|
1109
|
+
if (U({ group: e }) === 0)
|
|
1110
|
+
return;
|
|
1111
|
+
M((x) => {
|
|
1112
|
+
const g = x.mountedGroups.get(e);
|
|
1113
|
+
if (g) {
|
|
1114
|
+
const b = he(e), w = g.defaultLayoutDeferred ? Re(b) : g.layout, C = N({
|
|
1115
|
+
layout: w,
|
|
1116
|
+
panelConstraints: b
|
|
1117
|
+
});
|
|
1118
|
+
return !g.defaultLayoutDeferred && K(w, C) && zt(
|
|
1119
|
+
g.derivedPanelConstraints,
|
|
1120
|
+
b
|
|
1121
|
+
) ? x : {
|
|
1122
|
+
mountedGroups: new Map(x.mountedGroups).set(e, {
|
|
1123
|
+
defaultLayoutDeferred: !1,
|
|
1124
|
+
derivedPanelConstraints: b,
|
|
1125
|
+
layout: C,
|
|
1126
|
+
separatorToPanels: g.separatorToPanels
|
|
1127
|
+
})
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
return x;
|
|
1131
|
+
});
|
|
1960
1132
|
}
|
|
1961
|
-
|
|
1962
|
-
|
|
1133
|
+
} else
|
|
1134
|
+
xt(e, v, y);
|
|
1963
1135
|
}
|
|
1964
1136
|
});
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1137
|
+
s.observe(e.element), e.panels.forEach((c) => {
|
|
1138
|
+
z(
|
|
1139
|
+
!o.has(c.id),
|
|
1140
|
+
`Panel ids must be unique; id "${c.id}" was used more than once`
|
|
1141
|
+
), o.add(c.id), c.onResize && s.observe(c.element);
|
|
1142
|
+
});
|
|
1143
|
+
const l = U({ group: e }), i = he(e), a = e.panels.map(({ id: c }) => c).join(",");
|
|
1144
|
+
let u = e.defaultLayout;
|
|
1145
|
+
u && (bt(e.panels, u) || (u = void 0));
|
|
1146
|
+
const f = e.inMemoryLayouts[a] ?? u ?? Re(i), p = N({
|
|
1147
|
+
layout: f,
|
|
1148
|
+
panelConstraints: i
|
|
1149
|
+
}), m = ke(e), h = e.element.ownerDocument;
|
|
1150
|
+
return M((c) => {
|
|
1151
|
+
const d = /* @__PURE__ */ new Map();
|
|
1152
|
+
return B.set(
|
|
1153
|
+
h,
|
|
1154
|
+
(B.get(h) ?? 0) + 1
|
|
1155
|
+
), m.forEach((y) => {
|
|
1156
|
+
y.separator && d.set(y.separator, y.panels);
|
|
1157
|
+
}), {
|
|
1158
|
+
mountedGroups: new Map(c.mountedGroups).set(e, {
|
|
1159
|
+
defaultLayoutDeferred: l === 0,
|
|
1160
|
+
derivedPanelConstraints: i,
|
|
1161
|
+
layout: p,
|
|
1162
|
+
separatorToPanels: d
|
|
1163
|
+
})
|
|
1971
1164
|
};
|
|
1972
|
-
},
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
trigger: isKeyDown(event) ? "keyboard" : "mouse-or-touch"
|
|
2016
|
-
});
|
|
2017
|
-
const layoutChanged = !compareLayouts(prevLayout, nextLayout);
|
|
2018
|
-
|
|
2019
|
-
// Only update the cursor for layout changes triggered by touch/mouse events (not keyboard)
|
|
2020
|
-
// Update the cursor even if the layout hasn't changed (we may need to show an invalid cursor state)
|
|
2021
|
-
if (isPointerEvent(event) || isMouseEvent(event)) {
|
|
2022
|
-
// Watch for multiple subsequent deltas; this might occur for tiny cursor movements.
|
|
2023
|
-
// In this case, Panel sizes might not change–
|
|
2024
|
-
// but updating cursor in this scenario would cause a flicker.
|
|
2025
|
-
if (prevDeltaRef.current != delta) {
|
|
2026
|
-
prevDeltaRef.current = delta;
|
|
2027
|
-
if (!layoutChanged && delta !== 0) {
|
|
2028
|
-
// If the pointer has moved too far to resize the panel any further, note this so we can update the cursor.
|
|
2029
|
-
// This mimics VS Code behavior.
|
|
2030
|
-
if (isHorizontal) {
|
|
2031
|
-
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_HORIZONTAL_MIN : EXCEEDED_HORIZONTAL_MAX);
|
|
2032
|
-
} else {
|
|
2033
|
-
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN : EXCEEDED_VERTICAL_MAX);
|
|
2034
|
-
}
|
|
2035
|
-
} else {
|
|
2036
|
-
reportConstraintsViolation(dragHandleId, 0);
|
|
1165
|
+
}), e.separators.forEach((c) => {
|
|
1166
|
+
z(
|
|
1167
|
+
!r.has(c.id),
|
|
1168
|
+
`Separator ids must be unique; id "${c.id}" was used more than once`
|
|
1169
|
+
), r.add(c.id), c.element.addEventListener("keydown", ye);
|
|
1170
|
+
}), B.get(h) === 1 && (h.addEventListener("pointerdown", ze), h.addEventListener("pointerleave", we), h.addEventListener("pointermove", Le), h.addEventListener("pointerup", Pe)), function() {
|
|
1171
|
+
t = !1, B.set(
|
|
1172
|
+
h,
|
|
1173
|
+
Math.max(0, (B.get(h) ?? 0) - 1)
|
|
1174
|
+
), M((d) => {
|
|
1175
|
+
const y = new Map(d.mountedGroups);
|
|
1176
|
+
return y.delete(e), { mountedGroups: y };
|
|
1177
|
+
}), e.separators.forEach((d) => {
|
|
1178
|
+
d.element.removeEventListener("keydown", ye);
|
|
1179
|
+
}), B.get(h) || (h.removeEventListener("pointerdown", ze), h.removeEventListener("pointerleave", we), h.removeEventListener("pointermove", Le), h.removeEventListener("pointerup", Pe)), s.disconnect();
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
function ue(e) {
|
|
1183
|
+
const t = Ke();
|
|
1184
|
+
return `${e ?? t}`;
|
|
1185
|
+
}
|
|
1186
|
+
const A = typeof window < "u" ? Xe : Ce;
|
|
1187
|
+
function ce(e) {
|
|
1188
|
+
const t = I(e);
|
|
1189
|
+
return A(() => {
|
|
1190
|
+
t.current = e;
|
|
1191
|
+
}, [e]), qe(
|
|
1192
|
+
(...n) => t.current?.(...n),
|
|
1193
|
+
[t]
|
|
1194
|
+
);
|
|
1195
|
+
}
|
|
1196
|
+
function fe(...e) {
|
|
1197
|
+
return ce((t) => {
|
|
1198
|
+
e.forEach((n) => {
|
|
1199
|
+
if (n)
|
|
1200
|
+
switch (typeof n) {
|
|
1201
|
+
case "function": {
|
|
1202
|
+
n(t);
|
|
1203
|
+
break;
|
|
1204
|
+
}
|
|
1205
|
+
case "object": {
|
|
1206
|
+
n.current = t;
|
|
1207
|
+
break;
|
|
2037
1208
|
}
|
|
2038
1209
|
}
|
|
2039
|
-
}
|
|
2040
|
-
if (layoutChanged) {
|
|
2041
|
-
setLayout(nextLayout);
|
|
2042
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
2043
|
-
if (onLayout) {
|
|
2044
|
-
onLayout(nextLayout);
|
|
2045
|
-
}
|
|
2046
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
2047
|
-
}
|
|
2048
|
-
};
|
|
2049
|
-
}, []);
|
|
2050
|
-
|
|
2051
|
-
// External APIs are safe to memoize via committed values ref
|
|
2052
|
-
const resizePanel = useCallback((panelData, unsafePanelSize) => {
|
|
2053
|
-
const {
|
|
2054
|
-
onLayout
|
|
2055
|
-
} = committedValuesRef.current;
|
|
2056
|
-
const {
|
|
2057
|
-
layout: prevLayout,
|
|
2058
|
-
panelDataArray
|
|
2059
|
-
} = eagerValuesRef.current;
|
|
2060
|
-
const panelConstraintsArray = panelDataArray.map(panelData => panelData.constraints);
|
|
2061
|
-
const {
|
|
2062
|
-
panelSize,
|
|
2063
|
-
pivotIndices
|
|
2064
|
-
} = panelDataHelper(panelDataArray, panelData, prevLayout);
|
|
2065
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
2066
|
-
const isLastPanel = findPanelDataIndex(panelDataArray, panelData) === panelDataArray.length - 1;
|
|
2067
|
-
const delta = isLastPanel ? panelSize - unsafePanelSize : unsafePanelSize - panelSize;
|
|
2068
|
-
const nextLayout = adjustLayoutByDelta({
|
|
2069
|
-
delta,
|
|
2070
|
-
initialLayout: prevLayout,
|
|
2071
|
-
panelConstraints: panelConstraintsArray,
|
|
2072
|
-
pivotIndices,
|
|
2073
|
-
prevLayout,
|
|
2074
|
-
trigger: "imperative-api"
|
|
2075
|
-
});
|
|
2076
|
-
if (!compareLayouts(prevLayout, nextLayout)) {
|
|
2077
|
-
setLayout(nextLayout);
|
|
2078
|
-
eagerValuesRef.current.layout = nextLayout;
|
|
2079
|
-
if (onLayout) {
|
|
2080
|
-
onLayout(nextLayout);
|
|
2081
|
-
}
|
|
2082
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
2083
|
-
}
|
|
2084
|
-
}, []);
|
|
2085
|
-
const reevaluatePanelConstraints = useCallback((panelData, prevConstraints) => {
|
|
2086
|
-
const {
|
|
2087
|
-
layout,
|
|
2088
|
-
panelDataArray
|
|
2089
|
-
} = eagerValuesRef.current;
|
|
2090
|
-
const {
|
|
2091
|
-
collapsedSize: prevCollapsedSize = 0,
|
|
2092
|
-
collapsible: prevCollapsible
|
|
2093
|
-
} = prevConstraints;
|
|
2094
|
-
const {
|
|
2095
|
-
collapsedSize: nextCollapsedSize = 0,
|
|
2096
|
-
collapsible: nextCollapsible,
|
|
2097
|
-
maxSize: nextMaxSize = 100,
|
|
2098
|
-
minSize: nextMinSize = 0
|
|
2099
|
-
} = panelData.constraints;
|
|
2100
|
-
const {
|
|
2101
|
-
panelSize: prevPanelSize
|
|
2102
|
-
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
2103
|
-
if (prevPanelSize == null) {
|
|
2104
|
-
// It's possible that the panels in this group have changed since the last render
|
|
2105
|
-
return;
|
|
2106
|
-
}
|
|
2107
|
-
if (prevCollapsible && nextCollapsible && fuzzyNumbersEqual$1(prevPanelSize, prevCollapsedSize)) {
|
|
2108
|
-
if (!fuzzyNumbersEqual$1(prevCollapsedSize, nextCollapsedSize)) {
|
|
2109
|
-
resizePanel(panelData, nextCollapsedSize);
|
|
2110
|
-
}
|
|
2111
|
-
} else if (prevPanelSize < nextMinSize) {
|
|
2112
|
-
resizePanel(panelData, nextMinSize);
|
|
2113
|
-
} else if (prevPanelSize > nextMaxSize) {
|
|
2114
|
-
resizePanel(panelData, nextMaxSize);
|
|
2115
|
-
}
|
|
2116
|
-
}, [resizePanel]);
|
|
2117
|
-
|
|
2118
|
-
// TODO Multiple drag handles can be active at the same time so this API is a bit awkward now
|
|
2119
|
-
const startDragging = useCallback((dragHandleId, event) => {
|
|
2120
|
-
const {
|
|
2121
|
-
direction
|
|
2122
|
-
} = committedValuesRef.current;
|
|
2123
|
-
const {
|
|
2124
|
-
layout
|
|
2125
|
-
} = eagerValuesRef.current;
|
|
2126
|
-
if (!panelGroupElementRef.current) {
|
|
2127
|
-
return;
|
|
2128
|
-
}
|
|
2129
|
-
const handleElement = getResizeHandleElement(dragHandleId, panelGroupElementRef.current);
|
|
2130
|
-
assert(handleElement, `Drag handle element not found for id "${dragHandleId}"`);
|
|
2131
|
-
const initialCursorPosition = getResizeEventCursorPosition(direction, event);
|
|
2132
|
-
setDragState({
|
|
2133
|
-
dragHandleId,
|
|
2134
|
-
dragHandleRect: handleElement.getBoundingClientRect(),
|
|
2135
|
-
initialCursorPosition,
|
|
2136
|
-
initialLayout: layout
|
|
2137
1210
|
});
|
|
2138
|
-
}
|
|
2139
|
-
const stopDragging = useCallback(() => {
|
|
2140
|
-
setDragState(null);
|
|
2141
|
-
}, []);
|
|
2142
|
-
const unregisterPanel = useCallback(panelData => {
|
|
2143
|
-
const {
|
|
2144
|
-
panelDataArray
|
|
2145
|
-
} = eagerValuesRef.current;
|
|
2146
|
-
const index = findPanelDataIndex(panelDataArray, panelData);
|
|
2147
|
-
if (index >= 0) {
|
|
2148
|
-
panelDataArray.splice(index, 1);
|
|
2149
|
-
|
|
2150
|
-
// TRICKY
|
|
2151
|
-
// When a panel is removed from the group, we should delete the most recent prev-size entry for it.
|
|
2152
|
-
// If we don't do this, then a conditionally rendered panel might not call onResize when it's re-mounted.
|
|
2153
|
-
// Strict effects mode makes this tricky though because all panels will be registered, unregistered, then re-registered on mount.
|
|
2154
|
-
delete panelIdToLastNotifiedSizeMapRef.current[panelData.id];
|
|
2155
|
-
eagerValuesRef.current.panelDataArrayChanged = true;
|
|
2156
|
-
forceUpdate();
|
|
2157
|
-
}
|
|
2158
|
-
}, [forceUpdate]);
|
|
2159
|
-
const context = useMemo(() => ({
|
|
2160
|
-
collapsePanel,
|
|
2161
|
-
direction,
|
|
2162
|
-
dragState,
|
|
2163
|
-
expandPanel,
|
|
2164
|
-
getPanelSize,
|
|
2165
|
-
getPanelStyle,
|
|
2166
|
-
groupId,
|
|
2167
|
-
isPanelCollapsed,
|
|
2168
|
-
isPanelExpanded,
|
|
2169
|
-
reevaluatePanelConstraints,
|
|
2170
|
-
registerPanel,
|
|
2171
|
-
registerResizeHandle,
|
|
2172
|
-
resizePanel,
|
|
2173
|
-
startDragging,
|
|
2174
|
-
stopDragging,
|
|
2175
|
-
unregisterPanel,
|
|
2176
|
-
panelGroupElement: panelGroupElementRef.current
|
|
2177
|
-
}), [collapsePanel, dragState, direction, expandPanel, getPanelSize, getPanelStyle, groupId, isPanelCollapsed, isPanelExpanded, reevaluatePanelConstraints, registerPanel, registerResizeHandle, resizePanel, startDragging, stopDragging, unregisterPanel]);
|
|
2178
|
-
const style = {
|
|
2179
|
-
display: "flex",
|
|
2180
|
-
flexDirection: direction === "horizontal" ? "row" : "column",
|
|
2181
|
-
height: "100%",
|
|
2182
|
-
overflow: "hidden",
|
|
2183
|
-
width: "100%"
|
|
2184
|
-
};
|
|
2185
|
-
return createElement(PanelGroupContext.Provider, {
|
|
2186
|
-
value: context
|
|
2187
|
-
}, createElement(Type, {
|
|
2188
|
-
...rest,
|
|
2189
|
-
children,
|
|
2190
|
-
className: classNameFromProps,
|
|
2191
|
-
id: idFromProps,
|
|
2192
|
-
ref: panelGroupElementRef,
|
|
2193
|
-
style: {
|
|
2194
|
-
...style,
|
|
2195
|
-
...styleFromProps
|
|
2196
|
-
},
|
|
2197
|
-
// CSS selectors
|
|
2198
|
-
[DATA_ATTRIBUTES.group]: "",
|
|
2199
|
-
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
2200
|
-
[DATA_ATTRIBUTES.groupId]: groupId
|
|
2201
|
-
}));
|
|
1211
|
+
});
|
|
2202
1212
|
}
|
|
2203
|
-
|
|
2204
|
-
...
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
1213
|
+
function Lt(e) {
|
|
1214
|
+
const t = I({ ...e });
|
|
1215
|
+
return A(() => {
|
|
1216
|
+
for (const n in e)
|
|
1217
|
+
t.current[n] = e[n];
|
|
1218
|
+
}, [e]), t.current;
|
|
1219
|
+
}
|
|
1220
|
+
const je = "--react-resizable-panels--panel--pointer-events";
|
|
1221
|
+
function He(e, t) {
|
|
1222
|
+
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1223
|
+
return `--react-resizable-panels--${n}--${o}`;
|
|
1224
|
+
}
|
|
1225
|
+
const Ve = Ye(null);
|
|
1226
|
+
function Pt(e, t) {
|
|
1227
|
+
const n = I({
|
|
1228
|
+
getLayout: () => ({}),
|
|
1229
|
+
setLayout: ut
|
|
1230
|
+
});
|
|
1231
|
+
Ee(t, () => n.current, []), A(() => {
|
|
1232
|
+
Object.assign(
|
|
1233
|
+
n.current,
|
|
1234
|
+
Ge({ groupId: e })
|
|
1235
|
+
);
|
|
1236
|
+
});
|
|
2222
1237
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
1238
|
+
function Tt({
|
|
1239
|
+
children: e,
|
|
1240
|
+
className: t,
|
|
1241
|
+
defaultLayout: n,
|
|
1242
|
+
disableCursor: o,
|
|
1243
|
+
disabled: r,
|
|
1244
|
+
elementRef: s,
|
|
1245
|
+
groupRef: l,
|
|
1246
|
+
id: i,
|
|
1247
|
+
onLayoutChange: a,
|
|
1248
|
+
orientation: u = "horizontal",
|
|
1249
|
+
style: f,
|
|
1250
|
+
...p
|
|
2231
1251
|
}) {
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
}
|
|
2236
|
-
|
|
2237
|
-
|
|
1252
|
+
const m = I({}), h = ce((L) => {
|
|
1253
|
+
K(m.current, L) || (m.current = L, a?.(L));
|
|
1254
|
+
}), c = ue(i), [d, y] = D(!1), v = I(null), [S, x] = D(n ?? {}), [g, b] = D([]), [w, C] = D([]), $ = I({
|
|
1255
|
+
lastExpandedPanelSizes: {},
|
|
1256
|
+
layouts: {}
|
|
1257
|
+
}), oe = fe(v, s);
|
|
1258
|
+
Pt(c, l);
|
|
1259
|
+
const Z = se(
|
|
1260
|
+
() => ({
|
|
1261
|
+
id: c,
|
|
1262
|
+
orientation: u,
|
|
1263
|
+
registerPanel: (L) => (b((P) => ae(u, [...P, L])), () => {
|
|
1264
|
+
b((P) => P.filter((O) => O !== L));
|
|
1265
|
+
}),
|
|
1266
|
+
registerSeparator: (L) => (C(
|
|
1267
|
+
(P) => ae(u, [...P, L])
|
|
1268
|
+
), () => {
|
|
1269
|
+
C(
|
|
1270
|
+
(P) => P.filter((O) => O !== L)
|
|
1271
|
+
);
|
|
1272
|
+
})
|
|
1273
|
+
}),
|
|
1274
|
+
[c, u]
|
|
1275
|
+
), F = Lt({
|
|
1276
|
+
defaultLayout: n,
|
|
1277
|
+
disableCursor: o
|
|
1278
|
+
}), j = I(null);
|
|
1279
|
+
A(() => {
|
|
1280
|
+
const L = v.current;
|
|
1281
|
+
if (L === null)
|
|
2238
1282
|
return;
|
|
1283
|
+
const P = {
|
|
1284
|
+
defaultLayout: F.defaultLayout,
|
|
1285
|
+
disableCursor: !!F.disableCursor,
|
|
1286
|
+
disabled: !!r,
|
|
1287
|
+
element: L,
|
|
1288
|
+
id: c,
|
|
1289
|
+
inMemoryLastExpandedPanelSizes: $.current.lastExpandedPanelSizes,
|
|
1290
|
+
inMemoryLayouts: $.current.layouts,
|
|
1291
|
+
orientation: u,
|
|
1292
|
+
panels: g,
|
|
1293
|
+
separators: w
|
|
1294
|
+
};
|
|
1295
|
+
j.current = P;
|
|
1296
|
+
const O = wt(P), pe = G().mountedGroups.get(P);
|
|
1297
|
+
if (pe) {
|
|
1298
|
+
const { defaultLayoutDeferred: H, derivedPanelConstraints: V, layout: Q } = pe;
|
|
1299
|
+
!H && V.length > 0 && (x(Q), h?.(Q));
|
|
2239
1300
|
}
|
|
2240
|
-
const
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
case "Home":
|
|
2251
|
-
{
|
|
2252
|
-
event.preventDefault();
|
|
2253
|
-
resizeHandler(event);
|
|
1301
|
+
const Be = _.addListener(
|
|
1302
|
+
"interactionStateChange",
|
|
1303
|
+
(H) => {
|
|
1304
|
+
switch (H.state) {
|
|
1305
|
+
case "active": {
|
|
1306
|
+
y(
|
|
1307
|
+
H.hitRegions.some(
|
|
1308
|
+
(V) => V.group === P
|
|
1309
|
+
)
|
|
1310
|
+
);
|
|
2254
1311
|
break;
|
|
2255
1312
|
}
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
event.preventDefault();
|
|
2259
|
-
const groupId = handleElement.getAttribute(DATA_ATTRIBUTES.groupId);
|
|
2260
|
-
assert(groupId, `No group element found for id "${groupId}"`);
|
|
2261
|
-
const handles = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
2262
|
-
const index = getResizeHandleElementIndex(groupId, handleId, panelGroupElement);
|
|
2263
|
-
assert(index !== null, `No resize element found for id "${handleId}"`);
|
|
2264
|
-
const nextIndex = event.shiftKey ? index > 0 ? index - 1 : handles.length - 1 : index + 1 < handles.length ? index + 1 : 0;
|
|
2265
|
-
const nextHandle = handles[nextIndex];
|
|
2266
|
-
nextHandle.focus();
|
|
1313
|
+
default: {
|
|
1314
|
+
y(!1);
|
|
2267
1315
|
break;
|
|
2268
1316
|
}
|
|
1317
|
+
}
|
|
2269
1318
|
}
|
|
2270
|
-
|
|
2271
|
-
|
|
1319
|
+
), We = _.addListener(
|
|
1320
|
+
"mountedGroupsChange",
|
|
1321
|
+
(H) => {
|
|
1322
|
+
const V = H.get(P);
|
|
1323
|
+
if (V) {
|
|
1324
|
+
const { defaultLayoutDeferred: Q, derivedPanelConstraints: Ue, layout: me } = V;
|
|
1325
|
+
if (Q || Ue.length === 0)
|
|
1326
|
+
return;
|
|
1327
|
+
x(me), h?.(me);
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
);
|
|
2272
1331
|
return () => {
|
|
2273
|
-
|
|
1332
|
+
j.current = null, O(), Be(), We();
|
|
2274
1333
|
};
|
|
2275
|
-
}, [
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
onDragging,
|
|
2287
|
-
onFocus,
|
|
2288
|
-
onPointerDown,
|
|
2289
|
-
onPointerUp,
|
|
2290
|
-
style: styleFromProps = {},
|
|
2291
|
-
tabIndex = 0,
|
|
2292
|
-
tagName: Type = "div",
|
|
2293
|
-
...rest
|
|
2294
|
-
}) {
|
|
2295
|
-
var _hitAreaMargins$coars, _hitAreaMargins$fine;
|
|
2296
|
-
const elementRef = useRef(null);
|
|
2297
|
-
|
|
2298
|
-
// Use a ref to guard against users passing inline props
|
|
2299
|
-
const callbacksRef = useRef({
|
|
2300
|
-
onClick,
|
|
2301
|
-
onDragging,
|
|
2302
|
-
onPointerDown,
|
|
2303
|
-
onPointerUp
|
|
1334
|
+
}, [
|
|
1335
|
+
r,
|
|
1336
|
+
c,
|
|
1337
|
+
h,
|
|
1338
|
+
u,
|
|
1339
|
+
g,
|
|
1340
|
+
w,
|
|
1341
|
+
F
|
|
1342
|
+
]), Ce(() => {
|
|
1343
|
+
const L = j.current;
|
|
1344
|
+
L && (L.defaultLayout = n, L.disableCursor = !!o);
|
|
2304
1345
|
});
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
const panelGroupContext = useContext(PanelGroupContext);
|
|
2312
|
-
if (panelGroupContext === null) {
|
|
2313
|
-
throw Error(`PanelResizeHandle components must be rendered within a PanelGroup container`);
|
|
1346
|
+
const J = {
|
|
1347
|
+
[je]: d ? "none" : void 0
|
|
1348
|
+
};
|
|
1349
|
+
for (const L in S) {
|
|
1350
|
+
const P = He(c, L), O = S[L];
|
|
1351
|
+
J[P] = O;
|
|
2314
1352
|
}
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
useEffect(() => {
|
|
2334
|
-
if (disabled) {
|
|
2335
|
-
setResizeHandler(null);
|
|
2336
|
-
} else {
|
|
2337
|
-
const resizeHandler = registerResizeHandleWithParentGroup(resizeHandleId);
|
|
2338
|
-
setResizeHandler(() => resizeHandler);
|
|
1353
|
+
return /* @__PURE__ */ X(Ve.Provider, { value: Z, children: /* @__PURE__ */ X(
|
|
1354
|
+
"div",
|
|
1355
|
+
{
|
|
1356
|
+
...p,
|
|
1357
|
+
"aria-orientation": u,
|
|
1358
|
+
className: t,
|
|
1359
|
+
"data-group": !0,
|
|
1360
|
+
"data-testid": c,
|
|
1361
|
+
id: c,
|
|
1362
|
+
ref: oe,
|
|
1363
|
+
style: {
|
|
1364
|
+
...f,
|
|
1365
|
+
...J,
|
|
1366
|
+
display: "flex",
|
|
1367
|
+
flexDirection: u === "horizontal" ? "row" : "column",
|
|
1368
|
+
flexWrap: "nowrap"
|
|
1369
|
+
},
|
|
1370
|
+
children: e
|
|
2339
1371
|
}
|
|
2340
|
-
}
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
1372
|
+
) });
|
|
1373
|
+
}
|
|
1374
|
+
function Rt(e, t = 10) {
|
|
1375
|
+
let n = null;
|
|
1376
|
+
return (o) => {
|
|
1377
|
+
n !== null && clearTimeout(n), n = setTimeout(() => {
|
|
1378
|
+
e(o);
|
|
1379
|
+
}, t);
|
|
1380
|
+
};
|
|
1381
|
+
}
|
|
1382
|
+
function re(e, t) {
|
|
1383
|
+
return `react-resizable-panels:${[e, ...t].join(":")}`;
|
|
1384
|
+
}
|
|
1385
|
+
function _t({
|
|
1386
|
+
debounceSaveMs: e = 100,
|
|
1387
|
+
panelIds: t,
|
|
1388
|
+
storage: n,
|
|
1389
|
+
...o
|
|
1390
|
+
}) {
|
|
1391
|
+
const r = t !== void 0, s = "id" in o ? o.id : o.groupId, l = re(s, t ?? []), i = Ze(
|
|
1392
|
+
Ct,
|
|
1393
|
+
() => n.getItem(l),
|
|
1394
|
+
() => n.getItem(l)
|
|
1395
|
+
), a = se(
|
|
1396
|
+
() => i ? JSON.parse(i) : void 0,
|
|
1397
|
+
[i]
|
|
1398
|
+
), u = se(() => {
|
|
1399
|
+
const f = (p) => {
|
|
1400
|
+
let m;
|
|
1401
|
+
r ? m = re(s, Object.keys(p)) : m = re(s, []);
|
|
1402
|
+
try {
|
|
1403
|
+
n.setItem(m, JSON.stringify(p));
|
|
1404
|
+
} catch (h) {
|
|
1405
|
+
console.error(h);
|
|
1406
|
+
}
|
|
1407
|
+
};
|
|
1408
|
+
return e > 0 ? Rt(f, e) : f;
|
|
1409
|
+
}, [e, r, s, n]);
|
|
1410
|
+
return {
|
|
1411
|
+
defaultLayout: a,
|
|
1412
|
+
onLayoutChange: u
|
|
1413
|
+
};
|
|
1414
|
+
}
|
|
1415
|
+
function Ct() {
|
|
1416
|
+
return function() {
|
|
1417
|
+
};
|
|
1418
|
+
}
|
|
1419
|
+
function Nt() {
|
|
1420
|
+
return D(null);
|
|
1421
|
+
}
|
|
1422
|
+
function At() {
|
|
1423
|
+
return I(null);
|
|
1424
|
+
}
|
|
1425
|
+
function de() {
|
|
1426
|
+
const e = Je(Ve);
|
|
1427
|
+
return z(
|
|
1428
|
+
e,
|
|
1429
|
+
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1430
|
+
), e;
|
|
1431
|
+
}
|
|
1432
|
+
function Et({
|
|
1433
|
+
groupId: e,
|
|
1434
|
+
panelId: t
|
|
1435
|
+
}) {
|
|
1436
|
+
const n = () => {
|
|
1437
|
+
const { mountedGroups: i } = G();
|
|
1438
|
+
for (const [
|
|
1439
|
+
a,
|
|
1440
|
+
{
|
|
1441
|
+
defaultLayoutDeferred: u,
|
|
1442
|
+
derivedPanelConstraints: f,
|
|
1443
|
+
layout: p,
|
|
1444
|
+
separatorToPanels: m
|
|
1445
|
+
}
|
|
1446
|
+
] of i)
|
|
1447
|
+
if (a.id === e)
|
|
1448
|
+
return {
|
|
1449
|
+
defaultLayoutDeferred: u,
|
|
1450
|
+
derivedPanelConstraints: f,
|
|
1451
|
+
group: a,
|
|
1452
|
+
layout: p,
|
|
1453
|
+
separatorToPanels: m
|
|
1454
|
+
};
|
|
1455
|
+
throw Error(`Group ${e} not found`);
|
|
1456
|
+
}, o = () => {
|
|
1457
|
+
const i = n().derivedPanelConstraints.find(
|
|
1458
|
+
(a) => a.panelId === t
|
|
1459
|
+
);
|
|
1460
|
+
if (i !== void 0)
|
|
1461
|
+
return i;
|
|
1462
|
+
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
1463
|
+
}, r = () => {
|
|
1464
|
+
const i = n().group.panels.find((a) => a.id === t);
|
|
1465
|
+
if (i !== void 0)
|
|
1466
|
+
return i;
|
|
1467
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
1468
|
+
}, s = () => {
|
|
1469
|
+
const i = n().layout[t];
|
|
1470
|
+
if (i !== void 0)
|
|
1471
|
+
return i;
|
|
1472
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
1473
|
+
}, l = (i) => {
|
|
1474
|
+
const a = s();
|
|
1475
|
+
if (i === a)
|
|
2348
1476
|
return;
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
1477
|
+
const {
|
|
1478
|
+
defaultLayoutDeferred: u,
|
|
1479
|
+
derivedPanelConstraints: f,
|
|
1480
|
+
group: p,
|
|
1481
|
+
layout: m,
|
|
1482
|
+
separatorToPanels: h
|
|
1483
|
+
} = n(), c = p.panels.findIndex((S) => S.id === t), d = c === p.panels.length - 1, y = Y({
|
|
1484
|
+
delta: d ? a - i : i - a,
|
|
1485
|
+
initialLayout: m,
|
|
1486
|
+
panelConstraints: f,
|
|
1487
|
+
pivotIndices: d ? [c - 1, c] : [c, c + 1],
|
|
1488
|
+
prevLayout: m,
|
|
1489
|
+
trigger: "imperative-api"
|
|
1490
|
+
}), v = N({
|
|
1491
|
+
layout: y,
|
|
1492
|
+
panelConstraints: f
|
|
1493
|
+
});
|
|
1494
|
+
K(m, v) || M((S) => ({
|
|
1495
|
+
mountedGroups: new Map(S.mountedGroups).set(p, {
|
|
1496
|
+
defaultLayoutDeferred: u,
|
|
1497
|
+
derivedPanelConstraints: f,
|
|
1498
|
+
layout: v,
|
|
1499
|
+
separatorToPanels: h
|
|
1500
|
+
})
|
|
1501
|
+
}));
|
|
1502
|
+
};
|
|
1503
|
+
return {
|
|
1504
|
+
collapse: () => {
|
|
1505
|
+
const { collapsible: i, collapsedSize: a } = o(), { mutableValues: u } = r(), f = s();
|
|
1506
|
+
i && f !== a && (u.expandToSize = f, l(a));
|
|
1507
|
+
},
|
|
1508
|
+
expand: () => {
|
|
1509
|
+
const { collapsible: i, collapsedSize: a, minSize: u } = o(), { mutableValues: f } = r(), p = s();
|
|
1510
|
+
if (i && p === a) {
|
|
1511
|
+
let m = f.expandToSize ?? u;
|
|
1512
|
+
m === 0 && (m = 1), l(m);
|
|
2357
1513
|
}
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
{
|
|
2375
|
-
const {
|
|
2376
|
-
|
|
2377
|
-
} = committedValuesRef.current;
|
|
2378
|
-
didMove = true;
|
|
2379
|
-
if (state !== "drag") {
|
|
2380
|
-
setState("hover");
|
|
2381
|
-
}
|
|
2382
|
-
assert(event, 'Expected event to be defined for "move" action');
|
|
2383
|
-
resizeHandler(event);
|
|
1514
|
+
},
|
|
1515
|
+
getSize: () => {
|
|
1516
|
+
const { group: i } = n(), a = s(), { element: u } = r(), f = i.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
|
|
1517
|
+
return {
|
|
1518
|
+
asPercentage: a,
|
|
1519
|
+
inPixels: f
|
|
1520
|
+
};
|
|
1521
|
+
},
|
|
1522
|
+
isCollapsed: () => {
|
|
1523
|
+
const { collapsible: i, collapsedSize: a } = o(), u = s();
|
|
1524
|
+
return i && R(a, u);
|
|
1525
|
+
},
|
|
1526
|
+
resize: (i) => {
|
|
1527
|
+
if (s() !== i) {
|
|
1528
|
+
let u;
|
|
1529
|
+
switch (typeof i) {
|
|
1530
|
+
case "number": {
|
|
1531
|
+
const { group: f } = n(), p = U({ group: f });
|
|
1532
|
+
u = k(i / p * 100);
|
|
2384
1533
|
break;
|
|
2385
1534
|
}
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
setState("hover");
|
|
2389
|
-
stopDragging();
|
|
2390
|
-
const {
|
|
2391
|
-
onClick,
|
|
2392
|
-
onDragging,
|
|
2393
|
-
onPointerUp
|
|
2394
|
-
} = callbacksRef.current;
|
|
2395
|
-
onDragging === null || onDragging === void 0 ? void 0 : onDragging(false);
|
|
2396
|
-
onPointerUp === null || onPointerUp === void 0 ? void 0 : onPointerUp();
|
|
2397
|
-
if (!didMove) {
|
|
2398
|
-
onClick === null || onClick === void 0 ? void 0 : onClick();
|
|
2399
|
-
}
|
|
1535
|
+
case "string": {
|
|
1536
|
+
u = parseFloat(i);
|
|
2400
1537
|
break;
|
|
2401
1538
|
}
|
|
1539
|
+
}
|
|
1540
|
+
l(u);
|
|
2402
1541
|
}
|
|
2403
|
-
}
|
|
2404
|
-
return registerResizeHandle(resizeHandleId, element, direction, {
|
|
2405
|
-
coarse: coarseHitAreaMargins,
|
|
2406
|
-
fine: fineHitAreaMargins
|
|
2407
|
-
}, setResizeHandlerState);
|
|
2408
|
-
}, [coarseHitAreaMargins, direction, disabled, fineHitAreaMargins, registerResizeHandleWithParentGroup, resizeHandleId, resizeHandler, startDragging, stopDragging]);
|
|
2409
|
-
useWindowSplitterResizeHandlerBehavior({
|
|
2410
|
-
disabled,
|
|
2411
|
-
handleId: resizeHandleId,
|
|
2412
|
-
resizeHandler,
|
|
2413
|
-
panelGroupElement
|
|
2414
|
-
});
|
|
2415
|
-
const style = {
|
|
2416
|
-
touchAction: "none",
|
|
2417
|
-
userSelect: "none"
|
|
1542
|
+
}
|
|
2418
1543
|
};
|
|
2419
|
-
return createElement(Type, {
|
|
2420
|
-
...rest,
|
|
2421
|
-
children,
|
|
2422
|
-
className: classNameFromProps,
|
|
2423
|
-
id: idFromProps,
|
|
2424
|
-
onBlur: () => {
|
|
2425
|
-
setIsFocused(false);
|
|
2426
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
2427
|
-
},
|
|
2428
|
-
onFocus: () => {
|
|
2429
|
-
setIsFocused(true);
|
|
2430
|
-
onFocus === null || onFocus === void 0 ? void 0 : onFocus();
|
|
2431
|
-
},
|
|
2432
|
-
ref: elementRef,
|
|
2433
|
-
role: "separator",
|
|
2434
|
-
style: {
|
|
2435
|
-
...style,
|
|
2436
|
-
...styleFromProps
|
|
2437
|
-
},
|
|
2438
|
-
tabIndex,
|
|
2439
|
-
// CSS selectors
|
|
2440
|
-
[DATA_ATTRIBUTES.groupDirection]: direction,
|
|
2441
|
-
[DATA_ATTRIBUTES.groupId]: groupId,
|
|
2442
|
-
[DATA_ATTRIBUTES.resizeHandle]: "",
|
|
2443
|
-
[DATA_ATTRIBUTES.resizeHandleActive]: state === "drag" ? "pointer" : isFocused ? "keyboard" : undefined,
|
|
2444
|
-
[DATA_ATTRIBUTES.resizeHandleEnabled]: !disabled,
|
|
2445
|
-
[DATA_ATTRIBUTES.resizeHandleId]: resizeHandleId,
|
|
2446
|
-
[DATA_ATTRIBUTES.resizeHandleState]: state
|
|
2447
|
-
});
|
|
2448
1544
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
1545
|
+
function Mt(e, t) {
|
|
1546
|
+
const { id: n } = de(), o = I({
|
|
1547
|
+
collapse: ie,
|
|
1548
|
+
expand: ie,
|
|
1549
|
+
getSize: () => ({
|
|
1550
|
+
asPercentage: 0,
|
|
1551
|
+
inPixels: 0
|
|
1552
|
+
}),
|
|
1553
|
+
isCollapsed: () => !1,
|
|
1554
|
+
resize: ie
|
|
1555
|
+
});
|
|
1556
|
+
Ee(t, () => o.current, []), A(() => {
|
|
1557
|
+
Object.assign(
|
|
1558
|
+
o.current,
|
|
1559
|
+
Et({ groupId: n, panelId: e })
|
|
1560
|
+
);
|
|
1561
|
+
});
|
|
2457
1562
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
1563
|
+
function $t({
|
|
1564
|
+
children: e,
|
|
1565
|
+
className: t,
|
|
1566
|
+
collapsedSize: n = "0%",
|
|
1567
|
+
collapsible: o = !1,
|
|
1568
|
+
defaultSize: r,
|
|
1569
|
+
elementRef: s,
|
|
1570
|
+
id: l,
|
|
1571
|
+
maxSize: i = "100%",
|
|
1572
|
+
minSize: a = "0%",
|
|
1573
|
+
onResize: u,
|
|
1574
|
+
panelRef: f,
|
|
1575
|
+
style: p,
|
|
1576
|
+
...m
|
|
1577
|
+
}) {
|
|
1578
|
+
const h = !!l, c = ue(l), d = I(null), y = fe(d, s), { id: v, registerPanel: S } = de(), x = u !== null, g = ce(
|
|
1579
|
+
(w, C, $) => {
|
|
1580
|
+
u?.(w, l, $);
|
|
1581
|
+
}
|
|
1582
|
+
);
|
|
1583
|
+
A(() => {
|
|
1584
|
+
const w = d.current;
|
|
1585
|
+
if (w !== null)
|
|
1586
|
+
return S({
|
|
1587
|
+
element: w,
|
|
1588
|
+
id: c,
|
|
1589
|
+
idIsStable: h,
|
|
1590
|
+
mutableValues: {
|
|
1591
|
+
expandToSize: void 0,
|
|
1592
|
+
prevSize: void 0
|
|
1593
|
+
},
|
|
1594
|
+
onResize: x ? g : void 0,
|
|
1595
|
+
panelConstraints: {
|
|
1596
|
+
collapsedSize: n,
|
|
1597
|
+
collapsible: o,
|
|
1598
|
+
defaultSize: r,
|
|
1599
|
+
maxSize: i,
|
|
1600
|
+
minSize: a
|
|
1601
|
+
}
|
|
1602
|
+
});
|
|
1603
|
+
}, [
|
|
1604
|
+
n,
|
|
1605
|
+
o,
|
|
1606
|
+
r,
|
|
1607
|
+
x,
|
|
1608
|
+
c,
|
|
1609
|
+
h,
|
|
1610
|
+
i,
|
|
1611
|
+
a,
|
|
1612
|
+
g,
|
|
1613
|
+
S
|
|
1614
|
+
]), Mt(c, f);
|
|
1615
|
+
const b = He(v, c);
|
|
1616
|
+
return /* @__PURE__ */ X(
|
|
1617
|
+
"div",
|
|
1618
|
+
{
|
|
1619
|
+
...m,
|
|
1620
|
+
"data-panel": !0,
|
|
1621
|
+
"data-testid": c,
|
|
1622
|
+
id: c,
|
|
1623
|
+
ref: y,
|
|
1624
|
+
style: {
|
|
1625
|
+
...It,
|
|
1626
|
+
flexBasis: 0,
|
|
1627
|
+
flexGrow: `var(${b}, 1)`,
|
|
1628
|
+
flexShrink: 1,
|
|
1629
|
+
// Prevent Panel content from interfering with panel size
|
|
1630
|
+
overflow: "hidden",
|
|
1631
|
+
// Disable pointer events inside of a panel during resize
|
|
1632
|
+
// This avoid edge cases like nested iframes
|
|
1633
|
+
pointerEvents: `var(${je})`
|
|
1634
|
+
},
|
|
1635
|
+
children: /* @__PURE__ */ X(
|
|
1636
|
+
"div",
|
|
1637
|
+
{
|
|
1638
|
+
className: t,
|
|
1639
|
+
style: {
|
|
1640
|
+
width: "100%",
|
|
1641
|
+
height: "100%",
|
|
1642
|
+
...p
|
|
1643
|
+
},
|
|
1644
|
+
children: e
|
|
1645
|
+
}
|
|
1646
|
+
)
|
|
1647
|
+
}
|
|
1648
|
+
);
|
|
1649
|
+
}
|
|
1650
|
+
const It = {
|
|
1651
|
+
minHeight: "unset",
|
|
1652
|
+
maxHeight: "unset",
|
|
1653
|
+
height: "unset",
|
|
1654
|
+
minWidth: "unset",
|
|
1655
|
+
maxWidth: "unset",
|
|
1656
|
+
width: "unset",
|
|
1657
|
+
flex: "unset",
|
|
1658
|
+
flexBasis: "unset",
|
|
1659
|
+
flexShrink: "unset",
|
|
1660
|
+
flexGrow: "unset",
|
|
1661
|
+
border: "unset",
|
|
1662
|
+
borderWidth: "unset",
|
|
1663
|
+
padding: "unset",
|
|
1664
|
+
margin: "unset"
|
|
1665
|
+
};
|
|
1666
|
+
function Ft() {
|
|
1667
|
+
return D(null);
|
|
2465
1668
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
return Array.from(scope.querySelectorAll(`[data-panel][data-panel-group-id="${groupId}"]`));
|
|
1669
|
+
function jt() {
|
|
1670
|
+
return I(null);
|
|
2469
1671
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
1672
|
+
function kt({
|
|
1673
|
+
layout: e,
|
|
1674
|
+
panelConstraints: t,
|
|
1675
|
+
panelId: n,
|
|
1676
|
+
panelIndex: o
|
|
1677
|
+
}) {
|
|
1678
|
+
let r, s;
|
|
1679
|
+
const l = e[n], i = t.find(
|
|
1680
|
+
(a) => a.panelId === n
|
|
1681
|
+
);
|
|
1682
|
+
if (i) {
|
|
1683
|
+
const a = i.maxSize, u = s = i.collapsible ? i.collapsedSize : i.minSize, f = [o, o + 1];
|
|
1684
|
+
s = N({
|
|
1685
|
+
layout: Y({
|
|
1686
|
+
delta: u - l,
|
|
1687
|
+
initialLayout: e,
|
|
1688
|
+
panelConstraints: t,
|
|
1689
|
+
pivotIndices: f,
|
|
1690
|
+
prevLayout: e,
|
|
1691
|
+
trigger: "keyboard"
|
|
1692
|
+
}),
|
|
1693
|
+
panelConstraints: t
|
|
1694
|
+
})[n], r = N({
|
|
1695
|
+
layout: Y({
|
|
1696
|
+
delta: a - l,
|
|
1697
|
+
initialLayout: e,
|
|
1698
|
+
panelConstraints: t,
|
|
1699
|
+
pivotIndices: f,
|
|
1700
|
+
prevLayout: e,
|
|
1701
|
+
trigger: "keyboard"
|
|
1702
|
+
}),
|
|
1703
|
+
panelConstraints: t
|
|
1704
|
+
})[n];
|
|
2479
1705
|
}
|
|
2480
1706
|
return {
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
1707
|
+
valueControls: n,
|
|
1708
|
+
valueMax: r,
|
|
1709
|
+
valueMin: s,
|
|
1710
|
+
valueNow: l
|
|
2485
1711
|
};
|
|
2486
1712
|
}
|
|
2487
|
-
|
|
2488
|
-
|
|
1713
|
+
function Ht({
|
|
1714
|
+
children: e,
|
|
1715
|
+
className: t,
|
|
1716
|
+
elementRef: n,
|
|
1717
|
+
id: o,
|
|
1718
|
+
style: r,
|
|
1719
|
+
...s
|
|
1720
|
+
}) {
|
|
1721
|
+
const l = ue(o), [i, a] = D({}), [u, f] = D("inactive"), [p, m] = D(null), h = fe(m, n), {
|
|
1722
|
+
id: c,
|
|
1723
|
+
orientation: d,
|
|
1724
|
+
registerSeparator: y
|
|
1725
|
+
} = de(), v = d === "horizontal" ? "vertical" : "horizontal";
|
|
1726
|
+
return A(() => {
|
|
1727
|
+
if (p !== null) {
|
|
1728
|
+
const S = {
|
|
1729
|
+
element: p,
|
|
1730
|
+
id: l
|
|
1731
|
+
}, x = y(S), g = _.addListener(
|
|
1732
|
+
"interactionStateChange",
|
|
1733
|
+
(w) => {
|
|
1734
|
+
f(
|
|
1735
|
+
w.state !== "inactive" && w.hitRegions.some(
|
|
1736
|
+
(C) => C.separator === S
|
|
1737
|
+
) ? w.state : "inactive"
|
|
1738
|
+
);
|
|
1739
|
+
}
|
|
1740
|
+
), b = _.addListener(
|
|
1741
|
+
"mountedGroupsChange",
|
|
1742
|
+
(w) => {
|
|
1743
|
+
w.forEach(
|
|
1744
|
+
({ derivedPanelConstraints: C, layout: $, separatorToPanels: oe }, Z) => {
|
|
1745
|
+
if (Z.id === c) {
|
|
1746
|
+
const F = oe.get(S);
|
|
1747
|
+
if (F) {
|
|
1748
|
+
const j = F[0], J = Z.panels.indexOf(j);
|
|
1749
|
+
a(
|
|
1750
|
+
kt({
|
|
1751
|
+
layout: $,
|
|
1752
|
+
panelConstraints: C,
|
|
1753
|
+
panelId: j.id,
|
|
1754
|
+
panelIndex: J
|
|
1755
|
+
})
|
|
1756
|
+
);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
);
|
|
1761
|
+
}
|
|
1762
|
+
);
|
|
1763
|
+
return () => {
|
|
1764
|
+
g(), b(), x();
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
}, [p, c, l, y]), /* @__PURE__ */ X(
|
|
1768
|
+
"div",
|
|
1769
|
+
{
|
|
1770
|
+
...s,
|
|
1771
|
+
"aria-controls": i.valueControls,
|
|
1772
|
+
"aria-orientation": v,
|
|
1773
|
+
"aria-valuemax": i.valueMax,
|
|
1774
|
+
"aria-valuemin": i.valueMin,
|
|
1775
|
+
"aria-valuenow": i.valueNow,
|
|
1776
|
+
children: e,
|
|
1777
|
+
className: t,
|
|
1778
|
+
"data-separator": u,
|
|
1779
|
+
"data-testid": l,
|
|
1780
|
+
id: l,
|
|
1781
|
+
ref: h,
|
|
1782
|
+
role: "separator",
|
|
1783
|
+
style: {
|
|
1784
|
+
flexBasis: "auto",
|
|
1785
|
+
...r,
|
|
1786
|
+
flexGrow: 0,
|
|
1787
|
+
flexShrink: 0
|
|
1788
|
+
},
|
|
1789
|
+
tabIndex: 0
|
|
1790
|
+
}
|
|
1791
|
+
);
|
|
1792
|
+
}
|
|
1793
|
+
export {
|
|
1794
|
+
Tt as Group,
|
|
1795
|
+
$t as Panel,
|
|
1796
|
+
Ht as Separator,
|
|
1797
|
+
_t as useDefaultLayout,
|
|
1798
|
+
Nt as useGroupCallbackRef,
|
|
1799
|
+
At as useGroupRef,
|
|
1800
|
+
Ft as usePanelCallbackRef,
|
|
1801
|
+
jt as usePanelRef
|
|
1802
|
+
};
|
|
1803
|
+
//# sourceMappingURL=react-resizable-panels.js.map
|