react-resizable-panels 4.0.11 → 4.0.12
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
|
|
3
|
+
import { useId as Ve, useLayoutEffect as Ke, useEffect as Re, useRef as O, useCallback as Xe, createContext as Ye, useImperativeHandle as Ee, useState as k, useMemo as se, useSyncExternalStore as qe, useContext as Ze } from "react";
|
|
4
4
|
function z(e, t = "Assertion error") {
|
|
5
5
|
if (!e)
|
|
6
6
|
throw Error(t);
|
|
@@ -11,20 +11,20 @@ function B({
|
|
|
11
11
|
const { orientation: t, panels: n } = e;
|
|
12
12
|
return n.reduce((o, r) => (o += t === "horizontal" ? r.element.offsetWidth : r.element.offsetHeight, o), 0);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ae(e, t) {
|
|
15
15
|
return t.sort(
|
|
16
|
-
e === "horizontal" ?
|
|
16
|
+
e === "horizontal" ? Je : Qe
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function Je(e, t) {
|
|
20
20
|
const n = e.element.offsetLeft - t.element.offsetLeft;
|
|
21
21
|
return n !== 0 ? n : e.element.offsetWidth - t.element.offsetWidth;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function Qe(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 Me(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),
|
|
@@ -36,7 +36,7 @@ function Ie(e, t) {
|
|
|
36
36
|
)
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function et({
|
|
40
40
|
orientation: e,
|
|
41
41
|
rects: t,
|
|
42
42
|
targetRect: n
|
|
@@ -47,13 +47,13 @@ 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 } = Me(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
|
|
56
|
-
const { element: t, orientation: n, panels: o, separators: r } = e, a =
|
|
55
|
+
function ke(e) {
|
|
56
|
+
const { element: t, orientation: n, panels: o, separators: r } = e, a = ae(
|
|
57
57
|
n,
|
|
58
58
|
Array.from(t.children).filter((c) => c instanceof HTMLElement).map((c) => ({ element: c }))
|
|
59
59
|
).map(({ element: c }) => c), l = [];
|
|
@@ -83,7 +83,7 @@ function Ge(e) {
|
|
|
83
83
|
break;
|
|
84
84
|
}
|
|
85
85
|
case 1: {
|
|
86
|
-
const v = u[0], S =
|
|
86
|
+
const v = u[0], S = et({
|
|
87
87
|
orientation: n,
|
|
88
88
|
rects: [m, p],
|
|
89
89
|
targetRect: v.element.getBoundingClientRect()
|
|
@@ -133,21 +133,21 @@ function Ge(e) {
|
|
|
133
133
|
i = !0;
|
|
134
134
|
return l;
|
|
135
135
|
}
|
|
136
|
-
function
|
|
136
|
+
function tt(e, t) {
|
|
137
137
|
const n = getComputedStyle(e), o = parseFloat(n.fontSize);
|
|
138
138
|
return t * o;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function nt(e, t) {
|
|
141
141
|
const n = getComputedStyle(e.ownerDocument.body), o = parseFloat(n.fontSize);
|
|
142
142
|
return t * o;
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function ot(e) {
|
|
145
145
|
return e / 100 * window.innerHeight;
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function it(e) {
|
|
148
148
|
return e / 100 * window.innerWidth;
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function rt(e) {
|
|
151
151
|
switch (typeof e) {
|
|
152
152
|
case "number":
|
|
153
153
|
return [e, "px"];
|
|
@@ -163,7 +163,7 @@ function te({
|
|
|
163
163
|
styleProp: n
|
|
164
164
|
}) {
|
|
165
165
|
let o;
|
|
166
|
-
const [r, a] =
|
|
166
|
+
const [r, a] = rt(n);
|
|
167
167
|
switch (a) {
|
|
168
168
|
case "%": {
|
|
169
169
|
o = r / 100 * e;
|
|
@@ -174,19 +174,19 @@ function te({
|
|
|
174
174
|
break;
|
|
175
175
|
}
|
|
176
176
|
case "rem": {
|
|
177
|
-
o =
|
|
177
|
+
o = nt(t, r);
|
|
178
178
|
break;
|
|
179
179
|
}
|
|
180
180
|
case "em": {
|
|
181
|
-
o =
|
|
181
|
+
o = tt(t, r);
|
|
182
182
|
break;
|
|
183
183
|
}
|
|
184
184
|
case "vh": {
|
|
185
|
-
o =
|
|
185
|
+
o = ot(r);
|
|
186
186
|
break;
|
|
187
187
|
}
|
|
188
188
|
case "vw": {
|
|
189
|
-
o =
|
|
189
|
+
o = it(r);
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
@@ -252,7 +252,7 @@ function ye(e) {
|
|
|
252
252
|
};
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
-
class
|
|
255
|
+
class st {
|
|
256
256
|
#e = {};
|
|
257
257
|
addListener(t, n) {
|
|
258
258
|
const o = this.#e[t];
|
|
@@ -301,7 +301,7 @@ let R = {
|
|
|
301
301
|
},
|
|
302
302
|
mountedGroups: /* @__PURE__ */ new Map()
|
|
303
303
|
};
|
|
304
|
-
const _ = new
|
|
304
|
+
const _ = new st();
|
|
305
305
|
function D() {
|
|
306
306
|
return R;
|
|
307
307
|
}
|
|
@@ -331,12 +331,12 @@ function E(e) {
|
|
|
331
331
|
});
|
|
332
332
|
}), _.emit("mountedGroupsChange", R.mountedGroups)), R;
|
|
333
333
|
}
|
|
334
|
-
const
|
|
335
|
-
},
|
|
334
|
+
const at = (e) => e, ie = () => {
|
|
335
|
+
}, Ie = 1, Ge = 2, De = 4, Oe = 8, ge = {
|
|
336
336
|
coarse: 10,
|
|
337
337
|
precise: 5
|
|
338
338
|
};
|
|
339
|
-
function
|
|
339
|
+
function lt({
|
|
340
340
|
cursorFlags: e,
|
|
341
341
|
groups: t,
|
|
342
342
|
state: n
|
|
@@ -363,7 +363,7 @@ function ut({
|
|
|
363
363
|
return null;
|
|
364
364
|
switch (n) {
|
|
365
365
|
case "active": {
|
|
366
|
-
const a = (e &
|
|
366
|
+
const a = (e & Ie) !== 0, l = (e & Ge) !== 0, i = (e & De) !== 0, s = (e & Oe) !== 0;
|
|
367
367
|
if (e) {
|
|
368
368
|
if (a)
|
|
369
369
|
return i ? "se-resize" : s ? "ne-resize" : "e-resize";
|
|
@@ -386,7 +386,7 @@ function le() {
|
|
|
386
386
|
switch (t.state) {
|
|
387
387
|
case "active":
|
|
388
388
|
case "hover": {
|
|
389
|
-
const n =
|
|
389
|
+
const n = lt({
|
|
390
390
|
cursorFlags: e,
|
|
391
391
|
groups: t.hitRegions.map((r) => r.group),
|
|
392
392
|
state: t.state
|
|
@@ -402,7 +402,7 @@ function le() {
|
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
404
|
}
|
|
405
|
-
function
|
|
405
|
+
function ut(e, t) {
|
|
406
406
|
if (e.length !== t.length)
|
|
407
407
|
return !1;
|
|
408
408
|
for (let n = 0; n < e.length; n++)
|
|
@@ -528,7 +528,7 @@ function Y({
|
|
|
528
528
|
e < 0 ? d-- : d++;
|
|
529
529
|
}
|
|
530
530
|
}
|
|
531
|
-
if (
|
|
531
|
+
if (ut(i, s))
|
|
532
532
|
return r;
|
|
533
533
|
{
|
|
534
534
|
const f = e < 0 ? c : u, d = l[f];
|
|
@@ -575,7 +575,7 @@ function U(e, t) {
|
|
|
575
575
|
return !1;
|
|
576
576
|
return !0;
|
|
577
577
|
}
|
|
578
|
-
function
|
|
578
|
+
function Te({
|
|
579
579
|
event: e,
|
|
580
580
|
hitRegions: t,
|
|
581
581
|
initialLayoutMap: n,
|
|
@@ -607,11 +607,11 @@ function Ae({
|
|
|
607
607
|
if (p !== 0 && !c)
|
|
608
608
|
switch (h) {
|
|
609
609
|
case "horizontal": {
|
|
610
|
-
a |= p < 0 ?
|
|
610
|
+
a |= p < 0 ? Ie : Ge;
|
|
611
611
|
break;
|
|
612
612
|
}
|
|
613
613
|
case "vertical": {
|
|
614
|
-
a |= p < 0 ?
|
|
614
|
+
a |= p < 0 ? De : Oe;
|
|
615
615
|
break;
|
|
616
616
|
}
|
|
617
617
|
}
|
|
@@ -642,7 +642,7 @@ function ve(e) {
|
|
|
642
642
|
switch (t.state) {
|
|
643
643
|
case "active":
|
|
644
644
|
t.hitRegions.forEach((o) => {
|
|
645
|
-
e.currentTarget === o.group.element &&
|
|
645
|
+
e.currentTarget === o.group.element && Te({
|
|
646
646
|
event: e,
|
|
647
647
|
hitRegions: t.hitRegions,
|
|
648
648
|
initialLayoutMap: t.initialLayoutMap,
|
|
@@ -703,7 +703,7 @@ function A({
|
|
|
703
703
|
const l = Object.keys(e);
|
|
704
704
|
return o.reduce((i, s, u) => (i[l[u]] = s, i), {});
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function _e({
|
|
707
707
|
groupId: e
|
|
708
708
|
}) {
|
|
709
709
|
const t = () => {
|
|
@@ -740,18 +740,18 @@ function Ne({
|
|
|
740
740
|
}
|
|
741
741
|
};
|
|
742
742
|
}
|
|
743
|
-
function
|
|
743
|
+
function Ae(e) {
|
|
744
744
|
const { mountedGroups: t } = D(), n = t.get(e);
|
|
745
745
|
return z(n, `Mounted Group ${e.id} not found`), n;
|
|
746
746
|
}
|
|
747
747
|
function T(e, t) {
|
|
748
|
-
const n = oe(e), o =
|
|
748
|
+
const n = oe(e), o = Ae(n), r = n.separators.find(
|
|
749
749
|
(h) => h.element === e
|
|
750
750
|
);
|
|
751
751
|
z(r, "Matching separator not found");
|
|
752
752
|
const a = o.separatorToPanels.get(r);
|
|
753
753
|
z(a, "Matching panels not found");
|
|
754
|
-
const l = a.map((h) => n.panels.indexOf(h)), s =
|
|
754
|
+
const l = a.map((h) => n.panels.indexOf(h)), s = _e({ groupId: n.id }).getLayout(), u = Y({
|
|
755
755
|
delta: t,
|
|
756
756
|
initialLayout: s,
|
|
757
757
|
panelConstraints: o.derivedPanelConstraints,
|
|
@@ -799,7 +799,7 @@ function Se(e) {
|
|
|
799
799
|
}
|
|
800
800
|
case "Enter": {
|
|
801
801
|
e.preventDefault();
|
|
802
|
-
const o = oe(t), { derivedPanelConstraints: r, layout: a, separatorToPanels: l } =
|
|
802
|
+
const o = oe(t), { derivedPanelConstraints: r, layout: a, separatorToPanels: l } = Ae(o), i = o.separators.find(
|
|
803
803
|
(h) => h.element === t
|
|
804
804
|
);
|
|
805
805
|
z(i, "Matching separator not found");
|
|
@@ -832,13 +832,13 @@ function Se(e) {
|
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function ct(e, t, n) {
|
|
836
836
|
let o, r = {
|
|
837
837
|
x: 1 / 0,
|
|
838
838
|
y: 1 / 0
|
|
839
839
|
};
|
|
840
840
|
for (const a of t) {
|
|
841
|
-
const l =
|
|
841
|
+
const l = Me(n, a.rect);
|
|
842
842
|
switch (e) {
|
|
843
843
|
case "horizontal": {
|
|
844
844
|
l.x <= r.x && (o = a, r = l);
|
|
@@ -856,10 +856,10 @@ function ft(e, t, n) {
|
|
|
856
856
|
} : void 0;
|
|
857
857
|
}
|
|
858
858
|
let ne;
|
|
859
|
-
function
|
|
859
|
+
function ft() {
|
|
860
860
|
return ne === void 0 && (typeof matchMedia == "function" ? ne = !!matchMedia("(pointer:coarse)").matches : ne = !1), ne;
|
|
861
861
|
}
|
|
862
|
-
function
|
|
862
|
+
function dt(e, t) {
|
|
863
863
|
if (e === t) throw new Error("Cannot compare node with itself");
|
|
864
864
|
const n = {
|
|
865
865
|
a: we(e),
|
|
@@ -890,20 +890,20 @@ function pt(e, t) {
|
|
|
890
890
|
}
|
|
891
891
|
return Math.sign(r.a - r.b);
|
|
892
892
|
}
|
|
893
|
-
const
|
|
894
|
-
function
|
|
895
|
-
const t = getComputedStyle(
|
|
893
|
+
const pt = /\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;
|
|
894
|
+
function ht(e) {
|
|
895
|
+
const t = getComputedStyle(Ne(e) ?? e).display;
|
|
896
896
|
return t === "flex" || t === "inline-flex";
|
|
897
897
|
}
|
|
898
|
-
function
|
|
898
|
+
function mt(e) {
|
|
899
899
|
const t = getComputedStyle(e);
|
|
900
|
-
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" ||
|
|
900
|
+
return !!(t.position === "fixed" || t.zIndex !== "auto" && (t.position !== "static" || ht(e)) || +t.opacity < 1 || "transform" in t && t.transform !== "none" || "webkitTransform" in t && t.webkitTransform !== "none" || "mixBlendMode" in t && t.mixBlendMode !== "normal" || "filter" in t && t.filter !== "none" || "webkitFilter" in t && t.webkitFilter !== "none" || "isolation" in t && t.isolation === "isolate" || pt.test(t.willChange) || t.webkitOverflowScrolling === "touch");
|
|
901
901
|
}
|
|
902
902
|
function xe(e) {
|
|
903
903
|
let t = e.length;
|
|
904
904
|
for (; t--; ) {
|
|
905
905
|
const n = e[t];
|
|
906
|
-
if (z(n, "Missing node"),
|
|
906
|
+
if (z(n, "Missing node"), mt(n)) return n;
|
|
907
907
|
}
|
|
908
908
|
return null;
|
|
909
909
|
}
|
|
@@ -913,45 +913,45 @@ function ze(e) {
|
|
|
913
913
|
function we(e) {
|
|
914
914
|
const t = [];
|
|
915
915
|
for (; e; )
|
|
916
|
-
t.push(e), e =
|
|
916
|
+
t.push(e), e = Ne(e);
|
|
917
917
|
return t;
|
|
918
918
|
}
|
|
919
|
-
function
|
|
919
|
+
function Ne(e) {
|
|
920
920
|
const { parentNode: t } = e;
|
|
921
921
|
return t && t instanceof ShadowRoot ? t.host : t;
|
|
922
922
|
}
|
|
923
|
-
function
|
|
923
|
+
function yt(e, t) {
|
|
924
924
|
return e.x < t.x + t.width && e.x + e.width > t.x && e.y < t.y + t.height && e.y + e.height > t.y;
|
|
925
925
|
}
|
|
926
|
-
function
|
|
926
|
+
function gt({
|
|
927
927
|
groupElement: e,
|
|
928
928
|
hitRegion: t,
|
|
929
929
|
pointerEventTarget: n
|
|
930
930
|
}) {
|
|
931
931
|
if (!(n instanceof HTMLElement) || n.contains(e) || e.contains(n))
|
|
932
932
|
return !0;
|
|
933
|
-
if (
|
|
933
|
+
if (dt(n, e) > 0) {
|
|
934
934
|
let o = n;
|
|
935
935
|
for (; o; ) {
|
|
936
936
|
if (o.contains(e))
|
|
937
937
|
return !0;
|
|
938
|
-
if (
|
|
938
|
+
if (yt(o.getBoundingClientRect(), t))
|
|
939
939
|
return !1;
|
|
940
940
|
o = o.parentElement;
|
|
941
941
|
}
|
|
942
942
|
}
|
|
943
943
|
return !0;
|
|
944
944
|
}
|
|
945
|
-
function
|
|
945
|
+
function $e(e, t) {
|
|
946
946
|
const n = [];
|
|
947
947
|
return t.forEach((o, r) => {
|
|
948
948
|
if (r.disabled)
|
|
949
949
|
return;
|
|
950
|
-
const a =
|
|
950
|
+
const a = ft() ? ge.coarse : ge.precise, l = ke(r), i = ct(r.orientation, l, {
|
|
951
951
|
x: e.clientX,
|
|
952
952
|
y: e.clientY
|
|
953
953
|
});
|
|
954
|
-
i && i.distance.x <= a && i.distance.y <= a &&
|
|
954
|
+
i && i.distance.x <= a && i.distance.y <= a && gt({
|
|
955
955
|
groupElement: r.element,
|
|
956
956
|
hitRegion: i.hitRegion.rect,
|
|
957
957
|
pointerEventTarget: e.target
|
|
@@ -961,7 +961,7 @@ function He(e, t) {
|
|
|
961
961
|
function be(e) {
|
|
962
962
|
if (e.defaultPrevented)
|
|
963
963
|
return;
|
|
964
|
-
const { mountedGroups: t } = D(), n =
|
|
964
|
+
const { mountedGroups: t } = D(), n = $e(e, t), o = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Map();
|
|
965
965
|
let i = !1;
|
|
966
966
|
n.forEach((s) => {
|
|
967
967
|
o.add(s.group), s.panels.forEach((c) => {
|
|
@@ -998,7 +998,7 @@ function Le(e) {
|
|
|
998
998
|
);
|
|
999
999
|
return;
|
|
1000
1000
|
}
|
|
1001
|
-
|
|
1001
|
+
Te({
|
|
1002
1002
|
event: e,
|
|
1003
1003
|
hitRegions: t.hitRegions,
|
|
1004
1004
|
initialLayoutMap: t.initialLayoutMap,
|
|
@@ -1008,7 +1008,7 @@ function Le(e) {
|
|
|
1008
1008
|
break;
|
|
1009
1009
|
}
|
|
1010
1010
|
default: {
|
|
1011
|
-
const o =
|
|
1011
|
+
const o = $e(e, n);
|
|
1012
1012
|
o.length === 0 ? t.state !== "inactive" && E({
|
|
1013
1013
|
interactionState: { state: "inactive" }
|
|
1014
1014
|
}) : E({
|
|
@@ -1054,7 +1054,7 @@ function Ce(e) {
|
|
|
1054
1054
|
}
|
|
1055
1055
|
return o;
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1057
|
+
function vt(e, t, n) {
|
|
1058
1058
|
const o = n[0];
|
|
1059
1059
|
if (!o)
|
|
1060
1060
|
return;
|
|
@@ -1072,7 +1072,7 @@ function St(e, t, n) {
|
|
|
1072
1072
|
r.id
|
|
1073
1073
|
);
|
|
1074
1074
|
}
|
|
1075
|
-
function
|
|
1075
|
+
function St(e, t) {
|
|
1076
1076
|
if (Object.keys(e).length !== Object.keys(t).length)
|
|
1077
1077
|
return !1;
|
|
1078
1078
|
for (const o in e)
|
|
@@ -1080,7 +1080,7 @@ function xt(e, t) {
|
|
|
1080
1080
|
return !1;
|
|
1081
1081
|
return !0;
|
|
1082
1082
|
}
|
|
1083
|
-
function
|
|
1083
|
+
function xt(e) {
|
|
1084
1084
|
let t = !0;
|
|
1085
1085
|
const n = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), r = new ResizeObserver((p) => {
|
|
1086
1086
|
for (const f of p) {
|
|
@@ -1096,7 +1096,7 @@ function zt(e) {
|
|
|
1096
1096
|
layout: b,
|
|
1097
1097
|
panelConstraints: g
|
|
1098
1098
|
});
|
|
1099
|
-
return !x.defaultLayoutDeferred && U(b, L) &&
|
|
1099
|
+
return !x.defaultLayoutDeferred && U(b, L) && St(
|
|
1100
1100
|
x.derivedPanelConstraints,
|
|
1101
1101
|
g
|
|
1102
1102
|
) ? S : {
|
|
@@ -1112,7 +1112,7 @@ function zt(e) {
|
|
|
1112
1112
|
});
|
|
1113
1113
|
}
|
|
1114
1114
|
} else
|
|
1115
|
-
|
|
1115
|
+
vt(e, y, d);
|
|
1116
1116
|
}
|
|
1117
1117
|
});
|
|
1118
1118
|
r.observe(e.element), e.panels.forEach((p) => {
|
|
@@ -1127,7 +1127,7 @@ function zt(e) {
|
|
|
1127
1127
|
const u = e.inMemoryLayouts[i] ?? s ?? Ce(l), c = A({
|
|
1128
1128
|
layout: u,
|
|
1129
1129
|
panelConstraints: l
|
|
1130
|
-
}), h =
|
|
1130
|
+
}), h = ke(e), m = E((p) => {
|
|
1131
1131
|
const f = /* @__PURE__ */ new Map();
|
|
1132
1132
|
return h.forEach((d) => {
|
|
1133
1133
|
d.separator && f.set(d.separator, d.panels);
|
|
@@ -1157,15 +1157,15 @@ function zt(e) {
|
|
|
1157
1157
|
};
|
|
1158
1158
|
}
|
|
1159
1159
|
function ue(e) {
|
|
1160
|
-
const t =
|
|
1160
|
+
const t = Ve();
|
|
1161
1161
|
return `${e ?? t}`;
|
|
1162
1162
|
}
|
|
1163
|
-
const N = typeof window < "u" ?
|
|
1163
|
+
const N = typeof window < "u" ? Ke : Re;
|
|
1164
1164
|
function ce(e) {
|
|
1165
1165
|
const t = O(e);
|
|
1166
1166
|
return N(() => {
|
|
1167
1167
|
t.current = e;
|
|
1168
|
-
}, [e]),
|
|
1168
|
+
}, [e]), Xe((n) => t.current?.(n), [t]);
|
|
1169
1169
|
}
|
|
1170
1170
|
function fe(...e) {
|
|
1171
1171
|
return ce((t) => {
|
|
@@ -1184,28 +1184,28 @@ function fe(...e) {
|
|
|
1184
1184
|
});
|
|
1185
1185
|
});
|
|
1186
1186
|
}
|
|
1187
|
-
function
|
|
1187
|
+
function zt(e) {
|
|
1188
1188
|
const t = O({ ...e });
|
|
1189
1189
|
return N(() => {
|
|
1190
1190
|
for (const n in e)
|
|
1191
1191
|
t.current[n] = e[n];
|
|
1192
1192
|
}, [e]), t.current;
|
|
1193
1193
|
}
|
|
1194
|
-
const
|
|
1195
|
-
function
|
|
1194
|
+
const Fe = "--react-resizable-panels--panel--pointer-events";
|
|
1195
|
+
function He(e, t) {
|
|
1196
1196
|
const n = e.replace(/[^a-zA-Z0-9\-_]/g, ""), o = t.replace(/[^a-zA-Z0-9\-_]/g, "");
|
|
1197
1197
|
return `--react-resizable-panels--${n}--${o}`;
|
|
1198
1198
|
}
|
|
1199
|
-
const
|
|
1200
|
-
function
|
|
1199
|
+
const je = Ye(null);
|
|
1200
|
+
function wt(e, t) {
|
|
1201
1201
|
const n = O({
|
|
1202
1202
|
getLayout: () => ({}),
|
|
1203
|
-
setLayout:
|
|
1203
|
+
setLayout: at
|
|
1204
1204
|
});
|
|
1205
|
-
|
|
1205
|
+
Ee(t, () => n.current, []), N(() => {
|
|
1206
1206
|
Object.assign(
|
|
1207
1207
|
n.current,
|
|
1208
|
-
|
|
1208
|
+
_e({ groupId: e })
|
|
1209
1209
|
);
|
|
1210
1210
|
});
|
|
1211
1211
|
}
|
|
@@ -1229,16 +1229,16 @@ function Gt({
|
|
|
1229
1229
|
lastExpandedPanelSizes: {},
|
|
1230
1230
|
layouts: {}
|
|
1231
1231
|
}), J = fe(S, a);
|
|
1232
|
-
|
|
1233
|
-
const Q =
|
|
1232
|
+
wt(f, l);
|
|
1233
|
+
const Q = se(
|
|
1234
1234
|
() => ({
|
|
1235
1235
|
id: f,
|
|
1236
1236
|
orientation: u,
|
|
1237
|
-
registerPanel: (w) => (L((M) =>
|
|
1237
|
+
registerPanel: (w) => (L((M) => ae(u, [...M, w])), () => {
|
|
1238
1238
|
L((M) => M.filter((F) => F !== w));
|
|
1239
1239
|
}),
|
|
1240
1240
|
registerSeparator: (w) => (q(
|
|
1241
|
-
(M) =>
|
|
1241
|
+
(M) => ae(u, [...M, w])
|
|
1242
1242
|
), () => {
|
|
1243
1243
|
q(
|
|
1244
1244
|
(M) => M.filter((F) => F !== w)
|
|
@@ -1246,7 +1246,7 @@ function Gt({
|
|
|
1246
1246
|
})
|
|
1247
1247
|
}),
|
|
1248
1248
|
[f, u]
|
|
1249
|
-
), $ =
|
|
1249
|
+
), $ = zt({
|
|
1250
1250
|
defaultLayout: n,
|
|
1251
1251
|
disableCursor: o
|
|
1252
1252
|
}), V = O(null);
|
|
@@ -1266,12 +1266,12 @@ function Gt({
|
|
|
1266
1266
|
separators: C
|
|
1267
1267
|
};
|
|
1268
1268
|
V.current = w;
|
|
1269
|
-
const M =
|
|
1269
|
+
const M = xt(w), he = D().mountedGroups.get(w);
|
|
1270
1270
|
if (he) {
|
|
1271
1271
|
const { defaultLayoutDeferred: H, derivedPanelConstraints: j, layout: ee } = he;
|
|
1272
1272
|
!H && j.length > 0 && (g(ee), p?.(ee));
|
|
1273
1273
|
}
|
|
1274
|
-
const
|
|
1274
|
+
const We = _.addListener(
|
|
1275
1275
|
"interactionStateChange",
|
|
1276
1276
|
(H) => {
|
|
1277
1277
|
switch (H.state) {
|
|
@@ -1289,20 +1289,20 @@ function Gt({
|
|
|
1289
1289
|
}
|
|
1290
1290
|
}
|
|
1291
1291
|
}
|
|
1292
|
-
),
|
|
1292
|
+
), Be = _.addListener(
|
|
1293
1293
|
"mountedGroupsChange",
|
|
1294
1294
|
(H) => {
|
|
1295
1295
|
const j = H.get(w);
|
|
1296
1296
|
if (j) {
|
|
1297
|
-
const { defaultLayoutDeferred: ee, derivedPanelConstraints:
|
|
1298
|
-
if (ee ||
|
|
1297
|
+
const { defaultLayoutDeferred: ee, derivedPanelConstraints: Ue, layout: me } = j;
|
|
1298
|
+
if (ee || Ue.length === 0)
|
|
1299
1299
|
return;
|
|
1300
1300
|
g(me), p?.(me);
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
1303
|
);
|
|
1304
1304
|
return () => {
|
|
1305
|
-
V.current = null, M(),
|
|
1305
|
+
V.current = null, M(), We(), Be();
|
|
1306
1306
|
};
|
|
1307
1307
|
}, [
|
|
1308
1308
|
r,
|
|
@@ -1318,13 +1318,13 @@ function Gt({
|
|
|
1318
1318
|
w && (w.defaultLayout = n, w.disableCursor = !!o);
|
|
1319
1319
|
});
|
|
1320
1320
|
const pe = {
|
|
1321
|
-
[
|
|
1321
|
+
[Fe]: d ? "none" : void 0
|
|
1322
1322
|
};
|
|
1323
1323
|
for (const w in x) {
|
|
1324
|
-
const M =
|
|
1324
|
+
const M = He(f, w), F = x[w];
|
|
1325
1325
|
pe[M] = F;
|
|
1326
1326
|
}
|
|
1327
|
-
return /* @__PURE__ */ K(
|
|
1327
|
+
return /* @__PURE__ */ K(je.Provider, { value: Q, children: /* @__PURE__ */ K(
|
|
1328
1328
|
"div",
|
|
1329
1329
|
{
|
|
1330
1330
|
...h,
|
|
@@ -1345,43 +1345,42 @@ function Gt({
|
|
|
1345
1345
|
}
|
|
1346
1346
|
) });
|
|
1347
1347
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
1348
|
+
function bt(e, t = 10) {
|
|
1349
|
+
let n = null;
|
|
1350
|
+
return (o) => {
|
|
1351
|
+
n !== null && clearTimeout(n), n = setTimeout(() => {
|
|
1352
|
+
e(o);
|
|
1353
|
+
}, t);
|
|
1354
|
+
};
|
|
1350
1355
|
}
|
|
1351
|
-
function Lt({
|
|
1352
|
-
|
|
1353
|
-
layout: t,
|
|
1354
|
-
storage: n
|
|
1355
|
-
}) {
|
|
1356
|
-
try {
|
|
1357
|
-
const o = ae(e);
|
|
1358
|
-
n.setItem(o, JSON.stringify(t));
|
|
1359
|
-
} catch (o) {
|
|
1360
|
-
console.error(o);
|
|
1361
|
-
}
|
|
1356
|
+
function Lt(e) {
|
|
1357
|
+
return `react-resizable-panels:${e}`;
|
|
1362
1358
|
}
|
|
1363
1359
|
function Dt({
|
|
1364
|
-
|
|
1365
|
-
|
|
1360
|
+
debounceSaveMs: e = 100,
|
|
1361
|
+
groupId: t,
|
|
1362
|
+
storage: n
|
|
1366
1363
|
}) {
|
|
1367
|
-
const
|
|
1364
|
+
const o = Lt(t), r = qe(
|
|
1368
1365
|
Pt,
|
|
1369
|
-
() =>
|
|
1370
|
-
() =>
|
|
1371
|
-
),
|
|
1372
|
-
() =>
|
|
1373
|
-
[
|
|
1374
|
-
),
|
|
1375
|
-
(
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1366
|
+
() => n.getItem(o),
|
|
1367
|
+
() => n.getItem(o)
|
|
1368
|
+
), a = se(
|
|
1369
|
+
() => r ? JSON.parse(r) : void 0,
|
|
1370
|
+
[r]
|
|
1371
|
+
), l = se(() => {
|
|
1372
|
+
const i = (s) => {
|
|
1373
|
+
try {
|
|
1374
|
+
n.setItem(o, JSON.stringify(s));
|
|
1375
|
+
} catch (u) {
|
|
1376
|
+
console.error(u);
|
|
1377
|
+
}
|
|
1378
|
+
};
|
|
1379
|
+
return e > 0 ? bt(i, e) : i;
|
|
1380
|
+
}, [e, n, o]);
|
|
1382
1381
|
return {
|
|
1383
|
-
defaultLayout:
|
|
1384
|
-
onLayoutChange:
|
|
1382
|
+
defaultLayout: a,
|
|
1383
|
+
onLayoutChange: l
|
|
1385
1384
|
};
|
|
1386
1385
|
}
|
|
1387
1386
|
function Pt() {
|
|
@@ -1395,7 +1394,7 @@ function Tt() {
|
|
|
1395
1394
|
return O(null);
|
|
1396
1395
|
}
|
|
1397
1396
|
function de() {
|
|
1398
|
-
const e =
|
|
1397
|
+
const e = Ze(je);
|
|
1399
1398
|
return z(
|
|
1400
1399
|
e,
|
|
1401
1400
|
"Group Context not found; did you render a Panel or Separator outside of a Group?"
|
|
@@ -1522,7 +1521,7 @@ function Rt(e, t) {
|
|
|
1522
1521
|
isCollapsed: () => !1,
|
|
1523
1522
|
resize: ie
|
|
1524
1523
|
});
|
|
1525
|
-
|
|
1524
|
+
Ee(t, () => o.current, []), N(() => {
|
|
1526
1525
|
Object.assign(
|
|
1527
1526
|
o.current,
|
|
1528
1527
|
Ct({ groupId: n, panelId: e })
|
|
@@ -1575,7 +1574,7 @@ function _t({
|
|
|
1575
1574
|
b,
|
|
1576
1575
|
x
|
|
1577
1576
|
]), Rt(f, c);
|
|
1578
|
-
const L =
|
|
1577
|
+
const L = He(S, f);
|
|
1579
1578
|
return /* @__PURE__ */ K(
|
|
1580
1579
|
"div",
|
|
1581
1580
|
{
|
|
@@ -1593,7 +1592,7 @@ function _t({
|
|
|
1593
1592
|
overflow: "hidden",
|
|
1594
1593
|
// Disable pointer events inside of a panel during resize
|
|
1595
1594
|
// This avoid edge cases like nested iframes
|
|
1596
|
-
pointerEvents: `var(${
|
|
1595
|
+
pointerEvents: `var(${Fe})`
|
|
1597
1596
|
},
|
|
1598
1597
|
children: /* @__PURE__ */ K(
|
|
1599
1598
|
"div",
|