@pasquelin/panels 0.2.0 → 0.3.1

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