react-resizable-panels 4.5.4 → 4.5.5
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,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as Q } from "react/jsx-runtime";
|
|
3
3
|
import { useState as ee, useCallback as Z, useId as nt, useLayoutEffect as Te, useEffect as Oe, useRef as k, createContext as ot, useImperativeHandle as Ae, useMemo as _e, useSyncExternalStore as it, useContext as rt } from "react";
|
|
4
|
-
function
|
|
4
|
+
function b(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
7
7
|
}
|
|
@@ -53,7 +53,7 @@ function lt({
|
|
|
53
53
|
const { x: s, y: a } = Fe(o, l), u = e === "horizontal" ? s : a;
|
|
54
54
|
u < r && (r = u, i = l);
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return b(i, "No rect found"), i;
|
|
57
57
|
}
|
|
58
58
|
let ie;
|
|
59
59
|
function ut() {
|
|
@@ -68,17 +68,17 @@ function $e(e) {
|
|
|
68
68
|
for (const c of r)
|
|
69
69
|
if (c.hasAttribute("data-panel")) {
|
|
70
70
|
const h = o.find(
|
|
71
|
-
(
|
|
71
|
+
(S) => S.element === c
|
|
72
72
|
);
|
|
73
73
|
if (h) {
|
|
74
74
|
if (a) {
|
|
75
|
-
const
|
|
75
|
+
const S = a.element.getBoundingClientRect(), m = c.getBoundingClientRect();
|
|
76
76
|
let f;
|
|
77
77
|
if (s) {
|
|
78
|
-
const d = n === "horizontal" ? new DOMRect(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
const d = n === "horizontal" ? new DOMRect(S.right, S.top, 0, S.height) : new DOMRect(
|
|
79
|
+
S.left,
|
|
80
|
+
S.bottom,
|
|
81
|
+
S.width,
|
|
82
82
|
0
|
|
83
83
|
), p = n === "horizontal" ? new DOMRect(m.left, m.top, 0, m.height) : new DOMRect(m.left, m.top, m.width, 0);
|
|
84
84
|
switch (u.length) {
|
|
@@ -92,12 +92,12 @@ function $e(e) {
|
|
|
92
92
|
case 1: {
|
|
93
93
|
const g = u[0], v = lt({
|
|
94
94
|
orientation: n,
|
|
95
|
-
rects: [
|
|
95
|
+
rects: [S, m],
|
|
96
96
|
targetRect: g.element.getBoundingClientRect()
|
|
97
97
|
});
|
|
98
98
|
f = [
|
|
99
99
|
g,
|
|
100
|
-
v ===
|
|
100
|
+
v === S ? p : d
|
|
101
101
|
];
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
@@ -109,15 +109,15 @@ function $e(e) {
|
|
|
109
109
|
} else
|
|
110
110
|
u.length ? f = u : f = [
|
|
111
111
|
n === "horizontal" ? new DOMRect(
|
|
112
|
-
|
|
112
|
+
S.right,
|
|
113
113
|
m.top,
|
|
114
|
-
m.left -
|
|
114
|
+
m.left - S.right,
|
|
115
115
|
m.height
|
|
116
116
|
) : new DOMRect(
|
|
117
117
|
m.left,
|
|
118
|
-
|
|
118
|
+
S.bottom,
|
|
119
119
|
m.width,
|
|
120
|
-
m.top -
|
|
120
|
+
m.top - S.bottom
|
|
121
121
|
)
|
|
122
122
|
];
|
|
123
123
|
for (const d of f) {
|
|
@@ -154,7 +154,7 @@ function $e(e) {
|
|
|
154
154
|
}
|
|
155
155
|
} else if (c.hasAttribute("data-separator")) {
|
|
156
156
|
const h = i.find(
|
|
157
|
-
(
|
|
157
|
+
(S) => S.element === c
|
|
158
158
|
);
|
|
159
159
|
h ? u.push(h) : (a = void 0, u = []);
|
|
160
160
|
} else
|
|
@@ -220,7 +220,7 @@ function re({
|
|
|
220
220
|
}
|
|
221
221
|
return o;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function T(e) {
|
|
224
224
|
return parseFloat(e.toFixed(3));
|
|
225
225
|
}
|
|
226
226
|
function ve(e) {
|
|
@@ -241,7 +241,7 @@ function ve(e) {
|
|
|
241
241
|
panelElement: i,
|
|
242
242
|
styleProp: r.collapsedSize
|
|
243
243
|
});
|
|
244
|
-
l =
|
|
244
|
+
l = T(c / n * 100);
|
|
245
245
|
}
|
|
246
246
|
let s;
|
|
247
247
|
if (r.defaultSize !== void 0) {
|
|
@@ -250,7 +250,7 @@ function ve(e) {
|
|
|
250
250
|
panelElement: i,
|
|
251
251
|
styleProp: r.defaultSize
|
|
252
252
|
});
|
|
253
|
-
s =
|
|
253
|
+
s = T(c / n * 100);
|
|
254
254
|
}
|
|
255
255
|
let a = 0;
|
|
256
256
|
if (r.minSize !== void 0) {
|
|
@@ -259,7 +259,7 @@ function ve(e) {
|
|
|
259
259
|
panelElement: i,
|
|
260
260
|
styleProp: r.minSize
|
|
261
261
|
});
|
|
262
|
-
a =
|
|
262
|
+
a = T(c / n * 100);
|
|
263
263
|
}
|
|
264
264
|
let u = 100;
|
|
265
265
|
if (r.maxSize !== void 0) {
|
|
@@ -268,7 +268,7 @@ function ve(e) {
|
|
|
268
268
|
panelElement: i,
|
|
269
269
|
styleProp: r.maxSize
|
|
270
270
|
});
|
|
271
|
-
u =
|
|
271
|
+
u = T(c / n * 100);
|
|
272
272
|
}
|
|
273
273
|
return {
|
|
274
274
|
collapsedSize: l,
|
|
@@ -320,7 +320,7 @@ class mt {
|
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
322
|
function R(e, t, n = 0) {
|
|
323
|
-
return Math.abs(
|
|
323
|
+
return Math.abs(T(e) - T(t)) <= n;
|
|
324
324
|
}
|
|
325
325
|
let I = {
|
|
326
326
|
cursorFlags: 0,
|
|
@@ -394,7 +394,7 @@ function St(e, t) {
|
|
|
394
394
|
let o;
|
|
395
395
|
for (; n.a.at(-1) === n.b.at(-1); )
|
|
396
396
|
o = n.a.pop(), n.b.pop();
|
|
397
|
-
|
|
397
|
+
b(
|
|
398
398
|
o,
|
|
399
399
|
"Stacking order can only be calculated for elements with a common ancestor"
|
|
400
400
|
);
|
|
@@ -429,7 +429,7 @@ function xe(e) {
|
|
|
429
429
|
let t = e.length;
|
|
430
430
|
for (; t--; ) {
|
|
431
431
|
const n = e[t];
|
|
432
|
-
if (
|
|
432
|
+
if (b(n, "Missing node"), zt(n)) return n;
|
|
433
433
|
}
|
|
434
434
|
return null;
|
|
435
435
|
}
|
|
@@ -492,7 +492,7 @@ function Lt(e, t) {
|
|
|
492
492
|
return !1;
|
|
493
493
|
return !0;
|
|
494
494
|
}
|
|
495
|
-
function
|
|
495
|
+
function D(e, t) {
|
|
496
496
|
return R(e, t) ? 0 : e > t ? 1 : -1;
|
|
497
497
|
}
|
|
498
498
|
function B({
|
|
@@ -505,13 +505,13 @@ function B({
|
|
|
505
505
|
maxSize: i = 100,
|
|
506
506
|
minSize: r = 0
|
|
507
507
|
} = e;
|
|
508
|
-
if (
|
|
508
|
+
if (D(t, r) < 0)
|
|
509
509
|
if (o) {
|
|
510
510
|
const l = (n + r) / 2;
|
|
511
|
-
|
|
511
|
+
D(t, l) < 0 ? t = n : t = r;
|
|
512
512
|
} else
|
|
513
513
|
t = r;
|
|
514
|
-
return t = Math.min(i, t), t =
|
|
514
|
+
return t = Math.min(i, t), t = T(t), t;
|
|
515
515
|
}
|
|
516
516
|
function te({
|
|
517
517
|
delta: e,
|
|
@@ -524,13 +524,13 @@ function te({
|
|
|
524
524
|
if (R(e, 0))
|
|
525
525
|
return t;
|
|
526
526
|
const l = Object.values(t), s = Object.values(i), a = [...l], [u, c] = o;
|
|
527
|
-
|
|
527
|
+
b(u != null, "Invalid first pivot index"), b(c != null, "Invalid second pivot index");
|
|
528
528
|
let h = 0;
|
|
529
529
|
switch (r) {
|
|
530
530
|
case "keyboard": {
|
|
531
531
|
{
|
|
532
532
|
const f = e < 0 ? c : u, d = n[f];
|
|
533
|
-
|
|
533
|
+
b(
|
|
534
534
|
d,
|
|
535
535
|
`Panel constraints not found for index ${f}`
|
|
536
536
|
);
|
|
@@ -541,18 +541,18 @@ function te({
|
|
|
541
541
|
} = d;
|
|
542
542
|
if (g) {
|
|
543
543
|
const x = l[f];
|
|
544
|
-
if (
|
|
544
|
+
if (b(
|
|
545
545
|
x != null,
|
|
546
546
|
`Previous layout not found for panel index ${f}`
|
|
547
547
|
), R(x, p)) {
|
|
548
|
-
const
|
|
549
|
-
|
|
548
|
+
const y = v - x;
|
|
549
|
+
D(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
}
|
|
553
553
|
{
|
|
554
554
|
const f = e < 0 ? u : c, d = n[f];
|
|
555
|
-
|
|
555
|
+
b(
|
|
556
556
|
d,
|
|
557
557
|
`No panel constraints found for index ${f}`
|
|
558
558
|
);
|
|
@@ -563,12 +563,12 @@ function te({
|
|
|
563
563
|
} = d;
|
|
564
564
|
if (g) {
|
|
565
565
|
const x = l[f];
|
|
566
|
-
if (
|
|
566
|
+
if (b(
|
|
567
567
|
x != null,
|
|
568
568
|
`Previous layout not found for panel index ${f}`
|
|
569
569
|
), R(x, v)) {
|
|
570
|
-
const
|
|
571
|
-
|
|
570
|
+
const y = x - p;
|
|
571
|
+
D(y, Math.abs(e)) > 0 && (e = e < 0 ? 0 - y : y);
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
}
|
|
@@ -576,19 +576,21 @@ function te({
|
|
|
576
576
|
}
|
|
577
577
|
default: {
|
|
578
578
|
const f = e < 0 ? c : u, d = n[f];
|
|
579
|
-
|
|
579
|
+
b(
|
|
580
580
|
d,
|
|
581
581
|
`Panel constraints not found for index ${f}`
|
|
582
582
|
);
|
|
583
583
|
const { collapsible: p, collapsedSize: g, minSize: v } = d;
|
|
584
|
-
if (p)
|
|
584
|
+
if (p) {
|
|
585
|
+
const x = f === c;
|
|
585
586
|
if (e > 0) {
|
|
586
|
-
const
|
|
587
|
-
|
|
587
|
+
const y = v - g, z = y / 2;
|
|
588
|
+
D(e, v) < 0 && (e = D(e, z) <= 0 ? 0 : y);
|
|
588
589
|
} else {
|
|
589
|
-
const
|
|
590
|
-
|
|
590
|
+
const y = v - g, z = 100 - y / 2;
|
|
591
|
+
x ? D(Math.abs(e), v) < 0 && (e = D(100 + e, z) > 0 ? 0 : -y) : D(100 + e, v) < 0 && (e = D(100 + e, z) > 0 ? 0 : -y);
|
|
591
592
|
}
|
|
593
|
+
}
|
|
592
594
|
break;
|
|
593
595
|
}
|
|
594
596
|
}
|
|
@@ -597,15 +599,15 @@ function te({
|
|
|
597
599
|
let d = e < 0 ? c : u, p = 0;
|
|
598
600
|
for (; ; ) {
|
|
599
601
|
const v = l[d];
|
|
600
|
-
|
|
602
|
+
b(
|
|
601
603
|
v != null,
|
|
602
604
|
`Previous layout not found for panel index ${d}`
|
|
603
605
|
);
|
|
604
|
-
const
|
|
606
|
+
const y = B({
|
|
605
607
|
panelConstraints: n[d],
|
|
606
608
|
size: 100
|
|
607
609
|
}) - v;
|
|
608
|
-
if (p +=
|
|
610
|
+
if (p += y, d += f, d < 0 || d >= n.length)
|
|
609
611
|
break;
|
|
610
612
|
}
|
|
611
613
|
const g = Math.min(Math.abs(e), Math.abs(p));
|
|
@@ -615,7 +617,7 @@ function te({
|
|
|
615
617
|
let d = e < 0 ? u : c;
|
|
616
618
|
for (; d >= 0 && d < n.length; ) {
|
|
617
619
|
const p = Math.abs(e) - Math.abs(h), g = l[d];
|
|
618
|
-
|
|
620
|
+
b(
|
|
619
621
|
g != null,
|
|
620
622
|
`Previous layout not found for panel index ${d}`
|
|
621
623
|
);
|
|
@@ -634,7 +636,7 @@ function te({
|
|
|
634
636
|
return i;
|
|
635
637
|
{
|
|
636
638
|
const f = e < 0 ? c : u, d = l[f];
|
|
637
|
-
|
|
639
|
+
b(
|
|
638
640
|
d != null,
|
|
639
641
|
`Previous layout not found for panel index ${f}`
|
|
640
642
|
);
|
|
@@ -643,28 +645,28 @@ function te({
|
|
|
643
645
|
size: p
|
|
644
646
|
});
|
|
645
647
|
if (a[f] = g, !R(g, p)) {
|
|
646
|
-
let v = p - g,
|
|
647
|
-
for (;
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
`Previous layout not found for panel index ${
|
|
648
|
+
let v = p - g, y = e < 0 ? c : u;
|
|
649
|
+
for (; y >= 0 && y < n.length; ) {
|
|
650
|
+
const z = a[y];
|
|
651
|
+
b(
|
|
652
|
+
z != null,
|
|
653
|
+
`Previous layout not found for panel index ${y}`
|
|
652
654
|
);
|
|
653
|
-
const C =
|
|
654
|
-
panelConstraints: n[
|
|
655
|
+
const C = z + v, P = B({
|
|
656
|
+
panelConstraints: n[y],
|
|
655
657
|
size: C
|
|
656
658
|
});
|
|
657
|
-
if (R(
|
|
659
|
+
if (R(z, P) || (v -= P - z, a[y] = P), R(v, 0))
|
|
658
660
|
break;
|
|
659
|
-
e > 0 ?
|
|
661
|
+
e > 0 ? y-- : y++;
|
|
660
662
|
}
|
|
661
663
|
}
|
|
662
664
|
}
|
|
663
|
-
const
|
|
665
|
+
const S = Object.values(a).reduce(
|
|
664
666
|
(f, d) => d + f,
|
|
665
667
|
0
|
|
666
668
|
);
|
|
667
|
-
if (!R(
|
|
669
|
+
if (!R(S, 100, 0.1))
|
|
668
670
|
return i;
|
|
669
671
|
const m = Object.keys(i);
|
|
670
672
|
return a.reduce((f, d, p) => (f[m[p]] = d, f), {});
|
|
@@ -673,7 +675,7 @@ function $(e, t) {
|
|
|
673
675
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
674
676
|
return !1;
|
|
675
677
|
for (const n in e)
|
|
676
|
-
if (t[n] === void 0 ||
|
|
678
|
+
if (t[n] === void 0 || D(e[n], t[n]) !== 0)
|
|
677
679
|
return !1;
|
|
678
680
|
return !0;
|
|
679
681
|
}
|
|
@@ -692,14 +694,14 @@ function H({
|
|
|
692
694
|
if (!R(i, 100) && o.length > 0)
|
|
693
695
|
for (let s = 0; s < t.length; s++) {
|
|
694
696
|
const a = o[s];
|
|
695
|
-
|
|
697
|
+
b(a != null, `No layout data found for index ${s}`);
|
|
696
698
|
const u = 100 / i * a;
|
|
697
699
|
o[s] = u;
|
|
698
700
|
}
|
|
699
701
|
let r = 0;
|
|
700
702
|
for (let s = 0; s < t.length; s++) {
|
|
701
703
|
const a = o[s];
|
|
702
|
-
|
|
704
|
+
b(a != null, `No layout data found for index ${s}`);
|
|
703
705
|
const u = B({
|
|
704
706
|
panelConstraints: t[s],
|
|
705
707
|
size: a
|
|
@@ -709,7 +711,7 @@ function H({
|
|
|
709
711
|
if (!R(r, 0))
|
|
710
712
|
for (let s = 0; s < t.length; s++) {
|
|
711
713
|
const a = o[s];
|
|
712
|
-
|
|
714
|
+
b(a != null, `No layout data found for index ${s}`);
|
|
713
715
|
const u = a + r, c = B({
|
|
714
716
|
panelConstraints: t[s],
|
|
715
717
|
size: u
|
|
@@ -732,7 +734,7 @@ function je({
|
|
|
732
734
|
defaultLayoutDeferred: u,
|
|
733
735
|
derivedPanelConstraints: c,
|
|
734
736
|
layout: h,
|
|
735
|
-
separatorToPanels:
|
|
737
|
+
separatorToPanels: S
|
|
736
738
|
}
|
|
737
739
|
] of s)
|
|
738
740
|
if (a.id === e)
|
|
@@ -741,7 +743,7 @@ function je({
|
|
|
741
743
|
derivedPanelConstraints: c,
|
|
742
744
|
group: a,
|
|
743
745
|
layout: h,
|
|
744
|
-
separatorToPanels:
|
|
746
|
+
separatorToPanels: S
|
|
745
747
|
};
|
|
746
748
|
throw Error(`Group ${e} not found`);
|
|
747
749
|
}, o = () => {
|
|
@@ -769,20 +771,20 @@ function je({
|
|
|
769
771
|
defaultLayoutDeferred: u,
|
|
770
772
|
derivedPanelConstraints: c,
|
|
771
773
|
group: h,
|
|
772
|
-
layout:
|
|
774
|
+
layout: S,
|
|
773
775
|
separatorToPanels: m
|
|
774
776
|
} = n(), f = h.panels.findIndex((v) => v.id === t), d = f === h.panels.length - 1, p = te({
|
|
775
777
|
delta: d ? a - s : s - a,
|
|
776
|
-
initialLayout:
|
|
778
|
+
initialLayout: S,
|
|
777
779
|
panelConstraints: c,
|
|
778
780
|
pivotIndices: d ? [f - 1, f] : [f, f + 1],
|
|
779
|
-
prevLayout:
|
|
781
|
+
prevLayout: S,
|
|
780
782
|
trigger: "imperative-api"
|
|
781
783
|
}), g = H({
|
|
782
784
|
layout: p,
|
|
783
785
|
panelConstraints: c
|
|
784
786
|
});
|
|
785
|
-
$(
|
|
787
|
+
$(S, g) || M((v) => ({
|
|
786
788
|
mountedGroups: new Map(v.mountedGroups).set(h, {
|
|
787
789
|
defaultLayoutDeferred: u,
|
|
788
790
|
derivedPanelConstraints: c,
|
|
@@ -799,8 +801,8 @@ function je({
|
|
|
799
801
|
expand: () => {
|
|
800
802
|
const { collapsible: s, collapsedSize: a, minSize: u } = o(), { mutableValues: c } = i(), h = r();
|
|
801
803
|
if (s && h === a) {
|
|
802
|
-
let
|
|
803
|
-
|
|
804
|
+
let S = c.expandToSize ?? u;
|
|
805
|
+
S === 0 && (S = 1), l(S);
|
|
804
806
|
}
|
|
805
807
|
},
|
|
806
808
|
getSize: () => {
|
|
@@ -820,7 +822,7 @@ function je({
|
|
|
820
822
|
switch (typeof s) {
|
|
821
823
|
case "number": {
|
|
822
824
|
const { group: c } = n(), h = K({ group: c });
|
|
823
|
-
u =
|
|
825
|
+
u = T(s / h * 100);
|
|
824
826
|
break;
|
|
825
827
|
}
|
|
826
828
|
case "string": {
|
|
@@ -900,15 +902,15 @@ function Ve({
|
|
|
900
902
|
}
|
|
901
903
|
function Ue(e) {
|
|
902
904
|
const { mountedGroups: t } = G(), n = t.get(e);
|
|
903
|
-
return
|
|
905
|
+
return b(n, `Mounted Group ${e.id} not found`), n;
|
|
904
906
|
}
|
|
905
907
|
function N(e, t) {
|
|
906
908
|
const n = ae(e), o = Ue(n), i = n.separators.find(
|
|
907
909
|
(h) => h.element === e
|
|
908
910
|
);
|
|
909
|
-
|
|
911
|
+
b(i, "Matching separator not found");
|
|
910
912
|
const r = o.separatorToPanels.get(i);
|
|
911
|
-
|
|
913
|
+
b(r, "Matching panels not found");
|
|
912
914
|
const l = r.map((h) => n.panels.indexOf(h)), a = Ve({ groupId: n.id }).getLayout(), u = te({
|
|
913
915
|
delta: t,
|
|
914
916
|
initialLayout: a,
|
|
@@ -960,15 +962,15 @@ function Le(e) {
|
|
|
960
962
|
const o = ae(t), { derivedPanelConstraints: i, layout: r, separatorToPanels: l } = Ue(o), s = o.separators.find(
|
|
961
963
|
(h) => h.element === t
|
|
962
964
|
);
|
|
963
|
-
|
|
965
|
+
b(s, "Matching separator not found");
|
|
964
966
|
const a = l.get(s);
|
|
965
|
-
|
|
967
|
+
b(a, "Matching panels not found");
|
|
966
968
|
const u = a[0], c = i.find(
|
|
967
969
|
(h) => h.panelId === u.id
|
|
968
970
|
);
|
|
969
|
-
if (
|
|
970
|
-
const h = r[u.id],
|
|
971
|
-
N(t,
|
|
971
|
+
if (b(c, "Panel metadata not found"), c.collapsible) {
|
|
972
|
+
const h = r[u.id], S = c.collapsedSize === h ? o.inMemoryLastExpandedPanelSizes[u.id] ?? c.minSize : c.collapsedSize;
|
|
973
|
+
N(t, S - h);
|
|
972
974
|
}
|
|
973
975
|
break;
|
|
974
976
|
}
|
|
@@ -979,7 +981,7 @@ function Le(e) {
|
|
|
979
981
|
), r = Array.from(i).findIndex(
|
|
980
982
|
(a) => a === e.currentTarget
|
|
981
983
|
);
|
|
982
|
-
|
|
984
|
+
b(r !== null, "Index not found");
|
|
983
985
|
const l = e.shiftKey ? r > 0 ? r - 1 : i.length - 1 : r + 1 < i.length ? r + 1 : 0;
|
|
984
986
|
i[l].focus();
|
|
985
987
|
break;
|
|
@@ -1101,25 +1103,25 @@ function qe({
|
|
|
1101
1103
|
let s = 0;
|
|
1102
1104
|
const a = new Map(i);
|
|
1103
1105
|
n.forEach((c) => {
|
|
1104
|
-
const { group: h, groupSize:
|
|
1106
|
+
const { group: h, groupSize: S } = c, { disableCursor: m, orientation: f, panels: d } = h;
|
|
1105
1107
|
let p = 0;
|
|
1106
|
-
r ? f === "horizontal" ? p = (t.clientX - r.x) /
|
|
1108
|
+
r ? f === "horizontal" ? p = (t.clientX - r.x) / S * 100 : p = (t.clientY - r.y) / S * 100 : f === "horizontal" ? p = t.clientX < 0 ? -100 : 100 : p = t.clientY < 0 ? -100 : 100;
|
|
1107
1109
|
const g = o.get(h), {
|
|
1108
1110
|
defaultLayoutDeferred: v,
|
|
1109
1111
|
derivedPanelConstraints: x,
|
|
1110
|
-
layout:
|
|
1111
|
-
separatorToPanels:
|
|
1112
|
+
layout: y,
|
|
1113
|
+
separatorToPanels: z
|
|
1112
1114
|
} = i.get(h) ?? { defaultLayoutDeferred: !1 };
|
|
1113
|
-
if (x && g &&
|
|
1115
|
+
if (x && g && y && z) {
|
|
1114
1116
|
const C = te({
|
|
1115
1117
|
delta: p,
|
|
1116
1118
|
initialLayout: g,
|
|
1117
1119
|
panelConstraints: x,
|
|
1118
1120
|
pivotIndices: c.panels.map((P) => d.indexOf(P)),
|
|
1119
|
-
prevLayout:
|
|
1121
|
+
prevLayout: y,
|
|
1120
1122
|
trigger: "mouse-or-touch"
|
|
1121
1123
|
});
|
|
1122
|
-
if ($(C,
|
|
1124
|
+
if ($(C, y)) {
|
|
1123
1125
|
if (p !== 0 && !m)
|
|
1124
1126
|
switch (f) {
|
|
1125
1127
|
case "horizontal": {
|
|
@@ -1136,9 +1138,9 @@ function qe({
|
|
|
1136
1138
|
defaultLayoutDeferred: v,
|
|
1137
1139
|
derivedPanelConstraints: x,
|
|
1138
1140
|
layout: C,
|
|
1139
|
-
separatorToPanels:
|
|
1141
|
+
separatorToPanels: z
|
|
1140
1142
|
});
|
|
1141
|
-
const P = c.group.panels.map(({ id:
|
|
1143
|
+
const P = c.group.panels.map(({ id: O }) => O).join(",");
|
|
1142
1144
|
c.group.inMemoryLayouts[P] = C;
|
|
1143
1145
|
}
|
|
1144
1146
|
}
|
|
@@ -1234,13 +1236,13 @@ function De(e) {
|
|
|
1234
1236
|
for (const r of e)
|
|
1235
1237
|
if (r.defaultSize !== void 0) {
|
|
1236
1238
|
t++;
|
|
1237
|
-
const l =
|
|
1239
|
+
const l = T(r.defaultSize);
|
|
1238
1240
|
n += l, o[r.panelId] = l;
|
|
1239
1241
|
} else
|
|
1240
1242
|
o[r.panelId] = void 0;
|
|
1241
1243
|
const i = e.length - t;
|
|
1242
1244
|
if (i !== 0) {
|
|
1243
|
-
const r =
|
|
1245
|
+
const r = T((100 - n) / i);
|
|
1244
1246
|
for (const l of e)
|
|
1245
1247
|
l.defaultSize === void 0 && (o[l.panelId] = r);
|
|
1246
1248
|
}
|
|
@@ -1253,7 +1255,7 @@ function Rt(e, t, n) {
|
|
|
1253
1255
|
if (!i || !i.onResize)
|
|
1254
1256
|
return;
|
|
1255
1257
|
const r = K({ group: e }), l = e.orientation === "horizontal" ? i.element.offsetWidth : i.element.offsetHeight, s = i.mutableValues.prevSize, a = {
|
|
1256
|
-
asPercentage:
|
|
1258
|
+
asPercentage: T(l / r * 100),
|
|
1257
1259
|
inPixels: l
|
|
1258
1260
|
};
|
|
1259
1261
|
i.mutableValues.prevSize = a, i.onResize(a, i.id, s);
|
|
@@ -1278,7 +1280,7 @@ function Et(e, t) {
|
|
|
1278
1280
|
const W = /* @__PURE__ */ new Map();
|
|
1279
1281
|
function kt(e) {
|
|
1280
1282
|
let t = !0;
|
|
1281
|
-
|
|
1283
|
+
b(
|
|
1282
1284
|
e.element.ownerDocument.defaultView,
|
|
1283
1285
|
"Cannot register an unmounted Group"
|
|
1284
1286
|
);
|
|
@@ -1290,21 +1292,21 @@ function kt(e) {
|
|
|
1290
1292
|
if (K({ group: e }) === 0)
|
|
1291
1293
|
return;
|
|
1292
1294
|
M((x) => {
|
|
1293
|
-
const
|
|
1294
|
-
if (
|
|
1295
|
-
const
|
|
1295
|
+
const y = x.mountedGroups.get(e);
|
|
1296
|
+
if (y) {
|
|
1297
|
+
const z = ve(e), C = y.defaultLayoutDeferred ? De(z) : y.layout, P = H({
|
|
1296
1298
|
layout: C,
|
|
1297
|
-
panelConstraints:
|
|
1299
|
+
panelConstraints: z
|
|
1298
1300
|
});
|
|
1299
|
-
return !
|
|
1300
|
-
|
|
1301
|
-
|
|
1301
|
+
return !y.defaultLayoutDeferred && $(C, P) && Mt(
|
|
1302
|
+
y.derivedPanelConstraints,
|
|
1303
|
+
z
|
|
1302
1304
|
) ? x : {
|
|
1303
1305
|
mountedGroups: new Map(x.mountedGroups).set(e, {
|
|
1304
1306
|
defaultLayoutDeferred: !1,
|
|
1305
|
-
derivedPanelConstraints:
|
|
1307
|
+
derivedPanelConstraints: z,
|
|
1306
1308
|
layout: P,
|
|
1307
|
-
separatorToPanels:
|
|
1309
|
+
separatorToPanels: y.separatorToPanels
|
|
1308
1310
|
})
|
|
1309
1311
|
};
|
|
1310
1312
|
}
|
|
@@ -1316,7 +1318,7 @@ function kt(e) {
|
|
|
1316
1318
|
}
|
|
1317
1319
|
});
|
|
1318
1320
|
r.observe(e.element), e.panels.forEach((f) => {
|
|
1319
|
-
|
|
1321
|
+
b(
|
|
1320
1322
|
!o.has(f.id),
|
|
1321
1323
|
`Panel ids must be unique; id "${f.id}" was used more than once`
|
|
1322
1324
|
), o.add(f.id), f.onResize && r.observe(f.element);
|
|
@@ -1327,13 +1329,13 @@ function kt(e) {
|
|
|
1327
1329
|
const c = e.inMemoryLayouts[a] ?? u ?? De(s), h = H({
|
|
1328
1330
|
layout: c,
|
|
1329
1331
|
panelConstraints: s
|
|
1330
|
-
}),
|
|
1332
|
+
}), S = $e(e), m = e.element.ownerDocument;
|
|
1331
1333
|
return M((f) => {
|
|
1332
1334
|
const d = /* @__PURE__ */ new Map();
|
|
1333
1335
|
return W.set(
|
|
1334
1336
|
m,
|
|
1335
1337
|
(W.get(m) ?? 0) + 1
|
|
1336
|
-
),
|
|
1338
|
+
), S.forEach((p) => {
|
|
1337
1339
|
p.separator && d.set(p.separator, p.panels);
|
|
1338
1340
|
}), {
|
|
1339
1341
|
mountedGroups: new Map(f.mountedGroups).set(e, {
|
|
@@ -1344,7 +1346,7 @@ function kt(e) {
|
|
|
1344
1346
|
})
|
|
1345
1347
|
};
|
|
1346
1348
|
}), e.separators.forEach((f) => {
|
|
1347
|
-
|
|
1349
|
+
b(
|
|
1348
1350
|
!i.has(f.id),
|
|
1349
1351
|
`Separator ids must be unique; id "${f.id}" was used more than once`
|
|
1350
1352
|
), i.add(f.id), f.element.addEventListener("keydown", Le);
|
|
@@ -1439,17 +1441,17 @@ function Dt({
|
|
|
1439
1441
|
coarse: 20,
|
|
1440
1442
|
fine: 10
|
|
1441
1443
|
},
|
|
1442
|
-
style:
|
|
1444
|
+
style: S,
|
|
1443
1445
|
...m
|
|
1444
1446
|
}) {
|
|
1445
1447
|
const f = k({
|
|
1446
1448
|
onLayoutChange: {},
|
|
1447
1449
|
onLayoutChanged: {}
|
|
1448
|
-
}), d = J((
|
|
1449
|
-
$(f.current.onLayoutChange,
|
|
1450
|
-
}), p = J((
|
|
1451
|
-
$(f.current.onLayoutChanged,
|
|
1452
|
-
}), g = me(s), v = k(null), [x,
|
|
1450
|
+
}), d = J((w) => {
|
|
1451
|
+
$(f.current.onLayoutChange, w) || (f.current.onLayoutChange = w, a?.(w));
|
|
1452
|
+
}), p = J((w) => {
|
|
1453
|
+
$(f.current.onLayoutChanged, w) || (f.current.onLayoutChanged = w, u?.(w));
|
|
1454
|
+
}), g = me(s), v = k(null), [x, y] = Ye(), z = k({
|
|
1453
1455
|
lastExpandedPanelSizes: {},
|
|
1454
1456
|
layouts: {},
|
|
1455
1457
|
panels: [],
|
|
@@ -1458,10 +1460,10 @@ function Dt({
|
|
|
1458
1460
|
}), C = ge(v, r);
|
|
1459
1461
|
It(g, l);
|
|
1460
1462
|
const P = J(
|
|
1461
|
-
(
|
|
1463
|
+
(w, L) => {
|
|
1462
1464
|
const { interactionState: E, mountedGroups: ne } = G();
|
|
1463
1465
|
for (const oe of ne.keys())
|
|
1464
|
-
if (oe.id ===
|
|
1466
|
+
if (oe.id === w) {
|
|
1465
1467
|
const X = ne.get(oe);
|
|
1466
1468
|
if (X) {
|
|
1467
1469
|
let q = !1;
|
|
@@ -1483,51 +1485,51 @@ function Dt({
|
|
|
1483
1485
|
flexGrow: n?.[L] ?? 1
|
|
1484
1486
|
};
|
|
1485
1487
|
}
|
|
1486
|
-
),
|
|
1488
|
+
), O = _e(
|
|
1487
1489
|
() => ({
|
|
1488
1490
|
getPanelStyles: P,
|
|
1489
1491
|
id: g,
|
|
1490
1492
|
orientation: c,
|
|
1491
|
-
registerPanel: (
|
|
1492
|
-
const L =
|
|
1493
|
+
registerPanel: (w) => {
|
|
1494
|
+
const L = z.current;
|
|
1493
1495
|
return L.panels = de(c, [
|
|
1494
1496
|
...L.panels,
|
|
1495
|
-
|
|
1496
|
-
]),
|
|
1497
|
+
w
|
|
1498
|
+
]), y(), () => {
|
|
1497
1499
|
L.panels = L.panels.filter(
|
|
1498
|
-
(E) => E !==
|
|
1499
|
-
),
|
|
1500
|
+
(E) => E !== w
|
|
1501
|
+
), y();
|
|
1500
1502
|
};
|
|
1501
1503
|
},
|
|
1502
|
-
registerSeparator: (
|
|
1503
|
-
const L =
|
|
1504
|
+
registerSeparator: (w) => {
|
|
1505
|
+
const L = z.current;
|
|
1504
1506
|
return L.separators = de(c, [
|
|
1505
1507
|
...L.separators,
|
|
1506
|
-
|
|
1507
|
-
]),
|
|
1508
|
+
w
|
|
1509
|
+
]), y(), () => {
|
|
1508
1510
|
L.separators = L.separators.filter(
|
|
1509
|
-
(E) => E !==
|
|
1510
|
-
),
|
|
1511
|
+
(E) => E !== w
|
|
1512
|
+
), y();
|
|
1511
1513
|
};
|
|
1512
1514
|
}
|
|
1513
1515
|
}),
|
|
1514
|
-
[P, g,
|
|
1516
|
+
[P, g, y, c]
|
|
1515
1517
|
), V = Gt({
|
|
1516
1518
|
defaultLayout: n,
|
|
1517
1519
|
disableCursor: o
|
|
1518
1520
|
}), A = k(null);
|
|
1519
1521
|
return j(() => {
|
|
1520
|
-
const
|
|
1521
|
-
if (
|
|
1522
|
+
const w = v.current;
|
|
1523
|
+
if (w === null)
|
|
1522
1524
|
return;
|
|
1523
|
-
const L =
|
|
1525
|
+
const L = z.current, E = {
|
|
1524
1526
|
defaultLayout: V.defaultLayout,
|
|
1525
1527
|
disableCursor: !!V.disableCursor,
|
|
1526
1528
|
disabled: !!i,
|
|
1527
|
-
element:
|
|
1529
|
+
element: w,
|
|
1528
1530
|
id: g,
|
|
1529
|
-
inMemoryLastExpandedPanelSizes:
|
|
1530
|
-
inMemoryLayouts:
|
|
1531
|
+
inMemoryLastExpandedPanelSizes: z.current.lastExpandedPanelSizes,
|
|
1532
|
+
inMemoryLayouts: z.current.layouts,
|
|
1531
1533
|
orientation: c,
|
|
1532
1534
|
panels: L.panels,
|
|
1533
1535
|
resizeTargetMinimumSize: L.resizeTargetMinimumSize,
|
|
@@ -1577,13 +1579,12 @@ function Dt({
|
|
|
1577
1579
|
x,
|
|
1578
1580
|
V
|
|
1579
1581
|
]), Oe(() => {
|
|
1580
|
-
const
|
|
1581
|
-
|
|
1582
|
-
}), /* @__PURE__ */ Q(Ze.Provider, { value:
|
|
1582
|
+
const w = A.current;
|
|
1583
|
+
w && (w.defaultLayout = n, w.disableCursor = !!o);
|
|
1584
|
+
}), /* @__PURE__ */ Q(Ze.Provider, { value: O, children: /* @__PURE__ */ Q(
|
|
1583
1585
|
"div",
|
|
1584
1586
|
{
|
|
1585
1587
|
...m,
|
|
1586
|
-
"aria-orientation": c,
|
|
1587
1588
|
className: t,
|
|
1588
1589
|
"data-group": !0,
|
|
1589
1590
|
"data-testid": g,
|
|
@@ -1593,7 +1594,7 @@ function Dt({
|
|
|
1593
1594
|
height: "100%",
|
|
1594
1595
|
width: "100%",
|
|
1595
1596
|
overflow: "hidden",
|
|
1596
|
-
...
|
|
1597
|
+
...S,
|
|
1597
1598
|
display: "flex",
|
|
1598
1599
|
flexDirection: c === "horizontal" ? "row" : "column",
|
|
1599
1600
|
flexWrap: "nowrap"
|
|
@@ -1638,7 +1639,7 @@ function jt({
|
|
|
1638
1639
|
}
|
|
1639
1640
|
},
|
|
1640
1641
|
[c, i, r, n]
|
|
1641
|
-
),
|
|
1642
|
+
), S = Z(
|
|
1642
1643
|
(m) => {
|
|
1643
1644
|
c(), e === 0 ? h(m) : u.current = setTimeout(() => {
|
|
1644
1645
|
h(m);
|
|
@@ -1656,7 +1657,7 @@ function jt({
|
|
|
1656
1657
|
*
|
|
1657
1658
|
* @deprecated Use the {@link onLayoutChanged} prop instead.
|
|
1658
1659
|
*/
|
|
1659
|
-
onLayoutChange:
|
|
1660
|
+
onLayoutChange: S,
|
|
1660
1661
|
/**
|
|
1661
1662
|
* Attach this callback on the `Group` as the `onLayoutChanged` prop.
|
|
1662
1663
|
*/
|
|
@@ -1675,7 +1676,7 @@ function Ut() {
|
|
|
1675
1676
|
}
|
|
1676
1677
|
function ye() {
|
|
1677
1678
|
const e = rt(Ze);
|
|
1678
|
-
return
|
|
1679
|
+
return b(
|
|
1679
1680
|
e,
|
|
1680
1681
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1681
1682
|
), e;
|
|
@@ -1711,25 +1712,25 @@ function At({
|
|
|
1711
1712
|
onResize: u,
|
|
1712
1713
|
panelRef: c,
|
|
1713
1714
|
style: h,
|
|
1714
|
-
...
|
|
1715
|
+
...S
|
|
1715
1716
|
}) {
|
|
1716
|
-
const m = !!l, f = me(l), d = k(null), p = ge(d, r), [, g] = Ye(), { getPanelStyles: v, id: x, registerPanel:
|
|
1717
|
-
(
|
|
1718
|
-
u?.(
|
|
1717
|
+
const m = !!l, f = me(l), d = k(null), p = ge(d, r), [, g] = Ye(), { getPanelStyles: v, id: x, registerPanel: y } = ye(), z = u !== null, C = J(
|
|
1718
|
+
(O, V, A) => {
|
|
1719
|
+
u?.(O, l, A);
|
|
1719
1720
|
}
|
|
1720
1721
|
);
|
|
1721
1722
|
j(() => {
|
|
1722
|
-
const
|
|
1723
|
-
if (
|
|
1724
|
-
return
|
|
1725
|
-
element:
|
|
1723
|
+
const O = d.current;
|
|
1724
|
+
if (O !== null)
|
|
1725
|
+
return y({
|
|
1726
|
+
element: O,
|
|
1726
1727
|
id: f,
|
|
1727
1728
|
idIsStable: m,
|
|
1728
1729
|
mutableValues: {
|
|
1729
1730
|
expandToSize: void 0,
|
|
1730
1731
|
prevSize: void 0
|
|
1731
1732
|
},
|
|
1732
|
-
onResize:
|
|
1733
|
+
onResize: z ? C : void 0,
|
|
1733
1734
|
panelConstraints: {
|
|
1734
1735
|
collapsedSize: n,
|
|
1735
1736
|
collapsible: o,
|
|
@@ -1744,19 +1745,19 @@ function At({
|
|
|
1744
1745
|
o,
|
|
1745
1746
|
i,
|
|
1746
1747
|
g,
|
|
1747
|
-
|
|
1748
|
+
z,
|
|
1748
1749
|
f,
|
|
1749
1750
|
m,
|
|
1750
1751
|
s,
|
|
1751
1752
|
a,
|
|
1752
1753
|
C,
|
|
1753
|
-
|
|
1754
|
+
y
|
|
1754
1755
|
]), Ot(f, c);
|
|
1755
1756
|
const P = v(x, f);
|
|
1756
1757
|
return /* @__PURE__ */ Q(
|
|
1757
1758
|
"div",
|
|
1758
1759
|
{
|
|
1759
|
-
...
|
|
1760
|
+
...S,
|
|
1760
1761
|
"data-panel": !0,
|
|
1761
1762
|
"data-testid": f,
|
|
1762
1763
|
id: f,
|
|
@@ -1852,7 +1853,7 @@ function Ft({
|
|
|
1852
1853
|
style: i,
|
|
1853
1854
|
...r
|
|
1854
1855
|
}) {
|
|
1855
|
-
const l = me(o), [s, a] = ee({}), [u, c] = ee("inactive"), h = k(null),
|
|
1856
|
+
const l = me(o), [s, a] = ee({}), [u, c] = ee("inactive"), h = k(null), S = ge(h, n), {
|
|
1856
1857
|
id: m,
|
|
1857
1858
|
orientation: f,
|
|
1858
1859
|
registerSeparator: d
|
|
@@ -1863,7 +1864,7 @@ function Ft({
|
|
|
1863
1864
|
const v = {
|
|
1864
1865
|
element: g,
|
|
1865
1866
|
id: l
|
|
1866
|
-
}, x = d(v),
|
|
1867
|
+
}, x = d(v), y = F.addListener(
|
|
1867
1868
|
"interactionStateChange",
|
|
1868
1869
|
(C) => {
|
|
1869
1870
|
c(
|
|
@@ -1872,18 +1873,18 @@ function Ft({
|
|
|
1872
1873
|
) ? C.state : "inactive"
|
|
1873
1874
|
);
|
|
1874
1875
|
}
|
|
1875
|
-
),
|
|
1876
|
+
), z = F.addListener(
|
|
1876
1877
|
"mountedGroupsChange",
|
|
1877
1878
|
(C) => {
|
|
1878
1879
|
C.forEach(
|
|
1879
|
-
({ derivedPanelConstraints: P, layout:
|
|
1880
|
+
({ derivedPanelConstraints: P, layout: O, separatorToPanels: V }, A) => {
|
|
1880
1881
|
if (A.id === m) {
|
|
1881
|
-
const
|
|
1882
|
-
if (
|
|
1883
|
-
const L =
|
|
1882
|
+
const w = V.get(v);
|
|
1883
|
+
if (w) {
|
|
1884
|
+
const L = w[0], E = A.panels.indexOf(L);
|
|
1884
1885
|
a(
|
|
1885
1886
|
Nt({
|
|
1886
|
-
layout:
|
|
1887
|
+
layout: O,
|
|
1887
1888
|
panelConstraints: P,
|
|
1888
1889
|
panelId: L.id,
|
|
1889
1890
|
panelIndex: E
|
|
@@ -1896,7 +1897,7 @@ function Ft({
|
|
|
1896
1897
|
}
|
|
1897
1898
|
);
|
|
1898
1899
|
return () => {
|
|
1899
|
-
|
|
1900
|
+
y(), z(), x();
|
|
1900
1901
|
};
|
|
1901
1902
|
}
|
|
1902
1903
|
}, [m, l, d]), /* @__PURE__ */ Q(
|
|
@@ -1913,7 +1914,7 @@ function Ft({
|
|
|
1913
1914
|
"data-separator": u,
|
|
1914
1915
|
"data-testid": l,
|
|
1915
1916
|
id: l,
|
|
1916
|
-
ref:
|
|
1917
|
+
ref: S,
|
|
1917
1918
|
role: "separator",
|
|
1918
1919
|
style: {
|
|
1919
1920
|
flexBasis: "auto",
|