@pasquelin/panels 0.3.0 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/components/PanelFrame.d.ts +4 -1
- package/dist/components/Rail.d.ts +2 -1
- package/dist/components/Surface.d.ts +2 -2
- package/dist/dockview.cjs +1 -1
- package/dist/dockview.js +27 -23
- package/dist/index.cjs +1 -1
- package/dist/index.js +467 -433
- package/dist/styles.css +1 -1
- package/llms-full.txt +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as u, jsxs as m, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import H, { useEffect as tn, useLayoutEffect as Bn, useState as J, useMemo as w, useContext as en, createContext as on, useRef as Z, useCallback as N, memo as Sn, Fragment as kn, Children as Dn, isValidElement as Hn } from "react";
|
|
3
3
|
import { c as b } from "./cx-CcykAxZN.js";
|
|
4
|
-
const
|
|
4
|
+
const un = (n) => {
|
|
5
5
|
let t;
|
|
6
6
|
const e = /* @__PURE__ */ new Set(), o = (a, d) => {
|
|
7
7
|
const f = typeof a == "function" ? a(t) : a;
|
|
8
8
|
if (!Object.is(f, t)) {
|
|
9
|
-
const
|
|
10
|
-
t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((
|
|
9
|
+
const p = t;
|
|
10
|
+
t = d ?? (typeof f != "object" || f === null) ? f : Object.assign({}, t, f), e.forEach((g) => g(t, p));
|
|
11
11
|
}
|
|
12
|
-
}, c = () => t,
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
function
|
|
16
|
-
const e =
|
|
12
|
+
}, c = () => t, r = { setState: o, getState: c, getInitialState: () => l, subscribe: (a) => (e.add(a), () => e.delete(a)) }, l = t = n(o, c, r);
|
|
13
|
+
return r;
|
|
14
|
+
}, jn = ((n) => n ? un(n) : un), Un = (n) => n;
|
|
15
|
+
function Vn(n, t = Un) {
|
|
16
|
+
const e = H.useSyncExternalStore(
|
|
17
17
|
n.subscribe,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
H.useCallback(() => t(n.getState()), [n, t]),
|
|
19
|
+
H.useCallback(() => t(n.getInitialState()), [n, t])
|
|
20
20
|
);
|
|
21
|
-
return
|
|
21
|
+
return H.useDebugValue(e), e;
|
|
22
22
|
}
|
|
23
|
-
const
|
|
24
|
-
function
|
|
23
|
+
const B = ["left", "right", "top", "bottomLeft", "bottomRight"], Pn = ["primary", "secondary"], rn = "default", Wn = ["bottomLeft", "bottomRight"];
|
|
24
|
+
function sn(n) {
|
|
25
25
|
return n === "bottomLeft" || n === "bottomRight";
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
return n === "top" ||
|
|
27
|
+
function T(n) {
|
|
28
|
+
return n === "top" || sn(n);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
30
|
+
const X = {
|
|
31
31
|
left: { column: ["left", "top"], band: "bottomLeft" },
|
|
32
32
|
right: { column: ["right"], band: "bottomRight" }
|
|
33
33
|
};
|
|
34
|
-
function
|
|
34
|
+
function dn(n) {
|
|
35
35
|
return n === "left" || n === "top";
|
|
36
36
|
}
|
|
37
|
-
const
|
|
37
|
+
const U = 140, Nn = 240, O = 100, Yn = {
|
|
38
38
|
left: 320,
|
|
39
39
|
right: 260,
|
|
40
40
|
top: 180,
|
|
41
41
|
bottomLeft: 240,
|
|
42
42
|
bottomRight: 240
|
|
43
43
|
}, _n = "bottomRight";
|
|
44
|
-
function
|
|
45
|
-
return
|
|
44
|
+
function V(n) {
|
|
45
|
+
return sn(n) ? _n : n;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
47
|
+
const C = {
|
|
48
48
|
left: "right",
|
|
49
49
|
right: "left",
|
|
50
50
|
// The band as a whole faces the top strip: either half of it takes the same height off.
|
|
@@ -55,192 +55,208 @@ const x = {
|
|
|
55
55
|
function In(n, t, e) {
|
|
56
56
|
return Math.min(Math.max(n, t), e);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
const o = Math.max(
|
|
60
|
-
return In(Math.round(n),
|
|
58
|
+
function En(n, t, e) {
|
|
59
|
+
const o = Math.max(U, Math.round(t - e - Nn));
|
|
60
|
+
return In(Math.round(n), U, o);
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
const e = Math.max(
|
|
64
|
-
return In(Math.round(n),
|
|
62
|
+
function W(n, t) {
|
|
63
|
+
const e = Math.max(O, Math.round(t - O));
|
|
64
|
+
return In(Math.round(n), O, e);
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
return e(t) ? n.sizes[
|
|
66
|
+
function Ln(n, t, e, o) {
|
|
67
|
+
return e(t) ? n.sizes[V(t)] ?? o(t) : 0;
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
const s = { ...n.sizes },
|
|
71
|
-
for (const l of
|
|
69
|
+
function $n(n, t, e, o, c) {
|
|
70
|
+
const s = { ...n.sizes }, i = { ...n.splits };
|
|
71
|
+
for (const l of B) {
|
|
72
72
|
const a = s[l];
|
|
73
73
|
if (a !== void 0) {
|
|
74
|
-
const f =
|
|
75
|
-
s[l] =
|
|
74
|
+
const f = T(l) ? e : t, p = Ln(n, C[l], o, c);
|
|
75
|
+
s[l] = En(a, f, p);
|
|
76
76
|
}
|
|
77
|
-
const d =
|
|
78
|
-
d !== void 0 && (
|
|
77
|
+
const d = i[l];
|
|
78
|
+
d !== void 0 && (i[l] = W(d, T(l) ? t : e));
|
|
79
79
|
}
|
|
80
|
-
const
|
|
81
|
-
return { sizes: s, splits:
|
|
80
|
+
const r = n.bandSplit === void 0 ? void 0 : W(n.bandSplit, t);
|
|
81
|
+
return { sizes: s, splits: i, bandSplit: r };
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const o = e -
|
|
83
|
+
function Gn(n, t, e) {
|
|
84
|
+
const o = e - Nn, c = n + t;
|
|
85
85
|
if (c <= o) return [n, t];
|
|
86
|
-
const s = (a) => a === 0 ? 0 :
|
|
87
|
-
if (o <=
|
|
86
|
+
const s = (a) => a === 0 ? 0 : U, i = s(n) + s(t);
|
|
87
|
+
if (o <= i)
|
|
88
88
|
return [Math.min(n, s(n)), Math.min(t, s(t))];
|
|
89
|
-
const
|
|
89
|
+
const r = o / c, l = Math.max(s(n), Math.round(n * r));
|
|
90
90
|
return [l, Math.max(s(t), Math.round(o - l))];
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function A(n) {
|
|
93
93
|
return n.views[n.view] ?? {};
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function G(n, t) {
|
|
96
96
|
const e = { ...t ?? {} };
|
|
97
|
-
for (const o of
|
|
98
|
-
for (const c of
|
|
99
|
-
e[o]?.[c] === void 0 &&
|
|
97
|
+
for (const o of B)
|
|
98
|
+
for (const c of Pn)
|
|
99
|
+
e[o]?.[c] === void 0 && xn(n, o, c) !== void 0 && (e[o] = { ...e[o], [c]: null });
|
|
100
100
|
return e;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function K(n, t) {
|
|
103
103
|
return Object.hasOwn(n.views, t);
|
|
104
104
|
}
|
|
105
|
-
function
|
|
105
|
+
function Jn(n, t) {
|
|
106
|
+
return n.length === t.length && n.every((e, o) => {
|
|
107
|
+
const c = t[o];
|
|
108
|
+
return c !== void 0 && e.id === c.id && e.zone === c.zone && e.slot === c.slot && e.title === c.title && e.opens === c.opens && e.solo === c.solo && e.fillActions === c.fillActions && e.icon === c.icon;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function xn(n, t, e) {
|
|
106
112
|
return n.find((o) => o.zone === t && o.slot === e);
|
|
107
113
|
}
|
|
108
|
-
function
|
|
114
|
+
function M(n, t) {
|
|
109
115
|
return t == null ? void 0 : n.find((e) => e.id === t);
|
|
110
116
|
}
|
|
111
|
-
function
|
|
112
|
-
const o =
|
|
117
|
+
function fn(n, t, e) {
|
|
118
|
+
const o = A(n)[t];
|
|
113
119
|
if (!o || !(e in o)) return;
|
|
114
|
-
const c =
|
|
115
|
-
return c?.zone === t && c.slot === e ? c :
|
|
116
|
-
}
|
|
117
|
-
function E(n, t) {
|
|
118
|
-
const e = dn(n, t, "primary");
|
|
119
|
-
return e?.solo === !0 ? { primary: e } : { primary: e, secondary: dn(n, t, "secondary") };
|
|
120
|
+
const c = M(n.registry, o[e]);
|
|
121
|
+
return c?.zone === t && c.slot === e ? c : xn(n.registry, t, e);
|
|
120
122
|
}
|
|
121
123
|
function L(n, t) {
|
|
122
|
-
const
|
|
124
|
+
const e = fn(n, t, "primary");
|
|
125
|
+
return e?.solo === !0 ? { primary: e } : { primary: e, secondary: fn(n, t, "secondary") };
|
|
126
|
+
}
|
|
127
|
+
function F(n, t) {
|
|
128
|
+
const { primary: e, secondary: o } = L(n, t);
|
|
123
129
|
return { primary: e?.id, secondary: o?.id };
|
|
124
130
|
}
|
|
125
|
-
function
|
|
126
|
-
return
|
|
131
|
+
function Y(n, t) {
|
|
132
|
+
return sn(t) ? Wn.some((e) => $(n, e)) : $(n, t);
|
|
127
133
|
}
|
|
128
|
-
function
|
|
129
|
-
const e =
|
|
134
|
+
function $(n, t) {
|
|
135
|
+
const e = F(n, t);
|
|
130
136
|
return e.primary !== void 0 || e.secondary !== void 0;
|
|
131
137
|
}
|
|
132
|
-
function
|
|
133
|
-
return Math.max(
|
|
138
|
+
function q(n, t) {
|
|
139
|
+
return Math.max(Yn[n], t?.opens ?? 0);
|
|
134
140
|
}
|
|
135
141
|
function Xn(n, t, e, o) {
|
|
136
|
-
const { slot: c, id: s } = e,
|
|
142
|
+
const { slot: c, id: s } = e, i = A(n)[t] ?? {}, r = { ...n.stashed };
|
|
137
143
|
if (e.solo === !0 && c === "primary")
|
|
138
|
-
return
|
|
139
|
-
if (o?.solo !== !0) return [{ ...
|
|
140
|
-
const l =
|
|
141
|
-
if (delete
|
|
142
|
-
const a = { ...
|
|
143
|
-
return c !== o.slot && delete a[o.slot], [a,
|
|
144
|
+
return r[t] = i, [{ [c]: s }, r];
|
|
145
|
+
if (o?.solo !== !0) return [{ ...i, [c]: s }, n.stashed];
|
|
146
|
+
const l = r[t];
|
|
147
|
+
if (delete r[t], l) return [{ ...l, [c]: s }, r];
|
|
148
|
+
const a = { ...i, [c]: s };
|
|
149
|
+
return c !== o.slot && delete a[o.slot], [a, r];
|
|
144
150
|
}
|
|
145
151
|
function Kn(n, t, e) {
|
|
146
|
-
const o =
|
|
147
|
-
if (s && c !== void 0 &&
|
|
148
|
-
const
|
|
149
|
-
return delete
|
|
152
|
+
const o = A(n)[t] ?? {}, c = o[e], s = n.stashed[t];
|
|
153
|
+
if (s && c !== void 0 && M(n.registry, c)?.solo === !0) {
|
|
154
|
+
const r = { ...n.stashed };
|
|
155
|
+
return delete r[t], [s, r];
|
|
150
156
|
}
|
|
151
|
-
const
|
|
152
|
-
return delete
|
|
157
|
+
const i = { ...o };
|
|
158
|
+
return delete i[e], [i, n.stashed];
|
|
159
|
+
}
|
|
160
|
+
const hn = { sizes: {}, splits: {} };
|
|
161
|
+
function qn(n, t) {
|
|
162
|
+
return n.bandSplit !== t.bandSplit ? !1 : B.every(
|
|
163
|
+
(e) => n.sizes[e] === t.sizes[e] && n.splits[e] === t.splits[e]
|
|
164
|
+
);
|
|
153
165
|
}
|
|
154
|
-
|
|
155
|
-
function qn(n = {}) {
|
|
166
|
+
function Qn(n = {}) {
|
|
156
167
|
const t = n.initial, e = (o, c) => ({
|
|
157
168
|
...o.views,
|
|
158
169
|
[o.view]: c
|
|
159
170
|
});
|
|
160
|
-
return
|
|
171
|
+
return jn()((o, c) => ({
|
|
161
172
|
registry: [],
|
|
162
|
-
view: n.view ??
|
|
173
|
+
view: n.view ?? rn,
|
|
163
174
|
views: t?.views ?? {},
|
|
164
|
-
lengths: t?.lengths ??
|
|
175
|
+
lengths: t?.lengths ?? hn,
|
|
165
176
|
focusedZone: null,
|
|
166
177
|
stashed: {},
|
|
167
178
|
available: { width: 0, height: 0 },
|
|
168
179
|
// The arrangement is left ALONE by a panel leaving the list: the half naming it falls back
|
|
169
180
|
// to what is still declared — see `resolve` — and names it again the day it comes back.
|
|
170
|
-
|
|
181
|
+
//
|
|
182
|
+
// 🛑 Compared, not written: a project builds this list in its render, so the identity is new
|
|
183
|
+
// every time an unrelated prop moves. Written through, every rail, every zone and every
|
|
184
|
+
// frame re-rendered for a list identical to the one they already held.
|
|
185
|
+
declare: (s) => o((i) => Jn(i.registry, s) ? i : { registry: s }),
|
|
171
186
|
// Having an entry in `views` IS the record of having been settled. No second field can then
|
|
172
187
|
// disagree about which views have been opened, or fall out of step when a reset clears them.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const i = s ?? r.defaults;
|
|
177
|
-
return J(r, r.view) ? i === r.defaults ? r : { defaults: i } : { views: e(r, $(r.registry, i)), defaults: i };
|
|
188
|
+
settle: (s) => o((i) => {
|
|
189
|
+
const r = s ?? i.defaults;
|
|
190
|
+
return K(i, i.view) ? r === i.defaults ? i : { defaults: r } : { views: e(i, G(i.registry, r)), defaults: r };
|
|
178
191
|
}),
|
|
179
192
|
// Settles the view it arrives at, rather than leaving that to the next render: a project
|
|
180
193
|
// driving the chassis from outside React would otherwise land on an empty frame.
|
|
181
|
-
setView: (s) => o((
|
|
194
|
+
setView: (s) => o((i) => i.view === s ? i : {
|
|
182
195
|
view: s,
|
|
183
|
-
views:
|
|
196
|
+
views: K(i, s) ? i.views : { ...i.views, [s]: G(i.registry, i.defaults) },
|
|
184
197
|
// Session state, and it belongs to the view being left: a zone accented on arrival is
|
|
185
198
|
// a zone nobody clicked, and a stash given back in another view would reopen a half
|
|
186
199
|
// there.
|
|
187
200
|
focusedZone: null,
|
|
188
201
|
stashed: {}
|
|
189
202
|
}),
|
|
190
|
-
show: (s) => o((
|
|
191
|
-
const
|
|
192
|
-
if (!
|
|
193
|
-
const { zone: l } =
|
|
194
|
-
if (a[
|
|
195
|
-
const [d, f] = Xn(
|
|
203
|
+
show: (s) => o((i) => {
|
|
204
|
+
const r = M(i.registry, s);
|
|
205
|
+
if (!r) return i;
|
|
206
|
+
const { zone: l } = r, a = L(i, l);
|
|
207
|
+
if (a[r.slot]?.id === s) return { focusedZone: l };
|
|
208
|
+
const [d, f] = Xn(i, l, r, a.primary);
|
|
196
209
|
return {
|
|
197
|
-
views: e(
|
|
210
|
+
views: e(i, { ...A(i), [l]: d }),
|
|
198
211
|
stashed: f,
|
|
199
212
|
focusedZone: l
|
|
200
213
|
};
|
|
201
214
|
}),
|
|
202
|
-
close: (s,
|
|
203
|
-
const [l, a] = Kn(
|
|
215
|
+
close: (s, i) => o((r) => {
|
|
216
|
+
const [l, a] = Kn(r, s, i), d = e(r, { ...A(r), [s]: l }), f = $({ registry: r.registry, view: r.view, views: d }, s);
|
|
204
217
|
return {
|
|
205
218
|
views: d,
|
|
206
219
|
stashed: a,
|
|
207
|
-
focusedZone: !f &&
|
|
220
|
+
focusedZone: !f && r.focusedZone === s ? null : r.focusedZone
|
|
208
221
|
};
|
|
209
222
|
}),
|
|
210
223
|
toggle: (s) => {
|
|
211
|
-
const
|
|
212
|
-
|
|
224
|
+
const i = c(), r = M(i.registry, s);
|
|
225
|
+
r && (F(i, r.zone)[r.slot] === s ? i.close(r.zone, r.slot) : i.show(s));
|
|
213
226
|
},
|
|
214
|
-
focus: (s) => o((
|
|
227
|
+
focus: (s) => o((i) => i.focusedZone === s ? i : { focusedZone: s }),
|
|
215
228
|
// Guarded: a drag past the ceiling clamps to the same number for as long as the pointer
|
|
216
229
|
// keeps going, and every write notifies every subscriber.
|
|
217
|
-
resize: (s,
|
|
218
|
-
const a =
|
|
230
|
+
resize: (s, i, r) => o((l) => {
|
|
231
|
+
const a = Ln(
|
|
219
232
|
l.lengths,
|
|
220
|
-
|
|
221
|
-
(
|
|
222
|
-
(
|
|
223
|
-
), d =
|
|
233
|
+
C[s],
|
|
234
|
+
(p) => Y(l, p),
|
|
235
|
+
(p) => q(p, L(l, p).primary)
|
|
236
|
+
), d = En(i, r, a), f = V(s);
|
|
224
237
|
return d === l.lengths.sizes[f] ? l : { lengths: { ...l.lengths, sizes: { ...l.lengths.sizes, [f]: d } } };
|
|
225
238
|
}),
|
|
226
|
-
resplit: (s,
|
|
227
|
-
const a =
|
|
239
|
+
resplit: (s, i, r) => o((l) => {
|
|
240
|
+
const a = W(i, r);
|
|
228
241
|
return a === l.lengths.splits[s] ? l : { lengths: { ...l.lengths, splits: { ...l.lengths.splits, [s]: a } } };
|
|
229
242
|
}),
|
|
230
|
-
resplitBand: (s,
|
|
231
|
-
const l =
|
|
232
|
-
return l ===
|
|
243
|
+
resplitBand: (s, i) => o((r) => {
|
|
244
|
+
const l = W(s, i);
|
|
245
|
+
return l === r.lengths.bandSplit ? r : { lengths: { ...r.lengths, bandSplit: l } };
|
|
233
246
|
}),
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
247
|
+
// Guarded like `resize`, and for a heavier reason: the observer fires on every frame of a
|
|
248
|
+
// window resize, and the persistence subscriber compares `lengths` by reference. A fresh
|
|
249
|
+
// object carrying the same numbers had each of those frames re-serialising the whole file.
|
|
250
|
+
fit: (s, i) => o((r) => {
|
|
251
|
+
const l = $n(
|
|
252
|
+
r.lengths,
|
|
238
253
|
s,
|
|
239
|
-
|
|
240
|
-
(
|
|
241
|
-
(
|
|
242
|
-
)
|
|
243
|
-
|
|
254
|
+
i,
|
|
255
|
+
(f) => Y(r, f),
|
|
256
|
+
(f) => q(f, L(r, f).primary)
|
|
257
|
+
), a = qn(r.lengths, l) ? r.lengths : l, { available: d } = r;
|
|
258
|
+
return a === r.lengths && d.width === s && d.height === i ? r : { available: { width: s, height: i }, lengths: a };
|
|
259
|
+
}),
|
|
244
260
|
// Every view, not just the one in front: a reset the reader asked for must not leave the
|
|
245
261
|
// arrangement they were escaping waiting for them one click away.
|
|
246
262
|
reset: () => o((s) => ({
|
|
@@ -251,8 +267,8 @@ function qn(n = {}) {
|
|
|
251
267
|
// 🛑 Unless nothing is declared yet, and then it is left UNSETTLED: settled against an
|
|
252
268
|
// empty registry it would be settled EMPTY, and having an entry is what stops anything
|
|
253
269
|
// reopening it. Every half would stay shut for good.
|
|
254
|
-
views: s.registry.length === 0 ? {} : { [s.view]:
|
|
255
|
-
lengths:
|
|
270
|
+
views: s.registry.length === 0 ? {} : { [s.view]: G(s.registry, s.defaults) },
|
|
271
|
+
lengths: hn,
|
|
256
272
|
focusedZone: null,
|
|
257
273
|
// Left behind, a solo panel closed after a reset would give back the zone the reset
|
|
258
274
|
// had just cleared.
|
|
@@ -261,7 +277,7 @@ function qn(n = {}) {
|
|
|
261
277
|
}))
|
|
262
278
|
}));
|
|
263
279
|
}
|
|
264
|
-
const
|
|
280
|
+
const xt = () => {
|
|
265
281
|
const n = /* @__PURE__ */ new Map();
|
|
266
282
|
return {
|
|
267
283
|
read: (t) => n.get(t) ?? null,
|
|
@@ -269,7 +285,7 @@ const Ct = () => {
|
|
|
269
285
|
n.set(t, e);
|
|
270
286
|
}
|
|
271
287
|
};
|
|
272
|
-
},
|
|
288
|
+
}, nt = () => ({
|
|
273
289
|
read: (n) => {
|
|
274
290
|
try {
|
|
275
291
|
return globalThis.localStorage?.getItem(n) ?? null;
|
|
@@ -283,40 +299,40 @@ const Ct = () => {
|
|
|
283
299
|
} catch {
|
|
284
300
|
}
|
|
285
301
|
}
|
|
286
|
-
}),
|
|
287
|
-
function
|
|
302
|
+
}), Cn = 2;
|
|
303
|
+
function E(n) {
|
|
288
304
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
289
305
|
}
|
|
290
|
-
function
|
|
306
|
+
function pn(n) {
|
|
291
307
|
const t = {};
|
|
292
|
-
for (const e of
|
|
308
|
+
for (const e of B) {
|
|
293
309
|
const o = n[e];
|
|
294
|
-
if (
|
|
295
|
-
for (const c of
|
|
310
|
+
if (E(o))
|
|
311
|
+
for (const c of Pn) {
|
|
296
312
|
const s = o[c];
|
|
297
313
|
s !== null && typeof s != "string" || (t[e] = { ...t[e], [c]: s });
|
|
298
314
|
}
|
|
299
315
|
}
|
|
300
316
|
return t;
|
|
301
317
|
}
|
|
302
|
-
function
|
|
318
|
+
function gn(n) {
|
|
303
319
|
const t = {};
|
|
304
|
-
for (const e of
|
|
320
|
+
for (const e of B) {
|
|
305
321
|
const o = n[e];
|
|
306
322
|
typeof o == "number" && Number.isFinite(o) && (t[e] = o);
|
|
307
323
|
}
|
|
308
324
|
return t;
|
|
309
325
|
}
|
|
310
|
-
function
|
|
326
|
+
function tt(n, t) {
|
|
311
327
|
if (n.version === 1)
|
|
312
|
-
return
|
|
313
|
-
if (n.version !==
|
|
328
|
+
return E(n.open) ? { [t]: pn(n.open) } : void 0;
|
|
329
|
+
if (n.version !== Cn || !E(n.views)) return;
|
|
314
330
|
const e = /* @__PURE__ */ Object.create(null);
|
|
315
331
|
for (const [o, c] of Object.entries(n.views))
|
|
316
|
-
|
|
332
|
+
E(c) && (e[o] = pn(c));
|
|
317
333
|
return e;
|
|
318
334
|
}
|
|
319
|
-
function
|
|
335
|
+
function et(n, t, e = rn) {
|
|
320
336
|
const o = n.read(t);
|
|
321
337
|
if (o === null) return;
|
|
322
338
|
let c;
|
|
@@ -325,31 +341,31 @@ function tt(n, t, e = on) {
|
|
|
325
341
|
} catch {
|
|
326
342
|
return;
|
|
327
343
|
}
|
|
328
|
-
if (!
|
|
329
|
-
const s =
|
|
344
|
+
if (!E(c) || !E(c.lengths)) return;
|
|
345
|
+
const s = tt(c, e);
|
|
330
346
|
if (!s) return;
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
347
|
+
const i = c.lengths;
|
|
348
|
+
if (!E(i.sizes) || !E(i.splits)) return;
|
|
349
|
+
const r = i.bandSplit;
|
|
334
350
|
return {
|
|
335
351
|
views: s,
|
|
336
352
|
lengths: {
|
|
337
|
-
sizes:
|
|
338
|
-
splits:
|
|
339
|
-
bandSplit: typeof
|
|
353
|
+
sizes: gn(i.sizes),
|
|
354
|
+
splits: gn(i.splits),
|
|
355
|
+
bandSplit: typeof r == "number" && Number.isFinite(r) ? r : void 0
|
|
340
356
|
}
|
|
341
357
|
};
|
|
342
358
|
}
|
|
343
|
-
function
|
|
359
|
+
function ot(n, t, e) {
|
|
344
360
|
const o = {
|
|
345
|
-
version:
|
|
361
|
+
version: Cn,
|
|
346
362
|
views: e.views,
|
|
347
363
|
lengths: e.lengths
|
|
348
364
|
};
|
|
349
365
|
n.write(t, JSON.stringify(o));
|
|
350
366
|
}
|
|
351
|
-
const
|
|
352
|
-
function
|
|
367
|
+
const Zn = typeof globalThis.document > "u" ? tn : Bn, Mn = on(null), rt = 250;
|
|
368
|
+
function st({
|
|
353
369
|
store: n,
|
|
354
370
|
storageKey: t = "panels:layout",
|
|
355
371
|
storage: e,
|
|
@@ -357,55 +373,62 @@ function ot({
|
|
|
357
373
|
view: c,
|
|
358
374
|
children: s
|
|
359
375
|
}) {
|
|
360
|
-
const [
|
|
361
|
-
() => e === null ? null : e ??
|
|
362
|
-
), [
|
|
363
|
-
const l = c ??
|
|
364
|
-
return n ? (a && n.setState(a), n) :
|
|
376
|
+
const [i] = J(
|
|
377
|
+
() => e === null ? null : e ?? nt()
|
|
378
|
+
), [r] = J(() => {
|
|
379
|
+
const l = c ?? rn, a = i ? et(i, t, l) : void 0;
|
|
380
|
+
return n ? (a && n.setState(a), n) : Qn({ view: l, initial: a });
|
|
365
381
|
});
|
|
366
|
-
return
|
|
367
|
-
const l =
|
|
382
|
+
return Zn(() => {
|
|
383
|
+
const l = r.getState();
|
|
368
384
|
c !== void 0 && l.setView(c), l.settle(o);
|
|
369
|
-
}),
|
|
370
|
-
if (!
|
|
371
|
-
let l;
|
|
372
|
-
|
|
373
|
-
|
|
385
|
+
}), tn(() => {
|
|
386
|
+
if (!i) return;
|
|
387
|
+
let l, a, d;
|
|
388
|
+
const f = () => {
|
|
389
|
+
d !== void 0 && clearTimeout(d), d = void 0, a && (l = a, a = void 0, ot(i, t, l));
|
|
390
|
+
}, p = r.subscribe((g) => {
|
|
391
|
+
if (!K(g, g.view)) return;
|
|
392
|
+
const S = a ?? l;
|
|
393
|
+
S?.views === g.views && S.lengths === g.lengths || (a = { views: g.views, lengths: g.lengths }, d ??= setTimeout(f, rt));
|
|
374
394
|
});
|
|
375
|
-
|
|
395
|
+
return globalThis.addEventListener?.("pagehide", f), () => {
|
|
396
|
+
p(), globalThis.removeEventListener?.("pagehide", f), f();
|
|
397
|
+
};
|
|
398
|
+
}, [i, r, t]), /* @__PURE__ */ u(Mn.Provider, { value: r, children: s });
|
|
376
399
|
}
|
|
377
|
-
function
|
|
378
|
-
const n =
|
|
400
|
+
function k() {
|
|
401
|
+
const n = en(Mn);
|
|
379
402
|
if (!n) throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");
|
|
380
403
|
return n;
|
|
381
404
|
}
|
|
382
405
|
function v(n) {
|
|
383
|
-
const t =
|
|
384
|
-
return
|
|
406
|
+
const t = k();
|
|
407
|
+
return Vn(t, n);
|
|
385
408
|
}
|
|
386
|
-
function
|
|
387
|
-
const n =
|
|
409
|
+
function D() {
|
|
410
|
+
const n = k();
|
|
388
411
|
return w(() => {
|
|
389
|
-
const { show: t, close: e, toggle: o, focus: c, resize: s, resplit:
|
|
390
|
-
return { show: t, close: e, toggle: o, focus: c, resize: s, resplit:
|
|
412
|
+
const { show: t, close: e, toggle: o, focus: c, resize: s, resplit: i, resplitBand: r, fit: l, reset: a } = n.getState();
|
|
413
|
+
return { show: t, close: e, toggle: o, focus: c, resize: s, resplit: i, resplitBand: r, fit: l, reset: a };
|
|
391
414
|
}, [n]);
|
|
392
415
|
}
|
|
393
|
-
function
|
|
416
|
+
function it({
|
|
394
417
|
icon: n,
|
|
395
418
|
label: t,
|
|
396
419
|
active: e,
|
|
397
420
|
accented: o,
|
|
398
421
|
acts: c,
|
|
399
422
|
className: s,
|
|
400
|
-
children:
|
|
401
|
-
ref:
|
|
423
|
+
children: i,
|
|
424
|
+
ref: r,
|
|
402
425
|
...l
|
|
403
426
|
}) {
|
|
404
|
-
return /* @__PURE__ */
|
|
427
|
+
return /* @__PURE__ */ m(
|
|
405
428
|
"button",
|
|
406
429
|
{
|
|
407
430
|
type: "button",
|
|
408
|
-
ref:
|
|
431
|
+
ref: r,
|
|
409
432
|
"aria-label": t,
|
|
410
433
|
"aria-pressed": c ? void 0 : e,
|
|
411
434
|
className: b(
|
|
@@ -417,63 +440,63 @@ function rt({
|
|
|
417
440
|
...l,
|
|
418
441
|
children: [
|
|
419
442
|
n !== void 0 && /* @__PURE__ */ u("span", { className: "pnl-icon-button__glyph", children: n }),
|
|
420
|
-
|
|
443
|
+
i
|
|
421
444
|
]
|
|
422
445
|
}
|
|
423
446
|
);
|
|
424
447
|
}
|
|
425
|
-
const
|
|
426
|
-
function
|
|
427
|
-
return
|
|
448
|
+
const Q = { IconButton: it }, zn = on(Q), ct = zn.Provider;
|
|
449
|
+
function Rn() {
|
|
450
|
+
return en(zn);
|
|
428
451
|
}
|
|
429
|
-
function
|
|
430
|
-
return n === void 0 ?
|
|
452
|
+
function lt(n) {
|
|
453
|
+
return n === void 0 ? Q : { ...Q, ...n };
|
|
431
454
|
}
|
|
432
|
-
function
|
|
433
|
-
const t =
|
|
434
|
-
|
|
455
|
+
function at(n) {
|
|
456
|
+
const t = k();
|
|
457
|
+
tn(() => {
|
|
435
458
|
const e = n.current;
|
|
436
459
|
if (!e) return;
|
|
437
460
|
const o = () => {
|
|
438
|
-
const { clientWidth: s, clientHeight:
|
|
439
|
-
s === 0 ||
|
|
461
|
+
const { clientWidth: s, clientHeight: i } = e;
|
|
462
|
+
s === 0 || i === 0 || t.getState().fit(s, i);
|
|
440
463
|
};
|
|
441
464
|
if (o(), typeof ResizeObserver > "u") return;
|
|
442
465
|
const c = new ResizeObserver(o);
|
|
443
466
|
return c.observe(e), () => c.disconnect();
|
|
444
467
|
}, [n, t]);
|
|
445
468
|
}
|
|
446
|
-
function
|
|
469
|
+
function z() {
|
|
447
470
|
const n = v((o) => o.registry), t = v((o) => o.view), e = v((o) => o.views[o.view]);
|
|
448
471
|
return w(
|
|
449
472
|
() => ({ registry: n, view: t, views: e === void 0 ? {} : { [t]: e } }),
|
|
450
473
|
[n, t, e]
|
|
451
474
|
);
|
|
452
475
|
}
|
|
453
|
-
function
|
|
454
|
-
const t =
|
|
455
|
-
return w(() =>
|
|
476
|
+
function ut(n) {
|
|
477
|
+
const t = z();
|
|
478
|
+
return w(() => F(t, n), [t, n]);
|
|
456
479
|
}
|
|
457
|
-
function
|
|
458
|
-
const t =
|
|
459
|
-
return w(() =>
|
|
480
|
+
function Ct(n) {
|
|
481
|
+
const t = z();
|
|
482
|
+
return w(() => L(t, n), [t, n]);
|
|
460
483
|
}
|
|
461
484
|
function mn(n) {
|
|
462
|
-
const t =
|
|
463
|
-
return w(() =>
|
|
485
|
+
const t = z();
|
|
486
|
+
return w(() => $(t, n), [t, n]);
|
|
464
487
|
}
|
|
465
|
-
function
|
|
466
|
-
const t =
|
|
467
|
-
return w(() =>
|
|
488
|
+
function Zt(n) {
|
|
489
|
+
const t = z();
|
|
490
|
+
return w(() => Y(t, n), [t, n]);
|
|
468
491
|
}
|
|
469
|
-
function
|
|
492
|
+
function dt() {
|
|
470
493
|
return {
|
|
471
|
-
left: mn(
|
|
472
|
-
right: mn(
|
|
494
|
+
left: mn(X.left.band),
|
|
495
|
+
right: mn(X.right.band)
|
|
473
496
|
};
|
|
474
497
|
}
|
|
475
|
-
function
|
|
476
|
-
const n =
|
|
498
|
+
function ft() {
|
|
499
|
+
const n = Z(null);
|
|
477
500
|
return w(() => ({
|
|
478
501
|
start: (e, o) => {
|
|
479
502
|
e.currentTarget.setPointerCapture(e.pointerId), n.current = { ...o, pointerId: e.pointerId };
|
|
@@ -484,37 +507,37 @@ function dt() {
|
|
|
484
507
|
}
|
|
485
508
|
}), []);
|
|
486
509
|
}
|
|
487
|
-
function
|
|
510
|
+
function nn({
|
|
488
511
|
axis: n,
|
|
489
512
|
invert: t = !1,
|
|
490
513
|
size: e,
|
|
491
514
|
onSize: o,
|
|
492
515
|
measure: c,
|
|
493
516
|
label: s,
|
|
494
|
-
min:
|
|
495
|
-
max:
|
|
517
|
+
min: i,
|
|
518
|
+
max: r,
|
|
496
519
|
step: l = 16,
|
|
497
520
|
className: a
|
|
498
521
|
}) {
|
|
499
|
-
const d =
|
|
500
|
-
(
|
|
501
|
-
[
|
|
502
|
-
),
|
|
503
|
-
(
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
506
|
-
const
|
|
507
|
-
o(
|
|
522
|
+
const d = ft(), f = Z(null), p = n === "vertical", g = N(
|
|
523
|
+
(h) => (p ? h?.clientHeight : h?.clientWidth) ?? 0,
|
|
524
|
+
[p]
|
|
525
|
+
), S = N(
|
|
526
|
+
(h) => {
|
|
527
|
+
const _ = d.matching(h);
|
|
528
|
+
if (!_) return;
|
|
529
|
+
const P = (p ? h.clientY : h.clientX) - _.position;
|
|
530
|
+
o(_.size + P * (t ? -1 : 1), _.available);
|
|
508
531
|
},
|
|
509
|
-
[d, t,
|
|
510
|
-
), y =
|
|
511
|
-
(
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
const
|
|
515
|
-
|
|
532
|
+
[d, t, p, o]
|
|
533
|
+
), y = N(
|
|
534
|
+
(h) => {
|
|
535
|
+
const _ = p ? "ArrowUp" : "ArrowLeft", x = p ? "ArrowDown" : "ArrowRight";
|
|
536
|
+
if (h.key !== _ && h.key !== x) return;
|
|
537
|
+
const P = g(f.current?.parentElement), R = e ?? c?.() ?? 0, Fn = h.key === x ? 1 : -1;
|
|
538
|
+
h.preventDefault(), o(R + l * Fn * (t ? -1 : 1), P);
|
|
516
539
|
},
|
|
517
|
-
[t,
|
|
540
|
+
[t, p, c, o, g, e, l]
|
|
518
541
|
);
|
|
519
542
|
return /* @__PURE__ */ u(
|
|
520
543
|
"div",
|
|
@@ -523,76 +546,76 @@ function Q({
|
|
|
523
546
|
role: "separator",
|
|
524
547
|
tabIndex: 0,
|
|
525
548
|
"aria-label": s,
|
|
526
|
-
"aria-orientation":
|
|
549
|
+
"aria-orientation": p ? "horizontal" : "vertical",
|
|
527
550
|
"aria-valuenow": e === void 0 ? void 0 : Math.round(e),
|
|
528
|
-
"aria-valuemin":
|
|
529
|
-
"aria-valuemax":
|
|
530
|
-
onPointerDown: (
|
|
531
|
-
d.start(
|
|
532
|
-
position:
|
|
551
|
+
"aria-valuemin": i,
|
|
552
|
+
"aria-valuemax": r,
|
|
553
|
+
onPointerDown: (h) => {
|
|
554
|
+
h.button !== 0 || !h.isPrimary || d.start(h, {
|
|
555
|
+
position: p ? h.clientY : h.clientX,
|
|
533
556
|
size: e ?? c?.() ?? 0,
|
|
534
|
-
available:
|
|
557
|
+
available: g(h.currentTarget.parentElement)
|
|
535
558
|
});
|
|
536
559
|
},
|
|
537
|
-
onPointerMove:
|
|
560
|
+
onPointerMove: S,
|
|
538
561
|
onPointerUp: d.cancel,
|
|
539
562
|
onPointerCancel: d.cancel,
|
|
540
563
|
onLostPointerCapture: d.cancel,
|
|
541
564
|
onKeyDown: y,
|
|
542
|
-
className: b("pnl-handle",
|
|
565
|
+
className: b("pnl-handle", p ? "pnl-handle--row" : "pnl-handle--col", a)
|
|
543
566
|
}
|
|
544
567
|
);
|
|
545
568
|
}
|
|
546
569
|
function vn(n, t, e, o) {
|
|
547
|
-
return o ? t ??
|
|
548
|
-
}
|
|
549
|
-
function
|
|
550
|
-
const t =
|
|
551
|
-
(
|
|
552
|
-
),
|
|
553
|
-
(
|
|
554
|
-
),
|
|
555
|
-
(
|
|
556
|
-
),
|
|
570
|
+
return o ? t ?? q(e, n) : 0;
|
|
571
|
+
}
|
|
572
|
+
function ht(n) {
|
|
573
|
+
const t = z(), e = v(
|
|
574
|
+
(r) => r.lengths.sizes[V(n)]
|
|
575
|
+
), o = v(
|
|
576
|
+
(r) => r.lengths.sizes[V(C[n])]
|
|
577
|
+
), c = v((r) => r.lengths.splits[n]), s = v(
|
|
578
|
+
(r) => T(n) ? r.available.height : r.available.width
|
|
579
|
+
), i = v((r) => r.focusedZone === n);
|
|
557
580
|
return w(() => {
|
|
558
|
-
const { primary:
|
|
581
|
+
const { primary: r, secondary: l } = L(t, n), a = r !== void 0 || l !== void 0, d = L(t, C[n]), f = Y(t, C[n]), p = vn(r, e, n, a), g = vn(d.primary, o, C[n], f);
|
|
559
582
|
return {
|
|
560
|
-
primary:
|
|
561
|
-
secondary:
|
|
562
|
-
draws:
|
|
583
|
+
primary: r,
|
|
584
|
+
secondary: l,
|
|
585
|
+
draws: a,
|
|
563
586
|
// Zero until the container has been measured: bounding against nothing would collapse
|
|
564
587
|
// every zone to its floor on the very first paint.
|
|
565
|
-
size:
|
|
566
|
-
split:
|
|
567
|
-
focused:
|
|
588
|
+
size: s === 0 ? p : Gn(p, g, s)[0],
|
|
589
|
+
split: c,
|
|
590
|
+
focused: i
|
|
568
591
|
};
|
|
569
|
-
}, [t, e, o,
|
|
592
|
+
}, [t, e, o, s, c, i, n]);
|
|
570
593
|
}
|
|
571
|
-
function
|
|
594
|
+
function pt(n) {
|
|
572
595
|
const t = v((e) => e.registry);
|
|
573
596
|
return w(() => [
|
|
574
597
|
["primary", t.filter((o) => o.zone === n && o.slot === "primary")],
|
|
575
598
|
["secondary", t.filter((o) => o.zone === n && o.slot === "secondary")]
|
|
576
599
|
].filter(([, o]) => o.length > 0), [t, n]);
|
|
577
600
|
}
|
|
578
|
-
const
|
|
579
|
-
function
|
|
580
|
-
return
|
|
601
|
+
const On = on(/* @__PURE__ */ new Map()), gt = On.Provider;
|
|
602
|
+
function mt(n) {
|
|
603
|
+
return en(On).get(n);
|
|
581
604
|
}
|
|
582
|
-
function
|
|
605
|
+
function vt({
|
|
583
606
|
title: n,
|
|
584
607
|
children: t,
|
|
585
608
|
fillActions: e,
|
|
586
609
|
trailing: o,
|
|
587
610
|
className: c
|
|
588
611
|
}) {
|
|
589
|
-
return /* @__PURE__ */
|
|
612
|
+
return /* @__PURE__ */ m("header", { className: b("pnl-header", c), children: [
|
|
590
613
|
/* @__PURE__ */ u("span", { className: b("pnl-header__title", e && "pnl-header__title--fixed"), children: n }),
|
|
591
614
|
/* @__PURE__ */ u("span", { className: b("pnl-header__actions", e && "pnl-header__actions--fill"), children: t }),
|
|
592
615
|
/* @__PURE__ */ u("span", { className: "pnl-header__trailing", children: o })
|
|
593
616
|
] });
|
|
594
617
|
}
|
|
595
|
-
function
|
|
618
|
+
function cn({ orientation: n = "vertical", className: t }) {
|
|
596
619
|
return /* @__PURE__ */ u(
|
|
597
620
|
"span",
|
|
598
621
|
{
|
|
@@ -604,39 +627,41 @@ function sn({ orientation: n = "vertical", className: t }) {
|
|
|
604
627
|
function Tn({ children: n, className: t, ...e }) {
|
|
605
628
|
return /* @__PURE__ */ u("section", { className: b("pnl-surface", t), ...e, children: n });
|
|
606
629
|
}
|
|
607
|
-
function
|
|
630
|
+
function bt({
|
|
608
631
|
panel: n,
|
|
609
632
|
length: t,
|
|
610
633
|
closeLabel: e,
|
|
611
|
-
onFocus: o
|
|
634
|
+
onFocus: o,
|
|
635
|
+
ref: c
|
|
612
636
|
}) {
|
|
613
|
-
const { close:
|
|
637
|
+
const { close: s } = D(), { IconButton: i } = Rn(), r = mt(n.id);
|
|
614
638
|
return (
|
|
615
639
|
// The zone owns its length: a half given one keeps it, the other takes what is left. Both
|
|
616
640
|
// sized here would make the pair overflow the zone the user dragged.
|
|
617
|
-
/* @__PURE__ */
|
|
641
|
+
/* @__PURE__ */ m(
|
|
618
642
|
Tn,
|
|
619
643
|
{
|
|
644
|
+
ref: c,
|
|
620
645
|
"aria-label": n.title,
|
|
621
646
|
onPointerDownCapture: o,
|
|
622
647
|
className: t === void 0 ? "pnl-surface--fill" : "pnl-surface--give",
|
|
623
648
|
style: t === void 0 ? void 0 : { flexBasis: t },
|
|
624
649
|
children: [
|
|
625
650
|
/* @__PURE__ */ u(
|
|
626
|
-
|
|
651
|
+
vt,
|
|
627
652
|
{
|
|
628
653
|
title: n.title,
|
|
629
|
-
fillActions: n.fillActions ?? (r?.actions !== void 0 &&
|
|
630
|
-
trailing: /* @__PURE__ */
|
|
631
|
-
r?.actions !== void 0 && /* @__PURE__ */ u(
|
|
654
|
+
fillActions: n.fillActions ?? (r?.actions !== void 0 && T(n.zone)),
|
|
655
|
+
trailing: /* @__PURE__ */ m(j, { children: [
|
|
656
|
+
r?.actions !== void 0 && /* @__PURE__ */ u(cn, {}),
|
|
632
657
|
/* @__PURE__ */ u(
|
|
633
|
-
|
|
658
|
+
i,
|
|
634
659
|
{
|
|
635
660
|
label: e,
|
|
636
661
|
acts: !0,
|
|
637
|
-
onClick: () =>
|
|
662
|
+
onClick: () => s(n.zone, n.slot),
|
|
638
663
|
className: "pnl-icon-button--header",
|
|
639
|
-
icon: /* @__PURE__ */ u(
|
|
664
|
+
icon: /* @__PURE__ */ u(wt, {})
|
|
640
665
|
}
|
|
641
666
|
)
|
|
642
667
|
] }),
|
|
@@ -649,8 +674,8 @@ function vt({
|
|
|
649
674
|
)
|
|
650
675
|
);
|
|
651
676
|
}
|
|
652
|
-
const bn = Sn(
|
|
653
|
-
function
|
|
677
|
+
const bn = Sn(bt);
|
|
678
|
+
function wt() {
|
|
654
679
|
return /* @__PURE__ */ u("svg", { viewBox: "0 0 24 24", width: "14", height: "14", "aria-hidden": "true", focusable: "false", children: /* @__PURE__ */ u(
|
|
655
680
|
"path",
|
|
656
681
|
{
|
|
@@ -659,117 +684,126 @@ function bt() {
|
|
|
659
684
|
}
|
|
660
685
|
) });
|
|
661
686
|
}
|
|
662
|
-
function
|
|
663
|
-
const e =
|
|
664
|
-
() => l ?
|
|
687
|
+
function yt({ zone: n, labels: t }) {
|
|
688
|
+
const e = ht(n), { focus: o, resize: c, resplit: s } = D(), i = Z(null), r = Z(null), l = T(n), a = v(
|
|
689
|
+
(P) => l ? P.available.height : P.available.width
|
|
690
|
+
), d = N(() => o(n), [o, n]), f = N(
|
|
691
|
+
() => l ? i.current?.clientHeight ?? 0 : i.current?.clientWidth ?? 0,
|
|
692
|
+
[l]
|
|
693
|
+
), p = N(
|
|
694
|
+
() => l ? r.current?.clientWidth ?? 0 : r.current?.clientHeight ?? 0,
|
|
665
695
|
[l]
|
|
666
696
|
);
|
|
667
697
|
if (!e.draws) return null;
|
|
668
|
-
const { primary:
|
|
698
|
+
const { primary: g, secondary: S, size: y, split: h } = e, _ = /* @__PURE__ */ m(
|
|
669
699
|
"div",
|
|
670
700
|
{
|
|
671
|
-
ref:
|
|
701
|
+
ref: i,
|
|
672
702
|
className: b("pnl-zone", l ? "pnl-zone--row" : "pnl-zone--col"),
|
|
673
|
-
style: { [l ? "height" : "width"]:
|
|
703
|
+
style: { [l ? "height" : "width"]: y },
|
|
674
704
|
children: [
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
705
|
+
g && /* @__PURE__ */ u(bn, { panel: g, closeLabel: t.closePanel, onFocus: d }),
|
|
706
|
+
g && S && /* @__PURE__ */ u(
|
|
707
|
+
nn,
|
|
678
708
|
{
|
|
679
709
|
axis: l ? "horizontal" : "vertical",
|
|
680
710
|
invert: !0,
|
|
681
|
-
size:
|
|
682
|
-
min:
|
|
711
|
+
size: h,
|
|
712
|
+
min: O,
|
|
713
|
+
measure: p,
|
|
683
714
|
label: t.resizeSplit,
|
|
684
|
-
onSize: (
|
|
715
|
+
onSize: (P, R) => s(n, P, R)
|
|
685
716
|
}
|
|
686
717
|
),
|
|
687
|
-
|
|
718
|
+
S && /* @__PURE__ */ u(
|
|
688
719
|
bn,
|
|
689
720
|
{
|
|
690
|
-
|
|
691
|
-
|
|
721
|
+
ref: r,
|
|
722
|
+
panel: S,
|
|
723
|
+
length: g && h !== void 0 ? h : void 0,
|
|
692
724
|
closeLabel: t.closePanel,
|
|
693
|
-
onFocus:
|
|
725
|
+
onFocus: d
|
|
694
726
|
}
|
|
695
727
|
)
|
|
696
728
|
]
|
|
697
729
|
}
|
|
698
|
-
),
|
|
699
|
-
|
|
730
|
+
), x = /* @__PURE__ */ u(
|
|
731
|
+
nn,
|
|
700
732
|
{
|
|
701
733
|
axis: l ? "vertical" : "horizontal",
|
|
702
|
-
invert: !
|
|
703
|
-
size:
|
|
704
|
-
min:
|
|
705
|
-
measure:
|
|
734
|
+
invert: !dn(n),
|
|
735
|
+
size: y,
|
|
736
|
+
min: U,
|
|
737
|
+
measure: f,
|
|
706
738
|
label: t.resizeZone,
|
|
707
|
-
onSize: (
|
|
739
|
+
onSize: (P, R) => c(n, P, a || R)
|
|
708
740
|
}
|
|
709
741
|
);
|
|
710
|
-
return
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
] }) : /* @__PURE__ */
|
|
714
|
-
|
|
715
|
-
|
|
742
|
+
return dn(n) ? /* @__PURE__ */ m(j, { children: [
|
|
743
|
+
_,
|
|
744
|
+
x
|
|
745
|
+
] }) : /* @__PURE__ */ m(j, { children: [
|
|
746
|
+
x,
|
|
747
|
+
_
|
|
716
748
|
] });
|
|
717
749
|
}
|
|
718
|
-
const
|
|
719
|
-
function
|
|
720
|
-
const o = v((
|
|
721
|
-
(
|
|
750
|
+
const I = Sn(yt);
|
|
751
|
+
function St({ left: n, right: t, labels: e }) {
|
|
752
|
+
const o = v((l) => l.lengths.bandSplit), { resplitBand: c } = D(), s = Z(null), i = N(
|
|
753
|
+
(l, a) => c(l, a),
|
|
722
754
|
[c]
|
|
723
|
-
);
|
|
724
|
-
return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(
|
|
755
|
+
), r = N(() => s.current?.clientWidth ?? 0, []);
|
|
756
|
+
return !n && !t ? null : !n || !t ? /* @__PURE__ */ u(I, { zone: n ? "bottomLeft" : "bottomRight", labels: e }) : /* @__PURE__ */ m("div", { className: "pnl-band", children: [
|
|
725
757
|
/* @__PURE__ */ u(
|
|
726
758
|
"div",
|
|
727
759
|
{
|
|
760
|
+
ref: s,
|
|
728
761
|
className: b("pnl-band__half", o === void 0 && "pnl-band__half--even"),
|
|
729
762
|
style: o === void 0 ? void 0 : { width: o },
|
|
730
|
-
children: /* @__PURE__ */ u(
|
|
763
|
+
children: /* @__PURE__ */ u(I, { zone: "bottomLeft", labels: e })
|
|
731
764
|
}
|
|
732
765
|
),
|
|
733
766
|
/* @__PURE__ */ u(
|
|
734
|
-
|
|
767
|
+
nn,
|
|
735
768
|
{
|
|
736
769
|
axis: "horizontal",
|
|
737
770
|
size: o,
|
|
738
|
-
min:
|
|
771
|
+
min: O,
|
|
772
|
+
measure: r,
|
|
739
773
|
label: e.resizeBand,
|
|
740
|
-
onSize:
|
|
774
|
+
onSize: i
|
|
741
775
|
}
|
|
742
776
|
),
|
|
743
|
-
/* @__PURE__ */ u("div", { className: "pnl-band__half pnl-band__half--rest", children: /* @__PURE__ */ u(
|
|
777
|
+
/* @__PURE__ */ u("div", { className: "pnl-band__half pnl-band__half--rest", children: /* @__PURE__ */ u(I, { zone: "bottomRight", labels: e }) })
|
|
744
778
|
] });
|
|
745
779
|
}
|
|
746
|
-
function
|
|
780
|
+
function ln(n) {
|
|
747
781
|
return null;
|
|
748
782
|
}
|
|
749
|
-
|
|
750
|
-
const
|
|
783
|
+
ln.displayName = "Panels.Center";
|
|
784
|
+
const Pt = {
|
|
751
785
|
closePanel: "Close panel",
|
|
752
786
|
resizeZone: "Resize panel area",
|
|
753
787
|
resizeSplit: "Resize the two panels",
|
|
754
788
|
resizeBand: "Resize the bottom panels"
|
|
755
789
|
};
|
|
756
|
-
function
|
|
790
|
+
function an(n) {
|
|
757
791
|
return null;
|
|
758
792
|
}
|
|
759
|
-
|
|
793
|
+
an.displayName = "Panels.Panel";
|
|
760
794
|
function wn({ side: n, header: t, className: e }) {
|
|
761
|
-
const { column: o, band: c } =
|
|
762
|
-
return /* @__PURE__ */
|
|
795
|
+
const { column: o, band: c } = X[n];
|
|
796
|
+
return /* @__PURE__ */ m(
|
|
763
797
|
"div",
|
|
764
798
|
{
|
|
765
799
|
role: "toolbar",
|
|
766
800
|
"aria-orientation": "vertical",
|
|
767
801
|
className: b("pnl-rail", `pnl-rail--${n}`, e),
|
|
768
802
|
children: [
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
t !== void 0 && /* @__PURE__ */
|
|
803
|
+
/* @__PURE__ */ m("div", { className: "pnl-rail__group", children: [
|
|
804
|
+
t !== void 0 && /* @__PURE__ */ m(j, { children: [
|
|
771
805
|
t,
|
|
772
|
-
/* @__PURE__ */ u(
|
|
806
|
+
/* @__PURE__ */ u(cn, { orientation: "horizontal" })
|
|
773
807
|
] }),
|
|
774
808
|
o.map((s) => /* @__PURE__ */ u(yn, { zone: s }, s))
|
|
775
809
|
] }),
|
|
@@ -779,11 +813,11 @@ function wn({ side: n, header: t, className: e }) {
|
|
|
779
813
|
);
|
|
780
814
|
}
|
|
781
815
|
function yn({ zone: n }) {
|
|
782
|
-
const t =
|
|
783
|
-
return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([
|
|
784
|
-
l > 0 && /* @__PURE__ */ u(
|
|
785
|
-
|
|
786
|
-
const d = e[
|
|
816
|
+
const t = pt(n), e = ut(n), o = v((i) => i.focusedZone === n), { toggle: c } = D(), { IconButton: s } = Rn();
|
|
817
|
+
return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([i, r], l) => /* @__PURE__ */ m(kn, { children: [
|
|
818
|
+
l > 0 && /* @__PURE__ */ u(cn, { orientation: "horizontal" }),
|
|
819
|
+
r.map((a) => {
|
|
820
|
+
const d = e[i] === a.id;
|
|
787
821
|
return /* @__PURE__ */ u(
|
|
788
822
|
s,
|
|
789
823
|
{
|
|
@@ -797,42 +831,42 @@ function yn({ zone: n }) {
|
|
|
797
831
|
a.id
|
|
798
832
|
);
|
|
799
833
|
})
|
|
800
|
-
] }, `${n}:${
|
|
834
|
+
] }, `${n}:${i}`)) });
|
|
801
835
|
}
|
|
802
836
|
function Nt(n) {
|
|
803
837
|
const t = [], e = /* @__PURE__ */ new Map(), o = [];
|
|
804
838
|
let c = null;
|
|
805
|
-
for (const s of
|
|
839
|
+
for (const s of Dn.toArray(n)) {
|
|
806
840
|
if (!Hn(s)) {
|
|
807
841
|
o.push(s);
|
|
808
842
|
continue;
|
|
809
843
|
}
|
|
810
|
-
if (s.type ===
|
|
844
|
+
if (s.type === ln) {
|
|
811
845
|
c = s;
|
|
812
846
|
continue;
|
|
813
847
|
}
|
|
814
|
-
if (s.type !==
|
|
848
|
+
if (s.type !== an) {
|
|
815
849
|
o.push(s);
|
|
816
850
|
continue;
|
|
817
851
|
}
|
|
818
|
-
const
|
|
819
|
-
t.push({ ...d, slot: a }), e.set(d.id, { content: l, actions:
|
|
852
|
+
const i = s.props, { actions: r, children: l, slot: a = "primary", ...d } = i;
|
|
853
|
+
t.push({ ...d, slot: a }), e.set(d.id, { content: l, actions: r });
|
|
820
854
|
}
|
|
821
855
|
return { specs: t, content: e, centre: c, loose: o };
|
|
822
856
|
}
|
|
823
|
-
function
|
|
857
|
+
function An({
|
|
824
858
|
header: n,
|
|
825
859
|
footer: t,
|
|
826
860
|
railHeader: e,
|
|
827
861
|
labels: o,
|
|
828
862
|
theme: c,
|
|
829
863
|
className: s,
|
|
830
|
-
components:
|
|
831
|
-
children:
|
|
864
|
+
components: i,
|
|
865
|
+
children: r,
|
|
832
866
|
...l
|
|
833
867
|
}) {
|
|
834
|
-
return /* @__PURE__ */ u(
|
|
835
|
-
|
|
868
|
+
return /* @__PURE__ */ u(st, { ...l, children: /* @__PURE__ */ u(
|
|
869
|
+
_t,
|
|
836
870
|
{
|
|
837
871
|
header: n,
|
|
838
872
|
footer: t,
|
|
@@ -840,66 +874,66 @@ function Fn({
|
|
|
840
874
|
labels: o,
|
|
841
875
|
theme: c,
|
|
842
876
|
className: s,
|
|
843
|
-
components:
|
|
844
|
-
children:
|
|
877
|
+
components: i,
|
|
878
|
+
children: r
|
|
845
879
|
}
|
|
846
880
|
) });
|
|
847
881
|
}
|
|
848
|
-
function
|
|
882
|
+
function _t({
|
|
849
883
|
header: n,
|
|
850
884
|
footer: t,
|
|
851
885
|
railHeader: e,
|
|
852
886
|
labels: o,
|
|
853
887
|
theme: c,
|
|
854
888
|
className: s,
|
|
855
|
-
components:
|
|
856
|
-
children:
|
|
889
|
+
components: i,
|
|
890
|
+
children: r
|
|
857
891
|
}) {
|
|
858
|
-
const l =
|
|
859
|
-
|
|
860
|
-
const [d] =
|
|
861
|
-
|
|
892
|
+
const l = k(), a = Z(null);
|
|
893
|
+
at(a);
|
|
894
|
+
const [d] = J(() => lt(i)), { specs: f, content: p, centre: g, loose: S } = w(() => Nt(r), [r]), y = w(() => ({ ...Pt, ...o }), [o]);
|
|
895
|
+
Zn(() => {
|
|
862
896
|
l.getState().declare(f);
|
|
863
897
|
}, [l, f]);
|
|
864
|
-
const
|
|
865
|
-
return /* @__PURE__ */ u(
|
|
898
|
+
const h = dt();
|
|
899
|
+
return /* @__PURE__ */ u(ct, { value: d, children: /* @__PURE__ */ u(gt, { value: p, children: /* @__PURE__ */ m("div", { "data-pnl-theme": c, className: b("pnl-root", s), children: [
|
|
866
900
|
n,
|
|
867
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ m("div", { className: "pnl-middle", children: [
|
|
868
902
|
/* @__PURE__ */ u(wn, { side: "left", header: e }),
|
|
869
|
-
/* @__PURE__ */
|
|
870
|
-
/* @__PURE__ */ u(
|
|
871
|
-
/* @__PURE__ */
|
|
872
|
-
!
|
|
873
|
-
/* @__PURE__ */
|
|
874
|
-
/* @__PURE__ */
|
|
875
|
-
|
|
876
|
-
/* @__PURE__ */ u(Tn, { className: "pnl-centre", children:
|
|
877
|
-
|
|
903
|
+
/* @__PURE__ */ m("div", { ref: a, className: "pnl-columns", children: [
|
|
904
|
+
/* @__PURE__ */ u(I, { zone: "top", labels: y }),
|
|
905
|
+
/* @__PURE__ */ m("div", { className: "pnl-row", children: [
|
|
906
|
+
!h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
|
|
907
|
+
/* @__PURE__ */ m("div", { className: "pnl-stack", children: [
|
|
908
|
+
/* @__PURE__ */ m("div", { className: "pnl-row", children: [
|
|
909
|
+
h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
|
|
910
|
+
/* @__PURE__ */ u(Tn, { className: "pnl-centre", children: g?.props.children }),
|
|
911
|
+
h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
|
|
878
912
|
] }),
|
|
879
|
-
/* @__PURE__ */ u(
|
|
913
|
+
/* @__PURE__ */ u(St, { left: h.left, right: h.right, labels: y })
|
|
880
914
|
] }),
|
|
881
|
-
!
|
|
915
|
+
!h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
|
|
882
916
|
] })
|
|
883
917
|
] }),
|
|
884
918
|
/* @__PURE__ */ u(wn, { side: "right" })
|
|
885
919
|
] }),
|
|
886
920
|
t,
|
|
887
|
-
|
|
921
|
+
S
|
|
888
922
|
] }) }) });
|
|
889
923
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
function
|
|
893
|
-
const n =
|
|
894
|
-
(
|
|
895
|
-
const
|
|
896
|
-
return
|
|
924
|
+
An.Panel = an;
|
|
925
|
+
An.Center = ln;
|
|
926
|
+
function Mt() {
|
|
927
|
+
const n = k(), t = z(), e = v((i) => i.focusedZone), o = D(), c = N(
|
|
928
|
+
(i) => {
|
|
929
|
+
const r = M(t.registry, i);
|
|
930
|
+
return r !== void 0 && F(t, r.zone)[r.slot] === i;
|
|
897
931
|
},
|
|
898
932
|
[t]
|
|
899
|
-
), s =
|
|
900
|
-
(
|
|
901
|
-
const
|
|
902
|
-
!
|
|
933
|
+
), s = N(
|
|
934
|
+
(i) => {
|
|
935
|
+
const r = M(t.registry, i);
|
|
936
|
+
!r || F(t, r.zone)[r.slot] !== i || n.getState().close(r.zone, r.slot);
|
|
903
937
|
},
|
|
904
938
|
[t, n]
|
|
905
939
|
);
|
|
@@ -917,66 +951,66 @@ function Zt() {
|
|
|
917
951
|
);
|
|
918
952
|
}
|
|
919
953
|
export {
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
954
|
+
Wn as BOTTOM_ZONES,
|
|
955
|
+
St as Band,
|
|
956
|
+
ln as Center,
|
|
957
|
+
gt as ContentProvider,
|
|
958
|
+
Pt as DEFAULT_LABELS,
|
|
959
|
+
Yn as DEFAULT_SIZES,
|
|
960
|
+
rn as DEFAULT_VIEW,
|
|
961
|
+
it as IconButton,
|
|
962
|
+
Cn as LAYOUT_VERSION,
|
|
963
|
+
Nn as MIN_CENTER,
|
|
964
|
+
U as MIN_SIZE,
|
|
965
|
+
O as MIN_SPLIT,
|
|
966
|
+
an as Panel,
|
|
933
967
|
bn as PanelFrame,
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
968
|
+
vt as PanelHeader,
|
|
969
|
+
An as Panels,
|
|
970
|
+
st as PanelsProvider,
|
|
937
971
|
wn as Rail,
|
|
938
972
|
yn as RailZone,
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
973
|
+
nn as ResizeHandle,
|
|
974
|
+
Pn as SLOTS,
|
|
975
|
+
cn as Separator,
|
|
942
976
|
Tn as Surface,
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
977
|
+
B as ZONES,
|
|
978
|
+
X as ZONES_BY_SIDE,
|
|
979
|
+
I as ZoneEdge,
|
|
980
|
+
nt as browserStorage,
|
|
981
|
+
Qn as createPanelsStore,
|
|
948
982
|
b as cx,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
983
|
+
W as fitSplit,
|
|
984
|
+
En as fitZoneSize,
|
|
985
|
+
sn as isBottom,
|
|
986
|
+
T as isHorizontal,
|
|
987
|
+
dn as isLeading,
|
|
988
|
+
xt as memoryStorage,
|
|
989
|
+
A as openOf,
|
|
990
|
+
et as readLayout,
|
|
991
|
+
Gn as sharedSizes,
|
|
992
|
+
F as shownIn,
|
|
993
|
+
L as shownSpecsIn,
|
|
994
|
+
V as sizeKeyOf,
|
|
995
|
+
M as specOf,
|
|
996
|
+
q as undraggedSizeOf,
|
|
997
|
+
z as useArrangement,
|
|
998
|
+
dt as useBandHalves,
|
|
999
|
+
at as useContainerFit,
|
|
1000
|
+
mt as usePanelContent,
|
|
1001
|
+
Mt as usePanels,
|
|
1002
|
+
D as usePanelsActions,
|
|
1003
|
+
Rn as usePanelsComponents,
|
|
970
1004
|
v as usePanelsState,
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
1005
|
+
k as usePanelsStore,
|
|
1006
|
+
ft as usePointerDrag,
|
|
1007
|
+
ut as useShownIn,
|
|
1008
|
+
Ct as useShownSpecsIn,
|
|
1009
|
+
ht as useZone,
|
|
976
1010
|
mn as useZoneDraws,
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
1011
|
+
pt as useZonePanels,
|
|
1012
|
+
Zt as useZoneTakesRoom,
|
|
1013
|
+
ot as writeLayout,
|
|
1014
|
+
$ as zoneDraws,
|
|
1015
|
+
Y as zoneTakesRoom
|
|
982
1016
|
};
|