@pasquelin/panels 0.3.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 +36 -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 +468 -444
- package/dist/styles.css +1 -1
- 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
|
-
},
|
|
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,77 +175,78 @@ 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) => ({
|
|
@@ -251,8 +257,8 @@ function qn(n = {}) {
|
|
|
251
257
|
// 🛑 Unless nothing is declared yet, and then it is left UNSETTLED: settled against an
|
|
252
258
|
// empty registry it would be settled EMPTY, and having an entry is what stops anything
|
|
253
259
|
// reopening it. Every half would stay shut for good.
|
|
254
|
-
views: s.registry.length === 0 ? {} : { [s.view]:
|
|
255
|
-
lengths:
|
|
260
|
+
views: s.registry.length === 0 ? {} : { [s.view]: G(s.registry, s.defaults) },
|
|
261
|
+
lengths: hn,
|
|
256
262
|
focusedZone: null,
|
|
257
263
|
// Left behind, a solo panel closed after a reset would give back the zone the reset
|
|
258
264
|
// had just cleared.
|
|
@@ -261,7 +267,7 @@ function qn(n = {}) {
|
|
|
261
267
|
}))
|
|
262
268
|
}));
|
|
263
269
|
}
|
|
264
|
-
const
|
|
270
|
+
const xt = () => {
|
|
265
271
|
const n = /* @__PURE__ */ new Map();
|
|
266
272
|
return {
|
|
267
273
|
read: (t) => n.get(t) ?? null,
|
|
@@ -283,25 +289,25 @@ const Ct = () => {
|
|
|
283
289
|
} catch {
|
|
284
290
|
}
|
|
285
291
|
}
|
|
286
|
-
}),
|
|
287
|
-
function
|
|
292
|
+
}), Cn = 2;
|
|
293
|
+
function E(n) {
|
|
288
294
|
return typeof n == "object" && n !== null && !Array.isArray(n);
|
|
289
295
|
}
|
|
290
|
-
function
|
|
296
|
+
function pn(n) {
|
|
291
297
|
const t = {};
|
|
292
|
-
for (const e of
|
|
298
|
+
for (const e of B) {
|
|
293
299
|
const o = n[e];
|
|
294
|
-
if (
|
|
295
|
-
for (const
|
|
296
|
-
const s = o[
|
|
297
|
-
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 });
|
|
298
304
|
}
|
|
299
305
|
}
|
|
300
306
|
return t;
|
|
301
307
|
}
|
|
302
|
-
function
|
|
308
|
+
function gn(n) {
|
|
303
309
|
const t = {};
|
|
304
|
-
for (const e of
|
|
310
|
+
for (const e of B) {
|
|
305
311
|
const o = n[e];
|
|
306
312
|
typeof o == "number" && Number.isFinite(o) && (t[e] = o);
|
|
307
313
|
}
|
|
@@ -309,171 +315,178 @@ function pn(n) {
|
|
|
309
315
|
}
|
|
310
316
|
function nt(n, t) {
|
|
311
317
|
if (n.version === 1)
|
|
312
|
-
return
|
|
313
|
-
if (n.version !==
|
|
318
|
+
return E(n.open) ? { [t]: pn(n.open) } : void 0;
|
|
319
|
+
if (n.version !== Cn || !E(n.views)) return;
|
|
314
320
|
const e = /* @__PURE__ */ Object.create(null);
|
|
315
|
-
for (const [o,
|
|
316
|
-
|
|
321
|
+
for (const [o, l] of Object.entries(n.views))
|
|
322
|
+
E(l) && (e[o] = pn(l));
|
|
317
323
|
return e;
|
|
318
324
|
}
|
|
319
|
-
function tt(n, t, e =
|
|
325
|
+
function tt(n, t, e = rn) {
|
|
320
326
|
const o = n.read(t);
|
|
321
327
|
if (o === null) return;
|
|
322
|
-
let
|
|
328
|
+
let l;
|
|
323
329
|
try {
|
|
324
|
-
|
|
330
|
+
l = JSON.parse(o);
|
|
325
331
|
} catch {
|
|
326
332
|
return;
|
|
327
333
|
}
|
|
328
|
-
if (!
|
|
329
|
-
const s = nt(
|
|
334
|
+
if (!E(l) || !E(l.lengths)) return;
|
|
335
|
+
const s = nt(l, e);
|
|
330
336
|
if (!s) return;
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
333
|
-
const
|
|
337
|
+
const i = l.lengths;
|
|
338
|
+
if (!E(i.sizes) || !E(i.splits)) return;
|
|
339
|
+
const r = i.bandSplit;
|
|
334
340
|
return {
|
|
335
341
|
views: s,
|
|
336
342
|
lengths: {
|
|
337
|
-
sizes:
|
|
338
|
-
splits:
|
|
339
|
-
bandSplit: typeof
|
|
343
|
+
sizes: gn(i.sizes),
|
|
344
|
+
splits: gn(i.splits),
|
|
345
|
+
bandSplit: typeof r == "number" && Number.isFinite(r) ? r : void 0
|
|
340
346
|
}
|
|
341
347
|
};
|
|
342
348
|
}
|
|
343
349
|
function et(n, t, e) {
|
|
344
350
|
const o = {
|
|
345
|
-
version:
|
|
351
|
+
version: Cn,
|
|
346
352
|
views: e.views,
|
|
347
353
|
lengths: e.lengths
|
|
348
354
|
};
|
|
349
355
|
n.write(t, JSON.stringify(o));
|
|
350
356
|
}
|
|
351
|
-
const
|
|
352
|
-
function
|
|
357
|
+
const Zn = typeof globalThis.document > "u" ? tn : Bn, Mn = on(null), ot = 250;
|
|
358
|
+
function rt({
|
|
353
359
|
store: n,
|
|
354
360
|
storageKey: t = "panels:layout",
|
|
355
361
|
storage: e,
|
|
356
362
|
defaultOpen: o,
|
|
357
|
-
view:
|
|
363
|
+
view: l,
|
|
358
364
|
children: s
|
|
359
365
|
}) {
|
|
360
|
-
const [
|
|
366
|
+
const [i] = J(
|
|
361
367
|
() => e === null ? null : e ?? Qn()
|
|
362
|
-
), [
|
|
363
|
-
const
|
|
364
|
-
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 });
|
|
365
371
|
});
|
|
366
|
-
return
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
}),
|
|
370
|
-
if (!
|
|
371
|
-
let
|
|
372
|
-
|
|
373
|
-
|
|
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));
|
|
374
384
|
});
|
|
375
|
-
|
|
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 });
|
|
376
389
|
}
|
|
377
|
-
function
|
|
378
|
-
const n =
|
|
390
|
+
function k() {
|
|
391
|
+
const n = en(Mn);
|
|
379
392
|
if (!n) throw new Error("usePanelsStore must be used inside a <Panels> or <PanelsProvider>");
|
|
380
393
|
return n;
|
|
381
394
|
}
|
|
382
395
|
function v(n) {
|
|
383
|
-
const t =
|
|
384
|
-
return
|
|
396
|
+
const t = k();
|
|
397
|
+
return Vn(t, n);
|
|
385
398
|
}
|
|
386
|
-
function
|
|
387
|
-
const n =
|
|
399
|
+
function D() {
|
|
400
|
+
const n = k();
|
|
388
401
|
return w(() => {
|
|
389
|
-
const { show: t, close: e, toggle: o, focus:
|
|
390
|
-
return { show: t, close: e, toggle: o, focus:
|
|
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 };
|
|
391
404
|
}, [n]);
|
|
392
405
|
}
|
|
393
|
-
function
|
|
406
|
+
function st({
|
|
394
407
|
icon: n,
|
|
395
408
|
label: t,
|
|
396
409
|
active: e,
|
|
397
410
|
accented: o,
|
|
398
|
-
acts:
|
|
411
|
+
acts: l,
|
|
399
412
|
className: s,
|
|
400
|
-
children:
|
|
401
|
-
ref:
|
|
402
|
-
...
|
|
413
|
+
children: i,
|
|
414
|
+
ref: r,
|
|
415
|
+
...c
|
|
403
416
|
}) {
|
|
404
|
-
return /* @__PURE__ */
|
|
417
|
+
return /* @__PURE__ */ m(
|
|
405
418
|
"button",
|
|
406
419
|
{
|
|
407
420
|
type: "button",
|
|
408
|
-
ref:
|
|
421
|
+
ref: r,
|
|
409
422
|
"aria-label": t,
|
|
410
|
-
"aria-pressed":
|
|
423
|
+
"aria-pressed": l ? void 0 : e,
|
|
411
424
|
className: b(
|
|
412
425
|
"pnl-icon-button",
|
|
413
426
|
e && "pnl-icon-button--active",
|
|
414
427
|
o && "pnl-icon-button--accented",
|
|
415
428
|
s
|
|
416
429
|
),
|
|
417
|
-
...
|
|
430
|
+
...c,
|
|
418
431
|
children: [
|
|
419
432
|
n !== void 0 && /* @__PURE__ */ u("span", { className: "pnl-icon-button__glyph", children: n }),
|
|
420
|
-
|
|
433
|
+
i
|
|
421
434
|
]
|
|
422
435
|
}
|
|
423
436
|
);
|
|
424
437
|
}
|
|
425
|
-
const
|
|
438
|
+
const Q = { IconButton: st }, Rn = on(Q), it = Rn.Provider;
|
|
426
439
|
function On() {
|
|
427
|
-
return
|
|
428
|
-
}
|
|
429
|
-
function it(n) {
|
|
430
|
-
return n === void 0 ? q : { ...q, ...n };
|
|
440
|
+
return en(Rn);
|
|
431
441
|
}
|
|
432
442
|
function ct(n) {
|
|
433
|
-
|
|
434
|
-
|
|
443
|
+
return n === void 0 ? Q : { ...Q, ...n };
|
|
444
|
+
}
|
|
445
|
+
function lt(n) {
|
|
446
|
+
const t = k();
|
|
447
|
+
tn(() => {
|
|
435
448
|
const e = n.current;
|
|
436
449
|
if (!e) return;
|
|
437
450
|
const o = () => {
|
|
438
|
-
const { clientWidth: s, clientHeight:
|
|
439
|
-
s === 0 ||
|
|
451
|
+
const { clientWidth: s, clientHeight: i } = e;
|
|
452
|
+
s === 0 || i === 0 || t.getState().fit(s, i);
|
|
440
453
|
};
|
|
441
454
|
if (o(), typeof ResizeObserver > "u") return;
|
|
442
|
-
const
|
|
443
|
-
return
|
|
455
|
+
const l = new ResizeObserver(o);
|
|
456
|
+
return l.observe(e), () => l.disconnect();
|
|
444
457
|
}, [n, t]);
|
|
445
458
|
}
|
|
446
|
-
function
|
|
459
|
+
function R() {
|
|
447
460
|
const n = v((o) => o.registry), t = v((o) => o.view), e = v((o) => o.views[o.view]);
|
|
448
461
|
return w(
|
|
449
462
|
() => ({ registry: n, view: t, views: e === void 0 ? {} : { [t]: e } }),
|
|
450
463
|
[n, t, e]
|
|
451
464
|
);
|
|
452
465
|
}
|
|
453
|
-
function
|
|
454
|
-
const t =
|
|
455
|
-
return w(() =>
|
|
466
|
+
function at(n) {
|
|
467
|
+
const t = R();
|
|
468
|
+
return w(() => A(t, n), [t, n]);
|
|
456
469
|
}
|
|
457
|
-
function
|
|
458
|
-
const t =
|
|
459
|
-
return w(() =>
|
|
470
|
+
function Lt(n) {
|
|
471
|
+
const t = R();
|
|
472
|
+
return w(() => x(t, n), [t, n]);
|
|
460
473
|
}
|
|
461
474
|
function mn(n) {
|
|
462
|
-
const t =
|
|
463
|
-
return w(() =>
|
|
475
|
+
const t = R();
|
|
476
|
+
return w(() => $(t, n), [t, n]);
|
|
464
477
|
}
|
|
465
|
-
function
|
|
466
|
-
const t =
|
|
467
|
-
return w(() =>
|
|
478
|
+
function Ct(n) {
|
|
479
|
+
const t = R();
|
|
480
|
+
return w(() => Y(t, n), [t, n]);
|
|
468
481
|
}
|
|
469
482
|
function ut() {
|
|
470
483
|
return {
|
|
471
|
-
left: mn(
|
|
472
|
-
right: mn(
|
|
484
|
+
left: mn(X.left.band),
|
|
485
|
+
right: mn(X.right.band)
|
|
473
486
|
};
|
|
474
487
|
}
|
|
475
488
|
function dt() {
|
|
476
|
-
const n =
|
|
489
|
+
const n = Z(null);
|
|
477
490
|
return w(() => ({
|
|
478
491
|
start: (e, o) => {
|
|
479
492
|
e.currentTarget.setPointerCapture(e.pointerId), n.current = { ...o, pointerId: e.pointerId };
|
|
@@ -484,37 +497,37 @@ function dt() {
|
|
|
484
497
|
}
|
|
485
498
|
}), []);
|
|
486
499
|
}
|
|
487
|
-
function
|
|
500
|
+
function nn({
|
|
488
501
|
axis: n,
|
|
489
502
|
invert: t = !1,
|
|
490
503
|
size: e,
|
|
491
504
|
onSize: o,
|
|
492
|
-
measure:
|
|
505
|
+
measure: l,
|
|
493
506
|
label: s,
|
|
494
|
-
min:
|
|
495
|
-
max:
|
|
496
|
-
step:
|
|
507
|
+
min: i,
|
|
508
|
+
max: r,
|
|
509
|
+
step: c = 16,
|
|
497
510
|
className: a
|
|
498
511
|
}) {
|
|
499
|
-
const d = dt(), f =
|
|
500
|
-
(
|
|
501
|
-
[
|
|
502
|
-
),
|
|
503
|
-
(
|
|
504
|
-
const
|
|
505
|
-
if (!
|
|
506
|
-
const
|
|
507
|
-
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);
|
|
508
521
|
},
|
|
509
|
-
[d, t,
|
|
510
|
-
), y =
|
|
511
|
-
(
|
|
512
|
-
const
|
|
513
|
-
if (
|
|
514
|
-
const
|
|
515
|
-
|
|
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);
|
|
516
529
|
},
|
|
517
|
-
[t,
|
|
530
|
+
[t, p, l, o, g, e, c]
|
|
518
531
|
);
|
|
519
532
|
return /* @__PURE__ */ u(
|
|
520
533
|
"div",
|
|
@@ -523,50 +536,50 @@ function Q({
|
|
|
523
536
|
role: "separator",
|
|
524
537
|
tabIndex: 0,
|
|
525
538
|
"aria-label": s,
|
|
526
|
-
"aria-orientation":
|
|
539
|
+
"aria-orientation": p ? "horizontal" : "vertical",
|
|
527
540
|
"aria-valuenow": e === void 0 ? void 0 : Math.round(e),
|
|
528
|
-
"aria-valuemin":
|
|
529
|
-
"aria-valuemax":
|
|
530
|
-
onPointerDown: (
|
|
531
|
-
d.start(
|
|
532
|
-
position:
|
|
533
|
-
size: e ??
|
|
534
|
-
available:
|
|
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)
|
|
535
548
|
});
|
|
536
549
|
},
|
|
537
|
-
onPointerMove:
|
|
550
|
+
onPointerMove: S,
|
|
538
551
|
onPointerUp: d.cancel,
|
|
539
552
|
onPointerCancel: d.cancel,
|
|
540
553
|
onLostPointerCapture: d.cancel,
|
|
541
554
|
onKeyDown: y,
|
|
542
|
-
className: b("pnl-handle",
|
|
555
|
+
className: b("pnl-handle", p ? "pnl-handle--row" : "pnl-handle--col", a)
|
|
543
556
|
}
|
|
544
557
|
);
|
|
545
558
|
}
|
|
546
559
|
function vn(n, t, e, o) {
|
|
547
|
-
return o ? t ??
|
|
560
|
+
return o ? t ?? q(e, n) : 0;
|
|
548
561
|
}
|
|
549
562
|
function ft(n) {
|
|
550
|
-
const t =
|
|
551
|
-
(
|
|
552
|
-
),
|
|
553
|
-
(
|
|
554
|
-
),
|
|
555
|
-
(
|
|
556
|
-
),
|
|
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);
|
|
557
570
|
return w(() => {
|
|
558
|
-
const { primary:
|
|
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);
|
|
559
572
|
return {
|
|
560
|
-
primary:
|
|
561
|
-
secondary:
|
|
562
|
-
draws:
|
|
573
|
+
primary: r,
|
|
574
|
+
secondary: c,
|
|
575
|
+
draws: a,
|
|
563
576
|
// Zero until the container has been measured: bounding against nothing would collapse
|
|
564
577
|
// every zone to its floor on the very first paint.
|
|
565
|
-
size:
|
|
566
|
-
split:
|
|
567
|
-
focused:
|
|
578
|
+
size: s === 0 ? p : Gn(p, g, s)[0],
|
|
579
|
+
split: l,
|
|
580
|
+
focused: i
|
|
568
581
|
};
|
|
569
|
-
}, [t, e, o,
|
|
582
|
+
}, [t, e, o, s, l, i, n]);
|
|
570
583
|
}
|
|
571
584
|
function ht(n) {
|
|
572
585
|
const t = v((e) => e.registry);
|
|
@@ -575,24 +588,24 @@ function ht(n) {
|
|
|
575
588
|
["secondary", t.filter((o) => o.zone === n && o.slot === "secondary")]
|
|
576
589
|
].filter(([, o]) => o.length > 0), [t, n]);
|
|
577
590
|
}
|
|
578
|
-
const
|
|
591
|
+
const zn = on(/* @__PURE__ */ new Map()), pt = zn.Provider;
|
|
579
592
|
function gt(n) {
|
|
580
|
-
return
|
|
593
|
+
return en(zn).get(n);
|
|
581
594
|
}
|
|
582
595
|
function mt({
|
|
583
596
|
title: n,
|
|
584
597
|
children: t,
|
|
585
598
|
fillActions: e,
|
|
586
599
|
trailing: o,
|
|
587
|
-
className:
|
|
600
|
+
className: l
|
|
588
601
|
}) {
|
|
589
|
-
return /* @__PURE__ */
|
|
602
|
+
return /* @__PURE__ */ m("header", { className: b("pnl-header", l), children: [
|
|
590
603
|
/* @__PURE__ */ u("span", { className: b("pnl-header__title", e && "pnl-header__title--fixed"), children: n }),
|
|
591
604
|
/* @__PURE__ */ u("span", { className: b("pnl-header__actions", e && "pnl-header__actions--fill"), children: t }),
|
|
592
605
|
/* @__PURE__ */ u("span", { className: "pnl-header__trailing", children: o })
|
|
593
606
|
] });
|
|
594
607
|
}
|
|
595
|
-
function
|
|
608
|
+
function cn({ orientation: n = "vertical", className: t }) {
|
|
596
609
|
return /* @__PURE__ */ u(
|
|
597
610
|
"span",
|
|
598
611
|
{
|
|
@@ -608,15 +621,17 @@ function vt({
|
|
|
608
621
|
panel: n,
|
|
609
622
|
length: t,
|
|
610
623
|
closeLabel: e,
|
|
611
|
-
onFocus: o
|
|
624
|
+
onFocus: o,
|
|
625
|
+
ref: l
|
|
612
626
|
}) {
|
|
613
|
-
const { close:
|
|
627
|
+
const { close: s } = D(), { IconButton: i } = On(), r = gt(n.id);
|
|
614
628
|
return (
|
|
615
629
|
// The zone owns its length: a half given one keeps it, the other takes what is left. Both
|
|
616
630
|
// sized here would make the pair overflow the zone the user dragged.
|
|
617
|
-
/* @__PURE__ */
|
|
631
|
+
/* @__PURE__ */ m(
|
|
618
632
|
Tn,
|
|
619
633
|
{
|
|
634
|
+
ref: l,
|
|
620
635
|
"aria-label": n.title,
|
|
621
636
|
onPointerDownCapture: o,
|
|
622
637
|
className: t === void 0 ? "pnl-surface--fill" : "pnl-surface--give",
|
|
@@ -626,15 +641,15 @@ function vt({
|
|
|
626
641
|
mt,
|
|
627
642
|
{
|
|
628
643
|
title: n.title,
|
|
629
|
-
fillActions: n.fillActions ?? (r?.actions !== void 0 &&
|
|
630
|
-
trailing: /* @__PURE__ */
|
|
631
|
-
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, {}),
|
|
632
647
|
/* @__PURE__ */ u(
|
|
633
|
-
|
|
648
|
+
i,
|
|
634
649
|
{
|
|
635
650
|
label: e,
|
|
636
651
|
acts: !0,
|
|
637
|
-
onClick: () =>
|
|
652
|
+
onClick: () => s(n.zone, n.slot),
|
|
638
653
|
className: "pnl-icon-button--header",
|
|
639
654
|
icon: /* @__PURE__ */ u(bt, {})
|
|
640
655
|
}
|
|
@@ -660,130 +675,139 @@ function bt() {
|
|
|
660
675
|
) });
|
|
661
676
|
}
|
|
662
677
|
function wt({ zone: n, labels: t }) {
|
|
663
|
-
const e = ft(n), { focus: o, resize:
|
|
664
|
-
() =>
|
|
665
|
-
|
|
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]
|
|
666
686
|
);
|
|
667
687
|
if (!e.draws) return null;
|
|
668
|
-
const { primary:
|
|
688
|
+
const { primary: g, secondary: S, size: y, split: h } = e, _ = /* @__PURE__ */ m(
|
|
669
689
|
"div",
|
|
670
690
|
{
|
|
671
|
-
ref:
|
|
672
|
-
className: b("pnl-zone",
|
|
673
|
-
style: { [
|
|
691
|
+
ref: i,
|
|
692
|
+
className: b("pnl-zone", c ? "pnl-zone--row" : "pnl-zone--col"),
|
|
693
|
+
style: { [c ? "height" : "width"]: y },
|
|
674
694
|
children: [
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
695
|
+
g && /* @__PURE__ */ u(bn, { panel: g, closeLabel: t.closePanel, onFocus: d }),
|
|
696
|
+
g && S && /* @__PURE__ */ u(
|
|
697
|
+
nn,
|
|
678
698
|
{
|
|
679
|
-
axis:
|
|
699
|
+
axis: c ? "horizontal" : "vertical",
|
|
680
700
|
invert: !0,
|
|
681
|
-
size:
|
|
682
|
-
min:
|
|
701
|
+
size: h,
|
|
702
|
+
min: z,
|
|
703
|
+
measure: p,
|
|
683
704
|
label: t.resizeSplit,
|
|
684
|
-
onSize: (
|
|
705
|
+
onSize: (P, O) => s(n, P, O)
|
|
685
706
|
}
|
|
686
707
|
),
|
|
687
|
-
|
|
708
|
+
S && /* @__PURE__ */ u(
|
|
688
709
|
bn,
|
|
689
710
|
{
|
|
690
|
-
|
|
691
|
-
|
|
711
|
+
ref: r,
|
|
712
|
+
panel: S,
|
|
713
|
+
length: g && h !== void 0 ? h : void 0,
|
|
692
714
|
closeLabel: t.closePanel,
|
|
693
|
-
onFocus:
|
|
715
|
+
onFocus: d
|
|
694
716
|
}
|
|
695
717
|
)
|
|
696
718
|
]
|
|
697
719
|
}
|
|
698
|
-
),
|
|
699
|
-
|
|
720
|
+
), L = /* @__PURE__ */ u(
|
|
721
|
+
nn,
|
|
700
722
|
{
|
|
701
|
-
axis:
|
|
702
|
-
invert: !
|
|
703
|
-
size:
|
|
704
|
-
min:
|
|
705
|
-
measure:
|
|
723
|
+
axis: c ? "vertical" : "horizontal",
|
|
724
|
+
invert: !dn(n),
|
|
725
|
+
size: y,
|
|
726
|
+
min: U,
|
|
727
|
+
measure: f,
|
|
706
728
|
label: t.resizeZone,
|
|
707
|
-
onSize: (
|
|
729
|
+
onSize: (P, O) => l(n, P, a || O)
|
|
708
730
|
}
|
|
709
731
|
);
|
|
710
|
-
return
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
] }) : /* @__PURE__ */
|
|
714
|
-
|
|
715
|
-
|
|
732
|
+
return dn(n) ? /* @__PURE__ */ m(j, { children: [
|
|
733
|
+
_,
|
|
734
|
+
L
|
|
735
|
+
] }) : /* @__PURE__ */ m(j, { children: [
|
|
736
|
+
L,
|
|
737
|
+
_
|
|
716
738
|
] });
|
|
717
739
|
}
|
|
718
|
-
const
|
|
740
|
+
const I = Sn(wt);
|
|
719
741
|
function yt({ left: n, right: t, labels: e }) {
|
|
720
|
-
const o = v((
|
|
721
|
-
(
|
|
722
|
-
[
|
|
723
|
-
);
|
|
724
|
-
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: [
|
|
725
747
|
/* @__PURE__ */ u(
|
|
726
748
|
"div",
|
|
727
749
|
{
|
|
750
|
+
ref: s,
|
|
728
751
|
className: b("pnl-band__half", o === void 0 && "pnl-band__half--even"),
|
|
729
752
|
style: o === void 0 ? void 0 : { width: o },
|
|
730
|
-
children: /* @__PURE__ */ u(
|
|
753
|
+
children: /* @__PURE__ */ u(I, { zone: "bottomLeft", labels: e })
|
|
731
754
|
}
|
|
732
755
|
),
|
|
733
756
|
/* @__PURE__ */ u(
|
|
734
|
-
|
|
757
|
+
nn,
|
|
735
758
|
{
|
|
736
759
|
axis: "horizontal",
|
|
737
760
|
size: o,
|
|
738
|
-
min:
|
|
761
|
+
min: z,
|
|
762
|
+
measure: r,
|
|
739
763
|
label: e.resizeBand,
|
|
740
|
-
onSize:
|
|
764
|
+
onSize: i
|
|
741
765
|
}
|
|
742
766
|
),
|
|
743
|
-
/* @__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 }) })
|
|
744
768
|
] });
|
|
745
769
|
}
|
|
746
|
-
function
|
|
770
|
+
function ln(n) {
|
|
747
771
|
return null;
|
|
748
772
|
}
|
|
749
|
-
|
|
773
|
+
ln.displayName = "Panels.Center";
|
|
750
774
|
const St = {
|
|
751
775
|
closePanel: "Close panel",
|
|
752
776
|
resizeZone: "Resize panel area",
|
|
753
777
|
resizeSplit: "Resize the two panels",
|
|
754
778
|
resizeBand: "Resize the bottom panels"
|
|
755
779
|
};
|
|
756
|
-
function
|
|
780
|
+
function an(n) {
|
|
757
781
|
return null;
|
|
758
782
|
}
|
|
759
|
-
|
|
783
|
+
an.displayName = "Panels.Panel";
|
|
760
784
|
function wn({ side: n, header: t, className: e }) {
|
|
761
|
-
const { column: o, band:
|
|
762
|
-
return /* @__PURE__ */
|
|
785
|
+
const { column: o, band: l } = X[n];
|
|
786
|
+
return /* @__PURE__ */ m(
|
|
763
787
|
"div",
|
|
764
788
|
{
|
|
765
789
|
role: "toolbar",
|
|
766
790
|
"aria-orientation": "vertical",
|
|
767
791
|
className: b("pnl-rail", `pnl-rail--${n}`, e),
|
|
768
792
|
children: [
|
|
769
|
-
/* @__PURE__ */
|
|
770
|
-
t !== void 0 && /* @__PURE__ */
|
|
793
|
+
/* @__PURE__ */ m("div", { className: "pnl-rail__group", children: [
|
|
794
|
+
t !== void 0 && /* @__PURE__ */ m(j, { children: [
|
|
771
795
|
t,
|
|
772
|
-
/* @__PURE__ */ u(
|
|
796
|
+
/* @__PURE__ */ u(cn, { orientation: "horizontal" })
|
|
773
797
|
] }),
|
|
774
798
|
o.map((s) => /* @__PURE__ */ u(yn, { zone: s }, s))
|
|
775
799
|
] }),
|
|
776
|
-
/* @__PURE__ */ u(yn, { zone:
|
|
800
|
+
/* @__PURE__ */ u(yn, { zone: l })
|
|
777
801
|
]
|
|
778
802
|
}
|
|
779
803
|
);
|
|
780
804
|
}
|
|
781
805
|
function yn({ zone: n }) {
|
|
782
|
-
const t = ht(n), e =
|
|
783
|
-
return t.length === 0 ? null : /* @__PURE__ */ u("div", { className: "pnl-rail__group", children: t.map(([
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
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;
|
|
787
811
|
return /* @__PURE__ */ u(
|
|
788
812
|
s,
|
|
789
813
|
{
|
|
@@ -791,115 +815,115 @@ function yn({ zone: n }) {
|
|
|
791
815
|
label: a.title,
|
|
792
816
|
active: d,
|
|
793
817
|
accented: d && o,
|
|
794
|
-
onClick: () =>
|
|
818
|
+
onClick: () => l(a.id),
|
|
795
819
|
className: "pnl-rail__button"
|
|
796
820
|
},
|
|
797
821
|
a.id
|
|
798
822
|
);
|
|
799
823
|
})
|
|
800
|
-
] }, `${n}:${
|
|
824
|
+
] }, `${n}:${i}`)) });
|
|
801
825
|
}
|
|
802
|
-
function
|
|
826
|
+
function Pt(n) {
|
|
803
827
|
const t = [], e = /* @__PURE__ */ new Map(), o = [];
|
|
804
|
-
let
|
|
805
|
-
for (const s of
|
|
828
|
+
let l = null;
|
|
829
|
+
for (const s of Dn.toArray(n)) {
|
|
806
830
|
if (!Hn(s)) {
|
|
807
831
|
o.push(s);
|
|
808
832
|
continue;
|
|
809
833
|
}
|
|
810
|
-
if (s.type ===
|
|
811
|
-
|
|
834
|
+
if (s.type === ln) {
|
|
835
|
+
l = s;
|
|
812
836
|
continue;
|
|
813
837
|
}
|
|
814
|
-
if (s.type !==
|
|
838
|
+
if (s.type !== an) {
|
|
815
839
|
o.push(s);
|
|
816
840
|
continue;
|
|
817
841
|
}
|
|
818
|
-
const
|
|
819
|
-
t.push({ ...d, slot: a }), e.set(d.id, { content:
|
|
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 });
|
|
820
844
|
}
|
|
821
|
-
return { specs: t, content: e, centre:
|
|
845
|
+
return { specs: t, content: e, centre: l, loose: o };
|
|
822
846
|
}
|
|
823
847
|
function Fn({
|
|
824
848
|
header: n,
|
|
825
849
|
footer: t,
|
|
826
850
|
railHeader: e,
|
|
827
851
|
labels: o,
|
|
828
|
-
theme:
|
|
852
|
+
theme: l,
|
|
829
853
|
className: s,
|
|
830
|
-
components:
|
|
831
|
-
children:
|
|
832
|
-
...
|
|
854
|
+
components: i,
|
|
855
|
+
children: r,
|
|
856
|
+
...c
|
|
833
857
|
}) {
|
|
834
|
-
return /* @__PURE__ */ u(
|
|
835
|
-
|
|
858
|
+
return /* @__PURE__ */ u(rt, { ...c, children: /* @__PURE__ */ u(
|
|
859
|
+
Nt,
|
|
836
860
|
{
|
|
837
861
|
header: n,
|
|
838
862
|
footer: t,
|
|
839
863
|
railHeader: e,
|
|
840
864
|
labels: o,
|
|
841
|
-
theme:
|
|
865
|
+
theme: l,
|
|
842
866
|
className: s,
|
|
843
|
-
components:
|
|
844
|
-
children:
|
|
867
|
+
components: i,
|
|
868
|
+
children: r
|
|
845
869
|
}
|
|
846
870
|
) });
|
|
847
871
|
}
|
|
848
|
-
function
|
|
872
|
+
function Nt({
|
|
849
873
|
header: n,
|
|
850
874
|
footer: t,
|
|
851
875
|
railHeader: e,
|
|
852
876
|
labels: o,
|
|
853
|
-
theme:
|
|
877
|
+
theme: l,
|
|
854
878
|
className: s,
|
|
855
|
-
components:
|
|
856
|
-
children:
|
|
879
|
+
components: i,
|
|
880
|
+
children: r
|
|
857
881
|
}) {
|
|
858
|
-
const
|
|
859
|
-
|
|
860
|
-
const [d] =
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}, [
|
|
864
|
-
const
|
|
865
|
-
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: [
|
|
866
890
|
n,
|
|
867
|
-
/* @__PURE__ */
|
|
891
|
+
/* @__PURE__ */ m("div", { className: "pnl-middle", children: [
|
|
868
892
|
/* @__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
|
-
|
|
893
|
+
/* @__PURE__ */ m("div", { ref: a, className: "pnl-columns", children: [
|
|
894
|
+
/* @__PURE__ */ u(I, { zone: "top", labels: y }),
|
|
895
|
+
/* @__PURE__ */ m("div", { className: "pnl-row", children: [
|
|
896
|
+
!h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
|
|
897
|
+
/* @__PURE__ */ m("div", { className: "pnl-stack", children: [
|
|
898
|
+
/* @__PURE__ */ m("div", { className: "pnl-row", children: [
|
|
899
|
+
h.left && /* @__PURE__ */ u(I, { zone: "left", labels: y }),
|
|
900
|
+
/* @__PURE__ */ u(Tn, { className: "pnl-centre", children: g?.props.children }),
|
|
901
|
+
h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
|
|
878
902
|
] }),
|
|
879
|
-
/* @__PURE__ */ u(yt, { left:
|
|
903
|
+
/* @__PURE__ */ u(yt, { left: h.left, right: h.right, labels: y })
|
|
880
904
|
] }),
|
|
881
|
-
!
|
|
905
|
+
!h.right && /* @__PURE__ */ u(I, { zone: "right", labels: y })
|
|
882
906
|
] })
|
|
883
907
|
] }),
|
|
884
908
|
/* @__PURE__ */ u(wn, { side: "right" })
|
|
885
909
|
] }),
|
|
886
910
|
t,
|
|
887
|
-
|
|
911
|
+
S
|
|
888
912
|
] }) }) });
|
|
889
913
|
}
|
|
890
|
-
Fn.Panel =
|
|
891
|
-
Fn.Center =
|
|
914
|
+
Fn.Panel = an;
|
|
915
|
+
Fn.Center = ln;
|
|
892
916
|
function Zt() {
|
|
893
|
-
const n =
|
|
894
|
-
(
|
|
895
|
-
const
|
|
896
|
-
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;
|
|
897
921
|
},
|
|
898
922
|
[t]
|
|
899
|
-
), s =
|
|
900
|
-
(
|
|
901
|
-
const
|
|
902
|
-
!
|
|
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);
|
|
903
927
|
},
|
|
904
928
|
[t, n]
|
|
905
929
|
);
|
|
@@ -909,74 +933,74 @@ function Zt() {
|
|
|
909
933
|
reveal: o.show,
|
|
910
934
|
close: s,
|
|
911
935
|
toggle: o.toggle,
|
|
912
|
-
isShown:
|
|
936
|
+
isShown: l,
|
|
913
937
|
focusedZone: e,
|
|
914
938
|
reset: o.reset
|
|
915
939
|
}),
|
|
916
|
-
[t, o.show, o.toggle, o.reset, s,
|
|
940
|
+
[t, o.show, o.toggle, o.reset, s, l, e]
|
|
917
941
|
);
|
|
918
942
|
}
|
|
919
943
|
export {
|
|
920
|
-
|
|
944
|
+
Wn as BOTTOM_ZONES,
|
|
921
945
|
yt as Band,
|
|
922
|
-
|
|
946
|
+
ln as Center,
|
|
923
947
|
pt as ContentProvider,
|
|
924
948
|
St as DEFAULT_LABELS,
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
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,
|
|
933
957
|
bn as PanelFrame,
|
|
934
958
|
mt as PanelHeader,
|
|
935
959
|
Fn as Panels,
|
|
936
|
-
|
|
960
|
+
rt as PanelsProvider,
|
|
937
961
|
wn as Rail,
|
|
938
962
|
yn as RailZone,
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
963
|
+
nn as ResizeHandle,
|
|
964
|
+
Pn as SLOTS,
|
|
965
|
+
cn as Separator,
|
|
942
966
|
Tn as Surface,
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
967
|
+
B as ZONES,
|
|
968
|
+
X as ZONES_BY_SIDE,
|
|
969
|
+
I as ZoneEdge,
|
|
946
970
|
Qn as browserStorage,
|
|
947
971
|
qn as createPanelsStore,
|
|
948
972
|
b as cx,
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
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,
|
|
956
980
|
tt as readLayout,
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
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,
|
|
964
988
|
ut as useBandHalves,
|
|
965
|
-
|
|
989
|
+
lt as useContainerFit,
|
|
966
990
|
gt as usePanelContent,
|
|
967
991
|
Zt as usePanels,
|
|
968
|
-
|
|
992
|
+
D as usePanelsActions,
|
|
969
993
|
On as usePanelsComponents,
|
|
970
994
|
v as usePanelsState,
|
|
971
|
-
|
|
995
|
+
k as usePanelsStore,
|
|
972
996
|
dt as usePointerDrag,
|
|
973
|
-
|
|
974
|
-
|
|
997
|
+
at as useShownIn,
|
|
998
|
+
Lt as useShownSpecsIn,
|
|
975
999
|
ft as useZone,
|
|
976
1000
|
mn as useZoneDraws,
|
|
977
1001
|
ht as useZonePanels,
|
|
978
|
-
|
|
1002
|
+
Ct as useZoneTakesRoom,
|
|
979
1003
|
et as writeLayout,
|
|
980
|
-
|
|
981
|
-
|
|
1004
|
+
$ as zoneDraws,
|
|
1005
|
+
Y as zoneTakesRoom
|
|
982
1006
|
};
|