react-panel-layout 0.5.0 → 0.5.2
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.
- package/dist/FloatingPanelFrame-D9Cp2al1.cjs +2 -0
- package/dist/FloatingPanelFrame-D9Cp2al1.cjs.map +1 -0
- package/dist/FloatingPanelFrame-lLg-Lpg7.js +95 -0
- package/dist/FloatingPanelFrame-lLg-Lpg7.js.map +1 -0
- package/dist/GridLayout-BQQ63eA1.cjs +2 -0
- package/dist/GridLayout-BQQ63eA1.cjs.map +1 -0
- package/dist/{GridLayout-tpSM0iM-.js → GridLayout-CJTKq7Mp.js} +465 -460
- package/dist/GridLayout-CJTKq7Mp.js.map +1 -0
- package/dist/PanelSystemContext.d.ts +9 -0
- package/dist/components/grid/GridLayerList.d.ts +3 -0
- package/dist/components/paneling/FloatingPanelFrame.d.ts +4 -0
- package/dist/config.cjs +1 -1
- package/dist/config.js +1 -1
- package/dist/constants/styles.d.ts +3 -1
- package/dist/floating.cjs +1 -1
- package/dist/floating.js +1 -1
- package/dist/hooks/ContentCacheContext.d.ts +59 -0
- package/dist/hooks/useContainerScroll.d.ts +23 -0
- package/dist/hooks/useContentCache.d.ts +67 -0
- package/dist/hooks/useDocumentScroll.d.ts +13 -0
- package/dist/hooks/useScrollContainer.d.ts +21 -0
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +442 -440
- package/dist/index.js.map +1 -1
- package/dist/modules/pivot/types.d.ts +6 -0
- package/dist/pivot.cjs +1 -1
- package/dist/pivot.js +1 -1
- package/dist/sticky-header/StickyHeader.d.ts +53 -0
- package/dist/sticky-header/index.d.ts +7 -0
- package/dist/sticky-header/types.d.ts +50 -0
- package/dist/sticky-header.cjs +2 -0
- package/dist/sticky-header.cjs.map +1 -0
- package/dist/sticky-header.js +198 -0
- package/dist/sticky-header.js.map +1 -0
- package/dist/styles-CA2_zLZt.js +52 -0
- package/dist/{styles-DcG3aIFx.cjs.map → styles-CA2_zLZt.js.map} +1 -1
- package/dist/styles-PsqGOEJP.cjs +2 -0
- package/dist/styles-PsqGOEJP.cjs.map +1 -0
- package/dist/types.d.ts +12 -0
- package/dist/useIsomorphicLayoutEffect-DGRNF4Lf.cjs +2 -0
- package/dist/useIsomorphicLayoutEffect-DGRNF4Lf.cjs.map +1 -0
- package/dist/useIsomorphicLayoutEffect-DhmEnmZ_.js +6 -0
- package/dist/useIsomorphicLayoutEffect-DhmEnmZ_.js.map +1 -0
- package/dist/usePivot-7ctin_P_.cjs +2 -0
- package/dist/usePivot-7ctin_P_.cjs.map +1 -0
- package/dist/usePivot-CgQxB8rc.js +124 -0
- package/dist/usePivot-CgQxB8rc.js.map +1 -0
- package/package.json +6 -1
- package/dist/FloatingPanelFrame-DDT6aING.js +0 -66
- package/dist/FloatingPanelFrame-DDT6aING.js.map +0 -1
- package/dist/FloatingPanelFrame-DrYwgI9f.cjs +0 -2
- package/dist/FloatingPanelFrame-DrYwgI9f.cjs.map +0 -1
- package/dist/GridLayout-DC7fCmcI.cjs +0 -2
- package/dist/GridLayout-DC7fCmcI.cjs.map +0 -1
- package/dist/GridLayout-tpSM0iM-.js.map +0 -1
- package/dist/styles-DcG3aIFx.cjs +0 -2
- package/dist/styles-w0ZixggV.js +0 -51
- package/dist/styles-w0ZixggV.js.map +0 -1
- package/dist/usePivot-C8q0pMgW.cjs +0 -2
- package/dist/usePivot-C8q0pMgW.cjs.map +0 -1
- package/dist/usePivot-z9gumDf-.js +0 -97
- package/dist/usePivot-z9gumDf-.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { u as kt, a as Mt, b as _t, c as J, d as Ot, e as M, t as Bt, R as ot, G as st } from "./GridLayout-
|
|
2
|
-
import { D as
|
|
1
|
+
import { u as kt, a as Mt, b as _t, c as J, d as Ot, e as M, t as Bt, R as ot, G as st } from "./GridLayout-CJTKq7Mp.js";
|
|
2
|
+
import { D as _n, f as On, F as Bn, r as Ln, g as Hn } from "./GridLayout-CJTKq7Mp.js";
|
|
3
3
|
import { jsx as m, jsxs as H, Fragment as et } from "react/jsx-runtime";
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import * as u from "react";
|
|
5
|
+
import { u as Lt, v as Ht, w as Nt, H as zt, z as $t, A as Ft, B as Xt, E as Yt, I as jt, J as Ut, T as Kt, K as Vt, L as Wt, M as qt, N as Zt, O as Jt, Q as Qt, S as te } from "./styles-CA2_zLZt.js";
|
|
6
|
+
import { U as zn } from "./styles-CA2_zLZt.js";
|
|
7
|
+
import { u as nt } from "./useIsomorphicLayoutEffect-DhmEnmZ_.js";
|
|
8
8
|
import { createPortal as ee } from "react-dom";
|
|
9
|
-
|
|
9
|
+
import { a as ne } from "./usePivot-CgQxB8rc.js";
|
|
10
|
+
const re = (t) => ({
|
|
10
11
|
width: zt,
|
|
11
12
|
cursor: "col-resize",
|
|
12
13
|
position: "relative",
|
|
13
14
|
userSelect: "none",
|
|
14
15
|
backgroundColor: t === "drag" ? Lt : t === "hover" ? Ht : Nt
|
|
15
|
-
}),
|
|
16
|
+
}), En = ({ onResize: t, component: e, element: n }) => {
|
|
16
17
|
const { ref: r, isDragging: o, onPointerDown: s } = kt({
|
|
17
18
|
axis: "x",
|
|
18
19
|
onResize: t
|
|
19
|
-
}), [a, i] =
|
|
20
|
+
}), [a, i] = u.useState(!1), c = {
|
|
20
21
|
ref: r,
|
|
21
|
-
style:
|
|
22
|
+
style: re(o ? "drag" : a ? "hover" : "idle"),
|
|
22
23
|
role: "separator",
|
|
23
24
|
"aria-orientation": "vertical",
|
|
24
25
|
"data-dragging": o ? "true" : void 0,
|
|
@@ -26,67 +27,67 @@ const ne = (t) => ({
|
|
|
26
27
|
onPointerEnter: () => i(!0),
|
|
27
28
|
onPointerLeave: () => i(!1)
|
|
28
29
|
};
|
|
29
|
-
return n ?
|
|
30
|
-
},
|
|
30
|
+
return n ? u.cloneElement(n, c) : e ? /* @__PURE__ */ m(e, { ...c }) : /* @__PURE__ */ m("div", { ...c });
|
|
31
|
+
}, Rn = () => {
|
|
31
32
|
const { layerId: t } = Mt(), { getLayerHandleProps: e } = _t();
|
|
32
|
-
return
|
|
33
|
-
}, it = { left: 0, top: 0 }, at = { width: 400, height: 300 },
|
|
34
|
-
const [e, n] =
|
|
35
|
-
const
|
|
33
|
+
return u.useMemo(() => e(t), [e, t]);
|
|
34
|
+
}, it = { left: 0, top: 0 }, at = { width: 400, height: 300 }, Pn = (t) => {
|
|
35
|
+
const [e, n] = u.useState(() => {
|
|
36
|
+
const l = {};
|
|
36
37
|
return t.forEach((p) => {
|
|
37
38
|
if (p.floating) {
|
|
38
39
|
const g = p.floating;
|
|
39
|
-
|
|
40
|
+
l[p.id] = {
|
|
40
41
|
position: g.defaultPosition ?? it,
|
|
41
42
|
size: g.defaultSize ?? at
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
}),
|
|
45
|
-
}), r =
|
|
46
|
-
const
|
|
47
|
-
return t.forEach((p) =>
|
|
48
|
-
}, [t]), o =
|
|
49
|
-
(
|
|
50
|
-
const p = r.get(
|
|
51
|
-
return p?.floating?.position !== void 0 ? p.floating.position : e[
|
|
45
|
+
}), l;
|
|
46
|
+
}), r = u.useMemo(() => {
|
|
47
|
+
const l = /* @__PURE__ */ new Map();
|
|
48
|
+
return t.forEach((p) => l.set(p.id, p)), l;
|
|
49
|
+
}, [t]), o = u.useCallback(
|
|
50
|
+
(l) => {
|
|
51
|
+
const p = r.get(l);
|
|
52
|
+
return p?.floating?.position !== void 0 ? p.floating.position : e[l]?.position ?? it;
|
|
52
53
|
},
|
|
53
54
|
[r, e]
|
|
54
|
-
), s =
|
|
55
|
-
(
|
|
56
|
-
const p = r.get(
|
|
57
|
-
return p?.floating?.size !== void 0 ? p.floating.size : e[
|
|
55
|
+
), s = u.useCallback(
|
|
56
|
+
(l) => {
|
|
57
|
+
const p = r.get(l);
|
|
58
|
+
return p?.floating?.size !== void 0 ? p.floating.size : e[l]?.size ?? at;
|
|
58
59
|
},
|
|
59
60
|
[r, e]
|
|
60
|
-
), a =
|
|
61
|
-
(
|
|
61
|
+
), a = u.useCallback(
|
|
62
|
+
(l) => r.get(l)?.floating?.zIndex,
|
|
62
63
|
[r]
|
|
63
|
-
), i =
|
|
64
|
-
(
|
|
65
|
-
const g = r.get(
|
|
64
|
+
), i = u.useCallback(
|
|
65
|
+
(l, p) => {
|
|
66
|
+
const g = r.get(l);
|
|
66
67
|
g?.floating && (g.floating.position === void 0 && n((v) => {
|
|
67
|
-
const
|
|
68
|
-
return
|
|
68
|
+
const b = v[l];
|
|
69
|
+
return b ? {
|
|
69
70
|
...v,
|
|
70
|
-
[
|
|
71
|
+
[l]: { ...b, position: p }
|
|
71
72
|
} : v;
|
|
72
73
|
}), g.floating.onMove?.(p));
|
|
73
74
|
},
|
|
74
75
|
[r]
|
|
75
|
-
), c =
|
|
76
|
-
(
|
|
77
|
-
const g = r.get(
|
|
76
|
+
), c = u.useCallback(
|
|
77
|
+
(l, p) => {
|
|
78
|
+
const g = r.get(l);
|
|
78
79
|
g?.floating && (g.floating.size === void 0 && n((v) => {
|
|
79
|
-
const
|
|
80
|
-
return
|
|
80
|
+
const b = v[l];
|
|
81
|
+
return b ? {
|
|
81
82
|
...v,
|
|
82
|
-
[
|
|
83
|
+
[l]: { ...b, size: p }
|
|
83
84
|
} : v;
|
|
84
85
|
}), g.floating.onResize?.(p));
|
|
85
86
|
},
|
|
86
87
|
[r]
|
|
87
|
-
), d =
|
|
88
|
-
(
|
|
89
|
-
r.get(
|
|
88
|
+
), d = u.useCallback(
|
|
89
|
+
(l) => {
|
|
90
|
+
r.get(l)?.floating?.onClose?.();
|
|
90
91
|
},
|
|
91
92
|
[r]
|
|
92
93
|
);
|
|
@@ -98,37 +99,37 @@ const ne = (t) => ({
|
|
|
98
99
|
updateSize: c,
|
|
99
100
|
close: d
|
|
100
101
|
};
|
|
101
|
-
}, ft =
|
|
102
|
-
const t =
|
|
102
|
+
}, ft = u.createContext(null), oe = () => {
|
|
103
|
+
const t = u.useContext(ft);
|
|
103
104
|
if (!t)
|
|
104
105
|
throw new Error("useKeybindings must be used within KeybindingsProvider");
|
|
105
106
|
return t;
|
|
106
|
-
},
|
|
107
|
+
}, se = (t) => {
|
|
107
108
|
const e = [];
|
|
108
109
|
t.metaKey && e.push("Mod"), t.ctrlKey && e.push("Ctrl"), t.altKey && e.push("Alt"), t.shiftKey && e.push("Shift");
|
|
109
110
|
const n = t.key.length === 1 ? t.key.toUpperCase() : t.key;
|
|
110
111
|
return e.push(n), e.join("-");
|
|
111
|
-
},
|
|
112
|
-
const n =
|
|
112
|
+
}, ie = ({ children: t, configure: e }) => {
|
|
113
|
+
const n = u.useRef({}), r = u.useCallback((a, i) => {
|
|
113
114
|
n.current = { ...n.current, [a]: i };
|
|
114
|
-
}, []), o =
|
|
115
|
+
}, []), o = u.useCallback((a) => {
|
|
115
116
|
const i = { ...n.current };
|
|
116
117
|
delete i[a], n.current = i;
|
|
117
118
|
}, []);
|
|
118
|
-
|
|
119
|
+
u.useEffect(() => {
|
|
119
120
|
const a = (i) => {
|
|
120
|
-
const c =
|
|
121
|
+
const c = se(i), d = n.current[c];
|
|
121
122
|
d && d(i);
|
|
122
123
|
};
|
|
123
124
|
return window.addEventListener("keydown", a), () => {
|
|
124
125
|
window.removeEventListener("keydown", a);
|
|
125
126
|
};
|
|
126
127
|
}, []);
|
|
127
|
-
const s =
|
|
128
|
-
return
|
|
128
|
+
const s = u.useMemo(() => ({ register: r, unregister: o }), [r, o]);
|
|
129
|
+
return u.useEffect(() => {
|
|
129
130
|
e && e(s);
|
|
130
131
|
}, [s, e]), /* @__PURE__ */ m(ft.Provider, { value: s, children: t });
|
|
131
|
-
},
|
|
132
|
+
}, ae = (t, e) => {
|
|
132
133
|
t.register("Mod-\\", (n) => {
|
|
133
134
|
n.preventDefault(), e.splitFocused("vertical");
|
|
134
135
|
}), t.register("Mod-Shift-\\", (n) => {
|
|
@@ -143,9 +144,9 @@ const ne = (t) => ({
|
|
|
143
144
|
}), t.register("Alt-ArrowLeft", (n) => {
|
|
144
145
|
n.preventDefault(), e.focusPrevGroup();
|
|
145
146
|
});
|
|
146
|
-
},
|
|
147
|
+
}, ce = (t) => t.type === "group", gt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
|
|
147
148
|
const n = /* @__PURE__ */ new Map(), r = (o, s) => {
|
|
148
|
-
if (
|
|
149
|
+
if (ce(o)) {
|
|
149
150
|
n.set(o.groupId, s);
|
|
150
151
|
return;
|
|
151
152
|
}
|
|
@@ -158,7 +159,7 @@ const ne = (t) => ({
|
|
|
158
159
|
r(o.a, { x: s.x, y: s.y, w: s.w, h: a }), r(o.b, { x: s.x, y: s.y + a, w: s.w, h: i });
|
|
159
160
|
};
|
|
160
161
|
return r(t, e), n;
|
|
161
|
-
},
|
|
162
|
+
}, ue = (t, e) => {
|
|
162
163
|
const n = gt(t.tree), r = {
|
|
163
164
|
areas: [["root"]],
|
|
164
165
|
rows: [{ size: "1fr" }],
|
|
@@ -184,95 +185,95 @@ const ne = (t) => ({
|
|
|
184
185
|
};
|
|
185
186
|
});
|
|
186
187
|
return { config: r, layers: o };
|
|
187
|
-
},
|
|
188
|
-
const r = gt(t.tree), o = Array.from(new Set(Array.from(r.values()).flatMap((
|
|
189
|
-
for (const [
|
|
190
|
-
if (
|
|
191
|
-
return
|
|
188
|
+
}, le = (t, e, n) => {
|
|
189
|
+
const r = gt(t.tree), o = Array.from(new Set(Array.from(r.values()).flatMap((b) => [b.x, b.x + b.w]))).sort((b, I) => b - I), s = Array.from(new Set(Array.from(r.values()).flatMap((b) => [b.y, b.y + b.h]))).sort((b, I) => b - I), a = o.slice(1).map((b, I) => `${b - o[I]}fr`), i = s.slice(1).map((b, I) => `${b - s[I]}fr`), c = a.map((b) => ({ size: b, resizable: n })), d = i.map((b) => ({ size: b, resizable: n })), l = (b, I, w, T) => {
|
|
190
|
+
for (const [h, y] of r.entries())
|
|
191
|
+
if (b >= y.x && I <= y.x + y.w && w >= y.y && T <= y.y + y.h)
|
|
192
|
+
return h;
|
|
192
193
|
return ".";
|
|
193
194
|
}, p = [];
|
|
194
|
-
for (let
|
|
195
|
-
const
|
|
195
|
+
for (let b = 0; b < s.length - 1; b += 1) {
|
|
196
|
+
const I = [];
|
|
196
197
|
for (let w = 0; w < o.length - 1; w += 1)
|
|
197
|
-
|
|
198
|
-
p.push(
|
|
198
|
+
I.push(l(o[w], o[w + 1], s[b], s[b + 1]));
|
|
199
|
+
p.push(I);
|
|
199
200
|
}
|
|
200
201
|
const g = {
|
|
201
202
|
areas: p,
|
|
202
203
|
rows: d,
|
|
203
204
|
columns: c,
|
|
204
205
|
gap: "0px"
|
|
205
|
-
}, v = Array.from(r.keys()).map((
|
|
206
|
-
id:
|
|
207
|
-
gridArea:
|
|
208
|
-
component: e(
|
|
206
|
+
}, v = Array.from(r.keys()).map((b) => ({
|
|
207
|
+
id: b,
|
|
208
|
+
gridArea: b,
|
|
209
|
+
component: e(b)
|
|
209
210
|
}));
|
|
210
211
|
return { config: g, layers: v };
|
|
211
|
-
}, bt =
|
|
212
|
-
const t =
|
|
212
|
+
}, bt = u.createContext(null), de = () => {
|
|
213
|
+
const t = u.useContext(bt);
|
|
213
214
|
if (!t)
|
|
214
215
|
throw new Error("usePanelRenderContext must be used within PanelRenderProvider");
|
|
215
216
|
return t;
|
|
216
|
-
},
|
|
217
|
-
const t =
|
|
217
|
+
}, pe = ({ value: t, children: e }) => /* @__PURE__ */ m(bt.Provider, { value: t, children: e }), ht = u.createContext(null), mt = () => {
|
|
218
|
+
const t = u.useContext(ht);
|
|
218
219
|
if (!t)
|
|
219
220
|
throw new Error("useDomRegistry must be used within DomRegistryProvider");
|
|
220
221
|
return t;
|
|
221
|
-
},
|
|
222
|
-
const e =
|
|
222
|
+
}, fe = ({ children: t }) => {
|
|
223
|
+
const e = u.useRef(/* @__PURE__ */ new Map()), n = u.useCallback((c) => {
|
|
223
224
|
const d = e.current.get(c);
|
|
224
225
|
if (d)
|
|
225
226
|
return d;
|
|
226
|
-
const
|
|
227
|
-
return e.current.set(c,
|
|
228
|
-
}, []), r =
|
|
227
|
+
const l = { group: null, tabbar: null, content: null };
|
|
228
|
+
return e.current.set(c, l), l;
|
|
229
|
+
}, []), r = u.useCallback(
|
|
229
230
|
(c, d) => {
|
|
230
|
-
const
|
|
231
|
-
if (
|
|
231
|
+
const l = n(c);
|
|
232
|
+
if (l.group = d, d === null) {
|
|
232
233
|
const p = e.current.get(c);
|
|
233
234
|
(p ? p.tabbar === null && p.content === null : !1) && e.current.delete(c);
|
|
234
235
|
}
|
|
235
236
|
},
|
|
236
237
|
[n]
|
|
237
|
-
), o =
|
|
238
|
+
), o = u.useCallback(
|
|
238
239
|
(c, d) => {
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
240
|
+
const l = n(c);
|
|
241
|
+
if (l.tabbar = d, d === null) {
|
|
241
242
|
const p = e.current.get(c);
|
|
242
243
|
(p ? p.group === null && p.content === null : !1) && e.current.delete(c);
|
|
243
244
|
}
|
|
244
245
|
},
|
|
245
246
|
[n]
|
|
246
|
-
), s =
|
|
247
|
+
), s = u.useCallback(
|
|
247
248
|
(c, d) => {
|
|
248
|
-
const
|
|
249
|
-
if (
|
|
249
|
+
const l = n(c);
|
|
250
|
+
if (l.content = d, d === null) {
|
|
250
251
|
const p = e.current.get(c);
|
|
251
252
|
(p ? p.group === null && p.tabbar === null : !1) && e.current.delete(c);
|
|
252
253
|
}
|
|
253
254
|
},
|
|
254
255
|
[n]
|
|
255
|
-
), a =
|
|
256
|
+
), a = u.useCallback(() => e.current, []), i = u.useMemo(() => ({ setGroupEl: r, setTabbarEl: o, setContentEl: s, getAll: a }), [r, o, s, a]);
|
|
256
257
|
return /* @__PURE__ */ m(ht.Provider, { value: i, children: t });
|
|
257
|
-
},
|
|
258
|
+
}, ge = {
|
|
258
259
|
display: "flex",
|
|
259
260
|
flexDirection: "column",
|
|
260
261
|
width: "100%",
|
|
261
262
|
height: "100%"
|
|
262
|
-
},
|
|
263
|
+
}, be = {
|
|
263
264
|
flex: "1 1 auto",
|
|
264
265
|
minWidth: 0,
|
|
265
266
|
minHeight: 0,
|
|
266
267
|
position: "relative",
|
|
267
268
|
overflow: "hidden"
|
|
268
269
|
};
|
|
269
|
-
function be(t, e, n, r) {
|
|
270
|
-
return t ? l.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
|
|
271
|
-
}
|
|
272
270
|
function he(t, e, n, r) {
|
|
273
|
-
return t ?
|
|
271
|
+
return t ? u.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
|
|
272
|
+
}
|
|
273
|
+
function me(t, e, n, r) {
|
|
274
|
+
return t ? u.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
|
|
274
275
|
}
|
|
275
|
-
const
|
|
276
|
+
const ve = ({
|
|
276
277
|
group: t,
|
|
277
278
|
tabbar: e,
|
|
278
279
|
content: n,
|
|
@@ -284,25 +285,25 @@ const me = ({
|
|
|
284
285
|
contentComponent: c,
|
|
285
286
|
contentElement: d
|
|
286
287
|
}) => {
|
|
287
|
-
const
|
|
288
|
+
const l = {
|
|
288
289
|
ref: o,
|
|
289
|
-
style:
|
|
290
|
+
style: ge,
|
|
290
291
|
"data-group-id": t.id
|
|
291
|
-
}, g =
|
|
292
|
+
}, g = he(d, c, {
|
|
292
293
|
ref: s,
|
|
293
|
-
style:
|
|
294
|
+
style: be,
|
|
294
295
|
"data-dnd-zone": "content",
|
|
295
296
|
onPointerDown: r
|
|
296
297
|
}, n);
|
|
297
|
-
return
|
|
298
|
+
return me(i, a, l, /* @__PURE__ */ H(et, { children: [
|
|
298
299
|
e,
|
|
299
300
|
g
|
|
300
301
|
] }));
|
|
301
|
-
}, vt =
|
|
302
|
+
}, vt = u.memo(ve, (t, e) => t.group.id !== e.group.id || t.group.activeTabId !== e.group.activeTabId || t.group.tabs.length !== e.group.tabs.length ? !1 : t.group.tabs === e.group.tabs);
|
|
302
303
|
vt.displayName = "PanelGroupView";
|
|
303
|
-
const
|
|
304
|
-
const r = t.left, o = t.top, s = t.width, a = t.height, i = e - r, c = n - o, d = s / 3,
|
|
305
|
-
return i > d && i < s - d && c >
|
|
304
|
+
const U = (t, e, n) => {
|
|
305
|
+
const r = t.left, o = t.top, s = t.width, a = t.height, i = e - r, c = n - o, d = s / 3, l = a / 3;
|
|
306
|
+
return i > d && i < s - d && c > l && c < a - l ? "center" : i < c && i < s - i && c < a - c ? "left" : s - i < c && s - i < i && c < a - c ? "right" : c < i && c < a - c && i < s - i ? "top" : "bottom";
|
|
306
307
|
};
|
|
307
308
|
function A(t, e) {
|
|
308
309
|
if (!e) {
|
|
@@ -323,7 +324,7 @@ function A(t, e) {
|
|
|
323
324
|
enumerable: !0
|
|
324
325
|
}), n;
|
|
325
326
|
}
|
|
326
|
-
const
|
|
327
|
+
const Ie = (t, e) => {
|
|
327
328
|
const n = {};
|
|
328
329
|
return Object.keys(t).forEach((r) => {
|
|
329
330
|
const o = t[r];
|
|
@@ -359,7 +360,7 @@ const ve = (t, e) => {
|
|
|
359
360
|
(t) => t
|
|
360
361
|
),
|
|
361
362
|
reset: A("RESET")
|
|
362
|
-
},
|
|
363
|
+
}, we = It(D, {
|
|
363
364
|
startContent: (t, e) => ({
|
|
364
365
|
phase: {
|
|
365
366
|
kind: "content",
|
|
@@ -392,15 +393,15 @@ const ve = (t, e) => {
|
|
|
392
393
|
setPointer: (t, e) => ({ ...t, pointer: e.payload }),
|
|
393
394
|
setTabbarHover: (t, e) => ({ ...t, tabbarHover: e.payload }),
|
|
394
395
|
reset: () => wt
|
|
395
|
-
}),
|
|
396
|
-
const n =
|
|
396
|
+
}), ye = (t, e) => {
|
|
397
|
+
const n = we[e.type];
|
|
397
398
|
return n ? n(t, e, void 0) : t;
|
|
398
|
-
}, yt =
|
|
399
|
-
const t =
|
|
399
|
+
}, yt = u.createContext(null), W = () => {
|
|
400
|
+
const t = u.useContext(yt);
|
|
400
401
|
if (!t)
|
|
401
402
|
throw new Error("usePanelInteractions must be used within InteractionsProvider");
|
|
402
403
|
return t;
|
|
403
|
-
},
|
|
404
|
+
}, Te = ({
|
|
404
405
|
containerRef: t,
|
|
405
406
|
dragThresholdPx: e,
|
|
406
407
|
onCommitContentDrop: n,
|
|
@@ -408,27 +409,27 @@ const ve = (t, e) => {
|
|
|
408
409
|
isContentZoneAllowed: o,
|
|
409
410
|
children: s
|
|
410
411
|
}) => {
|
|
411
|
-
const [a, i] =
|
|
412
|
-
const w = Array.from(c.getAll().entries()), T = w.map(([f, S]) => ({ gid: f, el: S.content ?? S.group })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() })),
|
|
413
|
-
return { groups: T, tabbars:
|
|
414
|
-
}, [c]),
|
|
412
|
+
const [a, i] = u.useReducer(ye, wt), c = mt(), d = u.useCallback(() => {
|
|
413
|
+
const w = Array.from(c.getAll().entries()), T = w.map(([f, S]) => ({ gid: f, el: S.content ?? S.group })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() })), h = w.map(([f, S]) => ({ gid: f, el: S.tabbar })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() })), y = w.map(([f, S]) => ({ gid: f, el: S.content ?? S.group })).filter((f) => !!f.el).map((f) => ({ ...f, rect: f.el.getBoundingClientRect() }));
|
|
414
|
+
return { groups: T, tabbars: h, contents: y };
|
|
415
|
+
}, [c]), l = J((w) => {
|
|
415
416
|
if (!t.current)
|
|
416
417
|
return;
|
|
417
|
-
const
|
|
418
|
+
const h = w.clientX, y = w.clientY, f = a.phase;
|
|
418
419
|
if (f.kind === "idle")
|
|
419
420
|
return;
|
|
420
|
-
const S = Math.abs(
|
|
421
|
+
const S = Math.abs(h - f.startX), C = Math.abs(y - f.startY);
|
|
421
422
|
if (S < e && C < e) {
|
|
422
423
|
a.phase.kind === "content" && i(D.setSuggest(null)), i(D.setPointer(null)), i(D.setTabbarHover(null));
|
|
423
424
|
return;
|
|
424
425
|
}
|
|
425
|
-
if (i(D.setPointer({ x:
|
|
426
|
-
const G = f.cache.groups.find(({ rect: x }) =>
|
|
426
|
+
if (i(D.setPointer({ x: h, y })), f.kind === "content") {
|
|
427
|
+
const G = f.cache.groups.find(({ rect: x }) => h >= x.left && h <= x.right && y >= x.top && y <= x.bottom);
|
|
427
428
|
if (!G) {
|
|
428
429
|
i(D.setSuggest(null));
|
|
429
430
|
return;
|
|
430
431
|
}
|
|
431
|
-
const R =
|
|
432
|
+
const R = U(G.rect, h, y);
|
|
432
433
|
if (o && !o({ targetGroupId: G.gid, zone: R })) {
|
|
433
434
|
i(D.setSuggest(null));
|
|
434
435
|
return;
|
|
@@ -437,18 +438,18 @@ const ve = (t, e) => {
|
|
|
437
438
|
return;
|
|
438
439
|
}
|
|
439
440
|
if (f.kind === "tab") {
|
|
440
|
-
const G = f.cache.tabbars.find(({ rect: E }) =>
|
|
441
|
+
const G = f.cache.tabbars.find(({ rect: E }) => h >= E.left && h <= E.right && y >= E.top && y <= E.bottom);
|
|
441
442
|
if (G) {
|
|
442
|
-
const k = Array.from(G.el.querySelectorAll("[role='tab']")).map((z) => z.getBoundingClientRect()), P = k.map((z) => z.left + z.width / 2), O = P.findIndex((z) =>
|
|
443
|
+
const k = Array.from(G.el.querySelectorAll("[role='tab']")).map((z) => z.getBoundingClientRect()), P = k.map((z) => z.left + z.width / 2), O = P.findIndex((z) => h < z), B = O === -1 ? P.length : O, At = k.length === 0 ? G.rect.left + 8 : B === 0 ? k[0].left : B === k.length ? k[k.length - 1].right : (k[B - 1].right + k[B].left) / 2;
|
|
443
444
|
i(D.setTabbarHover({ groupId: G.gid, index: B, rect: G.rect, insertX: At }));
|
|
444
445
|
} else
|
|
445
446
|
i(D.setTabbarHover(null));
|
|
446
|
-
const R = f.cache.contents.find(({ rect: E }) =>
|
|
447
|
+
const R = f.cache.contents.find(({ rect: E }) => h >= E.left && h <= E.right && y >= E.top && y <= E.bottom);
|
|
447
448
|
if (!R) {
|
|
448
449
|
i(D.setSuggest(null));
|
|
449
450
|
return;
|
|
450
451
|
}
|
|
451
|
-
const x =
|
|
452
|
+
const x = U(R.rect, h, y);
|
|
452
453
|
if (o && !o({ targetGroupId: R.gid, zone: x })) {
|
|
453
454
|
i(D.setSuggest(null));
|
|
454
455
|
return;
|
|
@@ -456,29 +457,29 @@ const ve = (t, e) => {
|
|
|
456
457
|
i(D.setSuggest({ rect: R.rect, zone: x }));
|
|
457
458
|
}
|
|
458
459
|
}), p = J((w) => {
|
|
459
|
-
const T = t.current,
|
|
460
|
+
const T = t.current, h = a;
|
|
460
461
|
if (i(D.reset()), !T)
|
|
461
462
|
return;
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
463
|
+
const y = w.clientX, f = w.clientY;
|
|
464
|
+
if (h.phase.kind === "idle")
|
|
464
465
|
return;
|
|
465
|
-
const S = Math.abs(
|
|
466
|
+
const S = Math.abs(y - h.phase.startX), C = Math.abs(f - h.phase.startY);
|
|
466
467
|
if (!(S < e && C < e)) {
|
|
467
|
-
if (
|
|
468
|
-
const G =
|
|
468
|
+
if (h.phase.kind === "content") {
|
|
469
|
+
const G = h.phase.cache.groups.find(({ rect: E }) => y >= E.left && y <= E.right && f >= E.top && f <= E.bottom);
|
|
469
470
|
if (!G)
|
|
470
471
|
return;
|
|
471
472
|
const R = G.gid ?? null;
|
|
472
473
|
if (!R)
|
|
473
474
|
return;
|
|
474
|
-
const x =
|
|
475
|
+
const x = U(G.rect, y, f);
|
|
475
476
|
if (o && !o({ targetGroupId: R, zone: x }))
|
|
476
477
|
return;
|
|
477
|
-
n({ fromGroupId:
|
|
478
|
+
n({ fromGroupId: h.phase.fromGroupId, tabId: h.phase.tabId, targetGroupId: R, zone: x });
|
|
478
479
|
return;
|
|
479
480
|
}
|
|
480
|
-
if (
|
|
481
|
-
const G =
|
|
481
|
+
if (h.phase.kind === "tab") {
|
|
482
|
+
const G = h.phase.cache.tabbars.find(({ rect: x }) => y >= x.left && y <= x.right && f >= x.top && f <= x.bottom);
|
|
482
483
|
if (G) {
|
|
483
484
|
const x = G.gid;
|
|
484
485
|
if (!x)
|
|
@@ -486,45 +487,45 @@ const ve = (t, e) => {
|
|
|
486
487
|
const k = Array.from(G.el.querySelectorAll("[role='tab']")).map((B) => {
|
|
487
488
|
const Z = B.getBoundingClientRect();
|
|
488
489
|
return Z.left + Z.width / 2;
|
|
489
|
-
}), P = k.findIndex((B) =>
|
|
490
|
-
r({ fromGroupId:
|
|
490
|
+
}), P = k.findIndex((B) => y < B), O = P === -1 ? k.length : P;
|
|
491
|
+
r({ fromGroupId: h.phase.fromGroupId, tabId: h.phase.tabId, targetGroupId: x, targetIndex: O });
|
|
491
492
|
return;
|
|
492
493
|
}
|
|
493
|
-
const R =
|
|
494
|
+
const R = h.phase.cache.contents.find(({ rect: x }) => y >= x.left && y <= x.right && f >= x.top && f <= x.bottom);
|
|
494
495
|
if (R) {
|
|
495
496
|
const x = R.gid ?? null;
|
|
496
497
|
if (!x)
|
|
497
498
|
return;
|
|
498
|
-
const E =
|
|
499
|
+
const E = U(R.rect, y, f);
|
|
499
500
|
if (o && !o({ targetGroupId: x, zone: E }))
|
|
500
501
|
return;
|
|
501
|
-
n({ fromGroupId:
|
|
502
|
+
n({ fromGroupId: h.phase.fromGroupId, tabId: h.phase.tabId, targetGroupId: x, zone: E });
|
|
502
503
|
}
|
|
503
504
|
}
|
|
504
505
|
}
|
|
505
506
|
}), g = J(() => {
|
|
506
507
|
i(D.reset());
|
|
507
508
|
});
|
|
508
|
-
|
|
509
|
+
u.useEffect(() => {
|
|
509
510
|
if (a.phase.kind !== "idle")
|
|
510
|
-
return window.addEventListener("pointermove",
|
|
511
|
-
window.removeEventListener("pointermove",
|
|
511
|
+
return window.addEventListener("pointermove", l), window.addEventListener("pointerup", p, { once: !0 }), window.addEventListener("pointercancel", g, { once: !0 }), () => {
|
|
512
|
+
window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", p), window.removeEventListener("pointercancel", g);
|
|
512
513
|
};
|
|
513
514
|
}, [a.phase.kind]);
|
|
514
|
-
const v =
|
|
515
|
-
if (
|
|
515
|
+
const v = u.useCallback((w, T, h) => {
|
|
516
|
+
if (h.button !== 0)
|
|
516
517
|
return;
|
|
517
|
-
|
|
518
|
-
const
|
|
519
|
-
i(D.startContent({ x:
|
|
520
|
-
}, [d]),
|
|
521
|
-
if (
|
|
518
|
+
h.currentTarget.setPointerCapture(h.pointerId);
|
|
519
|
+
const y = d();
|
|
520
|
+
i(D.startContent({ x: h.clientX, y: h.clientY, groupId: w, tabId: T, cache: y }));
|
|
521
|
+
}, [d]), b = u.useCallback((w, T, h) => {
|
|
522
|
+
if (h.button !== 0)
|
|
522
523
|
return;
|
|
523
|
-
const
|
|
524
|
-
|
|
524
|
+
const y = h.currentTarget;
|
|
525
|
+
y && y.setPointerCapture(h.pointerId);
|
|
525
526
|
const f = d();
|
|
526
|
-
i(D.startTab({ x:
|
|
527
|
-
}, [d]),
|
|
527
|
+
i(D.startTab({ x: h.clientX, y: h.clientY, groupId: T, tabId: w, cache: f, element: y }));
|
|
528
|
+
}, [d]), I = u.useMemo(() => ({
|
|
528
529
|
suggest: a.suggest,
|
|
529
530
|
isTabDragging: a.phase.kind === "tab",
|
|
530
531
|
draggingTabId: a.phase.kind === "tab" ? a.phase.tabId : null,
|
|
@@ -532,14 +533,14 @@ const ve = (t, e) => {
|
|
|
532
533
|
tabbarHover: a.tabbarHover,
|
|
533
534
|
draggingTabElement: a.draggingTabElement,
|
|
534
535
|
onStartContentDrag: v,
|
|
535
|
-
onStartTabDrag:
|
|
536
|
-
}), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, v,
|
|
537
|
-
return /* @__PURE__ */ m(yt.Provider, { value:
|
|
536
|
+
onStartTabDrag: b
|
|
537
|
+
}), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement, v, b]);
|
|
538
|
+
return /* @__PURE__ */ m(yt.Provider, { value: I, children: s });
|
|
538
539
|
}, ct = {
|
|
539
540
|
display: "inline-flex",
|
|
540
541
|
alignItems: "center",
|
|
541
542
|
userSelect: "none"
|
|
542
|
-
},
|
|
543
|
+
}, Se = ({
|
|
543
544
|
groupId: t,
|
|
544
545
|
tab: e,
|
|
545
546
|
active: n,
|
|
@@ -551,13 +552,13 @@ const ve = (t, e) => {
|
|
|
551
552
|
tabElement: c,
|
|
552
553
|
onDoubleClick: d
|
|
553
554
|
}) => {
|
|
554
|
-
const
|
|
555
|
+
const l = u.useEffectEvent(() => {
|
|
555
556
|
o(e.id);
|
|
556
|
-
}), p =
|
|
557
|
-
s &&
|
|
557
|
+
}), p = u.useEffectEvent((I) => {
|
|
558
|
+
s && I.button === 0 && s(e.id, t, I);
|
|
558
559
|
}), g = () => {
|
|
559
|
-
const
|
|
560
|
-
return /* @__PURE__ */ m(
|
|
560
|
+
const I = !!a;
|
|
561
|
+
return /* @__PURE__ */ m(u.Activity, { mode: I ? "visible" : "hidden", children: /* @__PURE__ */ m(
|
|
561
562
|
"button",
|
|
562
563
|
{
|
|
563
564
|
type: "button",
|
|
@@ -566,9 +567,9 @@ const ve = (t, e) => {
|
|
|
566
567
|
a && (w.stopPropagation(), a(t, e.id));
|
|
567
568
|
},
|
|
568
569
|
style: { marginLeft: 6 },
|
|
569
|
-
tabIndex:
|
|
570
|
-
disabled: !
|
|
571
|
-
"aria-hidden":
|
|
570
|
+
tabIndex: I ? void 0 : -1,
|
|
571
|
+
disabled: !I,
|
|
572
|
+
"aria-hidden": I ? void 0 : !0,
|
|
572
573
|
children: "×"
|
|
573
574
|
}
|
|
574
575
|
) });
|
|
@@ -577,7 +578,7 @@ const ve = (t, e) => {
|
|
|
577
578
|
"aria-selected": n,
|
|
578
579
|
tabIndex: n ? 0 : -1,
|
|
579
580
|
style: ct,
|
|
580
|
-
onClick:
|
|
581
|
+
onClick: l,
|
|
581
582
|
onPointerDown: p,
|
|
582
583
|
onDoubleClick: d,
|
|
583
584
|
"data-tab-id": e.id,
|
|
@@ -587,7 +588,7 @@ const ve = (t, e) => {
|
|
|
587
588
|
/* @__PURE__ */ m("span", { children: e.title }),
|
|
588
589
|
g()
|
|
589
590
|
] })
|
|
590
|
-
},
|
|
591
|
+
}, b = {
|
|
591
592
|
type: "button",
|
|
592
593
|
role: "tab",
|
|
593
594
|
"aria-selected": n,
|
|
@@ -596,20 +597,20 @@ const ve = (t, e) => {
|
|
|
596
597
|
onClick: () => {
|
|
597
598
|
o(e.id);
|
|
598
599
|
},
|
|
599
|
-
onPointerDown: (
|
|
600
|
-
s &&
|
|
600
|
+
onPointerDown: (I) => {
|
|
601
|
+
s && I.button === 0 && s(e.id, t, I);
|
|
601
602
|
},
|
|
602
603
|
onDoubleClick: d,
|
|
603
604
|
children: /* @__PURE__ */ m("span", { children: e.title })
|
|
604
605
|
};
|
|
605
|
-
return c ? c(
|
|
606
|
-
},
|
|
606
|
+
return c ? c(b) : i ? /* @__PURE__ */ m(i, { ...b }) : /* @__PURE__ */ m("div", { ...v });
|
|
607
|
+
}, xe = {
|
|
607
608
|
display: "flex",
|
|
608
609
|
alignItems: "center"
|
|
609
|
-
},
|
|
610
|
+
}, Ge = {
|
|
610
611
|
flex: "1 1 auto",
|
|
611
612
|
alignSelf: "stretch"
|
|
612
|
-
},
|
|
613
|
+
}, Ce = ({
|
|
613
614
|
group: t,
|
|
614
615
|
onClickTab: e,
|
|
615
616
|
onStartDrag: n,
|
|
@@ -620,9 +621,9 @@ const ve = (t, e) => {
|
|
|
620
621
|
tabElement: i,
|
|
621
622
|
onAddTab: c,
|
|
622
623
|
onCloseTab: d,
|
|
623
|
-
doubleClickToAdd:
|
|
624
|
+
doubleClickToAdd: l
|
|
624
625
|
}) => {
|
|
625
|
-
const { isTabDragging: p, draggingTabId: g } = W(), v =
|
|
626
|
+
const { isTabDragging: p, draggingTabId: g } = W(), v = u.useRef(null), b = u.useCallback(
|
|
626
627
|
(f) => {
|
|
627
628
|
if (v.current = f, !!r) {
|
|
628
629
|
if (typeof r == "function") {
|
|
@@ -636,7 +637,7 @@ const ve = (t, e) => {
|
|
|
636
637
|
}
|
|
637
638
|
},
|
|
638
639
|
[r]
|
|
639
|
-
),
|
|
640
|
+
), I = u.useEffectEvent((f) => {
|
|
640
641
|
const S = v.current ?? f.currentTarget;
|
|
641
642
|
if (!S)
|
|
642
643
|
return;
|
|
@@ -687,7 +688,7 @@ const ve = (t, e) => {
|
|
|
687
688
|
return;
|
|
688
689
|
}
|
|
689
690
|
});
|
|
690
|
-
|
|
691
|
+
u.useEffect(() => {
|
|
691
692
|
const f = v.current;
|
|
692
693
|
if (!f)
|
|
693
694
|
return;
|
|
@@ -697,16 +698,16 @@ const ve = (t, e) => {
|
|
|
697
698
|
!f.contains(document.activeElement) && S && S.focus();
|
|
698
699
|
}, [t.activeTabId]);
|
|
699
700
|
const w = {
|
|
700
|
-
style:
|
|
701
|
+
style: xe,
|
|
701
702
|
role: "tablist",
|
|
702
703
|
"data-tabbar": "true",
|
|
703
704
|
"data-group-id": t.id,
|
|
704
705
|
"data-dragging": p ? "true" : "false",
|
|
705
|
-
onKeyDown:
|
|
706
|
+
onKeyDown: I
|
|
706
707
|
}, T = Ot({
|
|
707
708
|
element: s,
|
|
708
709
|
component: o
|
|
709
|
-
}),
|
|
710
|
+
}), h = () => c ? /* @__PURE__ */ m(
|
|
710
711
|
"button",
|
|
711
712
|
{
|
|
712
713
|
type: "button",
|
|
@@ -716,12 +717,12 @@ const ve = (t, e) => {
|
|
|
716
717
|
},
|
|
717
718
|
children: "+"
|
|
718
719
|
}
|
|
719
|
-
) : null,
|
|
720
|
-
|
|
721
|
-
}, [
|
|
722
|
-
return /* @__PURE__ */ H(T, { ...w, ref:
|
|
720
|
+
) : null, y = u.useCallback(() => {
|
|
721
|
+
l && c && c(t.id);
|
|
722
|
+
}, [l, c, t.id]);
|
|
723
|
+
return /* @__PURE__ */ H(T, { ...w, ref: b, onDoubleClick: y, children: [
|
|
723
724
|
t.tabs.map((f, S) => /* @__PURE__ */ m(
|
|
724
|
-
|
|
725
|
+
Se,
|
|
725
726
|
{
|
|
726
727
|
groupId: t.id,
|
|
727
728
|
tab: f,
|
|
@@ -736,21 +737,21 @@ const ve = (t, e) => {
|
|
|
736
737
|
},
|
|
737
738
|
`${t.id}:${f.id}:${S}`
|
|
738
739
|
)),
|
|
739
|
-
/* @__PURE__ */ m("span", { style:
|
|
740
|
-
|
|
740
|
+
/* @__PURE__ */ m("span", { style: Ge }),
|
|
741
|
+
h()
|
|
741
742
|
] });
|
|
742
|
-
},
|
|
743
|
-
const { getGroup: r, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: d, registerContentContainer:
|
|
743
|
+
}, Ee = ({ id: t, TabBarComponent: e, PanelGroupComponent: n }) => {
|
|
744
|
+
const { getGroup: r, getGroupContent: o, onClickTab: s, onAddTab: a, onCloseTab: i, onStartTabDrag: c, doubleClickToAdd: d, registerContentContainer: l } = de(), { setGroupEl: p, setTabbarEl: g, setContentEl: v } = mt(), b = u.useCallback(
|
|
744
745
|
(S) => {
|
|
745
746
|
p(t, S);
|
|
746
747
|
},
|
|
747
748
|
[t, p]
|
|
748
|
-
),
|
|
749
|
+
), I = u.useCallback(
|
|
749
750
|
(S) => {
|
|
750
|
-
v(t, S),
|
|
751
|
+
v(t, S), l(t, S);
|
|
751
752
|
},
|
|
752
|
-
[t, v,
|
|
753
|
-
), w =
|
|
753
|
+
[t, v, l]
|
|
754
|
+
), w = u.useCallback(
|
|
754
755
|
(S) => {
|
|
755
756
|
g(t, S);
|
|
756
757
|
},
|
|
@@ -758,13 +759,13 @@ const ve = (t, e) => {
|
|
|
758
759
|
), T = r(t);
|
|
759
760
|
if (!T)
|
|
760
761
|
return null;
|
|
761
|
-
const
|
|
762
|
+
const h = o(t);
|
|
762
763
|
return /* @__PURE__ */ m(
|
|
763
764
|
n ?? ((S) => /* @__PURE__ */ m(vt, { ...S })),
|
|
764
765
|
{
|
|
765
766
|
group: T,
|
|
766
767
|
tabbar: /* @__PURE__ */ m(
|
|
767
|
-
e ??
|
|
768
|
+
e ?? Ce,
|
|
768
769
|
{
|
|
769
770
|
rootRef: w,
|
|
770
771
|
group: T,
|
|
@@ -775,23 +776,23 @@ const ve = (t, e) => {
|
|
|
775
776
|
doubleClickToAdd: d
|
|
776
777
|
}
|
|
777
778
|
),
|
|
778
|
-
content:
|
|
779
|
-
groupRef:
|
|
780
|
-
contentRef:
|
|
779
|
+
content: h,
|
|
780
|
+
groupRef: b,
|
|
781
|
+
contentRef: I
|
|
781
782
|
}
|
|
782
783
|
);
|
|
783
|
-
},
|
|
784
|
+
}, Re = (t, e) => {
|
|
784
785
|
const n = new Array(16);
|
|
785
786
|
for (let r = 0; r < 4; r++)
|
|
786
787
|
for (let o = 0; o < 4; o++)
|
|
787
788
|
n[r * 4 + o] = t[0 + o] * e[r * 4 + 0] + t[4 + o] * e[r * 4 + 1] + t[8 + o] * e[r * 4 + 2] + t[12 + o] * e[r * 4 + 3];
|
|
788
789
|
return n;
|
|
789
|
-
},
|
|
790
|
+
}, K = (t) => {
|
|
790
791
|
if (t.length !== 16)
|
|
791
792
|
throw new Error("Matrix must have exactly 16 values");
|
|
792
793
|
const e = Object.freeze([...t]), n = (r) => {
|
|
793
|
-
const o =
|
|
794
|
-
return
|
|
794
|
+
const o = Re(e, r);
|
|
795
|
+
return K(o);
|
|
795
796
|
};
|
|
796
797
|
return Object.freeze({
|
|
797
798
|
translate: (r = 0, o = 0, s = 0) => n([
|
|
@@ -1040,21 +1041,21 @@ const ve = (t, e) => {
|
|
|
1040
1041
|
rotate: (r, o, s, a) => {
|
|
1041
1042
|
const i = Math.sqrt(o * o + s * s + a * a);
|
|
1042
1043
|
if (i === 0)
|
|
1043
|
-
return
|
|
1044
|
+
return K(e);
|
|
1044
1045
|
o /= i, s /= i, a /= i;
|
|
1045
|
-
const c = Math.cos(r), d = Math.sin(r),
|
|
1046
|
+
const c = Math.cos(r), d = Math.sin(r), l = 1 - c;
|
|
1046
1047
|
return n([
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1048
|
+
l * o * o + c,
|
|
1049
|
+
l * o * s + d * a,
|
|
1050
|
+
l * o * a - d * s,
|
|
1050
1051
|
0,
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1052
|
+
l * o * s - d * a,
|
|
1053
|
+
l * s * s + c,
|
|
1054
|
+
l * s * a + d * o,
|
|
1054
1055
|
0,
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1056
|
+
l * o * a + d * s,
|
|
1057
|
+
l * s * a - d * o,
|
|
1058
|
+
l * a * a + c,
|
|
1058
1059
|
0,
|
|
1059
1060
|
0,
|
|
1060
1061
|
0,
|
|
@@ -1065,21 +1066,21 @@ const ve = (t, e) => {
|
|
|
1065
1066
|
rotate3d: (r, o, s, a) => {
|
|
1066
1067
|
const i = Math.sqrt(r * r + o * o + s * s);
|
|
1067
1068
|
if (i === 0)
|
|
1068
|
-
return
|
|
1069
|
+
return K(e);
|
|
1069
1070
|
r /= i, o /= i, s /= i;
|
|
1070
|
-
const c = Math.cos(a), d = Math.sin(a),
|
|
1071
|
+
const c = Math.cos(a), d = Math.sin(a), l = 1 - c;
|
|
1071
1072
|
return n([
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1073
|
+
l * r * r + c,
|
|
1074
|
+
l * r * o + d * s,
|
|
1075
|
+
l * r * s - d * o,
|
|
1075
1076
|
0,
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1077
|
+
l * r * o - d * s,
|
|
1078
|
+
l * o * o + c,
|
|
1079
|
+
l * o * s + d * r,
|
|
1079
1080
|
0,
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1081
|
+
l * r * s + d * o,
|
|
1082
|
+
l * o * s - d * r,
|
|
1083
|
+
l * s * s + c,
|
|
1083
1084
|
0,
|
|
1084
1085
|
0,
|
|
1085
1086
|
0,
|
|
@@ -1182,7 +1183,7 @@ const ve = (t, e) => {
|
|
|
1182
1183
|
].join(`
|
|
1183
1184
|
`)
|
|
1184
1185
|
});
|
|
1185
|
-
},
|
|
1186
|
+
}, Pe = () => K([
|
|
1186
1187
|
1,
|
|
1187
1188
|
0,
|
|
1188
1189
|
0,
|
|
@@ -1199,18 +1200,18 @@ const ve = (t, e) => {
|
|
|
1199
1200
|
0,
|
|
1200
1201
|
0,
|
|
1201
1202
|
1
|
|
1202
|
-
]),
|
|
1203
|
+
]), De = {
|
|
1203
1204
|
position: "fixed",
|
|
1204
1205
|
inset: 0,
|
|
1205
1206
|
pointerEvents: "none",
|
|
1206
1207
|
zIndex: $t
|
|
1207
|
-
},
|
|
1208
|
+
}, Ae = {
|
|
1208
1209
|
position: "absolute",
|
|
1209
1210
|
border: `${Yt} dashed ${jt}`,
|
|
1210
1211
|
background: Xt,
|
|
1211
1212
|
borderRadius: Ft,
|
|
1212
1213
|
transformOrigin: "top left"
|
|
1213
|
-
}, L = (t, e) => e <= 0 ? 0 : M(t / e, 0),
|
|
1214
|
+
}, L = (t, e) => e <= 0 ? 0 : M(t / e, 0), ke = (t, e, n) => {
|
|
1214
1215
|
const { width: r, height: o } = t, s = n / 2, a = r > 0 ? r : 1, i = o > 0 ? o : 1, c = {
|
|
1215
1216
|
translateX: n,
|
|
1216
1217
|
translateY: n,
|
|
@@ -1221,7 +1222,7 @@ const ve = (t, e) => {
|
|
|
1221
1222
|
translateY: n,
|
|
1222
1223
|
scaleX: L(M(r / 2 - n * 1.5, 0), a),
|
|
1223
1224
|
scaleY: L(M(o - n * 2, 0), i)
|
|
1224
|
-
},
|
|
1225
|
+
}, l = {
|
|
1225
1226
|
translateX: r / 2 + s,
|
|
1226
1227
|
translateY: n,
|
|
1227
1228
|
scaleX: L(M(r / 2 - n * 1.5, 0), a),
|
|
@@ -1239,78 +1240,78 @@ const ve = (t, e) => {
|
|
|
1239
1240
|
}, v = {
|
|
1240
1241
|
center: c,
|
|
1241
1242
|
left: d,
|
|
1242
|
-
right:
|
|
1243
|
+
right: l,
|
|
1243
1244
|
top: p,
|
|
1244
1245
|
bottom: g
|
|
1245
|
-
}, { translateX:
|
|
1246
|
-
return
|
|
1247
|
-
},
|
|
1248
|
-
const n =
|
|
1246
|
+
}, { translateX: b, translateY: I, scaleX: w, scaleY: T } = v[e];
|
|
1247
|
+
return Pe().translate(b, I, 0).scale(w, T, 1).toCSS();
|
|
1248
|
+
}, Me = (t, e) => {
|
|
1249
|
+
const n = Ut;
|
|
1249
1250
|
return {
|
|
1250
|
-
...
|
|
1251
|
+
...Ae,
|
|
1251
1252
|
left: t.left,
|
|
1252
1253
|
top: t.top,
|
|
1253
1254
|
width: t.width,
|
|
1254
1255
|
height: t.height,
|
|
1255
|
-
transform:
|
|
1256
|
+
transform: ke(t, e, n)
|
|
1256
1257
|
};
|
|
1257
|
-
},
|
|
1258
|
+
}, _e = ({ suggest: t }) => {
|
|
1258
1259
|
if (!t)
|
|
1259
1260
|
return null;
|
|
1260
|
-
const { rect: e, zone: n } = t, r =
|
|
1261
|
-
return /* @__PURE__ */ m("div", { style:
|
|
1262
|
-
},
|
|
1263
|
-
const [e, n] =
|
|
1261
|
+
const { rect: e, zone: n } = t, r = Me(e, n);
|
|
1262
|
+
return /* @__PURE__ */ m("div", { style: De, children: /* @__PURE__ */ m("div", { style: r }) });
|
|
1263
|
+
}, Oe = typeof window < "u" && typeof document < "u", Be = (t) => {
|
|
1264
|
+
const [e, n] = u.useState(null), [r, o] = u.useState(null);
|
|
1264
1265
|
return nt(() => {
|
|
1265
|
-
if (!
|
|
1266
|
+
if (!Oe || !t) {
|
|
1266
1267
|
n(null), o(null);
|
|
1267
1268
|
return;
|
|
1268
1269
|
}
|
|
1269
1270
|
const s = t.getBoundingClientRect();
|
|
1270
1271
|
n({ width: s.width, height: s.height }), o(t.outerHTML);
|
|
1271
1272
|
}, [t]), { html: r, size: e };
|
|
1272
|
-
},
|
|
1273
|
+
}, Le = {
|
|
1273
1274
|
position: "fixed",
|
|
1274
1275
|
inset: 0,
|
|
1275
1276
|
pointerEvents: "none",
|
|
1276
1277
|
zIndex: Qt
|
|
1277
|
-
},
|
|
1278
|
+
}, He = {
|
|
1278
1279
|
position: "absolute",
|
|
1279
1280
|
width: Jt,
|
|
1280
1281
|
borderRadius: Zt,
|
|
1281
1282
|
background: qt,
|
|
1282
1283
|
boxShadow: Wt
|
|
1283
|
-
},
|
|
1284
|
-
const { isTabDragging: t, draggingTabId: e, dragPointer: n, tabbarHover: r, draggingTabElement: o } = W(), { html: s, size: a } =
|
|
1284
|
+
}, Ne = () => {
|
|
1285
|
+
const { isTabDragging: t, draggingTabId: e, dragPointer: n, tabbarHover: r, draggingTabElement: o } = W(), { html: s, size: a } = Be(o), i = n !== null && e !== null, c = u.useMemo(() => {
|
|
1285
1286
|
if (!(!i || !n))
|
|
1286
1287
|
return {
|
|
1287
1288
|
position: "absolute",
|
|
1288
1289
|
left: n.x,
|
|
1289
1290
|
top: n.y,
|
|
1290
|
-
transform: `translate(${
|
|
1291
|
+
transform: `translate(${Kt}, ${Vt})`,
|
|
1291
1292
|
pointerEvents: "none"
|
|
1292
1293
|
};
|
|
1293
|
-
}, [i, n]), d =
|
|
1294
|
+
}, [i, n]), d = u.useMemo(() => {
|
|
1294
1295
|
if (!(!c || !o))
|
|
1295
1296
|
return a ? { ...c, width: a.width, height: a.height } : c;
|
|
1296
|
-
}, [c, o, a]),
|
|
1297
|
+
}, [c, o, a]), l = u.useMemo(() => {
|
|
1297
1298
|
if (r)
|
|
1298
1299
|
return {
|
|
1299
|
-
...
|
|
1300
|
+
...He,
|
|
1300
1301
|
left: r.insertX,
|
|
1301
1302
|
top: r.rect.top + 4,
|
|
1302
1303
|
height: Math.max(0, r.rect.height - 8)
|
|
1303
1304
|
};
|
|
1304
1305
|
}, [r]);
|
|
1305
|
-
return t ? /* @__PURE__ */ H("div", { style:
|
|
1306
|
-
/* @__PURE__ */ m(
|
|
1306
|
+
return t ? /* @__PURE__ */ H("div", { style: Le, children: [
|
|
1307
|
+
/* @__PURE__ */ m(u.Activity, { mode: d ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: d, children: /* @__PURE__ */ m(
|
|
1307
1308
|
"div",
|
|
1308
1309
|
{
|
|
1309
1310
|
style: { width: "100%", height: "100%", pointerEvents: "none" },
|
|
1310
1311
|
dangerouslySetInnerHTML: { __html: s ?? "" }
|
|
1311
1312
|
}
|
|
1312
1313
|
) }) }),
|
|
1313
|
-
/* @__PURE__ */ m(
|
|
1314
|
+
/* @__PURE__ */ m(u.Activity, { mode: l ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: l }) })
|
|
1314
1315
|
] }) : null;
|
|
1315
1316
|
}, _ = (t) => t.type === "group", Y = (t, e = []) => {
|
|
1316
1317
|
if (_(t))
|
|
@@ -1346,7 +1347,7 @@ const ve = (t, e) => {
|
|
|
1346
1347
|
return { tree: a, newGroupId: o };
|
|
1347
1348
|
const d = s.side === "a" ? { ...c, a } : { ...c, b: a };
|
|
1348
1349
|
return { tree: j(t, i, d), newGroupId: o };
|
|
1349
|
-
},
|
|
1350
|
+
}, ze = (t, e) => {
|
|
1350
1351
|
const n = V(t, e);
|
|
1351
1352
|
if (!n || n.splitPath === null)
|
|
1352
1353
|
return { tree: t, survivorGroupId: e };
|
|
@@ -1355,7 +1356,7 @@ const ve = (t, e) => {
|
|
|
1355
1356
|
return { tree: t, survivorGroupId: e };
|
|
1356
1357
|
const s = n.side === "a" ? o.b : o.a, a = j(t, r, s), i = _(s) ? s.groupId : Y(s)[0] ?? null;
|
|
1357
1358
|
return { tree: a, survivorGroupId: i };
|
|
1358
|
-
},
|
|
1359
|
+
}, $e = (t, e, n) => {
|
|
1359
1360
|
const r = q(t, e);
|
|
1360
1361
|
if (_(r))
|
|
1361
1362
|
return t;
|
|
@@ -1368,17 +1369,17 @@ const ve = (t, e) => {
|
|
|
1368
1369
|
const a = o.groups[s];
|
|
1369
1370
|
if (!a || a.tabs.length > 0 || Object.keys(o.groups).length <= 1)
|
|
1370
1371
|
return o;
|
|
1371
|
-
const { tree: c, survivorGroupId: d } =
|
|
1372
|
+
const { tree: c, survivorGroupId: d } = ze(o.tree, s), { [s]: l, ...p } = o.groups, g = Y(c), v = o.focusedGroupId === s ? d ?? g[0] ?? null : o.focusedGroupId;
|
|
1372
1373
|
return { ...o, tree: c, groups: p, groupOrder: g, focusedGroupId: v };
|
|
1373
1374
|
};
|
|
1374
1375
|
return t.groupOrder.reduce((o, s) => r(o, s), t);
|
|
1375
|
-
},
|
|
1376
|
+
}, Fe = (t) => ({ id: t, tabIds: [], tabs: [], activeTabId: null }), ut = (t, e, n, r) => {
|
|
1376
1377
|
const o = { ...t.groups }, s = o[e];
|
|
1377
1378
|
if (!s)
|
|
1378
1379
|
throw new Error(`Group ${e} does not exist.`);
|
|
1379
|
-
const a = { ...t.panels, [n.id]: n }, i = [...s.tabIds, n.id], c = r ? n.id : s.activeTabId ?? n.id, d = i.map((p) => a[p]),
|
|
1380
|
-
return o[e] =
|
|
1381
|
-
},
|
|
1380
|
+
const a = { ...t.panels, [n.id]: n }, i = [...s.tabIds, n.id], c = r ? n.id : s.activeTabId ?? n.id, d = i.map((p) => a[p]), l = { ...s, tabIds: i, tabs: d, activeTabId: c };
|
|
1381
|
+
return o[e] = l, { ...t, panels: a, groups: o };
|
|
1382
|
+
}, Xe = (t, e, n) => {
|
|
1382
1383
|
const r = { ...t.groups }, o = r[e];
|
|
1383
1384
|
if (!o)
|
|
1384
1385
|
throw new Error(`Group ${e} does not exist.`);
|
|
@@ -1388,8 +1389,8 @@ const ve = (t, e) => {
|
|
|
1388
1389
|
const s = t.groups[e], a = t.groups[n];
|
|
1389
1390
|
if (!s || !a)
|
|
1390
1391
|
throw new Error("moveTab: source or target group is missing.");
|
|
1391
|
-
const i = { ...t.groups }, c = s.tabIds.filter((p) => p !== r), d = [...a.tabIds.filter((p) => p !== r), r],
|
|
1392
|
-
return i[e] = { ...s, tabIds: c, tabs: c.map((p) => t.panels[p]), activeTabId:
|
|
1392
|
+
const i = { ...t.groups }, c = s.tabIds.filter((p) => p !== r), d = [...a.tabIds.filter((p) => p !== r), r], l = s.activeTabId === r ? c[0] ?? null : s.activeTabId;
|
|
1393
|
+
return i[e] = { ...s, tabIds: c, tabs: c.map((p) => t.panels[p]), activeTabId: l }, i[n] = { ...a, tabIds: d, tabs: d.map((p) => t.panels[p]), activeTabId: r }, { ...t, groups: i };
|
|
1393
1394
|
}, St = (t, e, n) => {
|
|
1394
1395
|
const r = t.groups[e];
|
|
1395
1396
|
if (!r)
|
|
@@ -1404,16 +1405,16 @@ const ve = (t, e) => {
|
|
|
1404
1405
|
throw new Error(`addTabToGroupAtIndex: group ${e} not found.`);
|
|
1405
1406
|
const a = { ...t.panels, [n.id]: n }, i = s.tabIds.slice(), c = Math.max(0, Math.min(r, i.length));
|
|
1406
1407
|
i.splice(c, 0, n.id);
|
|
1407
|
-
const d = i.map((g) => a[g]),
|
|
1408
|
+
const d = i.map((g) => a[g]), l = o ? n.id : s.activeTabId ?? n.id, p = { ...t.groups, [e]: { ...s, tabIds: i, tabs: d, activeTabId: l } };
|
|
1408
1409
|
return { ...t, panels: a, groups: p };
|
|
1409
1410
|
}, N = (t, e) => {
|
|
1410
1411
|
if (!t.groups[e])
|
|
1411
1412
|
throw new Error(`setFocusedGroup: group ${e} not found.`);
|
|
1412
1413
|
return { ...t, focusedGroupId: e };
|
|
1413
|
-
},
|
|
1414
|
+
}, Ye = (t, e) => {
|
|
1414
1415
|
const n = e - 1, r = t.groupOrder[n];
|
|
1415
1416
|
return r ? N(t, r) : t;
|
|
1416
|
-
},
|
|
1417
|
+
}, je = (t) => {
|
|
1417
1418
|
const e = t.groupOrder, n = t.focusedGroupId;
|
|
1418
1419
|
if (!n) {
|
|
1419
1420
|
const s = e[0];
|
|
@@ -1421,7 +1422,7 @@ const ve = (t, e) => {
|
|
|
1421
1422
|
}
|
|
1422
1423
|
const r = e.indexOf(n), o = e[(r + 1) % e.length];
|
|
1423
1424
|
return N(t, o);
|
|
1424
|
-
},
|
|
1425
|
+
}, Ue = (t) => {
|
|
1425
1426
|
const e = t.groupOrder, n = t.focusedGroupId;
|
|
1426
1427
|
if (!n) {
|
|
1427
1428
|
const s = e[e.length - 1];
|
|
@@ -1430,20 +1431,20 @@ const ve = (t, e) => {
|
|
|
1430
1431
|
const r = e.indexOf(n), o = e[(r - 1 + e.length) % e.length];
|
|
1431
1432
|
return N(t, o);
|
|
1432
1433
|
}, xt = (t, e, n, r) => {
|
|
1433
|
-
const { tree: o, newGroupId: s } = Tt(t.tree, e, n, r), a = { ...t.groups, [s]:
|
|
1434
|
+
const { tree: o, newGroupId: s } = Tt(t.tree, e, n, r), a = { ...t.groups, [s]: Fe(s) }, i = Y(o);
|
|
1434
1435
|
return { ...t, tree: o, groups: a, groupOrder: i, focusedGroupId: s };
|
|
1435
|
-
},
|
|
1436
|
+
}, Dn = (t) => {
|
|
1436
1437
|
const n = { type: "group", groupId: "g_1" }, r = Object.fromEntries(t.map((i) => [i.id, i])), s = { g_1: { id: "g_1", tabIds: t.map((i) => i.id), tabs: t, activeTabId: t[0]?.id ?? null } };
|
|
1437
1438
|
return { tree: n, panels: r, groups: s, groupOrder: ["g_1"], focusedGroupId: "g_1" };
|
|
1438
|
-
}, Ke =
|
|
1439
|
-
const t =
|
|
1439
|
+
}, Ke = u.createContext(null), Ve = ({ value: t, children: e }) => /* @__PURE__ */ m(Ke.Provider, { value: t, children: e }), Gt = u.createContext(null), We = () => {
|
|
1440
|
+
const t = u.useContext(Gt);
|
|
1440
1441
|
if (!t)
|
|
1441
1442
|
throw new Error("useTree must be used within TreeProvider");
|
|
1442
1443
|
return t;
|
|
1443
|
-
},
|
|
1444
|
+
}, qe = ({ value: t, children: e }) => /* @__PURE__ */ m(Gt.Provider, { value: t, children: e }), Ze = u.createContext(null), Je = ({ value: t, children: e }) => /* @__PURE__ */ m(Ze.Provider, { value: t, children: e }), F = (t) => {
|
|
1444
1445
|
const e = Bt(t, Number.POSITIVE_INFINITY);
|
|
1445
1446
|
return M(e, 1);
|
|
1446
|
-
},
|
|
1447
|
+
}, Qe = (t) => typeof t == "object" && t !== null, tn = (t) => Qe(t) ? "rows" in t ? !0 : "cols" in t : !1, Ct = (t) => {
|
|
1447
1448
|
if (!t)
|
|
1448
1449
|
return {
|
|
1449
1450
|
rows: Number.POSITIVE_INFINITY,
|
|
@@ -1453,7 +1454,7 @@ const ve = (t, e) => {
|
|
|
1453
1454
|
const n = F(t);
|
|
1454
1455
|
return { rows: n, cols: n };
|
|
1455
1456
|
}
|
|
1456
|
-
if (
|
|
1457
|
+
if (tn(t))
|
|
1457
1458
|
return {
|
|
1458
1459
|
rows: F(t.rows),
|
|
1459
1460
|
cols: F(t.cols)
|
|
@@ -1468,13 +1469,13 @@ const ve = (t, e) => {
|
|
|
1468
1469
|
return { horizontal: 1, vertical: 1 };
|
|
1469
1470
|
const e = tt(t.a), n = tt(t.b);
|
|
1470
1471
|
return t.direction === "horizontal" ? { horizontal: e.horizontal + n.horizontal, vertical: Math.max(e.vertical, n.vertical) } : { horizontal: Math.max(e.horizontal, n.horizontal), vertical: e.vertical + n.vertical };
|
|
1471
|
-
},
|
|
1472
|
+
}, en = (t, e, n) => {
|
|
1472
1473
|
const { tree: r } = Tt(t, e, n, () => "__preview__");
|
|
1473
1474
|
return r;
|
|
1474
1475
|
}, rt = (t, e, n, r) => {
|
|
1475
1476
|
if (!Number.isFinite(r.rows) && !Number.isFinite(r.cols))
|
|
1476
1477
|
return !0;
|
|
1477
|
-
const o =
|
|
1478
|
+
const o = en(t, e, n), s = tt(o);
|
|
1478
1479
|
return !(s.horizontal > r.rows || s.vertical > r.cols);
|
|
1479
1480
|
}, Et = {
|
|
1480
1481
|
splitFocused: A("panelState/splitFocused", (t) => ({ direction: t })),
|
|
@@ -1500,7 +1501,7 @@ const ve = (t, e) => {
|
|
|
1500
1501
|
(t) => t
|
|
1501
1502
|
),
|
|
1502
1503
|
adjustSplitRatio: A("panelState/adjustSplitRatio", (t) => t)
|
|
1503
|
-
},
|
|
1504
|
+
}, nn = (t, e, n) => {
|
|
1504
1505
|
const r = t.groups[e.fromGroupId], o = t.groups[e.targetGroupId];
|
|
1505
1506
|
if (!r || !o || !r.tabs.find((p) => p.id === e.tabId))
|
|
1506
1507
|
return t;
|
|
@@ -1513,14 +1514,14 @@ const ve = (t, e) => {
|
|
|
1513
1514
|
const a = e.zone === "left" || e.zone === "right" ? "vertical" : "horizontal";
|
|
1514
1515
|
if (!rt(t.tree, e.targetGroupId, a, n.splitLimits))
|
|
1515
1516
|
return t;
|
|
1516
|
-
const i = n.createGroupId(), c = xt(t, e.targetGroupId, a, () => i), d = e.zone === "left" || e.zone === "top" ? e.targetGroupId : i,
|
|
1517
|
-
return N(
|
|
1518
|
-
},
|
|
1517
|
+
const i = n.createGroupId(), c = xt(t, e.targetGroupId, a, () => i), d = e.zone === "left" || e.zone === "top" ? e.targetGroupId : i, l = lt(c, e.fromGroupId, d, e.tabId);
|
|
1518
|
+
return N(l, d);
|
|
1519
|
+
}, rn = (t, e) => {
|
|
1519
1520
|
const n = t.groups[e.fromGroupId], r = t.groups[e.targetGroupId];
|
|
1520
1521
|
if (!n || !r || !t.panels[e.tabId])
|
|
1521
1522
|
return t;
|
|
1522
1523
|
if (e.fromGroupId === e.targetGroupId) {
|
|
1523
|
-
const g = n.tabIds.filter((T) => T !== e.tabId), v = Math.max(0, Math.min(e.targetIndex, g.length)),
|
|
1524
|
+
const g = n.tabIds.filter((T) => T !== e.tabId), v = Math.max(0, Math.min(e.targetIndex, g.length)), b = g.slice(0, v).concat([e.tabId], g.slice(v)), I = b.map((T) => t.panels[T]).filter(Boolean), w = { ...t.groups, [e.fromGroupId]: { ...n, tabIds: b, tabs: I } };
|
|
1524
1525
|
return { ...t, groups: w };
|
|
1525
1526
|
}
|
|
1526
1527
|
const s = { ...t.groups }, a = n.tabIds.filter((g) => g !== e.tabId), i = a.map((g) => t.panels[g]);
|
|
@@ -1530,16 +1531,16 @@ const ve = (t, e) => {
|
|
|
1530
1531
|
tabs: i,
|
|
1531
1532
|
activeTabId: n.activeTabId === e.tabId ? i[0]?.id ?? null : n.activeTabId
|
|
1532
1533
|
};
|
|
1533
|
-
const c = r.tabIds.filter((g) => g !== e.tabId), d = Math.max(0, Math.min(e.targetIndex, c.length)),
|
|
1534
|
-
return s[e.targetGroupId] = { ...r, tabIds:
|
|
1535
|
-
},
|
|
1534
|
+
const c = r.tabIds.filter((g) => g !== e.tabId), d = Math.max(0, Math.min(e.targetIndex, c.length)), l = c.slice(0, d).concat([e.tabId], c.slice(d)), p = l.map((g) => t.panels[g]).filter(Boolean);
|
|
1535
|
+
return s[e.targetGroupId] = { ...r, tabIds: l, tabs: p, activeTabId: e.tabId }, { ...t, groups: s, focusedGroupId: e.targetGroupId };
|
|
1536
|
+
}, on = It(Et, {
|
|
1536
1537
|
splitFocused: (t, e, n) => {
|
|
1537
1538
|
const r = t.focusedGroupId ?? t.groupOrder[0] ?? null;
|
|
1538
1539
|
return !r || !rt(t.tree, r, e.payload.direction, n.splitLimits) ? t : xt(t, r, e.payload.direction, n.createGroupId);
|
|
1539
1540
|
},
|
|
1540
|
-
focusGroupIndex: (t, e) =>
|
|
1541
|
-
focusNextGroup: (t) =>
|
|
1542
|
-
focusPrevGroup: (t) =>
|
|
1541
|
+
focusGroupIndex: (t, e) => Ye(t, e.payload.index1Based),
|
|
1542
|
+
focusNextGroup: (t) => je(t),
|
|
1543
|
+
focusPrevGroup: (t) => Ue(t),
|
|
1543
1544
|
setActiveTab: (t, e) => St(t, e.payload.groupId, e.payload.tabId),
|
|
1544
1545
|
addTab: (t, e) => {
|
|
1545
1546
|
const { groupId: n, tab: r, index: o, makeActive: s } = e.payload;
|
|
@@ -1551,28 +1552,28 @@ const ve = (t, e) => {
|
|
|
1551
1552
|
const o = { id: n.createPanelId(), title: e.payload.title, render: () => e.payload.title }, { groupId: s, index: a, makeActive: i } = e.payload;
|
|
1552
1553
|
return typeof a == "number" ? dt(t, s, o, a, i ?? !0) : ut(t, s, o, i ?? !0);
|
|
1553
1554
|
},
|
|
1554
|
-
removeTab: (t, e) =>
|
|
1555
|
-
contentDrop: (t, e, n) =>
|
|
1556
|
-
tabDrop: (t, e) =>
|
|
1555
|
+
removeTab: (t, e) => Xe(t, e.payload.groupId, e.payload.tabId),
|
|
1556
|
+
contentDrop: (t, e, n) => nn(t, e.payload, n),
|
|
1557
|
+
tabDrop: (t, e) => rn(t, e.payload),
|
|
1557
1558
|
adjustSplitRatio: (t, e) => {
|
|
1558
1559
|
const n = q(t.tree, e.payload.path);
|
|
1559
1560
|
if (_(n))
|
|
1560
1561
|
return t;
|
|
1561
|
-
const r =
|
|
1562
|
+
const r = $e(t.tree, e.payload.path, n.ratio + e.payload.deltaRatio);
|
|
1562
1563
|
return { ...t, tree: r };
|
|
1563
1564
|
}
|
|
1564
1565
|
}), pt = (t, e, n) => {
|
|
1565
|
-
const r =
|
|
1566
|
+
const r = on[e.type];
|
|
1566
1567
|
if (!r)
|
|
1567
1568
|
return t;
|
|
1568
1569
|
const o = r(t, e, n);
|
|
1569
1570
|
return Q(o);
|
|
1570
|
-
}, Rt =
|
|
1571
|
-
const t =
|
|
1571
|
+
}, Rt = u.createContext(null), $ = () => {
|
|
1572
|
+
const t = u.useContext(Rt);
|
|
1572
1573
|
if (!t)
|
|
1573
1574
|
throw new Error("usePanelSystem must be used within PanelSystemProvider");
|
|
1574
1575
|
return t;
|
|
1575
|
-
},
|
|
1576
|
+
}, sn = ({
|
|
1576
1577
|
initialState: t,
|
|
1577
1578
|
createGroupId: e,
|
|
1578
1579
|
createPanelId: n,
|
|
@@ -1581,56 +1582,56 @@ const ve = (t, e) => {
|
|
|
1581
1582
|
splitLimits: s,
|
|
1582
1583
|
children: a
|
|
1583
1584
|
}) => {
|
|
1584
|
-
const i =
|
|
1585
|
+
const i = u.useMemo(() => Q(t), [t]), c = u.useMemo(() => Ct(s), [s]), d = u.useRef({ createGroupId: e, splitLimits: c, createPanelId: n });
|
|
1585
1586
|
d.current.createGroupId = e, d.current.splitLimits = c, d.current.createPanelId = n;
|
|
1586
|
-
const [
|
|
1587
|
+
const [l, p] = u.useReducer(
|
|
1587
1588
|
(S, C) => pt(S, C, d.current),
|
|
1588
1589
|
i
|
|
1589
|
-
), g =
|
|
1590
|
-
() => r ? Q(r) :
|
|
1591
|
-
[r,
|
|
1592
|
-
), v =
|
|
1590
|
+
), g = u.useMemo(
|
|
1591
|
+
() => r ? Q(r) : l,
|
|
1592
|
+
[r, l]
|
|
1593
|
+
), v = u.useRef(g);
|
|
1593
1594
|
v.current = g;
|
|
1594
|
-
const
|
|
1595
|
+
const b = r !== void 0, I = u.useCallback(
|
|
1595
1596
|
(S) => {
|
|
1596
|
-
if (
|
|
1597
|
+
if (b) {
|
|
1597
1598
|
const C = pt(v.current, S, d.current);
|
|
1598
1599
|
o?.(C);
|
|
1599
1600
|
return;
|
|
1600
1601
|
}
|
|
1601
1602
|
p(S);
|
|
1602
1603
|
},
|
|
1603
|
-
[
|
|
1604
|
-
), w =
|
|
1604
|
+
[b, o, p]
|
|
1605
|
+
), w = u.useMemo(() => Ie(Et, I), [I]), T = u.useMemo(
|
|
1605
1606
|
() => ({
|
|
1606
1607
|
setActiveTab: w.setActiveTab,
|
|
1607
1608
|
tabDrop: w.tabDrop
|
|
1608
1609
|
}),
|
|
1609
1610
|
[w]
|
|
1610
|
-
),
|
|
1611
|
+
), h = u.useMemo(
|
|
1611
1612
|
() => ({
|
|
1612
1613
|
adjustSplitRatio: w.adjustSplitRatio
|
|
1613
1614
|
}),
|
|
1614
1615
|
[w]
|
|
1615
|
-
),
|
|
1616
|
+
), y = u.useMemo(
|
|
1616
1617
|
() => ({
|
|
1617
1618
|
focusGroupIndex: w.focusGroupIndex,
|
|
1618
1619
|
focusNextGroup: w.focusNextGroup,
|
|
1619
1620
|
focusPrevGroup: w.focusPrevGroup
|
|
1620
1621
|
}),
|
|
1621
1622
|
[w]
|
|
1622
|
-
), f =
|
|
1623
|
+
), f = u.useMemo(
|
|
1623
1624
|
() => ({
|
|
1624
1625
|
state: g,
|
|
1625
|
-
dispatch:
|
|
1626
|
+
dispatch: I,
|
|
1626
1627
|
actions: w
|
|
1627
1628
|
}),
|
|
1628
|
-
[g,
|
|
1629
|
+
[g, I, w]
|
|
1629
1630
|
);
|
|
1630
|
-
return /* @__PURE__ */ m(Rt.Provider, { value: f, children: /* @__PURE__ */ m(
|
|
1631
|
-
},
|
|
1631
|
+
return /* @__PURE__ */ m(Rt.Provider, { value: f, children: /* @__PURE__ */ m(Ve, { value: T, children: /* @__PURE__ */ m(qe, { value: h, children: /* @__PURE__ */ m(Je, { value: y, children: a }) }) }) });
|
|
1632
|
+
}, an = () => {
|
|
1632
1633
|
const { actions: t } = $();
|
|
1633
|
-
return
|
|
1634
|
+
return u.useMemo(
|
|
1634
1635
|
() => ({
|
|
1635
1636
|
splitFocused: (e) => {
|
|
1636
1637
|
t.splitFocused(e);
|
|
@@ -1649,128 +1650,129 @@ const ve = (t, e) => {
|
|
|
1649
1650
|
}),
|
|
1650
1651
|
[t]
|
|
1651
1652
|
);
|
|
1652
|
-
},
|
|
1653
|
-
const { actions: t } = $(), e =
|
|
1653
|
+
}, cn = () => {
|
|
1654
|
+
const { actions: t } = $(), e = u.useCallback(
|
|
1654
1655
|
({ fromGroupId: r, tabId: o, targetGroupId: s, zone: a }) => {
|
|
1655
1656
|
t.contentDrop({ fromGroupId: r, tabId: o, targetGroupId: s, zone: a });
|
|
1656
1657
|
},
|
|
1657
1658
|
[t]
|
|
1658
|
-
), n =
|
|
1659
|
+
), n = u.useCallback(
|
|
1659
1660
|
({ fromGroupId: r, tabId: o, targetGroupId: s, targetIndex: a }) => {
|
|
1660
1661
|
t.tabDrop({ fromGroupId: r, tabId: o, targetGroupId: s, targetIndex: a });
|
|
1661
1662
|
},
|
|
1662
1663
|
[t]
|
|
1663
1664
|
);
|
|
1664
1665
|
return { onCommitContentDrop: e, onCommitTabDrop: n };
|
|
1665
|
-
},
|
|
1666
|
-
const t =
|
|
1667
|
-
return
|
|
1668
|
-
|
|
1666
|
+
}, un = () => {
|
|
1667
|
+
const t = oe(), e = an();
|
|
1668
|
+
return u.useEffect(() => {
|
|
1669
|
+
ae(t, e);
|
|
1669
1670
|
}, [t, e]), null;
|
|
1670
|
-
}, Pt =
|
|
1671
|
-
const t =
|
|
1671
|
+
}, Pt = u.createContext(null), ln = () => {
|
|
1672
|
+
const t = u.useContext(Pt);
|
|
1672
1673
|
if (!t)
|
|
1673
1674
|
throw new Error("useContentRegistry must be used within ContentRegistryProvider");
|
|
1674
1675
|
return t;
|
|
1675
|
-
},
|
|
1676
|
+
}, dn = (t) => {
|
|
1676
1677
|
const e = document.createElement("div");
|
|
1677
1678
|
return e.setAttribute("data-panel-wrapper", t), e.style.display = "contents", e;
|
|
1678
|
-
},
|
|
1679
|
-
const [r] =
|
|
1679
|
+
}, pn = (t, e, n) => {
|
|
1680
|
+
const [r] = u.useState(() => dn(t));
|
|
1680
1681
|
return nt(() => (r.style.display = n ? "contents" : "none", e && r.parentElement !== e && e.appendChild(r), () => {
|
|
1681
1682
|
r.parentElement?.removeChild(r);
|
|
1682
1683
|
}), [r, e, n]), r;
|
|
1683
|
-
}, Dt =
|
|
1684
|
+
}, Dt = u.memo(
|
|
1684
1685
|
({ panelId: t, content: e, placement: n, containerElement: r }) => {
|
|
1685
|
-
const o = n?.isActive ?? !1, s =
|
|
1686
|
+
const o = n?.isActive ?? !1, s = pn(t, r, o);
|
|
1686
1687
|
return ee(
|
|
1687
|
-
/* @__PURE__ */ m(
|
|
1688
|
+
/* @__PURE__ */ m(u.Activity, { mode: o ? "visible" : "hidden", children: e }),
|
|
1688
1689
|
s
|
|
1689
1690
|
);
|
|
1690
1691
|
}
|
|
1691
1692
|
);
|
|
1692
1693
|
Dt.displayName = "PanelContentHost";
|
|
1693
|
-
const
|
|
1694
|
+
const fn = ({
|
|
1694
1695
|
children: t,
|
|
1695
1696
|
panels: e,
|
|
1696
1697
|
placements: n
|
|
1697
1698
|
}) => {
|
|
1698
|
-
const [r, o] =
|
|
1699
|
-
o((
|
|
1700
|
-
const
|
|
1701
|
-
return
|
|
1699
|
+
const [r, o] = u.useState(/* @__PURE__ */ new Map()), s = u.useCallback((g, v) => {
|
|
1700
|
+
o((b) => {
|
|
1701
|
+
const I = new Map(b);
|
|
1702
|
+
return v ? I.set(g, v) : I.delete(g), I;
|
|
1702
1703
|
});
|
|
1703
|
-
}, []),
|
|
1704
|
-
() => ({ registerContentContainer:
|
|
1705
|
-
[
|
|
1706
|
-
),
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1704
|
+
}, []), a = u.useMemo(
|
|
1705
|
+
() => ({ registerContentContainer: s }),
|
|
1706
|
+
[s]
|
|
1707
|
+
), i = u.useRef(e);
|
|
1708
|
+
i.current = e;
|
|
1709
|
+
const c = u.useCallback((g) => {
|
|
1710
|
+
const v = i.current[g];
|
|
1711
|
+
return v ? v.render(v.id) : null;
|
|
1712
|
+
}, []), d = u.useMemo(() => Object.keys(e), [e]), { getCachedContent: l } = ne({
|
|
1713
|
+
resolveContent: c,
|
|
1714
|
+
validIds: d
|
|
1715
|
+
}), p = Object.keys(e);
|
|
1716
|
+
return /* @__PURE__ */ H(Pt.Provider, { value: a, children: [
|
|
1714
1717
|
t,
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
if (!p)
|
|
1718
|
+
p.map((g) => {
|
|
1719
|
+
if (!e[g])
|
|
1718
1720
|
return null;
|
|
1719
|
-
const
|
|
1721
|
+
const b = n[g] ?? null, I = b ? r.get(b.groupId) ?? null : null, w = l(g);
|
|
1720
1722
|
return /* @__PURE__ */ m(
|
|
1721
1723
|
Dt,
|
|
1722
1724
|
{
|
|
1723
|
-
panelId:
|
|
1724
|
-
content:
|
|
1725
|
-
placement:
|
|
1726
|
-
containerElement:
|
|
1725
|
+
panelId: g,
|
|
1726
|
+
content: w,
|
|
1727
|
+
placement: b,
|
|
1728
|
+
containerElement: I
|
|
1727
1729
|
},
|
|
1728
|
-
|
|
1730
|
+
g
|
|
1729
1731
|
);
|
|
1730
1732
|
})
|
|
1731
1733
|
] });
|
|
1732
|
-
},
|
|
1734
|
+
}, gn = ({
|
|
1733
1735
|
children: t,
|
|
1734
1736
|
emptyContentComponent: e,
|
|
1735
1737
|
doubleClickToAdd: n
|
|
1736
1738
|
}) => {
|
|
1737
|
-
const r = W(), { state: o, actions: s } = $(), { registerContentContainer: a } =
|
|
1739
|
+
const r = W(), { state: o, actions: s } = $(), { registerContentContainer: a } = ln(), i = u.useCallback(() => u.createElement("div", { style: { color: "#888", fontSize: 12, padding: 12 } }, "No tabs"), []), c = e ?? i, d = u.useCallback(
|
|
1738
1740
|
(T) => {
|
|
1739
|
-
const
|
|
1740
|
-
if (!
|
|
1741
|
+
const h = o.groups[T];
|
|
1742
|
+
if (!h)
|
|
1741
1743
|
return null;
|
|
1742
|
-
const
|
|
1743
|
-
return { ...
|
|
1744
|
+
const y = h.tabIds.map((f) => o.panels[f]).filter(Boolean);
|
|
1745
|
+
return { ...h, tabs: y };
|
|
1744
1746
|
},
|
|
1745
1747
|
[o.groups, o.panels]
|
|
1746
|
-
),
|
|
1748
|
+
), l = u.useCallback(
|
|
1747
1749
|
(T) => {
|
|
1748
|
-
const
|
|
1749
|
-
return !
|
|
1750
|
+
const h = o.groups[T];
|
|
1751
|
+
return !h || h.tabIds.length === 0 ? /* @__PURE__ */ m(c, {}) : null;
|
|
1750
1752
|
},
|
|
1751
1753
|
[o.groups, c]
|
|
1752
|
-
), p =
|
|
1753
|
-
s.setActiveTab(T,
|
|
1754
|
-
}, [s]), g =
|
|
1754
|
+
), p = u.useCallback((T, h) => {
|
|
1755
|
+
s.setActiveTab(T, h);
|
|
1756
|
+
}, [s]), g = u.useCallback((T) => {
|
|
1755
1757
|
s.addNewTab({ groupId: T, title: "New Tab", makeActive: !0 });
|
|
1756
|
-
}, [s]), v =
|
|
1757
|
-
s.removeTab(T,
|
|
1758
|
-
}, [s]),
|
|
1759
|
-
s.setActiveTab(
|
|
1760
|
-
}, [s, r]),
|
|
1761
|
-
const
|
|
1762
|
-
!
|
|
1763
|
-
}, [o.groups, r]), w =
|
|
1764
|
-
() => ({ getGroup: d, getGroupContent:
|
|
1765
|
-
[d,
|
|
1758
|
+
}, [s]), v = u.useCallback((T, h) => {
|
|
1759
|
+
s.removeTab(T, h);
|
|
1760
|
+
}, [s]), b = u.useCallback((T, h, y) => {
|
|
1761
|
+
s.setActiveTab(h, T), r.onStartTabDrag(T, h, y);
|
|
1762
|
+
}, [s, r]), I = u.useCallback((T, h) => {
|
|
1763
|
+
const y = o.groups[T];
|
|
1764
|
+
!y || !y.activeTabId || r.onStartContentDrag(T, y.activeTabId, h);
|
|
1765
|
+
}, [o.groups, r]), w = u.useMemo(
|
|
1766
|
+
() => ({ getGroup: d, getGroupContent: l, onClickTab: p, onAddTab: g, onCloseTab: v, onStartTabDrag: b, onStartContentDrag: I, doubleClickToAdd: n, registerContentContainer: a }),
|
|
1767
|
+
[d, l, p, g, v, b, I, n, a]
|
|
1766
1768
|
);
|
|
1767
|
-
return /* @__PURE__ */ m(
|
|
1768
|
-
},
|
|
1769
|
+
return /* @__PURE__ */ m(pe, { value: w, children: t });
|
|
1770
|
+
}, bn = ({
|
|
1769
1771
|
children: t,
|
|
1770
1772
|
emptyContentComponent: e,
|
|
1771
1773
|
doubleClickToAdd: n
|
|
1772
1774
|
}) => {
|
|
1773
|
-
const { state: r } = $(), o =
|
|
1775
|
+
const { state: r } = $(), o = u.useMemo(() => {
|
|
1774
1776
|
const s = {};
|
|
1775
1777
|
for (const [a, i] of Object.entries(r.groups))
|
|
1776
1778
|
for (const c of i.tabIds)
|
|
@@ -1780,7 +1782,7 @@ const pn = ({
|
|
|
1780
1782
|
};
|
|
1781
1783
|
return s;
|
|
1782
1784
|
}, [r.groups]);
|
|
1783
|
-
return /* @__PURE__ */ m(
|
|
1785
|
+
return /* @__PURE__ */ m(fn, { panels: r.panels, placements: o, children: /* @__PURE__ */ m(gn, { emptyContentComponent: e, doubleClickToAdd: n, children: t }) });
|
|
1784
1786
|
}, X = (t, e, n, r) => {
|
|
1785
1787
|
if (_(t))
|
|
1786
1788
|
return r;
|
|
@@ -1791,8 +1793,8 @@ const pn = ({
|
|
|
1791
1793
|
}
|
|
1792
1794
|
const a = n.h * t.ratio, i = n.h - a;
|
|
1793
1795
|
return X(t.a, [...e, "a"], { x: n.x, y: n.y, w: n.w, h: a }, r), X(t.b, [...e, "b"], { x: n.x, y: n.y + a, w: n.w, h: i }, r), r;
|
|
1794
|
-
},
|
|
1795
|
-
const { state: e } = $(), { adjustSplitRatio: n } =
|
|
1796
|
+
}, hn = ({ containerRef: t }) => {
|
|
1797
|
+
const { state: e } = $(), { adjustSplitRatio: n } = We(), r = u.useMemo(() => X(e.tree, [], { x: 0, y: 0, w: 100, h: 100 }, []), [e.tree]), [o, s] = u.useState(null);
|
|
1796
1798
|
if (nt(() => {
|
|
1797
1799
|
const i = t.current;
|
|
1798
1800
|
if (!i)
|
|
@@ -1810,7 +1812,7 @@ const pn = ({
|
|
|
1810
1812
|
return null;
|
|
1811
1813
|
}
|
|
1812
1814
|
}
|
|
1813
|
-
const
|
|
1815
|
+
const l = d(), p = l ? new l(() => c()) : null;
|
|
1814
1816
|
p && p.observe(i);
|
|
1815
1817
|
const g = () => c();
|
|
1816
1818
|
return window.addEventListener("scroll", g, !0), () => {
|
|
@@ -1824,43 +1826,43 @@ const pn = ({
|
|
|
1824
1826
|
top: o.top + o.height * i.parentRect.y / 100,
|
|
1825
1827
|
width: o.width * i.parentRect.w / 100,
|
|
1826
1828
|
height: o.height * i.parentRect.h / 100
|
|
1827
|
-
},
|
|
1829
|
+
}, l = te;
|
|
1828
1830
|
if (i.direction === "vertical") {
|
|
1829
|
-
const
|
|
1831
|
+
const b = d.left + d.width * (i.linePos - i.parentRect.x) / i.parentRect.w, I = {
|
|
1830
1832
|
position: "fixed",
|
|
1831
|
-
left: `calc(${Math.round(
|
|
1833
|
+
left: `calc(${Math.round(b)}px - ${l} / 2)`,
|
|
1832
1834
|
top: Math.round(d.top),
|
|
1833
|
-
width:
|
|
1835
|
+
width: l,
|
|
1834
1836
|
height: Math.round(d.height),
|
|
1835
1837
|
cursor: "col-resize",
|
|
1836
1838
|
pointerEvents: "auto"
|
|
1837
1839
|
};
|
|
1838
|
-
return /* @__PURE__ */ m("div", { style:
|
|
1839
|
-
const
|
|
1840
|
-
n({ path: i.path, deltaRatio:
|
|
1840
|
+
return /* @__PURE__ */ m("div", { style: I, children: /* @__PURE__ */ m(ot, { direction: "vertical", onResize: (T) => {
|
|
1841
|
+
const h = o.width * i.parentRect.w / 100, y = h === 0 ? 0 : T / h;
|
|
1842
|
+
n({ path: i.path, deltaRatio: y });
|
|
1841
1843
|
} }) }, `split-${c}`);
|
|
1842
1844
|
}
|
|
1843
1845
|
const p = d.top + d.height * (i.linePos - i.parentRect.y) / i.parentRect.h, g = {
|
|
1844
1846
|
position: "fixed",
|
|
1845
1847
|
left: Math.round(d.left),
|
|
1846
|
-
top: `calc(${Math.round(p)}px - ${
|
|
1848
|
+
top: `calc(${Math.round(p)}px - ${l} / 2)`,
|
|
1847
1849
|
width: Math.round(d.width),
|
|
1848
|
-
height:
|
|
1850
|
+
height: l,
|
|
1849
1851
|
cursor: "row-resize",
|
|
1850
1852
|
pointerEvents: "auto"
|
|
1851
1853
|
};
|
|
1852
|
-
return /* @__PURE__ */ m("div", { style: g, children: /* @__PURE__ */ m(ot, { direction: "horizontal", onResize: (
|
|
1853
|
-
const
|
|
1854
|
+
return /* @__PURE__ */ m("div", { style: g, children: /* @__PURE__ */ m(ot, { direction: "horizontal", onResize: (b) => {
|
|
1855
|
+
const I = o.height * i.parentRect.h / 100, w = I === 0 ? 0 : b / I;
|
|
1854
1856
|
n({ path: i.path, deltaRatio: w });
|
|
1855
1857
|
} }) }, `split-${c}`);
|
|
1856
1858
|
};
|
|
1857
1859
|
return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children: r.map((i, c) => a(i, c)) });
|
|
1858
|
-
},
|
|
1860
|
+
}, mn = {
|
|
1859
1861
|
position: "relative",
|
|
1860
1862
|
display: "flex",
|
|
1861
1863
|
width: "100%",
|
|
1862
1864
|
height: "100%"
|
|
1863
|
-
},
|
|
1865
|
+
}, vn = ({
|
|
1864
1866
|
state: t,
|
|
1865
1867
|
layoutMode: e,
|
|
1866
1868
|
gridTracksInteractive: n,
|
|
@@ -1868,14 +1870,14 @@ const pn = ({
|
|
|
1868
1870
|
tabBarComponent: o,
|
|
1869
1871
|
panelGroupComponent: s
|
|
1870
1872
|
}) => {
|
|
1871
|
-
const a = (c) => r ? /* @__PURE__ */ m(r, { groupId: c }) : /* @__PURE__ */ m(
|
|
1873
|
+
const a = (c) => r ? /* @__PURE__ */ m(r, { groupId: c }) : /* @__PURE__ */ m(Ee, { id: c, TabBarComponent: o, PanelGroupComponent: s });
|
|
1872
1874
|
if (e === "grid") {
|
|
1873
|
-
const c =
|
|
1875
|
+
const c = le(t, a, !!n);
|
|
1874
1876
|
return /* @__PURE__ */ m(st, { config: c.config, layers: c.layers });
|
|
1875
1877
|
}
|
|
1876
|
-
const i =
|
|
1878
|
+
const i = ue(t, a);
|
|
1877
1879
|
return /* @__PURE__ */ m(st, { config: i.config, layers: i.layers });
|
|
1878
|
-
},
|
|
1880
|
+
}, In = ({
|
|
1879
1881
|
containerRef: t,
|
|
1880
1882
|
layoutMode: e,
|
|
1881
1883
|
gridTracksInteractive: n,
|
|
@@ -1886,29 +1888,29 @@ const pn = ({
|
|
|
1886
1888
|
tabBarComponent: i,
|
|
1887
1889
|
panelGroupComponent: c,
|
|
1888
1890
|
splitLimits: d,
|
|
1889
|
-
emptyContentComponent:
|
|
1891
|
+
emptyContentComponent: l,
|
|
1890
1892
|
doubleClickToAdd: p
|
|
1891
1893
|
}) => {
|
|
1892
|
-
const { state: g } = $(), { onCommitContentDrop: v, onCommitTabDrop:
|
|
1893
|
-
({ targetGroupId: T, zone:
|
|
1894
|
-
if (
|
|
1894
|
+
const { state: g } = $(), { onCommitContentDrop: v, onCommitTabDrop: b } = cn(), I = u.useMemo(() => ({ ...mn, ...s }), [s]), w = u.useCallback(
|
|
1895
|
+
({ targetGroupId: T, zone: h }) => {
|
|
1896
|
+
if (h === "center")
|
|
1895
1897
|
return !0;
|
|
1896
|
-
const
|
|
1897
|
-
return rt(g.tree, T,
|
|
1898
|
+
const y = h === "left" || h === "right" ? "vertical" : "horizontal";
|
|
1899
|
+
return rt(g.tree, T, y, d);
|
|
1898
1900
|
},
|
|
1899
1901
|
[g.tree, d]
|
|
1900
1902
|
);
|
|
1901
|
-
return /* @__PURE__ */ m(
|
|
1902
|
-
|
|
1903
|
+
return /* @__PURE__ */ m(fe, { children: /* @__PURE__ */ H(
|
|
1904
|
+
Te,
|
|
1903
1905
|
{
|
|
1904
1906
|
containerRef: t,
|
|
1905
1907
|
dragThresholdPx: r,
|
|
1906
1908
|
onCommitContentDrop: v,
|
|
1907
|
-
onCommitTabDrop:
|
|
1909
|
+
onCommitTabDrop: b,
|
|
1908
1910
|
isContentZoneAllowed: w,
|
|
1909
1911
|
children: [
|
|
1910
|
-
/* @__PURE__ */ m(
|
|
1911
|
-
|
|
1912
|
+
/* @__PURE__ */ m(bn, { emptyContentComponent: l, doubleClickToAdd: p, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: I, children: /* @__PURE__ */ m(
|
|
1913
|
+
vn,
|
|
1912
1914
|
{
|
|
1913
1915
|
state: g,
|
|
1914
1916
|
layoutMode: e,
|
|
@@ -1918,18 +1920,18 @@ const pn = ({
|
|
|
1918
1920
|
panelGroupComponent: c
|
|
1919
1921
|
}
|
|
1920
1922
|
) }) }),
|
|
1921
|
-
/* @__PURE__ */ m(
|
|
1922
|
-
/* @__PURE__ */ m(
|
|
1923
|
+
/* @__PURE__ */ m(hn, { containerRef: t }),
|
|
1924
|
+
/* @__PURE__ */ m(wn, {})
|
|
1923
1925
|
]
|
|
1924
1926
|
}
|
|
1925
1927
|
) });
|
|
1926
|
-
},
|
|
1928
|
+
}, wn = () => {
|
|
1927
1929
|
const t = W();
|
|
1928
1930
|
return /* @__PURE__ */ H(et, { children: [
|
|
1929
|
-
/* @__PURE__ */ m(
|
|
1930
|
-
/* @__PURE__ */ m(
|
|
1931
|
+
/* @__PURE__ */ m(_e, { suggest: t.suggest }),
|
|
1932
|
+
/* @__PURE__ */ m(Ne, {})
|
|
1931
1933
|
] });
|
|
1932
|
-
},
|
|
1934
|
+
}, An = ({
|
|
1933
1935
|
initialState: t,
|
|
1934
1936
|
createGroupId: e,
|
|
1935
1937
|
createPanelId: n,
|
|
@@ -1940,12 +1942,12 @@ const pn = ({
|
|
|
1940
1942
|
emptyContentComponent: i,
|
|
1941
1943
|
state: c,
|
|
1942
1944
|
onStateChange: d,
|
|
1943
|
-
className:
|
|
1945
|
+
className: l,
|
|
1944
1946
|
style: p,
|
|
1945
1947
|
tabBarComponent: g,
|
|
1946
1948
|
panelGroupComponent: v,
|
|
1947
|
-
splitLimits:
|
|
1948
|
-
doubleClickToAdd:
|
|
1949
|
+
splitLimits: b,
|
|
1950
|
+
doubleClickToAdd: I
|
|
1949
1951
|
}) => {
|
|
1950
1952
|
if (!t)
|
|
1951
1953
|
throw new Error("PanelSystem requires initialState.");
|
|
@@ -1957,20 +1959,20 @@ const pn = ({
|
|
|
1957
1959
|
throw new Error("PanelSystem(layoutMode='grid') requires explicit 'gridTracksInteractive' flag.");
|
|
1958
1960
|
if (s === void 0)
|
|
1959
1961
|
throw new Error("PanelSystem requires explicit 'dragThresholdPx' value.");
|
|
1960
|
-
const w =
|
|
1962
|
+
const w = u.useRef(null), T = u.useMemo(() => Ct(b), [b]);
|
|
1961
1963
|
return /* @__PURE__ */ m(
|
|
1962
|
-
|
|
1964
|
+
sn,
|
|
1963
1965
|
{
|
|
1964
1966
|
initialState: t,
|
|
1965
1967
|
createGroupId: e,
|
|
1966
1968
|
createPanelId: n,
|
|
1967
1969
|
state: c,
|
|
1968
1970
|
onStateChange: d,
|
|
1969
|
-
splitLimits:
|
|
1970
|
-
children: /* @__PURE__ */ H(
|
|
1971
|
-
/* @__PURE__ */ m(
|
|
1971
|
+
splitLimits: b,
|
|
1972
|
+
children: /* @__PURE__ */ H(ie, { children: [
|
|
1973
|
+
/* @__PURE__ */ m(un, {}),
|
|
1972
1974
|
/* @__PURE__ */ m(
|
|
1973
|
-
|
|
1975
|
+
In,
|
|
1974
1976
|
{
|
|
1975
1977
|
containerRef: w,
|
|
1976
1978
|
layoutMode: r,
|
|
@@ -1978,12 +1980,12 @@ const pn = ({
|
|
|
1978
1980
|
dragThresholdPx: s,
|
|
1979
1981
|
view: a,
|
|
1980
1982
|
style: p,
|
|
1981
|
-
className:
|
|
1983
|
+
className: l,
|
|
1982
1984
|
tabBarComponent: g,
|
|
1983
1985
|
panelGroupComponent: v,
|
|
1984
1986
|
splitLimits: T,
|
|
1985
1987
|
emptyContentComponent: i,
|
|
1986
|
-
doubleClickToAdd:
|
|
1988
|
+
doubleClickToAdd: I
|
|
1987
1989
|
}
|
|
1988
1990
|
)
|
|
1989
1991
|
] })
|
|
@@ -1991,18 +1993,18 @@ const pn = ({
|
|
|
1991
1993
|
);
|
|
1992
1994
|
};
|
|
1993
1995
|
export {
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1996
|
+
zn as CSS_VAR_PREFIX,
|
|
1997
|
+
_n as Drawer,
|
|
1998
|
+
On as DrawerLayers,
|
|
1999
|
+
Bn as FloatingWindow,
|
|
1998
2000
|
st as GridLayout,
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
+
En as HorizontalDivider,
|
|
2002
|
+
An as PanelSystem,
|
|
2001
2003
|
ot as ResizeHandle,
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2004
|
+
Dn as buildInitialState,
|
|
2005
|
+
Ln as runTransition,
|
|
2006
|
+
Pn as useFloatingState,
|
|
2007
|
+
Rn as useLayerDragHandle,
|
|
2008
|
+
Hn as useTransitionState
|
|
2007
2009
|
};
|
|
2008
2010
|
//# sourceMappingURL=index.js.map
|