react-resizable-panels 3.0.6 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +253 -250
- package/dist/react-resizable-panels.cjs +2 -0
- package/dist/react-resizable-panels.cjs.map +1 -0
- package/dist/react-resizable-panels.d.ts +331 -2
- package/dist/react-resizable-panels.js +1063 -2373
- package/dist/react-resizable-panels.js.map +1 -0
- package/package.json +102 -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,1178 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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++;
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as F } from "react/jsx-runtime";
|
|
3
|
+
import { useId as Pe, useLayoutEffect as Ee, useEffect as Ce, useRef as I, useCallback as fe, createContext as Me, useImperativeHandle as de, useState as M, useMemo as pe, useSyncExternalStore as Ge, useContext as Ie } from "react";
|
|
4
|
+
function Oe(e, t) {
|
|
5
|
+
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
6
|
+
return t * o;
|
|
7
|
+
}
|
|
8
|
+
function ke(e, t) {
|
|
9
|
+
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
10
|
+
return t * o;
|
|
11
|
+
}
|
|
12
|
+
function Ae(e) {
|
|
13
|
+
return e / 100 * window.innerHeight;
|
|
14
|
+
}
|
|
15
|
+
function Ne(e) {
|
|
16
|
+
return e / 100 * window.innerWidth;
|
|
17
|
+
}
|
|
18
|
+
function $e(e) {
|
|
19
|
+
switch (typeof e) {
|
|
20
|
+
case "number":
|
|
21
|
+
return [e, "px"];
|
|
22
|
+
case "string": {
|
|
23
|
+
const t = parseFloat(e);
|
|
24
|
+
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, "%"];
|
|
25
|
+
}
|
|
37
26
|
}
|
|
38
|
-
return idFromParams !== null && idFromParams !== void 0 ? idFromParams : idRef.current;
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
|
28
|
+
function j({
|
|
29
|
+
groupSize: e,
|
|
30
|
+
panelElement: t,
|
|
31
|
+
styleProp: n
|
|
58
32
|
}) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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);
|
|
33
|
+
let o;
|
|
34
|
+
const [s, i] = $e(n);
|
|
35
|
+
switch (i) {
|
|
36
|
+
case "%": {
|
|
37
|
+
o = s / 100 * e;
|
|
38
|
+
break;
|
|
120
39
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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);
|
|
40
|
+
case "px": {
|
|
41
|
+
o = s;
|
|
42
|
+
break;
|
|
150
43
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
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";
|
|
44
|
+
case "rem": {
|
|
45
|
+
o = ke(t, s);
|
|
46
|
+
break;
|
|
236
47
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
case "
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
if (styleElement !== null) {
|
|
249
|
-
document.head.removeChild(styleElement);
|
|
250
|
-
currentCursorStyle = null;
|
|
251
|
-
styleElement = null;
|
|
252
|
-
prevRuleIndex = -1;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function setGlobalCursorStyle(state, constraintFlags, isPointerDown) {
|
|
256
|
-
var _styleElement$sheet$i, _styleElement$sheet2;
|
|
257
|
-
if (!enabled) {
|
|
258
|
-
return;
|
|
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);
|
|
48
|
+
case "em": {
|
|
49
|
+
o = Oe(t, s);
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
case "vh": {
|
|
53
|
+
o = Ae(s);
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "vw": {
|
|
57
|
+
o = Ne(s);
|
|
58
|
+
break;
|
|
270
59
|
}
|
|
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
60
|
}
|
|
277
|
-
|
|
61
|
+
return o;
|
|
278
62
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return event.type === "keydown";
|
|
63
|
+
function L(e) {
|
|
64
|
+
return parseFloat(e.toFixed(3));
|
|
282
65
|
}
|
|
283
|
-
function
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
return
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
66
|
+
function Q({
|
|
67
|
+
group: e
|
|
68
|
+
}) {
|
|
69
|
+
const { orientation: t, panels: n } = e;
|
|
70
|
+
return n.reduce((o, s) => (o += t === "horizontal" ? s.element.offsetWidth : s.element.offsetHeight, o), 0);
|
|
71
|
+
}
|
|
72
|
+
function ae(e) {
|
|
73
|
+
const { panels: t } = e, n = Q({ group: e });
|
|
74
|
+
return t.map((o) => {
|
|
75
|
+
const { element: s, panelConstraints: i } = o;
|
|
76
|
+
let a = 0;
|
|
77
|
+
if (i.collapsedSize) {
|
|
78
|
+
const u = j({
|
|
79
|
+
groupSize: n,
|
|
80
|
+
panelElement: s,
|
|
81
|
+
styleProp: i.collapsedSize
|
|
82
|
+
});
|
|
83
|
+
a = L(u / n * 100);
|
|
84
|
+
}
|
|
85
|
+
let r;
|
|
86
|
+
if (i.defaultSize) {
|
|
87
|
+
const u = j({
|
|
88
|
+
groupSize: n,
|
|
89
|
+
panelElement: s,
|
|
90
|
+
styleProp: i.defaultSize
|
|
91
|
+
});
|
|
92
|
+
r = L(u / n * 100);
|
|
93
|
+
}
|
|
94
|
+
let l = 0;
|
|
95
|
+
if (i.minSize) {
|
|
96
|
+
const u = j({
|
|
97
|
+
groupSize: n,
|
|
98
|
+
panelElement: s,
|
|
99
|
+
styleProp: i.minSize
|
|
100
|
+
});
|
|
101
|
+
l = L(u / n * 100);
|
|
102
|
+
}
|
|
103
|
+
let c = 100;
|
|
104
|
+
if (i.maxSize) {
|
|
105
|
+
const u = j({
|
|
106
|
+
groupSize: n,
|
|
107
|
+
panelElement: s,
|
|
108
|
+
styleProp: i.maxSize
|
|
109
|
+
});
|
|
110
|
+
c = L(u / n * 100);
|
|
297
111
|
}
|
|
298
|
-
} else if (isMouseEvent(event)) {
|
|
299
112
|
return {
|
|
300
|
-
|
|
301
|
-
|
|
113
|
+
collapsedSize: a,
|
|
114
|
+
collapsible: i.collapsible === !0,
|
|
115
|
+
defaultSize: r,
|
|
116
|
+
minSize: l,
|
|
117
|
+
maxSize: c,
|
|
118
|
+
panelId: o.id
|
|
302
119
|
};
|
|
303
|
-
}
|
|
304
|
-
return {
|
|
305
|
-
x: Infinity,
|
|
306
|
-
y: Infinity
|
|
307
|
-
};
|
|
120
|
+
});
|
|
308
121
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
122
|
+
class De {
|
|
123
|
+
#e = {};
|
|
124
|
+
addListener(t, n) {
|
|
125
|
+
const o = this.#e[t];
|
|
126
|
+
return o === void 0 ? this.#e[t] = [n] : o.includes(n) || o.push(n), () => {
|
|
127
|
+
this.removeListener(t, n);
|
|
128
|
+
};
|
|
313
129
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
130
|
+
emit(t, n) {
|
|
131
|
+
const o = this.#e[t];
|
|
132
|
+
if (o !== void 0)
|
|
133
|
+
if (o.length === 1)
|
|
134
|
+
o[0].call(null, n);
|
|
135
|
+
else {
|
|
136
|
+
let s = !1, i = null;
|
|
137
|
+
const a = Array.from(o);
|
|
138
|
+
for (let r = 0; r < a.length; r++) {
|
|
139
|
+
const l = a[r];
|
|
140
|
+
try {
|
|
141
|
+
l.call(null, n);
|
|
142
|
+
} catch (c) {
|
|
143
|
+
i === null && (s = !0, i = c);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (s)
|
|
147
|
+
throw i;
|
|
148
|
+
}
|
|
321
149
|
}
|
|
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)
|
|
337
|
-
};
|
|
338
|
-
let common_ancestor;
|
|
339
|
-
|
|
340
|
-
// remove shared ancestors
|
|
341
|
-
while (ancestors.a.at(-1) === ancestors.b.at(-1)) {
|
|
342
|
-
a = ancestors.a.pop();
|
|
343
|
-
b = ancestors.b.pop();
|
|
344
|
-
common_ancestor = a;
|
|
150
|
+
removeAllListeners() {
|
|
151
|
+
this.#e = {};
|
|
345
152
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if (z_indexes.a === z_indexes.b) {
|
|
352
|
-
const children = common_ancestor.childNodes;
|
|
353
|
-
const furthest_ancestors = {
|
|
354
|
-
a: ancestors.a.at(-1),
|
|
355
|
-
b: ancestors.b.at(-1)
|
|
356
|
-
};
|
|
357
|
-
let i = children.length;
|
|
358
|
-
while (i--) {
|
|
359
|
-
const child = children[i];
|
|
360
|
-
if (child === furthest_ancestors.a) return 1;
|
|
361
|
-
if (child === furthest_ancestors.b) return -1;
|
|
153
|
+
removeListener(t, n) {
|
|
154
|
+
const o = this.#e[t];
|
|
155
|
+
if (o !== void 0) {
|
|
156
|
+
const s = o.indexOf(n);
|
|
157
|
+
s >= 0 && o.splice(s, 1);
|
|
362
158
|
}
|
|
363
159
|
}
|
|
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
|
-
}
|
|
411
|
-
|
|
412
|
-
/** @param {HTMLElement | SVGElement} node */
|
|
413
|
-
function get_z_index(node) {
|
|
414
|
-
return node && Number(getComputedStyle(node).zIndex) || 0;
|
|
415
160
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
161
|
+
let E = {
|
|
162
|
+
cursorFlags: 0,
|
|
163
|
+
interactionState: {
|
|
164
|
+
state: "inactive"
|
|
165
|
+
},
|
|
166
|
+
mountedGroups: /* @__PURE__ */ new Map()
|
|
167
|
+
};
|
|
168
|
+
const T = new De();
|
|
169
|
+
function O() {
|
|
170
|
+
return E;
|
|
171
|
+
}
|
|
172
|
+
function G(e) {
|
|
173
|
+
const t = typeof e == "function" ? e(E) : e;
|
|
174
|
+
return E === t || (E = {
|
|
175
|
+
...E,
|
|
176
|
+
...t
|
|
177
|
+
}, t.cursorFlags !== void 0 && T.emit("cursorFlagsChange", E.cursorFlags), t.interactionState !== void 0 && T.emit("interactionStateChange", E.interactionState), t.mountedGroups !== void 0 && T.emit("mountedGroupsChange", E.mountedGroups)), E;
|
|
178
|
+
}
|
|
179
|
+
const Te = (e) => e, V = () => {
|
|
180
|
+
}, he = 1, me = 2, ve = 4, ge = 8, le = {
|
|
181
|
+
coarse: 10,
|
|
182
|
+
precise: 5
|
|
183
|
+
};
|
|
184
|
+
function X(e, t) {
|
|
185
|
+
return t.sort(
|
|
186
|
+
e === "horizontal" ? _e : Fe
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
function _e(e, t) {
|
|
190
|
+
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
191
|
+
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
192
|
+
}
|
|
193
|
+
function Fe(e, t) {
|
|
194
|
+
const n = e.element.offsetTop - t.element.offsetTop;
|
|
195
|
+
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
196
|
+
}
|
|
197
|
+
function He(e) {
|
|
198
|
+
const { element: t, orientation: n, panels: o, separators: s } = e, i = X(
|
|
199
|
+
n,
|
|
200
|
+
Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
|
|
201
|
+
).map(({ element: c }) => c), a = [];
|
|
202
|
+
let r, l;
|
|
203
|
+
for (const c of i) {
|
|
204
|
+
const u = o.find(
|
|
205
|
+
(d) => d.element === c
|
|
206
|
+
);
|
|
207
|
+
if (u) {
|
|
208
|
+
if (r) {
|
|
209
|
+
const d = r.element.getBoundingClientRect(), p = c.getBoundingClientRect();
|
|
210
|
+
a.push({
|
|
211
|
+
group: e,
|
|
212
|
+
panels: [r, u],
|
|
213
|
+
separator: l,
|
|
214
|
+
rect: n === "horizontal" ? new DOMRect(
|
|
215
|
+
d.right,
|
|
216
|
+
p.top,
|
|
217
|
+
p.left - d.right,
|
|
218
|
+
p.height
|
|
219
|
+
) : new DOMRect(
|
|
220
|
+
p.left,
|
|
221
|
+
d.bottom,
|
|
222
|
+
p.width,
|
|
223
|
+
p.top - d.bottom
|
|
224
|
+
)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
r = u, l = void 0;
|
|
228
|
+
} else {
|
|
229
|
+
const d = s.find(
|
|
230
|
+
(p) => p.element === c
|
|
231
|
+
);
|
|
232
|
+
d ? l = d : (r = void 0, l = void 0);
|
|
233
|
+
}
|
|
424
234
|
}
|
|
425
|
-
return
|
|
235
|
+
return a;
|
|
426
236
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
237
|
+
function je(e, t) {
|
|
238
|
+
return {
|
|
239
|
+
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
240
|
+
Math.abs(e.x - t.left),
|
|
241
|
+
Math.abs(e.x - t.right)
|
|
242
|
+
),
|
|
243
|
+
y: e.y >= t.top && e.y <= t.bottom ? 0 : Math.min(
|
|
244
|
+
Math.abs(e.y - t.top),
|
|
245
|
+
Math.abs(e.y - t.bottom)
|
|
246
|
+
)
|
|
247
|
+
};
|
|
437
248
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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
|
|
249
|
+
function We(e, t, n) {
|
|
250
|
+
let o, s = {
|
|
251
|
+
x: 1 / 0,
|
|
252
|
+
y: 1 / 0
|
|
459
253
|
};
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
updateListeners();
|
|
471
|
-
if (count === 1) {
|
|
472
|
-
ownerDocumentCounts.delete(ownerDocument);
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
// If the resize handle that is currently unmounting is intersecting with the pointer,
|
|
476
|
-
// update the global pointer to account for the change
|
|
477
|
-
if (intersectingHandles.includes(data)) {
|
|
478
|
-
const index = intersectingHandles.indexOf(data);
|
|
479
|
-
if (index >= 0) {
|
|
480
|
-
intersectingHandles.splice(index, 1);
|
|
254
|
+
for (const i of t) {
|
|
255
|
+
const a = je(n, i.rect);
|
|
256
|
+
switch (e) {
|
|
257
|
+
case "horizontal": {
|
|
258
|
+
a.x <= s.x && (o = i, s = a);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
case "vertical": {
|
|
262
|
+
a.y <= s.y && (o = i, s = a);
|
|
263
|
+
break;
|
|
481
264
|
}
|
|
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);
|
|
487
|
-
}
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
function handlePointerDown(event) {
|
|
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();
|
|
513
265
|
}
|
|
514
266
|
}
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
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
|
|
267
|
+
return o ? {
|
|
268
|
+
distance: s,
|
|
269
|
+
hitRegion: o
|
|
270
|
+
} : void 0;
|
|
271
|
+
}
|
|
272
|
+
let W;
|
|
273
|
+
function Ue() {
|
|
274
|
+
return W === void 0 && (typeof matchMedia == "function" ? W = !!matchMedia("(pointer:coarse)").matches : W = !1), W;
|
|
275
|
+
}
|
|
276
|
+
function ye(e, t) {
|
|
277
|
+
const n = [];
|
|
278
|
+
return t.forEach((o, s) => {
|
|
279
|
+
if (s.disabled)
|
|
280
|
+
return;
|
|
281
|
+
const i = Ue() ? le.coarse : le.precise, a = He(s), r = We(s.orientation, a, {
|
|
282
|
+
x: e.clientX,
|
|
283
|
+
y: e.clientY
|
|
542
284
|
});
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
// Update cursor based on return value(s) from active handles
|
|
547
|
-
updateCursor();
|
|
548
|
-
if (intersectingHandles.length > 0) {
|
|
549
|
-
event.preventDefault();
|
|
550
|
-
}
|
|
285
|
+
r && r.distance.x <= i && r.distance.y <= i && n.push(r.hitRegion);
|
|
286
|
+
}), n;
|
|
551
287
|
}
|
|
552
|
-
function
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
} =
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
updateResizeHandlerStates("up", event);
|
|
569
|
-
recalculateIntersectingHandles({
|
|
570
|
-
target,
|
|
571
|
-
x,
|
|
572
|
-
y
|
|
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;
|
|
288
|
+
function ce(e) {
|
|
289
|
+
if (e.defaultPrevented)
|
|
290
|
+
return;
|
|
291
|
+
const { mountedGroups: t } = O(), n = ye(e, t), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
292
|
+
n.forEach((r) => {
|
|
293
|
+
o.add(r.group), r.panels.forEach((c) => {
|
|
294
|
+
s.add(c);
|
|
295
|
+
}), r.separator && i.add(r.separator);
|
|
296
|
+
const l = t.get(r.group);
|
|
297
|
+
l && a.set(r.group, l.layout);
|
|
298
|
+
}), G({
|
|
299
|
+
interactionState: {
|
|
300
|
+
hitRegions: n,
|
|
301
|
+
initialLayoutMap: a,
|
|
302
|
+
pointerDownAtPoint: { x: e.clientX, y: e.clientY },
|
|
303
|
+
state: "active"
|
|
582
304
|
}
|
|
583
|
-
|
|
584
|
-
}
|
|
585
|
-
return false;
|
|
305
|
+
}), n.length && e.preventDefault();
|
|
586
306
|
}
|
|
587
|
-
function
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
307
|
+
function Be({
|
|
308
|
+
cursorFlags: e,
|
|
309
|
+
groups: t,
|
|
310
|
+
state: n
|
|
591
311
|
}) {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
top
|
|
608
|
-
} = dragHandleRect;
|
|
609
|
-
const margin = isCoarsePointer ? hitAreaMargins.coarse : hitAreaMargins.fine;
|
|
610
|
-
const eventIntersects = x >= left - margin && x <= right + margin && y >= top - margin && y <= bottom + margin;
|
|
611
|
-
if (eventIntersects) {
|
|
612
|
-
// TRICKY
|
|
613
|
-
// We listen for pointers events at the root in order to support hit area margins
|
|
614
|
-
// (determining when the pointer is close enough to an element to be considered a "hit")
|
|
615
|
-
// Clicking on an element "above" a handle (e.g. a modal) should prevent a hit though
|
|
616
|
-
// so at this point we need to compare stacking order of a potentially intersecting drag handle,
|
|
617
|
-
// and the element that was actually clicked/touched
|
|
618
|
-
if (targetElement !== null && document.contains(targetElement) && dragHandleElement !== targetElement && !dragHandleElement.contains(targetElement) && !targetElement.contains(dragHandleElement) &&
|
|
619
|
-
// Calculating stacking order has a cost, so we should avoid it if possible
|
|
620
|
-
// That is why we only check potentially intersecting handles,
|
|
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;
|
|
312
|
+
let o = 0, s = 0;
|
|
313
|
+
switch (n) {
|
|
314
|
+
case "active":
|
|
315
|
+
case "hover":
|
|
316
|
+
t.forEach((i) => {
|
|
317
|
+
if (!i.disableCursor)
|
|
318
|
+
switch (i.orientation) {
|
|
319
|
+
case "horizontal": {
|
|
320
|
+
o++;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
case "vertical": {
|
|
324
|
+
s++;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
637
327
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
if (o === 0 && s === 0)
|
|
331
|
+
return null;
|
|
332
|
+
switch (n) {
|
|
333
|
+
case "active": {
|
|
334
|
+
const i = (e & he) !== 0, a = (e & me) !== 0, r = (e & ve) !== 0, l = (e & ge) !== 0;
|
|
335
|
+
if (e) {
|
|
336
|
+
if (i)
|
|
337
|
+
return r ? "se-resize" : l ? "ne-resize" : "e-resize";
|
|
338
|
+
if (a)
|
|
339
|
+
return r ? "sw-resize" : l ? "nw-resize" : "w-resize";
|
|
340
|
+
if (r)
|
|
341
|
+
return "s-resize";
|
|
342
|
+
if (l)
|
|
343
|
+
return "n-resize";
|
|
643
344
|
}
|
|
644
|
-
|
|
345
|
+
break;
|
|
645
346
|
}
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
function reportConstraintsViolation(resizeHandleId, flag) {
|
|
649
|
-
panelConstraintFlags.set(resizeHandleId, flag);
|
|
650
|
-
}
|
|
651
|
-
function updateCursor() {
|
|
652
|
-
let intersectsHorizontal = false;
|
|
653
|
-
let intersectsVertical = false;
|
|
654
|
-
intersectingHandles.forEach(data => {
|
|
655
|
-
const {
|
|
656
|
-
direction
|
|
657
|
-
} = data;
|
|
658
|
-
if (direction === "horizontal") {
|
|
659
|
-
intersectsHorizontal = true;
|
|
660
|
-
} else {
|
|
661
|
-
intersectsVertical = true;
|
|
662
|
-
}
|
|
663
|
-
});
|
|
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
347
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
if (isPointerDown) {
|
|
691
|
-
if (intersectingHandles.length > 0) {
|
|
692
|
-
ownerDocumentCounts.forEach((count, ownerDocument) => {
|
|
693
|
-
const {
|
|
694
|
-
body
|
|
695
|
-
} = ownerDocument;
|
|
696
|
-
if (count > 0) {
|
|
697
|
-
body.addEventListener("contextmenu", handlePointerUp, options);
|
|
698
|
-
body.addEventListener("pointerleave", handlePointerMove, options);
|
|
699
|
-
body.addEventListener("pointermove", handlePointerMove, options);
|
|
700
|
-
}
|
|
348
|
+
return o > 0 && s > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
349
|
+
}
|
|
350
|
+
let K = null, P;
|
|
351
|
+
function Y() {
|
|
352
|
+
P === void 0 && (P = new CSSStyleSheet(), document.adoptedStyleSheets = [P]);
|
|
353
|
+
const { cursorFlags: e, interactionState: t } = O();
|
|
354
|
+
switch (t.state) {
|
|
355
|
+
case "active":
|
|
356
|
+
case "hover": {
|
|
357
|
+
const n = Be({
|
|
358
|
+
cursorFlags: e,
|
|
359
|
+
groups: t.hitRegions.map((o) => o.group),
|
|
360
|
+
state: t.state
|
|
701
361
|
});
|
|
362
|
+
if (K === n)
|
|
363
|
+
return;
|
|
364
|
+
K = n, n ? P.cssRules.length === 0 ? P.insertRule(`*{cursor: ${n} !important;}`) : P.replaceSync(`*{cursor: ${n} !important;}`) : P.cssRules.length === 1 && P.deleteRule(0);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
case "inactive": {
|
|
368
|
+
K = null, P.cssRules.length === 1 && P.deleteRule(0);
|
|
369
|
+
break;
|
|
702
370
|
}
|
|
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);
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
function updateResizeHandlerStates(action, event) {
|
|
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);
|
|
741
371
|
}
|
|
742
372
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
return 0;
|
|
747
|
-
} else {
|
|
748
|
-
return actual > expected ? 1 : -1;
|
|
749
|
-
}
|
|
373
|
+
function C(e, t = "Assertion error") {
|
|
374
|
+
if (!e)
|
|
375
|
+
throw console.error(t), Error(t);
|
|
750
376
|
}
|
|
751
|
-
function
|
|
752
|
-
|
|
377
|
+
function Ve(e, t) {
|
|
378
|
+
if (e.length !== t.length)
|
|
379
|
+
return !1;
|
|
380
|
+
for (let n = 0; n < e.length; n++)
|
|
381
|
+
if (e[n] != t[n])
|
|
382
|
+
return !1;
|
|
383
|
+
return !0;
|
|
753
384
|
}
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
return fuzzyCompareNumbers(actual, expected, fractionDigits) === 0;
|
|
385
|
+
function w(e, t, n = 0) {
|
|
386
|
+
return Math.abs(L(e) - L(t)) <= n;
|
|
757
387
|
}
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
if (actual.length !== expected.length) {
|
|
761
|
-
return false;
|
|
762
|
-
}
|
|
763
|
-
for (let index = 0; index < actual.length; index++) {
|
|
764
|
-
const actualSize = actual[index];
|
|
765
|
-
const expectedSize = expected[index];
|
|
766
|
-
if (!fuzzyNumbersEqual(actualSize, expectedSize, fractionDigits)) {
|
|
767
|
-
return false;
|
|
768
|
-
}
|
|
769
|
-
}
|
|
770
|
-
return true;
|
|
388
|
+
function Z(e, t) {
|
|
389
|
+
return w(e, t) ? 0 : e > t ? 1 : -1;
|
|
771
390
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
panelConstraints: panelConstraintsArray,
|
|
776
|
-
panelIndex,
|
|
777
|
-
size
|
|
391
|
+
function D({
|
|
392
|
+
panelConstraints: e,
|
|
393
|
+
size: t
|
|
778
394
|
}) {
|
|
779
|
-
const
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
size = Math.min(maxSize, size);
|
|
801
|
-
size = parseFloat(size.toFixed(PRECISION));
|
|
802
|
-
return size;
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
// All units must be in percentages; pixel values should be pre-converted
|
|
806
|
-
function adjustLayoutByDelta({
|
|
807
|
-
delta,
|
|
808
|
-
initialLayout,
|
|
809
|
-
panelConstraints: panelConstraintsArray,
|
|
810
|
-
pivotIndices,
|
|
811
|
-
prevLayout,
|
|
812
|
-
trigger
|
|
395
|
+
const {
|
|
396
|
+
collapsedSize: n = 0,
|
|
397
|
+
collapsible: o,
|
|
398
|
+
maxSize: s = 100,
|
|
399
|
+
minSize: i = 0
|
|
400
|
+
} = e;
|
|
401
|
+
if (Z(t, i) < 0)
|
|
402
|
+
if (o) {
|
|
403
|
+
const a = (n + i) / 2;
|
|
404
|
+
Z(t, a) < 0 ? t = n : t = i;
|
|
405
|
+
} else
|
|
406
|
+
t = i;
|
|
407
|
+
return t = Math.min(s, t), t = L(t), t;
|
|
408
|
+
}
|
|
409
|
+
function Ke({
|
|
410
|
+
delta: e,
|
|
411
|
+
initialLayout: t,
|
|
412
|
+
panelConstraints: n,
|
|
413
|
+
pivotIndices: o,
|
|
414
|
+
prevLayout: s,
|
|
415
|
+
trigger: i
|
|
813
416
|
}) {
|
|
814
|
-
if (
|
|
815
|
-
return
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
assert(firstPivotIndex != null, "Invalid first pivot index");
|
|
820
|
-
assert(secondPivotIndex != null, "Invalid second pivot index");
|
|
821
|
-
let deltaApplied = 0;
|
|
822
|
-
|
|
823
|
-
// const DEBUG = [];
|
|
824
|
-
// DEBUG.push(`adjustLayoutByDelta()`);
|
|
825
|
-
// DEBUG.push(` initialLayout: ${initialLayout.join(", ")}`);
|
|
826
|
-
// DEBUG.push(` prevLayout: ${prevLayout.join(", ")}`);
|
|
827
|
-
// DEBUG.push(` delta: ${delta}`);
|
|
828
|
-
// DEBUG.push(` pivotIndices: ${pivotIndices.join(", ")}`);
|
|
829
|
-
// DEBUG.push(` trigger: ${trigger}`);
|
|
830
|
-
// DEBUG.push("");
|
|
831
|
-
|
|
832
|
-
// A resizing panel affects the panels before or after it.
|
|
833
|
-
//
|
|
834
|
-
// A negative delta means the panel(s) immediately after the resize handle should grow/expand by decreasing its offset.
|
|
835
|
-
// Other panels may also need to shrink/contract (and shift) to make room, depending on the min weights.
|
|
836
|
-
//
|
|
837
|
-
// A positive delta means the panel(s) immediately before the resize handle should "expand".
|
|
838
|
-
// This is accomplished by shrinking/contracting (and shifting) one or more of the panels after the resize handle.
|
|
839
|
-
|
|
840
|
-
{
|
|
841
|
-
// If this is a resize triggered by a keyboard event, our logic for expanding/collapsing is different.
|
|
842
|
-
// We no longer check the halfway threshold because this may prevent the panel from expanding at all.
|
|
843
|
-
if (trigger === "keyboard") {
|
|
844
|
-
{
|
|
845
|
-
// Check if we should expand a collapsed panel
|
|
846
|
-
const index = delta < 0 ? secondPivotIndex : firstPivotIndex;
|
|
847
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
848
|
-
assert(panelConstraints, `Panel constraints not found for index ${index}`);
|
|
849
|
-
const {
|
|
850
|
-
collapsedSize = 0,
|
|
851
|
-
collapsible,
|
|
852
|
-
minSize = 0
|
|
853
|
-
} = panelConstraints;
|
|
854
|
-
|
|
855
|
-
// DEBUG.push(`edge case check 1: ${index}`);
|
|
856
|
-
// DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
857
|
-
if (collapsible) {
|
|
858
|
-
const prevSize = initialLayout[index];
|
|
859
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
860
|
-
if (fuzzyNumbersEqual(prevSize, collapsedSize)) {
|
|
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
|
-
}
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
{
|
|
873
|
-
// Check if we should collapse a panel at its minimum size
|
|
874
|
-
const index = delta < 0 ? firstPivotIndex : secondPivotIndex;
|
|
875
|
-
const panelConstraints = panelConstraintsArray[index];
|
|
876
|
-
assert(panelConstraints, `No panel constraints found for index ${index}`);
|
|
877
|
-
const {
|
|
878
|
-
collapsedSize = 0,
|
|
879
|
-
collapsible,
|
|
880
|
-
minSize = 0
|
|
881
|
-
} = panelConstraints;
|
|
882
|
-
|
|
883
|
-
// DEBUG.push(`edge case check 2: ${index}`);
|
|
884
|
-
// DEBUG.push(` -> collapsible? ${collapsible}`);
|
|
885
|
-
if (collapsible) {
|
|
886
|
-
const prevSize = initialLayout[index];
|
|
887
|
-
assert(prevSize != null, `Previous layout not found for panel index ${index}`);
|
|
888
|
-
if (fuzzyNumbersEqual(prevSize, minSize)) {
|
|
889
|
-
const localDelta = prevSize - collapsedSize;
|
|
890
|
-
// DEBUG.push(` -> expand delta: ${localDelta}`);
|
|
891
|
-
|
|
892
|
-
if (fuzzyCompareNumbers(localDelta, Math.abs(delta)) > 0) {
|
|
893
|
-
delta = delta < 0 ? 0 - localDelta : localDelta;
|
|
894
|
-
// DEBUG.push(` -> delta: ${delta}`);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
// DEBUG.push("");
|
|
901
|
-
}
|
|
902
|
-
|
|
417
|
+
if (w(e, 0))
|
|
418
|
+
return t;
|
|
419
|
+
const a = Object.values(t), r = Object.values(s), l = [...a], [c, u] = o;
|
|
420
|
+
C(c != null, "Invalid first pivot index"), C(u != null, "Invalid second pivot index");
|
|
421
|
+
let d = 0;
|
|
903
422
|
{
|
|
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,
|
|
423
|
+
const h = e < 0 ? 1 : -1;
|
|
424
|
+
let f = e < 0 ? u : c, v = 0;
|
|
425
|
+
for (; ; ) {
|
|
426
|
+
const x = a[f];
|
|
427
|
+
C(
|
|
428
|
+
x != null,
|
|
429
|
+
`Previous layout not found for panel index ${f}`
|
|
430
|
+
);
|
|
431
|
+
const S = D({
|
|
432
|
+
panelConstraints: n[f],
|
|
921
433
|
size: 100
|
|
922
|
-
});
|
|
923
|
-
|
|
924
|
-
// DEBUG.push(` ${index}: ${prevSize} -> ${maxSafeSize}`);
|
|
925
|
-
|
|
926
|
-
maxAvailableDelta += delta;
|
|
927
|
-
index += increment;
|
|
928
|
-
if (index < 0 || index >= panelConstraintsArray.length) {
|
|
434
|
+
}) - x;
|
|
435
|
+
if (v += S, f += h, f < 0 || f >= n.length)
|
|
929
436
|
break;
|
|
930
|
-
}
|
|
931
437
|
}
|
|
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("");
|
|
438
|
+
const g = Math.min(Math.abs(e), Math.abs(v));
|
|
439
|
+
e = e < 0 ? 0 - g : g;
|
|
938
440
|
}
|
|
939
|
-
|
|
940
441
|
{
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
panelConstraints: panelConstraintsArray,
|
|
952
|
-
panelIndex: index,
|
|
953
|
-
size: unsafeSize
|
|
442
|
+
let f = e < 0 ? c : u;
|
|
443
|
+
for (; f >= 0 && f < n.length; ) {
|
|
444
|
+
const v = Math.abs(e) - Math.abs(d), g = a[f];
|
|
445
|
+
C(
|
|
446
|
+
g != null,
|
|
447
|
+
`Previous layout not found for panel index ${f}`
|
|
448
|
+
);
|
|
449
|
+
const x = g - v, z = D({
|
|
450
|
+
panelConstraints: n[f],
|
|
451
|
+
size: x
|
|
954
452
|
});
|
|
955
|
-
if (!
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
}) >= 0) {
|
|
961
|
-
break;
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
if (delta < 0) {
|
|
965
|
-
index--;
|
|
966
|
-
} else {
|
|
967
|
-
index++;
|
|
968
|
-
}
|
|
453
|
+
if (!w(g, z) && (d += g - z, l[f] = z, d.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
454
|
+
numeric: !0
|
|
455
|
+
}) >= 0))
|
|
456
|
+
break;
|
|
457
|
+
e < 0 ? f-- : f++;
|
|
969
458
|
}
|
|
970
459
|
}
|
|
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
|
-
}
|
|
460
|
+
if (Ve(r, l))
|
|
461
|
+
return s;
|
|
983
462
|
{
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
const
|
|
990
|
-
panelConstraints:
|
|
991
|
-
|
|
992
|
-
size: unsafeSize
|
|
463
|
+
const h = e < 0 ? u : c, f = a[h];
|
|
464
|
+
C(
|
|
465
|
+
f != null,
|
|
466
|
+
`Previous layout not found for panel index ${h}`
|
|
467
|
+
);
|
|
468
|
+
const v = f + d, g = D({
|
|
469
|
+
panelConstraints: n[h],
|
|
470
|
+
size: v
|
|
993
471
|
});
|
|
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
|
|
472
|
+
if (l[h] = g, !w(g, v)) {
|
|
473
|
+
let x = v - g, S = e < 0 ? u : c;
|
|
474
|
+
for (; S >= 0 && S < n.length; ) {
|
|
475
|
+
const R = l[S];
|
|
476
|
+
C(
|
|
477
|
+
R != null,
|
|
478
|
+
`Previous layout not found for panel index ${S}`
|
|
479
|
+
);
|
|
480
|
+
const k = R + x, A = D({
|
|
481
|
+
panelConstraints: n[S],
|
|
482
|
+
size: k
|
|
1011
483
|
});
|
|
1012
|
-
if (
|
|
1013
|
-
deltaRemaining -= safeSize - prevSize;
|
|
1014
|
-
nextLayout[index] = safeSize;
|
|
1015
|
-
}
|
|
1016
|
-
if (fuzzyNumbersEqual(deltaRemaining, 0)) {
|
|
484
|
+
if (w(R, A) || (x -= A - R, l[S] = A), w(x, 0))
|
|
1017
485
|
break;
|
|
1018
|
-
|
|
1019
|
-
if (delta > 0) {
|
|
1020
|
-
index--;
|
|
1021
|
-
} else {
|
|
1022
|
-
index++;
|
|
1023
|
-
}
|
|
486
|
+
e > 0 ? S-- : S++;
|
|
1024
487
|
}
|
|
1025
488
|
}
|
|
1026
489
|
}
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
} = panelData;
|
|
1064
|
-
const {
|
|
1065
|
-
maxSize = 100,
|
|
1066
|
-
minSize = 0
|
|
1067
|
-
} = constraints;
|
|
1068
|
-
if (index === firstIndex) {
|
|
1069
|
-
currentMinSize = minSize;
|
|
1070
|
-
currentMaxSize = maxSize;
|
|
1071
|
-
} else {
|
|
1072
|
-
totalMinSize += minSize;
|
|
1073
|
-
totalMaxSize += maxSize;
|
|
1074
|
-
}
|
|
1075
|
-
});
|
|
1076
|
-
const valueMax = Math.min(currentMaxSize, 100 - totalMinSize);
|
|
1077
|
-
const valueMin = Math.max(currentMinSize, 100 - totalMaxSize);
|
|
1078
|
-
const valueNow = layout[firstIndex];
|
|
1079
|
-
return {
|
|
1080
|
-
valueMax,
|
|
1081
|
-
valueMin,
|
|
1082
|
-
valueNow
|
|
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;
|
|
1128
|
-
}
|
|
1129
|
-
return null;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
function getResizeHandlePanelIds(groupId, handleId, panelsArray, scope = document) {
|
|
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
|
|
1152
|
-
}) {
|
|
1153
|
-
useRef({
|
|
1154
|
-
didWarnAboutMissingResizeHandle: false
|
|
1155
|
-
});
|
|
1156
|
-
useIsomorphicLayoutEffect(() => {
|
|
1157
|
-
if (!panelGroupElement) {
|
|
1158
|
-
return;
|
|
1159
|
-
}
|
|
1160
|
-
const resizeHandleElements = getResizeHandleElementsForGroup(groupId, panelGroupElement);
|
|
1161
|
-
for (let index = 0; index < panelDataArray.length - 1; index++) {
|
|
1162
|
-
const {
|
|
1163
|
-
valueMax,
|
|
1164
|
-
valueMin,
|
|
1165
|
-
valueNow
|
|
1166
|
-
} = calculateAriaValues({
|
|
1167
|
-
layout,
|
|
1168
|
-
panelsArray: panelDataArray,
|
|
1169
|
-
pivotIndices: [index, index + 1]
|
|
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");
|
|
1187
|
-
});
|
|
1188
|
-
};
|
|
1189
|
-
}, [groupId, layout, panelDataArray, panelGroupElement]);
|
|
1190
|
-
useEffect(() => {
|
|
1191
|
-
if (!panelGroupElement) {
|
|
1192
|
-
return;
|
|
1193
|
-
}
|
|
1194
|
-
const eagerValues = eagerValuesRef.current;
|
|
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 () => {};
|
|
490
|
+
const p = Object.values(l).reduce(
|
|
491
|
+
(h, f) => f + h,
|
|
492
|
+
0
|
|
493
|
+
);
|
|
494
|
+
if (!w(p, 100, 0.1))
|
|
495
|
+
return s;
|
|
496
|
+
const m = Object.keys(s);
|
|
497
|
+
return l.reduce((h, f, v) => (h[m[v]] = f, h), {});
|
|
498
|
+
}
|
|
499
|
+
function ee(e, t) {
|
|
500
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
501
|
+
return !1;
|
|
502
|
+
for (const n in e)
|
|
503
|
+
if (Z(e[n], t[n]) !== 0)
|
|
504
|
+
return !1;
|
|
505
|
+
return !0;
|
|
506
|
+
}
|
|
507
|
+
function U(e) {
|
|
508
|
+
if (e.defaultPrevented)
|
|
509
|
+
return;
|
|
510
|
+
const { interactionState: t, mountedGroups: n } = O();
|
|
511
|
+
switch (t.state) {
|
|
512
|
+
case "active": {
|
|
513
|
+
if (
|
|
514
|
+
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
515
|
+
e.type !== "pointerleave" && e.buttons === 0
|
|
516
|
+
) {
|
|
517
|
+
G(
|
|
518
|
+
(i) => i.interactionState.state === "inactive" ? i : {
|
|
519
|
+
cursorFlags: 0,
|
|
520
|
+
interactionState: {
|
|
521
|
+
state: "inactive"
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
);
|
|
525
|
+
return;
|
|
1209
526
|
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
setLayout(nextLayout);
|
|
1239
|
-
}
|
|
527
|
+
let o = 0;
|
|
528
|
+
const s = new Map(n);
|
|
529
|
+
t.hitRegions.forEach((i) => {
|
|
530
|
+
const { disableCursor: a, element: r, orientation: l, panels: c } = i.group;
|
|
531
|
+
let u = 0;
|
|
532
|
+
t.state === "active" && (l === "horizontal" ? u = (e.clientX - t.pointerDownAtPoint.x) / r.offsetWidth * 100 : u = (e.clientY - t.pointerDownAtPoint.y) / r.offsetHeight * 100);
|
|
533
|
+
const d = t.initialLayoutMap.get(
|
|
534
|
+
i.group
|
|
535
|
+
), { derivedPanelConstraints: p, layout: m } = n.get(i.group) ?? {};
|
|
536
|
+
if (p && d && m) {
|
|
537
|
+
const h = Ke({
|
|
538
|
+
delta: u,
|
|
539
|
+
initialLayout: d,
|
|
540
|
+
panelConstraints: p,
|
|
541
|
+
pivotIndices: i.panels.map((f) => c.indexOf(f)),
|
|
542
|
+
prevLayout: m,
|
|
543
|
+
trigger: "mouse-or-touch"
|
|
544
|
+
});
|
|
545
|
+
if (ee(h, m)) {
|
|
546
|
+
if (u !== 0 && !a)
|
|
547
|
+
switch (l) {
|
|
548
|
+
case "horizontal": {
|
|
549
|
+
o |= u < 0 ? he : me;
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
case "vertical": {
|
|
553
|
+
o |= u < 0 ? ve : ge;
|
|
554
|
+
break;
|
|
1240
555
|
}
|
|
1241
556
|
}
|
|
1242
|
-
|
|
1243
|
-
|
|
557
|
+
} else {
|
|
558
|
+
s.set(i.group, {
|
|
559
|
+
derivedPanelConstraints: p,
|
|
560
|
+
layout: h
|
|
561
|
+
});
|
|
562
|
+
const f = i.group.panels.map(({ id: v }) => v).join(",");
|
|
563
|
+
i.group.inMemoryLayouts[f] = h;
|
|
564
|
+
}
|
|
1244
565
|
}
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
});
|
|
1251
|
-
return () => {
|
|
1252
|
-
cleanupFunctions.forEach(cleanupFunction => cleanupFunction());
|
|
1253
|
-
};
|
|
1254
|
-
}, [panelGroupElement, committedValuesRef, eagerValuesRef, groupId, layout, panelDataArray, setLayout]);
|
|
1255
|
-
}
|
|
1256
|
-
|
|
1257
|
-
function areEqual(arrayA, arrayB) {
|
|
1258
|
-
if (arrayA.length !== arrayB.length) {
|
|
1259
|
-
return false;
|
|
1260
|
-
}
|
|
1261
|
-
for (let index = 0; index < arrayA.length; index++) {
|
|
1262
|
-
if (arrayA[index] !== arrayB[index]) {
|
|
1263
|
-
return false;
|
|
566
|
+
}), G({
|
|
567
|
+
cursorFlags: o,
|
|
568
|
+
mountedGroups: s
|
|
569
|
+
}), Y();
|
|
570
|
+
break;
|
|
1264
571
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
y
|
|
1274
|
-
} = getResizeEventCoordinates(event);
|
|
1275
|
-
return isHorizontal ? x : y;
|
|
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;
|
|
1316
|
-
break;
|
|
1317
|
-
case "ArrowRight":
|
|
1318
|
-
movement = isHorizontal ? delta : 0;
|
|
1319
|
-
break;
|
|
1320
|
-
case "ArrowUp":
|
|
1321
|
-
movement = isHorizontal ? 0 : -delta;
|
|
1322
|
-
break;
|
|
1323
|
-
case "End":
|
|
1324
|
-
movement = 100;
|
|
1325
|
-
break;
|
|
1326
|
-
case "Home":
|
|
1327
|
-
movement = -100;
|
|
1328
|
-
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
|
-
}
|
|
1405
|
-
if (collapsible && (onCollapse || onExpand)) {
|
|
1406
|
-
if (onExpand && (lastNotifiedSize == null || fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && !fuzzyNumbersEqual$1(size, collapsedSize)) {
|
|
1407
|
-
onExpand();
|
|
1408
|
-
}
|
|
1409
|
-
if (onCollapse && (lastNotifiedSize == null || !fuzzyNumbersEqual$1(lastNotifiedSize, collapsedSize)) && fuzzyNumbersEqual$1(size, collapsedSize)) {
|
|
1410
|
-
onCollapse();
|
|
572
|
+
default: {
|
|
573
|
+
const o = ye(e, n);
|
|
574
|
+
o.length === 0 ? t.state !== "inactive" && G({
|
|
575
|
+
interactionState: { state: "inactive" }
|
|
576
|
+
}) : G({
|
|
577
|
+
interactionState: {
|
|
578
|
+
hitRegions: o,
|
|
579
|
+
state: "hover"
|
|
1411
580
|
}
|
|
1412
|
-
}
|
|
1413
|
-
|
|
1414
|
-
});
|
|
1415
|
-
}
|
|
1416
|
-
|
|
1417
|
-
function compareLayouts(a, b) {
|
|
1418
|
-
if (a.length !== b.length) {
|
|
1419
|
-
return false;
|
|
1420
|
-
} else {
|
|
1421
|
-
for (let index = 0; index < a.length; index++) {
|
|
1422
|
-
if (a[index] != b[index]) {
|
|
1423
|
-
return false;
|
|
1424
|
-
}
|
|
581
|
+
}), Y();
|
|
582
|
+
break;
|
|
1425
583
|
}
|
|
1426
584
|
}
|
|
1427
|
-
return true;
|
|
1428
585
|
}
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
}
|
|
1441
|
-
|
|
1442
|
-
let flexGrow;
|
|
1443
|
-
if (size == null) {
|
|
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);
|
|
586
|
+
function ue(e) {
|
|
587
|
+
if (e.defaultPrevented)
|
|
588
|
+
return;
|
|
589
|
+
e.preventDefault();
|
|
590
|
+
const { interactionState: t } = O();
|
|
591
|
+
switch (t.state) {
|
|
592
|
+
case "active":
|
|
593
|
+
G({
|
|
594
|
+
cursorFlags: 0,
|
|
595
|
+
interactionState: {
|
|
596
|
+
state: "inactive"
|
|
597
|
+
}
|
|
598
|
+
}), Y();
|
|
1452
599
|
}
|
|
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
|
|
1462
|
-
};
|
|
1463
600
|
}
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
if (
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
// or on a browser with cookies/storage disabled.
|
|
1480
|
-
// In either case, this function avoids accessing localStorage until needed,
|
|
1481
|
-
// and avoids throwing user-visible errors.
|
|
1482
|
-
function initializeDefaultStorage(storageObject) {
|
|
1483
|
-
try {
|
|
1484
|
-
if (typeof localStorage !== "undefined") {
|
|
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");
|
|
1494
|
-
}
|
|
1495
|
-
} catch (error) {
|
|
1496
|
-
console.error(error);
|
|
1497
|
-
storageObject.getItem = () => null;
|
|
1498
|
-
storageObject.setItem = () => {};
|
|
601
|
+
function Xe(e) {
|
|
602
|
+
let t = 0, n = 0;
|
|
603
|
+
const o = {};
|
|
604
|
+
for (const i of e)
|
|
605
|
+
if (i.defaultSize !== void 0) {
|
|
606
|
+
t++;
|
|
607
|
+
const a = L(i.defaultSize);
|
|
608
|
+
n += a, o[i.panelId] = a;
|
|
609
|
+
} else
|
|
610
|
+
o[i.panelId] = void 0;
|
|
611
|
+
const s = e.length - t;
|
|
612
|
+
if (s !== 0) {
|
|
613
|
+
const i = L((100 - n) / s);
|
|
614
|
+
for (const a of e)
|
|
615
|
+
a.defaultSize === void 0 && (o[a.panelId] = i);
|
|
1499
616
|
}
|
|
617
|
+
return o;
|
|
1500
618
|
}
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
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) {}
|
|
1536
|
-
return null;
|
|
1537
|
-
}
|
|
1538
|
-
function loadPanelGroupState(autoSaveId, panels, storage) {
|
|
1539
|
-
var _loadSerializedPanelG, _state$panelKey;
|
|
1540
|
-
const state = (_loadSerializedPanelG = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG !== void 0 ? _loadSerializedPanelG : {};
|
|
1541
|
-
const panelKey = getPanelKey(panels);
|
|
1542
|
-
return (_state$panelKey = state[panelKey]) !== null && _state$panelKey !== void 0 ? _state$panelKey : null;
|
|
1543
|
-
}
|
|
1544
|
-
function savePanelGroupState(autoSaveId, panels, panelSizesBeforeCollapse, sizes, storage) {
|
|
1545
|
-
var _loadSerializedPanelG2;
|
|
1546
|
-
const panelGroupKey = getPanelGroupKey(autoSaveId);
|
|
1547
|
-
const panelKey = getPanelKey(panels);
|
|
1548
|
-
const state = (_loadSerializedPanelG2 = loadSerializedPanelGroupState(autoSaveId, storage)) !== null && _loadSerializedPanelG2 !== void 0 ? _loadSerializedPanelG2 : {};
|
|
1549
|
-
state[panelKey] = {
|
|
1550
|
-
expandToSizes: Object.fromEntries(panelSizesBeforeCollapse.entries()),
|
|
1551
|
-
layout: sizes
|
|
1552
|
-
};
|
|
1553
|
-
try {
|
|
1554
|
-
storage.setItem(panelGroupKey, JSON.stringify(state));
|
|
1555
|
-
} catch (error) {
|
|
1556
|
-
console.error(error);
|
|
1557
|
-
}
|
|
619
|
+
function Ye(e, t, n) {
|
|
620
|
+
const o = n[0];
|
|
621
|
+
if (!o)
|
|
622
|
+
return;
|
|
623
|
+
const s = e.panels.find((a) => a.element === t);
|
|
624
|
+
if (!s || !s.onResize)
|
|
625
|
+
return;
|
|
626
|
+
const i = Q({ group: e });
|
|
627
|
+
s.onResize(
|
|
628
|
+
{
|
|
629
|
+
asPercentage: L(
|
|
630
|
+
o.inlineSize / i * 100
|
|
631
|
+
),
|
|
632
|
+
inPixels: o.inlineSize
|
|
633
|
+
},
|
|
634
|
+
s.id
|
|
635
|
+
);
|
|
1558
636
|
}
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
layout: prevLayout,
|
|
1563
|
-
panelConstraints
|
|
637
|
+
function q({
|
|
638
|
+
layout: e,
|
|
639
|
+
panelConstraints: t
|
|
1564
640
|
}) {
|
|
1565
|
-
const
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
if (
|
|
1570
|
-
throw Error(
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
const
|
|
1576
|
-
|
|
641
|
+
const o = [...Object.values(e)], s = o.reduce(
|
|
642
|
+
(r, l) => r + l,
|
|
643
|
+
0
|
|
644
|
+
);
|
|
645
|
+
if (o.length !== t.length)
|
|
646
|
+
throw Error(
|
|
647
|
+
`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
|
|
648
|
+
);
|
|
649
|
+
if (!w(s, 100) && o.length > 0)
|
|
650
|
+
for (let r = 0; r < t.length; r++) {
|
|
651
|
+
const l = o[r];
|
|
652
|
+
C(l != null, `No layout data found for index ${r}`);
|
|
653
|
+
const c = 100 / s * l;
|
|
654
|
+
o[r] = c;
|
|
1577
655
|
}
|
|
1578
|
-
|
|
1579
|
-
let
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
const safeSize = resizePanel({
|
|
1586
|
-
panelConstraints,
|
|
1587
|
-
panelIndex: index,
|
|
1588
|
-
size: unsafeSize
|
|
656
|
+
let i = 0;
|
|
657
|
+
for (let r = 0; r < t.length; r++) {
|
|
658
|
+
const l = o[r];
|
|
659
|
+
C(l != null, `No layout data found for index ${r}`);
|
|
660
|
+
const c = D({
|
|
661
|
+
panelConstraints: t[r],
|
|
662
|
+
size: l
|
|
1589
663
|
});
|
|
1590
|
-
|
|
1591
|
-
remainingSize += unsafeSize - safeSize;
|
|
1592
|
-
nextLayout[index] = safeSize;
|
|
1593
|
-
}
|
|
664
|
+
l != c && (i += l - c, o[r] = c);
|
|
1594
665
|
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
const unsafeSize = prevSize + remainingSize;
|
|
1603
|
-
const safeSize = resizePanel({
|
|
1604
|
-
panelConstraints,
|
|
1605
|
-
panelIndex: index,
|
|
1606
|
-
size: unsafeSize
|
|
666
|
+
if (!w(i, 0))
|
|
667
|
+
for (let r = 0; r < t.length; r++) {
|
|
668
|
+
const l = o[r];
|
|
669
|
+
C(l != null, `No layout data found for index ${r}`);
|
|
670
|
+
const c = l + i, u = D({
|
|
671
|
+
panelConstraints: t[r],
|
|
672
|
+
size: c
|
|
1607
673
|
});
|
|
1608
|
-
if (
|
|
1609
|
-
|
|
1610
|
-
nextLayout[index] = safeSize;
|
|
1611
|
-
|
|
1612
|
-
// Once we've used up the remainder, bail
|
|
1613
|
-
if (fuzzyNumbersEqual(remainingSize, 0)) {
|
|
1614
|
-
break;
|
|
1615
|
-
}
|
|
1616
|
-
}
|
|
674
|
+
if (l !== u && (i -= u - l, o[r] = u, w(i, 0)))
|
|
675
|
+
break;
|
|
1617
676
|
}
|
|
1618
|
-
|
|
1619
|
-
return
|
|
1620
|
-
}
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
};
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
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: []
|
|
1674
|
-
});
|
|
1675
|
-
useImperativeHandle(forwardedRef, () => ({
|
|
1676
|
-
getId: () => committedValuesRef.current.id,
|
|
1677
|
-
getLayout: () => {
|
|
1678
|
-
const {
|
|
1679
|
-
layout
|
|
1680
|
-
} = eagerValuesRef.current;
|
|
1681
|
-
return layout;
|
|
1682
|
-
},
|
|
1683
|
-
setLayout: unsafeLayout => {
|
|
1684
|
-
const {
|
|
1685
|
-
onLayout
|
|
1686
|
-
} = committedValuesRef.current;
|
|
1687
|
-
const {
|
|
1688
|
-
layout: prevLayout,
|
|
1689
|
-
panelDataArray
|
|
1690
|
-
} = eagerValuesRef.current;
|
|
1691
|
-
const safeLayout = validatePanelGroupLayout({
|
|
1692
|
-
layout: unsafeLayout,
|
|
1693
|
-
panelConstraints: panelDataArray.map(panelData => panelData.constraints)
|
|
1694
|
-
});
|
|
1695
|
-
if (!areEqual(prevLayout, safeLayout)) {
|
|
1696
|
-
setLayout(safeLayout);
|
|
1697
|
-
eagerValuesRef.current.layout = safeLayout;
|
|
1698
|
-
if (onLayout) {
|
|
1699
|
-
onLayout(safeLayout);
|
|
677
|
+
const a = Object.keys(e);
|
|
678
|
+
return o.reduce((r, l, c) => (r[a[c]] = l, r), {});
|
|
679
|
+
}
|
|
680
|
+
function Ze(e) {
|
|
681
|
+
let t = !1;
|
|
682
|
+
const n = new ResizeObserver((l) => {
|
|
683
|
+
for (const c of l) {
|
|
684
|
+
const { borderBoxSize: u, target: d } = c;
|
|
685
|
+
d === e.element ? t && G((p) => {
|
|
686
|
+
const m = p.mountedGroups.get(e);
|
|
687
|
+
if (m) {
|
|
688
|
+
const h = ae(e), f = m.layout, v = q({
|
|
689
|
+
layout: f,
|
|
690
|
+
panelConstraints: h
|
|
691
|
+
});
|
|
692
|
+
return {
|
|
693
|
+
mountedGroups: new Map(p.mountedGroups).set(e, {
|
|
694
|
+
derivedPanelConstraints: h,
|
|
695
|
+
layout: v
|
|
696
|
+
})
|
|
697
|
+
};
|
|
1700
698
|
}
|
|
1701
|
-
|
|
1702
|
-
}
|
|
699
|
+
return p;
|
|
700
|
+
}) : Ye(e, d, u);
|
|
1703
701
|
}
|
|
1704
|
-
}), []);
|
|
1705
|
-
useIsomorphicLayoutEffect(() => {
|
|
1706
|
-
committedValuesRef.current.autoSaveId = autoSaveId;
|
|
1707
|
-
committedValuesRef.current.direction = direction;
|
|
1708
|
-
committedValuesRef.current.dragState = dragState;
|
|
1709
|
-
committedValuesRef.current.id = groupId;
|
|
1710
|
-
committedValuesRef.current.onLayout = onLayout;
|
|
1711
|
-
committedValuesRef.current.storage = storage;
|
|
1712
|
-
});
|
|
1713
|
-
useWindowSplitterPanelGroupBehavior({
|
|
1714
|
-
committedValuesRef,
|
|
1715
|
-
eagerValuesRef,
|
|
1716
|
-
groupId,
|
|
1717
|
-
layout,
|
|
1718
|
-
panelDataArray: eagerValuesRef.current.panelDataArray,
|
|
1719
|
-
setLayout,
|
|
1720
|
-
panelGroupElement: panelGroupElementRef.current
|
|
1721
702
|
});
|
|
1722
|
-
|
|
1723
|
-
|
|
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;
|
|
1738
|
-
}
|
|
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
|
-
}
|
|
1746
|
-
}, [autoSaveId, layout, storage]);
|
|
1747
|
-
|
|
1748
|
-
// DEV warnings
|
|
1749
|
-
useEffect(() => {
|
|
703
|
+
n.observe(e.element), e.panels.forEach((l) => {
|
|
704
|
+
l.onResize && n.observe(l.element);
|
|
1750
705
|
});
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
const
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
onLayout(nextLayout);
|
|
706
|
+
const o = ae(e), s = e.panels.map(({ id: l }) => l).join(","), i = e.inMemoryLayouts[s] ?? e.defaultLayout ?? Xe(o), a = q({
|
|
707
|
+
layout: i,
|
|
708
|
+
panelConstraints: o
|
|
709
|
+
}), r = G((l) => ({
|
|
710
|
+
mountedGroups: new Map(l.mountedGroups).set(e, {
|
|
711
|
+
derivedPanelConstraints: o,
|
|
712
|
+
layout: a
|
|
713
|
+
})
|
|
714
|
+
}));
|
|
715
|
+
return t = !0, r.mountedGroups.size === 1 && (window.addEventListener("pointerdown", ce), window.addEventListener("pointerleave", U), window.addEventListener("pointermove", U), window.addEventListener("pointerup", ue)), function() {
|
|
716
|
+
const c = G((u) => {
|
|
717
|
+
const d = new Map(u.mountedGroups);
|
|
718
|
+
return d.delete(e), { mountedGroups: d };
|
|
719
|
+
});
|
|
720
|
+
t = !1, c.mountedGroups.size === 0 && (window.removeEventListener("pointerdown", ce), window.removeEventListener("pointerleave", U), window.removeEventListener("pointermove", U), window.removeEventListener("pointerup", ue)), n.disconnect();
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
function te(e) {
|
|
724
|
+
const t = Pe();
|
|
725
|
+
return `${e ?? t}`;
|
|
726
|
+
}
|
|
727
|
+
const _ = typeof window < "u" ? Ee : Ce;
|
|
728
|
+
function ne(e) {
|
|
729
|
+
const t = I(e);
|
|
730
|
+
return _(() => {
|
|
731
|
+
t.current = e;
|
|
732
|
+
}, [e]), fe((n) => t.current?.(n), [t]);
|
|
733
|
+
}
|
|
734
|
+
function oe(...e) {
|
|
735
|
+
return ne((t) => {
|
|
736
|
+
e.forEach((n) => {
|
|
737
|
+
if (n)
|
|
738
|
+
switch (typeof n) {
|
|
739
|
+
case "function": {
|
|
740
|
+
n(t);
|
|
741
|
+
break;
|
|
1788
742
|
}
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
}
|
|
1793
|
-
}, []);
|
|
1794
|
-
|
|
1795
|
-
// External APIs are safe to memoize via committed values ref
|
|
1796
|
-
const expandPanel = useCallback((panelData, minSizeOverride) => {
|
|
1797
|
-
const {
|
|
1798
|
-
onLayout
|
|
1799
|
-
} = committedValuesRef.current;
|
|
1800
|
-
const {
|
|
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);
|
|
743
|
+
case "object": {
|
|
744
|
+
n.current = t;
|
|
745
|
+
break;
|
|
1832
746
|
}
|
|
1833
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
1834
747
|
}
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
}, []);
|
|
1838
|
-
|
|
1839
|
-
// External APIs are safe to memoize via committed values ref
|
|
1840
|
-
const getPanelSize = useCallback(panelData => {
|
|
1841
|
-
const {
|
|
1842
|
-
layout,
|
|
1843
|
-
panelDataArray
|
|
1844
|
-
} = eagerValuesRef.current;
|
|
1845
|
-
const {
|
|
1846
|
-
panelSize
|
|
1847
|
-
} = panelDataHelper(panelDataArray, panelData, layout);
|
|
1848
|
-
assert(panelSize != null, `Panel size not found for panel "${panelData.id}"`);
|
|
1849
|
-
return panelSize;
|
|
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
748
|
});
|
|
1865
|
-
}
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
} =
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
layout
|
|
1886
|
-
|
|
1887
|
-
}
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
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;
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
if (unsafeLayout == null) {
|
|
1944
|
-
unsafeLayout = calculateUnsafeDefaultLayout({
|
|
1945
|
-
panelDataArray
|
|
1946
|
-
});
|
|
1947
|
-
}
|
|
1948
|
-
|
|
1949
|
-
// Validate even saved layouts in case something has changed since last render
|
|
1950
|
-
// e.g. for pixel groups, this could be the size of the window
|
|
1951
|
-
const nextLayout = validatePanelGroupLayout({
|
|
1952
|
-
layout: unsafeLayout,
|
|
1953
|
-
panelConstraints: panelDataArray.map(panelData => panelData.constraints)
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
const Se = "--react-resizable-panels--panel--pointer-events";
|
|
752
|
+
function xe(e, t) {
|
|
753
|
+
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
754
|
+
return `--react-resizable-panels--${n}--${o}`;
|
|
755
|
+
}
|
|
756
|
+
const ze = Me(null);
|
|
757
|
+
function qe({
|
|
758
|
+
groupId: e
|
|
759
|
+
}) {
|
|
760
|
+
const t = () => {
|
|
761
|
+
const { mountedGroups: n } = O();
|
|
762
|
+
for (const [o, { derivedPanelConstraints: s, layout: i }] of n)
|
|
763
|
+
if (o.id === e)
|
|
764
|
+
return { derivedPanelConstraints: s, group: o, layout: i };
|
|
765
|
+
throw Error(`Group ${e} not found`);
|
|
766
|
+
};
|
|
767
|
+
return {
|
|
768
|
+
getLayout() {
|
|
769
|
+
const { layout: n } = t();
|
|
770
|
+
return n;
|
|
771
|
+
},
|
|
772
|
+
setLayout(n) {
|
|
773
|
+
const { derivedPanelConstraints: o, group: s, layout: i } = t(), a = q({
|
|
774
|
+
layout: n,
|
|
775
|
+
panelConstraints: o
|
|
1954
776
|
});
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
callPanelCallbacks(panelDataArray, nextLayout, panelIdToLastNotifiedSizeMapRef.current);
|
|
1962
|
-
}
|
|
777
|
+
return ee(i, a) || G((r) => ({
|
|
778
|
+
mountedGroups: new Map(r.mountedGroups).set(s, {
|
|
779
|
+
derivedPanelConstraints: o,
|
|
780
|
+
layout: a
|
|
781
|
+
})
|
|
782
|
+
})), a;
|
|
1963
783
|
}
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
function Je(e, t) {
|
|
787
|
+
const n = I({
|
|
788
|
+
getLayout: () => ({}),
|
|
789
|
+
setLayout: Te
|
|
1964
790
|
});
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
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
|
-
const
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
} else {
|
|
2033
|
-
reportConstraintsViolation(dragHandleId, delta < 0 ? EXCEEDED_VERTICAL_MIN : EXCEEDED_VERTICAL_MAX);
|
|
791
|
+
de(t, () => n.current, []), _(() => {
|
|
792
|
+
Object.assign(
|
|
793
|
+
n.current,
|
|
794
|
+
qe({ groupId: e })
|
|
795
|
+
);
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
function rt({
|
|
799
|
+
children: e,
|
|
800
|
+
className: t,
|
|
801
|
+
defaultLayout: n,
|
|
802
|
+
disableCursor: o,
|
|
803
|
+
disabled: s,
|
|
804
|
+
elementRef: i,
|
|
805
|
+
groupRef: a,
|
|
806
|
+
id: r,
|
|
807
|
+
onLayoutChange: l,
|
|
808
|
+
orientation: c = "horizontal",
|
|
809
|
+
style: u
|
|
810
|
+
}) {
|
|
811
|
+
const d = I({}), p = ne((y) => {
|
|
812
|
+
ee(d.current, y) || (d.current = y, l?.(y));
|
|
813
|
+
}), m = te(r), [h, f] = M(!1), [v, g] = M(null), x = I({}), [z, S] = M(n ?? {}), [R, k] = M([]), [A, re] = M([]), be = oe(g, i);
|
|
814
|
+
Je(m, a);
|
|
815
|
+
const we = pe(
|
|
816
|
+
() => ({
|
|
817
|
+
id: m,
|
|
818
|
+
orientation: c,
|
|
819
|
+
registerPanel: (y) => (k((b) => X(c, [...b, y])), () => {
|
|
820
|
+
k((b) => b.filter((N) => N !== y));
|
|
821
|
+
}),
|
|
822
|
+
registerSeparator: (y) => (re(
|
|
823
|
+
(b) => X(c, [...b, y])
|
|
824
|
+
), () => {
|
|
825
|
+
re(
|
|
826
|
+
(b) => b.filter((N) => N !== y)
|
|
827
|
+
);
|
|
828
|
+
})
|
|
829
|
+
}),
|
|
830
|
+
[m, c]
|
|
831
|
+
);
|
|
832
|
+
_(() => {
|
|
833
|
+
if (v !== null && R.length > 0) {
|
|
834
|
+
const y = {
|
|
835
|
+
defaultLayout: n,
|
|
836
|
+
disableCursor: !!o,
|
|
837
|
+
disabled: !!s,
|
|
838
|
+
element: v,
|
|
839
|
+
id: m,
|
|
840
|
+
inMemoryLayouts: x.current,
|
|
841
|
+
orientation: c,
|
|
842
|
+
panels: R,
|
|
843
|
+
separators: A
|
|
844
|
+
}, b = Ze(y), B = O().mountedGroups.get(y);
|
|
845
|
+
B && (S(B.layout), p?.(B.layout));
|
|
846
|
+
const Le = T.addListener(
|
|
847
|
+
"interactionStateChange",
|
|
848
|
+
(H) => {
|
|
849
|
+
switch (H.state) {
|
|
850
|
+
case "active":
|
|
851
|
+
case "hover": {
|
|
852
|
+
f(
|
|
853
|
+
H.hitRegions.some(
|
|
854
|
+
($) => $.group === y
|
|
855
|
+
)
|
|
856
|
+
);
|
|
857
|
+
break;
|
|
2034
858
|
}
|
|
2035
|
-
} else {
|
|
2036
|
-
reportConstraintsViolation(dragHandleId, 0);
|
|
2037
859
|
}
|
|
2038
860
|
}
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
onLayout(nextLayout);
|
|
861
|
+
), Re = T.addListener(
|
|
862
|
+
"mountedGroupsChange",
|
|
863
|
+
(H) => {
|
|
864
|
+
const $ = H.get(y);
|
|
865
|
+
$ && $.derivedPanelConstraints.length > 0 && (S($.layout), p?.($.layout));
|
|
2045
866
|
}
|
|
2046
|
-
|
|
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
|
-
});
|
|
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();
|
|
867
|
+
);
|
|
868
|
+
return () => {
|
|
869
|
+
b(), Le(), Re();
|
|
870
|
+
};
|
|
2157
871
|
}
|
|
2158
|
-
}, [
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
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%"
|
|
872
|
+
}, [
|
|
873
|
+
n,
|
|
874
|
+
o,
|
|
875
|
+
s,
|
|
876
|
+
v,
|
|
877
|
+
m,
|
|
878
|
+
p,
|
|
879
|
+
c,
|
|
880
|
+
R,
|
|
881
|
+
A
|
|
882
|
+
]);
|
|
883
|
+
const se = {
|
|
884
|
+
[Se]: h ? "none" : void 0
|
|
2184
885
|
};
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
886
|
+
for (const y in z) {
|
|
887
|
+
const b = xe(m, y), N = z[y];
|
|
888
|
+
se[b] = N;
|
|
889
|
+
}
|
|
890
|
+
return /* @__PURE__ */ F(ze.Provider, { value: we, children: /* @__PURE__ */ F(
|
|
891
|
+
"div",
|
|
892
|
+
{
|
|
893
|
+
"aria-orientation": c,
|
|
894
|
+
className: t,
|
|
895
|
+
"data-group": m,
|
|
896
|
+
ref: be,
|
|
897
|
+
style: {
|
|
898
|
+
...u,
|
|
899
|
+
...se,
|
|
900
|
+
display: "flex",
|
|
901
|
+
flexDirection: c === "horizontal" ? "row" : "column",
|
|
902
|
+
flexWrap: "nowrap"
|
|
903
|
+
},
|
|
904
|
+
children: e
|
|
905
|
+
}
|
|
906
|
+
) });
|
|
2202
907
|
}
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
forwardedRef: ref
|
|
2206
|
-
}));
|
|
2207
|
-
PanelGroupWithForwardedRef.displayName = "PanelGroup";
|
|
2208
|
-
PanelGroup.displayName = "forwardRef(PanelGroup)";
|
|
2209
|
-
function findPanelDataIndex(panelDataArray, panelData) {
|
|
2210
|
-
return panelDataArray.findIndex(prevPanelData => prevPanelData === panelData || prevPanelData.id === panelData.id);
|
|
908
|
+
function J(e) {
|
|
909
|
+
return `react-resizable-panels:${e}`;
|
|
2211
910
|
}
|
|
2212
|
-
function
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
911
|
+
function Qe({
|
|
912
|
+
id: e,
|
|
913
|
+
layout: t,
|
|
914
|
+
storage: n
|
|
915
|
+
}) {
|
|
916
|
+
try {
|
|
917
|
+
const o = J(e);
|
|
918
|
+
n.setItem(o, JSON.stringify(t));
|
|
919
|
+
} catch (o) {
|
|
920
|
+
console.error(o);
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
function st({
|
|
924
|
+
groupId: e,
|
|
925
|
+
storage: t
|
|
926
|
+
}) {
|
|
927
|
+
const n = Ge(
|
|
928
|
+
et,
|
|
929
|
+
() => t.getItem(J(e)),
|
|
930
|
+
() => t.getItem(J(e))
|
|
931
|
+
), o = pe(
|
|
932
|
+
() => n ? JSON.parse(n) : null,
|
|
933
|
+
[n]
|
|
934
|
+
), s = fe(
|
|
935
|
+
(i) => Qe({
|
|
936
|
+
id: e,
|
|
937
|
+
layout: i,
|
|
938
|
+
storage: t
|
|
939
|
+
}),
|
|
940
|
+
[e, t]
|
|
941
|
+
);
|
|
2217
942
|
return {
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
pivotIndices
|
|
943
|
+
defaultLayout: o,
|
|
944
|
+
onLayoutChange: s
|
|
2221
945
|
};
|
|
2222
946
|
}
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
useEffect(() => {
|
|
2233
|
-
if (disabled || resizeHandler == null || panelGroupElement == null) {
|
|
2234
|
-
return;
|
|
2235
|
-
}
|
|
2236
|
-
const handleElement = getResizeHandleElement(handleId, panelGroupElement);
|
|
2237
|
-
if (handleElement == null) {
|
|
2238
|
-
return;
|
|
2239
|
-
}
|
|
2240
|
-
const onKeyDown = event => {
|
|
2241
|
-
if (event.defaultPrevented) {
|
|
2242
|
-
return;
|
|
2243
|
-
}
|
|
2244
|
-
switch (event.key) {
|
|
2245
|
-
case "ArrowDown":
|
|
2246
|
-
case "ArrowLeft":
|
|
2247
|
-
case "ArrowRight":
|
|
2248
|
-
case "ArrowUp":
|
|
2249
|
-
case "End":
|
|
2250
|
-
case "Home":
|
|
2251
|
-
{
|
|
2252
|
-
event.preventDefault();
|
|
2253
|
-
resizeHandler(event);
|
|
2254
|
-
break;
|
|
2255
|
-
}
|
|
2256
|
-
case "F6":
|
|
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();
|
|
2267
|
-
break;
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
};
|
|
2271
|
-
handleElement.addEventListener("keydown", onKeyDown);
|
|
2272
|
-
return () => {
|
|
2273
|
-
handleElement.removeEventListener("keydown", onKeyDown);
|
|
2274
|
-
};
|
|
2275
|
-
}, [panelGroupElement, disabled, handleId, resizeHandler]);
|
|
947
|
+
function et() {
|
|
948
|
+
return function() {
|
|
949
|
+
};
|
|
950
|
+
}
|
|
951
|
+
function at() {
|
|
952
|
+
return M(null);
|
|
953
|
+
}
|
|
954
|
+
function lt() {
|
|
955
|
+
return I(null);
|
|
2276
956
|
}
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
onBlur,
|
|
2285
|
-
onClick,
|
|
2286
|
-
onDragging,
|
|
2287
|
-
onFocus,
|
|
2288
|
-
onPointerDown,
|
|
2289
|
-
onPointerUp,
|
|
2290
|
-
style: styleFromProps = {},
|
|
2291
|
-
tabIndex = 0,
|
|
2292
|
-
tagName: Type = "div",
|
|
2293
|
-
...rest
|
|
957
|
+
function ie() {
|
|
958
|
+
const e = Ie(ze);
|
|
959
|
+
return C(e, "Unexpected"), e;
|
|
960
|
+
}
|
|
961
|
+
function tt({
|
|
962
|
+
groupId: e,
|
|
963
|
+
panelId: t
|
|
2294
964
|
}) {
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
registerResizeHandle: registerResizeHandleWithParentGroup,
|
|
2319
|
-
startDragging,
|
|
2320
|
-
stopDragging,
|
|
2321
|
-
panelGroupElement
|
|
2322
|
-
} = panelGroupContext;
|
|
2323
|
-
const resizeHandleId = useUniqueId(idFromProps);
|
|
2324
|
-
const [state, setState] = useState("inactive");
|
|
2325
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
2326
|
-
const [resizeHandler, setResizeHandler] = useState(null);
|
|
2327
|
-
const committedValuesRef = useRef({
|
|
2328
|
-
state
|
|
2329
|
-
});
|
|
2330
|
-
useIsomorphicLayoutEffect(() => {
|
|
2331
|
-
committedValuesRef.current.state = state;
|
|
2332
|
-
});
|
|
2333
|
-
useEffect(() => {
|
|
2334
|
-
if (disabled) {
|
|
2335
|
-
setResizeHandler(null);
|
|
2336
|
-
} else {
|
|
2337
|
-
const resizeHandler = registerResizeHandleWithParentGroup(resizeHandleId);
|
|
2338
|
-
setResizeHandler(() => resizeHandler);
|
|
2339
|
-
}
|
|
2340
|
-
}, [disabled, resizeHandleId, registerResizeHandleWithParentGroup]);
|
|
2341
|
-
|
|
2342
|
-
// Extract hit area margins before passing them to the effect's dependency array
|
|
2343
|
-
// so that inline object values won't trigger re-renders
|
|
2344
|
-
const coarseHitAreaMargins = (_hitAreaMargins$coars = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.coarse) !== null && _hitAreaMargins$coars !== void 0 ? _hitAreaMargins$coars : 15;
|
|
2345
|
-
const fineHitAreaMargins = (_hitAreaMargins$fine = hitAreaMargins === null || hitAreaMargins === void 0 ? void 0 : hitAreaMargins.fine) !== null && _hitAreaMargins$fine !== void 0 ? _hitAreaMargins$fine : 5;
|
|
2346
|
-
useEffect(() => {
|
|
2347
|
-
if (disabled || resizeHandler == null) {
|
|
2348
|
-
return;
|
|
2349
|
-
}
|
|
2350
|
-
const element = elementRef.current;
|
|
2351
|
-
assert(element, "Element ref not attached");
|
|
2352
|
-
let didMove = false;
|
|
2353
|
-
const setResizeHandlerState = (action, isActive, event) => {
|
|
2354
|
-
if (!isActive) {
|
|
2355
|
-
setState("inactive");
|
|
2356
|
-
return;
|
|
2357
|
-
}
|
|
2358
|
-
switch (action) {
|
|
2359
|
-
case "down":
|
|
2360
|
-
{
|
|
2361
|
-
setState("drag");
|
|
2362
|
-
didMove = false;
|
|
2363
|
-
assert(event, 'Expected event to be defined for "down" action');
|
|
2364
|
-
startDragging(resizeHandleId, event);
|
|
2365
|
-
const {
|
|
2366
|
-
onDragging,
|
|
2367
|
-
onPointerDown
|
|
2368
|
-
} = callbacksRef.current;
|
|
2369
|
-
onDragging === null || onDragging === void 0 ? void 0 : onDragging(true);
|
|
2370
|
-
onPointerDown === null || onPointerDown === void 0 ? void 0 : onPointerDown();
|
|
2371
|
-
break;
|
|
2372
|
-
}
|
|
2373
|
-
case "move":
|
|
2374
|
-
{
|
|
2375
|
-
const {
|
|
2376
|
-
state
|
|
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);
|
|
2384
|
-
break;
|
|
2385
|
-
}
|
|
2386
|
-
case "up":
|
|
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
|
-
}
|
|
2400
|
-
break;
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
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"
|
|
965
|
+
const n = () => {
|
|
966
|
+
const { mountedGroups: a } = O();
|
|
967
|
+
for (const [r, { derivedPanelConstraints: l, layout: c }] of a)
|
|
968
|
+
if (r.id === e)
|
|
969
|
+
return { derivedPanelConstraints: l, group: r, layout: c };
|
|
970
|
+
throw Error(`Group ${e} not found`);
|
|
971
|
+
}, o = () => {
|
|
972
|
+
const a = n().derivedPanelConstraints.find(
|
|
973
|
+
(r) => r.panelId === t
|
|
974
|
+
);
|
|
975
|
+
if (a !== void 0)
|
|
976
|
+
return a;
|
|
977
|
+
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
978
|
+
}, s = () => {
|
|
979
|
+
const a = n().group.panels.find((r) => r.id === t);
|
|
980
|
+
if (a !== void 0)
|
|
981
|
+
return a;
|
|
982
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
983
|
+
}, i = () => {
|
|
984
|
+
const a = n().layout[t];
|
|
985
|
+
if (a !== void 0)
|
|
986
|
+
return a;
|
|
987
|
+
throw Error(`Layout not found for Panel ${t}`);
|
|
2418
988
|
};
|
|
2419
|
-
return
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
id: idFromProps,
|
|
2424
|
-
onBlur: () => {
|
|
2425
|
-
setIsFocused(false);
|
|
2426
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur();
|
|
989
|
+
return {
|
|
990
|
+
collapse: () => {
|
|
991
|
+
const { collapsible: a, collapsedSize: r } = o();
|
|
992
|
+
i();
|
|
2427
993
|
},
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
994
|
+
expand: () => {
|
|
995
|
+
const { collapsible: a, collapsedSize: r, minSize: l } = o();
|
|
996
|
+
i();
|
|
2431
997
|
},
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
998
|
+
getSize: () => {
|
|
999
|
+
const { group: a } = n(), r = i(), { element: l } = s(), c = a.orientation === "horizontal" ? l.offsetWidth : l.offsetHeight;
|
|
1000
|
+
return {
|
|
1001
|
+
asPercentage: r,
|
|
1002
|
+
inPixels: c
|
|
1003
|
+
};
|
|
2437
1004
|
},
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
const context = useContext(PanelGroupContext);
|
|
2453
|
-
return {
|
|
2454
|
-
direction: context === null || context === void 0 ? void 0 : context.direction,
|
|
2455
|
-
groupId: context === null || context === void 0 ? void 0 : context.groupId
|
|
1005
|
+
isCollapsed: () => {
|
|
1006
|
+
const { collapsible: a, collapsedSize: r } = o(), l = i();
|
|
1007
|
+
return a && w(r, l);
|
|
1008
|
+
},
|
|
1009
|
+
resize: (a) => {
|
|
1010
|
+
if (i() !== a)
|
|
1011
|
+
switch (typeof a) {
|
|
1012
|
+
case "number": {
|
|
1013
|
+
const { group: l } = n(), c = Q({ group: l });
|
|
1014
|
+
L(a / c * 100);
|
|
1015
|
+
break;
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
2456
1019
|
};
|
|
2457
1020
|
}
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
1021
|
+
function nt(e, t) {
|
|
1022
|
+
const { id: n } = ie(), o = I({
|
|
1023
|
+
collapse: V,
|
|
1024
|
+
expand: V,
|
|
1025
|
+
getSize: () => ({
|
|
1026
|
+
asPercentage: 0,
|
|
1027
|
+
inPixels: 0
|
|
1028
|
+
}),
|
|
1029
|
+
isCollapsed: () => !1,
|
|
1030
|
+
resize: V
|
|
1031
|
+
});
|
|
1032
|
+
de(t, () => o.current, []), _(() => {
|
|
1033
|
+
Object.assign(
|
|
1034
|
+
o.current,
|
|
1035
|
+
tt({ groupId: n, panelId: e })
|
|
1036
|
+
);
|
|
1037
|
+
});
|
|
2465
1038
|
}
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
1039
|
+
function ct({
|
|
1040
|
+
children: e,
|
|
1041
|
+
className: t,
|
|
1042
|
+
collapsedSize: n = 0,
|
|
1043
|
+
collapsible: o = !1,
|
|
1044
|
+
defaultSize: s,
|
|
1045
|
+
elementRef: i,
|
|
1046
|
+
id: a,
|
|
1047
|
+
maxSize: r = "100",
|
|
1048
|
+
minSize: l = "0",
|
|
1049
|
+
onResize: c,
|
|
1050
|
+
panelRef: u,
|
|
1051
|
+
style: d
|
|
1052
|
+
}) {
|
|
1053
|
+
const p = !!a, m = te(a), [h, f] = M(null), v = oe(f, i), { id: g, registerPanel: x } = ie(), z = c !== null, S = ne((k) => {
|
|
1054
|
+
c?.(k, a);
|
|
1055
|
+
});
|
|
1056
|
+
_(() => {
|
|
1057
|
+
if (h !== null)
|
|
1058
|
+
return x({
|
|
1059
|
+
element: h,
|
|
1060
|
+
id: m,
|
|
1061
|
+
idIsStable: p,
|
|
1062
|
+
onResize: z ? S : void 0,
|
|
1063
|
+
panelConstraints: {
|
|
1064
|
+
collapsedSize: n,
|
|
1065
|
+
collapsible: o,
|
|
1066
|
+
defaultSize: s,
|
|
1067
|
+
maxSize: r,
|
|
1068
|
+
minSize: l
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
}, [
|
|
1072
|
+
n,
|
|
1073
|
+
o,
|
|
1074
|
+
s,
|
|
1075
|
+
h,
|
|
1076
|
+
z,
|
|
1077
|
+
m,
|
|
1078
|
+
p,
|
|
1079
|
+
r,
|
|
1080
|
+
l,
|
|
1081
|
+
S,
|
|
1082
|
+
x
|
|
1083
|
+
]), nt(m, u);
|
|
1084
|
+
const R = xe(g, m);
|
|
1085
|
+
return /* @__PURE__ */ F(
|
|
1086
|
+
"div",
|
|
1087
|
+
{
|
|
1088
|
+
"data-panel": m,
|
|
1089
|
+
ref: v,
|
|
1090
|
+
style: {
|
|
1091
|
+
flexBasis: 0,
|
|
1092
|
+
flexGrow: `var(${R}, 1)`,
|
|
1093
|
+
flexShrink: 1,
|
|
1094
|
+
// Prevent Panel content from interfering with panel size
|
|
1095
|
+
overflow: "hidden",
|
|
1096
|
+
// Disable pointer events inside of a panel during resize
|
|
1097
|
+
// This avoid edge cases like nested iframes
|
|
1098
|
+
pointerEvents: `var(${Se})`
|
|
1099
|
+
},
|
|
1100
|
+
children: /* @__PURE__ */ F(
|
|
1101
|
+
"div",
|
|
1102
|
+
{
|
|
1103
|
+
className: t,
|
|
1104
|
+
style: {
|
|
1105
|
+
width: "100%",
|
|
1106
|
+
height: "100%",
|
|
1107
|
+
...d
|
|
1108
|
+
},
|
|
1109
|
+
children: e
|
|
1110
|
+
}
|
|
1111
|
+
)
|
|
1112
|
+
}
|
|
1113
|
+
);
|
|
2469
1114
|
}
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
y: 0,
|
|
2476
|
-
width: 0,
|
|
2477
|
-
height: 0
|
|
2478
|
-
};
|
|
2479
|
-
}
|
|
2480
|
-
return {
|
|
2481
|
-
x: Math.max(rectOne.x, rectTwo.x),
|
|
2482
|
-
y: Math.max(rectOne.y, rectTwo.y),
|
|
2483
|
-
width: Math.min(rectOne.x + rectOne.width, rectTwo.x + rectTwo.width) - Math.max(rectOne.x, rectTwo.x),
|
|
2484
|
-
height: Math.min(rectOne.y + rectOne.height, rectTwo.y + rectTwo.height) - Math.max(rectOne.y, rectTwo.y)
|
|
2485
|
-
};
|
|
1115
|
+
function ut() {
|
|
1116
|
+
return M(null);
|
|
1117
|
+
}
|
|
1118
|
+
function ft() {
|
|
1119
|
+
return I(null);
|
|
2486
1120
|
}
|
|
2487
|
-
|
|
2488
|
-
|
|
1121
|
+
function dt({
|
|
1122
|
+
children: e,
|
|
1123
|
+
className: t,
|
|
1124
|
+
elementRef: n,
|
|
1125
|
+
id: o,
|
|
1126
|
+
style: s
|
|
1127
|
+
}) {
|
|
1128
|
+
const i = te(o), [a, r] = M(null), [l, c] = M("inactive"), u = oe(r, n), { orientation: d, registerSeparator: p } = ie(), m = d === "horizontal" ? "vertical" : "horizontal";
|
|
1129
|
+
return _(() => {
|
|
1130
|
+
if (a !== null) {
|
|
1131
|
+
const h = {
|
|
1132
|
+
element: a,
|
|
1133
|
+
id: i
|
|
1134
|
+
}, f = p(h), v = T.addListener(
|
|
1135
|
+
"interactionStateChange",
|
|
1136
|
+
(g) => {
|
|
1137
|
+
c(
|
|
1138
|
+
g.state !== "inactive" && g.hitRegions.some(
|
|
1139
|
+
(x) => x.separator === h
|
|
1140
|
+
) ? g.state : "inactive"
|
|
1141
|
+
);
|
|
1142
|
+
}
|
|
1143
|
+
);
|
|
1144
|
+
return () => {
|
|
1145
|
+
f(), v();
|
|
1146
|
+
};
|
|
1147
|
+
}
|
|
1148
|
+
}, [a, i, p]), /* @__PURE__ */ F(
|
|
1149
|
+
"div",
|
|
1150
|
+
{
|
|
1151
|
+
"aria-orientation": m,
|
|
1152
|
+
children: e,
|
|
1153
|
+
className: t,
|
|
1154
|
+
"data-separator": i,
|
|
1155
|
+
"data-separator-state": l,
|
|
1156
|
+
ref: u,
|
|
1157
|
+
role: "separator",
|
|
1158
|
+
style: {
|
|
1159
|
+
flexBasis: "auto",
|
|
1160
|
+
...s,
|
|
1161
|
+
flexGrow: 0,
|
|
1162
|
+
flexShrink: 0
|
|
1163
|
+
},
|
|
1164
|
+
tabIndex: 0
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1167
|
+
}
|
|
1168
|
+
export {
|
|
1169
|
+
rt as Group,
|
|
1170
|
+
ct as Panel,
|
|
1171
|
+
dt as Separator,
|
|
1172
|
+
st as useDefaultLayout,
|
|
1173
|
+
at as useGroupCallbackRef,
|
|
1174
|
+
lt as useGroupRef,
|
|
1175
|
+
ut as usePanelCallbackRef,
|
|
1176
|
+
ft as usePanelRef
|
|
1177
|
+
};
|
|
1178
|
+
//# sourceMappingURL=react-resizable-panels.js.map
|