react-resizable-panels 4.11.1 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as ae } from "react/jsx-runtime";
|
|
3
|
-
import { useState as Q, useCallback as re, useId as pt, useLayoutEffect as
|
|
3
|
+
import { useState as Q, useCallback as re, useId as pt, useLayoutEffect as We, useEffect as me, useRef as T, createContext as ht, useImperativeHandle as Ke, useMemo as Se, useSyncExternalStore as Xe, useContext as mt } from "react";
|
|
4
4
|
function gt(e, t) {
|
|
5
5
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
6
6
|
return t * o;
|
|
7
7
|
}
|
|
8
8
|
function yt(e, t) {
|
|
9
|
-
const n = getComputedStyle(e.ownerDocument.
|
|
9
|
+
const n = getComputedStyle(e.ownerDocument.documentElement), o = parseFloat(n.fontSize);
|
|
10
10
|
return t * o;
|
|
11
11
|
}
|
|
12
12
|
function St(e) {
|
|
@@ -31,8 +31,8 @@ function ie({
|
|
|
31
31
|
styleProp: n
|
|
32
32
|
}) {
|
|
33
33
|
let o;
|
|
34
|
-
const [i,
|
|
35
|
-
switch (
|
|
34
|
+
const [i, s] = bt(n);
|
|
35
|
+
switch (s) {
|
|
36
36
|
case "%": {
|
|
37
37
|
o = i / 100 * e;
|
|
38
38
|
break;
|
|
@@ -81,50 +81,50 @@ function ve(e) {
|
|
|
81
81
|
maxSize: 100,
|
|
82
82
|
panelId: o.id
|
|
83
83
|
})) : t.map((o) => {
|
|
84
|
-
const { element: i, panelConstraints:
|
|
85
|
-
let
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
84
|
+
const { element: i, panelConstraints: s } = o;
|
|
85
|
+
let u = 0;
|
|
86
|
+
if (s.collapsedSize !== void 0) {
|
|
87
|
+
const c = ie({
|
|
88
88
|
groupSize: n,
|
|
89
89
|
panelElement: i,
|
|
90
|
-
styleProp:
|
|
90
|
+
styleProp: s.collapsedSize
|
|
91
91
|
});
|
|
92
|
-
|
|
92
|
+
u = O(c / n * 100);
|
|
93
93
|
}
|
|
94
94
|
let a;
|
|
95
|
-
if (
|
|
96
|
-
const
|
|
95
|
+
if (s.defaultSize !== void 0) {
|
|
96
|
+
const c = ie({
|
|
97
97
|
groupSize: n,
|
|
98
98
|
panelElement: i,
|
|
99
|
-
styleProp:
|
|
99
|
+
styleProp: s.defaultSize
|
|
100
100
|
});
|
|
101
|
-
a = O(
|
|
101
|
+
a = O(c / n * 100);
|
|
102
102
|
}
|
|
103
|
-
let
|
|
104
|
-
if (
|
|
105
|
-
const
|
|
103
|
+
let r = 0;
|
|
104
|
+
if (s.minSize !== void 0) {
|
|
105
|
+
const c = ie({
|
|
106
106
|
groupSize: n,
|
|
107
107
|
panelElement: i,
|
|
108
|
-
styleProp:
|
|
108
|
+
styleProp: s.minSize
|
|
109
109
|
});
|
|
110
|
-
|
|
110
|
+
r = O(c / n * 100);
|
|
111
111
|
}
|
|
112
112
|
let l = 100;
|
|
113
|
-
if (
|
|
114
|
-
const
|
|
113
|
+
if (s.maxSize !== void 0) {
|
|
114
|
+
const c = ie({
|
|
115
115
|
groupSize: n,
|
|
116
116
|
panelElement: i,
|
|
117
|
-
styleProp:
|
|
117
|
+
styleProp: s.maxSize
|
|
118
118
|
});
|
|
119
|
-
l = O(
|
|
119
|
+
l = O(c / n * 100);
|
|
120
120
|
}
|
|
121
121
|
return {
|
|
122
|
-
groupResizeBehavior:
|
|
123
|
-
collapsedSize:
|
|
124
|
-
collapsible:
|
|
122
|
+
groupResizeBehavior: s.groupResizeBehavior,
|
|
123
|
+
collapsedSize: u,
|
|
124
|
+
collapsible: s.collapsible === !0,
|
|
125
125
|
defaultSize: a,
|
|
126
|
-
disabled:
|
|
127
|
-
minSize:
|
|
126
|
+
disabled: s.disabled,
|
|
127
|
+
minSize: r,
|
|
128
128
|
maxSize: l,
|
|
129
129
|
panelId: o.id
|
|
130
130
|
};
|
|
@@ -171,10 +171,10 @@ function Pt({
|
|
|
171
171
|
x: n.x + n.width / 2,
|
|
172
172
|
y: n.y + n.height / 2
|
|
173
173
|
};
|
|
174
|
-
let i,
|
|
175
|
-
for (const
|
|
176
|
-
const { x: a, y:
|
|
177
|
-
l <
|
|
174
|
+
let i, s = Number.MAX_VALUE;
|
|
175
|
+
for (const u of t) {
|
|
176
|
+
const { x: a, y: r } = Ye(o, u), l = e === "horizontal" ? a : r;
|
|
177
|
+
l < s && (s = l, i = u);
|
|
178
178
|
}
|
|
179
179
|
return C(i, "No rect found"), i;
|
|
180
180
|
}
|
|
@@ -183,57 +183,57 @@ function wt() {
|
|
|
183
183
|
return fe === void 0 && (typeof matchMedia == "function" ? fe = !!matchMedia("(pointer:coarse)").matches : fe = !1), fe;
|
|
184
184
|
}
|
|
185
185
|
function Je(e) {
|
|
186
|
-
const { element: t, orientation: n, panels: o, separators: i } = e,
|
|
186
|
+
const { element: t, orientation: n, panels: o, separators: i } = e, s = be(
|
|
187
187
|
n,
|
|
188
188
|
Array.from(t.children).filter(qe).map((z) => ({ element: z }))
|
|
189
|
-
).map(({ element: z }) => z),
|
|
190
|
-
let a = !1,
|
|
189
|
+
).map(({ element: z }) => z), u = [];
|
|
190
|
+
let a = !1, r = !1, l = -1, c = -1, m = 0, p, S = [];
|
|
191
191
|
{
|
|
192
192
|
let z = -1;
|
|
193
|
-
for (const
|
|
194
|
-
|
|
193
|
+
for (const f of s)
|
|
194
|
+
f.hasAttribute("data-panel") && (z++, f.hasAttribute("data-disabled") || (m++, l === -1 && (l = z), c = z));
|
|
195
195
|
}
|
|
196
|
-
if (
|
|
196
|
+
if (m > 1) {
|
|
197
197
|
let z = -1;
|
|
198
|
-
for (const
|
|
199
|
-
if (
|
|
198
|
+
for (const f of s)
|
|
199
|
+
if (f.hasAttribute("data-panel")) {
|
|
200
200
|
z++;
|
|
201
|
-
const
|
|
202
|
-
(
|
|
201
|
+
const d = o.find(
|
|
202
|
+
(h) => h.element === f
|
|
203
203
|
);
|
|
204
|
-
if (
|
|
205
|
-
if (
|
|
206
|
-
const
|
|
204
|
+
if (d) {
|
|
205
|
+
if (p) {
|
|
206
|
+
const h = p.element.getBoundingClientRect(), y = f.getBoundingClientRect();
|
|
207
207
|
let b;
|
|
208
|
-
if (
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
|
|
208
|
+
if (r) {
|
|
209
|
+
const v = n === "horizontal" ? new DOMRect(
|
|
210
|
+
h.right,
|
|
211
|
+
h.top,
|
|
212
212
|
0,
|
|
213
|
-
|
|
213
|
+
h.height
|
|
214
214
|
) : new DOMRect(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
h.left,
|
|
216
|
+
h.bottom,
|
|
217
|
+
h.width,
|
|
218
218
|
0
|
|
219
|
-
), g = n === "horizontal" ? new DOMRect(
|
|
219
|
+
), g = n === "horizontal" ? new DOMRect(y.left, y.top, 0, y.height) : new DOMRect(y.left, y.top, y.width, 0);
|
|
220
220
|
switch (S.length) {
|
|
221
221
|
case 0: {
|
|
222
222
|
b = [
|
|
223
|
-
|
|
223
|
+
v,
|
|
224
224
|
g
|
|
225
225
|
];
|
|
226
226
|
break;
|
|
227
227
|
}
|
|
228
228
|
case 1: {
|
|
229
|
-
const
|
|
229
|
+
const w = S[0], M = Pt({
|
|
230
230
|
orientation: n,
|
|
231
|
-
rects: [
|
|
232
|
-
targetRect:
|
|
231
|
+
rects: [h, y],
|
|
232
|
+
targetRect: w.element.getBoundingClientRect()
|
|
233
233
|
});
|
|
234
234
|
b = [
|
|
235
|
-
|
|
236
|
-
M ===
|
|
235
|
+
w,
|
|
236
|
+
M === h ? g : v
|
|
237
237
|
];
|
|
238
238
|
break;
|
|
239
239
|
}
|
|
@@ -245,60 +245,60 @@ function Je(e) {
|
|
|
245
245
|
} else
|
|
246
246
|
S.length ? b = S : b = [
|
|
247
247
|
n === "horizontal" ? new DOMRect(
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
248
|
+
h.right,
|
|
249
|
+
y.top,
|
|
250
|
+
y.left - h.right,
|
|
251
|
+
y.height
|
|
252
252
|
) : new DOMRect(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
253
|
+
y.left,
|
|
254
|
+
h.bottom,
|
|
255
|
+
y.width,
|
|
256
|
+
y.top - h.bottom
|
|
257
257
|
)
|
|
258
258
|
];
|
|
259
|
-
for (const
|
|
260
|
-
let g = "width" in
|
|
261
|
-
const
|
|
262
|
-
if (g.width <
|
|
263
|
-
const
|
|
259
|
+
for (const v of b) {
|
|
260
|
+
let g = "width" in v ? v : v.element.getBoundingClientRect();
|
|
261
|
+
const w = wt() ? e.resizeTargetMinimumSize.coarse : e.resizeTargetMinimumSize.fine;
|
|
262
|
+
if (g.width < w) {
|
|
263
|
+
const L = w - g.width;
|
|
264
264
|
g = new DOMRect(
|
|
265
|
-
g.x -
|
|
265
|
+
g.x - L / 2,
|
|
266
266
|
g.y,
|
|
267
|
-
g.width +
|
|
267
|
+
g.width + L,
|
|
268
268
|
g.height
|
|
269
269
|
);
|
|
270
270
|
}
|
|
271
|
-
if (g.height <
|
|
272
|
-
const
|
|
271
|
+
if (g.height < w) {
|
|
272
|
+
const L = w - g.height;
|
|
273
273
|
g = new DOMRect(
|
|
274
274
|
g.x,
|
|
275
|
-
g.y -
|
|
275
|
+
g.y - L / 2,
|
|
276
276
|
g.width,
|
|
277
|
-
g.height +
|
|
277
|
+
g.height + L
|
|
278
278
|
);
|
|
279
279
|
}
|
|
280
|
-
const M = z <= l || z >
|
|
281
|
-
!a && !M &&
|
|
280
|
+
const M = z <= l || z > c;
|
|
281
|
+
!a && !M && u.push({
|
|
282
282
|
group: e,
|
|
283
283
|
groupSize: ne({ group: e }),
|
|
284
|
-
panels: [
|
|
285
|
-
separator: "width" in
|
|
284
|
+
panels: [p, d],
|
|
285
|
+
separator: "width" in v ? void 0 : v,
|
|
286
286
|
rect: g
|
|
287
287
|
}), a = !1;
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
r = !1, p = d, S = [];
|
|
291
291
|
}
|
|
292
|
-
} else if (
|
|
293
|
-
|
|
294
|
-
const
|
|
295
|
-
(
|
|
292
|
+
} else if (f.hasAttribute("data-separator")) {
|
|
293
|
+
f.ariaDisabled !== null && (a = !0);
|
|
294
|
+
const d = i.find(
|
|
295
|
+
(h) => h.element === f
|
|
296
296
|
);
|
|
297
|
-
|
|
297
|
+
d ? S.push(d) : (p = void 0, S = []);
|
|
298
298
|
} else
|
|
299
|
-
|
|
299
|
+
r = !0;
|
|
300
300
|
}
|
|
301
|
-
return
|
|
301
|
+
return u;
|
|
302
302
|
}
|
|
303
303
|
class Ze {
|
|
304
304
|
#e = {};
|
|
@@ -314,18 +314,18 @@ class Ze {
|
|
|
314
314
|
if (o.length === 1)
|
|
315
315
|
o[0].call(null, n);
|
|
316
316
|
else {
|
|
317
|
-
let i = !1,
|
|
318
|
-
const
|
|
319
|
-
for (let a = 0; a <
|
|
320
|
-
const
|
|
317
|
+
let i = !1, s = null;
|
|
318
|
+
const u = Array.from(o);
|
|
319
|
+
for (let a = 0; a < u.length; a++) {
|
|
320
|
+
const r = u[a];
|
|
321
321
|
try {
|
|
322
|
-
|
|
322
|
+
r.call(null, n);
|
|
323
323
|
} catch (l) {
|
|
324
|
-
|
|
324
|
+
s === null && (i = !0, s = l);
|
|
325
325
|
}
|
|
326
326
|
}
|
|
327
327
|
if (i)
|
|
328
|
-
throw
|
|
328
|
+
throw s;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
removeAllListeners() {
|
|
@@ -344,7 +344,7 @@ const Qe = new Ze();
|
|
|
344
344
|
function Lt(e) {
|
|
345
345
|
F = new Map(F), F.delete(e);
|
|
346
346
|
}
|
|
347
|
-
function
|
|
347
|
+
function Ie(e, t) {
|
|
348
348
|
for (const [n] of F)
|
|
349
349
|
if (n.id === e)
|
|
350
350
|
return n;
|
|
@@ -364,11 +364,12 @@ function ze(e, t) {
|
|
|
364
364
|
n.group.id === e && t(n);
|
|
365
365
|
});
|
|
366
366
|
}
|
|
367
|
-
function
|
|
368
|
-
const
|
|
367
|
+
function j(e, t, n) {
|
|
368
|
+
const o = F.get(e);
|
|
369
369
|
F = new Map(F), F.set(e, t), Qe.emit("groupChange", {
|
|
370
370
|
group: e,
|
|
371
|
-
|
|
371
|
+
isUserInteraction: n?.isUserInteraction === !0,
|
|
372
|
+
prev: o,
|
|
372
373
|
next: t
|
|
373
374
|
});
|
|
374
375
|
}
|
|
@@ -377,15 +378,15 @@ function Ct(e, t, n) {
|
|
|
377
378
|
x: 1 / 0,
|
|
378
379
|
y: 1 / 0
|
|
379
380
|
};
|
|
380
|
-
for (const
|
|
381
|
-
const
|
|
381
|
+
for (const s of t) {
|
|
382
|
+
const u = Ye(n, s.rect);
|
|
382
383
|
switch (e) {
|
|
383
384
|
case "horizontal": {
|
|
384
|
-
|
|
385
|
+
u.x <= i.x && (o = s, i = u);
|
|
385
386
|
break;
|
|
386
387
|
}
|
|
387
388
|
case "vertical": {
|
|
388
|
-
|
|
389
|
+
u.y <= i.y && (o = s, i = u);
|
|
389
390
|
break;
|
|
390
391
|
}
|
|
391
392
|
}
|
|
@@ -412,37 +413,37 @@ function Mt(e, t) {
|
|
|
412
413
|
"Stacking order can only be calculated for elements with a common ancestor"
|
|
413
414
|
);
|
|
414
415
|
const i = {
|
|
415
|
-
a: De(
|
|
416
|
-
b: De(
|
|
416
|
+
a: De(ke(n.a)),
|
|
417
|
+
b: De(ke(n.b))
|
|
417
418
|
};
|
|
418
419
|
if (i.a === i.b) {
|
|
419
|
-
const
|
|
420
|
+
const s = o.childNodes, u = {
|
|
420
421
|
a: n.a.at(-1),
|
|
421
422
|
b: n.b.at(-1)
|
|
422
423
|
};
|
|
423
|
-
let a =
|
|
424
|
+
let a = s.length;
|
|
424
425
|
for (; a--; ) {
|
|
425
|
-
const
|
|
426
|
-
if (
|
|
427
|
-
if (
|
|
426
|
+
const r = s[a];
|
|
427
|
+
if (r === u.a) return 1;
|
|
428
|
+
if (r === u.b) return -1;
|
|
428
429
|
}
|
|
429
430
|
}
|
|
430
431
|
return Math.sign(i.a - i.b);
|
|
431
432
|
}
|
|
432
433
|
const Et = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
433
|
-
function
|
|
434
|
+
function It(e) {
|
|
434
435
|
const t = getComputedStyle(et(e) ?? e).display;
|
|
435
436
|
return t === "flex" || t === "inline-flex";
|
|
436
437
|
}
|
|
437
|
-
function
|
|
438
|
+
function kt(e) {
|
|
438
439
|
const t = getComputedStyle(e);
|
|
439
|
-
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" ||
|
|
440
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || It(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || Et.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
440
441
|
}
|
|
441
|
-
function
|
|
442
|
+
function ke(e) {
|
|
442
443
|
let t = e.length;
|
|
443
444
|
for (; t--; ) {
|
|
444
445
|
const n = e[t];
|
|
445
|
-
if (C(n, "Missing node"),
|
|
446
|
+
if (C(n, "Missing node"), kt(n)) return n;
|
|
446
447
|
}
|
|
447
448
|
return null;
|
|
448
449
|
}
|
|
@@ -486,15 +487,15 @@ function xe(e, t) {
|
|
|
486
487
|
return t.forEach((o, i) => {
|
|
487
488
|
if (i.disabled)
|
|
488
489
|
return;
|
|
489
|
-
const
|
|
490
|
+
const s = Je(i), u = Ct(i.orientation, s, {
|
|
490
491
|
x: e.clientX,
|
|
491
492
|
y: e.clientY
|
|
492
493
|
});
|
|
493
|
-
|
|
494
|
+
u && u.distance.x <= 0 && u.distance.y <= 0 && Ot({
|
|
494
495
|
groupElement: i.element,
|
|
495
|
-
hitRegion:
|
|
496
|
+
hitRegion: u.hitRegion.rect,
|
|
496
497
|
pointerEventTarget: e.target
|
|
497
|
-
}) && n.push(
|
|
498
|
+
}) && n.push(u.hitRegion);
|
|
498
499
|
}), n;
|
|
499
500
|
}
|
|
500
501
|
function Tt(e, t) {
|
|
@@ -505,11 +506,11 @@ function Tt(e, t) {
|
|
|
505
506
|
return !1;
|
|
506
507
|
return !0;
|
|
507
508
|
}
|
|
508
|
-
function
|
|
509
|
+
function k(e, t, n = 0) {
|
|
509
510
|
return Math.abs(O(e) - O(t)) <= n;
|
|
510
511
|
}
|
|
511
512
|
function A(e, t) {
|
|
512
|
-
return
|
|
513
|
+
return k(e, t) ? 0 : e > t ? 1 : -1;
|
|
513
514
|
}
|
|
514
515
|
function Z({
|
|
515
516
|
overrideDisabledPanels: e,
|
|
@@ -519,19 +520,19 @@ function Z({
|
|
|
519
520
|
}) {
|
|
520
521
|
const {
|
|
521
522
|
collapsedSize: i = 0,
|
|
522
|
-
collapsible:
|
|
523
|
-
disabled:
|
|
523
|
+
collapsible: s,
|
|
524
|
+
disabled: u,
|
|
524
525
|
maxSize: a = 100,
|
|
525
|
-
minSize:
|
|
526
|
+
minSize: r = 0
|
|
526
527
|
} = t;
|
|
527
|
-
if (
|
|
528
|
+
if (u && !e)
|
|
528
529
|
return n;
|
|
529
|
-
if (A(o,
|
|
530
|
-
if (
|
|
531
|
-
const l = (i +
|
|
532
|
-
A(o, l) < 0 ? o = i : o =
|
|
530
|
+
if (A(o, r) < 0)
|
|
531
|
+
if (s) {
|
|
532
|
+
const l = (i + r) / 2;
|
|
533
|
+
A(o, l) < 0 ? o = i : o = r;
|
|
533
534
|
} else
|
|
534
|
-
o =
|
|
535
|
+
o = r;
|
|
535
536
|
return o = Math.min(a, o), o = O(o), o;
|
|
536
537
|
}
|
|
537
538
|
function le({
|
|
@@ -540,55 +541,55 @@ function le({
|
|
|
540
541
|
panelConstraints: n,
|
|
541
542
|
pivotIndices: o,
|
|
542
543
|
prevLayout: i,
|
|
543
|
-
trigger:
|
|
544
|
+
trigger: s
|
|
544
545
|
}) {
|
|
545
|
-
if (
|
|
546
|
+
if (k(e, 0))
|
|
546
547
|
return t;
|
|
547
|
-
const
|
|
548
|
-
C(
|
|
549
|
-
let
|
|
550
|
-
switch (
|
|
548
|
+
const u = s === "imperative-api", a = Object.values(t), r = Object.values(i), l = [...a], [c, m] = o;
|
|
549
|
+
C(c != null, "Invalid first pivot index"), C(m != null, "Invalid second pivot index");
|
|
550
|
+
let p = 0;
|
|
551
|
+
switch (s) {
|
|
551
552
|
case "keyboard": {
|
|
552
553
|
{
|
|
553
|
-
const
|
|
554
|
+
const f = e < 0 ? m : c, d = n[f];
|
|
554
555
|
C(
|
|
555
|
-
|
|
556
|
-
`Panel constraints not found for index ${
|
|
556
|
+
d,
|
|
557
|
+
`Panel constraints not found for index ${f}`
|
|
557
558
|
);
|
|
558
559
|
const {
|
|
559
|
-
collapsedSize:
|
|
560
|
-
collapsible:
|
|
560
|
+
collapsedSize: h = 0,
|
|
561
|
+
collapsible: y,
|
|
561
562
|
minSize: b = 0
|
|
562
|
-
} =
|
|
563
|
-
if (
|
|
564
|
-
const
|
|
563
|
+
} = d;
|
|
564
|
+
if (y) {
|
|
565
|
+
const v = a[f];
|
|
565
566
|
if (C(
|
|
566
|
-
|
|
567
|
-
`Previous layout not found for panel index ${
|
|
568
|
-
),
|
|
569
|
-
const g = b -
|
|
567
|
+
v != null,
|
|
568
|
+
`Previous layout not found for panel index ${f}`
|
|
569
|
+
), k(v, h)) {
|
|
570
|
+
const g = b - v;
|
|
570
571
|
A(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
571
572
|
}
|
|
572
573
|
}
|
|
573
574
|
}
|
|
574
575
|
{
|
|
575
|
-
const
|
|
576
|
+
const f = e < 0 ? c : m, d = n[f];
|
|
576
577
|
C(
|
|
577
|
-
|
|
578
|
-
`No panel constraints found for index ${
|
|
578
|
+
d,
|
|
579
|
+
`No panel constraints found for index ${f}`
|
|
579
580
|
);
|
|
580
581
|
const {
|
|
581
|
-
collapsedSize:
|
|
582
|
-
collapsible:
|
|
582
|
+
collapsedSize: h = 0,
|
|
583
|
+
collapsible: y,
|
|
583
584
|
minSize: b = 0
|
|
584
|
-
} =
|
|
585
|
-
if (
|
|
586
|
-
const
|
|
585
|
+
} = d;
|
|
586
|
+
if (y) {
|
|
587
|
+
const v = a[f];
|
|
587
588
|
if (C(
|
|
588
|
-
|
|
589
|
-
`Previous layout not found for panel index ${
|
|
590
|
-
),
|
|
591
|
-
const g =
|
|
589
|
+
v != null,
|
|
590
|
+
`Previous layout not found for panel index ${f}`
|
|
591
|
+
), k(v, b)) {
|
|
592
|
+
const g = v - h;
|
|
592
593
|
A(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
593
594
|
}
|
|
594
595
|
}
|
|
@@ -596,109 +597,109 @@ function le({
|
|
|
596
597
|
break;
|
|
597
598
|
}
|
|
598
599
|
default: {
|
|
599
|
-
const
|
|
600
|
+
const f = e < 0 ? m : c, d = n[f];
|
|
600
601
|
C(
|
|
601
|
-
|
|
602
|
-
`Panel constraints not found for index ${
|
|
602
|
+
d,
|
|
603
|
+
`Panel constraints not found for index ${f}`
|
|
603
604
|
);
|
|
604
|
-
const
|
|
605
|
-
if (
|
|
605
|
+
const h = a[f], { collapsible: y, collapsedSize: b, minSize: v } = d;
|
|
606
|
+
if (y && A(h, v) < 0)
|
|
606
607
|
if (e > 0) {
|
|
607
|
-
const g =
|
|
608
|
-
A(M,
|
|
608
|
+
const g = v - b, w = g / 2, M = h + e;
|
|
609
|
+
A(M, v) < 0 && (e = A(e, w) <= 0 ? 0 : g);
|
|
609
610
|
} else {
|
|
610
|
-
const g =
|
|
611
|
-
A(M,
|
|
611
|
+
const g = v - b, w = 100 - g / 2, M = h - e;
|
|
612
|
+
A(M, v) < 0 && (e = A(100 + e, w) > 0 ? 0 : -g);
|
|
612
613
|
}
|
|
613
614
|
break;
|
|
614
615
|
}
|
|
615
616
|
}
|
|
616
617
|
{
|
|
617
|
-
const
|
|
618
|
-
let
|
|
618
|
+
const f = e < 0 ? 1 : -1;
|
|
619
|
+
let d = e < 0 ? m : c, h = 0;
|
|
619
620
|
for (; ; ) {
|
|
620
|
-
const b = a[
|
|
621
|
+
const b = a[d];
|
|
621
622
|
C(
|
|
622
623
|
b != null,
|
|
623
|
-
`Previous layout not found for panel index ${
|
|
624
|
+
`Previous layout not found for panel index ${d}`
|
|
624
625
|
);
|
|
625
626
|
const g = Z({
|
|
626
|
-
overrideDisabledPanels:
|
|
627
|
-
panelConstraints: n[
|
|
627
|
+
overrideDisabledPanels: u,
|
|
628
|
+
panelConstraints: n[d],
|
|
628
629
|
prevSize: b,
|
|
629
630
|
size: 100
|
|
630
631
|
}) - b;
|
|
631
|
-
if (
|
|
632
|
+
if (h += g, d += f, d < 0 || d >= n.length)
|
|
632
633
|
break;
|
|
633
634
|
}
|
|
634
|
-
const
|
|
635
|
-
e = e < 0 ? 0 -
|
|
635
|
+
const y = Math.min(Math.abs(e), Math.abs(h));
|
|
636
|
+
e = e < 0 ? 0 - y : y;
|
|
636
637
|
}
|
|
637
638
|
{
|
|
638
|
-
let
|
|
639
|
-
for (;
|
|
640
|
-
const
|
|
639
|
+
let d = e < 0 ? c : m;
|
|
640
|
+
for (; d >= 0 && d < n.length; ) {
|
|
641
|
+
const h = Math.abs(e) - Math.abs(p), y = a[d];
|
|
641
642
|
C(
|
|
642
|
-
|
|
643
|
-
`Previous layout not found for panel index ${
|
|
643
|
+
y != null,
|
|
644
|
+
`Previous layout not found for panel index ${d}`
|
|
644
645
|
);
|
|
645
|
-
const b =
|
|
646
|
-
overrideDisabledPanels:
|
|
647
|
-
panelConstraints: n[
|
|
648
|
-
prevSize:
|
|
646
|
+
const b = y - h, v = Z({
|
|
647
|
+
overrideDisabledPanels: u,
|
|
648
|
+
panelConstraints: n[d],
|
|
649
|
+
prevSize: y,
|
|
649
650
|
size: b
|
|
650
651
|
});
|
|
651
|
-
if (!
|
|
652
|
+
if (!k(y, v) && (p += y - v, l[d] = v, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
652
653
|
numeric: !0
|
|
653
654
|
}) >= 0))
|
|
654
655
|
break;
|
|
655
|
-
e < 0 ?
|
|
656
|
+
e < 0 ? d-- : d++;
|
|
656
657
|
}
|
|
657
658
|
}
|
|
658
|
-
if (Tt(
|
|
659
|
+
if (Tt(r, l))
|
|
659
660
|
return i;
|
|
660
661
|
{
|
|
661
|
-
const
|
|
662
|
+
const f = e < 0 ? m : c, d = a[f];
|
|
662
663
|
C(
|
|
663
|
-
|
|
664
|
-
`Previous layout not found for panel index ${
|
|
664
|
+
d != null,
|
|
665
|
+
`Previous layout not found for panel index ${f}`
|
|
665
666
|
);
|
|
666
|
-
const
|
|
667
|
-
overrideDisabledPanels:
|
|
668
|
-
panelConstraints: n[
|
|
669
|
-
prevSize:
|
|
670
|
-
size:
|
|
667
|
+
const h = d + p, y = Z({
|
|
668
|
+
overrideDisabledPanels: u,
|
|
669
|
+
panelConstraints: n[f],
|
|
670
|
+
prevSize: d,
|
|
671
|
+
size: h
|
|
671
672
|
});
|
|
672
|
-
if (l[
|
|
673
|
-
let b =
|
|
673
|
+
if (l[f] = y, !k(y, h)) {
|
|
674
|
+
let b = h - y, g = e < 0 ? m : c;
|
|
674
675
|
for (; g >= 0 && g < n.length; ) {
|
|
675
|
-
const
|
|
676
|
+
const w = l[g];
|
|
676
677
|
C(
|
|
677
|
-
|
|
678
|
+
w != null,
|
|
678
679
|
`Previous layout not found for panel index ${g}`
|
|
679
680
|
);
|
|
680
|
-
const M =
|
|
681
|
-
overrideDisabledPanels:
|
|
681
|
+
const M = w + b, L = Z({
|
|
682
|
+
overrideDisabledPanels: u,
|
|
682
683
|
panelConstraints: n[g],
|
|
683
|
-
prevSize:
|
|
684
|
+
prevSize: w,
|
|
684
685
|
size: M
|
|
685
686
|
});
|
|
686
|
-
if (
|
|
687
|
+
if (k(w, L) || (b -= L - w, l[g] = L), k(b, 0))
|
|
687
688
|
break;
|
|
688
689
|
e > 0 ? g-- : g++;
|
|
689
690
|
}
|
|
690
691
|
}
|
|
691
692
|
}
|
|
692
693
|
const S = Object.values(l).reduce(
|
|
693
|
-
(
|
|
694
|
+
(f, d) => d + f,
|
|
694
695
|
0
|
|
695
696
|
);
|
|
696
|
-
if (!
|
|
697
|
+
if (!k(S, 100, 0.1))
|
|
697
698
|
return i;
|
|
698
699
|
const z = Object.keys(i);
|
|
699
|
-
return l.reduce((
|
|
700
|
+
return l.reduce((f, d, h) => (f[z[h]] = d, f), {});
|
|
700
701
|
}
|
|
701
|
-
function
|
|
702
|
+
function B(e, t) {
|
|
702
703
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
703
704
|
return !1;
|
|
704
705
|
for (const n in e)
|
|
@@ -706,180 +707,180 @@ function W(e, t) {
|
|
|
706
707
|
return !1;
|
|
707
708
|
return !0;
|
|
708
709
|
}
|
|
709
|
-
function
|
|
710
|
+
function W({
|
|
710
711
|
layout: e,
|
|
711
712
|
panelConstraints: t
|
|
712
713
|
}) {
|
|
713
714
|
const n = Object.values(e), o = [...n], i = o.reduce(
|
|
714
|
-
(a,
|
|
715
|
+
(a, r) => a + r,
|
|
715
716
|
0
|
|
716
717
|
);
|
|
717
718
|
if (o.length !== t.length)
|
|
718
719
|
throw Error(
|
|
719
720
|
`Invalid ${t.length} panel layout: ${o.map((a) => `${a}%`).join(", ")}`
|
|
720
721
|
);
|
|
721
|
-
if (!
|
|
722
|
+
if (!k(i, 100) && o.length > 0)
|
|
722
723
|
for (let a = 0; a < t.length; a++) {
|
|
723
|
-
const
|
|
724
|
-
C(
|
|
725
|
-
const l = 100 / i *
|
|
724
|
+
const r = o[a];
|
|
725
|
+
C(r != null, `No layout data found for index ${a}`);
|
|
726
|
+
const l = 100 / i * r;
|
|
726
727
|
o[a] = l;
|
|
727
728
|
}
|
|
728
|
-
let
|
|
729
|
+
let s = 0;
|
|
729
730
|
for (let a = 0; a < t.length; a++) {
|
|
730
|
-
const
|
|
731
|
-
C(
|
|
731
|
+
const r = n[a];
|
|
732
|
+
C(r != null, `No layout data found for index ${a}`);
|
|
732
733
|
const l = o[a];
|
|
733
734
|
C(l != null, `No layout data found for index ${a}`);
|
|
734
|
-
const
|
|
735
|
+
const c = Z({
|
|
735
736
|
overrideDisabledPanels: !0,
|
|
736
737
|
panelConstraints: t[a],
|
|
737
|
-
prevSize:
|
|
738
|
+
prevSize: r,
|
|
738
739
|
size: l
|
|
739
740
|
});
|
|
740
|
-
l !=
|
|
741
|
+
l != c && (s += l - c, o[a] = c);
|
|
741
742
|
}
|
|
742
|
-
if (!
|
|
743
|
+
if (!k(s, 0))
|
|
743
744
|
for (let a = 0; a < t.length; a++) {
|
|
744
|
-
const
|
|
745
|
-
C(
|
|
746
|
-
const l =
|
|
745
|
+
const r = o[a];
|
|
746
|
+
C(r != null, `No layout data found for index ${a}`);
|
|
747
|
+
const l = r + s, c = Z({
|
|
747
748
|
overrideDisabledPanels: !0,
|
|
748
749
|
panelConstraints: t[a],
|
|
749
|
-
prevSize:
|
|
750
|
+
prevSize: r,
|
|
750
751
|
size: l
|
|
751
752
|
});
|
|
752
|
-
if (
|
|
753
|
+
if (r !== c && (s -= c - r, o[a] = c, k(s, 0)))
|
|
753
754
|
break;
|
|
754
755
|
}
|
|
755
|
-
const
|
|
756
|
-
return o.reduce((a,
|
|
756
|
+
const u = Object.keys(e);
|
|
757
|
+
return o.reduce((a, r, l) => (a[u[l]] = r, a), {});
|
|
757
758
|
}
|
|
758
759
|
function tt({
|
|
759
760
|
groupId: e,
|
|
760
761
|
panelId: t
|
|
761
762
|
}) {
|
|
762
763
|
const n = () => {
|
|
763
|
-
const
|
|
764
|
+
const r = X();
|
|
764
765
|
for (const [
|
|
765
766
|
l,
|
|
766
767
|
{
|
|
767
|
-
defaultLayoutDeferred:
|
|
768
|
-
derivedPanelConstraints:
|
|
769
|
-
layout:
|
|
768
|
+
defaultLayoutDeferred: c,
|
|
769
|
+
derivedPanelConstraints: m,
|
|
770
|
+
layout: p,
|
|
770
771
|
groupSize: S,
|
|
771
772
|
separatorToPanels: z
|
|
772
773
|
}
|
|
773
|
-
] of
|
|
774
|
+
] of r)
|
|
774
775
|
if (l.id === e)
|
|
775
776
|
return {
|
|
776
|
-
defaultLayoutDeferred:
|
|
777
|
-
derivedPanelConstraints:
|
|
777
|
+
defaultLayoutDeferred: c,
|
|
778
|
+
derivedPanelConstraints: m,
|
|
778
779
|
group: l,
|
|
779
780
|
groupSize: S,
|
|
780
|
-
layout:
|
|
781
|
+
layout: p,
|
|
781
782
|
separatorToPanels: z
|
|
782
783
|
};
|
|
783
784
|
throw Error(`Group ${e} not found`);
|
|
784
785
|
}, o = () => {
|
|
785
|
-
const
|
|
786
|
+
const r = n().derivedPanelConstraints.find(
|
|
786
787
|
(l) => l.panelId === t
|
|
787
788
|
);
|
|
788
|
-
if (
|
|
789
|
-
return
|
|
789
|
+
if (r !== void 0)
|
|
790
|
+
return r;
|
|
790
791
|
throw Error(`Panel constraints not found for Panel ${t}`);
|
|
791
792
|
}, i = () => {
|
|
792
|
-
const
|
|
793
|
-
if (
|
|
794
|
-
return
|
|
793
|
+
const r = n().group.panels.find((l) => l.id === t);
|
|
794
|
+
if (r !== void 0)
|
|
795
|
+
return r;
|
|
795
796
|
throw Error(`Layout not found for Panel ${t}`);
|
|
796
|
-
},
|
|
797
|
-
const
|
|
798
|
-
if (
|
|
799
|
-
return
|
|
797
|
+
}, s = () => {
|
|
798
|
+
const r = n().layout[t];
|
|
799
|
+
if (r !== void 0)
|
|
800
|
+
return r;
|
|
800
801
|
throw Error(`Layout not found for Panel ${t}`);
|
|
801
|
-
},
|
|
802
|
-
nextSize:
|
|
802
|
+
}, u = ({
|
|
803
|
+
nextSize: r,
|
|
803
804
|
panels: l,
|
|
804
|
-
prevLayout:
|
|
805
|
-
derivedPanelConstraints:
|
|
805
|
+
prevLayout: c,
|
|
806
|
+
derivedPanelConstraints: m
|
|
806
807
|
}) => {
|
|
807
|
-
const
|
|
808
|
-
if (
|
|
809
|
-
const b =
|
|
810
|
-
return b?.collapsible &&
|
|
808
|
+
const p = s(), S = l.findIndex((h) => h.id === t), z = S === 0, f = S === l.length - 1;
|
|
809
|
+
if (f && r < p && (z || l.slice(0, S).every((h, y) => {
|
|
810
|
+
const b = m[y];
|
|
811
|
+
return b?.collapsible && k(b.collapsedSize, c[b.panelId]);
|
|
811
812
|
}))) {
|
|
812
|
-
const
|
|
813
|
+
const h = l.slice(0, S).reduce((y, b) => y + c[b.id], 0);
|
|
813
814
|
return {
|
|
814
|
-
...
|
|
815
|
-
[t]: O(100 -
|
|
815
|
+
...c,
|
|
816
|
+
[t]: O(100 - h)
|
|
816
817
|
};
|
|
817
818
|
}
|
|
818
819
|
return le({
|
|
819
|
-
delta:
|
|
820
|
-
initialLayout:
|
|
821
|
-
panelConstraints:
|
|
822
|
-
pivotIndices:
|
|
823
|
-
prevLayout:
|
|
820
|
+
delta: f ? p - r : r - p,
|
|
821
|
+
initialLayout: c,
|
|
822
|
+
panelConstraints: m,
|
|
823
|
+
pivotIndices: f ? [S - 1, S] : [S, S + 1],
|
|
824
|
+
prevLayout: c,
|
|
824
825
|
trigger: "imperative-api"
|
|
825
826
|
});
|
|
826
|
-
}, a = (
|
|
827
|
-
const l =
|
|
828
|
-
if (
|
|
827
|
+
}, a = (r) => {
|
|
828
|
+
const l = s();
|
|
829
|
+
if (r === l)
|
|
829
830
|
return;
|
|
830
831
|
const {
|
|
831
|
-
defaultLayoutDeferred:
|
|
832
|
-
derivedPanelConstraints:
|
|
833
|
-
group:
|
|
832
|
+
defaultLayoutDeferred: c,
|
|
833
|
+
derivedPanelConstraints: m,
|
|
834
|
+
group: p,
|
|
834
835
|
groupSize: S,
|
|
835
836
|
layout: z,
|
|
836
|
-
separatorToPanels:
|
|
837
|
-
} = n(),
|
|
838
|
-
nextSize:
|
|
839
|
-
panels:
|
|
837
|
+
separatorToPanels: f
|
|
838
|
+
} = n(), d = u({
|
|
839
|
+
nextSize: r,
|
|
840
|
+
panels: p.panels,
|
|
840
841
|
prevLayout: z,
|
|
841
|
-
derivedPanelConstraints:
|
|
842
|
-
}),
|
|
843
|
-
layout:
|
|
844
|
-
panelConstraints:
|
|
842
|
+
derivedPanelConstraints: m
|
|
843
|
+
}), h = W({
|
|
844
|
+
layout: d,
|
|
845
|
+
panelConstraints: m
|
|
845
846
|
});
|
|
846
|
-
|
|
847
|
-
defaultLayoutDeferred:
|
|
848
|
-
derivedPanelConstraints:
|
|
847
|
+
B(z, h) || j(p, {
|
|
848
|
+
defaultLayoutDeferred: c,
|
|
849
|
+
derivedPanelConstraints: m,
|
|
849
850
|
groupSize: S,
|
|
850
|
-
layout:
|
|
851
|
-
separatorToPanels:
|
|
851
|
+
layout: h,
|
|
852
|
+
separatorToPanels: f
|
|
852
853
|
});
|
|
853
854
|
};
|
|
854
855
|
return {
|
|
855
856
|
collapse: () => {
|
|
856
|
-
const { collapsible:
|
|
857
|
-
|
|
857
|
+
const { collapsible: r, collapsedSize: l } = o(), { mutableValues: c } = i(), m = s();
|
|
858
|
+
r && m !== l && (c.expandToSize = m, a(l));
|
|
858
859
|
},
|
|
859
860
|
expand: () => {
|
|
860
|
-
const { collapsible:
|
|
861
|
-
if (
|
|
862
|
-
let S =
|
|
861
|
+
const { collapsible: r, collapsedSize: l, minSize: c } = o(), { mutableValues: m } = i(), p = s();
|
|
862
|
+
if (r && p === l) {
|
|
863
|
+
let S = m.expandToSize ?? c;
|
|
863
864
|
S === 0 && (S = 1), a(S);
|
|
864
865
|
}
|
|
865
866
|
},
|
|
866
867
|
getSize: () => {
|
|
867
|
-
const { group:
|
|
868
|
+
const { group: r } = n(), l = s(), { element: c } = i(), m = r.orientation === "horizontal" ? c.offsetWidth : c.offsetHeight;
|
|
868
869
|
return {
|
|
869
870
|
asPercentage: l,
|
|
870
|
-
inPixels:
|
|
871
|
+
inPixels: m
|
|
871
872
|
};
|
|
872
873
|
},
|
|
873
874
|
isCollapsed: () => {
|
|
874
|
-
const { collapsible:
|
|
875
|
-
return
|
|
875
|
+
const { collapsible: r, collapsedSize: l } = o(), c = s();
|
|
876
|
+
return r && k(l, c);
|
|
876
877
|
},
|
|
877
|
-
resize: (
|
|
878
|
-
const { group: l } = n(), { element:
|
|
879
|
-
groupSize:
|
|
880
|
-
panelElement:
|
|
881
|
-
styleProp:
|
|
882
|
-
}), S = O(
|
|
878
|
+
resize: (r) => {
|
|
879
|
+
const { group: l } = n(), { element: c } = i(), m = ne({ group: l }), p = ie({
|
|
880
|
+
groupSize: m,
|
|
881
|
+
panelElement: c,
|
|
882
|
+
styleProp: r
|
|
883
|
+
}), S = O(p / m * 100);
|
|
883
884
|
a(S);
|
|
884
885
|
}
|
|
885
886
|
};
|
|
@@ -891,14 +892,14 @@ function Te(e) {
|
|
|
891
892
|
xe(e, t).forEach((o) => {
|
|
892
893
|
if (o.separator && !o.separator.disableDoubleClick) {
|
|
893
894
|
const i = o.panels.find(
|
|
894
|
-
(
|
|
895
|
+
(s) => s.panelConstraints.defaultSize !== void 0
|
|
895
896
|
);
|
|
896
897
|
if (i) {
|
|
897
|
-
const
|
|
898
|
+
const s = i.panelConstraints.defaultSize, u = tt({
|
|
898
899
|
groupId: o.group.id,
|
|
899
900
|
panelId: i.id
|
|
900
901
|
});
|
|
901
|
-
|
|
902
|
+
u && s !== void 0 && (u.resize(s), e.preventDefault());
|
|
902
903
|
}
|
|
903
904
|
}
|
|
904
905
|
});
|
|
@@ -931,49 +932,57 @@ function nt({
|
|
|
931
932
|
const {
|
|
932
933
|
defaultLayoutDeferred: o,
|
|
933
934
|
derivedPanelConstraints: i,
|
|
934
|
-
group:
|
|
935
|
-
groupSize:
|
|
935
|
+
group: s,
|
|
936
|
+
groupSize: u,
|
|
936
937
|
layout: a,
|
|
937
|
-
separatorToPanels:
|
|
938
|
-
} = t(), l =
|
|
938
|
+
separatorToPanels: r
|
|
939
|
+
} = t(), l = W({
|
|
939
940
|
layout: n,
|
|
940
941
|
panelConstraints: i
|
|
941
942
|
});
|
|
942
|
-
return o ? a : (
|
|
943
|
+
return o ? a : (B(a, l) || j(s, {
|
|
943
944
|
defaultLayoutDeferred: o,
|
|
944
945
|
derivedPanelConstraints: i,
|
|
945
|
-
groupSize:
|
|
946
|
+
groupSize: u,
|
|
946
947
|
layout: l,
|
|
947
|
-
separatorToPanels:
|
|
948
|
+
separatorToPanels: r
|
|
948
949
|
}), l);
|
|
949
950
|
}
|
|
950
951
|
};
|
|
951
952
|
}
|
|
952
|
-
function
|
|
953
|
+
function U(e, t) {
|
|
953
954
|
const n = pe(e), o = H(n.id, !0), i = n.separators.find(
|
|
954
|
-
(
|
|
955
|
+
(m) => m.element === e
|
|
955
956
|
);
|
|
956
957
|
C(i, "Matching separator not found");
|
|
957
|
-
const
|
|
958
|
-
C(
|
|
959
|
-
const
|
|
958
|
+
const s = o.separatorToPanels.get(i);
|
|
959
|
+
C(s, "Matching panels not found");
|
|
960
|
+
const u = s.map((m) => n.panels.indexOf(m)), r = nt({ groupId: n.id }).getLayout(), l = le({
|
|
960
961
|
delta: t,
|
|
961
|
-
initialLayout:
|
|
962
|
+
initialLayout: r,
|
|
962
963
|
panelConstraints: o.derivedPanelConstraints,
|
|
963
|
-
pivotIndices:
|
|
964
|
-
prevLayout:
|
|
964
|
+
pivotIndices: u,
|
|
965
|
+
prevLayout: r,
|
|
965
966
|
trigger: "keyboard"
|
|
966
|
-
}),
|
|
967
|
+
}), c = W({
|
|
967
968
|
layout: l,
|
|
968
969
|
panelConstraints: o.derivedPanelConstraints
|
|
969
970
|
});
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
971
|
+
B(r, c) || j(
|
|
972
|
+
n,
|
|
973
|
+
{
|
|
974
|
+
defaultLayoutDeferred: o.defaultLayoutDeferred,
|
|
975
|
+
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
976
|
+
groupSize: o.groupSize,
|
|
977
|
+
layout: c,
|
|
978
|
+
separatorToPanels: o.separatorToPanels
|
|
979
|
+
},
|
|
980
|
+
// Keyboard resizes (arrow keys, Home/End, Enter collapse/expand) originate
|
|
981
|
+
// from a real DOM event on the separator, so they are user interactions
|
|
982
|
+
// just like pointer drags. This function is only reached from
|
|
983
|
+
// onDocumentKeyDown. See #716.
|
|
984
|
+
{ isUserInteraction: !0 }
|
|
985
|
+
);
|
|
977
986
|
}
|
|
978
987
|
function Ge(e) {
|
|
979
988
|
if (e.defaultPrevented)
|
|
@@ -982,58 +991,58 @@ function Ge(e) {
|
|
|
982
991
|
if (!n.disabled)
|
|
983
992
|
switch (e.key) {
|
|
984
993
|
case "ArrowDown": {
|
|
985
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
994
|
+
e.preventDefault(), n.orientation === "vertical" && U(t, 5);
|
|
986
995
|
break;
|
|
987
996
|
}
|
|
988
997
|
case "ArrowLeft": {
|
|
989
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
998
|
+
e.preventDefault(), n.orientation === "horizontal" && U(t, -5);
|
|
990
999
|
break;
|
|
991
1000
|
}
|
|
992
1001
|
case "ArrowRight": {
|
|
993
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
1002
|
+
e.preventDefault(), n.orientation === "horizontal" && U(t, 5);
|
|
994
1003
|
break;
|
|
995
1004
|
}
|
|
996
1005
|
case "ArrowUp": {
|
|
997
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
1006
|
+
e.preventDefault(), n.orientation === "vertical" && U(t, -5);
|
|
998
1007
|
break;
|
|
999
1008
|
}
|
|
1000
1009
|
case "End": {
|
|
1001
|
-
e.preventDefault(),
|
|
1010
|
+
e.preventDefault(), U(t, 100);
|
|
1002
1011
|
break;
|
|
1003
1012
|
}
|
|
1004
1013
|
case "Enter": {
|
|
1005
1014
|
e.preventDefault();
|
|
1006
|
-
const o = pe(t), i = H(o.id, !0), { derivedPanelConstraints:
|
|
1007
|
-
(
|
|
1015
|
+
const o = pe(t), i = H(o.id, !0), { derivedPanelConstraints: s, layout: u, separatorToPanels: a } = i, r = o.separators.find(
|
|
1016
|
+
(p) => p.element === t
|
|
1008
1017
|
);
|
|
1009
|
-
C(
|
|
1010
|
-
const l = a.get(
|
|
1018
|
+
C(r, "Matching separator not found");
|
|
1019
|
+
const l = a.get(r);
|
|
1011
1020
|
C(l, "Matching panels not found");
|
|
1012
|
-
const
|
|
1013
|
-
(
|
|
1021
|
+
const c = l[0], m = s.find(
|
|
1022
|
+
(p) => p.panelId === c.id
|
|
1014
1023
|
);
|
|
1015
|
-
if (C(
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1024
|
+
if (C(m, "Panel metadata not found"), m.collapsible) {
|
|
1025
|
+
const p = u[c.id], S = m.collapsedSize === p ? o.mutableState.expandedPanelSizes[c.id] ?? m.minSize : m.collapsedSize;
|
|
1026
|
+
U(t, S - p);
|
|
1018
1027
|
}
|
|
1019
1028
|
break;
|
|
1020
1029
|
}
|
|
1021
1030
|
case "F6": {
|
|
1022
1031
|
e.preventDefault();
|
|
1023
1032
|
const i = pe(t).separators.map(
|
|
1024
|
-
(
|
|
1025
|
-
),
|
|
1026
|
-
(
|
|
1033
|
+
(r) => r.element
|
|
1034
|
+
), s = Array.from(i).findIndex(
|
|
1035
|
+
(r) => r === e.currentTarget
|
|
1027
1036
|
);
|
|
1028
|
-
C(
|
|
1029
|
-
const
|
|
1030
|
-
i[
|
|
1037
|
+
C(s !== null, "Index not found");
|
|
1038
|
+
const u = e.shiftKey ? s > 0 ? s - 1 : i.length - 1 : s + 1 < i.length ? s + 1 : 0;
|
|
1039
|
+
i[u].focus({
|
|
1031
1040
|
preventScroll: !0
|
|
1032
1041
|
});
|
|
1033
1042
|
break;
|
|
1034
1043
|
}
|
|
1035
1044
|
case "Home": {
|
|
1036
|
-
e.preventDefault(),
|
|
1045
|
+
e.preventDefault(), U(t, -100);
|
|
1037
1046
|
break;
|
|
1038
1047
|
}
|
|
1039
1048
|
}
|
|
@@ -1070,14 +1079,14 @@ function Ae(e) {
|
|
|
1070
1079
|
return;
|
|
1071
1080
|
const t = X(), n = xe(e, t), o = /* @__PURE__ */ new Map();
|
|
1072
1081
|
let i = !1;
|
|
1073
|
-
n.forEach((
|
|
1074
|
-
|
|
1082
|
+
n.forEach((s) => {
|
|
1083
|
+
s.separator && (i || (i = !0, s.separator.element.focus({
|
|
1075
1084
|
// @ts-expect-error https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#browser_compatibility
|
|
1076
1085
|
focusVisible: !1,
|
|
1077
1086
|
preventScroll: !0
|
|
1078
1087
|
})));
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1088
|
+
const u = t.get(s.group);
|
|
1089
|
+
u && o.set(s.group, u.layout);
|
|
1081
1090
|
}), te({
|
|
1082
1091
|
cursorFlags: 0,
|
|
1083
1092
|
hitRegions: n,
|
|
@@ -1101,9 +1110,9 @@ function Nt({
|
|
|
1101
1110
|
switch (n) {
|
|
1102
1111
|
case "active":
|
|
1103
1112
|
case "hover":
|
|
1104
|
-
t.forEach((
|
|
1105
|
-
if (!
|
|
1106
|
-
switch (
|
|
1113
|
+
t.forEach((s) => {
|
|
1114
|
+
if (!s.mutableState.disableCursor)
|
|
1115
|
+
switch (s.orientation) {
|
|
1107
1116
|
case "horizontal": {
|
|
1108
1117
|
o++;
|
|
1109
1118
|
break;
|
|
@@ -1119,14 +1128,14 @@ function Nt({
|
|
|
1119
1128
|
switch (n) {
|
|
1120
1129
|
case "active": {
|
|
1121
1130
|
if (e && _e()) {
|
|
1122
|
-
const
|
|
1123
|
-
if (
|
|
1124
|
-
return a ? "se-resize" :
|
|
1125
|
-
if (
|
|
1126
|
-
return a ? "sw-resize" :
|
|
1131
|
+
const s = (e & ot) !== 0, u = (e & it) !== 0, a = (e & rt) !== 0, r = (e & st) !== 0;
|
|
1132
|
+
if (s)
|
|
1133
|
+
return a ? "se-resize" : r ? "ne-resize" : "e-resize";
|
|
1134
|
+
if (u)
|
|
1135
|
+
return a ? "sw-resize" : r ? "nw-resize" : "w-resize";
|
|
1127
1136
|
if (a)
|
|
1128
1137
|
return "s-resize";
|
|
1129
|
-
if (
|
|
1138
|
+
if (r)
|
|
1130
1139
|
return "n-resize";
|
|
1131
1140
|
}
|
|
1132
1141
|
break;
|
|
@@ -1150,12 +1159,12 @@ function we(e) {
|
|
|
1150
1159
|
case "hover": {
|
|
1151
1160
|
const i = Nt({
|
|
1152
1161
|
cursorFlags: o.cursorFlags,
|
|
1153
|
-
groups: o.hitRegions.map((
|
|
1162
|
+
groups: o.hitRegions.map((u) => u.group),
|
|
1154
1163
|
state: o.state
|
|
1155
|
-
}),
|
|
1156
|
-
if (t ===
|
|
1164
|
+
}), s = `*, *:hover {cursor: ${i} !important; }`;
|
|
1165
|
+
if (t === s)
|
|
1157
1166
|
return;
|
|
1158
|
-
t =
|
|
1167
|
+
t = s, i ? n.cssRules.length === 0 ? n.insertRule(s) : n.replaceSync(s) : n.cssRules.length === 1 && n.deleteRule(0);
|
|
1159
1168
|
break;
|
|
1160
1169
|
}
|
|
1161
1170
|
case "inactive": {
|
|
@@ -1174,57 +1183,57 @@ function at({
|
|
|
1174
1183
|
hitRegions: n,
|
|
1175
1184
|
initialLayoutMap: o,
|
|
1176
1185
|
mountedGroups: i,
|
|
1177
|
-
pointerDownAtPoint:
|
|
1178
|
-
prevCursorFlags:
|
|
1186
|
+
pointerDownAtPoint: s,
|
|
1187
|
+
prevCursorFlags: u
|
|
1179
1188
|
}) {
|
|
1180
1189
|
let a = 0;
|
|
1181
1190
|
n.forEach((l) => {
|
|
1182
|
-
const { group:
|
|
1183
|
-
let
|
|
1184
|
-
|
|
1185
|
-
const
|
|
1186
|
-
if (!
|
|
1191
|
+
const { group: c, groupSize: m } = l, { orientation: p, panels: S } = c, { disableCursor: z } = c.mutableState;
|
|
1192
|
+
let f = 0;
|
|
1193
|
+
s ? p === "horizontal" ? f = (t.clientX - s.x) / m * 100 : f = (t.clientY - s.y) / m * 100 : p === "horizontal" ? f = t.clientX < 0 ? -100 : 100 : f = t.clientY < 0 ? -100 : 100;
|
|
1194
|
+
const d = o.get(c), h = i.get(c);
|
|
1195
|
+
if (!d || !h)
|
|
1187
1196
|
return;
|
|
1188
1197
|
const {
|
|
1189
|
-
defaultLayoutDeferred:
|
|
1198
|
+
defaultLayoutDeferred: y,
|
|
1190
1199
|
derivedPanelConstraints: b,
|
|
1191
|
-
groupSize:
|
|
1200
|
+
groupSize: v,
|
|
1192
1201
|
layout: g,
|
|
1193
|
-
separatorToPanels:
|
|
1194
|
-
} =
|
|
1195
|
-
if (b && g &&
|
|
1202
|
+
separatorToPanels: w
|
|
1203
|
+
} = h;
|
|
1204
|
+
if (b && g && w) {
|
|
1196
1205
|
const M = le({
|
|
1197
|
-
delta:
|
|
1198
|
-
initialLayout:
|
|
1206
|
+
delta: f,
|
|
1207
|
+
initialLayout: d,
|
|
1199
1208
|
panelConstraints: b,
|
|
1200
|
-
pivotIndices: l.panels.map((
|
|
1209
|
+
pivotIndices: l.panels.map((L) => S.indexOf(L)),
|
|
1201
1210
|
prevLayout: g,
|
|
1202
1211
|
trigger: "mouse-or-touch"
|
|
1203
1212
|
});
|
|
1204
|
-
if (
|
|
1205
|
-
if (
|
|
1206
|
-
switch (
|
|
1213
|
+
if (B(M, g)) {
|
|
1214
|
+
if (f !== 0 && !z)
|
|
1215
|
+
switch (p) {
|
|
1207
1216
|
case "horizontal": {
|
|
1208
|
-
a |=
|
|
1217
|
+
a |= f < 0 ? ot : it;
|
|
1209
1218
|
break;
|
|
1210
1219
|
}
|
|
1211
1220
|
case "vertical": {
|
|
1212
|
-
a |=
|
|
1221
|
+
a |= f < 0 ? rt : st;
|
|
1213
1222
|
break;
|
|
1214
1223
|
}
|
|
1215
1224
|
}
|
|
1216
1225
|
} else
|
|
1217
|
-
|
|
1218
|
-
defaultLayoutDeferred:
|
|
1226
|
+
j(l.group, {
|
|
1227
|
+
defaultLayoutDeferred: y,
|
|
1219
1228
|
derivedPanelConstraints: b,
|
|
1220
|
-
groupSize:
|
|
1229
|
+
groupSize: v,
|
|
1221
1230
|
layout: M,
|
|
1222
|
-
separatorToPanels:
|
|
1231
|
+
separatorToPanels: w
|
|
1223
1232
|
});
|
|
1224
1233
|
}
|
|
1225
1234
|
});
|
|
1226
|
-
let
|
|
1227
|
-
t.movementX === 0 ?
|
|
1235
|
+
let r = 0;
|
|
1236
|
+
t.movementX === 0 ? r |= u & Fe : r |= a & Fe, t.movementY === 0 ? r |= u & Ne : r |= a & Ne, At(r), we(e);
|
|
1228
1237
|
}
|
|
1229
1238
|
function je(e) {
|
|
1230
1239
|
const t = X(), n = K();
|
|
@@ -1255,7 +1264,9 @@ function He(e) {
|
|
|
1255
1264
|
state: "inactive"
|
|
1256
1265
|
}), t.hitRegions.forEach((o) => {
|
|
1257
1266
|
const i = H(o.group.id, !0);
|
|
1258
|
-
|
|
1267
|
+
j(o.group, i, {
|
|
1268
|
+
isUserInteraction: !0
|
|
1269
|
+
});
|
|
1259
1270
|
});
|
|
1260
1271
|
return;
|
|
1261
1272
|
}
|
|
@@ -1299,7 +1310,7 @@ function Ve(e) {
|
|
|
1299
1310
|
});
|
|
1300
1311
|
}
|
|
1301
1312
|
}
|
|
1302
|
-
function
|
|
1313
|
+
function Ue(e) {
|
|
1303
1314
|
if (e.defaultPrevented)
|
|
1304
1315
|
return;
|
|
1305
1316
|
if (e.pointerType === "mouse" && e.button > 0)
|
|
@@ -1312,25 +1323,27 @@ function Be(e) {
|
|
|
1312
1323
|
state: "inactive"
|
|
1313
1324
|
}), t.hitRegions.length > 0 && (we(e.currentTarget), t.hitRegions.forEach((n) => {
|
|
1314
1325
|
const o = H(n.group.id, !0);
|
|
1315
|
-
|
|
1326
|
+
j(n.group, o, {
|
|
1327
|
+
isUserInteraction: !0
|
|
1328
|
+
});
|
|
1316
1329
|
}), e.preventDefault());
|
|
1317
1330
|
}
|
|
1318
1331
|
}
|
|
1319
|
-
function
|
|
1332
|
+
function Be(e) {
|
|
1320
1333
|
let t = 0, n = 0;
|
|
1321
1334
|
const o = {};
|
|
1322
|
-
for (const
|
|
1323
|
-
if (
|
|
1335
|
+
for (const s of e)
|
|
1336
|
+
if (s.defaultSize !== void 0) {
|
|
1324
1337
|
t++;
|
|
1325
|
-
const
|
|
1326
|
-
n +=
|
|
1338
|
+
const u = O(s.defaultSize);
|
|
1339
|
+
n += u, o[s.panelId] = u;
|
|
1327
1340
|
} else
|
|
1328
|
-
o[
|
|
1341
|
+
o[s.panelId] = void 0;
|
|
1329
1342
|
const i = e.length - t;
|
|
1330
1343
|
if (i !== 0) {
|
|
1331
|
-
const
|
|
1332
|
-
for (const
|
|
1333
|
-
|
|
1344
|
+
const s = O((100 - n) / i);
|
|
1345
|
+
for (const u of e)
|
|
1346
|
+
u.defaultSize === void 0 && (o[u.panelId] = s);
|
|
1334
1347
|
}
|
|
1335
1348
|
return o;
|
|
1336
1349
|
}
|
|
@@ -1340,11 +1353,11 @@ function _t(e, t, n) {
|
|
|
1340
1353
|
const i = e.panels.find((l) => l.element === t);
|
|
1341
1354
|
if (!i || !i.onResize)
|
|
1342
1355
|
return;
|
|
1343
|
-
const
|
|
1344
|
-
asPercentage: O(
|
|
1345
|
-
inPixels:
|
|
1356
|
+
const s = ne({ group: e }), u = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, a = i.mutableValues.prevSize, r = {
|
|
1357
|
+
asPercentage: O(u / s * 100),
|
|
1358
|
+
inPixels: u
|
|
1346
1359
|
};
|
|
1347
|
-
i.mutableValues.prevSize =
|
|
1360
|
+
i.mutableValues.prevSize = r, i.onResize(r, i.id, a);
|
|
1348
1361
|
}
|
|
1349
1362
|
function $t(e, t) {
|
|
1350
1363
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
@@ -1362,46 +1375,46 @@ function jt({
|
|
|
1362
1375
|
}) {
|
|
1363
1376
|
if (n <= 0 || t <= 0 || n === t)
|
|
1364
1377
|
return o;
|
|
1365
|
-
let i = 0,
|
|
1366
|
-
const a = /* @__PURE__ */ new Map(),
|
|
1367
|
-
for (const
|
|
1368
|
-
const
|
|
1369
|
-
switch (
|
|
1378
|
+
let i = 0, s = 0, u = !1;
|
|
1379
|
+
const a = /* @__PURE__ */ new Map(), r = [];
|
|
1380
|
+
for (const m of e.panels) {
|
|
1381
|
+
const p = o[m.id] ?? 0;
|
|
1382
|
+
switch (m.panelConstraints.groupResizeBehavior) {
|
|
1370
1383
|
case "preserve-pixel-size": {
|
|
1371
|
-
|
|
1372
|
-
const S =
|
|
1384
|
+
u = !0;
|
|
1385
|
+
const S = p / 100 * n, z = O(
|
|
1373
1386
|
S / t * 100
|
|
1374
1387
|
);
|
|
1375
|
-
a.set(
|
|
1388
|
+
a.set(m.id, z), i += z;
|
|
1376
1389
|
break;
|
|
1377
1390
|
}
|
|
1378
1391
|
case "preserve-relative-size":
|
|
1379
1392
|
default: {
|
|
1380
|
-
|
|
1393
|
+
r.push(m.id), s += p;
|
|
1381
1394
|
break;
|
|
1382
1395
|
}
|
|
1383
1396
|
}
|
|
1384
1397
|
}
|
|
1385
|
-
if (!
|
|
1398
|
+
if (!u || r.length === 0)
|
|
1386
1399
|
return o;
|
|
1387
|
-
const l = 100 - i,
|
|
1388
|
-
if (a.forEach((
|
|
1389
|
-
|
|
1390
|
-
}),
|
|
1391
|
-
for (const
|
|
1392
|
-
const
|
|
1393
|
-
|
|
1394
|
-
|
|
1400
|
+
const l = 100 - i, c = { ...o };
|
|
1401
|
+
if (a.forEach((m, p) => {
|
|
1402
|
+
c[p] = m;
|
|
1403
|
+
}), s > 0)
|
|
1404
|
+
for (const m of r) {
|
|
1405
|
+
const p = o[m] ?? 0;
|
|
1406
|
+
c[m] = O(
|
|
1407
|
+
p / s * l
|
|
1395
1408
|
);
|
|
1396
1409
|
}
|
|
1397
1410
|
else {
|
|
1398
|
-
const
|
|
1399
|
-
l /
|
|
1411
|
+
const m = O(
|
|
1412
|
+
l / r.length
|
|
1400
1413
|
);
|
|
1401
|
-
for (const
|
|
1402
|
-
|
|
1414
|
+
for (const p of r)
|
|
1415
|
+
c[p] = m;
|
|
1403
1416
|
}
|
|
1404
|
-
return
|
|
1417
|
+
return c;
|
|
1405
1418
|
}
|
|
1406
1419
|
function Ht(e, t) {
|
|
1407
1420
|
const n = e.map((i) => i.id), o = Object.keys(t);
|
|
@@ -1419,92 +1432,92 @@ function Vt(e) {
|
|
|
1419
1432
|
e.element.ownerDocument.defaultView,
|
|
1420
1433
|
"Cannot register an unmounted Group"
|
|
1421
1434
|
);
|
|
1422
|
-
const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(),
|
|
1423
|
-
for (const
|
|
1424
|
-
const { borderBoxSize:
|
|
1425
|
-
if (
|
|
1435
|
+
const n = e.element.ownerDocument.defaultView.ResizeObserver, o = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set(), s = new n((f) => {
|
|
1436
|
+
for (const d of f) {
|
|
1437
|
+
const { borderBoxSize: h, target: y } = d;
|
|
1438
|
+
if (y === e.element) {
|
|
1426
1439
|
if (t) {
|
|
1427
1440
|
const b = ne({ group: e });
|
|
1428
1441
|
if (b === 0)
|
|
1429
1442
|
return;
|
|
1430
|
-
const
|
|
1431
|
-
if (!
|
|
1443
|
+
const v = H(e.id);
|
|
1444
|
+
if (!v)
|
|
1432
1445
|
return;
|
|
1433
|
-
const g = ve(e),
|
|
1446
|
+
const g = ve(e), w = v.defaultLayoutDeferred ? Be(g) : v.layout, M = jt({
|
|
1434
1447
|
group: e,
|
|
1435
1448
|
nextGroupSize: b,
|
|
1436
|
-
prevGroupSize:
|
|
1437
|
-
prevLayout:
|
|
1438
|
-
}),
|
|
1449
|
+
prevGroupSize: v.groupSize,
|
|
1450
|
+
prevLayout: w
|
|
1451
|
+
}), L = W({
|
|
1439
1452
|
layout: M,
|
|
1440
1453
|
panelConstraints: g
|
|
1441
1454
|
});
|
|
1442
|
-
if (!
|
|
1443
|
-
|
|
1455
|
+
if (!v.defaultLayoutDeferred && B(v.layout, L) && $t(
|
|
1456
|
+
v.derivedPanelConstraints,
|
|
1444
1457
|
g
|
|
1445
|
-
) &&
|
|
1458
|
+
) && v.groupSize === b)
|
|
1446
1459
|
return;
|
|
1447
|
-
|
|
1460
|
+
j(e, {
|
|
1448
1461
|
defaultLayoutDeferred: !1,
|
|
1449
1462
|
derivedPanelConstraints: g,
|
|
1450
1463
|
groupSize: b,
|
|
1451
|
-
layout:
|
|
1452
|
-
separatorToPanels:
|
|
1464
|
+
layout: L,
|
|
1465
|
+
separatorToPanels: v.separatorToPanels
|
|
1453
1466
|
});
|
|
1454
1467
|
}
|
|
1455
1468
|
} else
|
|
1456
|
-
_t(e,
|
|
1469
|
+
_t(e, y, h);
|
|
1457
1470
|
}
|
|
1458
1471
|
});
|
|
1459
|
-
|
|
1472
|
+
s.observe(e.element), e.panels.forEach((f) => {
|
|
1460
1473
|
C(
|
|
1461
|
-
!o.has(
|
|
1462
|
-
`Panel ids must be unique; id "${
|
|
1463
|
-
), o.add(
|
|
1474
|
+
!o.has(f.id),
|
|
1475
|
+
`Panel ids must be unique; id "${f.id}" was used more than once`
|
|
1476
|
+
), o.add(f.id), f.onResize && s.observe(f.element);
|
|
1464
1477
|
});
|
|
1465
|
-
const
|
|
1478
|
+
const u = ne({ group: e }), a = ve(e), r = e.panels.map(({ id: f }) => f).join(",");
|
|
1466
1479
|
let l = e.mutableState.defaultLayout;
|
|
1467
1480
|
l && (Ht(e.panels, l) || (l = void 0));
|
|
1468
|
-
const
|
|
1469
|
-
layout:
|
|
1481
|
+
const c = e.mutableState.layouts[r] ?? l ?? Be(a), m = W({
|
|
1482
|
+
layout: c,
|
|
1470
1483
|
panelConstraints: a
|
|
1471
|
-
}),
|
|
1484
|
+
}), p = e.element.ownerDocument;
|
|
1472
1485
|
J.set(
|
|
1473
|
-
|
|
1474
|
-
(J.get(
|
|
1486
|
+
p,
|
|
1487
|
+
(J.get(p) ?? 0) + 1
|
|
1475
1488
|
);
|
|
1476
1489
|
const S = /* @__PURE__ */ new Map();
|
|
1477
|
-
return Je(e).forEach((
|
|
1478
|
-
|
|
1479
|
-
}),
|
|
1480
|
-
defaultLayoutDeferred:
|
|
1490
|
+
return Je(e).forEach((f) => {
|
|
1491
|
+
f.separator && S.set(f.separator, f.panels);
|
|
1492
|
+
}), j(e, {
|
|
1493
|
+
defaultLayoutDeferred: u === 0,
|
|
1481
1494
|
derivedPanelConstraints: a,
|
|
1482
|
-
groupSize:
|
|
1483
|
-
layout:
|
|
1495
|
+
groupSize: u,
|
|
1496
|
+
layout: m,
|
|
1484
1497
|
separatorToPanels: S
|
|
1485
|
-
}), e.separators.forEach((
|
|
1498
|
+
}), e.separators.forEach((f) => {
|
|
1486
1499
|
C(
|
|
1487
|
-
!i.has(
|
|
1488
|
-
`Separator ids must be unique; id "${
|
|
1489
|
-
), i.add(
|
|
1490
|
-
}), J.get(
|
|
1500
|
+
!i.has(f.id),
|
|
1501
|
+
`Separator ids must be unique; id "${f.id}" was used more than once`
|
|
1502
|
+
), i.add(f.id), f.element.addEventListener("keydown", Ge);
|
|
1503
|
+
}), J.get(p) === 1 && (p.addEventListener("dblclick", Te, !0), p.addEventListener("pointerdown", Ae, !0), p.addEventListener("pointerleave", je), p.addEventListener("pointermove", He), p.addEventListener("pointerout", Ve), p.addEventListener("pointerup", Ue, !0)), function() {
|
|
1491
1504
|
t = !1, J.set(
|
|
1492
|
-
|
|
1493
|
-
Math.max(0, (J.get(
|
|
1494
|
-
), Lt(e), e.separators.forEach((
|
|
1495
|
-
|
|
1496
|
-
}), J.get(
|
|
1505
|
+
p,
|
|
1506
|
+
Math.max(0, (J.get(p) ?? 0) - 1)
|
|
1507
|
+
), Lt(e), e.separators.forEach((d) => {
|
|
1508
|
+
d.element.removeEventListener("keydown", Ge);
|
|
1509
|
+
}), J.get(p) || (p.removeEventListener(
|
|
1497
1510
|
"dblclick",
|
|
1498
1511
|
Te,
|
|
1499
1512
|
!0
|
|
1500
|
-
),
|
|
1513
|
+
), p.removeEventListener(
|
|
1501
1514
|
"pointerdown",
|
|
1502
1515
|
Ae,
|
|
1503
1516
|
!0
|
|
1504
|
-
),
|
|
1517
|
+
), p.removeEventListener("pointerleave", je), p.removeEventListener("pointermove", He), p.removeEventListener("pointerout", Ve), p.removeEventListener("pointerup", Ue, !0)), s.disconnect();
|
|
1505
1518
|
};
|
|
1506
1519
|
}
|
|
1507
|
-
function
|
|
1520
|
+
function Ut() {
|
|
1508
1521
|
const [e, t] = Q({}), n = re(() => t({}), []);
|
|
1509
1522
|
return [e, n];
|
|
1510
1523
|
}
|
|
@@ -1512,7 +1525,7 @@ function Le(e) {
|
|
|
1512
1525
|
const t = pt();
|
|
1513
1526
|
return `${e ?? t}`;
|
|
1514
1527
|
}
|
|
1515
|
-
const q = typeof window < "u" ?
|
|
1528
|
+
const q = typeof window < "u" ? We : me;
|
|
1516
1529
|
function se(e) {
|
|
1517
1530
|
const t = T(e);
|
|
1518
1531
|
return q(() => {
|
|
@@ -1547,7 +1560,7 @@ function Re(e) {
|
|
|
1547
1560
|
}, [e]), t.current;
|
|
1548
1561
|
}
|
|
1549
1562
|
const lt = ht(null);
|
|
1550
|
-
function
|
|
1563
|
+
function Bt(e, t) {
|
|
1551
1564
|
const n = T({
|
|
1552
1565
|
getLayout: () => ({}),
|
|
1553
1566
|
setLayout: Ft
|
|
@@ -1559,184 +1572,186 @@ function Wt(e, t) {
|
|
|
1559
1572
|
);
|
|
1560
1573
|
});
|
|
1561
1574
|
}
|
|
1562
|
-
function
|
|
1575
|
+
function Wt({
|
|
1563
1576
|
children: e,
|
|
1564
1577
|
className: t,
|
|
1565
1578
|
defaultLayout: n,
|
|
1566
1579
|
disableCursor: o,
|
|
1567
1580
|
disabled: i,
|
|
1568
|
-
elementRef:
|
|
1569
|
-
groupRef:
|
|
1581
|
+
elementRef: s,
|
|
1582
|
+
groupRef: u,
|
|
1570
1583
|
id: a,
|
|
1571
|
-
onLayoutChange:
|
|
1584
|
+
onLayoutChange: r,
|
|
1572
1585
|
onLayoutChanged: l,
|
|
1573
|
-
orientation:
|
|
1574
|
-
resizeTargetMinimumSize:
|
|
1586
|
+
orientation: c = "horizontal",
|
|
1587
|
+
resizeTargetMinimumSize: m = {
|
|
1575
1588
|
coarse: 20,
|
|
1576
1589
|
fine: 10
|
|
1577
1590
|
},
|
|
1578
|
-
style:
|
|
1591
|
+
style: p,
|
|
1579
1592
|
...S
|
|
1580
1593
|
}) {
|
|
1581
1594
|
const z = T({
|
|
1582
1595
|
onLayoutChange: {},
|
|
1583
1596
|
onLayoutChanged: {}
|
|
1584
|
-
}),
|
|
1585
|
-
|
|
1586
|
-
}),
|
|
1587
|
-
|
|
1588
|
-
|
|
1597
|
+
}), f = se((x) => {
|
|
1598
|
+
B(z.current.onLayoutChange, x) || (z.current.onLayoutChange = x, r?.(x));
|
|
1599
|
+
}), d = se(
|
|
1600
|
+
(x, P) => {
|
|
1601
|
+
B(z.current.onLayoutChanged, x) || (z.current.onLayoutChanged = x, l?.(x, { isUserInteraction: P }));
|
|
1602
|
+
}
|
|
1603
|
+
), h = Le(a), y = T(null), [b, v] = Ut(), g = T({
|
|
1589
1604
|
lastExpandedPanelSizes: {},
|
|
1590
1605
|
layouts: {},
|
|
1591
1606
|
panels: [],
|
|
1592
|
-
resizeTargetMinimumSize:
|
|
1607
|
+
resizeTargetMinimumSize: m,
|
|
1593
1608
|
separators: []
|
|
1594
|
-
}),
|
|
1595
|
-
|
|
1609
|
+
}), w = Ce(y, s);
|
|
1610
|
+
Bt(h, u);
|
|
1596
1611
|
const M = se(
|
|
1597
|
-
(x,
|
|
1598
|
-
const
|
|
1612
|
+
(x, P) => {
|
|
1613
|
+
const I = K(), R = Ie(x), E = H(x);
|
|
1599
1614
|
if (E) {
|
|
1600
1615
|
let D = !1;
|
|
1601
|
-
switch (
|
|
1616
|
+
switch (I.state) {
|
|
1602
1617
|
case "active": {
|
|
1603
|
-
D =
|
|
1618
|
+
D = I.hitRegions.some(
|
|
1604
1619
|
(V) => V.group === R
|
|
1605
1620
|
);
|
|
1606
1621
|
break;
|
|
1607
1622
|
}
|
|
1608
1623
|
}
|
|
1609
1624
|
return {
|
|
1610
|
-
flexGrow: E.layout[
|
|
1625
|
+
flexGrow: E.layout[P] ?? 1,
|
|
1611
1626
|
pointerEvents: D ? "none" : void 0
|
|
1612
1627
|
};
|
|
1613
1628
|
}
|
|
1614
|
-
if (n?.[
|
|
1629
|
+
if (n?.[P])
|
|
1615
1630
|
return {
|
|
1616
|
-
flexGrow: n?.[
|
|
1631
|
+
flexGrow: n?.[P]
|
|
1617
1632
|
};
|
|
1618
1633
|
}
|
|
1619
|
-
),
|
|
1634
|
+
), L = Re({
|
|
1620
1635
|
defaultLayout: n,
|
|
1621
1636
|
disableCursor: o
|
|
1622
1637
|
}), G = Se(
|
|
1623
1638
|
() => ({
|
|
1624
1639
|
get disableCursor() {
|
|
1625
|
-
return !!
|
|
1640
|
+
return !!L.disableCursor;
|
|
1626
1641
|
},
|
|
1627
1642
|
getPanelStyles: M,
|
|
1628
|
-
id:
|
|
1629
|
-
orientation:
|
|
1643
|
+
id: h,
|
|
1644
|
+
orientation: c,
|
|
1630
1645
|
registerPanel: (x) => {
|
|
1631
|
-
const
|
|
1632
|
-
return
|
|
1633
|
-
...
|
|
1646
|
+
const P = g.current;
|
|
1647
|
+
return P.panels = be(c, [
|
|
1648
|
+
...P.panels,
|
|
1634
1649
|
x
|
|
1635
|
-
]),
|
|
1636
|
-
|
|
1637
|
-
(
|
|
1638
|
-
),
|
|
1650
|
+
]), v(), () => {
|
|
1651
|
+
P.panels = P.panels.filter(
|
|
1652
|
+
(I) => I !== x
|
|
1653
|
+
), v();
|
|
1639
1654
|
};
|
|
1640
1655
|
},
|
|
1641
1656
|
registerSeparator: (x) => {
|
|
1642
|
-
const
|
|
1643
|
-
return
|
|
1644
|
-
...
|
|
1657
|
+
const P = g.current;
|
|
1658
|
+
return P.separators = be(c, [
|
|
1659
|
+
...P.separators,
|
|
1645
1660
|
x
|
|
1646
|
-
]),
|
|
1647
|
-
|
|
1648
|
-
(
|
|
1649
|
-
),
|
|
1661
|
+
]), v(), () => {
|
|
1662
|
+
P.separators = P.separators.filter(
|
|
1663
|
+
(I) => I !== x
|
|
1664
|
+
), v();
|
|
1650
1665
|
};
|
|
1651
1666
|
},
|
|
1652
|
-
updatePanelProps: (x, { disabled:
|
|
1667
|
+
updatePanelProps: (x, { disabled: P }) => {
|
|
1653
1668
|
const R = g.current.panels.find(
|
|
1654
1669
|
(V) => V.id === x
|
|
1655
1670
|
);
|
|
1656
|
-
R && (R.panelConstraints.disabled =
|
|
1657
|
-
const E =
|
|
1658
|
-
E && D &&
|
|
1671
|
+
R && (R.panelConstraints.disabled = P);
|
|
1672
|
+
const E = Ie(h), D = H(h);
|
|
1673
|
+
E && D && j(E, {
|
|
1659
1674
|
...D,
|
|
1660
1675
|
derivedPanelConstraints: ve(E)
|
|
1661
1676
|
});
|
|
1662
1677
|
},
|
|
1663
1678
|
updateSeparatorProps: (x, {
|
|
1664
|
-
disabled:
|
|
1665
|
-
disableDoubleClick:
|
|
1679
|
+
disabled: P,
|
|
1680
|
+
disableDoubleClick: I
|
|
1666
1681
|
}) => {
|
|
1667
1682
|
const E = g.current.separators.find(
|
|
1668
1683
|
(D) => D.id === x
|
|
1669
1684
|
);
|
|
1670
|
-
E && (E.disabled =
|
|
1685
|
+
E && (E.disabled = P, E.disableDoubleClick = I);
|
|
1671
1686
|
}
|
|
1672
1687
|
}),
|
|
1673
|
-
[M,
|
|
1688
|
+
[M, h, v, c, L]
|
|
1674
1689
|
), N = T(null);
|
|
1675
1690
|
return q(() => {
|
|
1676
|
-
const x =
|
|
1691
|
+
const x = y.current;
|
|
1677
1692
|
if (x === null)
|
|
1678
1693
|
return;
|
|
1679
|
-
const
|
|
1680
|
-
let
|
|
1681
|
-
if (
|
|
1682
|
-
|
|
1683
|
-
for (const
|
|
1684
|
-
const Y =
|
|
1685
|
-
Y !== void 0 && (
|
|
1694
|
+
const P = g.current;
|
|
1695
|
+
let I;
|
|
1696
|
+
if (L.defaultLayout !== void 0 && Object.keys(L.defaultLayout).length === P.panels.length) {
|
|
1697
|
+
I = {};
|
|
1698
|
+
for (const _ of P.panels) {
|
|
1699
|
+
const Y = L.defaultLayout[_.id];
|
|
1700
|
+
Y !== void 0 && (I[_.id] = Y);
|
|
1686
1701
|
}
|
|
1687
1702
|
}
|
|
1688
1703
|
const R = {
|
|
1689
1704
|
disabled: !!i,
|
|
1690
1705
|
element: x,
|
|
1691
|
-
id:
|
|
1706
|
+
id: h,
|
|
1692
1707
|
mutableState: {
|
|
1693
|
-
defaultLayout:
|
|
1694
|
-
disableCursor: !!
|
|
1708
|
+
defaultLayout: I,
|
|
1709
|
+
disableCursor: !!L.disableCursor,
|
|
1695
1710
|
expandedPanelSizes: g.current.lastExpandedPanelSizes,
|
|
1696
1711
|
layouts: g.current.layouts
|
|
1697
1712
|
},
|
|
1698
|
-
orientation:
|
|
1699
|
-
panels:
|
|
1700
|
-
resizeTargetMinimumSize:
|
|
1701
|
-
separators:
|
|
1713
|
+
orientation: c,
|
|
1714
|
+
panels: P.panels,
|
|
1715
|
+
resizeTargetMinimumSize: P.resizeTargetMinimumSize,
|
|
1716
|
+
separators: P.separators
|
|
1702
1717
|
};
|
|
1703
1718
|
N.current = R;
|
|
1704
1719
|
const E = Vt(R), { defaultLayoutDeferred: D, derivedPanelConstraints: V, layout: ue } = H(R.id, !0);
|
|
1705
|
-
!D && V.length > 0 && (
|
|
1706
|
-
const oe = ze(
|
|
1707
|
-
const { defaultLayoutDeferred: Y, derivedPanelConstraints: Ee, layout: ce } =
|
|
1720
|
+
!D && V.length > 0 && (f(ue), d(ue, !1));
|
|
1721
|
+
const oe = ze(h, (_) => {
|
|
1722
|
+
const { defaultLayoutDeferred: Y, derivedPanelConstraints: Ee, layout: ce } = _.next;
|
|
1708
1723
|
if (Y || Ee.length === 0)
|
|
1709
1724
|
return;
|
|
1710
|
-
const ut = R.panels.map(({ id:
|
|
1711
|
-
R.mutableState.layouts[ut] = ce, Ee.forEach((
|
|
1712
|
-
if (
|
|
1713
|
-
const { layout: ge } =
|
|
1725
|
+
const ut = R.panels.map(({ id: $ }) => $).join(",");
|
|
1726
|
+
R.mutableState.layouts[ut] = ce, Ee.forEach(($) => {
|
|
1727
|
+
if ($.collapsible) {
|
|
1728
|
+
const { layout: ge } = _.prev ?? {};
|
|
1714
1729
|
if (ge) {
|
|
1715
|
-
const ft =
|
|
1716
|
-
|
|
1717
|
-
ce[
|
|
1718
|
-
), dt =
|
|
1719
|
-
|
|
1720
|
-
ge[
|
|
1730
|
+
const ft = k(
|
|
1731
|
+
$.collapsedSize,
|
|
1732
|
+
ce[$.panelId]
|
|
1733
|
+
), dt = k(
|
|
1734
|
+
$.collapsedSize,
|
|
1735
|
+
ge[$.panelId]
|
|
1721
1736
|
);
|
|
1722
|
-
ft && !dt && (R.mutableState.expandedPanelSizes[
|
|
1737
|
+
ft && !dt && (R.mutableState.expandedPanelSizes[$.panelId] = ge[$.panelId]);
|
|
1723
1738
|
}
|
|
1724
1739
|
}
|
|
1725
1740
|
});
|
|
1726
1741
|
const ct = K().state !== "active";
|
|
1727
|
-
|
|
1742
|
+
f(ce), ct && d(ce, _.isUserInteraction);
|
|
1728
1743
|
});
|
|
1729
1744
|
return () => {
|
|
1730
1745
|
N.current = null, E(), oe();
|
|
1731
1746
|
};
|
|
1732
1747
|
}, [
|
|
1733
1748
|
i,
|
|
1734
|
-
|
|
1735
|
-
|
|
1749
|
+
h,
|
|
1750
|
+
d,
|
|
1751
|
+
f,
|
|
1736
1752
|
c,
|
|
1737
|
-
u,
|
|
1738
1753
|
b,
|
|
1739
|
-
|
|
1754
|
+
L
|
|
1740
1755
|
]), me(() => {
|
|
1741
1756
|
const x = N.current;
|
|
1742
1757
|
x && (x.mutableState.defaultLayout = n, x.mutableState.disableCursor = !!o);
|
|
@@ -1746,28 +1761,28 @@ function Ut({
|
|
|
1746
1761
|
...S,
|
|
1747
1762
|
className: t,
|
|
1748
1763
|
"data-group": !0,
|
|
1749
|
-
"data-testid":
|
|
1750
|
-
id:
|
|
1751
|
-
ref:
|
|
1764
|
+
"data-testid": h,
|
|
1765
|
+
id: h,
|
|
1766
|
+
ref: w,
|
|
1752
1767
|
style: {
|
|
1753
1768
|
height: "100%",
|
|
1754
1769
|
width: "100%",
|
|
1755
1770
|
overflow: "hidden",
|
|
1756
|
-
...
|
|
1771
|
+
...p,
|
|
1757
1772
|
display: "flex",
|
|
1758
|
-
flexDirection:
|
|
1773
|
+
flexDirection: c === "horizontal" ? "row" : "column",
|
|
1759
1774
|
flexWrap: "nowrap",
|
|
1760
1775
|
// Inform the browser that the library is handling touch events for this element
|
|
1761
1776
|
// but still allow users to scroll content within panels in the non-resizing direction
|
|
1762
1777
|
// NOTE This is not an inherited style
|
|
1763
1778
|
// See github.com/bvaughn/react-resizable-panels/issues/662
|
|
1764
|
-
touchAction:
|
|
1779
|
+
touchAction: c === "horizontal" ? "pan-y" : "pan-x"
|
|
1765
1780
|
},
|
|
1766
1781
|
children: e
|
|
1767
1782
|
}
|
|
1768
1783
|
) });
|
|
1769
1784
|
}
|
|
1770
|
-
|
|
1785
|
+
Wt.displayName = "Group";
|
|
1771
1786
|
function he(e, t) {
|
|
1772
1787
|
return `react-resizable-panels:${[e, ...t].join(":")}`;
|
|
1773
1788
|
}
|
|
@@ -1779,25 +1794,25 @@ function Kt({
|
|
|
1779
1794
|
const o = he(e, []), i = n.getItem(o);
|
|
1780
1795
|
if (i)
|
|
1781
1796
|
try {
|
|
1782
|
-
const
|
|
1797
|
+
const s = JSON.parse(i);
|
|
1783
1798
|
if (t) {
|
|
1784
|
-
const
|
|
1799
|
+
const u = t.join(","), a = s[u];
|
|
1785
1800
|
if (a && Array.isArray(a.layout) && t.length === a.layout.length) {
|
|
1786
|
-
const
|
|
1801
|
+
const r = {};
|
|
1787
1802
|
for (let l = 0; l < t.length; l++)
|
|
1788
|
-
|
|
1789
|
-
return
|
|
1803
|
+
r[t[l]] = a.layout[l];
|
|
1804
|
+
return r;
|
|
1790
1805
|
}
|
|
1791
1806
|
} else {
|
|
1792
|
-
const
|
|
1793
|
-
if (
|
|
1794
|
-
const a =
|
|
1807
|
+
const u = Object.keys(s);
|
|
1808
|
+
if (u.length === 1) {
|
|
1809
|
+
const a = s[u[0]];
|
|
1795
1810
|
if (a && Array.isArray(a.layout)) {
|
|
1796
|
-
const
|
|
1797
|
-
if (
|
|
1811
|
+
const r = u[0].split(",");
|
|
1812
|
+
if (r.length === a.layout.length) {
|
|
1798
1813
|
const l = {};
|
|
1799
|
-
for (let
|
|
1800
|
-
l[
|
|
1814
|
+
for (let c = 0; c < r.length; c++)
|
|
1815
|
+
l[r[c]] = a.layout[c];
|
|
1801
1816
|
return l;
|
|
1802
1817
|
}
|
|
1803
1818
|
}
|
|
@@ -1808,69 +1823,83 @@ function Kt({
|
|
|
1808
1823
|
}
|
|
1809
1824
|
function on({
|
|
1810
1825
|
debounceSaveMs: e = 100,
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1826
|
+
onlySaveAfterUserInteractions: t,
|
|
1827
|
+
panelIds: n,
|
|
1828
|
+
storage: o = localStorage,
|
|
1829
|
+
...i
|
|
1814
1830
|
}) {
|
|
1815
|
-
const
|
|
1831
|
+
const s = n !== void 0, u = "id" in i ? i.id : i.groupId, a = he(u, n ?? []), r = Xe(
|
|
1816
1832
|
Xt,
|
|
1817
|
-
() =>
|
|
1818
|
-
() =>
|
|
1819
|
-
),
|
|
1820
|
-
if (
|
|
1821
|
-
const
|
|
1822
|
-
if (Array.from(
|
|
1823
|
-
return
|
|
1833
|
+
() => o.getItem(a),
|
|
1834
|
+
() => o.getItem(a)
|
|
1835
|
+
), l = Se(() => {
|
|
1836
|
+
if (r) {
|
|
1837
|
+
const d = JSON.parse(r), h = Object.values(d);
|
|
1838
|
+
if (Array.from(h).every((y) => typeof y == "number"))
|
|
1839
|
+
return d;
|
|
1824
1840
|
}
|
|
1825
|
-
}, [
|
|
1826
|
-
if (!
|
|
1841
|
+
}, [r]), c = Se(() => {
|
|
1842
|
+
if (!l)
|
|
1827
1843
|
return Kt({
|
|
1828
|
-
id:
|
|
1829
|
-
panelIds:
|
|
1830
|
-
storage:
|
|
1844
|
+
id: u,
|
|
1845
|
+
panelIds: n,
|
|
1846
|
+
storage: o
|
|
1831
1847
|
});
|
|
1832
|
-
}, [
|
|
1833
|
-
const
|
|
1834
|
-
|
|
1848
|
+
}, [l, u, n, o]), m = l ?? c, p = T(null), S = re(() => {
|
|
1849
|
+
const d = p.current;
|
|
1850
|
+
d && (p.current = null, clearTimeout(d));
|
|
1835
1851
|
}, []);
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
}, [
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1852
|
+
We(() => () => {
|
|
1853
|
+
S();
|
|
1854
|
+
}, [S]);
|
|
1855
|
+
const z = re(
|
|
1856
|
+
// The hook persists every layout commit -- including library-driven ones --
|
|
1857
|
+
// because it owns its own storage and the goal is to remember whatever
|
|
1858
|
+
// layout the user is currently looking at. Consumers that only want to
|
|
1859
|
+
// persist on user interaction should branch on `isUserInteraction` in
|
|
1860
|
+
// their own callback (see #716) rather than via this hook.
|
|
1861
|
+
(d, h) => {
|
|
1862
|
+
if (t && !h.isUserInteraction)
|
|
1863
|
+
return;
|
|
1864
|
+
S();
|
|
1865
|
+
let y;
|
|
1866
|
+
s ? y = he(u, Object.keys(d)) : y = he(u, []);
|
|
1844
1867
|
try {
|
|
1845
|
-
|
|
1846
|
-
} catch (
|
|
1847
|
-
console.error(
|
|
1868
|
+
o.setItem(y, JSON.stringify(d));
|
|
1869
|
+
} catch (b) {
|
|
1870
|
+
console.error(b);
|
|
1848
1871
|
}
|
|
1849
1872
|
},
|
|
1850
|
-
[
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1873
|
+
[
|
|
1874
|
+
S,
|
|
1875
|
+
s,
|
|
1876
|
+
u,
|
|
1877
|
+
t,
|
|
1878
|
+
o
|
|
1879
|
+
]
|
|
1880
|
+
), f = re(
|
|
1881
|
+
(d) => {
|
|
1882
|
+
S(), e === 0 ? z(d, { isUserInteraction: !1 }) : p.current = setTimeout(() => {
|
|
1883
|
+
z(d, { isUserInteraction: !1 });
|
|
1855
1884
|
}, e);
|
|
1856
1885
|
},
|
|
1857
|
-
[
|
|
1886
|
+
[S, e, z]
|
|
1858
1887
|
);
|
|
1859
1888
|
return {
|
|
1860
1889
|
/**
|
|
1861
1890
|
* Pass this value to `Group` as the `defaultLayout` prop.
|
|
1862
1891
|
*/
|
|
1863
|
-
defaultLayout:
|
|
1892
|
+
defaultLayout: m,
|
|
1864
1893
|
/**
|
|
1865
1894
|
* Attach this callback on the `Group` as the `onLayoutChange` prop.
|
|
1866
1895
|
*
|
|
1867
1896
|
* @deprecated Use the {@link onLayoutChanged} prop instead.
|
|
1868
1897
|
*/
|
|
1869
|
-
onLayoutChange:
|
|
1898
|
+
onLayoutChange: f,
|
|
1870
1899
|
/**
|
|
1871
1900
|
* Attach this callback on the `Group` as the `onLayoutChanged` prop.
|
|
1872
1901
|
*/
|
|
1873
|
-
onLayoutChanged:
|
|
1902
|
+
onLayoutChanged: z
|
|
1874
1903
|
};
|
|
1875
1904
|
}
|
|
1876
1905
|
function Xt() {
|
|
@@ -1914,37 +1943,37 @@ function Yt({
|
|
|
1914
1943
|
collapsedSize: n = "0%",
|
|
1915
1944
|
collapsible: o = !1,
|
|
1916
1945
|
defaultSize: i,
|
|
1917
|
-
disabled:
|
|
1918
|
-
elementRef:
|
|
1946
|
+
disabled: s,
|
|
1947
|
+
elementRef: u,
|
|
1919
1948
|
groupResizeBehavior: a = "preserve-relative-size",
|
|
1920
|
-
id:
|
|
1949
|
+
id: r,
|
|
1921
1950
|
maxSize: l = "100%",
|
|
1922
|
-
minSize:
|
|
1923
|
-
onResize:
|
|
1924
|
-
panelRef:
|
|
1951
|
+
minSize: c = "0%",
|
|
1952
|
+
onResize: m,
|
|
1953
|
+
panelRef: p,
|
|
1925
1954
|
style: S,
|
|
1926
1955
|
...z
|
|
1927
1956
|
}) {
|
|
1928
|
-
const
|
|
1929
|
-
disabled:
|
|
1930
|
-
}),
|
|
1931
|
-
getPanelStyles:
|
|
1957
|
+
const f = !!r, d = Le(r), h = Re({
|
|
1958
|
+
disabled: s
|
|
1959
|
+
}), y = T(null), b = Ce(y, u), {
|
|
1960
|
+
getPanelStyles: v,
|
|
1932
1961
|
id: g,
|
|
1933
|
-
orientation:
|
|
1962
|
+
orientation: w,
|
|
1934
1963
|
registerPanel: M,
|
|
1935
|
-
updatePanelProps:
|
|
1936
|
-
} = Me(), G =
|
|
1964
|
+
updatePanelProps: L
|
|
1965
|
+
} = Me(), G = m !== null, N = se(
|
|
1937
1966
|
(R, E, D) => {
|
|
1938
|
-
|
|
1967
|
+
m?.(R, r, D);
|
|
1939
1968
|
}
|
|
1940
1969
|
);
|
|
1941
1970
|
q(() => {
|
|
1942
|
-
const R =
|
|
1971
|
+
const R = y.current;
|
|
1943
1972
|
if (R !== null) {
|
|
1944
1973
|
const E = {
|
|
1945
1974
|
element: R,
|
|
1946
|
-
id:
|
|
1947
|
-
idIsStable:
|
|
1975
|
+
id: d,
|
|
1976
|
+
idIsStable: f,
|
|
1948
1977
|
mutableValues: {
|
|
1949
1978
|
expandToSize: void 0,
|
|
1950
1979
|
prevSize: void 0
|
|
@@ -1955,9 +1984,9 @@ function Yt({
|
|
|
1955
1984
|
collapsedSize: n,
|
|
1956
1985
|
collapsible: o,
|
|
1957
1986
|
defaultSize: i,
|
|
1958
|
-
disabled:
|
|
1987
|
+
disabled: h.disabled,
|
|
1959
1988
|
maxSize: l,
|
|
1960
|
-
minSize:
|
|
1989
|
+
minSize: c
|
|
1961
1990
|
}
|
|
1962
1991
|
};
|
|
1963
1992
|
return M(E);
|
|
@@ -1968,38 +1997,38 @@ function Yt({
|
|
|
1968
1997
|
o,
|
|
1969
1998
|
i,
|
|
1970
1999
|
G,
|
|
1971
|
-
|
|
1972
|
-
|
|
2000
|
+
d,
|
|
2001
|
+
f,
|
|
1973
2002
|
l,
|
|
1974
|
-
|
|
2003
|
+
c,
|
|
1975
2004
|
N,
|
|
1976
2005
|
M,
|
|
1977
|
-
|
|
2006
|
+
h
|
|
1978
2007
|
]), me(() => {
|
|
1979
|
-
|
|
1980
|
-
}, [
|
|
2008
|
+
L(d, { disabled: s });
|
|
2009
|
+
}, [s, d, L]), qt(d, p);
|
|
1981
2010
|
const x = () => {
|
|
1982
|
-
const R =
|
|
2011
|
+
const R = v(g, d);
|
|
1983
2012
|
if (R)
|
|
1984
2013
|
return JSON.stringify(R);
|
|
1985
|
-
},
|
|
2014
|
+
}, P = Xe(
|
|
1986
2015
|
(R) => ze(g, R),
|
|
1987
2016
|
x,
|
|
1988
2017
|
x
|
|
1989
2018
|
);
|
|
1990
|
-
let
|
|
1991
|
-
return
|
|
2019
|
+
let I;
|
|
2020
|
+
return P ? I = JSON.parse(P) : i !== void 0 ? I = {
|
|
1992
2021
|
flexGrow: void 0,
|
|
1993
2022
|
flexShrink: void 0,
|
|
1994
2023
|
flexBasis: i
|
|
1995
|
-
} :
|
|
2024
|
+
} : I = { flexGrow: 1 }, /* @__PURE__ */ ae(
|
|
1996
2025
|
"div",
|
|
1997
2026
|
{
|
|
1998
2027
|
...z,
|
|
1999
|
-
"data-disabled":
|
|
2028
|
+
"data-disabled": s || void 0,
|
|
2000
2029
|
"data-panel": !0,
|
|
2001
|
-
"data-testid":
|
|
2002
|
-
id:
|
|
2030
|
+
"data-testid": d,
|
|
2031
|
+
id: d,
|
|
2003
2032
|
ref: b,
|
|
2004
2033
|
style: {
|
|
2005
2034
|
...Jt,
|
|
@@ -2007,7 +2036,7 @@ function Yt({
|
|
|
2007
2036
|
flexBasis: 0,
|
|
2008
2037
|
flexShrink: 1,
|
|
2009
2038
|
overflow: "visible",
|
|
2010
|
-
...
|
|
2039
|
+
...I
|
|
2011
2040
|
},
|
|
2012
2041
|
children: /* @__PURE__ */ ae(
|
|
2013
2042
|
"div",
|
|
@@ -2023,7 +2052,7 @@ function Yt({
|
|
|
2023
2052
|
// but still allow users to scroll content within panels in the non-resizing direction
|
|
2024
2053
|
// NOTE This is not an inherited style
|
|
2025
2054
|
// See github.com/bvaughn/react-resizable-panels/issues/662
|
|
2026
|
-
touchAction:
|
|
2055
|
+
touchAction: w === "horizontal" ? "pan-y" : "pan-x"
|
|
2027
2056
|
},
|
|
2028
2057
|
children: e
|
|
2029
2058
|
}
|
|
@@ -2056,27 +2085,27 @@ function Zt({
|
|
|
2056
2085
|
panelId: n,
|
|
2057
2086
|
panelIndex: o
|
|
2058
2087
|
}) {
|
|
2059
|
-
let i,
|
|
2060
|
-
const
|
|
2061
|
-
(
|
|
2088
|
+
let i, s;
|
|
2089
|
+
const u = e[n], a = t.find(
|
|
2090
|
+
(r) => r.panelId === n
|
|
2062
2091
|
);
|
|
2063
2092
|
if (a) {
|
|
2064
|
-
const
|
|
2065
|
-
|
|
2093
|
+
const r = a.maxSize, l = a.collapsible ? a.collapsedSize : a.minSize, c = [o, o + 1];
|
|
2094
|
+
s = W({
|
|
2066
2095
|
layout: le({
|
|
2067
|
-
delta: l -
|
|
2096
|
+
delta: l - u,
|
|
2068
2097
|
initialLayout: e,
|
|
2069
2098
|
panelConstraints: t,
|
|
2070
|
-
pivotIndices:
|
|
2099
|
+
pivotIndices: c,
|
|
2071
2100
|
prevLayout: e
|
|
2072
2101
|
}),
|
|
2073
2102
|
panelConstraints: t
|
|
2074
|
-
})[n], i =
|
|
2103
|
+
})[n], i = W({
|
|
2075
2104
|
layout: le({
|
|
2076
|
-
delta:
|
|
2105
|
+
delta: r - u,
|
|
2077
2106
|
initialLayout: e,
|
|
2078
2107
|
panelConstraints: t,
|
|
2079
|
-
pivotIndices:
|
|
2108
|
+
pivotIndices: c,
|
|
2080
2109
|
prevLayout: e
|
|
2081
2110
|
}),
|
|
2082
2111
|
panelConstraints: t
|
|
@@ -2085,8 +2114,8 @@ function Zt({
|
|
|
2085
2114
|
return {
|
|
2086
2115
|
valueControls: n,
|
|
2087
2116
|
valueMax: i,
|
|
2088
|
-
valueMin:
|
|
2089
|
-
valueNow:
|
|
2117
|
+
valueMin: s,
|
|
2118
|
+
valueNow: u
|
|
2090
2119
|
};
|
|
2091
2120
|
}
|
|
2092
2121
|
function Qt({
|
|
@@ -2095,29 +2124,29 @@ function Qt({
|
|
|
2095
2124
|
disabled: n,
|
|
2096
2125
|
disableDoubleClick: o,
|
|
2097
2126
|
elementRef: i,
|
|
2098
|
-
id:
|
|
2099
|
-
style:
|
|
2127
|
+
id: s,
|
|
2128
|
+
style: u,
|
|
2100
2129
|
...a
|
|
2101
2130
|
}) {
|
|
2102
|
-
const
|
|
2131
|
+
const r = Le(s), l = Re({
|
|
2103
2132
|
disabled: n,
|
|
2104
2133
|
disableDoubleClick: o
|
|
2105
|
-
}), [
|
|
2106
|
-
disableCursor:
|
|
2134
|
+
}), [c, m] = Q({}), [p, S] = Q("inactive"), [z, f] = Q(!1), d = T(null), h = Ce(d, i), {
|
|
2135
|
+
disableCursor: y,
|
|
2107
2136
|
id: b,
|
|
2108
|
-
orientation:
|
|
2137
|
+
orientation: v,
|
|
2109
2138
|
registerSeparator: g,
|
|
2110
|
-
updateSeparatorProps:
|
|
2111
|
-
} = Me(), M =
|
|
2139
|
+
updateSeparatorProps: w
|
|
2140
|
+
} = Me(), M = v === "horizontal" ? "vertical" : "horizontal";
|
|
2112
2141
|
q(() => {
|
|
2113
|
-
const N =
|
|
2142
|
+
const N = d.current;
|
|
2114
2143
|
if (N !== null) {
|
|
2115
2144
|
const x = {
|
|
2116
2145
|
disabled: l.disabled,
|
|
2117
2146
|
disableDoubleClick: l.disableDoubleClick,
|
|
2118
2147
|
element: N,
|
|
2119
|
-
id:
|
|
2120
|
-
},
|
|
2148
|
+
id: r
|
|
2149
|
+
}, P = g(x), I = Gt(
|
|
2121
2150
|
(E) => {
|
|
2122
2151
|
S(
|
|
2123
2152
|
E.next.state !== "inactive" && E.next.hitRegions.some(
|
|
@@ -2130,12 +2159,12 @@ function Qt({
|
|
|
2130
2159
|
(E) => {
|
|
2131
2160
|
const { derivedPanelConstraints: D, layout: V, separatorToPanels: ue } = E.next, oe = ue.get(x);
|
|
2132
2161
|
if (oe) {
|
|
2133
|
-
const
|
|
2134
|
-
|
|
2162
|
+
const _ = oe[0], Y = oe.indexOf(_);
|
|
2163
|
+
m(
|
|
2135
2164
|
Zt({
|
|
2136
2165
|
layout: V,
|
|
2137
2166
|
panelConstraints: D,
|
|
2138
|
-
panelId:
|
|
2167
|
+
panelId: _.id,
|
|
2139
2168
|
panelIndex: Y
|
|
2140
2169
|
})
|
|
2141
2170
|
);
|
|
@@ -2143,49 +2172,49 @@ function Qt({
|
|
|
2143
2172
|
}
|
|
2144
2173
|
);
|
|
2145
2174
|
return () => {
|
|
2146
|
-
|
|
2175
|
+
I(), R(), P();
|
|
2147
2176
|
};
|
|
2148
2177
|
}
|
|
2149
|
-
}, [b,
|
|
2150
|
-
|
|
2151
|
-
}, [n, o,
|
|
2152
|
-
let
|
|
2153
|
-
n && !
|
|
2178
|
+
}, [b, r, g, l]), me(() => {
|
|
2179
|
+
w(r, { disabled: n, disableDoubleClick: o });
|
|
2180
|
+
}, [n, o, r, w]);
|
|
2181
|
+
let L;
|
|
2182
|
+
n && !y && (L = "not-allowed");
|
|
2154
2183
|
let G;
|
|
2155
2184
|
if (n)
|
|
2156
2185
|
G = "disabled";
|
|
2157
2186
|
else
|
|
2158
|
-
switch (
|
|
2187
|
+
switch (p) {
|
|
2159
2188
|
case "active": {
|
|
2160
2189
|
G = "active";
|
|
2161
2190
|
break;
|
|
2162
2191
|
}
|
|
2163
2192
|
default:
|
|
2164
|
-
z ? G = "focus" : G =
|
|
2193
|
+
z ? G = "focus" : G = p;
|
|
2165
2194
|
}
|
|
2166
2195
|
return /* @__PURE__ */ ae(
|
|
2167
2196
|
"div",
|
|
2168
2197
|
{
|
|
2169
2198
|
...a,
|
|
2170
|
-
"aria-controls":
|
|
2199
|
+
"aria-controls": c.valueControls,
|
|
2171
2200
|
"aria-disabled": n || void 0,
|
|
2172
2201
|
"aria-orientation": M,
|
|
2173
|
-
"aria-valuemax":
|
|
2174
|
-
"aria-valuemin":
|
|
2175
|
-
"aria-valuenow":
|
|
2202
|
+
"aria-valuemax": c.valueMax,
|
|
2203
|
+
"aria-valuemin": c.valueMin,
|
|
2204
|
+
"aria-valuenow": c.valueNow,
|
|
2176
2205
|
children: e,
|
|
2177
2206
|
className: t,
|
|
2178
2207
|
"data-separator": G,
|
|
2179
|
-
"data-testid":
|
|
2180
|
-
id:
|
|
2181
|
-
onBlur: () =>
|
|
2182
|
-
onFocus: () =>
|
|
2183
|
-
ref:
|
|
2208
|
+
"data-testid": r,
|
|
2209
|
+
id: r,
|
|
2210
|
+
onBlur: () => f(!1),
|
|
2211
|
+
onFocus: () => f(!0),
|
|
2212
|
+
ref: h,
|
|
2184
2213
|
role: "separator",
|
|
2185
2214
|
style: {
|
|
2186
2215
|
flexBasis: "auto",
|
|
2187
|
-
cursor:
|
|
2188
|
-
...
|
|
2216
|
+
cursor: L,
|
|
2217
|
+
...u,
|
|
2189
2218
|
flexGrow: 0,
|
|
2190
2219
|
flexShrink: 0,
|
|
2191
2220
|
// Inform the browser that the library is handling touch events for this element
|
|
@@ -2198,7 +2227,7 @@ function Qt({
|
|
|
2198
2227
|
}
|
|
2199
2228
|
Qt.displayName = "Separator";
|
|
2200
2229
|
export {
|
|
2201
|
-
|
|
2230
|
+
Wt as Group,
|
|
2202
2231
|
Yt as Panel,
|
|
2203
2232
|
Qt as Separator,
|
|
2204
2233
|
wt as isCoarsePointer,
|