react-resizable-panels 4.0.15 → 4.1.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,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as K } from "react/jsx-runtime";
|
|
3
|
-
import { useId as Ke, useLayoutEffect as Xe, useEffect as
|
|
3
|
+
import { useId as Ke, useLayoutEffect as Xe, useEffect as Ce, useRef as I, useCallback as qe, createContext as Ye, useImperativeHandle as Ee, useState as D, useMemo as se, useSyncExternalStore as Ze, useContext as Je } from "react";
|
|
4
4
|
function z(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
@@ -11,7 +11,7 @@ function W({
|
|
|
11
11
|
const { orientation: t, panels: n } = e;
|
|
12
12
|
return n.reduce((o, i) => (o += t === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, o), 0);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ae(e, t) {
|
|
15
15
|
return t.sort(
|
|
16
16
|
e === "horizontal" ? Qe : et
|
|
17
17
|
);
|
|
@@ -56,7 +56,7 @@ function tt({
|
|
|
56
56
|
return z(i, "No rect found"), i;
|
|
57
57
|
}
|
|
58
58
|
function ke(e) {
|
|
59
|
-
const { element: t, orientation: n, panels: o, separators: i } = e, s =
|
|
59
|
+
const { element: t, orientation: n, panels: o, separators: i } = e, s = ae(
|
|
60
60
|
n,
|
|
61
61
|
Array.from(t.children).filter(Me).map((f) => ({ element: f }))
|
|
62
62
|
).map(({ element: f }) => f), l = [];
|
|
@@ -64,19 +64,19 @@ function ke(e) {
|
|
|
64
64
|
for (const f of s)
|
|
65
65
|
if (f.hasAttribute("data-panel")) {
|
|
66
66
|
const p = o.find(
|
|
67
|
-
(
|
|
67
|
+
(h) => h.element === f
|
|
68
68
|
);
|
|
69
69
|
if (p) {
|
|
70
70
|
if (a) {
|
|
71
|
-
const
|
|
71
|
+
const h = a.element.getBoundingClientRect(), m = f.getBoundingClientRect();
|
|
72
72
|
let c;
|
|
73
73
|
if (r) {
|
|
74
|
-
const d = n === "horizontal" ? new DOMRect(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
const d = n === "horizontal" ? new DOMRect(h.right, h.top, 0, h.height) : new DOMRect(
|
|
75
|
+
h.left,
|
|
76
|
+
h.bottom,
|
|
77
|
+
h.width,
|
|
78
78
|
0
|
|
79
|
-
), y = n === "horizontal" ? new DOMRect(
|
|
79
|
+
), y = n === "horizontal" ? new DOMRect(m.left, m.top, 0, m.height) : new DOMRect(m.left, m.top, m.width, 0);
|
|
80
80
|
switch (u.length) {
|
|
81
81
|
case 0: {
|
|
82
82
|
c = [
|
|
@@ -88,12 +88,12 @@ function ke(e) {
|
|
|
88
88
|
case 1: {
|
|
89
89
|
const v = u[0], S = tt({
|
|
90
90
|
orientation: n,
|
|
91
|
-
rects: [
|
|
91
|
+
rects: [h, m],
|
|
92
92
|
targetRect: v.element.getBoundingClientRect()
|
|
93
93
|
});
|
|
94
94
|
c = [
|
|
95
95
|
v,
|
|
96
|
-
S ===
|
|
96
|
+
S === h ? y : d
|
|
97
97
|
];
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
@@ -105,15 +105,15 @@ function ke(e) {
|
|
|
105
105
|
} else
|
|
106
106
|
u.length ? c = u : c = [
|
|
107
107
|
n === "horizontal" ? new DOMRect(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
108
|
+
h.right,
|
|
109
|
+
m.top,
|
|
110
|
+
m.left - h.right,
|
|
111
|
+
m.height
|
|
112
112
|
) : new DOMRect(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
m.left,
|
|
114
|
+
h.bottom,
|
|
115
|
+
m.width,
|
|
116
|
+
m.top - h.bottom
|
|
117
117
|
)
|
|
118
118
|
];
|
|
119
119
|
for (const d of c)
|
|
@@ -129,7 +129,7 @@ function ke(e) {
|
|
|
129
129
|
}
|
|
130
130
|
} else if (f.hasAttribute("data-separator")) {
|
|
131
131
|
const p = i.find(
|
|
132
|
-
(
|
|
132
|
+
(h) => h.element === f
|
|
133
133
|
);
|
|
134
134
|
p ? u.push(p) : (a = void 0, u = []);
|
|
135
135
|
} else
|
|
@@ -160,7 +160,7 @@ function st(e) {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function ee({
|
|
164
164
|
groupSize: e,
|
|
165
165
|
panelElement: t,
|
|
166
166
|
styleProp: n
|
|
@@ -211,7 +211,7 @@ function me(e) {
|
|
|
211
211
|
const { element: i, panelConstraints: s } = o;
|
|
212
212
|
let l = 0;
|
|
213
213
|
if (s.collapsedSize) {
|
|
214
|
-
const f =
|
|
214
|
+
const f = ee({
|
|
215
215
|
groupSize: n,
|
|
216
216
|
panelElement: i,
|
|
217
217
|
styleProp: s.collapsedSize
|
|
@@ -220,7 +220,7 @@ function me(e) {
|
|
|
220
220
|
}
|
|
221
221
|
let r;
|
|
222
222
|
if (s.defaultSize) {
|
|
223
|
-
const f =
|
|
223
|
+
const f = ee({
|
|
224
224
|
groupSize: n,
|
|
225
225
|
panelElement: i,
|
|
226
226
|
styleProp: s.defaultSize
|
|
@@ -229,7 +229,7 @@ function me(e) {
|
|
|
229
229
|
}
|
|
230
230
|
let a = 0;
|
|
231
231
|
if (s.minSize) {
|
|
232
|
-
const f =
|
|
232
|
+
const f = ee({
|
|
233
233
|
groupSize: n,
|
|
234
234
|
panelElement: i,
|
|
235
235
|
styleProp: s.minSize
|
|
@@ -238,7 +238,7 @@ function me(e) {
|
|
|
238
238
|
}
|
|
239
239
|
let u = 100;
|
|
240
240
|
if (s.maxSize) {
|
|
241
|
-
const f =
|
|
241
|
+
const f = ee({
|
|
242
242
|
groupSize: n,
|
|
243
243
|
panelElement: i,
|
|
244
244
|
styleProp: s.maxSize
|
|
@@ -294,37 +294,37 @@ class at {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function R(e, t, n = 0) {
|
|
298
298
|
return Math.abs(k(e) - k(t)) <= n;
|
|
299
299
|
}
|
|
300
|
-
let
|
|
300
|
+
let E = {
|
|
301
301
|
cursorFlags: 0,
|
|
302
302
|
interactionState: {
|
|
303
303
|
state: "inactive"
|
|
304
304
|
},
|
|
305
305
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
306
306
|
};
|
|
307
|
-
const
|
|
307
|
+
const _ = new at();
|
|
308
308
|
function G() {
|
|
309
|
-
return
|
|
310
|
-
}
|
|
311
|
-
function
|
|
312
|
-
const t = typeof e == "function" ? e(
|
|
313
|
-
if (
|
|
314
|
-
return
|
|
315
|
-
const n =
|
|
316
|
-
return
|
|
317
|
-
...
|
|
309
|
+
return E;
|
|
310
|
+
}
|
|
311
|
+
function M(e) {
|
|
312
|
+
const t = typeof e == "function" ? e(E) : e;
|
|
313
|
+
if (E === t)
|
|
314
|
+
return E;
|
|
315
|
+
const n = E;
|
|
316
|
+
return E = {
|
|
317
|
+
...E,
|
|
318
318
|
...t
|
|
319
|
-
}, t.cursorFlags !== void 0 &&
|
|
319
|
+
}, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange", E.cursorFlags), t.interactionState !== void 0 && _.emit("interactionStateChange", E.interactionState), t.mountedGroups !== void 0 && (E.mountedGroups.forEach((o, i) => {
|
|
320
320
|
o.derivedPanelConstraints.forEach((s) => {
|
|
321
321
|
if (s.collapsible) {
|
|
322
322
|
const { layout: l } = n.mountedGroups.get(i) ?? {};
|
|
323
323
|
if (l) {
|
|
324
|
-
const r =
|
|
324
|
+
const r = R(
|
|
325
325
|
s.collapsedSize,
|
|
326
326
|
o.layout[s.panelId]
|
|
327
|
-
), a =
|
|
327
|
+
), a = R(
|
|
328
328
|
s.collapsedSize,
|
|
329
329
|
l[s.panelId]
|
|
330
330
|
);
|
|
@@ -332,7 +332,7 @@ function E(e) {
|
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
334
|
});
|
|
335
|
-
}),
|
|
335
|
+
}), _.emit("mountedGroupsChange", E.mountedGroups)), E;
|
|
336
336
|
}
|
|
337
337
|
function lt(e, t) {
|
|
338
338
|
if (e.length !== t.length)
|
|
@@ -343,9 +343,9 @@ function lt(e, t) {
|
|
|
343
343
|
return !0;
|
|
344
344
|
}
|
|
345
345
|
function X(e, t) {
|
|
346
|
-
return
|
|
346
|
+
return R(e, t) ? 0 : e > t ? 1 : -1;
|
|
347
347
|
}
|
|
348
|
-
function
|
|
348
|
+
function V({
|
|
349
349
|
panelConstraints: e,
|
|
350
350
|
size: t
|
|
351
351
|
}) {
|
|
@@ -371,7 +371,7 @@ function q({
|
|
|
371
371
|
prevLayout: i,
|
|
372
372
|
trigger: s
|
|
373
373
|
}) {
|
|
374
|
-
if (
|
|
374
|
+
if (R(e, 0))
|
|
375
375
|
return t;
|
|
376
376
|
const l = Object.values(t), r = Object.values(i), a = [...l], [u, f] = o;
|
|
377
377
|
z(u != null, "Invalid first pivot index"), z(f != null, "Invalid second pivot index");
|
|
@@ -393,7 +393,7 @@ function q({
|
|
|
393
393
|
if (z(
|
|
394
394
|
x != null,
|
|
395
395
|
`Previous layout not found for panel index ${c}`
|
|
396
|
-
),
|
|
396
|
+
), R(x, y)) {
|
|
397
397
|
const g = S - x;
|
|
398
398
|
X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
399
399
|
}
|
|
@@ -415,7 +415,7 @@ function q({
|
|
|
415
415
|
if (z(
|
|
416
416
|
x != null,
|
|
417
417
|
`Previous layout not found for panel index ${c}`
|
|
418
|
-
),
|
|
418
|
+
), R(x, S)) {
|
|
419
419
|
const g = x - y;
|
|
420
420
|
X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
421
421
|
}
|
|
@@ -431,7 +431,7 @@ function q({
|
|
|
431
431
|
S != null,
|
|
432
432
|
`Previous layout not found for panel index ${d}`
|
|
433
433
|
);
|
|
434
|
-
const g =
|
|
434
|
+
const g = V({
|
|
435
435
|
panelConstraints: n[d],
|
|
436
436
|
size: 100
|
|
437
437
|
}) - S;
|
|
@@ -449,11 +449,11 @@ function q({
|
|
|
449
449
|
v != null,
|
|
450
450
|
`Previous layout not found for panel index ${d}`
|
|
451
451
|
);
|
|
452
|
-
const S = v - y, x =
|
|
452
|
+
const S = v - y, x = V({
|
|
453
453
|
panelConstraints: n[d],
|
|
454
454
|
size: S
|
|
455
455
|
});
|
|
456
|
-
if (!
|
|
456
|
+
if (!R(v, x) && (p += v - x, a[d] = x, p.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
457
457
|
numeric: !0
|
|
458
458
|
}) >= 0))
|
|
459
459
|
break;
|
|
@@ -468,38 +468,38 @@ function q({
|
|
|
468
468
|
d != null,
|
|
469
469
|
`Previous layout not found for panel index ${c}`
|
|
470
470
|
);
|
|
471
|
-
const y = d + p, v =
|
|
471
|
+
const y = d + p, v = V({
|
|
472
472
|
panelConstraints: n[c],
|
|
473
473
|
size: y
|
|
474
474
|
});
|
|
475
|
-
if (a[c] = v, !
|
|
475
|
+
if (a[c] = v, !R(v, y)) {
|
|
476
476
|
let S = y - v, g = e < 0 ? f : u;
|
|
477
477
|
for (; g >= 0 && g < n.length; ) {
|
|
478
|
-
const
|
|
478
|
+
const b = a[g];
|
|
479
479
|
z(
|
|
480
|
-
|
|
480
|
+
b != null,
|
|
481
481
|
`Previous layout not found for panel index ${g}`
|
|
482
482
|
);
|
|
483
|
-
const
|
|
483
|
+
const w = b + S, C = V({
|
|
484
484
|
panelConstraints: n[g],
|
|
485
|
-
size:
|
|
485
|
+
size: w
|
|
486
486
|
});
|
|
487
|
-
if (
|
|
487
|
+
if (R(b, C) || (S -= C - b, a[g] = C), R(S, 0))
|
|
488
488
|
break;
|
|
489
489
|
e > 0 ? g-- : g++;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
const
|
|
493
|
+
const h = Object.values(a).reduce(
|
|
494
494
|
(c, d) => d + c,
|
|
495
495
|
0
|
|
496
496
|
);
|
|
497
|
-
if (!
|
|
497
|
+
if (!R(h, 100, 0.1))
|
|
498
498
|
return i;
|
|
499
|
-
const
|
|
500
|
-
return a.reduce((c, d, y) => (c[
|
|
499
|
+
const m = Object.keys(i);
|
|
500
|
+
return a.reduce((c, d, y) => (c[m[y]] = d, c), {});
|
|
501
501
|
}
|
|
502
|
-
function
|
|
502
|
+
function ne(e) {
|
|
503
503
|
const t = e.parentElement;
|
|
504
504
|
z(t, "Parent group element not found");
|
|
505
505
|
const { mountedGroups: n } = G();
|
|
@@ -508,7 +508,7 @@ function oe(e) {
|
|
|
508
508
|
return o;
|
|
509
509
|
throw Error("Could not find parent Group for separator element");
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function U(e, t) {
|
|
512
512
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
513
513
|
return !1;
|
|
514
514
|
for (const n in e)
|
|
@@ -516,7 +516,7 @@ function V(e, t) {
|
|
|
516
516
|
return !1;
|
|
517
517
|
return !0;
|
|
518
518
|
}
|
|
519
|
-
function
|
|
519
|
+
function N({
|
|
520
520
|
layout: e,
|
|
521
521
|
panelConstraints: t
|
|
522
522
|
}) {
|
|
@@ -528,7 +528,7 @@ function _({
|
|
|
528
528
|
throw Error(
|
|
529
529
|
`Invalid ${t.length} panel layout: ${o.map((r) => `${r}%`).join(", ")}`
|
|
530
530
|
);
|
|
531
|
-
if (!
|
|
531
|
+
if (!R(i, 100) && o.length > 0)
|
|
532
532
|
for (let r = 0; r < t.length; r++) {
|
|
533
533
|
const a = o[r];
|
|
534
534
|
z(a != null, `No layout data found for index ${r}`);
|
|
@@ -539,21 +539,21 @@ function _({
|
|
|
539
539
|
for (let r = 0; r < t.length; r++) {
|
|
540
540
|
const a = o[r];
|
|
541
541
|
z(a != null, `No layout data found for index ${r}`);
|
|
542
|
-
const u =
|
|
542
|
+
const u = V({
|
|
543
543
|
panelConstraints: t[r],
|
|
544
544
|
size: a
|
|
545
545
|
});
|
|
546
546
|
a != u && (s += a - u, o[r] = u);
|
|
547
547
|
}
|
|
548
|
-
if (!
|
|
548
|
+
if (!R(s, 0))
|
|
549
549
|
for (let r = 0; r < t.length; r++) {
|
|
550
550
|
const a = o[r];
|
|
551
551
|
z(a != null, `No layout data found for index ${r}`);
|
|
552
|
-
const u = a + s, f =
|
|
552
|
+
const u = a + s, f = V({
|
|
553
553
|
panelConstraints: t[r],
|
|
554
554
|
size: u
|
|
555
555
|
});
|
|
556
|
-
if (a !== f && (s -= f - a, o[r] = f,
|
|
556
|
+
if (a !== f && (s -= f - a, o[r] = f, R(s, 0)))
|
|
557
557
|
break;
|
|
558
558
|
}
|
|
559
559
|
const l = Object.keys(e);
|
|
@@ -581,11 +581,11 @@ function Ge({
|
|
|
581
581
|
group: s,
|
|
582
582
|
layout: l,
|
|
583
583
|
separatorToPanels: r
|
|
584
|
-
} = t(), a =
|
|
584
|
+
} = t(), a = N({
|
|
585
585
|
layout: n,
|
|
586
586
|
panelConstraints: i
|
|
587
587
|
});
|
|
588
|
-
return o ? l : (
|
|
588
|
+
return o ? l : (U(l, a) || M((u) => ({
|
|
589
589
|
mountedGroups: new Map(u.mountedGroups).set(s, {
|
|
590
590
|
defaultLayoutDeferred: o,
|
|
591
591
|
derivedPanelConstraints: i,
|
|
@@ -600,8 +600,8 @@ function De(e) {
|
|
|
600
600
|
const { mountedGroups: t } = G(), n = t.get(e);
|
|
601
601
|
return z(n, `Mounted Group ${e.id} not found`), n;
|
|
602
602
|
}
|
|
603
|
-
function
|
|
604
|
-
const n =
|
|
603
|
+
function T(e, t) {
|
|
604
|
+
const n = ne(e), o = De(n), i = n.separators.find(
|
|
605
605
|
(p) => p.element === e
|
|
606
606
|
);
|
|
607
607
|
z(i, "Matching separator not found");
|
|
@@ -614,11 +614,11 @@ function O(e, t) {
|
|
|
614
614
|
pivotIndices: l,
|
|
615
615
|
prevLayout: a,
|
|
616
616
|
trigger: "keyboard"
|
|
617
|
-
}), f =
|
|
617
|
+
}), f = N({
|
|
618
618
|
layout: u,
|
|
619
619
|
panelConstraints: o.derivedPanelConstraints
|
|
620
620
|
});
|
|
621
|
-
|
|
621
|
+
U(a, f) || M((p) => ({
|
|
622
622
|
mountedGroups: new Map(p.mountedGroups).set(n, {
|
|
623
623
|
defaultLayoutDeferred: o.defaultLayoutDeferred,
|
|
624
624
|
derivedPanelConstraints: o.derivedPanelConstraints,
|
|
@@ -630,32 +630,32 @@ function O(e, t) {
|
|
|
630
630
|
function ye(e) {
|
|
631
631
|
if (e.defaultPrevented)
|
|
632
632
|
return;
|
|
633
|
-
const t = e.currentTarget, n =
|
|
633
|
+
const t = e.currentTarget, n = ne(t);
|
|
634
634
|
if (!n.disabled)
|
|
635
635
|
switch (e.key) {
|
|
636
636
|
case "ArrowDown": {
|
|
637
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
637
|
+
e.preventDefault(), n.orientation === "vertical" && T(t, 5);
|
|
638
638
|
break;
|
|
639
639
|
}
|
|
640
640
|
case "ArrowLeft": {
|
|
641
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
641
|
+
e.preventDefault(), n.orientation === "horizontal" && T(t, -5);
|
|
642
642
|
break;
|
|
643
643
|
}
|
|
644
644
|
case "ArrowRight": {
|
|
645
|
-
e.preventDefault(), n.orientation === "horizontal" &&
|
|
645
|
+
e.preventDefault(), n.orientation === "horizontal" && T(t, 5);
|
|
646
646
|
break;
|
|
647
647
|
}
|
|
648
648
|
case "ArrowUp": {
|
|
649
|
-
e.preventDefault(), n.orientation === "vertical" &&
|
|
649
|
+
e.preventDefault(), n.orientation === "vertical" && T(t, -5);
|
|
650
650
|
break;
|
|
651
651
|
}
|
|
652
652
|
case "End": {
|
|
653
|
-
e.preventDefault(),
|
|
653
|
+
e.preventDefault(), T(t, 100);
|
|
654
654
|
break;
|
|
655
655
|
}
|
|
656
656
|
case "Enter": {
|
|
657
657
|
e.preventDefault();
|
|
658
|
-
const o =
|
|
658
|
+
const o = ne(t), { derivedPanelConstraints: i, layout: s, separatorToPanels: l } = De(o), r = o.separators.find(
|
|
659
659
|
(p) => p.element === t
|
|
660
660
|
);
|
|
661
661
|
z(r, "Matching separator not found");
|
|
@@ -665,14 +665,14 @@ function ye(e) {
|
|
|
665
665
|
(p) => p.panelId === u.id
|
|
666
666
|
);
|
|
667
667
|
if (z(f, "Panel metadata not found"), f.collapsible) {
|
|
668
|
-
const p = s[u.id],
|
|
669
|
-
|
|
668
|
+
const p = s[u.id], h = f.collapsedSize === p ? o.inMemoryLastExpandedPanelSizes[u.id] ?? f.minSize : f.collapsedSize;
|
|
669
|
+
T(t, h - p);
|
|
670
670
|
}
|
|
671
671
|
break;
|
|
672
672
|
}
|
|
673
673
|
case "F6": {
|
|
674
674
|
e.preventDefault();
|
|
675
|
-
const i =
|
|
675
|
+
const i = ne(t).separators.map(
|
|
676
676
|
(a) => a.element
|
|
677
677
|
), s = Array.from(i).findIndex(
|
|
678
678
|
(a) => a === e.currentTarget
|
|
@@ -683,7 +683,7 @@ function ye(e) {
|
|
|
683
683
|
break;
|
|
684
684
|
}
|
|
685
685
|
case "Home": {
|
|
686
|
-
e.preventDefault(),
|
|
686
|
+
e.preventDefault(), T(t, -100);
|
|
687
687
|
break;
|
|
688
688
|
}
|
|
689
689
|
}
|
|
@@ -716,9 +716,9 @@ function ct(e, t, n) {
|
|
|
716
716
|
hitRegion: o
|
|
717
717
|
} : void 0;
|
|
718
718
|
}
|
|
719
|
-
let
|
|
719
|
+
let te;
|
|
720
720
|
function ft() {
|
|
721
|
-
return
|
|
721
|
+
return te === void 0 && (typeof matchMedia == "function" ? te = !!matchMedia("(pointer:coarse)").matches : te = !1), te;
|
|
722
722
|
}
|
|
723
723
|
function dt(e) {
|
|
724
724
|
return e !== null && typeof e == "object" && "nodeType" in e && e.nodeType === Node.DOCUMENT_FRAGMENT_NODE;
|
|
@@ -833,7 +833,7 @@ function ze(e) {
|
|
|
833
833
|
}), a.separator && (s.add(a.separator), r || (r = !0, a.separator.element.focus()));
|
|
834
834
|
const u = t.get(a.group);
|
|
835
835
|
u && l.set(a.group, u.layout);
|
|
836
|
-
}),
|
|
836
|
+
}), M({
|
|
837
837
|
interactionState: {
|
|
838
838
|
hitRegions: n,
|
|
839
839
|
initialLayoutMap: l,
|
|
@@ -886,8 +886,8 @@ function St({
|
|
|
886
886
|
return o > 0 && i > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
887
887
|
}
|
|
888
888
|
const be = /* @__PURE__ */ new WeakMap();
|
|
889
|
-
function
|
|
890
|
-
if (e.defaultView === null)
|
|
889
|
+
function le(e) {
|
|
890
|
+
if (e.defaultView === null || e.defaultView === void 0)
|
|
891
891
|
return;
|
|
892
892
|
let { prevStyle: t, styleSheet: n } = be.get(e) ?? {};
|
|
893
893
|
n === void 0 && (n = new e.defaultView.CSSStyleSheet(), e.adoptedStyleSheets = [n]);
|
|
@@ -926,9 +926,9 @@ function Fe({
|
|
|
926
926
|
let l = 0;
|
|
927
927
|
const r = new Map(i);
|
|
928
928
|
n.forEach((a) => {
|
|
929
|
-
const { group: u, groupSize: f } = a, { disableCursor: p, orientation:
|
|
929
|
+
const { group: u, groupSize: f } = a, { disableCursor: p, orientation: h, panels: m } = u;
|
|
930
930
|
let c = 0;
|
|
931
|
-
s ?
|
|
931
|
+
s ? h === "horizontal" ? c = (t.clientX - s.x) / f * 100 : c = (t.clientY - s.y) / f * 100 : h === "horizontal" ? c = t.clientX < 0 ? -100 : 100 : c = t.clientY < 0 ? -100 : 100;
|
|
932
932
|
const d = o.get(u), {
|
|
933
933
|
defaultLayoutDeferred: y,
|
|
934
934
|
derivedPanelConstraints: v,
|
|
@@ -940,13 +940,13 @@ function Fe({
|
|
|
940
940
|
delta: c,
|
|
941
941
|
initialLayout: d,
|
|
942
942
|
panelConstraints: v,
|
|
943
|
-
pivotIndices: a.panels.map((
|
|
943
|
+
pivotIndices: a.panels.map((b) => m.indexOf(b)),
|
|
944
944
|
prevLayout: S,
|
|
945
945
|
trigger: "mouse-or-touch"
|
|
946
946
|
});
|
|
947
|
-
if (
|
|
947
|
+
if (U(g, S)) {
|
|
948
948
|
if (c !== 0 && !p)
|
|
949
|
-
switch (
|
|
949
|
+
switch (h) {
|
|
950
950
|
case "horizontal": {
|
|
951
951
|
l |= c < 0 ? Oe : Te;
|
|
952
952
|
break;
|
|
@@ -963,14 +963,14 @@ function Fe({
|
|
|
963
963
|
layout: g,
|
|
964
964
|
separatorToPanels: x
|
|
965
965
|
});
|
|
966
|
-
const
|
|
967
|
-
a.group.inMemoryLayouts[
|
|
966
|
+
const b = a.group.panels.map(({ id: w }) => w).join(",");
|
|
967
|
+
a.group.inMemoryLayouts[b] = g;
|
|
968
968
|
}
|
|
969
969
|
}
|
|
970
|
-
}),
|
|
970
|
+
}), M({
|
|
971
971
|
cursorFlags: l,
|
|
972
972
|
mountedGroups: r
|
|
973
|
-
}),
|
|
973
|
+
}), le(e);
|
|
974
974
|
}
|
|
975
975
|
function we(e) {
|
|
976
976
|
const { interactionState: t, mountedGroups: n } = G();
|
|
@@ -995,7 +995,7 @@ function Le(e) {
|
|
|
995
995
|
// Skip this check for "pointerleave" events, else Firefox triggers a false positive (see #514)
|
|
996
996
|
e.buttons === 0
|
|
997
997
|
) {
|
|
998
|
-
|
|
998
|
+
M(
|
|
999
999
|
(o) => o.interactionState.state === "inactive" ? o : {
|
|
1000
1000
|
cursorFlags: 0,
|
|
1001
1001
|
interactionState: {
|
|
@@ -1017,14 +1017,14 @@ function Le(e) {
|
|
|
1017
1017
|
}
|
|
1018
1018
|
default: {
|
|
1019
1019
|
const o = $e(e, n);
|
|
1020
|
-
o.length === 0 ? t.state !== "inactive" &&
|
|
1020
|
+
o.length === 0 ? t.state !== "inactive" && M({
|
|
1021
1021
|
interactionState: { state: "inactive" }
|
|
1022
|
-
}) :
|
|
1022
|
+
}) : M({
|
|
1023
1023
|
interactionState: {
|
|
1024
1024
|
hitRegions: o,
|
|
1025
1025
|
state: "hover"
|
|
1026
1026
|
}
|
|
1027
|
-
}),
|
|
1027
|
+
}), le(e.currentTarget);
|
|
1028
1028
|
break;
|
|
1029
1029
|
}
|
|
1030
1030
|
}
|
|
@@ -1036,15 +1036,15 @@ function Pe(e) {
|
|
|
1036
1036
|
const { interactionState: t } = G();
|
|
1037
1037
|
switch (t.state) {
|
|
1038
1038
|
case "active":
|
|
1039
|
-
|
|
1039
|
+
M({
|
|
1040
1040
|
cursorFlags: 0,
|
|
1041
1041
|
interactionState: {
|
|
1042
1042
|
state: "inactive"
|
|
1043
1043
|
}
|
|
1044
|
-
}),
|
|
1044
|
+
}), le(e.currentTarget);
|
|
1045
1045
|
}
|
|
1046
1046
|
}
|
|
1047
|
-
function
|
|
1047
|
+
function Re(e) {
|
|
1048
1048
|
let t = 0, n = 0;
|
|
1049
1049
|
const o = {};
|
|
1050
1050
|
for (const s of e)
|
|
@@ -1097,7 +1097,7 @@ function bt(e, t) {
|
|
|
1097
1097
|
return !1;
|
|
1098
1098
|
return !0;
|
|
1099
1099
|
}
|
|
1100
|
-
const
|
|
1100
|
+
const B = /* @__PURE__ */ new Map();
|
|
1101
1101
|
function wt(e) {
|
|
1102
1102
|
let t = !0;
|
|
1103
1103
|
z(
|
|
@@ -1111,21 +1111,21 @@ function wt(e) {
|
|
|
1111
1111
|
if (t) {
|
|
1112
1112
|
if (W({ group: e }) === 0)
|
|
1113
1113
|
return;
|
|
1114
|
-
|
|
1114
|
+
M((x) => {
|
|
1115
1115
|
const g = x.mountedGroups.get(e);
|
|
1116
1116
|
if (g) {
|
|
1117
|
-
const
|
|
1118
|
-
layout:
|
|
1119
|
-
panelConstraints:
|
|
1117
|
+
const b = me(e), w = g.defaultLayoutDeferred ? Re(b) : g.layout, C = N({
|
|
1118
|
+
layout: w,
|
|
1119
|
+
panelConstraints: b
|
|
1120
1120
|
});
|
|
1121
|
-
return !g.defaultLayoutDeferred &&
|
|
1121
|
+
return !g.defaultLayoutDeferred && U(w, C) && zt(
|
|
1122
1122
|
g.derivedPanelConstraints,
|
|
1123
|
-
|
|
1123
|
+
b
|
|
1124
1124
|
) ? x : {
|
|
1125
1125
|
mountedGroups: new Map(x.mountedGroups).set(e, {
|
|
1126
1126
|
defaultLayoutDeferred: !1,
|
|
1127
|
-
derivedPanelConstraints:
|
|
1128
|
-
layout:
|
|
1127
|
+
derivedPanelConstraints: b,
|
|
1128
|
+
layout: C,
|
|
1129
1129
|
separatorToPanels: g.separatorToPanels
|
|
1130
1130
|
})
|
|
1131
1131
|
};
|
|
@@ -1146,16 +1146,16 @@ function wt(e) {
|
|
|
1146
1146
|
const l = W({ group: e }), r = me(e), a = e.panels.map(({ id: c }) => c).join(",");
|
|
1147
1147
|
let u = e.defaultLayout;
|
|
1148
1148
|
u && (bt(e.panels, u) || (u = void 0));
|
|
1149
|
-
const f = e.inMemoryLayouts[a] ?? u ??
|
|
1149
|
+
const f = e.inMemoryLayouts[a] ?? u ?? Re(r), p = N({
|
|
1150
1150
|
layout: f,
|
|
1151
1151
|
panelConstraints: r
|
|
1152
|
-
}),
|
|
1153
|
-
return
|
|
1152
|
+
}), h = ke(e), m = e.element.ownerDocument;
|
|
1153
|
+
return M((c) => {
|
|
1154
1154
|
const d = /* @__PURE__ */ new Map();
|
|
1155
|
-
return
|
|
1156
|
-
|
|
1157
|
-
(
|
|
1158
|
-
),
|
|
1155
|
+
return B.set(
|
|
1156
|
+
m,
|
|
1157
|
+
(B.get(m) ?? 0) + 1
|
|
1158
|
+
), h.forEach((y) => {
|
|
1159
1159
|
y.separator && d.set(y.separator, y.panels);
|
|
1160
1160
|
}), {
|
|
1161
1161
|
mountedGroups: new Map(c.mountedGroups).set(e, {
|
|
@@ -1170,31 +1170,31 @@ function wt(e) {
|
|
|
1170
1170
|
!i.has(c.id),
|
|
1171
1171
|
`Separator ids must be unique; id "${c.id}" was used more than once`
|
|
1172
1172
|
), i.add(c.id), c.element.addEventListener("keydown", ye);
|
|
1173
|
-
}),
|
|
1174
|
-
t = !1,
|
|
1175
|
-
|
|
1176
|
-
Math.max(0, (
|
|
1177
|
-
),
|
|
1173
|
+
}), B.get(m) === 1 && (m.addEventListener("pointerdown", ze), m.addEventListener("pointerleave", we), m.addEventListener("pointermove", Le), m.addEventListener("pointerup", Pe)), function() {
|
|
1174
|
+
t = !1, B.set(
|
|
1175
|
+
m,
|
|
1176
|
+
Math.max(0, (B.get(m) ?? 0) - 1)
|
|
1177
|
+
), M((d) => {
|
|
1178
1178
|
const y = new Map(d.mountedGroups);
|
|
1179
1179
|
return y.delete(e), { mountedGroups: y };
|
|
1180
1180
|
}), e.separators.forEach((d) => {
|
|
1181
1181
|
d.element.removeEventListener("keydown", ye);
|
|
1182
|
-
}),
|
|
1182
|
+
}), B.get(m) || (m.removeEventListener("pointerdown", ze), m.removeEventListener("pointerleave", we), m.removeEventListener("pointermove", Le), m.removeEventListener("pointerup", Pe)), s.disconnect();
|
|
1183
1183
|
};
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1185
|
+
function ue(e) {
|
|
1186
1186
|
const t = Ke();
|
|
1187
1187
|
return `${e ?? t}`;
|
|
1188
1188
|
}
|
|
1189
|
-
const
|
|
1190
|
-
function
|
|
1191
|
-
const t =
|
|
1192
|
-
return
|
|
1189
|
+
const A = typeof window < "u" ? Xe : Ce;
|
|
1190
|
+
function ce(e) {
|
|
1191
|
+
const t = I(e);
|
|
1192
|
+
return A(() => {
|
|
1193
1193
|
t.current = e;
|
|
1194
1194
|
}, [e]), qe((n) => t.current?.(n), [t]);
|
|
1195
1195
|
}
|
|
1196
|
-
function
|
|
1197
|
-
return
|
|
1196
|
+
function fe(...e) {
|
|
1197
|
+
return ce((t) => {
|
|
1198
1198
|
e.forEach((n) => {
|
|
1199
1199
|
if (n)
|
|
1200
1200
|
switch (typeof n) {
|
|
@@ -1211,24 +1211,24 @@ function ce(...e) {
|
|
|
1211
1211
|
});
|
|
1212
1212
|
}
|
|
1213
1213
|
function Lt(e) {
|
|
1214
|
-
const t =
|
|
1215
|
-
return
|
|
1214
|
+
const t = I({ ...e });
|
|
1215
|
+
return A(() => {
|
|
1216
1216
|
for (const n in e)
|
|
1217
1217
|
t.current[n] = e[n];
|
|
1218
1218
|
}, [e]), t.current;
|
|
1219
1219
|
}
|
|
1220
|
-
const
|
|
1221
|
-
function
|
|
1220
|
+
const je = "--react-resizable-panels--panel--pointer-events";
|
|
1221
|
+
function He(e, t) {
|
|
1222
1222
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1223
1223
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1224
1224
|
}
|
|
1225
1225
|
const Be = Ye(null);
|
|
1226
1226
|
function Pt(e, t) {
|
|
1227
|
-
const n =
|
|
1227
|
+
const n = I({
|
|
1228
1228
|
getLayout: () => ({}),
|
|
1229
1229
|
setLayout: ut
|
|
1230
1230
|
});
|
|
1231
|
-
Ee(t, () => n.current, []),
|
|
1231
|
+
Ee(t, () => n.current, []), A(() => {
|
|
1232
1232
|
Object.assign(
|
|
1233
1233
|
n.current,
|
|
1234
1234
|
Ge({ groupId: e })
|
|
@@ -1249,62 +1249,63 @@ function Tt({
|
|
|
1249
1249
|
style: f,
|
|
1250
1250
|
...p
|
|
1251
1251
|
}) {
|
|
1252
|
-
const
|
|
1253
|
-
|
|
1254
|
-
}), c =
|
|
1252
|
+
const h = I({}), m = ce((L) => {
|
|
1253
|
+
U(h.current, L) || (h.current = L, a?.(L));
|
|
1254
|
+
}), c = ue(r), [d, y] = D(!1), v = I(null), [S, x] = D(n ?? {}), [g, b] = D([]), [w, C] = D([]), Y = I({
|
|
1255
1255
|
lastExpandedPanelSizes: {},
|
|
1256
1256
|
layouts: {}
|
|
1257
|
-
}),
|
|
1257
|
+
}), oe = fe(v, s);
|
|
1258
1258
|
Pt(c, l);
|
|
1259
|
-
const
|
|
1259
|
+
const Z = se(
|
|
1260
1260
|
() => ({
|
|
1261
1261
|
id: c,
|
|
1262
1262
|
orientation: u,
|
|
1263
|
-
registerPanel: (
|
|
1264
|
-
|
|
1263
|
+
registerPanel: (L) => (b((P) => ae(u, [...P, L])), () => {
|
|
1264
|
+
b((P) => P.filter((O) => O !== L));
|
|
1265
1265
|
}),
|
|
1266
|
-
registerSeparator: (
|
|
1267
|
-
(
|
|
1266
|
+
registerSeparator: (L) => (C(
|
|
1267
|
+
(P) => ae(u, [...P, L])
|
|
1268
1268
|
), () => {
|
|
1269
|
-
|
|
1270
|
-
(
|
|
1269
|
+
C(
|
|
1270
|
+
(P) => P.filter((O) => O !== L)
|
|
1271
1271
|
);
|
|
1272
1272
|
})
|
|
1273
1273
|
}),
|
|
1274
1274
|
[c, u]
|
|
1275
|
-
),
|
|
1275
|
+
), $ = Lt({
|
|
1276
1276
|
defaultLayout: n,
|
|
1277
1277
|
disableCursor: o
|
|
1278
|
-
}),
|
|
1279
|
-
|
|
1280
|
-
|
|
1278
|
+
}), F = I(null);
|
|
1279
|
+
A(() => {
|
|
1280
|
+
const L = v.current;
|
|
1281
|
+
if (L === null)
|
|
1281
1282
|
return;
|
|
1282
|
-
const
|
|
1283
|
-
defaultLayout:
|
|
1284
|
-
disableCursor:
|
|
1283
|
+
const P = {
|
|
1284
|
+
defaultLayout: $.defaultLayout,
|
|
1285
|
+
disableCursor: !!$.disableCursor,
|
|
1285
1286
|
disabled: !!i,
|
|
1286
|
-
element:
|
|
1287
|
+
element: L,
|
|
1287
1288
|
id: c,
|
|
1288
|
-
inMemoryLastExpandedPanelSizes:
|
|
1289
|
-
inMemoryLayouts:
|
|
1289
|
+
inMemoryLastExpandedPanelSizes: Y.current.lastExpandedPanelSizes,
|
|
1290
|
+
inMemoryLayouts: Y.current.layouts,
|
|
1290
1291
|
orientation: u,
|
|
1291
|
-
panels:
|
|
1292
|
-
separators:
|
|
1292
|
+
panels: g,
|
|
1293
|
+
separators: w
|
|
1293
1294
|
};
|
|
1294
|
-
|
|
1295
|
-
const
|
|
1295
|
+
F.current = P;
|
|
1296
|
+
const O = wt(P), pe = G().mountedGroups.get(P);
|
|
1296
1297
|
if (pe) {
|
|
1297
|
-
const { defaultLayoutDeferred:
|
|
1298
|
-
!
|
|
1298
|
+
const { defaultLayoutDeferred: j, derivedPanelConstraints: H, layout: Q } = pe;
|
|
1299
|
+
!j && H.length > 0 && (x(Q), m?.(Q));
|
|
1299
1300
|
}
|
|
1300
|
-
const
|
|
1301
|
+
const Ve = _.addListener(
|
|
1301
1302
|
"interactionStateChange",
|
|
1302
|
-
(
|
|
1303
|
-
switch (
|
|
1303
|
+
(j) => {
|
|
1304
|
+
switch (j.state) {
|
|
1304
1305
|
case "active": {
|
|
1305
1306
|
y(
|
|
1306
|
-
|
|
1307
|
-
(H) => H.group ===
|
|
1307
|
+
j.hitRegions.some(
|
|
1308
|
+
(H) => H.group === P
|
|
1308
1309
|
)
|
|
1309
1310
|
);
|
|
1310
1311
|
break;
|
|
@@ -1315,42 +1316,41 @@ function Tt({
|
|
|
1315
1316
|
}
|
|
1316
1317
|
}
|
|
1317
1318
|
}
|
|
1318
|
-
),
|
|
1319
|
+
), We = _.addListener(
|
|
1319
1320
|
"mountedGroupsChange",
|
|
1320
|
-
(
|
|
1321
|
-
const H =
|
|
1321
|
+
(j) => {
|
|
1322
|
+
const H = j.get(P);
|
|
1322
1323
|
if (H) {
|
|
1323
|
-
const { defaultLayoutDeferred:
|
|
1324
|
-
if (
|
|
1324
|
+
const { defaultLayoutDeferred: Q, derivedPanelConstraints: Ue, layout: he } = H;
|
|
1325
|
+
if (Q || Ue.length === 0)
|
|
1325
1326
|
return;
|
|
1326
|
-
|
|
1327
|
+
x(he), m?.(he);
|
|
1327
1328
|
}
|
|
1328
1329
|
}
|
|
1329
1330
|
);
|
|
1330
1331
|
return () => {
|
|
1331
|
-
|
|
1332
|
+
F.current = null, O(), Ve(), We();
|
|
1332
1333
|
};
|
|
1333
1334
|
}, [
|
|
1334
1335
|
i,
|
|
1335
|
-
v,
|
|
1336
1336
|
c,
|
|
1337
|
-
|
|
1337
|
+
m,
|
|
1338
1338
|
u,
|
|
1339
|
+
g,
|
|
1339
1340
|
w,
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
b && (b.defaultLayout = n, b.disableCursor = !!o);
|
|
1341
|
+
$
|
|
1342
|
+
]), Ce(() => {
|
|
1343
|
+
const L = F.current;
|
|
1344
|
+
L && (L.defaultLayout = n, L.disableCursor = !!o);
|
|
1345
1345
|
});
|
|
1346
|
-
const
|
|
1347
|
-
[
|
|
1346
|
+
const J = {
|
|
1347
|
+
[je]: d ? "none" : void 0
|
|
1348
1348
|
};
|
|
1349
|
-
for (const
|
|
1350
|
-
const
|
|
1351
|
-
|
|
1349
|
+
for (const L in S) {
|
|
1350
|
+
const P = He(c, L), O = S[L];
|
|
1351
|
+
J[P] = O;
|
|
1352
1352
|
}
|
|
1353
|
-
return /* @__PURE__ */ K(Be.Provider, { value:
|
|
1353
|
+
return /* @__PURE__ */ K(Be.Provider, { value: Z, children: /* @__PURE__ */ K(
|
|
1354
1354
|
"div",
|
|
1355
1355
|
{
|
|
1356
1356
|
...p,
|
|
@@ -1359,10 +1359,10 @@ function Tt({
|
|
|
1359
1359
|
"data-group": !0,
|
|
1360
1360
|
"data-testid": c,
|
|
1361
1361
|
id: c,
|
|
1362
|
-
ref:
|
|
1362
|
+
ref: oe,
|
|
1363
1363
|
style: {
|
|
1364
1364
|
...f,
|
|
1365
|
-
...
|
|
1365
|
+
...J,
|
|
1366
1366
|
display: "flex",
|
|
1367
1367
|
flexDirection: u === "horizontal" ? "row" : "column",
|
|
1368
1368
|
flexWrap: "nowrap"
|
|
@@ -1371,7 +1371,7 @@ function Tt({
|
|
|
1371
1371
|
}
|
|
1372
1372
|
) });
|
|
1373
1373
|
}
|
|
1374
|
-
function
|
|
1374
|
+
function Rt(e, t = 10) {
|
|
1375
1375
|
let n = null;
|
|
1376
1376
|
return (o) => {
|
|
1377
1377
|
n !== null && clearTimeout(n), n = setTimeout(() => {
|
|
@@ -1379,54 +1379,57 @@ function Ct(e, t = 10) {
|
|
|
1379
1379
|
}, t);
|
|
1380
1380
|
};
|
|
1381
1381
|
}
|
|
1382
|
-
function
|
|
1383
|
-
return `react-resizable-panels:${e}`;
|
|
1382
|
+
function ie(e, t) {
|
|
1383
|
+
return `react-resizable-panels:${[e, ...t].join(":")}`;
|
|
1384
1384
|
}
|
|
1385
1385
|
function _t({
|
|
1386
1386
|
debounceSaveMs: e = 100,
|
|
1387
|
-
|
|
1388
|
-
|
|
1387
|
+
panelIds: t,
|
|
1388
|
+
storage: n,
|
|
1389
|
+
...o
|
|
1389
1390
|
}) {
|
|
1390
|
-
const
|
|
1391
|
-
|
|
1392
|
-
() =>
|
|
1393
|
-
() =>
|
|
1394
|
-
),
|
|
1395
|
-
() =>
|
|
1396
|
-
[
|
|
1397
|
-
),
|
|
1398
|
-
const
|
|
1391
|
+
const i = t !== void 0, s = "id" in o ? o.id : o.groupId, l = ie(s, t ?? []), r = Ze(
|
|
1392
|
+
Ct,
|
|
1393
|
+
() => n.getItem(l),
|
|
1394
|
+
() => n.getItem(l)
|
|
1395
|
+
), a = se(
|
|
1396
|
+
() => r ? JSON.parse(r) : void 0,
|
|
1397
|
+
[r]
|
|
1398
|
+
), u = se(() => {
|
|
1399
|
+
const f = (p) => {
|
|
1400
|
+
let h;
|
|
1401
|
+
i ? h = ie(s, Object.keys(p)) : h = ie(s, []);
|
|
1399
1402
|
try {
|
|
1400
|
-
|
|
1401
|
-
} catch (
|
|
1402
|
-
console.error(
|
|
1403
|
+
n.setItem(h, JSON.stringify(p));
|
|
1404
|
+
} catch (m) {
|
|
1405
|
+
console.error(m);
|
|
1403
1406
|
}
|
|
1404
1407
|
};
|
|
1405
|
-
return e > 0 ?
|
|
1406
|
-
}, [e,
|
|
1408
|
+
return e > 0 ? Rt(f, e) : f;
|
|
1409
|
+
}, [e, i, s, n]);
|
|
1407
1410
|
return {
|
|
1408
|
-
defaultLayout:
|
|
1409
|
-
onLayoutChange:
|
|
1411
|
+
defaultLayout: a,
|
|
1412
|
+
onLayoutChange: u
|
|
1410
1413
|
};
|
|
1411
1414
|
}
|
|
1412
|
-
function
|
|
1415
|
+
function Ct() {
|
|
1413
1416
|
return function() {
|
|
1414
1417
|
};
|
|
1415
1418
|
}
|
|
1416
1419
|
function Nt() {
|
|
1417
|
-
return
|
|
1420
|
+
return D(null);
|
|
1418
1421
|
}
|
|
1419
1422
|
function At() {
|
|
1420
|
-
return
|
|
1423
|
+
return I(null);
|
|
1421
1424
|
}
|
|
1422
|
-
function
|
|
1425
|
+
function de() {
|
|
1423
1426
|
const e = Je(Be);
|
|
1424
1427
|
return z(
|
|
1425
1428
|
e,
|
|
1426
1429
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1427
1430
|
), e;
|
|
1428
1431
|
}
|
|
1429
|
-
function
|
|
1432
|
+
function Et({
|
|
1430
1433
|
groupId: e,
|
|
1431
1434
|
panelId: t
|
|
1432
1435
|
}) {
|
|
@@ -1438,7 +1441,7 @@ function Mt({
|
|
|
1438
1441
|
defaultLayoutDeferred: u,
|
|
1439
1442
|
derivedPanelConstraints: f,
|
|
1440
1443
|
layout: p,
|
|
1441
|
-
separatorToPanels:
|
|
1444
|
+
separatorToPanels: h
|
|
1442
1445
|
}
|
|
1443
1446
|
] of r)
|
|
1444
1447
|
if (a.id === e)
|
|
@@ -1447,7 +1450,7 @@ function Mt({
|
|
|
1447
1450
|
derivedPanelConstraints: f,
|
|
1448
1451
|
group: a,
|
|
1449
1452
|
layout: p,
|
|
1450
|
-
separatorToPanels:
|
|
1453
|
+
separatorToPanels: h
|
|
1451
1454
|
};
|
|
1452
1455
|
throw Error(`Group ${e} not found`);
|
|
1453
1456
|
}, o = () => {
|
|
@@ -1475,36 +1478,39 @@ function Mt({
|
|
|
1475
1478
|
defaultLayoutDeferred: u,
|
|
1476
1479
|
derivedPanelConstraints: f,
|
|
1477
1480
|
group: p,
|
|
1478
|
-
layout:
|
|
1479
|
-
separatorToPanels:
|
|
1481
|
+
layout: h,
|
|
1482
|
+
separatorToPanels: m
|
|
1480
1483
|
} = n(), c = p.panels.findIndex((S) => S.id === t), d = c === p.panels.length - 1, y = q({
|
|
1481
1484
|
delta: d ? a - r : r - a,
|
|
1482
|
-
initialLayout:
|
|
1485
|
+
initialLayout: h,
|
|
1483
1486
|
panelConstraints: f,
|
|
1484
1487
|
pivotIndices: d ? [c - 1, c] : [c, c + 1],
|
|
1485
|
-
prevLayout:
|
|
1488
|
+
prevLayout: h,
|
|
1486
1489
|
trigger: "imperative-api"
|
|
1487
|
-
}), v =
|
|
1490
|
+
}), v = N({
|
|
1488
1491
|
layout: y,
|
|
1489
1492
|
panelConstraints: f
|
|
1490
1493
|
});
|
|
1491
|
-
|
|
1494
|
+
U(h, v) || M((S) => ({
|
|
1492
1495
|
mountedGroups: new Map(S.mountedGroups).set(p, {
|
|
1493
1496
|
defaultLayoutDeferred: u,
|
|
1494
1497
|
derivedPanelConstraints: f,
|
|
1495
1498
|
layout: v,
|
|
1496
|
-
separatorToPanels:
|
|
1499
|
+
separatorToPanels: m
|
|
1497
1500
|
})
|
|
1498
1501
|
}));
|
|
1499
1502
|
};
|
|
1500
1503
|
return {
|
|
1501
1504
|
collapse: () => {
|
|
1502
|
-
const { collapsible: r, collapsedSize: a } = o(), u = s();
|
|
1503
|
-
r &&
|
|
1505
|
+
const { collapsible: r, collapsedSize: a } = o(), { expandToSizeRef: u } = i(), f = s();
|
|
1506
|
+
r && f !== a && (u.current = f, l(a));
|
|
1504
1507
|
},
|
|
1505
1508
|
expand: () => {
|
|
1506
|
-
const { collapsible: r, collapsedSize: a, minSize: u } = o(), f = s();
|
|
1507
|
-
r &&
|
|
1509
|
+
const { collapsible: r, collapsedSize: a, minSize: u } = o(), { expandToSizeRef: f } = i(), p = s();
|
|
1510
|
+
if (r && p === a) {
|
|
1511
|
+
let h = f.current ?? u;
|
|
1512
|
+
h === 0 && (h = 1), l(h);
|
|
1513
|
+
}
|
|
1508
1514
|
},
|
|
1509
1515
|
getSize: () => {
|
|
1510
1516
|
const { group: r } = n(), a = s(), { element: u } = i(), f = r.orientation === "horizontal" ? u.offsetWidth : u.offsetHeight;
|
|
@@ -1515,7 +1521,7 @@ function Mt({
|
|
|
1515
1521
|
},
|
|
1516
1522
|
isCollapsed: () => {
|
|
1517
1523
|
const { collapsible: r, collapsedSize: a } = o(), u = s();
|
|
1518
|
-
return r &&
|
|
1524
|
+
return r && R(a, u);
|
|
1519
1525
|
},
|
|
1520
1526
|
resize: (r) => {
|
|
1521
1527
|
if (s() !== r) {
|
|
@@ -1536,8 +1542,8 @@ function Mt({
|
|
|
1536
1542
|
}
|
|
1537
1543
|
};
|
|
1538
1544
|
}
|
|
1539
|
-
function
|
|
1540
|
-
const { id: n } =
|
|
1545
|
+
function Mt(e, t) {
|
|
1546
|
+
const { id: n } = de(), o = I({
|
|
1541
1547
|
collapse: re,
|
|
1542
1548
|
expand: re,
|
|
1543
1549
|
getSize: () => ({
|
|
@@ -1547,10 +1553,10 @@ function It(e, t) {
|
|
|
1547
1553
|
isCollapsed: () => !1,
|
|
1548
1554
|
resize: re
|
|
1549
1555
|
});
|
|
1550
|
-
Ee(t, () => o.current, []),
|
|
1556
|
+
Ee(t, () => o.current, []), A(() => {
|
|
1551
1557
|
Object.assign(
|
|
1552
1558
|
o.current,
|
|
1553
|
-
|
|
1559
|
+
Et({ groupId: n, panelId: e })
|
|
1554
1560
|
);
|
|
1555
1561
|
});
|
|
1556
1562
|
}
|
|
@@ -1567,18 +1573,20 @@ function $t({
|
|
|
1567
1573
|
onResize: u,
|
|
1568
1574
|
panelRef: f,
|
|
1569
1575
|
style: p,
|
|
1570
|
-
...
|
|
1576
|
+
...h
|
|
1571
1577
|
}) {
|
|
1572
|
-
const
|
|
1573
|
-
u?.(
|
|
1578
|
+
const m = !!l, c = ue(l), d = I(null), y = fe(d, s), { id: v, registerPanel: S } = de(), x = u !== null, g = ce((w) => {
|
|
1579
|
+
u?.(w, l);
|
|
1574
1580
|
});
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1581
|
+
A(() => {
|
|
1582
|
+
const w = d.current;
|
|
1583
|
+
if (w !== null)
|
|
1584
|
+
return S({
|
|
1585
|
+
element: w,
|
|
1586
|
+
expandToSizeRef: { current: void 0 },
|
|
1579
1587
|
id: c,
|
|
1580
|
-
idIsStable:
|
|
1581
|
-
onResize:
|
|
1588
|
+
idIsStable: m,
|
|
1589
|
+
onResize: x ? g : void 0,
|
|
1582
1590
|
panelConstraints: {
|
|
1583
1591
|
collapsedSize: n,
|
|
1584
1592
|
collapsible: o,
|
|
@@ -1591,34 +1599,33 @@ function $t({
|
|
|
1591
1599
|
n,
|
|
1592
1600
|
o,
|
|
1593
1601
|
i,
|
|
1594
|
-
|
|
1595
|
-
g,
|
|
1602
|
+
x,
|
|
1596
1603
|
c,
|
|
1597
|
-
|
|
1604
|
+
m,
|
|
1598
1605
|
r,
|
|
1599
1606
|
a,
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
]),
|
|
1603
|
-
const
|
|
1607
|
+
g,
|
|
1608
|
+
S
|
|
1609
|
+
]), Mt(c, f);
|
|
1610
|
+
const b = He(v, c);
|
|
1604
1611
|
return /* @__PURE__ */ K(
|
|
1605
1612
|
"div",
|
|
1606
1613
|
{
|
|
1607
|
-
...
|
|
1614
|
+
...h,
|
|
1608
1615
|
"data-panel": !0,
|
|
1609
1616
|
"data-testid": c,
|
|
1610
1617
|
id: c,
|
|
1611
|
-
ref:
|
|
1618
|
+
ref: y,
|
|
1612
1619
|
style: {
|
|
1613
|
-
...
|
|
1620
|
+
...It,
|
|
1614
1621
|
flexBasis: 0,
|
|
1615
|
-
flexGrow: `var(${
|
|
1622
|
+
flexGrow: `var(${b}, 1)`,
|
|
1616
1623
|
flexShrink: 1,
|
|
1617
1624
|
// Prevent Panel content from interfering with panel size
|
|
1618
1625
|
overflow: "hidden",
|
|
1619
1626
|
// Disable pointer events inside of a panel during resize
|
|
1620
1627
|
// This avoid edge cases like nested iframes
|
|
1621
|
-
pointerEvents: `var(${
|
|
1628
|
+
pointerEvents: `var(${je})`
|
|
1622
1629
|
},
|
|
1623
1630
|
children: /* @__PURE__ */ K(
|
|
1624
1631
|
"div",
|
|
@@ -1635,7 +1642,7 @@ function $t({
|
|
|
1635
1642
|
}
|
|
1636
1643
|
);
|
|
1637
1644
|
}
|
|
1638
|
-
const
|
|
1645
|
+
const It = {
|
|
1639
1646
|
minHeight: "unset",
|
|
1640
1647
|
maxHeight: "unset",
|
|
1641
1648
|
height: "unset",
|
|
@@ -1652,12 +1659,12 @@ const kt = {
|
|
|
1652
1659
|
margin: "unset"
|
|
1653
1660
|
};
|
|
1654
1661
|
function Ft() {
|
|
1655
|
-
return I(null);
|
|
1656
|
-
}
|
|
1657
|
-
function Ht() {
|
|
1658
1662
|
return D(null);
|
|
1659
1663
|
}
|
|
1660
|
-
function
|
|
1664
|
+
function jt() {
|
|
1665
|
+
return I(null);
|
|
1666
|
+
}
|
|
1667
|
+
function kt({
|
|
1661
1668
|
layout: e,
|
|
1662
1669
|
panelConstraints: t,
|
|
1663
1670
|
panelId: n,
|
|
@@ -1669,7 +1676,7 @@ function Gt({
|
|
|
1669
1676
|
);
|
|
1670
1677
|
if (r) {
|
|
1671
1678
|
const a = r.maxSize, u = s = r.collapsible ? r.collapsedSize : r.minSize, f = [o, o + 1];
|
|
1672
|
-
s =
|
|
1679
|
+
s = N({
|
|
1673
1680
|
layout: q({
|
|
1674
1681
|
delta: u - l,
|
|
1675
1682
|
initialLayout: e,
|
|
@@ -1679,7 +1686,7 @@ function Gt({
|
|
|
1679
1686
|
trigger: "keyboard"
|
|
1680
1687
|
}),
|
|
1681
1688
|
panelConstraints: t
|
|
1682
|
-
})[n], i =
|
|
1689
|
+
})[n], i = N({
|
|
1683
1690
|
layout: q({
|
|
1684
1691
|
delta: a - l,
|
|
1685
1692
|
initialLayout: e,
|
|
@@ -1698,7 +1705,7 @@ function Gt({
|
|
|
1698
1705
|
valueNow: l
|
|
1699
1706
|
};
|
|
1700
1707
|
}
|
|
1701
|
-
function
|
|
1708
|
+
function Ht({
|
|
1702
1709
|
children: e,
|
|
1703
1710
|
className: t,
|
|
1704
1711
|
elementRef: n,
|
|
@@ -1706,40 +1713,40 @@ function jt({
|
|
|
1706
1713
|
style: i,
|
|
1707
1714
|
...s
|
|
1708
1715
|
}) {
|
|
1709
|
-
const l =
|
|
1716
|
+
const l = ue(o), [r, a] = D({}), [u, f] = D("inactive"), [p, h] = D(null), m = fe(h, n), {
|
|
1710
1717
|
id: c,
|
|
1711
1718
|
orientation: d,
|
|
1712
1719
|
registerSeparator: y
|
|
1713
|
-
} =
|
|
1714
|
-
return
|
|
1720
|
+
} = de(), v = d === "horizontal" ? "vertical" : "horizontal";
|
|
1721
|
+
return A(() => {
|
|
1715
1722
|
if (p !== null) {
|
|
1716
1723
|
const S = {
|
|
1717
1724
|
element: p,
|
|
1718
1725
|
id: l
|
|
1719
|
-
}, x = y(S), g =
|
|
1726
|
+
}, x = y(S), g = _.addListener(
|
|
1720
1727
|
"interactionStateChange",
|
|
1721
|
-
(
|
|
1728
|
+
(w) => {
|
|
1722
1729
|
f(
|
|
1723
|
-
|
|
1724
|
-
(
|
|
1725
|
-
) ?
|
|
1730
|
+
w.state !== "inactive" && w.hitRegions.some(
|
|
1731
|
+
(C) => C.separator === S
|
|
1732
|
+
) ? w.state : "inactive"
|
|
1726
1733
|
);
|
|
1727
1734
|
}
|
|
1728
|
-
),
|
|
1735
|
+
), b = _.addListener(
|
|
1729
1736
|
"mountedGroupsChange",
|
|
1730
|
-
(
|
|
1731
|
-
|
|
1732
|
-
({ derivedPanelConstraints:
|
|
1733
|
-
if (
|
|
1734
|
-
const
|
|
1735
|
-
if (
|
|
1736
|
-
const
|
|
1737
|
+
(w) => {
|
|
1738
|
+
w.forEach(
|
|
1739
|
+
({ derivedPanelConstraints: C, layout: Y, separatorToPanels: oe }, Z) => {
|
|
1740
|
+
if (Z.id === c) {
|
|
1741
|
+
const $ = oe.get(S);
|
|
1742
|
+
if ($) {
|
|
1743
|
+
const F = $[0], J = Z.panels.indexOf(F);
|
|
1737
1744
|
a(
|
|
1738
|
-
|
|
1745
|
+
kt({
|
|
1739
1746
|
layout: Y,
|
|
1740
|
-
panelConstraints:
|
|
1741
|
-
panelId:
|
|
1742
|
-
panelIndex:
|
|
1747
|
+
panelConstraints: C,
|
|
1748
|
+
panelId: F.id,
|
|
1749
|
+
panelIndex: J
|
|
1743
1750
|
})
|
|
1744
1751
|
);
|
|
1745
1752
|
}
|
|
@@ -1749,7 +1756,7 @@ function jt({
|
|
|
1749
1756
|
}
|
|
1750
1757
|
);
|
|
1751
1758
|
return () => {
|
|
1752
|
-
g(),
|
|
1759
|
+
g(), b(), x();
|
|
1753
1760
|
};
|
|
1754
1761
|
}
|
|
1755
1762
|
}, [p, c, l, y]), /* @__PURE__ */ K(
|
|
@@ -1766,7 +1773,7 @@ function jt({
|
|
|
1766
1773
|
"data-separator": u,
|
|
1767
1774
|
"data-testid": l,
|
|
1768
1775
|
id: l,
|
|
1769
|
-
ref:
|
|
1776
|
+
ref: m,
|
|
1770
1777
|
role: "separator",
|
|
1771
1778
|
style: {
|
|
1772
1779
|
flexBasis: "auto",
|
|
@@ -1781,11 +1788,11 @@ function jt({
|
|
|
1781
1788
|
export {
|
|
1782
1789
|
Tt as Group,
|
|
1783
1790
|
$t as Panel,
|
|
1784
|
-
|
|
1791
|
+
Ht as Separator,
|
|
1785
1792
|
_t as useDefaultLayout,
|
|
1786
1793
|
Nt as useGroupCallbackRef,
|
|
1787
1794
|
At as useGroupRef,
|
|
1788
1795
|
Ft as usePanelCallbackRef,
|
|
1789
|
-
|
|
1796
|
+
jt as usePanelRef
|
|
1790
1797
|
};
|
|
1791
1798
|
//# sourceMappingURL=react-resizable-panels.js.map
|