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