react-resizable-panels 4.0.10 → 4.0.11
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 Xe, useLayoutEffect as Ye, useEffect as
|
|
3
|
+
import { useId as Xe, useLayoutEffect as Ye, useEffect as Re, useRef as O, useCallback as Ee, createContext as qe, useImperativeHandle as Me, useState as k, useMemo as ke, 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);
|
|
@@ -24,7 +24,7 @@ function et(e, t) {
|
|
|
24
24
|
const n = e.element.offsetTop - t.element.offsetTop;
|
|
25
25
|
return n !== 0 ? n : e.element.offsetHeight - t.element.offsetHeight;
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function Ie(e, t) {
|
|
28
28
|
return {
|
|
29
29
|
x: e.x >= t.left && e.x <= t.right ? 0 : Math.min(
|
|
30
30
|
Math.abs(e.x - t.left),
|
|
@@ -47,12 +47,12 @@ function tt({
|
|
|
47
47
|
};
|
|
48
48
|
let r, a = Number.MAX_VALUE;
|
|
49
49
|
for (const l of t) {
|
|
50
|
-
const { x: i, y: s } =
|
|
50
|
+
const { x: i, y: s } = Ie(o, l), u = e === "horizontal" ? i : s;
|
|
51
51
|
u < a && (a = u, r = l);
|
|
52
52
|
}
|
|
53
53
|
return z(r, "No rect found"), r;
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function Ge(e) {
|
|
56
56
|
const { element: t, orientation: n, panels: o, separators: r } = e, a = se(
|
|
57
57
|
n,
|
|
58
58
|
Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
|
|
@@ -83,14 +83,14 @@ function ke(e) {
|
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
case 1: {
|
|
86
|
-
const
|
|
86
|
+
const v = u[0], S = tt({
|
|
87
87
|
orientation: n,
|
|
88
88
|
rects: [m, p],
|
|
89
|
-
targetRect:
|
|
89
|
+
targetRect: v.element.getBoundingClientRect()
|
|
90
90
|
});
|
|
91
91
|
f = [
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
v,
|
|
93
|
+
S === m ? y : d
|
|
94
94
|
];
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
@@ -192,7 +192,7 @@ function te({
|
|
|
192
192
|
}
|
|
193
193
|
return o;
|
|
194
194
|
}
|
|
195
|
-
function
|
|
195
|
+
function I(e) {
|
|
196
196
|
return parseFloat(e.toFixed(3));
|
|
197
197
|
}
|
|
198
198
|
function ye(e) {
|
|
@@ -213,7 +213,7 @@ function ye(e) {
|
|
|
213
213
|
panelElement: r,
|
|
214
214
|
styleProp: a.collapsedSize
|
|
215
215
|
});
|
|
216
|
-
l =
|
|
216
|
+
l = I(c / n * 100);
|
|
217
217
|
}
|
|
218
218
|
let i;
|
|
219
219
|
if (a.defaultSize) {
|
|
@@ -222,7 +222,7 @@ function ye(e) {
|
|
|
222
222
|
panelElement: r,
|
|
223
223
|
styleProp: a.defaultSize
|
|
224
224
|
});
|
|
225
|
-
i =
|
|
225
|
+
i = I(c / n * 100);
|
|
226
226
|
}
|
|
227
227
|
let s = 0;
|
|
228
228
|
if (a.minSize) {
|
|
@@ -231,7 +231,7 @@ function ye(e) {
|
|
|
231
231
|
panelElement: r,
|
|
232
232
|
styleProp: a.minSize
|
|
233
233
|
});
|
|
234
|
-
s =
|
|
234
|
+
s = I(c / n * 100);
|
|
235
235
|
}
|
|
236
236
|
let u = 100;
|
|
237
237
|
if (a.maxSize) {
|
|
@@ -240,7 +240,7 @@ function ye(e) {
|
|
|
240
240
|
panelElement: r,
|
|
241
241
|
styleProp: a.maxSize
|
|
242
242
|
});
|
|
243
|
-
u =
|
|
243
|
+
u = I(c / n * 100);
|
|
244
244
|
}
|
|
245
245
|
return {
|
|
246
246
|
collapsedSize: l,
|
|
@@ -292,9 +292,9 @@ class at {
|
|
|
292
292
|
}
|
|
293
293
|
}
|
|
294
294
|
function P(e, t, n = 0) {
|
|
295
|
-
return Math.abs(
|
|
295
|
+
return Math.abs(I(e) - I(t)) <= n;
|
|
296
296
|
}
|
|
297
|
-
let
|
|
297
|
+
let R = {
|
|
298
298
|
cursorFlags: 0,
|
|
299
299
|
interactionState: {
|
|
300
300
|
state: "inactive"
|
|
@@ -303,17 +303,17 @@ let C = {
|
|
|
303
303
|
};
|
|
304
304
|
const _ = new at();
|
|
305
305
|
function D() {
|
|
306
|
-
return
|
|
306
|
+
return R;
|
|
307
307
|
}
|
|
308
308
|
function E(e) {
|
|
309
|
-
const t = typeof e == "function" ? e(
|
|
310
|
-
if (
|
|
311
|
-
return
|
|
312
|
-
const n =
|
|
313
|
-
return
|
|
314
|
-
...
|
|
309
|
+
const t = typeof e == "function" ? e(R) : e;
|
|
310
|
+
if (R === t)
|
|
311
|
+
return R;
|
|
312
|
+
const n = R;
|
|
313
|
+
return R = {
|
|
314
|
+
...R,
|
|
315
315
|
...t
|
|
316
|
-
}, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange",
|
|
316
|
+
}, t.cursorFlags !== void 0 && _.emit("cursorFlagsChange", R.cursorFlags), t.interactionState !== void 0 && _.emit("interactionStateChange", R.interactionState), t.mountedGroups !== void 0 && (R.mountedGroups.forEach((o, r) => {
|
|
317
317
|
o.derivedPanelConstraints.forEach((a) => {
|
|
318
318
|
if (a.collapsible) {
|
|
319
319
|
const { layout: l } = n.mountedGroups.get(r) ?? {};
|
|
@@ -329,7 +329,7 @@ function E(e) {
|
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
|
-
}), _.emit("mountedGroupsChange",
|
|
332
|
+
}), _.emit("mountedGroupsChange", R.mountedGroups)), R;
|
|
333
333
|
}
|
|
334
334
|
const lt = (e) => e, ie = () => {
|
|
335
335
|
}, De = 1, Oe = 2, Te = 4, _e = 8, ge = {
|
|
@@ -379,9 +379,9 @@ function ut({
|
|
|
379
379
|
}
|
|
380
380
|
return o > 0 && r > 0 ? "move" : o > 0 ? "ew-resize" : "ns-resize";
|
|
381
381
|
}
|
|
382
|
-
let re,
|
|
382
|
+
let re, G;
|
|
383
383
|
function le() {
|
|
384
|
-
|
|
384
|
+
G === void 0 && (G = new CSSStyleSheet(), document.adoptedStyleSheets = [G]);
|
|
385
385
|
const { cursorFlags: e, interactionState: t } = D();
|
|
386
386
|
switch (t.state) {
|
|
387
387
|
case "active":
|
|
@@ -393,11 +393,11 @@ function le() {
|
|
|
393
393
|
}), o = `*{cursor: ${n} !important; ${t.state === "active" ? "touch-action: none;" : ""} }`;
|
|
394
394
|
if (re === o)
|
|
395
395
|
return;
|
|
396
|
-
re = o, n ?
|
|
396
|
+
re = o, n ? G.cssRules.length === 0 ? G.insertRule(o) : G.replaceSync(o) : G.cssRules.length === 1 && G.deleteRule(0);
|
|
397
397
|
break;
|
|
398
398
|
}
|
|
399
399
|
case "inactive": {
|
|
400
|
-
re = void 0,
|
|
400
|
+
re = void 0, G.cssRules.length === 1 && G.deleteRule(0);
|
|
401
401
|
break;
|
|
402
402
|
}
|
|
403
403
|
}
|
|
@@ -413,7 +413,7 @@ function ct(e, t) {
|
|
|
413
413
|
function X(e, t) {
|
|
414
414
|
return P(e, t) ? 0 : e > t ? 1 : -1;
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function W({
|
|
417
417
|
panelConstraints: e,
|
|
418
418
|
size: t
|
|
419
419
|
}) {
|
|
@@ -429,7 +429,7 @@ function j({
|
|
|
429
429
|
X(t, l) < 0 ? t = n : t = a;
|
|
430
430
|
} else
|
|
431
431
|
t = a;
|
|
432
|
-
return t = Math.min(r, t), t =
|
|
432
|
+
return t = Math.min(r, t), t = I(t), t;
|
|
433
433
|
}
|
|
434
434
|
function Y({
|
|
435
435
|
delta: e,
|
|
@@ -453,17 +453,17 @@ function Y({
|
|
|
453
453
|
);
|
|
454
454
|
const {
|
|
455
455
|
collapsedSize: y = 0,
|
|
456
|
-
collapsible:
|
|
457
|
-
minSize:
|
|
456
|
+
collapsible: v,
|
|
457
|
+
minSize: S = 0
|
|
458
458
|
} = d;
|
|
459
|
-
if (
|
|
459
|
+
if (v) {
|
|
460
460
|
const x = l[f];
|
|
461
461
|
if (z(
|
|
462
462
|
x != null,
|
|
463
463
|
`Previous layout not found for panel index ${f}`
|
|
464
464
|
), P(x, y)) {
|
|
465
|
-
const
|
|
466
|
-
X(
|
|
465
|
+
const g = S - x;
|
|
466
|
+
X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
467
467
|
}
|
|
468
468
|
}
|
|
469
469
|
}
|
|
@@ -475,17 +475,17 @@ function Y({
|
|
|
475
475
|
);
|
|
476
476
|
const {
|
|
477
477
|
collapsedSize: y = 0,
|
|
478
|
-
collapsible:
|
|
479
|
-
minSize:
|
|
478
|
+
collapsible: v,
|
|
479
|
+
minSize: S = 0
|
|
480
480
|
} = d;
|
|
481
|
-
if (
|
|
481
|
+
if (v) {
|
|
482
482
|
const x = l[f];
|
|
483
483
|
if (z(
|
|
484
484
|
x != null,
|
|
485
485
|
`Previous layout not found for panel index ${f}`
|
|
486
|
-
), P(x,
|
|
487
|
-
const
|
|
488
|
-
X(
|
|
486
|
+
), P(x, S)) {
|
|
487
|
+
const g = x - y;
|
|
488
|
+
X(g, Math.abs(e)) > 0 && (e = e < 0 ? 0 - g : g);
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
}
|
|
@@ -494,34 +494,34 @@ function Y({
|
|
|
494
494
|
const f = e < 0 ? 1 : -1;
|
|
495
495
|
let d = e < 0 ? c : u, y = 0;
|
|
496
496
|
for (; ; ) {
|
|
497
|
-
const
|
|
497
|
+
const S = l[d];
|
|
498
498
|
z(
|
|
499
|
-
|
|
499
|
+
S != null,
|
|
500
500
|
`Previous layout not found for panel index ${d}`
|
|
501
501
|
);
|
|
502
|
-
const
|
|
502
|
+
const g = W({
|
|
503
503
|
panelConstraints: n[d],
|
|
504
504
|
size: 100
|
|
505
|
-
}) -
|
|
506
|
-
if (y +=
|
|
505
|
+
}) - S;
|
|
506
|
+
if (y += g, d += f, d < 0 || d >= n.length)
|
|
507
507
|
break;
|
|
508
508
|
}
|
|
509
|
-
const
|
|
510
|
-
e = e < 0 ? 0 -
|
|
509
|
+
const v = Math.min(Math.abs(e), Math.abs(y));
|
|
510
|
+
e = e < 0 ? 0 - v : v;
|
|
511
511
|
}
|
|
512
512
|
{
|
|
513
513
|
let d = e < 0 ? u : c;
|
|
514
514
|
for (; d >= 0 && d < n.length; ) {
|
|
515
|
-
const y = Math.abs(e) - Math.abs(h),
|
|
515
|
+
const y = Math.abs(e) - Math.abs(h), v = l[d];
|
|
516
516
|
z(
|
|
517
|
-
|
|
517
|
+
v != null,
|
|
518
518
|
`Previous layout not found for panel index ${d}`
|
|
519
519
|
);
|
|
520
|
-
const
|
|
520
|
+
const S = v - y, x = W({
|
|
521
521
|
panelConstraints: n[d],
|
|
522
|
-
size:
|
|
522
|
+
size: S
|
|
523
523
|
});
|
|
524
|
-
if (!P(
|
|
524
|
+
if (!P(v, x) && (h += v - x, s[d] = x, h.toFixed(3).localeCompare(Math.abs(e).toFixed(3), void 0, {
|
|
525
525
|
numeric: !0
|
|
526
526
|
}) >= 0))
|
|
527
527
|
break;
|
|
@@ -536,25 +536,25 @@ function Y({
|
|
|
536
536
|
d != null,
|
|
537
537
|
`Previous layout not found for panel index ${f}`
|
|
538
538
|
);
|
|
539
|
-
const y = d + h,
|
|
539
|
+
const y = d + h, v = W({
|
|
540
540
|
panelConstraints: n[f],
|
|
541
541
|
size: y
|
|
542
542
|
});
|
|
543
|
-
if (s[f] =
|
|
544
|
-
let
|
|
545
|
-
for (;
|
|
546
|
-
const b = s[
|
|
543
|
+
if (s[f] = v, !P(v, y)) {
|
|
544
|
+
let S = y - v, g = e < 0 ? c : u;
|
|
545
|
+
for (; g >= 0 && g < n.length; ) {
|
|
546
|
+
const b = s[g];
|
|
547
547
|
z(
|
|
548
548
|
b != null,
|
|
549
|
-
`Previous layout not found for panel index ${
|
|
549
|
+
`Previous layout not found for panel index ${g}`
|
|
550
550
|
);
|
|
551
|
-
const L = b +
|
|
552
|
-
panelConstraints: n[
|
|
551
|
+
const L = b + S, C = W({
|
|
552
|
+
panelConstraints: n[g],
|
|
553
553
|
size: L
|
|
554
554
|
});
|
|
555
|
-
if (P(b,
|
|
555
|
+
if (P(b, C) || (S -= C - b, s[g] = C), P(S, 0))
|
|
556
556
|
break;
|
|
557
|
-
e > 0 ?
|
|
557
|
+
e > 0 ? g-- : g++;
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
}
|
|
@@ -591,19 +591,19 @@ function Ae({
|
|
|
591
591
|
const f = n.get(s), {
|
|
592
592
|
defaultLayoutDeferred: d,
|
|
593
593
|
derivedPanelConstraints: y,
|
|
594
|
-
layout:
|
|
595
|
-
separatorToPanels:
|
|
594
|
+
layout: v,
|
|
595
|
+
separatorToPanels: S
|
|
596
596
|
} = o.get(s) ?? { defaultLayoutDeferred: !1 };
|
|
597
|
-
if (y && f &&
|
|
597
|
+
if (y && f && v && S) {
|
|
598
598
|
const x = Y({
|
|
599
599
|
delta: p,
|
|
600
600
|
initialLayout: f,
|
|
601
601
|
panelConstraints: y,
|
|
602
|
-
pivotIndices: i.panels.map((
|
|
603
|
-
prevLayout:
|
|
602
|
+
pivotIndices: i.panels.map((g) => m.indexOf(g)),
|
|
603
|
+
prevLayout: v,
|
|
604
604
|
trigger: "mouse-or-touch"
|
|
605
605
|
});
|
|
606
|
-
if (U(x,
|
|
606
|
+
if (U(x, v)) {
|
|
607
607
|
if (p !== 0 && !c)
|
|
608
608
|
switch (h) {
|
|
609
609
|
case "horizontal": {
|
|
@@ -620,10 +620,10 @@ function Ae({
|
|
|
620
620
|
defaultLayoutDeferred: d,
|
|
621
621
|
derivedPanelConstraints: y,
|
|
622
622
|
layout: x,
|
|
623
|
-
separatorToPanels:
|
|
623
|
+
separatorToPanels: S
|
|
624
624
|
});
|
|
625
|
-
const
|
|
626
|
-
i.group.inMemoryLayouts[
|
|
625
|
+
const g = i.group.panels.map(({ id: b }) => b).join(",");
|
|
626
|
+
i.group.inMemoryLayouts[g] = x;
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
}), E({
|
|
@@ -683,7 +683,7 @@ function A({
|
|
|
683
683
|
for (let i = 0; i < t.length; i++) {
|
|
684
684
|
const s = o[i];
|
|
685
685
|
z(s != null, `No layout data found for index ${i}`);
|
|
686
|
-
const u =
|
|
686
|
+
const u = W({
|
|
687
687
|
panelConstraints: t[i],
|
|
688
688
|
size: s
|
|
689
689
|
});
|
|
@@ -693,7 +693,7 @@ function A({
|
|
|
693
693
|
for (let i = 0; i < t.length; i++) {
|
|
694
694
|
const s = o[i];
|
|
695
695
|
z(s != null, `No layout data found for index ${i}`);
|
|
696
|
-
const u = s + a, c =
|
|
696
|
+
const u = s + a, c = W({
|
|
697
697
|
panelConstraints: t[i],
|
|
698
698
|
size: u
|
|
699
699
|
});
|
|
@@ -838,7 +838,7 @@ function ft(e, t, n) {
|
|
|
838
838
|
y: 1 / 0
|
|
839
839
|
};
|
|
840
840
|
for (const a of t) {
|
|
841
|
-
const l =
|
|
841
|
+
const l = Ie(n, a.rect);
|
|
842
842
|
switch (e) {
|
|
843
843
|
case "horizontal": {
|
|
844
844
|
l.x <= r.x && (o = a, r = l);
|
|
@@ -947,7 +947,7 @@ function He(e, t) {
|
|
|
947
947
|
return t.forEach((o, r) => {
|
|
948
948
|
if (r.disabled)
|
|
949
949
|
return;
|
|
950
|
-
const a = dt() ? ge.coarse : ge.precise, l =
|
|
950
|
+
const a = dt() ? ge.coarse : ge.precise, l = Ge(r), i = ft(r.orientation, l, {
|
|
951
951
|
x: e.clientX,
|
|
952
952
|
y: e.clientY
|
|
953
953
|
});
|
|
@@ -1036,19 +1036,19 @@ function Pe(e) {
|
|
|
1036
1036
|
}), le();
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
|
-
function
|
|
1039
|
+
function Ce(e) {
|
|
1040
1040
|
let t = 0, n = 0;
|
|
1041
1041
|
const o = {};
|
|
1042
1042
|
for (const a of e)
|
|
1043
1043
|
if (a.defaultSize !== void 0) {
|
|
1044
1044
|
t++;
|
|
1045
|
-
const l =
|
|
1045
|
+
const l = I(a.defaultSize);
|
|
1046
1046
|
n += l, o[a.panelId] = l;
|
|
1047
1047
|
} else
|
|
1048
1048
|
o[a.panelId] = void 0;
|
|
1049
1049
|
const r = e.length - t;
|
|
1050
1050
|
if (r !== 0) {
|
|
1051
|
-
const a =
|
|
1051
|
+
const a = I((100 - n) / r);
|
|
1052
1052
|
for (const l of e)
|
|
1053
1053
|
l.defaultSize === void 0 && (o[l.panelId] = a);
|
|
1054
1054
|
}
|
|
@@ -1064,7 +1064,7 @@ function St(e, t, n) {
|
|
|
1064
1064
|
const a = B({ group: e });
|
|
1065
1065
|
r.onResize(
|
|
1066
1066
|
{
|
|
1067
|
-
asPercentage:
|
|
1067
|
+
asPercentage: I(
|
|
1068
1068
|
o.inlineSize / a * 100
|
|
1069
1069
|
),
|
|
1070
1070
|
inPixels: o.inlineSize
|
|
@@ -1072,7 +1072,15 @@ function St(e, t, n) {
|
|
|
1072
1072
|
r.id
|
|
1073
1073
|
);
|
|
1074
1074
|
}
|
|
1075
|
-
function xt(e) {
|
|
1075
|
+
function xt(e, t) {
|
|
1076
|
+
if (Object.keys(e).length !== Object.keys(t).length)
|
|
1077
|
+
return !1;
|
|
1078
|
+
for (const o in e)
|
|
1079
|
+
if (e[o] !== t[o])
|
|
1080
|
+
return !1;
|
|
1081
|
+
return !0;
|
|
1082
|
+
}
|
|
1083
|
+
function zt(e) {
|
|
1076
1084
|
let t = !0;
|
|
1077
1085
|
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((p) => {
|
|
1078
1086
|
for (const f of p) {
|
|
@@ -1081,23 +1089,26 @@ function xt(e) {
|
|
|
1081
1089
|
if (t) {
|
|
1082
1090
|
if (B({ group: e }) === 0)
|
|
1083
1091
|
return;
|
|
1084
|
-
E((
|
|
1085
|
-
const x =
|
|
1092
|
+
E((S) => {
|
|
1093
|
+
const x = S.mountedGroups.get(e);
|
|
1086
1094
|
if (x) {
|
|
1087
|
-
const
|
|
1095
|
+
const g = ye(e), b = x.defaultLayoutDeferred ? Ce(g) : x.layout, L = A({
|
|
1088
1096
|
layout: b,
|
|
1089
|
-
panelConstraints:
|
|
1097
|
+
panelConstraints: g
|
|
1090
1098
|
});
|
|
1091
|
-
return !x.defaultLayoutDeferred && U(b, L)
|
|
1092
|
-
|
|
1099
|
+
return !x.defaultLayoutDeferred && U(b, L) && xt(
|
|
1100
|
+
x.derivedPanelConstraints,
|
|
1101
|
+
g
|
|
1102
|
+
) ? S : {
|
|
1103
|
+
mountedGroups: new Map(S.mountedGroups).set(e, {
|
|
1093
1104
|
defaultLayoutDeferred: !1,
|
|
1094
|
-
derivedPanelConstraints:
|
|
1105
|
+
derivedPanelConstraints: g,
|
|
1095
1106
|
layout: L,
|
|
1096
1107
|
separatorToPanels: x.separatorToPanels
|
|
1097
1108
|
})
|
|
1098
1109
|
};
|
|
1099
1110
|
}
|
|
1100
|
-
return
|
|
1111
|
+
return S;
|
|
1101
1112
|
});
|
|
1102
1113
|
}
|
|
1103
1114
|
} else
|
|
@@ -1113,10 +1124,10 @@ function xt(e) {
|
|
|
1113
1124
|
const a = B({ group: e }), l = ye(e), i = e.panels.map(({ id: p }) => p).join(",");
|
|
1114
1125
|
let s = e.defaultLayout;
|
|
1115
1126
|
s && e.panels.length !== Object.keys(s).length && (s = void 0);
|
|
1116
|
-
const u = e.inMemoryLayouts[i] ?? s ??
|
|
1127
|
+
const u = e.inMemoryLayouts[i] ?? s ?? Ce(l), c = A({
|
|
1117
1128
|
layout: u,
|
|
1118
1129
|
panelConstraints: l
|
|
1119
|
-
}), h =
|
|
1130
|
+
}), h = Ge(e), m = E((p) => {
|
|
1120
1131
|
const f = /* @__PURE__ */ new Map();
|
|
1121
1132
|
return h.forEach((d) => {
|
|
1122
1133
|
d.separator && f.set(d.separator, d.panels);
|
|
@@ -1149,7 +1160,7 @@ function ue(e) {
|
|
|
1149
1160
|
const t = Xe();
|
|
1150
1161
|
return `${e ?? t}`;
|
|
1151
1162
|
}
|
|
1152
|
-
const N = typeof window < "u" ? Ye :
|
|
1163
|
+
const N = typeof window < "u" ? Ye : Re;
|
|
1153
1164
|
function ce(e) {
|
|
1154
1165
|
const t = O(e);
|
|
1155
1166
|
return N(() => {
|
|
@@ -1173,20 +1184,20 @@ function fe(...e) {
|
|
|
1173
1184
|
});
|
|
1174
1185
|
});
|
|
1175
1186
|
}
|
|
1176
|
-
function
|
|
1187
|
+
function wt(e) {
|
|
1177
1188
|
const t = O({ ...e });
|
|
1178
1189
|
return N(() => {
|
|
1179
1190
|
for (const n in e)
|
|
1180
1191
|
t.current[n] = e[n];
|
|
1181
1192
|
}, [e]), t.current;
|
|
1182
1193
|
}
|
|
1183
|
-
const
|
|
1184
|
-
function
|
|
1194
|
+
const je = "--react-resizable-panels--panel--pointer-events";
|
|
1195
|
+
function We(e, t) {
|
|
1185
1196
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1186
1197
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1187
1198
|
}
|
|
1188
1199
|
const Be = qe(null);
|
|
1189
|
-
function
|
|
1200
|
+
function bt(e, t) {
|
|
1190
1201
|
const n = O({
|
|
1191
1202
|
getLayout: () => ({}),
|
|
1192
1203
|
setLayout: lt
|
|
@@ -1214,12 +1225,12 @@ function Gt({
|
|
|
1214
1225
|
}) {
|
|
1215
1226
|
const m = O({}), p = ce((w) => {
|
|
1216
1227
|
U(m.current, w) || (m.current = w, s?.(w));
|
|
1217
|
-
}), f = ue(i), [d, y] =
|
|
1228
|
+
}), f = ue(i), [d, y] = k(!1), [v, S] = k(null), [x, g] = k(n ?? {}), [b, L] = k([]), [C, q] = k([]), Z = O({
|
|
1218
1229
|
lastExpandedPanelSizes: {},
|
|
1219
1230
|
layouts: {}
|
|
1220
|
-
}), J = fe(
|
|
1221
|
-
|
|
1222
|
-
const Q =
|
|
1231
|
+
}), J = fe(S, a);
|
|
1232
|
+
bt(f, l);
|
|
1233
|
+
const Q = ke(
|
|
1223
1234
|
() => ({
|
|
1224
1235
|
id: f,
|
|
1225
1236
|
orientation: u,
|
|
@@ -1235,30 +1246,30 @@ function Gt({
|
|
|
1235
1246
|
})
|
|
1236
1247
|
}),
|
|
1237
1248
|
[f, u]
|
|
1238
|
-
), $ =
|
|
1249
|
+
), $ = wt({
|
|
1239
1250
|
defaultLayout: n,
|
|
1240
1251
|
disableCursor: o
|
|
1241
1252
|
}), V = O(null);
|
|
1242
1253
|
N(() => {
|
|
1243
|
-
if (
|
|
1254
|
+
if (v === null)
|
|
1244
1255
|
return;
|
|
1245
1256
|
const w = {
|
|
1246
1257
|
defaultLayout: $.defaultLayout,
|
|
1247
1258
|
disableCursor: !!$.disableCursor,
|
|
1248
1259
|
disabled: !!r,
|
|
1249
|
-
element:
|
|
1260
|
+
element: v,
|
|
1250
1261
|
id: f,
|
|
1251
1262
|
inMemoryLastExpandedPanelSizes: Z.current.lastExpandedPanelSizes,
|
|
1252
1263
|
inMemoryLayouts: Z.current.layouts,
|
|
1253
1264
|
orientation: u,
|
|
1254
1265
|
panels: b,
|
|
1255
|
-
separators:
|
|
1266
|
+
separators: C
|
|
1256
1267
|
};
|
|
1257
1268
|
V.current = w;
|
|
1258
|
-
const M =
|
|
1269
|
+
const M = zt(w), he = D().mountedGroups.get(w);
|
|
1259
1270
|
if (he) {
|
|
1260
|
-
const { defaultLayoutDeferred: H, derivedPanelConstraints:
|
|
1261
|
-
!H &&
|
|
1271
|
+
const { defaultLayoutDeferred: H, derivedPanelConstraints: j, layout: ee } = he;
|
|
1272
|
+
!H && j.length > 0 && (g(ee), p?.(ee));
|
|
1262
1273
|
}
|
|
1263
1274
|
const Ue = _.addListener(
|
|
1264
1275
|
"interactionStateChange",
|
|
@@ -1267,7 +1278,7 @@ function Gt({
|
|
|
1267
1278
|
case "active": {
|
|
1268
1279
|
y(
|
|
1269
1280
|
H.hitRegions.some(
|
|
1270
|
-
(
|
|
1281
|
+
(j) => j.group === w
|
|
1271
1282
|
)
|
|
1272
1283
|
);
|
|
1273
1284
|
break;
|
|
@@ -1281,12 +1292,12 @@ function Gt({
|
|
|
1281
1292
|
), Ve = _.addListener(
|
|
1282
1293
|
"mountedGroupsChange",
|
|
1283
1294
|
(H) => {
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1286
|
-
const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ke, layout: me } =
|
|
1295
|
+
const j = H.get(w);
|
|
1296
|
+
if (j) {
|
|
1297
|
+
const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ke, layout: me } = j;
|
|
1287
1298
|
if (ee || Ke.length === 0)
|
|
1288
1299
|
return;
|
|
1289
|
-
|
|
1300
|
+
g(me), p?.(me);
|
|
1290
1301
|
}
|
|
1291
1302
|
}
|
|
1292
1303
|
);
|
|
@@ -1295,22 +1306,22 @@ function Gt({
|
|
|
1295
1306
|
};
|
|
1296
1307
|
}, [
|
|
1297
1308
|
r,
|
|
1298
|
-
|
|
1309
|
+
v,
|
|
1299
1310
|
f,
|
|
1300
1311
|
p,
|
|
1301
1312
|
u,
|
|
1302
1313
|
b,
|
|
1303
|
-
|
|
1314
|
+
C,
|
|
1304
1315
|
$
|
|
1305
|
-
]),
|
|
1316
|
+
]), Re(() => {
|
|
1306
1317
|
const w = V.current;
|
|
1307
1318
|
w && (w.defaultLayout = n, w.disableCursor = !!o);
|
|
1308
1319
|
});
|
|
1309
1320
|
const pe = {
|
|
1310
|
-
[
|
|
1321
|
+
[je]: d ? "none" : void 0
|
|
1311
1322
|
};
|
|
1312
1323
|
for (const w in x) {
|
|
1313
|
-
const M =
|
|
1324
|
+
const M = We(f, w), F = x[w];
|
|
1314
1325
|
pe[M] = F;
|
|
1315
1326
|
}
|
|
1316
1327
|
return /* @__PURE__ */ K(Be.Provider, { value: Q, children: /* @__PURE__ */ K(
|
|
@@ -1337,7 +1348,7 @@ function Gt({
|
|
|
1337
1348
|
function ae(e) {
|
|
1338
1349
|
return `react-resizable-panels:${e}`;
|
|
1339
1350
|
}
|
|
1340
|
-
function
|
|
1351
|
+
function Lt({
|
|
1341
1352
|
id: e,
|
|
1342
1353
|
layout: t,
|
|
1343
1354
|
storage: n
|
|
@@ -1349,19 +1360,19 @@ function bt({
|
|
|
1349
1360
|
console.error(o);
|
|
1350
1361
|
}
|
|
1351
1362
|
}
|
|
1352
|
-
function
|
|
1363
|
+
function Dt({
|
|
1353
1364
|
groupId: e,
|
|
1354
1365
|
storage: t
|
|
1355
1366
|
}) {
|
|
1356
1367
|
const n = Ze(
|
|
1357
|
-
|
|
1368
|
+
Pt,
|
|
1358
1369
|
() => t.getItem(ae(e)),
|
|
1359
1370
|
() => t.getItem(ae(e))
|
|
1360
|
-
), o =
|
|
1371
|
+
), o = ke(
|
|
1361
1372
|
() => n ? JSON.parse(n) : void 0,
|
|
1362
1373
|
[n]
|
|
1363
1374
|
), r = Ee(
|
|
1364
|
-
(a) =>
|
|
1375
|
+
(a) => Lt({
|
|
1365
1376
|
id: e,
|
|
1366
1377
|
layout: a,
|
|
1367
1378
|
storage: t
|
|
@@ -1373,14 +1384,14 @@ function kt({
|
|
|
1373
1384
|
onLayoutChange: r
|
|
1374
1385
|
};
|
|
1375
1386
|
}
|
|
1376
|
-
function
|
|
1387
|
+
function Pt() {
|
|
1377
1388
|
return function() {
|
|
1378
1389
|
};
|
|
1379
1390
|
}
|
|
1380
|
-
function Dt() {
|
|
1381
|
-
return I(null);
|
|
1382
|
-
}
|
|
1383
1391
|
function Ot() {
|
|
1392
|
+
return k(null);
|
|
1393
|
+
}
|
|
1394
|
+
function Tt() {
|
|
1384
1395
|
return O(null);
|
|
1385
1396
|
}
|
|
1386
1397
|
function de() {
|
|
@@ -1390,7 +1401,7 @@ function de() {
|
|
|
1390
1401
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
1391
1402
|
), e;
|
|
1392
1403
|
}
|
|
1393
|
-
function
|
|
1404
|
+
function Ct({
|
|
1394
1405
|
groupId: e,
|
|
1395
1406
|
panelId: t
|
|
1396
1407
|
}) {
|
|
@@ -1441,22 +1452,22 @@ function Pt({
|
|
|
1441
1452
|
group: h,
|
|
1442
1453
|
layout: m,
|
|
1443
1454
|
separatorToPanels: p
|
|
1444
|
-
} = n(), f = h.panels.findIndex((
|
|
1455
|
+
} = n(), f = h.panels.findIndex((S) => S.id === t), d = f === h.panels.length - 1, y = Y({
|
|
1445
1456
|
delta: d ? s - i : i - s,
|
|
1446
1457
|
initialLayout: m,
|
|
1447
1458
|
panelConstraints: c,
|
|
1448
1459
|
pivotIndices: d ? [f - 1, f] : [f, f + 1],
|
|
1449
1460
|
prevLayout: m,
|
|
1450
1461
|
trigger: "imperative-api"
|
|
1451
|
-
}),
|
|
1462
|
+
}), v = A({
|
|
1452
1463
|
layout: y,
|
|
1453
1464
|
panelConstraints: c
|
|
1454
1465
|
});
|
|
1455
|
-
U(m,
|
|
1456
|
-
mountedGroups: new Map(
|
|
1466
|
+
U(m, v) || E((S) => ({
|
|
1467
|
+
mountedGroups: new Map(S.mountedGroups).set(h, {
|
|
1457
1468
|
defaultLayoutDeferred: u,
|
|
1458
1469
|
derivedPanelConstraints: c,
|
|
1459
|
-
layout:
|
|
1470
|
+
layout: v,
|
|
1460
1471
|
separatorToPanels: p
|
|
1461
1472
|
})
|
|
1462
1473
|
}));
|
|
@@ -1487,7 +1498,7 @@ function Pt({
|
|
|
1487
1498
|
switch (typeof i) {
|
|
1488
1499
|
case "number": {
|
|
1489
1500
|
const { group: c } = n(), h = B({ group: c });
|
|
1490
|
-
u =
|
|
1501
|
+
u = I(i / h * 100);
|
|
1491
1502
|
break;
|
|
1492
1503
|
}
|
|
1493
1504
|
case "string": {
|
|
@@ -1514,11 +1525,11 @@ function Rt(e, t) {
|
|
|
1514
1525
|
Me(t, () => o.current, []), N(() => {
|
|
1515
1526
|
Object.assign(
|
|
1516
1527
|
o.current,
|
|
1517
|
-
|
|
1528
|
+
Ct({ groupId: n, panelId: e })
|
|
1518
1529
|
);
|
|
1519
1530
|
});
|
|
1520
1531
|
}
|
|
1521
|
-
function
|
|
1532
|
+
function _t({
|
|
1522
1533
|
children: e,
|
|
1523
1534
|
className: t,
|
|
1524
1535
|
collapsedSize: n = "0%",
|
|
@@ -1533,8 +1544,8 @@ function Tt({
|
|
|
1533
1544
|
style: h,
|
|
1534
1545
|
...m
|
|
1535
1546
|
}) {
|
|
1536
|
-
const p = !!l, f = ue(l), [d, y] =
|
|
1537
|
-
u?.(
|
|
1547
|
+
const p = !!l, f = ue(l), [d, y] = k(null), v = fe(y, a), { id: S, registerPanel: x } = de(), g = u !== null, b = ce((C) => {
|
|
1548
|
+
u?.(C, l);
|
|
1538
1549
|
});
|
|
1539
1550
|
N(() => {
|
|
1540
1551
|
if (d !== null)
|
|
@@ -1542,7 +1553,7 @@ function Tt({
|
|
|
1542
1553
|
element: d,
|
|
1543
1554
|
id: f,
|
|
1544
1555
|
idIsStable: p,
|
|
1545
|
-
onResize:
|
|
1556
|
+
onResize: g ? b : void 0,
|
|
1546
1557
|
panelConstraints: {
|
|
1547
1558
|
collapsedSize: n,
|
|
1548
1559
|
collapsible: o,
|
|
@@ -1556,7 +1567,7 @@ function Tt({
|
|
|
1556
1567
|
o,
|
|
1557
1568
|
r,
|
|
1558
1569
|
d,
|
|
1559
|
-
|
|
1570
|
+
g,
|
|
1560
1571
|
f,
|
|
1561
1572
|
p,
|
|
1562
1573
|
i,
|
|
@@ -1564,7 +1575,7 @@ function Tt({
|
|
|
1564
1575
|
b,
|
|
1565
1576
|
x
|
|
1566
1577
|
]), Rt(f, c);
|
|
1567
|
-
const L =
|
|
1578
|
+
const L = We(S, f);
|
|
1568
1579
|
return /* @__PURE__ */ K(
|
|
1569
1580
|
"div",
|
|
1570
1581
|
{
|
|
@@ -1572,9 +1583,9 @@ function Tt({
|
|
|
1572
1583
|
"data-panel": !0,
|
|
1573
1584
|
"data-testid": f,
|
|
1574
1585
|
id: f,
|
|
1575
|
-
ref:
|
|
1586
|
+
ref: v,
|
|
1576
1587
|
style: {
|
|
1577
|
-
...
|
|
1588
|
+
...Et,
|
|
1578
1589
|
flexBasis: 0,
|
|
1579
1590
|
flexGrow: `var(${L}, 1)`,
|
|
1580
1591
|
flexShrink: 1,
|
|
@@ -1582,7 +1593,7 @@ function Tt({
|
|
|
1582
1593
|
overflow: "hidden",
|
|
1583
1594
|
// Disable pointer events inside of a panel during resize
|
|
1584
1595
|
// This avoid edge cases like nested iframes
|
|
1585
|
-
pointerEvents: `var(${
|
|
1596
|
+
pointerEvents: `var(${je})`
|
|
1586
1597
|
},
|
|
1587
1598
|
children: /* @__PURE__ */ K(
|
|
1588
1599
|
"div",
|
|
@@ -1599,7 +1610,7 @@ function Tt({
|
|
|
1599
1610
|
}
|
|
1600
1611
|
);
|
|
1601
1612
|
}
|
|
1602
|
-
const
|
|
1613
|
+
const Et = {
|
|
1603
1614
|
minHeight: "unset",
|
|
1604
1615
|
maxHeight: "unset",
|
|
1605
1616
|
height: "unset",
|
|
@@ -1615,13 +1626,13 @@ const Ct = {
|
|
|
1615
1626
|
padding: "unset",
|
|
1616
1627
|
margin: "unset"
|
|
1617
1628
|
};
|
|
1618
|
-
function _t() {
|
|
1619
|
-
return I(null);
|
|
1620
|
-
}
|
|
1621
1629
|
function At() {
|
|
1630
|
+
return k(null);
|
|
1631
|
+
}
|
|
1632
|
+
function Nt() {
|
|
1622
1633
|
return O(null);
|
|
1623
1634
|
}
|
|
1624
|
-
function
|
|
1635
|
+
function Mt({
|
|
1625
1636
|
layout: e,
|
|
1626
1637
|
panelConstraints: t,
|
|
1627
1638
|
panelId: n,
|
|
@@ -1662,7 +1673,7 @@ function Et({
|
|
|
1662
1673
|
valueNow: l
|
|
1663
1674
|
};
|
|
1664
1675
|
}
|
|
1665
|
-
function
|
|
1676
|
+
function $t({
|
|
1666
1677
|
children: e,
|
|
1667
1678
|
className: t,
|
|
1668
1679
|
elementRef: n,
|
|
@@ -1670,22 +1681,22 @@ function Nt({
|
|
|
1670
1681
|
style: r,
|
|
1671
1682
|
...a
|
|
1672
1683
|
}) {
|
|
1673
|
-
const l = ue(o), [i, s] =
|
|
1684
|
+
const l = ue(o), [i, s] = k({}), [u, c] = k("inactive"), [h, m] = k(null), p = fe(m, n), {
|
|
1674
1685
|
id: f,
|
|
1675
1686
|
orientation: d,
|
|
1676
1687
|
registerSeparator: y
|
|
1677
|
-
} = de(),
|
|
1688
|
+
} = de(), v = d === "horizontal" ? "vertical" : "horizontal";
|
|
1678
1689
|
return N(() => {
|
|
1679
1690
|
if (h !== null) {
|
|
1680
|
-
const
|
|
1691
|
+
const S = {
|
|
1681
1692
|
element: h,
|
|
1682
1693
|
id: l
|
|
1683
|
-
}, x = y(
|
|
1694
|
+
}, x = y(S), g = _.addListener(
|
|
1684
1695
|
"interactionStateChange",
|
|
1685
1696
|
(L) => {
|
|
1686
1697
|
c(
|
|
1687
1698
|
L.state !== "inactive" && L.hitRegions.some(
|
|
1688
|
-
(
|
|
1699
|
+
(C) => C.separator === S
|
|
1689
1700
|
) ? L.state : "inactive"
|
|
1690
1701
|
);
|
|
1691
1702
|
}
|
|
@@ -1693,15 +1704,15 @@ function Nt({
|
|
|
1693
1704
|
"mountedGroupsChange",
|
|
1694
1705
|
(L) => {
|
|
1695
1706
|
L.forEach(
|
|
1696
|
-
({ derivedPanelConstraints:
|
|
1707
|
+
({ derivedPanelConstraints: C, layout: q, separatorToPanels: Z }, J) => {
|
|
1697
1708
|
if (J.id === f) {
|
|
1698
|
-
const Q = Z.get(
|
|
1709
|
+
const Q = Z.get(S);
|
|
1699
1710
|
if (Q) {
|
|
1700
1711
|
const $ = Q[0], V = J.panels.indexOf($);
|
|
1701
1712
|
s(
|
|
1702
|
-
|
|
1713
|
+
Mt({
|
|
1703
1714
|
layout: q,
|
|
1704
|
-
panelConstraints:
|
|
1715
|
+
panelConstraints: C,
|
|
1705
1716
|
panelId: $.id,
|
|
1706
1717
|
panelIndex: V
|
|
1707
1718
|
})
|
|
@@ -1713,7 +1724,7 @@ function Nt({
|
|
|
1713
1724
|
}
|
|
1714
1725
|
);
|
|
1715
1726
|
return () => {
|
|
1716
|
-
|
|
1727
|
+
g(), b(), x();
|
|
1717
1728
|
};
|
|
1718
1729
|
}
|
|
1719
1730
|
}, [h, f, l, y]), /* @__PURE__ */ K(
|
|
@@ -1721,7 +1732,7 @@ function Nt({
|
|
|
1721
1732
|
{
|
|
1722
1733
|
...a,
|
|
1723
1734
|
"aria-controls": i.valueControls,
|
|
1724
|
-
"aria-orientation":
|
|
1735
|
+
"aria-orientation": v,
|
|
1725
1736
|
"aria-valuemax": i.valueMax,
|
|
1726
1737
|
"aria-valuemin": i.valueMin,
|
|
1727
1738
|
"aria-valuenow": i.valueNow,
|
|
@@ -1744,12 +1755,12 @@ function Nt({
|
|
|
1744
1755
|
}
|
|
1745
1756
|
export {
|
|
1746
1757
|
Gt as Group,
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1758
|
+
_t as Panel,
|
|
1759
|
+
$t as Separator,
|
|
1760
|
+
Dt as useDefaultLayout,
|
|
1761
|
+
Ot as useGroupCallbackRef,
|
|
1762
|
+
Tt as useGroupRef,
|
|
1763
|
+
At as usePanelCallbackRef,
|
|
1764
|
+
Nt as usePanelRef
|
|
1754
1765
|
};
|
|
1755
1766
|
//# sourceMappingURL=react-resizable-panels.js.map
|