react-panel-layout 0.4.2 → 0.5.1
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-6W5OexYe.js +98 -0
- package/dist/FloatingPanelFrame-6W5OexYe.js.map +1 -0
- package/dist/FloatingPanelFrame-D9Cp2al1.cjs +2 -0
- package/dist/FloatingPanelFrame-D9Cp2al1.cjs.map +1 -0
- package/dist/GridLayout-BzrIDrC9.js +1465 -0
- package/dist/GridLayout-BzrIDrC9.js.map +1 -0
- package/dist/GridLayout-ZrOhoLLB.cjs +2 -0
- package/dist/GridLayout-ZrOhoLLB.cjs.map +1 -0
- package/dist/PanelSystemContext.d.ts +9 -0
- package/dist/components/grid/GridLayerList.d.ts +3 -0
- package/dist/components/grid/GridLayout.d.ts +5 -0
- package/dist/components/paneling/FloatingPanelFrame.d.ts +4 -0
- package/dist/components/window/FloatingWindow.d.ts +15 -0
- package/dist/config/panelRouter.d.ts +2 -2
- package/dist/config.cjs +1 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +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.d.ts +4 -1
- package/dist/index.js +950 -878
- package/dist/index.js.map +1 -1
- package/dist/modules/grid/GridLayoutContext.d.ts +5 -0
- package/dist/modules/grid/resizeHandles.d.ts +14 -0
- package/dist/modules/grid/trackUtils.d.ts +29 -0
- package/dist/modules/grid/useGridTracks.d.ts +6 -15
- package/dist/modules/grid/useLayerInteractions.d.ts +2 -1
- package/dist/modules/window/useFloatingState.d.ts +9 -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 +79 -4
- 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-BS-DGfwd.cjs +2 -0
- package/dist/usePivot-BS-DGfwd.cjs.map +1 -0
- package/dist/usePivot-BvOGxLQQ.js +124 -0
- package/dist/usePivot-BvOGxLQQ.js.map +1 -0
- package/dist/utils/css.d.ts +19 -0
- package/package.json +6 -1
- package/dist/FloatingPanelFrame-SOrLGjZd.js +0 -67
- package/dist/FloatingPanelFrame-SOrLGjZd.js.map +0 -1
- package/dist/FloatingPanelFrame-XtBcHANI.cjs +0 -2
- package/dist/FloatingPanelFrame-XtBcHANI.cjs.map +0 -1
- package/dist/GridLayout-CLvW8jID.js +0 -1352
- package/dist/GridLayout-CLvW8jID.js.map +0 -1
- package/dist/GridLayout-qufTyOQM.cjs +0 -2
- package/dist/GridLayout-qufTyOQM.cjs.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
|
|
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-BzrIDrC9.js";
|
|
2
|
+
import { D as _n, f as On, F as Bn, r as Ln, g as Hn } from "./GridLayout-BzrIDrC9.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 {
|
|
8
|
-
import { createPortal as
|
|
9
|
-
|
|
10
|
-
|
|
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
|
+
import { createPortal as ee } from "react-dom";
|
|
9
|
+
import { a as ne } from "./usePivot-BvOGxLQQ.js";
|
|
10
|
+
const re = (t) => ({
|
|
11
|
+
width: zt,
|
|
11
12
|
cursor: "col-resize",
|
|
12
13
|
position: "relative",
|
|
13
14
|
userSelect: "none",
|
|
14
|
-
backgroundColor: t === "drag" ?
|
|
15
|
-
}),
|
|
16
|
-
const { ref:
|
|
15
|
+
backgroundColor: t === "drag" ? Lt : t === "hover" ? Ht : Nt
|
|
16
|
+
}), En = ({ onResize: t, component: e, element: n }) => {
|
|
17
|
+
const { ref: r, isDragging: o, onPointerDown: s } = kt({
|
|
17
18
|
axis: "x",
|
|
18
19
|
onResize: t
|
|
19
|
-
}), [a, i] =
|
|
20
|
-
ref:
|
|
21
|
-
style:
|
|
20
|
+
}), [a, i] = u.useState(!1), c = {
|
|
21
|
+
ref: r,
|
|
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,78 +27,146 @@ const te = (t) => ({
|
|
|
26
27
|
onPointerEnter: () => i(!0),
|
|
27
28
|
onPointerLeave: () => i(!1)
|
|
28
29
|
};
|
|
29
|
-
return
|
|
30
|
-
},
|
|
31
|
-
const { layerId: t } =
|
|
32
|
-
return
|
|
33
|
-
},
|
|
34
|
-
const
|
|
30
|
+
return n ? u.cloneElement(n, c) : e ? /* @__PURE__ */ m(e, { ...c }) : /* @__PURE__ */ m("div", { ...c });
|
|
31
|
+
}, Rn = () => {
|
|
32
|
+
const { layerId: t } = Mt(), { getLayerHandleProps: e } = _t();
|
|
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 = {};
|
|
37
|
+
return t.forEach((p) => {
|
|
38
|
+
if (p.floating) {
|
|
39
|
+
const g = p.floating;
|
|
40
|
+
l[p.id] = {
|
|
41
|
+
position: g.defaultPosition ?? it,
|
|
42
|
+
size: g.defaultSize ?? at
|
|
43
|
+
};
|
|
44
|
+
}
|
|
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;
|
|
53
|
+
},
|
|
54
|
+
[r, 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;
|
|
59
|
+
},
|
|
60
|
+
[r, e]
|
|
61
|
+
), a = u.useCallback(
|
|
62
|
+
(l) => r.get(l)?.floating?.zIndex,
|
|
63
|
+
[r]
|
|
64
|
+
), i = u.useCallback(
|
|
65
|
+
(l, p) => {
|
|
66
|
+
const g = r.get(l);
|
|
67
|
+
g?.floating && (g.floating.position === void 0 && n((v) => {
|
|
68
|
+
const b = v[l];
|
|
69
|
+
return b ? {
|
|
70
|
+
...v,
|
|
71
|
+
[l]: { ...b, position: p }
|
|
72
|
+
} : v;
|
|
73
|
+
}), g.floating.onMove?.(p));
|
|
74
|
+
},
|
|
75
|
+
[r]
|
|
76
|
+
), c = u.useCallback(
|
|
77
|
+
(l, p) => {
|
|
78
|
+
const g = r.get(l);
|
|
79
|
+
g?.floating && (g.floating.size === void 0 && n((v) => {
|
|
80
|
+
const b = v[l];
|
|
81
|
+
return b ? {
|
|
82
|
+
...v,
|
|
83
|
+
[l]: { ...b, size: p }
|
|
84
|
+
} : v;
|
|
85
|
+
}), g.floating.onResize?.(p));
|
|
86
|
+
},
|
|
87
|
+
[r]
|
|
88
|
+
), d = u.useCallback(
|
|
89
|
+
(l) => {
|
|
90
|
+
r.get(l)?.floating?.onClose?.();
|
|
91
|
+
},
|
|
92
|
+
[r]
|
|
93
|
+
);
|
|
94
|
+
return {
|
|
95
|
+
getPosition: o,
|
|
96
|
+
getSize: s,
|
|
97
|
+
getZIndex: a,
|
|
98
|
+
updatePosition: i,
|
|
99
|
+
updateSize: c,
|
|
100
|
+
close: d
|
|
101
|
+
};
|
|
102
|
+
}, ft = u.createContext(null), oe = () => {
|
|
103
|
+
const t = u.useContext(ft);
|
|
35
104
|
if (!t)
|
|
36
105
|
throw new Error("useKeybindings must be used within KeybindingsProvider");
|
|
37
106
|
return t;
|
|
38
|
-
},
|
|
107
|
+
}, se = (t) => {
|
|
39
108
|
const e = [];
|
|
40
109
|
t.metaKey && e.push("Mod"), t.ctrlKey && e.push("Ctrl"), t.altKey && e.push("Alt"), t.shiftKey && e.push("Shift");
|
|
41
|
-
const
|
|
42
|
-
return e.push(
|
|
43
|
-
},
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
}, []), o =
|
|
47
|
-
const i = { ...
|
|
48
|
-
delete i[a],
|
|
110
|
+
const n = t.key.length === 1 ? t.key.toUpperCase() : t.key;
|
|
111
|
+
return e.push(n), e.join("-");
|
|
112
|
+
}, ie = ({ children: t, configure: e }) => {
|
|
113
|
+
const n = u.useRef({}), r = u.useCallback((a, i) => {
|
|
114
|
+
n.current = { ...n.current, [a]: i };
|
|
115
|
+
}, []), o = u.useCallback((a) => {
|
|
116
|
+
const i = { ...n.current };
|
|
117
|
+
delete i[a], n.current = i;
|
|
49
118
|
}, []);
|
|
50
|
-
|
|
119
|
+
u.useEffect(() => {
|
|
51
120
|
const a = (i) => {
|
|
52
|
-
const c =
|
|
53
|
-
|
|
121
|
+
const c = se(i), d = n.current[c];
|
|
122
|
+
d && d(i);
|
|
54
123
|
};
|
|
55
124
|
return window.addEventListener("keydown", a), () => {
|
|
56
125
|
window.removeEventListener("keydown", a);
|
|
57
126
|
};
|
|
58
127
|
}, []);
|
|
59
|
-
const s =
|
|
60
|
-
return
|
|
128
|
+
const s = u.useMemo(() => ({ register: r, unregister: o }), [r, o]);
|
|
129
|
+
return u.useEffect(() => {
|
|
61
130
|
e && e(s);
|
|
62
|
-
}, [s, e]), /* @__PURE__ */ m(
|
|
63
|
-
},
|
|
64
|
-
t.register("Mod-\\", (
|
|
65
|
-
|
|
66
|
-
}), t.register("Mod-Shift-\\", (
|
|
67
|
-
|
|
131
|
+
}, [s, e]), /* @__PURE__ */ m(ft.Provider, { value: s, children: t });
|
|
132
|
+
}, ae = (t, e) => {
|
|
133
|
+
t.register("Mod-\\", (n) => {
|
|
134
|
+
n.preventDefault(), e.splitFocused("vertical");
|
|
135
|
+
}), t.register("Mod-Shift-\\", (n) => {
|
|
136
|
+
n.preventDefault(), e.splitFocused("horizontal");
|
|
68
137
|
});
|
|
69
|
-
for (const
|
|
70
|
-
t.register(`Mod-${String(
|
|
71
|
-
|
|
138
|
+
for (const n of [1, 2, 3, 4, 5, 6, 7, 8, 9])
|
|
139
|
+
t.register(`Mod-${String(n)}`, (r) => {
|
|
140
|
+
r.preventDefault(), e.focusGroupIndex(n);
|
|
72
141
|
});
|
|
73
|
-
t.register("Alt-ArrowRight", (
|
|
74
|
-
|
|
75
|
-
}), t.register("Alt-ArrowLeft", (
|
|
76
|
-
|
|
142
|
+
t.register("Alt-ArrowRight", (n) => {
|
|
143
|
+
n.preventDefault(), e.focusNextGroup();
|
|
144
|
+
}), t.register("Alt-ArrowLeft", (n) => {
|
|
145
|
+
n.preventDefault(), e.focusPrevGroup();
|
|
77
146
|
});
|
|
78
|
-
},
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
|
|
147
|
+
}, ce = (t) => t.type === "group", gt = (t, e = { x: 0, y: 0, w: 100, h: 100 }) => {
|
|
148
|
+
const n = /* @__PURE__ */ new Map(), r = (o, s) => {
|
|
149
|
+
if (ce(o)) {
|
|
150
|
+
n.set(o.groupId, s);
|
|
82
151
|
return;
|
|
83
152
|
}
|
|
84
153
|
if (o.direction === "vertical") {
|
|
85
|
-
const c = s.w * o.ratio,
|
|
86
|
-
|
|
154
|
+
const c = s.w * o.ratio, d = s.w - c;
|
|
155
|
+
r(o.a, { x: s.x, y: s.y, w: c, h: s.h }), r(o.b, { x: s.x + c, y: s.y, w: d, h: s.h });
|
|
87
156
|
return;
|
|
88
157
|
}
|
|
89
158
|
const a = s.h * o.ratio, i = s.h - a;
|
|
90
|
-
|
|
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 });
|
|
91
160
|
};
|
|
92
|
-
return
|
|
93
|
-
},
|
|
94
|
-
const
|
|
161
|
+
return r(t, e), n;
|
|
162
|
+
}, ue = (t, e) => {
|
|
163
|
+
const n = gt(t.tree), r = {
|
|
95
164
|
areas: [["root"]],
|
|
96
165
|
rows: [{ size: "1fr" }],
|
|
97
166
|
columns: [{ size: "1fr" }],
|
|
98
167
|
gap: "0px",
|
|
99
168
|
style: { position: "relative" }
|
|
100
|
-
}, o = Array.from(
|
|
169
|
+
}, o = Array.from(n.entries()).map(([s, a]) => {
|
|
101
170
|
const i = {
|
|
102
171
|
position: "absolute",
|
|
103
172
|
left: `${a.x}%`,
|
|
@@ -115,167 +184,167 @@ const te = (t) => ({
|
|
|
115
184
|
component: e(s)
|
|
116
185
|
};
|
|
117
186
|
});
|
|
118
|
-
return { config:
|
|
119
|
-
},
|
|
120
|
-
const
|
|
121
|
-
for (const [
|
|
122
|
-
if (
|
|
123
|
-
return
|
|
187
|
+
return { config: r, layers: o };
|
|
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;
|
|
124
193
|
return ".";
|
|
125
|
-
},
|
|
126
|
-
for (let
|
|
127
|
-
const
|
|
128
|
-
for (let
|
|
129
|
-
|
|
130
|
-
|
|
194
|
+
}, p = [];
|
|
195
|
+
for (let b = 0; b < s.length - 1; b += 1) {
|
|
196
|
+
const I = [];
|
|
197
|
+
for (let w = 0; w < o.length - 1; w += 1)
|
|
198
|
+
I.push(l(o[w], o[w + 1], s[b], s[b + 1]));
|
|
199
|
+
p.push(I);
|
|
131
200
|
}
|
|
132
201
|
const g = {
|
|
133
|
-
areas:
|
|
134
|
-
rows:
|
|
202
|
+
areas: p,
|
|
203
|
+
rows: d,
|
|
135
204
|
columns: c,
|
|
136
205
|
gap: "0px"
|
|
137
|
-
},
|
|
138
|
-
id:
|
|
139
|
-
gridArea:
|
|
140
|
-
component: e(
|
|
206
|
+
}, v = Array.from(r.keys()).map((b) => ({
|
|
207
|
+
id: b,
|
|
208
|
+
gridArea: b,
|
|
209
|
+
component: e(b)
|
|
141
210
|
}));
|
|
142
|
-
return { config: g, layers:
|
|
143
|
-
},
|
|
144
|
-
const t =
|
|
211
|
+
return { config: g, layers: v };
|
|
212
|
+
}, bt = u.createContext(null), de = () => {
|
|
213
|
+
const t = u.useContext(bt);
|
|
145
214
|
if (!t)
|
|
146
215
|
throw new Error("usePanelRenderContext must be used within PanelRenderProvider");
|
|
147
216
|
return t;
|
|
148
|
-
},
|
|
149
|
-
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);
|
|
150
219
|
if (!t)
|
|
151
220
|
throw new Error("useDomRegistry must be used within DomRegistryProvider");
|
|
152
221
|
return t;
|
|
153
|
-
},
|
|
154
|
-
const e =
|
|
155
|
-
const
|
|
156
|
-
if (
|
|
157
|
-
return
|
|
158
|
-
const
|
|
159
|
-
return e.current.set(c,
|
|
160
|
-
}, []),
|
|
161
|
-
(c,
|
|
162
|
-
const
|
|
163
|
-
if (
|
|
164
|
-
const
|
|
165
|
-
(
|
|
222
|
+
}, fe = ({ children: t }) => {
|
|
223
|
+
const e = u.useRef(/* @__PURE__ */ new Map()), n = u.useCallback((c) => {
|
|
224
|
+
const d = e.current.get(c);
|
|
225
|
+
if (d)
|
|
226
|
+
return d;
|
|
227
|
+
const l = { group: null, tabbar: null, content: null };
|
|
228
|
+
return e.current.set(c, l), l;
|
|
229
|
+
}, []), r = u.useCallback(
|
|
230
|
+
(c, d) => {
|
|
231
|
+
const l = n(c);
|
|
232
|
+
if (l.group = d, d === null) {
|
|
233
|
+
const p = e.current.get(c);
|
|
234
|
+
(p ? p.tabbar === null && p.content === null : !1) && e.current.delete(c);
|
|
166
235
|
}
|
|
167
236
|
},
|
|
168
|
-
[
|
|
169
|
-
), o =
|
|
170
|
-
(c,
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
const
|
|
174
|
-
(
|
|
237
|
+
[n]
|
|
238
|
+
), o = u.useCallback(
|
|
239
|
+
(c, d) => {
|
|
240
|
+
const l = n(c);
|
|
241
|
+
if (l.tabbar = d, d === null) {
|
|
242
|
+
const p = e.current.get(c);
|
|
243
|
+
(p ? p.group === null && p.content === null : !1) && e.current.delete(c);
|
|
175
244
|
}
|
|
176
245
|
},
|
|
177
|
-
[
|
|
178
|
-
), s =
|
|
179
|
-
(c,
|
|
180
|
-
const
|
|
181
|
-
if (
|
|
182
|
-
const
|
|
183
|
-
(
|
|
246
|
+
[n]
|
|
247
|
+
), s = u.useCallback(
|
|
248
|
+
(c, d) => {
|
|
249
|
+
const l = n(c);
|
|
250
|
+
if (l.content = d, d === null) {
|
|
251
|
+
const p = e.current.get(c);
|
|
252
|
+
(p ? p.group === null && p.tabbar === null : !1) && e.current.delete(c);
|
|
184
253
|
}
|
|
185
254
|
},
|
|
186
|
-
[
|
|
187
|
-
), a =
|
|
188
|
-
return /* @__PURE__ */ m(
|
|
189
|
-
},
|
|
255
|
+
[n]
|
|
256
|
+
), a = u.useCallback(() => e.current, []), i = u.useMemo(() => ({ setGroupEl: r, setTabbarEl: o, setContentEl: s, getAll: a }), [r, o, s, a]);
|
|
257
|
+
return /* @__PURE__ */ m(ht.Provider, { value: i, children: t });
|
|
258
|
+
}, ge = {
|
|
190
259
|
display: "flex",
|
|
191
260
|
flexDirection: "column",
|
|
192
261
|
width: "100%",
|
|
193
262
|
height: "100%"
|
|
194
|
-
},
|
|
263
|
+
}, be = {
|
|
195
264
|
flex: "1 1 auto",
|
|
196
265
|
minWidth: 0,
|
|
197
266
|
minHeight: 0,
|
|
198
267
|
position: "relative",
|
|
199
268
|
overflow: "hidden"
|
|
200
269
|
};
|
|
201
|
-
function
|
|
202
|
-
return t ?
|
|
270
|
+
function he(t, e, n, r) {
|
|
271
|
+
return t ? u.cloneElement(t, n, r) : e ? /* @__PURE__ */ m(e, { ...n, children: r }) : /* @__PURE__ */ m("div", { ...n, children: r });
|
|
203
272
|
}
|
|
204
|
-
function
|
|
205
|
-
return t ?
|
|
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 });
|
|
206
275
|
}
|
|
207
|
-
const
|
|
276
|
+
const ve = ({
|
|
208
277
|
group: t,
|
|
209
278
|
tabbar: e,
|
|
210
|
-
content:
|
|
211
|
-
onContentPointerDown:
|
|
279
|
+
content: n,
|
|
280
|
+
onContentPointerDown: r,
|
|
212
281
|
groupRef: o,
|
|
213
282
|
contentRef: s,
|
|
214
283
|
component: a,
|
|
215
284
|
element: i,
|
|
216
285
|
contentComponent: c,
|
|
217
|
-
contentElement:
|
|
286
|
+
contentElement: d
|
|
218
287
|
}) => {
|
|
219
|
-
const
|
|
288
|
+
const l = {
|
|
220
289
|
ref: o,
|
|
221
|
-
style:
|
|
290
|
+
style: ge,
|
|
222
291
|
"data-group-id": t.id
|
|
223
|
-
}, g =
|
|
292
|
+
}, g = he(d, c, {
|
|
224
293
|
ref: s,
|
|
225
|
-
style:
|
|
294
|
+
style: be,
|
|
226
295
|
"data-dnd-zone": "content",
|
|
227
|
-
onPointerDown:
|
|
228
|
-
},
|
|
229
|
-
return
|
|
296
|
+
onPointerDown: r
|
|
297
|
+
}, n);
|
|
298
|
+
return me(i, a, l, /* @__PURE__ */ H(et, { children: [
|
|
230
299
|
e,
|
|
231
300
|
g
|
|
232
301
|
] }));
|
|
233
|
-
},
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
const
|
|
237
|
-
return i >
|
|
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);
|
|
303
|
+
vt.displayName = "PanelGroupView";
|
|
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";
|
|
238
307
|
};
|
|
239
308
|
function A(t, e) {
|
|
240
309
|
if (!e) {
|
|
241
|
-
const
|
|
242
|
-
return Object.defineProperty(
|
|
310
|
+
const r = (() => ({ type: t }));
|
|
311
|
+
return Object.defineProperty(r, "type", {
|
|
243
312
|
value: t,
|
|
244
313
|
writable: !1,
|
|
245
314
|
enumerable: !0
|
|
246
|
-
}),
|
|
315
|
+
}), r;
|
|
247
316
|
}
|
|
248
|
-
const
|
|
249
|
-
const o = e(...
|
|
317
|
+
const n = ((...r) => {
|
|
318
|
+
const o = e(...r);
|
|
250
319
|
return typeof o > "u" ? { type: t } : { type: t, payload: o };
|
|
251
320
|
});
|
|
252
|
-
return Object.defineProperty(
|
|
321
|
+
return Object.defineProperty(n, "type", {
|
|
253
322
|
value: t,
|
|
254
323
|
writable: !1,
|
|
255
324
|
enumerable: !0
|
|
256
|
-
}),
|
|
325
|
+
}), n;
|
|
257
326
|
}
|
|
258
|
-
const
|
|
259
|
-
const
|
|
260
|
-
return Object.keys(t).forEach((
|
|
261
|
-
const o = t[
|
|
262
|
-
r
|
|
327
|
+
const Ie = (t, e) => {
|
|
328
|
+
const n = {};
|
|
329
|
+
return Object.keys(t).forEach((r) => {
|
|
330
|
+
const o = t[r];
|
|
331
|
+
n[r] = ((...s) => {
|
|
263
332
|
const a = o(...s);
|
|
264
333
|
return e(a), a;
|
|
265
334
|
});
|
|
266
|
-
}),
|
|
267
|
-
},
|
|
268
|
-
const
|
|
269
|
-
return Object.keys(e).forEach((
|
|
270
|
-
const o = e[
|
|
335
|
+
}), n;
|
|
336
|
+
}, It = (t, e) => {
|
|
337
|
+
const n = {};
|
|
338
|
+
return Object.keys(e).forEach((r) => {
|
|
339
|
+
const o = e[r];
|
|
271
340
|
if (!o)
|
|
272
341
|
return;
|
|
273
|
-
const s = t[
|
|
342
|
+
const s = t[r];
|
|
274
343
|
if (!s)
|
|
275
|
-
throw new Error(`Missing action creator for key "${String(
|
|
276
|
-
|
|
277
|
-
}),
|
|
278
|
-
},
|
|
344
|
+
throw new Error(`Missing action creator for key "${String(r)}"`);
|
|
345
|
+
n[s.type] = o;
|
|
346
|
+
}), n;
|
|
347
|
+
}, wt = { phase: { kind: "idle" }, suggest: null, pointer: null, tabbarHover: null, draggingTabElement: null }, D = {
|
|
279
348
|
startContent: A(
|
|
280
349
|
"START_CONTENT",
|
|
281
350
|
(t) => t
|
|
@@ -291,7 +360,7 @@ const he = (t, e) => {
|
|
|
291
360
|
(t) => t
|
|
292
361
|
),
|
|
293
362
|
reset: A("RESET")
|
|
294
|
-
},
|
|
363
|
+
}, we = It(D, {
|
|
295
364
|
startContent: (t, e) => ({
|
|
296
365
|
phase: {
|
|
297
366
|
kind: "content",
|
|
@@ -323,322 +392,322 @@ const he = (t, e) => {
|
|
|
323
392
|
setSuggest: (t, e) => ({ ...t, suggest: e.payload }),
|
|
324
393
|
setPointer: (t, e) => ({ ...t, pointer: e.payload }),
|
|
325
394
|
setTabbarHover: (t, e) => ({ ...t, tabbarHover: e.payload }),
|
|
326
|
-
reset: () =>
|
|
327
|
-
}),
|
|
328
|
-
const
|
|
329
|
-
return
|
|
330
|
-
},
|
|
331
|
-
const t =
|
|
395
|
+
reset: () => wt
|
|
396
|
+
}), ye = (t, e) => {
|
|
397
|
+
const n = we[e.type];
|
|
398
|
+
return n ? n(t, e, void 0) : t;
|
|
399
|
+
}, yt = u.createContext(null), W = () => {
|
|
400
|
+
const t = u.useContext(yt);
|
|
332
401
|
if (!t)
|
|
333
402
|
throw new Error("usePanelInteractions must be used within InteractionsProvider");
|
|
334
403
|
return t;
|
|
335
|
-
},
|
|
404
|
+
}, Te = ({
|
|
336
405
|
containerRef: t,
|
|
337
406
|
dragThresholdPx: e,
|
|
338
|
-
onCommitContentDrop:
|
|
339
|
-
onCommitTabDrop:
|
|
407
|
+
onCommitContentDrop: n,
|
|
408
|
+
onCommitTabDrop: r,
|
|
340
409
|
isContentZoneAllowed: o,
|
|
341
410
|
children: s
|
|
342
411
|
}) => {
|
|
343
|
-
const [a, i] =
|
|
344
|
-
const
|
|
345
|
-
return { groups: T, tabbars:
|
|
346
|
-
}, [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) => {
|
|
347
416
|
if (!t.current)
|
|
348
417
|
return;
|
|
349
|
-
const
|
|
350
|
-
if (
|
|
418
|
+
const h = w.clientX, y = w.clientY, f = a.phase;
|
|
419
|
+
if (f.kind === "idle")
|
|
351
420
|
return;
|
|
352
|
-
const
|
|
353
|
-
if (
|
|
421
|
+
const S = Math.abs(h - f.startX), C = Math.abs(y - f.startY);
|
|
422
|
+
if (S < e && C < e) {
|
|
354
423
|
a.phase.kind === "content" && i(D.setSuggest(null)), i(D.setPointer(null)), i(D.setTabbarHover(null));
|
|
355
424
|
return;
|
|
356
425
|
}
|
|
357
|
-
if (i(D.setPointer({ x:
|
|
358
|
-
const
|
|
359
|
-
if (!
|
|
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);
|
|
428
|
+
if (!G) {
|
|
360
429
|
i(D.setSuggest(null));
|
|
361
430
|
return;
|
|
362
431
|
}
|
|
363
|
-
const R =
|
|
364
|
-
if (o && !o({ targetGroupId:
|
|
432
|
+
const R = U(G.rect, h, y);
|
|
433
|
+
if (o && !o({ targetGroupId: G.gid, zone: R })) {
|
|
365
434
|
i(D.setSuggest(null));
|
|
366
435
|
return;
|
|
367
436
|
}
|
|
368
|
-
i(D.setSuggest({ rect:
|
|
437
|
+
i(D.setSuggest({ rect: G.rect, zone: R }));
|
|
369
438
|
return;
|
|
370
439
|
}
|
|
371
|
-
if (
|
|
372
|
-
const
|
|
373
|
-
if (
|
|
374
|
-
const k = Array.from(
|
|
375
|
-
i(D.setTabbarHover({ groupId:
|
|
440
|
+
if (f.kind === "tab") {
|
|
441
|
+
const G = f.cache.tabbars.find(({ rect: E }) => h >= E.left && h <= E.right && y >= E.top && y <= E.bottom);
|
|
442
|
+
if (G) {
|
|
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;
|
|
444
|
+
i(D.setTabbarHover({ groupId: G.gid, index: B, rect: G.rect, insertX: At }));
|
|
376
445
|
} else
|
|
377
446
|
i(D.setTabbarHover(null));
|
|
378
|
-
const R =
|
|
447
|
+
const R = f.cache.contents.find(({ rect: E }) => h >= E.left && h <= E.right && y >= E.top && y <= E.bottom);
|
|
379
448
|
if (!R) {
|
|
380
449
|
i(D.setSuggest(null));
|
|
381
450
|
return;
|
|
382
451
|
}
|
|
383
|
-
const
|
|
384
|
-
if (o && !o({ targetGroupId: R.gid, zone:
|
|
452
|
+
const x = U(R.rect, h, y);
|
|
453
|
+
if (o && !o({ targetGroupId: R.gid, zone: x })) {
|
|
385
454
|
i(D.setSuggest(null));
|
|
386
455
|
return;
|
|
387
456
|
}
|
|
388
|
-
i(D.setSuggest({ rect: R.rect, zone:
|
|
457
|
+
i(D.setSuggest({ rect: R.rect, zone: x }));
|
|
389
458
|
}
|
|
390
|
-
}),
|
|
391
|
-
const T = t.current,
|
|
459
|
+
}), p = J((w) => {
|
|
460
|
+
const T = t.current, h = a;
|
|
392
461
|
if (i(D.reset()), !T)
|
|
393
462
|
return;
|
|
394
|
-
const
|
|
395
|
-
if (
|
|
463
|
+
const y = w.clientX, f = w.clientY;
|
|
464
|
+
if (h.phase.kind === "idle")
|
|
396
465
|
return;
|
|
397
|
-
const
|
|
398
|
-
if (!(
|
|
399
|
-
if (
|
|
400
|
-
const
|
|
401
|
-
if (!
|
|
466
|
+
const S = Math.abs(y - h.phase.startX), C = Math.abs(f - h.phase.startY);
|
|
467
|
+
if (!(S < e && C < e)) {
|
|
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);
|
|
470
|
+
if (!G)
|
|
402
471
|
return;
|
|
403
|
-
const R =
|
|
472
|
+
const R = G.gid ?? null;
|
|
404
473
|
if (!R)
|
|
405
474
|
return;
|
|
406
|
-
const
|
|
407
|
-
if (o && !o({ targetGroupId: R, zone:
|
|
475
|
+
const x = U(G.rect, y, f);
|
|
476
|
+
if (o && !o({ targetGroupId: R, zone: x }))
|
|
408
477
|
return;
|
|
409
|
-
|
|
478
|
+
n({ fromGroupId: h.phase.fromGroupId, tabId: h.phase.tabId, targetGroupId: R, zone: x });
|
|
410
479
|
return;
|
|
411
480
|
}
|
|
412
|
-
if (
|
|
413
|
-
const
|
|
414
|
-
if (
|
|
415
|
-
const
|
|
416
|
-
if (!
|
|
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);
|
|
483
|
+
if (G) {
|
|
484
|
+
const x = G.gid;
|
|
485
|
+
if (!x)
|
|
417
486
|
return;
|
|
418
|
-
const k = Array.from(
|
|
487
|
+
const k = Array.from(G.el.querySelectorAll("[role='tab']")).map((B) => {
|
|
419
488
|
const Z = B.getBoundingClientRect();
|
|
420
489
|
return Z.left + Z.width / 2;
|
|
421
|
-
}), P = k.findIndex((B) =>
|
|
422
|
-
|
|
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 });
|
|
423
492
|
return;
|
|
424
493
|
}
|
|
425
|
-
const R =
|
|
494
|
+
const R = h.phase.cache.contents.find(({ rect: x }) => y >= x.left && y <= x.right && f >= x.top && f <= x.bottom);
|
|
426
495
|
if (R) {
|
|
427
|
-
const
|
|
428
|
-
if (!
|
|
496
|
+
const x = R.gid ?? null;
|
|
497
|
+
if (!x)
|
|
429
498
|
return;
|
|
430
|
-
const
|
|
431
|
-
if (o && !o({ targetGroupId:
|
|
499
|
+
const E = U(R.rect, y, f);
|
|
500
|
+
if (o && !o({ targetGroupId: x, zone: E }))
|
|
432
501
|
return;
|
|
433
|
-
|
|
502
|
+
n({ fromGroupId: h.phase.fromGroupId, tabId: h.phase.tabId, targetGroupId: x, zone: E });
|
|
434
503
|
}
|
|
435
504
|
}
|
|
436
505
|
}
|
|
437
506
|
}), g = J(() => {
|
|
438
507
|
i(D.reset());
|
|
439
508
|
});
|
|
440
|
-
|
|
509
|
+
u.useEffect(() => {
|
|
441
510
|
if (a.phase.kind !== "idle")
|
|
442
|
-
return window.addEventListener("pointermove",
|
|
443
|
-
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);
|
|
444
513
|
};
|
|
445
514
|
}, [a.phase.kind]);
|
|
446
|
-
const
|
|
447
|
-
if (
|
|
515
|
+
const v = u.useCallback((w, T, h) => {
|
|
516
|
+
if (h.button !== 0)
|
|
448
517
|
return;
|
|
449
|
-
|
|
450
|
-
const
|
|
451
|
-
i(D.startContent({ x:
|
|
452
|
-
}, [
|
|
453
|
-
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)
|
|
454
523
|
return;
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
const
|
|
458
|
-
i(D.startTab({ x:
|
|
459
|
-
}, [
|
|
524
|
+
const y = h.currentTarget;
|
|
525
|
+
y && y.setPointerCapture(h.pointerId);
|
|
526
|
+
const f = d();
|
|
527
|
+
i(D.startTab({ x: h.clientX, y: h.clientY, groupId: T, tabId: w, cache: f, element: y }));
|
|
528
|
+
}, [d]), I = u.useMemo(() => ({
|
|
460
529
|
suggest: a.suggest,
|
|
461
530
|
isTabDragging: a.phase.kind === "tab",
|
|
462
531
|
draggingTabId: a.phase.kind === "tab" ? a.phase.tabId : null,
|
|
463
532
|
dragPointer: a.pointer,
|
|
464
533
|
tabbarHover: a.tabbarHover,
|
|
465
534
|
draggingTabElement: a.draggingTabElement,
|
|
466
|
-
onStartContentDrag:
|
|
467
|
-
onStartTabDrag:
|
|
468
|
-
}), [a.suggest, a.pointer, a.tabbarHover, a.phase, a.draggingTabElement,
|
|
469
|
-
return /* @__PURE__ */ m(
|
|
470
|
-
},
|
|
535
|
+
onStartContentDrag: v,
|
|
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 });
|
|
539
|
+
}, ct = {
|
|
471
540
|
display: "inline-flex",
|
|
472
541
|
alignItems: "center",
|
|
473
542
|
userSelect: "none"
|
|
474
|
-
},
|
|
543
|
+
}, Se = ({
|
|
475
544
|
groupId: t,
|
|
476
545
|
tab: e,
|
|
477
|
-
active:
|
|
478
|
-
dragging:
|
|
546
|
+
active: n,
|
|
547
|
+
dragging: r,
|
|
479
548
|
onClickTab: o,
|
|
480
549
|
onStartDrag: s,
|
|
481
550
|
onCloseTab: a,
|
|
482
551
|
tabComponent: i,
|
|
483
552
|
tabElement: c,
|
|
484
|
-
onDoubleClick:
|
|
553
|
+
onDoubleClick: d
|
|
485
554
|
}) => {
|
|
486
|
-
const
|
|
555
|
+
const l = u.useEffectEvent(() => {
|
|
487
556
|
o(e.id);
|
|
488
|
-
}),
|
|
489
|
-
s &&
|
|
557
|
+
}), p = u.useEffectEvent((I) => {
|
|
558
|
+
s && I.button === 0 && s(e.id, t, I);
|
|
490
559
|
}), g = () => {
|
|
491
|
-
const
|
|
492
|
-
return /* @__PURE__ */ m(
|
|
560
|
+
const I = !!a;
|
|
561
|
+
return /* @__PURE__ */ m(u.Activity, { mode: I ? "visible" : "hidden", children: /* @__PURE__ */ m(
|
|
493
562
|
"button",
|
|
494
563
|
{
|
|
495
564
|
type: "button",
|
|
496
565
|
"aria-label": `Close tab ${e.title}`,
|
|
497
|
-
onClick: (
|
|
498
|
-
a && (
|
|
566
|
+
onClick: (w) => {
|
|
567
|
+
a && (w.stopPropagation(), a(t, e.id));
|
|
499
568
|
},
|
|
500
569
|
style: { marginLeft: 6 },
|
|
501
|
-
tabIndex:
|
|
502
|
-
disabled: !
|
|
503
|
-
"aria-hidden":
|
|
570
|
+
tabIndex: I ? void 0 : -1,
|
|
571
|
+
disabled: !I,
|
|
572
|
+
"aria-hidden": I ? void 0 : !0,
|
|
504
573
|
children: "×"
|
|
505
574
|
}
|
|
506
575
|
) });
|
|
507
|
-
},
|
|
576
|
+
}, v = {
|
|
508
577
|
role: "tab",
|
|
509
|
-
"aria-selected":
|
|
510
|
-
tabIndex:
|
|
511
|
-
style:
|
|
512
|
-
onClick:
|
|
513
|
-
onPointerDown:
|
|
514
|
-
onDoubleClick:
|
|
578
|
+
"aria-selected": n,
|
|
579
|
+
tabIndex: n ? 0 : -1,
|
|
580
|
+
style: ct,
|
|
581
|
+
onClick: l,
|
|
582
|
+
onPointerDown: p,
|
|
583
|
+
onDoubleClick: d,
|
|
515
584
|
"data-tab-id": e.id,
|
|
516
|
-
"data-active":
|
|
517
|
-
"data-dragging":
|
|
585
|
+
"data-active": n ? "true" : "false",
|
|
586
|
+
"data-dragging": r ? "true" : "false",
|
|
518
587
|
children: /* @__PURE__ */ H(et, { children: [
|
|
519
588
|
/* @__PURE__ */ m("span", { children: e.title }),
|
|
520
589
|
g()
|
|
521
590
|
] })
|
|
522
|
-
},
|
|
591
|
+
}, b = {
|
|
523
592
|
type: "button",
|
|
524
593
|
role: "tab",
|
|
525
|
-
"aria-selected":
|
|
526
|
-
tabIndex:
|
|
527
|
-
style:
|
|
594
|
+
"aria-selected": n,
|
|
595
|
+
tabIndex: n ? 0 : -1,
|
|
596
|
+
style: ct,
|
|
528
597
|
onClick: () => {
|
|
529
598
|
o(e.id);
|
|
530
599
|
},
|
|
531
|
-
onPointerDown: (
|
|
532
|
-
s &&
|
|
600
|
+
onPointerDown: (I) => {
|
|
601
|
+
s && I.button === 0 && s(e.id, t, I);
|
|
533
602
|
},
|
|
534
|
-
onDoubleClick:
|
|
603
|
+
onDoubleClick: d,
|
|
535
604
|
children: /* @__PURE__ */ m("span", { children: e.title })
|
|
536
605
|
};
|
|
537
|
-
return c ? c(
|
|
538
|
-
},
|
|
606
|
+
return c ? c(b) : i ? /* @__PURE__ */ m(i, { ...b }) : /* @__PURE__ */ m("div", { ...v });
|
|
607
|
+
}, xe = {
|
|
539
608
|
display: "flex",
|
|
540
609
|
alignItems: "center"
|
|
541
|
-
},
|
|
610
|
+
}, Ge = {
|
|
542
611
|
flex: "1 1 auto",
|
|
543
612
|
alignSelf: "stretch"
|
|
544
|
-
},
|
|
613
|
+
}, Ce = ({
|
|
545
614
|
group: t,
|
|
546
615
|
onClickTab: e,
|
|
547
|
-
onStartDrag:
|
|
548
|
-
rootRef:
|
|
616
|
+
onStartDrag: n,
|
|
617
|
+
rootRef: r,
|
|
549
618
|
component: o,
|
|
550
619
|
element: s,
|
|
551
620
|
tabComponent: a,
|
|
552
621
|
tabElement: i,
|
|
553
622
|
onAddTab: c,
|
|
554
|
-
onCloseTab:
|
|
555
|
-
doubleClickToAdd:
|
|
623
|
+
onCloseTab: d,
|
|
624
|
+
doubleClickToAdd: l
|
|
556
625
|
}) => {
|
|
557
|
-
const { isTabDragging:
|
|
558
|
-
(
|
|
559
|
-
if (
|
|
560
|
-
if (typeof
|
|
561
|
-
|
|
626
|
+
const { isTabDragging: p, draggingTabId: g } = W(), v = u.useRef(null), b = u.useCallback(
|
|
627
|
+
(f) => {
|
|
628
|
+
if (v.current = f, !!r) {
|
|
629
|
+
if (typeof r == "function") {
|
|
630
|
+
r(f);
|
|
562
631
|
return;
|
|
563
632
|
}
|
|
564
633
|
try {
|
|
565
|
-
|
|
634
|
+
r.current = f;
|
|
566
635
|
} catch {
|
|
567
636
|
}
|
|
568
637
|
}
|
|
569
638
|
},
|
|
570
|
-
[
|
|
571
|
-
),
|
|
572
|
-
const
|
|
573
|
-
if (!
|
|
639
|
+
[r]
|
|
640
|
+
), I = u.useEffectEvent((f) => {
|
|
641
|
+
const S = v.current ?? f.currentTarget;
|
|
642
|
+
if (!S)
|
|
574
643
|
return;
|
|
575
|
-
const
|
|
576
|
-
if (
|
|
644
|
+
const C = Array.from(S.querySelectorAll('[role="tab"]'));
|
|
645
|
+
if (C.length === 0)
|
|
577
646
|
return;
|
|
578
|
-
const
|
|
579
|
-
const O = Math.max(0, Math.min(P,
|
|
647
|
+
const G = (P) => {
|
|
648
|
+
const O = Math.max(0, Math.min(P, C.length - 1)), B = C[O];
|
|
580
649
|
B && B.focus();
|
|
581
|
-
}, R = document.activeElement,
|
|
582
|
-
if (
|
|
583
|
-
|
|
584
|
-
const P =
|
|
585
|
-
|
|
650
|
+
}, R = document.activeElement, x = R ? C.indexOf(R) : C.findIndex((P) => P.getAttribute("data-tab-id") === t.activeTabId);
|
|
651
|
+
if (f.key === "ArrowRight") {
|
|
652
|
+
f.preventDefault();
|
|
653
|
+
const P = x >= 0 ? x + 1 : 0;
|
|
654
|
+
G(P >= C.length ? 0 : P);
|
|
586
655
|
return;
|
|
587
656
|
}
|
|
588
|
-
if (
|
|
589
|
-
|
|
590
|
-
const P =
|
|
591
|
-
|
|
657
|
+
if (f.key === "ArrowLeft") {
|
|
658
|
+
f.preventDefault();
|
|
659
|
+
const P = x >= 0 ? x - 1 : C.length - 1;
|
|
660
|
+
G(P < 0 ? C.length - 1 : P);
|
|
592
661
|
return;
|
|
593
662
|
}
|
|
594
|
-
if (
|
|
595
|
-
|
|
663
|
+
if (f.key === "Home") {
|
|
664
|
+
f.preventDefault(), G(0);
|
|
596
665
|
return;
|
|
597
666
|
}
|
|
598
|
-
if (
|
|
599
|
-
|
|
667
|
+
if (f.key === "End") {
|
|
668
|
+
f.preventDefault(), G(C.length - 1);
|
|
600
669
|
return;
|
|
601
670
|
}
|
|
602
|
-
if (
|
|
603
|
-
|
|
604
|
-
const O = (
|
|
671
|
+
if (f.key === "Enter" || f.key === " ") {
|
|
672
|
+
f.preventDefault();
|
|
673
|
+
const O = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
|
|
605
674
|
O && e(O);
|
|
606
675
|
return;
|
|
607
676
|
}
|
|
608
|
-
if (
|
|
609
|
-
if (
|
|
610
|
-
|
|
611
|
-
const O = (
|
|
612
|
-
O &&
|
|
677
|
+
if (f.key === "Delete" || f.key === "Backspace") {
|
|
678
|
+
if (d) {
|
|
679
|
+
f.preventDefault();
|
|
680
|
+
const O = (x >= 0 ? C[x] : null)?.getAttribute("data-tab-id") ?? null;
|
|
681
|
+
O && d(t.id, O);
|
|
613
682
|
}
|
|
614
683
|
return;
|
|
615
684
|
}
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
618
|
-
c && (
|
|
685
|
+
const E = (f.ctrlKey ? 1 : 0) + (f.metaKey ? 1 : 0) > 0, k = typeof f.key == "string" ? f.key.toLowerCase() : "";
|
|
686
|
+
if (E && k === "t") {
|
|
687
|
+
c && (f.preventDefault(), c(t.id));
|
|
619
688
|
return;
|
|
620
689
|
}
|
|
621
690
|
});
|
|
622
|
-
|
|
623
|
-
const
|
|
624
|
-
if (!
|
|
691
|
+
u.useEffect(() => {
|
|
692
|
+
const f = v.current;
|
|
693
|
+
if (!f)
|
|
625
694
|
return;
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
695
|
+
const S = f.querySelector(`[role="tab"][data-tab-id="${t.activeTabId}"]`);
|
|
696
|
+
if (S === document.activeElement)
|
|
628
697
|
return;
|
|
629
|
-
!
|
|
698
|
+
!f.contains(document.activeElement) && S && S.focus();
|
|
630
699
|
}, [t.activeTabId]);
|
|
631
|
-
const
|
|
632
|
-
style:
|
|
700
|
+
const w = {
|
|
701
|
+
style: xe,
|
|
633
702
|
role: "tablist",
|
|
634
703
|
"data-tabbar": "true",
|
|
635
704
|
"data-group-id": t.id,
|
|
636
|
-
"data-dragging":
|
|
637
|
-
onKeyDown:
|
|
638
|
-
}, T =
|
|
705
|
+
"data-dragging": p ? "true" : "false",
|
|
706
|
+
onKeyDown: I
|
|
707
|
+
}, T = Ot({
|
|
639
708
|
element: s,
|
|
640
709
|
component: o
|
|
641
|
-
}),
|
|
710
|
+
}), h = () => c ? /* @__PURE__ */ m(
|
|
642
711
|
"button",
|
|
643
712
|
{
|
|
644
713
|
type: "button",
|
|
@@ -648,85 +717,85 @@ const he = (t, e) => {
|
|
|
648
717
|
},
|
|
649
718
|
children: "+"
|
|
650
719
|
}
|
|
651
|
-
) : null,
|
|
652
|
-
|
|
653
|
-
}, [
|
|
654
|
-
return /* @__PURE__ */ H(T, { ...
|
|
655
|
-
t.tabs.map((
|
|
656
|
-
|
|
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: [
|
|
724
|
+
t.tabs.map((f, S) => /* @__PURE__ */ m(
|
|
725
|
+
Se,
|
|
657
726
|
{
|
|
658
727
|
groupId: t.id,
|
|
659
|
-
tab:
|
|
660
|
-
active: t.activeTabId ===
|
|
661
|
-
dragging: g ===
|
|
728
|
+
tab: f,
|
|
729
|
+
active: t.activeTabId === f.id,
|
|
730
|
+
dragging: g === f.id,
|
|
662
731
|
onClickTab: e,
|
|
663
|
-
onStartDrag:
|
|
664
|
-
onCloseTab:
|
|
732
|
+
onStartDrag: n,
|
|
733
|
+
onCloseTab: d,
|
|
665
734
|
tabComponent: a,
|
|
666
735
|
tabElement: i,
|
|
667
|
-
onDoubleClick: (
|
|
736
|
+
onDoubleClick: (C) => C.stopPropagation()
|
|
668
737
|
},
|
|
669
|
-
`${t.id}:${
|
|
738
|
+
`${t.id}:${f.id}:${S}`
|
|
670
739
|
)),
|
|
671
|
-
/* @__PURE__ */ m("span", { style:
|
|
672
|
-
|
|
740
|
+
/* @__PURE__ */ m("span", { style: Ge }),
|
|
741
|
+
h()
|
|
673
742
|
] });
|
|
674
|
-
},
|
|
675
|
-
const { getGroup:
|
|
676
|
-
(
|
|
677
|
-
|
|
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(
|
|
745
|
+
(S) => {
|
|
746
|
+
p(t, S);
|
|
678
747
|
},
|
|
679
|
-
[t,
|
|
680
|
-
),
|
|
681
|
-
(
|
|
682
|
-
|
|
748
|
+
[t, p]
|
|
749
|
+
), I = u.useCallback(
|
|
750
|
+
(S) => {
|
|
751
|
+
v(t, S), l(t, S);
|
|
683
752
|
},
|
|
684
|
-
[t,
|
|
685
|
-
),
|
|
686
|
-
(
|
|
687
|
-
g(t,
|
|
753
|
+
[t, v, l]
|
|
754
|
+
), w = u.useCallback(
|
|
755
|
+
(S) => {
|
|
756
|
+
g(t, S);
|
|
688
757
|
},
|
|
689
758
|
[t, g]
|
|
690
|
-
), T =
|
|
759
|
+
), T = r(t);
|
|
691
760
|
if (!T)
|
|
692
761
|
return null;
|
|
693
|
-
const
|
|
762
|
+
const h = o(t);
|
|
694
763
|
return /* @__PURE__ */ m(
|
|
695
|
-
|
|
764
|
+
n ?? ((S) => /* @__PURE__ */ m(vt, { ...S })),
|
|
696
765
|
{
|
|
697
766
|
group: T,
|
|
698
767
|
tabbar: /* @__PURE__ */ m(
|
|
699
|
-
e ??
|
|
768
|
+
e ?? Ce,
|
|
700
769
|
{
|
|
701
|
-
rootRef:
|
|
770
|
+
rootRef: w,
|
|
702
771
|
group: T,
|
|
703
|
-
onClickTab: (
|
|
772
|
+
onClickTab: (S) => s(t, S),
|
|
704
773
|
onAddTab: a,
|
|
705
774
|
onCloseTab: i,
|
|
706
|
-
onStartDrag: (
|
|
707
|
-
doubleClickToAdd:
|
|
775
|
+
onStartDrag: (S, C, G) => c(S, C, G),
|
|
776
|
+
doubleClickToAdd: d
|
|
708
777
|
}
|
|
709
778
|
),
|
|
710
|
-
content:
|
|
711
|
-
groupRef:
|
|
712
|
-
contentRef:
|
|
779
|
+
content: h,
|
|
780
|
+
groupRef: b,
|
|
781
|
+
contentRef: I
|
|
713
782
|
}
|
|
714
783
|
);
|
|
715
|
-
},
|
|
716
|
-
const
|
|
717
|
-
for (let
|
|
784
|
+
}, Re = (t, e) => {
|
|
785
|
+
const n = new Array(16);
|
|
786
|
+
for (let r = 0; r < 4; r++)
|
|
718
787
|
for (let o = 0; o < 4; o++)
|
|
719
|
-
r
|
|
720
|
-
return
|
|
721
|
-
},
|
|
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];
|
|
789
|
+
return n;
|
|
790
|
+
}, K = (t) => {
|
|
722
791
|
if (t.length !== 16)
|
|
723
792
|
throw new Error("Matrix must have exactly 16 values");
|
|
724
|
-
const e = Object.freeze([...t]),
|
|
725
|
-
const o =
|
|
726
|
-
return
|
|
793
|
+
const e = Object.freeze([...t]), n = (r) => {
|
|
794
|
+
const o = Re(e, r);
|
|
795
|
+
return K(o);
|
|
727
796
|
};
|
|
728
797
|
return Object.freeze({
|
|
729
|
-
translate: (
|
|
798
|
+
translate: (r = 0, o = 0, s = 0) => n([
|
|
730
799
|
1,
|
|
731
800
|
0,
|
|
732
801
|
0,
|
|
@@ -739,12 +808,12 @@ const he = (t, e) => {
|
|
|
739
808
|
0,
|
|
740
809
|
1,
|
|
741
810
|
0,
|
|
742
|
-
|
|
811
|
+
r,
|
|
743
812
|
o,
|
|
744
813
|
s,
|
|
745
814
|
1
|
|
746
815
|
]),
|
|
747
|
-
translate3d: (
|
|
816
|
+
translate3d: (r, o, s) => n([
|
|
748
817
|
1,
|
|
749
818
|
0,
|
|
750
819
|
0,
|
|
@@ -757,12 +826,12 @@ const he = (t, e) => {
|
|
|
757
826
|
0,
|
|
758
827
|
1,
|
|
759
828
|
0,
|
|
760
|
-
|
|
829
|
+
r,
|
|
761
830
|
o,
|
|
762
831
|
s,
|
|
763
832
|
1
|
|
764
833
|
]),
|
|
765
|
-
translateX: (
|
|
834
|
+
translateX: (r) => n([
|
|
766
835
|
1,
|
|
767
836
|
0,
|
|
768
837
|
0,
|
|
@@ -775,12 +844,12 @@ const he = (t, e) => {
|
|
|
775
844
|
0,
|
|
776
845
|
1,
|
|
777
846
|
0,
|
|
778
|
-
|
|
847
|
+
r,
|
|
779
848
|
0,
|
|
780
849
|
0,
|
|
781
850
|
1
|
|
782
851
|
]),
|
|
783
|
-
translateY: (
|
|
852
|
+
translateY: (r) => n([
|
|
784
853
|
1,
|
|
785
854
|
0,
|
|
786
855
|
0,
|
|
@@ -794,11 +863,11 @@ const he = (t, e) => {
|
|
|
794
863
|
1,
|
|
795
864
|
0,
|
|
796
865
|
0,
|
|
797
|
-
|
|
866
|
+
r,
|
|
798
867
|
0,
|
|
799
868
|
1
|
|
800
869
|
]),
|
|
801
|
-
translateZ: (
|
|
870
|
+
translateZ: (r) => n([
|
|
802
871
|
1,
|
|
803
872
|
0,
|
|
804
873
|
0,
|
|
@@ -813,11 +882,11 @@ const he = (t, e) => {
|
|
|
813
882
|
0,
|
|
814
883
|
0,
|
|
815
884
|
0,
|
|
816
|
-
|
|
885
|
+
r,
|
|
817
886
|
1
|
|
818
887
|
]),
|
|
819
|
-
scale: (
|
|
820
|
-
|
|
888
|
+
scale: (r = 1, o = 1, s = 1) => n([
|
|
889
|
+
r,
|
|
821
890
|
0,
|
|
822
891
|
0,
|
|
823
892
|
0,
|
|
@@ -834,8 +903,8 @@ const he = (t, e) => {
|
|
|
834
903
|
0,
|
|
835
904
|
1
|
|
836
905
|
]),
|
|
837
|
-
scale3d: (
|
|
838
|
-
|
|
906
|
+
scale3d: (r, o, s) => n([
|
|
907
|
+
r,
|
|
839
908
|
0,
|
|
840
909
|
0,
|
|
841
910
|
0,
|
|
@@ -852,8 +921,8 @@ const he = (t, e) => {
|
|
|
852
921
|
0,
|
|
853
922
|
1
|
|
854
923
|
]),
|
|
855
|
-
scaleX: (
|
|
856
|
-
|
|
924
|
+
scaleX: (r) => n([
|
|
925
|
+
r,
|
|
857
926
|
0,
|
|
858
927
|
0,
|
|
859
928
|
0,
|
|
@@ -870,13 +939,13 @@ const he = (t, e) => {
|
|
|
870
939
|
0,
|
|
871
940
|
1
|
|
872
941
|
]),
|
|
873
|
-
scaleY: (
|
|
942
|
+
scaleY: (r) => n([
|
|
874
943
|
1,
|
|
875
944
|
0,
|
|
876
945
|
0,
|
|
877
946
|
0,
|
|
878
947
|
0,
|
|
879
|
-
|
|
948
|
+
r,
|
|
880
949
|
0,
|
|
881
950
|
0,
|
|
882
951
|
0,
|
|
@@ -888,7 +957,7 @@ const he = (t, e) => {
|
|
|
888
957
|
0,
|
|
889
958
|
1
|
|
890
959
|
]),
|
|
891
|
-
scaleZ: (
|
|
960
|
+
scaleZ: (r) => n([
|
|
892
961
|
1,
|
|
893
962
|
0,
|
|
894
963
|
0,
|
|
@@ -899,16 +968,16 @@ const he = (t, e) => {
|
|
|
899
968
|
0,
|
|
900
969
|
0,
|
|
901
970
|
0,
|
|
902
|
-
|
|
971
|
+
r,
|
|
903
972
|
0,
|
|
904
973
|
0,
|
|
905
974
|
0,
|
|
906
975
|
0,
|
|
907
976
|
1
|
|
908
977
|
]),
|
|
909
|
-
rotateX: (
|
|
910
|
-
const o = Math.cos(
|
|
911
|
-
return
|
|
978
|
+
rotateX: (r) => {
|
|
979
|
+
const o = Math.cos(r), s = Math.sin(r);
|
|
980
|
+
return n([
|
|
912
981
|
1,
|
|
913
982
|
0,
|
|
914
983
|
0,
|
|
@@ -927,9 +996,9 @@ const he = (t, e) => {
|
|
|
927
996
|
1
|
|
928
997
|
]);
|
|
929
998
|
},
|
|
930
|
-
rotateY: (
|
|
931
|
-
const o = Math.cos(
|
|
932
|
-
return
|
|
999
|
+
rotateY: (r) => {
|
|
1000
|
+
const o = Math.cos(r), s = Math.sin(r);
|
|
1001
|
+
return n([
|
|
933
1002
|
o,
|
|
934
1003
|
0,
|
|
935
1004
|
-s,
|
|
@@ -948,9 +1017,9 @@ const he = (t, e) => {
|
|
|
948
1017
|
1
|
|
949
1018
|
]);
|
|
950
1019
|
},
|
|
951
|
-
rotateZ: (
|
|
952
|
-
const o = Math.cos(
|
|
953
|
-
return
|
|
1020
|
+
rotateZ: (r) => {
|
|
1021
|
+
const o = Math.cos(r), s = Math.sin(r);
|
|
1022
|
+
return n([
|
|
954
1023
|
o,
|
|
955
1024
|
s,
|
|
956
1025
|
0,
|
|
@@ -969,24 +1038,24 @@ const he = (t, e) => {
|
|
|
969
1038
|
1
|
|
970
1039
|
]);
|
|
971
1040
|
},
|
|
972
|
-
rotate: (
|
|
1041
|
+
rotate: (r, o, s, a) => {
|
|
973
1042
|
const i = Math.sqrt(o * o + s * s + a * a);
|
|
974
1043
|
if (i === 0)
|
|
975
|
-
return
|
|
1044
|
+
return K(e);
|
|
976
1045
|
o /= i, s /= i, a /= i;
|
|
977
|
-
const c = Math.cos(
|
|
978
|
-
return
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1046
|
+
const c = Math.cos(r), d = Math.sin(r), l = 1 - c;
|
|
1047
|
+
return n([
|
|
1048
|
+
l * o * o + c,
|
|
1049
|
+
l * o * s + d * a,
|
|
1050
|
+
l * o * a - d * s,
|
|
982
1051
|
0,
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
1052
|
+
l * o * s - d * a,
|
|
1053
|
+
l * s * s + c,
|
|
1054
|
+
l * s * a + d * o,
|
|
986
1055
|
0,
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1056
|
+
l * o * a + d * s,
|
|
1057
|
+
l * s * a - d * o,
|
|
1058
|
+
l * a * a + c,
|
|
990
1059
|
0,
|
|
991
1060
|
0,
|
|
992
1061
|
0,
|
|
@@ -994,24 +1063,24 @@ const he = (t, e) => {
|
|
|
994
1063
|
1
|
|
995
1064
|
]);
|
|
996
1065
|
},
|
|
997
|
-
rotate3d: (
|
|
998
|
-
const i = Math.sqrt(
|
|
1066
|
+
rotate3d: (r, o, s, a) => {
|
|
1067
|
+
const i = Math.sqrt(r * r + o * o + s * s);
|
|
999
1068
|
if (i === 0)
|
|
1000
|
-
return
|
|
1001
|
-
|
|
1002
|
-
const c = Math.cos(a),
|
|
1003
|
-
return
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1069
|
+
return K(e);
|
|
1070
|
+
r /= i, o /= i, s /= i;
|
|
1071
|
+
const c = Math.cos(a), d = Math.sin(a), l = 1 - c;
|
|
1072
|
+
return n([
|
|
1073
|
+
l * r * r + c,
|
|
1074
|
+
l * r * o + d * s,
|
|
1075
|
+
l * r * s - d * o,
|
|
1007
1076
|
0,
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1077
|
+
l * r * o - d * s,
|
|
1078
|
+
l * o * o + c,
|
|
1079
|
+
l * o * s + d * r,
|
|
1011
1080
|
0,
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1081
|
+
l * r * s + d * o,
|
|
1082
|
+
l * o * s - d * r,
|
|
1083
|
+
l * s * s + c,
|
|
1015
1084
|
0,
|
|
1016
1085
|
0,
|
|
1017
1086
|
0,
|
|
@@ -1019,9 +1088,9 @@ const he = (t, e) => {
|
|
|
1019
1088
|
1
|
|
1020
1089
|
]);
|
|
1021
1090
|
},
|
|
1022
|
-
skew: (
|
|
1023
|
-
const s = Math.tan(
|
|
1024
|
-
return
|
|
1091
|
+
skew: (r = 0, o = 0) => {
|
|
1092
|
+
const s = Math.tan(r), a = Math.tan(o);
|
|
1093
|
+
return n([
|
|
1025
1094
|
1,
|
|
1026
1095
|
a,
|
|
1027
1096
|
0,
|
|
@@ -1040,9 +1109,9 @@ const he = (t, e) => {
|
|
|
1040
1109
|
1
|
|
1041
1110
|
]);
|
|
1042
1111
|
},
|
|
1043
|
-
skewX: (
|
|
1044
|
-
const o = Math.tan(
|
|
1045
|
-
return
|
|
1112
|
+
skewX: (r) => {
|
|
1113
|
+
const o = Math.tan(r);
|
|
1114
|
+
return n([
|
|
1046
1115
|
1,
|
|
1047
1116
|
0,
|
|
1048
1117
|
0,
|
|
@@ -1061,9 +1130,9 @@ const he = (t, e) => {
|
|
|
1061
1130
|
1
|
|
1062
1131
|
]);
|
|
1063
1132
|
},
|
|
1064
|
-
skewY: (
|
|
1065
|
-
const o = Math.tan(
|
|
1066
|
-
return
|
|
1133
|
+
skewY: (r) => {
|
|
1134
|
+
const o = Math.tan(r);
|
|
1135
|
+
return n([
|
|
1067
1136
|
1,
|
|
1068
1137
|
o,
|
|
1069
1138
|
0,
|
|
@@ -1082,10 +1151,10 @@ const he = (t, e) => {
|
|
|
1082
1151
|
1
|
|
1083
1152
|
]);
|
|
1084
1153
|
},
|
|
1085
|
-
perspective: (
|
|
1086
|
-
if (
|
|
1154
|
+
perspective: (r) => {
|
|
1155
|
+
if (r === 0)
|
|
1087
1156
|
throw new Error("Perspective distance cannot be zero");
|
|
1088
|
-
return
|
|
1157
|
+
return n([
|
|
1089
1158
|
1,
|
|
1090
1159
|
0,
|
|
1091
1160
|
0,
|
|
@@ -1097,7 +1166,7 @@ const he = (t, e) => {
|
|
|
1097
1166
|
0,
|
|
1098
1167
|
0,
|
|
1099
1168
|
1,
|
|
1100
|
-
-1 /
|
|
1169
|
+
-1 / r,
|
|
1101
1170
|
0,
|
|
1102
1171
|
0,
|
|
1103
1172
|
0,
|
|
@@ -1114,7 +1183,7 @@ const he = (t, e) => {
|
|
|
1114
1183
|
].join(`
|
|
1115
1184
|
`)
|
|
1116
1185
|
});
|
|
1117
|
-
},
|
|
1186
|
+
}, Pe = () => K([
|
|
1118
1187
|
1,
|
|
1119
1188
|
0,
|
|
1120
1189
|
0,
|
|
@@ -1131,142 +1200,142 @@ const he = (t, e) => {
|
|
|
1131
1200
|
0,
|
|
1132
1201
|
0,
|
|
1133
1202
|
1
|
|
1134
|
-
]),
|
|
1203
|
+
]), De = {
|
|
1135
1204
|
position: "fixed",
|
|
1136
1205
|
inset: 0,
|
|
1137
1206
|
pointerEvents: "none",
|
|
1138
|
-
zIndex:
|
|
1139
|
-
},
|
|
1207
|
+
zIndex: $t
|
|
1208
|
+
}, Ae = {
|
|
1140
1209
|
position: "absolute",
|
|
1141
|
-
border: `${
|
|
1142
|
-
background:
|
|
1143
|
-
borderRadius:
|
|
1210
|
+
border: `${Yt} dashed ${jt}`,
|
|
1211
|
+
background: Xt,
|
|
1212
|
+
borderRadius: Ft,
|
|
1144
1213
|
transformOrigin: "top left"
|
|
1145
|
-
}, L = (t, e) => e <= 0 ? 0 : M(t / e, 0),
|
|
1146
|
-
const { width:
|
|
1147
|
-
translateX:
|
|
1148
|
-
translateY:
|
|
1149
|
-
scaleX: L(M(
|
|
1150
|
-
scaleY: L(M(o -
|
|
1151
|
-
}, u = {
|
|
1152
|
-
translateX: r,
|
|
1153
|
-
translateY: r,
|
|
1154
|
-
scaleX: L(M(n / 2 - r * 1.5, 0), a),
|
|
1155
|
-
scaleY: L(M(o - r * 2, 0), i)
|
|
1214
|
+
}, L = (t, e) => e <= 0 ? 0 : M(t / e, 0), ke = (t, e, n) => {
|
|
1215
|
+
const { width: r, height: o } = t, s = n / 2, a = r > 0 ? r : 1, i = o > 0 ? o : 1, c = {
|
|
1216
|
+
translateX: n,
|
|
1217
|
+
translateY: n,
|
|
1218
|
+
scaleX: L(M(r - n * 2, 0), a),
|
|
1219
|
+
scaleY: L(M(o - n * 2, 0), i)
|
|
1156
1220
|
}, d = {
|
|
1157
|
-
translateX: n
|
|
1158
|
-
translateY:
|
|
1159
|
-
scaleX: L(M(
|
|
1160
|
-
scaleY: L(M(o -
|
|
1161
|
-
},
|
|
1162
|
-
translateX: r,
|
|
1163
|
-
translateY:
|
|
1164
|
-
scaleX: L(M(
|
|
1165
|
-
scaleY: L(M(o
|
|
1221
|
+
translateX: n,
|
|
1222
|
+
translateY: n,
|
|
1223
|
+
scaleX: L(M(r / 2 - n * 1.5, 0), a),
|
|
1224
|
+
scaleY: L(M(o - n * 2, 0), i)
|
|
1225
|
+
}, l = {
|
|
1226
|
+
translateX: r / 2 + s,
|
|
1227
|
+
translateY: n,
|
|
1228
|
+
scaleX: L(M(r / 2 - n * 1.5, 0), a),
|
|
1229
|
+
scaleY: L(M(o - n * 2, 0), i)
|
|
1230
|
+
}, p = {
|
|
1231
|
+
translateX: n,
|
|
1232
|
+
translateY: n,
|
|
1233
|
+
scaleX: L(M(r - n * 2, 0), a),
|
|
1234
|
+
scaleY: L(M(o / 2 - n * 1.5, 0), i)
|
|
1166
1235
|
}, g = {
|
|
1167
|
-
translateX:
|
|
1236
|
+
translateX: n,
|
|
1168
1237
|
translateY: o / 2 + s,
|
|
1169
|
-
scaleX: L(M(
|
|
1170
|
-
scaleY: L(M(o / 2 -
|
|
1171
|
-
},
|
|
1238
|
+
scaleX: L(M(r - n * 2, 0), a),
|
|
1239
|
+
scaleY: L(M(o / 2 - n * 1.5, 0), i)
|
|
1240
|
+
}, v = {
|
|
1172
1241
|
center: c,
|
|
1173
|
-
left:
|
|
1174
|
-
right:
|
|
1175
|
-
top:
|
|
1242
|
+
left: d,
|
|
1243
|
+
right: l,
|
|
1244
|
+
top: p,
|
|
1176
1245
|
bottom: g
|
|
1177
|
-
}, { translateX:
|
|
1178
|
-
return
|
|
1179
|
-
},
|
|
1180
|
-
const
|
|
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;
|
|
1181
1250
|
return {
|
|
1182
|
-
...
|
|
1251
|
+
...Ae,
|
|
1183
1252
|
left: t.left,
|
|
1184
1253
|
top: t.top,
|
|
1185
1254
|
width: t.width,
|
|
1186
1255
|
height: t.height,
|
|
1187
|
-
transform:
|
|
1256
|
+
transform: ke(t, e, n)
|
|
1188
1257
|
};
|
|
1189
|
-
},
|
|
1258
|
+
}, _e = ({ suggest: t }) => {
|
|
1190
1259
|
if (!t)
|
|
1191
1260
|
return null;
|
|
1192
|
-
const { rect: e, zone:
|
|
1193
|
-
return /* @__PURE__ */ m("div", { style:
|
|
1194
|
-
},
|
|
1195
|
-
const [e,
|
|
1196
|
-
return
|
|
1197
|
-
if (!
|
|
1198
|
-
|
|
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);
|
|
1265
|
+
return nt(() => {
|
|
1266
|
+
if (!Oe || !t) {
|
|
1267
|
+
n(null), o(null);
|
|
1199
1268
|
return;
|
|
1200
1269
|
}
|
|
1201
1270
|
const s = t.getBoundingClientRect();
|
|
1202
|
-
|
|
1203
|
-
}, [t]), { html:
|
|
1204
|
-
},
|
|
1271
|
+
n({ width: s.width, height: s.height }), o(t.outerHTML);
|
|
1272
|
+
}, [t]), { html: r, size: e };
|
|
1273
|
+
}, Le = {
|
|
1205
1274
|
position: "fixed",
|
|
1206
1275
|
inset: 0,
|
|
1207
1276
|
pointerEvents: "none",
|
|
1208
|
-
zIndex:
|
|
1209
|
-
},
|
|
1277
|
+
zIndex: Qt
|
|
1278
|
+
}, He = {
|
|
1210
1279
|
position: "absolute",
|
|
1211
|
-
width:
|
|
1212
|
-
borderRadius:
|
|
1213
|
-
background:
|
|
1214
|
-
boxShadow:
|
|
1215
|
-
},
|
|
1216
|
-
const { isTabDragging: t, draggingTabId: e, dragPointer:
|
|
1217
|
-
if (!(!i || !
|
|
1280
|
+
width: Jt,
|
|
1281
|
+
borderRadius: Zt,
|
|
1282
|
+
background: qt,
|
|
1283
|
+
boxShadow: Wt
|
|
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(() => {
|
|
1286
|
+
if (!(!i || !n))
|
|
1218
1287
|
return {
|
|
1219
1288
|
position: "absolute",
|
|
1220
|
-
left:
|
|
1221
|
-
top:
|
|
1222
|
-
transform: `translate(${
|
|
1289
|
+
left: n.x,
|
|
1290
|
+
top: n.y,
|
|
1291
|
+
transform: `translate(${Kt}, ${Vt})`,
|
|
1223
1292
|
pointerEvents: "none"
|
|
1224
1293
|
};
|
|
1225
|
-
}, [i,
|
|
1294
|
+
}, [i, n]), d = u.useMemo(() => {
|
|
1226
1295
|
if (!(!c || !o))
|
|
1227
1296
|
return a ? { ...c, width: a.width, height: a.height } : c;
|
|
1228
|
-
}, [c, o, a]),
|
|
1229
|
-
if (
|
|
1297
|
+
}, [c, o, a]), l = u.useMemo(() => {
|
|
1298
|
+
if (r)
|
|
1230
1299
|
return {
|
|
1231
|
-
...
|
|
1232
|
-
left:
|
|
1233
|
-
top:
|
|
1234
|
-
height: Math.max(0,
|
|
1300
|
+
...He,
|
|
1301
|
+
left: r.insertX,
|
|
1302
|
+
top: r.rect.top + 4,
|
|
1303
|
+
height: Math.max(0, r.rect.height - 8)
|
|
1235
1304
|
};
|
|
1236
|
-
}, [
|
|
1237
|
-
return t ? /* @__PURE__ */ H("div", { style:
|
|
1238
|
-
/* @__PURE__ */ m(
|
|
1305
|
+
}, [r]);
|
|
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(
|
|
1239
1308
|
"div",
|
|
1240
1309
|
{
|
|
1241
1310
|
style: { width: "100%", height: "100%", pointerEvents: "none" },
|
|
1242
1311
|
dangerouslySetInnerHTML: { __html: s ?? "" }
|
|
1243
1312
|
}
|
|
1244
1313
|
) }) }),
|
|
1245
|
-
/* @__PURE__ */ m(
|
|
1314
|
+
/* @__PURE__ */ m(u.Activity, { mode: l ? "visible" : "hidden", children: /* @__PURE__ */ m("div", { style: l }) })
|
|
1246
1315
|
] }) : null;
|
|
1247
|
-
}, _ = (t) => t.type === "group",
|
|
1316
|
+
}, _ = (t) => t.type === "group", Y = (t, e = []) => {
|
|
1248
1317
|
if (_(t))
|
|
1249
1318
|
return [...e, t.groupId];
|
|
1250
|
-
const
|
|
1251
|
-
return
|
|
1252
|
-
}, q = (t, e) => e.reduce((
|
|
1319
|
+
const n = Y(t.a, e);
|
|
1320
|
+
return Y(t.b, n);
|
|
1321
|
+
}, q = (t, e) => e.reduce((n, r) => _(n) ? n : n[r], t), j = (t, e, n) => {
|
|
1253
1322
|
if (e.length === 0)
|
|
1254
|
-
return
|
|
1255
|
-
const [
|
|
1256
|
-
return _(t) ? t :
|
|
1257
|
-
},
|
|
1323
|
+
return n;
|
|
1324
|
+
const [r, ...o] = e;
|
|
1325
|
+
return _(t) ? t : r === "a" ? { ...t, a: j(t.a, o, n) } : { ...t, b: j(t.b, o, n) };
|
|
1326
|
+
}, V = (t, e, n = []) => {
|
|
1258
1327
|
if (_(t))
|
|
1259
1328
|
return t.groupId === e ? { splitPath: null, side: null } : null;
|
|
1260
1329
|
if (_(t.a) && t.a.groupId === e)
|
|
1261
|
-
return { splitPath:
|
|
1330
|
+
return { splitPath: n, side: "a" };
|
|
1262
1331
|
if (_(t.b) && t.b.groupId === e)
|
|
1263
|
-
return { splitPath:
|
|
1264
|
-
const
|
|
1265
|
-
return
|
|
1266
|
-
},
|
|
1267
|
-
const o =
|
|
1332
|
+
return { splitPath: n, side: "b" };
|
|
1333
|
+
const r = V(t.a, e, [...n, "a"]);
|
|
1334
|
+
return r || V(t.b, e, [...n, "b"]);
|
|
1335
|
+
}, Tt = (t, e, n, r) => {
|
|
1336
|
+
const o = r(), s = V(t, e), a = {
|
|
1268
1337
|
type: "split",
|
|
1269
|
-
direction:
|
|
1338
|
+
direction: n,
|
|
1270
1339
|
ratio: 0.5,
|
|
1271
1340
|
a: { type: "group", groupId: e },
|
|
1272
1341
|
b: { type: "group", groupId: o }
|
|
@@ -1276,139 +1345,139 @@ const he = (t, e) => {
|
|
|
1276
1345
|
const i = s.splitPath, c = q(t, i);
|
|
1277
1346
|
if (_(c))
|
|
1278
1347
|
return { tree: a, newGroupId: o };
|
|
1279
|
-
const
|
|
1280
|
-
return { tree: j(t, i,
|
|
1281
|
-
},
|
|
1282
|
-
const
|
|
1283
|
-
if (!
|
|
1348
|
+
const d = s.side === "a" ? { ...c, a } : { ...c, b: a };
|
|
1349
|
+
return { tree: j(t, i, d), newGroupId: o };
|
|
1350
|
+
}, ze = (t, e) => {
|
|
1351
|
+
const n = V(t, e);
|
|
1352
|
+
if (!n || n.splitPath === null)
|
|
1284
1353
|
return { tree: t, survivorGroupId: e };
|
|
1285
|
-
const
|
|
1354
|
+
const r = n.splitPath, o = q(t, r);
|
|
1286
1355
|
if (_(o))
|
|
1287
1356
|
return { tree: t, survivorGroupId: e };
|
|
1288
|
-
const s =
|
|
1357
|
+
const s = n.side === "a" ? o.b : o.a, a = j(t, r, s), i = _(s) ? s.groupId : Y(s)[0] ?? null;
|
|
1289
1358
|
return { tree: a, survivorGroupId: i };
|
|
1290
|
-
},
|
|
1291
|
-
const
|
|
1292
|
-
if (_(
|
|
1359
|
+
}, $e = (t, e, n) => {
|
|
1360
|
+
const r = q(t, e);
|
|
1361
|
+
if (_(r))
|
|
1293
1362
|
return t;
|
|
1294
|
-
const o = { ...
|
|
1363
|
+
const o = { ...r, ratio: M(n, 0.05, 0.95) };
|
|
1295
1364
|
return j(t, e, o);
|
|
1296
1365
|
}, Q = (t) => {
|
|
1297
1366
|
if (Object.keys(t.groups).filter((o) => t.groups[o].tabIds.length === 0).length === 0)
|
|
1298
1367
|
return t;
|
|
1299
|
-
const
|
|
1368
|
+
const r = (o, s) => {
|
|
1300
1369
|
const a = o.groups[s];
|
|
1301
1370
|
if (!a || a.tabs.length > 0 || Object.keys(o.groups).length <= 1)
|
|
1302
1371
|
return o;
|
|
1303
|
-
const { tree: c, survivorGroupId:
|
|
1304
|
-
return { ...o, tree: c, groups:
|
|
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;
|
|
1373
|
+
return { ...o, tree: c, groups: p, groupOrder: g, focusedGroupId: v };
|
|
1305
1374
|
};
|
|
1306
|
-
return t.groupOrder.reduce((o, s) =>
|
|
1307
|
-
},
|
|
1375
|
+
return t.groupOrder.reduce((o, s) => r(o, s), t);
|
|
1376
|
+
}, Fe = (t) => ({ id: t, tabIds: [], tabs: [], activeTabId: null }), ut = (t, e, n, r) => {
|
|
1308
1377
|
const o = { ...t.groups }, s = o[e];
|
|
1309
1378
|
if (!s)
|
|
1310
1379
|
throw new Error(`Group ${e} does not exist.`);
|
|
1311
|
-
const a = { ...t.panels, [
|
|
1312
|
-
return o[e] =
|
|
1313
|
-
},
|
|
1314
|
-
const
|
|
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) => {
|
|
1383
|
+
const r = { ...t.groups }, o = r[e];
|
|
1315
1384
|
if (!o)
|
|
1316
1385
|
throw new Error(`Group ${e} does not exist.`);
|
|
1317
|
-
const s = o.tabIds.filter((c) => c !==
|
|
1318
|
-
return
|
|
1319
|
-
},
|
|
1320
|
-
const s = t.groups[e], a = t.groups[
|
|
1386
|
+
const s = o.tabIds.filter((c) => c !== n), a = s.map((c) => t.panels[c]), i = o.activeTabId === n ? s[0] ?? null : o.activeTabId;
|
|
1387
|
+
return r[e] = { ...o, tabIds: s, tabs: a, activeTabId: i }, { ...t, groups: r };
|
|
1388
|
+
}, lt = (t, e, n, r, o) => {
|
|
1389
|
+
const s = t.groups[e], a = t.groups[n];
|
|
1321
1390
|
if (!s || !a)
|
|
1322
1391
|
throw new Error("moveTab: source or target group is missing.");
|
|
1323
|
-
const i = { ...t.groups }, c = s.tabIds.filter((
|
|
1324
|
-
return i[e] = { ...s, tabIds: c, tabs: c.map((
|
|
1325
|
-
},
|
|
1326
|
-
const
|
|
1327
|
-
if (!
|
|
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 };
|
|
1394
|
+
}, St = (t, e, n) => {
|
|
1395
|
+
const r = t.groups[e];
|
|
1396
|
+
if (!r)
|
|
1328
1397
|
throw new Error(`setActiveTab: group ${e} not found.`);
|
|
1329
|
-
if (!
|
|
1330
|
-
throw new Error(`setActiveTab: tab ${
|
|
1331
|
-
const o = { ...t.groups, [e]: { ...
|
|
1398
|
+
if (!r.tabIds.some((s) => s === n))
|
|
1399
|
+
throw new Error(`setActiveTab: tab ${n} not found in group ${e}.`);
|
|
1400
|
+
const o = { ...t.groups, [e]: { ...r, activeTabId: n } };
|
|
1332
1401
|
return { ...t, groups: o, focusedGroupId: e };
|
|
1333
|
-
},
|
|
1402
|
+
}, dt = (t, e, n, r, o) => {
|
|
1334
1403
|
const s = t.groups[e];
|
|
1335
1404
|
if (!s)
|
|
1336
1405
|
throw new Error(`addTabToGroupAtIndex: group ${e} not found.`);
|
|
1337
|
-
const a = { ...t.panels, [
|
|
1338
|
-
i.splice(c, 0,
|
|
1339
|
-
const
|
|
1340
|
-
return { ...t, panels: a, groups:
|
|
1406
|
+
const a = { ...t.panels, [n.id]: n }, i = s.tabIds.slice(), c = Math.max(0, Math.min(r, i.length));
|
|
1407
|
+
i.splice(c, 0, n.id);
|
|
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 } };
|
|
1409
|
+
return { ...t, panels: a, groups: p };
|
|
1341
1410
|
}, N = (t, e) => {
|
|
1342
1411
|
if (!t.groups[e])
|
|
1343
1412
|
throw new Error(`setFocusedGroup: group ${e} not found.`);
|
|
1344
1413
|
return { ...t, focusedGroupId: e };
|
|
1345
|
-
},
|
|
1346
|
-
const
|
|
1347
|
-
return
|
|
1348
|
-
},
|
|
1349
|
-
const e = t.groupOrder,
|
|
1350
|
-
if (!
|
|
1414
|
+
}, Ye = (t, e) => {
|
|
1415
|
+
const n = e - 1, r = t.groupOrder[n];
|
|
1416
|
+
return r ? N(t, r) : t;
|
|
1417
|
+
}, je = (t) => {
|
|
1418
|
+
const e = t.groupOrder, n = t.focusedGroupId;
|
|
1419
|
+
if (!n) {
|
|
1351
1420
|
const s = e[0];
|
|
1352
1421
|
return s ? N(t, s) : t;
|
|
1353
1422
|
}
|
|
1354
|
-
const
|
|
1423
|
+
const r = e.indexOf(n), o = e[(r + 1) % e.length];
|
|
1355
1424
|
return N(t, o);
|
|
1356
|
-
},
|
|
1357
|
-
const e = t.groupOrder,
|
|
1358
|
-
if (!
|
|
1425
|
+
}, Ue = (t) => {
|
|
1426
|
+
const e = t.groupOrder, n = t.focusedGroupId;
|
|
1427
|
+
if (!n) {
|
|
1359
1428
|
const s = e[e.length - 1];
|
|
1360
1429
|
return s ? N(t, s) : t;
|
|
1361
1430
|
}
|
|
1362
|
-
const
|
|
1431
|
+
const r = e.indexOf(n), o = e[(r - 1 + e.length) % e.length];
|
|
1363
1432
|
return N(t, o);
|
|
1364
|
-
},
|
|
1365
|
-
const { tree: o, newGroupId: s } =
|
|
1433
|
+
}, xt = (t, e, n, r) => {
|
|
1434
|
+
const { tree: o, newGroupId: s } = Tt(t.tree, e, n, r), a = { ...t.groups, [s]: Fe(s) }, i = Y(o);
|
|
1366
1435
|
return { ...t, tree: o, groups: a, groupOrder: i, focusedGroupId: s };
|
|
1367
|
-
},
|
|
1368
|
-
const
|
|
1369
|
-
return { tree:
|
|
1370
|
-
},
|
|
1371
|
-
const t =
|
|
1436
|
+
}, Dn = (t) => {
|
|
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 } };
|
|
1438
|
+
return { tree: n, panels: r, groups: s, groupOrder: ["g_1"], focusedGroupId: "g_1" };
|
|
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);
|
|
1372
1441
|
if (!t)
|
|
1373
1442
|
throw new Error("useTree must be used within TreeProvider");
|
|
1374
1443
|
return t;
|
|
1375
|
-
},
|
|
1376
|
-
const e =
|
|
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) => {
|
|
1445
|
+
const e = Bt(t, Number.POSITIVE_INFINITY);
|
|
1377
1446
|
return M(e, 1);
|
|
1378
|
-
},
|
|
1447
|
+
}, Qe = (t) => typeof t == "object" && t !== null, tn = (t) => Qe(t) ? "rows" in t ? !0 : "cols" in t : !1, Ct = (t) => {
|
|
1379
1448
|
if (!t)
|
|
1380
1449
|
return {
|
|
1381
1450
|
rows: Number.POSITIVE_INFINITY,
|
|
1382
1451
|
cols: Number.POSITIVE_INFINITY
|
|
1383
1452
|
};
|
|
1384
1453
|
if (typeof t == "number") {
|
|
1385
|
-
const
|
|
1386
|
-
return { rows:
|
|
1454
|
+
const n = F(t);
|
|
1455
|
+
return { rows: n, cols: n };
|
|
1387
1456
|
}
|
|
1388
|
-
if (
|
|
1457
|
+
if (tn(t))
|
|
1389
1458
|
return {
|
|
1390
|
-
rows:
|
|
1391
|
-
cols:
|
|
1459
|
+
rows: F(t.rows),
|
|
1460
|
+
cols: F(t.cols)
|
|
1392
1461
|
};
|
|
1393
1462
|
const e = t;
|
|
1394
1463
|
return {
|
|
1395
|
-
rows:
|
|
1396
|
-
cols:
|
|
1464
|
+
rows: F(e.maxHorizontal),
|
|
1465
|
+
cols: F(e.maxVertical)
|
|
1397
1466
|
};
|
|
1398
1467
|
}, tt = (t) => {
|
|
1399
1468
|
if (_(t))
|
|
1400
1469
|
return { horizontal: 1, vertical: 1 };
|
|
1401
|
-
const e = tt(t.a),
|
|
1402
|
-
return t.direction === "horizontal" ? { horizontal: e.horizontal +
|
|
1403
|
-
},
|
|
1404
|
-
const { tree:
|
|
1405
|
-
return
|
|
1406
|
-
},
|
|
1407
|
-
if (!Number.isFinite(
|
|
1470
|
+
const e = tt(t.a), n = tt(t.b);
|
|
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 };
|
|
1472
|
+
}, en = (t, e, n) => {
|
|
1473
|
+
const { tree: r } = Tt(t, e, n, () => "__preview__");
|
|
1474
|
+
return r;
|
|
1475
|
+
}, rt = (t, e, n, r) => {
|
|
1476
|
+
if (!Number.isFinite(r.rows) && !Number.isFinite(r.cols))
|
|
1408
1477
|
return !0;
|
|
1409
|
-
const o =
|
|
1410
|
-
return !(s.horizontal >
|
|
1411
|
-
},
|
|
1478
|
+
const o = en(t, e, n), s = tt(o);
|
|
1479
|
+
return !(s.horizontal > r.rows || s.vertical > r.cols);
|
|
1480
|
+
}, Et = {
|
|
1412
1481
|
splitFocused: A("panelState/splitFocused", (t) => ({ direction: t })),
|
|
1413
1482
|
focusGroupIndex: A("panelState/focusGroupIndex", (t) => ({ index1Based: t })),
|
|
1414
1483
|
focusNextGroup: A("panelState/focusNextGroup"),
|
|
@@ -1432,137 +1501,137 @@ const he = (t, e) => {
|
|
|
1432
1501
|
(t) => t
|
|
1433
1502
|
),
|
|
1434
1503
|
adjustSplitRatio: A("panelState/adjustSplitRatio", (t) => t)
|
|
1435
|
-
},
|
|
1436
|
-
const
|
|
1437
|
-
if (!
|
|
1504
|
+
}, nn = (t, e, n) => {
|
|
1505
|
+
const r = t.groups[e.fromGroupId], o = t.groups[e.targetGroupId];
|
|
1506
|
+
if (!r || !o || !r.tabs.find((p) => p.id === e.tabId))
|
|
1438
1507
|
return t;
|
|
1439
1508
|
if (e.zone === "center" && e.fromGroupId === e.targetGroupId)
|
|
1440
|
-
return
|
|
1509
|
+
return St(t, e.fromGroupId, e.tabId);
|
|
1441
1510
|
if (e.zone === "center") {
|
|
1442
|
-
const
|
|
1443
|
-
return N(
|
|
1511
|
+
const p = lt(t, e.fromGroupId, e.targetGroupId, e.tabId);
|
|
1512
|
+
return N(p, e.targetGroupId);
|
|
1444
1513
|
}
|
|
1445
1514
|
const a = e.zone === "left" || e.zone === "right" ? "vertical" : "horizontal";
|
|
1446
|
-
if (!
|
|
1515
|
+
if (!rt(t.tree, e.targetGroupId, a, n.splitLimits))
|
|
1447
1516
|
return t;
|
|
1448
|
-
const i =
|
|
1449
|
-
return N(
|
|
1450
|
-
},
|
|
1451
|
-
const
|
|
1452
|
-
if (!
|
|
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) => {
|
|
1520
|
+
const n = t.groups[e.fromGroupId], r = t.groups[e.targetGroupId];
|
|
1521
|
+
if (!n || !r || !t.panels[e.tabId])
|
|
1453
1522
|
return t;
|
|
1454
1523
|
if (e.fromGroupId === e.targetGroupId) {
|
|
1455
|
-
const g =
|
|
1456
|
-
return { ...t, groups:
|
|
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 } };
|
|
1525
|
+
return { ...t, groups: w };
|
|
1457
1526
|
}
|
|
1458
|
-
const s = { ...t.groups }, a =
|
|
1527
|
+
const s = { ...t.groups }, a = n.tabIds.filter((g) => g !== e.tabId), i = a.map((g) => t.panels[g]);
|
|
1459
1528
|
s[e.fromGroupId] = {
|
|
1460
|
-
...
|
|
1529
|
+
...n,
|
|
1461
1530
|
tabIds: a,
|
|
1462
1531
|
tabs: i,
|
|
1463
|
-
activeTabId:
|
|
1532
|
+
activeTabId: n.activeTabId === e.tabId ? i[0]?.id ?? null : n.activeTabId
|
|
1464
1533
|
};
|
|
1465
|
-
const c =
|
|
1466
|
-
return s[e.targetGroupId] = { ...
|
|
1467
|
-
},
|
|
1468
|
-
splitFocused: (t, e,
|
|
1469
|
-
const
|
|
1470
|
-
return !
|
|
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, {
|
|
1537
|
+
splitFocused: (t, e, n) => {
|
|
1538
|
+
const r = t.focusedGroupId ?? t.groupOrder[0] ?? null;
|
|
1539
|
+
return !r || !rt(t.tree, r, e.payload.direction, n.splitLimits) ? t : xt(t, r, e.payload.direction, n.createGroupId);
|
|
1471
1540
|
},
|
|
1472
|
-
focusGroupIndex: (t, e) =>
|
|
1473
|
-
focusNextGroup: (t) =>
|
|
1474
|
-
focusPrevGroup: (t) =>
|
|
1475
|
-
setActiveTab: (t, e) =>
|
|
1541
|
+
focusGroupIndex: (t, e) => Ye(t, e.payload.index1Based),
|
|
1542
|
+
focusNextGroup: (t) => je(t),
|
|
1543
|
+
focusPrevGroup: (t) => Ue(t),
|
|
1544
|
+
setActiveTab: (t, e) => St(t, e.payload.groupId, e.payload.tabId),
|
|
1476
1545
|
addTab: (t, e) => {
|
|
1477
|
-
const { groupId:
|
|
1478
|
-
return typeof o == "number" ?
|
|
1546
|
+
const { groupId: n, tab: r, index: o, makeActive: s } = e.payload;
|
|
1547
|
+
return typeof o == "number" ? dt(t, n, r, o, s ?? !0) : ut(t, n, r, s ?? !0);
|
|
1479
1548
|
},
|
|
1480
|
-
addNewTab: (t, e,
|
|
1481
|
-
if (!
|
|
1549
|
+
addNewTab: (t, e, n) => {
|
|
1550
|
+
if (!n.createPanelId)
|
|
1482
1551
|
throw new Error("addNewTab requires PanelSystemProvider.createPanelId");
|
|
1483
|
-
const o = { id:
|
|
1484
|
-
return typeof a == "number" ?
|
|
1552
|
+
const o = { id: n.createPanelId(), title: e.payload.title, render: () => e.payload.title }, { groupId: s, index: a, makeActive: i } = e.payload;
|
|
1553
|
+
return typeof a == "number" ? dt(t, s, o, a, i ?? !0) : ut(t, s, o, i ?? !0);
|
|
1485
1554
|
},
|
|
1486
|
-
removeTab: (t, e) =>
|
|
1487
|
-
contentDrop: (t, e,
|
|
1488
|
-
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),
|
|
1489
1558
|
adjustSplitRatio: (t, e) => {
|
|
1490
|
-
const
|
|
1491
|
-
if (_(
|
|
1559
|
+
const n = q(t.tree, e.payload.path);
|
|
1560
|
+
if (_(n))
|
|
1492
1561
|
return t;
|
|
1493
|
-
const
|
|
1494
|
-
return { ...t, tree:
|
|
1562
|
+
const r = $e(t.tree, e.payload.path, n.ratio + e.payload.deltaRatio);
|
|
1563
|
+
return { ...t, tree: r };
|
|
1495
1564
|
}
|
|
1496
|
-
}),
|
|
1497
|
-
const
|
|
1498
|
-
if (!
|
|
1565
|
+
}), pt = (t, e, n) => {
|
|
1566
|
+
const r = on[e.type];
|
|
1567
|
+
if (!r)
|
|
1499
1568
|
return t;
|
|
1500
|
-
const o =
|
|
1569
|
+
const o = r(t, e, n);
|
|
1501
1570
|
return Q(o);
|
|
1502
|
-
},
|
|
1503
|
-
const t =
|
|
1571
|
+
}, Rt = u.createContext(null), $ = () => {
|
|
1572
|
+
const t = u.useContext(Rt);
|
|
1504
1573
|
if (!t)
|
|
1505
1574
|
throw new Error("usePanelSystem must be used within PanelSystemProvider");
|
|
1506
1575
|
return t;
|
|
1507
|
-
},
|
|
1576
|
+
}, sn = ({
|
|
1508
1577
|
initialState: t,
|
|
1509
1578
|
createGroupId: e,
|
|
1510
|
-
createPanelId:
|
|
1511
|
-
state:
|
|
1579
|
+
createPanelId: n,
|
|
1580
|
+
state: r,
|
|
1512
1581
|
onStateChange: o,
|
|
1513
1582
|
splitLimits: s,
|
|
1514
1583
|
children: a
|
|
1515
1584
|
}) => {
|
|
1516
|
-
const i =
|
|
1517
|
-
|
|
1518
|
-
const [
|
|
1519
|
-
(
|
|
1585
|
+
const i = u.useMemo(() => Q(t), [t]), c = u.useMemo(() => Ct(s), [s]), d = u.useRef({ createGroupId: e, splitLimits: c, createPanelId: n });
|
|
1586
|
+
d.current.createGroupId = e, d.current.splitLimits = c, d.current.createPanelId = n;
|
|
1587
|
+
const [l, p] = u.useReducer(
|
|
1588
|
+
(S, C) => pt(S, C, d.current),
|
|
1520
1589
|
i
|
|
1521
|
-
), g =
|
|
1522
|
-
() =>
|
|
1523
|
-
[
|
|
1524
|
-
),
|
|
1525
|
-
|
|
1526
|
-
const
|
|
1527
|
-
(
|
|
1528
|
-
if (
|
|
1529
|
-
const
|
|
1530
|
-
o?.(
|
|
1590
|
+
), g = u.useMemo(
|
|
1591
|
+
() => r ? Q(r) : l,
|
|
1592
|
+
[r, l]
|
|
1593
|
+
), v = u.useRef(g);
|
|
1594
|
+
v.current = g;
|
|
1595
|
+
const b = r !== void 0, I = u.useCallback(
|
|
1596
|
+
(S) => {
|
|
1597
|
+
if (b) {
|
|
1598
|
+
const C = pt(v.current, S, d.current);
|
|
1599
|
+
o?.(C);
|
|
1531
1600
|
return;
|
|
1532
1601
|
}
|
|
1533
|
-
|
|
1602
|
+
p(S);
|
|
1534
1603
|
},
|
|
1535
|
-
[
|
|
1536
|
-
),
|
|
1604
|
+
[b, o, p]
|
|
1605
|
+
), w = u.useMemo(() => Ie(Et, I), [I]), T = u.useMemo(
|
|
1537
1606
|
() => ({
|
|
1538
|
-
setActiveTab:
|
|
1539
|
-
tabDrop:
|
|
1607
|
+
setActiveTab: w.setActiveTab,
|
|
1608
|
+
tabDrop: w.tabDrop
|
|
1540
1609
|
}),
|
|
1541
|
-
[
|
|
1542
|
-
),
|
|
1610
|
+
[w]
|
|
1611
|
+
), h = u.useMemo(
|
|
1543
1612
|
() => ({
|
|
1544
|
-
adjustSplitRatio:
|
|
1613
|
+
adjustSplitRatio: w.adjustSplitRatio
|
|
1545
1614
|
}),
|
|
1546
|
-
[
|
|
1547
|
-
),
|
|
1615
|
+
[w]
|
|
1616
|
+
), y = u.useMemo(
|
|
1548
1617
|
() => ({
|
|
1549
|
-
focusGroupIndex:
|
|
1550
|
-
focusNextGroup:
|
|
1551
|
-
focusPrevGroup:
|
|
1618
|
+
focusGroupIndex: w.focusGroupIndex,
|
|
1619
|
+
focusNextGroup: w.focusNextGroup,
|
|
1620
|
+
focusPrevGroup: w.focusPrevGroup
|
|
1552
1621
|
}),
|
|
1553
|
-
[
|
|
1554
|
-
),
|
|
1622
|
+
[w]
|
|
1623
|
+
), f = u.useMemo(
|
|
1555
1624
|
() => ({
|
|
1556
1625
|
state: g,
|
|
1557
|
-
dispatch:
|
|
1558
|
-
actions:
|
|
1626
|
+
dispatch: I,
|
|
1627
|
+
actions: w
|
|
1559
1628
|
}),
|
|
1560
|
-
[g,
|
|
1629
|
+
[g, I, w]
|
|
1561
1630
|
);
|
|
1562
|
-
return /* @__PURE__ */ m(
|
|
1563
|
-
},
|
|
1564
|
-
const { actions: t } =
|
|
1565
|
-
return
|
|
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 = () => {
|
|
1633
|
+
const { actions: t } = $();
|
|
1634
|
+
return u.useMemo(
|
|
1566
1635
|
() => ({
|
|
1567
1636
|
splitFocused: (e) => {
|
|
1568
1637
|
t.splitFocused(e);
|
|
@@ -1581,341 +1650,342 @@ const he = (t, e) => {
|
|
|
1581
1650
|
}),
|
|
1582
1651
|
[t]
|
|
1583
1652
|
);
|
|
1584
|
-
},
|
|
1585
|
-
const { actions: t } =
|
|
1586
|
-
({ fromGroupId:
|
|
1587
|
-
t.contentDrop({ fromGroupId:
|
|
1653
|
+
}, cn = () => {
|
|
1654
|
+
const { actions: t } = $(), e = u.useCallback(
|
|
1655
|
+
({ fromGroupId: r, tabId: o, targetGroupId: s, zone: a }) => {
|
|
1656
|
+
t.contentDrop({ fromGroupId: r, tabId: o, targetGroupId: s, zone: a });
|
|
1588
1657
|
},
|
|
1589
1658
|
[t]
|
|
1590
|
-
),
|
|
1591
|
-
({ fromGroupId:
|
|
1592
|
-
t.tabDrop({ fromGroupId:
|
|
1659
|
+
), n = u.useCallback(
|
|
1660
|
+
({ fromGroupId: r, tabId: o, targetGroupId: s, targetIndex: a }) => {
|
|
1661
|
+
t.tabDrop({ fromGroupId: r, tabId: o, targetGroupId: s, targetIndex: a });
|
|
1593
1662
|
},
|
|
1594
1663
|
[t]
|
|
1595
1664
|
);
|
|
1596
|
-
return { onCommitContentDrop: e, onCommitTabDrop:
|
|
1597
|
-
},
|
|
1598
|
-
const t =
|
|
1599
|
-
return
|
|
1600
|
-
|
|
1665
|
+
return { onCommitContentDrop: e, onCommitTabDrop: n };
|
|
1666
|
+
}, un = () => {
|
|
1667
|
+
const t = oe(), e = an();
|
|
1668
|
+
return u.useEffect(() => {
|
|
1669
|
+
ae(t, e);
|
|
1601
1670
|
}, [t, e]), null;
|
|
1602
|
-
},
|
|
1603
|
-
const t =
|
|
1671
|
+
}, Pt = u.createContext(null), ln = () => {
|
|
1672
|
+
const t = u.useContext(Pt);
|
|
1604
1673
|
if (!t)
|
|
1605
1674
|
throw new Error("useContentRegistry must be used within ContentRegistryProvider");
|
|
1606
1675
|
return t;
|
|
1607
|
-
},
|
|
1676
|
+
}, dn = (t) => {
|
|
1608
1677
|
const e = document.createElement("div");
|
|
1609
1678
|
return e.setAttribute("data-panel-wrapper", t), e.style.display = "contents", e;
|
|
1610
|
-
},
|
|
1611
|
-
const [
|
|
1612
|
-
return
|
|
1613
|
-
|
|
1614
|
-
}), [
|
|
1615
|
-
},
|
|
1616
|
-
({ panelId: t, content: e, placement:
|
|
1617
|
-
const o =
|
|
1618
|
-
return
|
|
1619
|
-
/* @__PURE__ */ m(
|
|
1679
|
+
}, pn = (t, e, n) => {
|
|
1680
|
+
const [r] = u.useState(() => dn(t));
|
|
1681
|
+
return nt(() => (r.style.display = n ? "contents" : "none", e && r.parentElement !== e && e.appendChild(r), () => {
|
|
1682
|
+
r.parentElement?.removeChild(r);
|
|
1683
|
+
}), [r, e, n]), r;
|
|
1684
|
+
}, Dt = u.memo(
|
|
1685
|
+
({ panelId: t, content: e, placement: n, containerElement: r }) => {
|
|
1686
|
+
const o = n?.isActive ?? !1, s = pn(t, r, o);
|
|
1687
|
+
return ee(
|
|
1688
|
+
/* @__PURE__ */ m(u.Activity, { mode: o ? "visible" : "hidden", children: e }),
|
|
1620
1689
|
s
|
|
1621
1690
|
);
|
|
1622
1691
|
}
|
|
1623
1692
|
);
|
|
1624
|
-
|
|
1625
|
-
const
|
|
1693
|
+
Dt.displayName = "PanelContentHost";
|
|
1694
|
+
const fn = ({
|
|
1626
1695
|
children: t,
|
|
1627
1696
|
panels: e,
|
|
1628
|
-
placements:
|
|
1697
|
+
placements: n
|
|
1629
1698
|
}) => {
|
|
1630
|
-
const [
|
|
1631
|
-
o((
|
|
1632
|
-
const
|
|
1633
|
-
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;
|
|
1634
1703
|
});
|
|
1635
|
-
}, []),
|
|
1636
|
-
() => ({ registerContentContainer:
|
|
1637
|
-
[
|
|
1638
|
-
),
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
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: [
|
|
1646
1717
|
t,
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
if (!f)
|
|
1718
|
+
p.map((g) => {
|
|
1719
|
+
if (!e[g])
|
|
1650
1720
|
return null;
|
|
1651
|
-
const
|
|
1721
|
+
const b = n[g] ?? null, I = b ? r.get(b.groupId) ?? null : null, w = l(g);
|
|
1652
1722
|
return /* @__PURE__ */ m(
|
|
1653
|
-
|
|
1723
|
+
Dt,
|
|
1654
1724
|
{
|
|
1655
|
-
panelId:
|
|
1656
|
-
content:
|
|
1657
|
-
placement:
|
|
1658
|
-
containerElement:
|
|
1725
|
+
panelId: g,
|
|
1726
|
+
content: w,
|
|
1727
|
+
placement: b,
|
|
1728
|
+
containerElement: I
|
|
1659
1729
|
},
|
|
1660
|
-
|
|
1730
|
+
g
|
|
1661
1731
|
);
|
|
1662
1732
|
})
|
|
1663
1733
|
] });
|
|
1664
|
-
},
|
|
1734
|
+
}, gn = ({
|
|
1665
1735
|
children: t,
|
|
1666
1736
|
emptyContentComponent: e,
|
|
1667
|
-
doubleClickToAdd:
|
|
1737
|
+
doubleClickToAdd: n
|
|
1668
1738
|
}) => {
|
|
1669
|
-
const
|
|
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(
|
|
1670
1740
|
(T) => {
|
|
1671
|
-
const
|
|
1672
|
-
if (!
|
|
1741
|
+
const h = o.groups[T];
|
|
1742
|
+
if (!h)
|
|
1673
1743
|
return null;
|
|
1674
|
-
const
|
|
1675
|
-
return { ...
|
|
1744
|
+
const y = h.tabIds.map((f) => o.panels[f]).filter(Boolean);
|
|
1745
|
+
return { ...h, tabs: y };
|
|
1676
1746
|
},
|
|
1677
1747
|
[o.groups, o.panels]
|
|
1678
|
-
),
|
|
1748
|
+
), l = u.useCallback(
|
|
1679
1749
|
(T) => {
|
|
1680
|
-
const
|
|
1681
|
-
return !
|
|
1750
|
+
const h = o.groups[T];
|
|
1751
|
+
return !h || h.tabIds.length === 0 ? /* @__PURE__ */ m(c, {}) : null;
|
|
1682
1752
|
},
|
|
1683
1753
|
[o.groups, c]
|
|
1684
|
-
),
|
|
1685
|
-
s.setActiveTab(T,
|
|
1686
|
-
}, [s]), g =
|
|
1754
|
+
), p = u.useCallback((T, h) => {
|
|
1755
|
+
s.setActiveTab(T, h);
|
|
1756
|
+
}, [s]), g = u.useCallback((T) => {
|
|
1687
1757
|
s.addNewTab({ groupId: T, title: "New Tab", makeActive: !0 });
|
|
1688
|
-
}, [s]),
|
|
1689
|
-
s.removeTab(T,
|
|
1690
|
-
}, [s]),
|
|
1691
|
-
s.setActiveTab(
|
|
1692
|
-
}, [s,
|
|
1693
|
-
const
|
|
1694
|
-
!
|
|
1695
|
-
}, [o.groups,
|
|
1696
|
-
() => ({ getGroup:
|
|
1697
|
-
[
|
|
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]
|
|
1698
1768
|
);
|
|
1699
|
-
return /* @__PURE__ */ m(
|
|
1700
|
-
},
|
|
1769
|
+
return /* @__PURE__ */ m(pe, { value: w, children: t });
|
|
1770
|
+
}, bn = ({
|
|
1701
1771
|
children: t,
|
|
1702
1772
|
emptyContentComponent: e,
|
|
1703
|
-
doubleClickToAdd:
|
|
1773
|
+
doubleClickToAdd: n
|
|
1704
1774
|
}) => {
|
|
1705
|
-
const { state:
|
|
1775
|
+
const { state: r } = $(), o = u.useMemo(() => {
|
|
1706
1776
|
const s = {};
|
|
1707
|
-
for (const [a, i] of Object.entries(
|
|
1777
|
+
for (const [a, i] of Object.entries(r.groups))
|
|
1708
1778
|
for (const c of i.tabIds)
|
|
1709
1779
|
s[c] = {
|
|
1710
1780
|
groupId: a,
|
|
1711
1781
|
isActive: c === i.activeTabId
|
|
1712
1782
|
};
|
|
1713
1783
|
return s;
|
|
1714
|
-
}, [
|
|
1715
|
-
return /* @__PURE__ */ m(
|
|
1716
|
-
},
|
|
1784
|
+
}, [r.groups]);
|
|
1785
|
+
return /* @__PURE__ */ m(fn, { panels: r.panels, placements: o, children: /* @__PURE__ */ m(gn, { emptyContentComponent: e, doubleClickToAdd: n, children: t }) });
|
|
1786
|
+
}, X = (t, e, n, r) => {
|
|
1717
1787
|
if (_(t))
|
|
1718
|
-
return
|
|
1719
|
-
const o = t.direction, s = o === "vertical" ?
|
|
1720
|
-
if (
|
|
1721
|
-
const c =
|
|
1722
|
-
return
|
|
1788
|
+
return r;
|
|
1789
|
+
const o = t.direction, s = o === "vertical" ? n.x + n.w * t.ratio : n.y + n.h * t.ratio;
|
|
1790
|
+
if (r.push({ path: e, direction: o, parentRect: n, linePos: s }), o === "vertical") {
|
|
1791
|
+
const c = n.w * t.ratio, d = n.w - c;
|
|
1792
|
+
return X(t.a, [...e, "a"], { x: n.x, y: n.y, w: c, h: n.h }, r), X(t.b, [...e, "b"], { x: n.x + c, y: n.y, w: d, h: n.h }, r), r;
|
|
1723
1793
|
}
|
|
1724
|
-
const a =
|
|
1725
|
-
return
|
|
1726
|
-
},
|
|
1727
|
-
const { state: e } =
|
|
1728
|
-
if (
|
|
1794
|
+
const a = n.h * t.ratio, i = n.h - a;
|
|
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;
|
|
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);
|
|
1798
|
+
if (nt(() => {
|
|
1729
1799
|
const i = t.current;
|
|
1730
1800
|
if (!i)
|
|
1731
1801
|
return;
|
|
1732
1802
|
const c = () => {
|
|
1733
|
-
const
|
|
1734
|
-
s({ left:
|
|
1803
|
+
const v = i.getBoundingClientRect();
|
|
1804
|
+
s({ left: v.left, top: v.top, width: v.width, height: v.height });
|
|
1735
1805
|
};
|
|
1736
1806
|
c();
|
|
1737
|
-
function
|
|
1807
|
+
function d() {
|
|
1738
1808
|
try {
|
|
1739
|
-
const
|
|
1740
|
-
return typeof
|
|
1809
|
+
const v = window.ResizeObserver;
|
|
1810
|
+
return typeof v == "function" ? v : null;
|
|
1741
1811
|
} catch {
|
|
1742
1812
|
return null;
|
|
1743
1813
|
}
|
|
1744
1814
|
}
|
|
1745
|
-
const
|
|
1746
|
-
|
|
1815
|
+
const l = d(), p = l ? new l(() => c()) : null;
|
|
1816
|
+
p && p.observe(i);
|
|
1747
1817
|
const g = () => c();
|
|
1748
1818
|
return window.addEventListener("scroll", g, !0), () => {
|
|
1749
|
-
window.removeEventListener("scroll", g, !0),
|
|
1819
|
+
window.removeEventListener("scroll", g, !0), p && p.disconnect();
|
|
1750
1820
|
};
|
|
1751
1821
|
}, [t, e.tree]), !o)
|
|
1752
1822
|
return null;
|
|
1753
1823
|
const a = (i, c) => {
|
|
1754
|
-
const
|
|
1824
|
+
const d = {
|
|
1755
1825
|
left: o.left + o.width * i.parentRect.x / 100,
|
|
1756
1826
|
top: o.top + o.height * i.parentRect.y / 100,
|
|
1757
1827
|
width: o.width * i.parentRect.w / 100,
|
|
1758
1828
|
height: o.height * i.parentRect.h / 100
|
|
1759
|
-
},
|
|
1829
|
+
}, l = te;
|
|
1760
1830
|
if (i.direction === "vertical") {
|
|
1761
|
-
const
|
|
1831
|
+
const b = d.left + d.width * (i.linePos - i.parentRect.x) / i.parentRect.w, I = {
|
|
1762
1832
|
position: "fixed",
|
|
1763
|
-
left: `calc(${Math.round(
|
|
1764
|
-
top: Math.round(
|
|
1765
|
-
width:
|
|
1766
|
-
height: Math.round(
|
|
1833
|
+
left: `calc(${Math.round(b)}px - ${l} / 2)`,
|
|
1834
|
+
top: Math.round(d.top),
|
|
1835
|
+
width: l,
|
|
1836
|
+
height: Math.round(d.height),
|
|
1767
1837
|
cursor: "col-resize",
|
|
1768
1838
|
pointerEvents: "auto"
|
|
1769
1839
|
};
|
|
1770
|
-
return /* @__PURE__ */ m("div", { style:
|
|
1771
|
-
const
|
|
1772
|
-
|
|
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 });
|
|
1773
1843
|
} }) }, `split-${c}`);
|
|
1774
1844
|
}
|
|
1775
|
-
const
|
|
1845
|
+
const p = d.top + d.height * (i.linePos - i.parentRect.y) / i.parentRect.h, g = {
|
|
1776
1846
|
position: "fixed",
|
|
1777
|
-
left: Math.round(
|
|
1778
|
-
top: `calc(${Math.round(
|
|
1779
|
-
width: Math.round(
|
|
1780
|
-
height:
|
|
1847
|
+
left: Math.round(d.left),
|
|
1848
|
+
top: `calc(${Math.round(p)}px - ${l} / 2)`,
|
|
1849
|
+
width: Math.round(d.width),
|
|
1850
|
+
height: l,
|
|
1781
1851
|
cursor: "row-resize",
|
|
1782
1852
|
pointerEvents: "auto"
|
|
1783
1853
|
};
|
|
1784
|
-
return /* @__PURE__ */ m("div", { style: g, children: /* @__PURE__ */ m(ot, { direction: "horizontal", onResize: (
|
|
1785
|
-
const
|
|
1786
|
-
|
|
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;
|
|
1856
|
+
n({ path: i.path, deltaRatio: w });
|
|
1787
1857
|
} }) }, `split-${c}`);
|
|
1788
1858
|
};
|
|
1789
|
-
return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children:
|
|
1790
|
-
},
|
|
1859
|
+
return /* @__PURE__ */ m("div", { style: { position: "fixed", inset: 0, pointerEvents: "none" }, children: r.map((i, c) => a(i, c)) });
|
|
1860
|
+
}, mn = {
|
|
1791
1861
|
position: "relative",
|
|
1792
1862
|
display: "flex",
|
|
1793
1863
|
width: "100%",
|
|
1794
1864
|
height: "100%"
|
|
1795
|
-
},
|
|
1865
|
+
}, vn = ({
|
|
1796
1866
|
state: t,
|
|
1797
1867
|
layoutMode: e,
|
|
1798
|
-
gridTracksInteractive:
|
|
1799
|
-
view:
|
|
1868
|
+
gridTracksInteractive: n,
|
|
1869
|
+
view: r,
|
|
1800
1870
|
tabBarComponent: o,
|
|
1801
1871
|
panelGroupComponent: s
|
|
1802
1872
|
}) => {
|
|
1803
|
-
const a = (c) =>
|
|
1873
|
+
const a = (c) => r ? /* @__PURE__ */ m(r, { groupId: c }) : /* @__PURE__ */ m(Ee, { id: c, TabBarComponent: o, PanelGroupComponent: s });
|
|
1804
1874
|
if (e === "grid") {
|
|
1805
|
-
const c =
|
|
1875
|
+
const c = le(t, a, !!n);
|
|
1806
1876
|
return /* @__PURE__ */ m(st, { config: c.config, layers: c.layers });
|
|
1807
1877
|
}
|
|
1808
|
-
const i =
|
|
1878
|
+
const i = ue(t, a);
|
|
1809
1879
|
return /* @__PURE__ */ m(st, { config: i.config, layers: i.layers });
|
|
1810
|
-
},
|
|
1880
|
+
}, In = ({
|
|
1811
1881
|
containerRef: t,
|
|
1812
1882
|
layoutMode: e,
|
|
1813
|
-
gridTracksInteractive:
|
|
1814
|
-
dragThresholdPx:
|
|
1883
|
+
gridTracksInteractive: n,
|
|
1884
|
+
dragThresholdPx: r,
|
|
1815
1885
|
view: o,
|
|
1816
1886
|
style: s,
|
|
1817
1887
|
className: a,
|
|
1818
1888
|
tabBarComponent: i,
|
|
1819
1889
|
panelGroupComponent: c,
|
|
1820
|
-
splitLimits:
|
|
1821
|
-
emptyContentComponent:
|
|
1822
|
-
doubleClickToAdd:
|
|
1890
|
+
splitLimits: d,
|
|
1891
|
+
emptyContentComponent: l,
|
|
1892
|
+
doubleClickToAdd: p
|
|
1823
1893
|
}) => {
|
|
1824
|
-
const { state: g } =
|
|
1825
|
-
({ targetGroupId: T, zone:
|
|
1826
|
-
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")
|
|
1827
1897
|
return !0;
|
|
1828
|
-
const
|
|
1829
|
-
return
|
|
1898
|
+
const y = h === "left" || h === "right" ? "vertical" : "horizontal";
|
|
1899
|
+
return rt(g.tree, T, y, d);
|
|
1830
1900
|
},
|
|
1831
|
-
[g.tree,
|
|
1901
|
+
[g.tree, d]
|
|
1832
1902
|
);
|
|
1833
|
-
return /* @__PURE__ */ m(
|
|
1834
|
-
|
|
1903
|
+
return /* @__PURE__ */ m(fe, { children: /* @__PURE__ */ H(
|
|
1904
|
+
Te,
|
|
1835
1905
|
{
|
|
1836
1906
|
containerRef: t,
|
|
1837
|
-
dragThresholdPx:
|
|
1838
|
-
onCommitContentDrop:
|
|
1839
|
-
onCommitTabDrop:
|
|
1840
|
-
isContentZoneAllowed:
|
|
1907
|
+
dragThresholdPx: r,
|
|
1908
|
+
onCommitContentDrop: v,
|
|
1909
|
+
onCommitTabDrop: b,
|
|
1910
|
+
isContentZoneAllowed: w,
|
|
1841
1911
|
children: [
|
|
1842
|
-
/* @__PURE__ */ m(
|
|
1843
|
-
|
|
1912
|
+
/* @__PURE__ */ m(bn, { emptyContentComponent: l, doubleClickToAdd: p, children: /* @__PURE__ */ m("div", { ref: t, className: a, style: I, children: /* @__PURE__ */ m(
|
|
1913
|
+
vn,
|
|
1844
1914
|
{
|
|
1845
1915
|
state: g,
|
|
1846
1916
|
layoutMode: e,
|
|
1847
|
-
gridTracksInteractive:
|
|
1917
|
+
gridTracksInteractive: n,
|
|
1848
1918
|
view: o,
|
|
1849
1919
|
tabBarComponent: i,
|
|
1850
1920
|
panelGroupComponent: c
|
|
1851
1921
|
}
|
|
1852
1922
|
) }) }),
|
|
1853
|
-
/* @__PURE__ */ m(
|
|
1854
|
-
/* @__PURE__ */ m(
|
|
1923
|
+
/* @__PURE__ */ m(hn, { containerRef: t }),
|
|
1924
|
+
/* @__PURE__ */ m(wn, {})
|
|
1855
1925
|
]
|
|
1856
1926
|
}
|
|
1857
1927
|
) });
|
|
1858
|
-
},
|
|
1928
|
+
}, wn = () => {
|
|
1859
1929
|
const t = W();
|
|
1860
1930
|
return /* @__PURE__ */ H(et, { children: [
|
|
1861
|
-
/* @__PURE__ */ m(
|
|
1862
|
-
/* @__PURE__ */ m(
|
|
1931
|
+
/* @__PURE__ */ m(_e, { suggest: t.suggest }),
|
|
1932
|
+
/* @__PURE__ */ m(Ne, {})
|
|
1863
1933
|
] });
|
|
1864
|
-
},
|
|
1934
|
+
}, An = ({
|
|
1865
1935
|
initialState: t,
|
|
1866
1936
|
createGroupId: e,
|
|
1867
|
-
createPanelId:
|
|
1868
|
-
layoutMode:
|
|
1937
|
+
createPanelId: n,
|
|
1938
|
+
layoutMode: r,
|
|
1869
1939
|
gridTracksInteractive: o,
|
|
1870
1940
|
dragThresholdPx: s,
|
|
1871
1941
|
view: a,
|
|
1872
1942
|
emptyContentComponent: i,
|
|
1873
1943
|
state: c,
|
|
1874
|
-
onStateChange:
|
|
1875
|
-
className:
|
|
1876
|
-
style:
|
|
1944
|
+
onStateChange: d,
|
|
1945
|
+
className: l,
|
|
1946
|
+
style: p,
|
|
1877
1947
|
tabBarComponent: g,
|
|
1878
|
-
panelGroupComponent:
|
|
1879
|
-
splitLimits:
|
|
1880
|
-
doubleClickToAdd:
|
|
1948
|
+
panelGroupComponent: v,
|
|
1949
|
+
splitLimits: b,
|
|
1950
|
+
doubleClickToAdd: I
|
|
1881
1951
|
}) => {
|
|
1882
1952
|
if (!t)
|
|
1883
1953
|
throw new Error("PanelSystem requires initialState.");
|
|
1884
1954
|
if (!e)
|
|
1885
1955
|
throw new Error("PanelSystem requires explicit createGroupId function.");
|
|
1886
|
-
if (!
|
|
1956
|
+
if (!r)
|
|
1887
1957
|
throw new Error("PanelSystem requires explicit layoutMode ('absolute' | 'grid').");
|
|
1888
|
-
if (
|
|
1958
|
+
if (r === "grid" && o === void 0)
|
|
1889
1959
|
throw new Error("PanelSystem(layoutMode='grid') requires explicit 'gridTracksInteractive' flag.");
|
|
1890
1960
|
if (s === void 0)
|
|
1891
1961
|
throw new Error("PanelSystem requires explicit 'dragThresholdPx' value.");
|
|
1892
|
-
const
|
|
1962
|
+
const w = u.useRef(null), T = u.useMemo(() => Ct(b), [b]);
|
|
1893
1963
|
return /* @__PURE__ */ m(
|
|
1894
|
-
|
|
1964
|
+
sn,
|
|
1895
1965
|
{
|
|
1896
1966
|
initialState: t,
|
|
1897
1967
|
createGroupId: e,
|
|
1898
|
-
createPanelId:
|
|
1968
|
+
createPanelId: n,
|
|
1899
1969
|
state: c,
|
|
1900
|
-
onStateChange:
|
|
1901
|
-
splitLimits:
|
|
1902
|
-
children: /* @__PURE__ */ H(
|
|
1903
|
-
/* @__PURE__ */ m(
|
|
1970
|
+
onStateChange: d,
|
|
1971
|
+
splitLimits: b,
|
|
1972
|
+
children: /* @__PURE__ */ H(ie, { children: [
|
|
1973
|
+
/* @__PURE__ */ m(un, {}),
|
|
1904
1974
|
/* @__PURE__ */ m(
|
|
1905
|
-
|
|
1975
|
+
In,
|
|
1906
1976
|
{
|
|
1907
|
-
containerRef:
|
|
1908
|
-
layoutMode:
|
|
1977
|
+
containerRef: w,
|
|
1978
|
+
layoutMode: r,
|
|
1909
1979
|
gridTracksInteractive: o,
|
|
1910
1980
|
dragThresholdPx: s,
|
|
1911
1981
|
view: a,
|
|
1912
|
-
style:
|
|
1913
|
-
className:
|
|
1982
|
+
style: p,
|
|
1983
|
+
className: l,
|
|
1914
1984
|
tabBarComponent: g,
|
|
1915
|
-
panelGroupComponent:
|
|
1985
|
+
panelGroupComponent: v,
|
|
1916
1986
|
splitLimits: T,
|
|
1917
1987
|
emptyContentComponent: i,
|
|
1918
|
-
doubleClickToAdd:
|
|
1988
|
+
doubleClickToAdd: I
|
|
1919
1989
|
}
|
|
1920
1990
|
)
|
|
1921
1991
|
] })
|
|
@@ -1923,16 +1993,18 @@ const ur = ({
|
|
|
1923
1993
|
);
|
|
1924
1994
|
};
|
|
1925
1995
|
export {
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1996
|
+
zn as CSS_VAR_PREFIX,
|
|
1997
|
+
_n as Drawer,
|
|
1998
|
+
On as DrawerLayers,
|
|
1999
|
+
Bn as FloatingWindow,
|
|
1929
2000
|
st as GridLayout,
|
|
1930
|
-
|
|
1931
|
-
|
|
2001
|
+
En as HorizontalDivider,
|
|
2002
|
+
An as PanelSystem,
|
|
1932
2003
|
ot as ResizeHandle,
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
2004
|
+
Dn as buildInitialState,
|
|
2005
|
+
Ln as runTransition,
|
|
2006
|
+
Pn as useFloatingState,
|
|
2007
|
+
Rn as useLayerDragHandle,
|
|
2008
|
+
Hn as useTransitionState
|
|
1937
2009
|
};
|
|
1938
2010
|
//# sourceMappingURL=index.js.map
|