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