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