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