@mt-gloss/ui 0.1.122 → 0.1.124

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.
@@ -1,27 +1,27 @@
1
1
  import { jsx as i, jsxs as N } from "react/jsx-runtime";
2
- import { motion as se } from "framer-motion";
3
- import M, { useSyncExternalStore as ie, useState as H, useRef as w, useMemo as V, useEffect as L, useCallback as O, createContext as le, useContext as W, useReducer as ae, useId as ce, useLayoutEffect as X } from "react";
4
- import { z as T } from "zod";
2
+ import { motion as ie } from "framer-motion";
3
+ import M, { useSyncExternalStore as le, useState as H, useRef as O, useMemo as $, useEffect as w, useCallback as T, createContext as ae, useContext as W, useReducer as ce, useId as X, useLayoutEffect as G } from "react";
4
+ import { z as L } from "zod";
5
5
  const de = "(prefers-reduced-motion: reduce)";
6
- function G() {
6
+ function J() {
7
7
  return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(de);
8
8
  }
9
9
  function ue(e) {
10
- const n = G();
10
+ const n = J();
11
11
  return n ? (n.addEventListener("change", e), () => {
12
12
  n.removeEventListener("change", e);
13
13
  }) : () => {
14
14
  };
15
15
  }
16
16
  function fe() {
17
- const e = G();
17
+ const e = J();
18
18
  return e ? e.matches : !1;
19
19
  }
20
20
  function pe() {
21
21
  return !1;
22
22
  }
23
- function J() {
24
- return ie(ue, fe, pe);
23
+ function ee() {
24
+ return le(ue, fe, pe);
25
25
  }
26
26
  const me = {
27
27
  threshold: "Threshold",
@@ -34,12 +34,12 @@ function ge({
34
34
  activeTab: n,
35
35
  onSelect: t,
36
36
  reduced: r,
37
- labels: o,
37
+ labels: s,
38
38
  ariaLabel: a = "Settings dimensions"
39
39
  }) {
40
- const c = J(), s = r ?? c;
40
+ const c = ee(), o = r ?? c;
41
41
  if (e.length < 2) return null;
42
- const f = (d) => o?.[d] ?? me[d], u = (d, m) => {
42
+ const p = (d) => s?.[d] ?? me[d], u = (d, m) => {
43
43
  d.key === "ArrowRight" ? (d.preventDefault(), t(e[(m + 1) % e.length])) : d.key === "ArrowLeft" ? (d.preventDefault(), t(e[(m - 1 + e.length) % e.length])) : d.key === "Home" ? (d.preventDefault(), t(e[0])) : d.key === "End" && (d.preventDefault(), t(e[e.length - 1]));
44
44
  };
45
45
  return /* @__PURE__ */ i(
@@ -63,9 +63,9 @@ function ge({
63
63
  onClick: () => t(d),
64
64
  onKeyDown: (R) => u(R, m),
65
65
  children: [
66
- /* @__PURE__ */ i("span", { className: "settings-tab-strip__label", children: f(d) }),
67
- _ && !s && /* @__PURE__ */ i(
68
- se.span,
66
+ /* @__PURE__ */ i("span", { className: "settings-tab-strip__label", children: p(d) }),
67
+ _ && !o && /* @__PURE__ */ i(
68
+ ie.span,
69
69
  {
70
70
  layoutId: "settings-active-tab-indicator",
71
71
  "data-layout-id": "settings-active-tab-indicator",
@@ -94,8 +94,8 @@ function Q(e, n) {
94
94
  return t ? t.zoneKey : U(e, n);
95
95
  }
96
96
  function he(e, n, t) {
97
- const r = [...e], [o] = r.splice(n, 1);
98
- return r.splice(t, 0, o), r;
97
+ const r = [...e], [s] = r.splice(n, 1);
98
+ return r.splice(t, 0, s), r;
99
99
  }
100
100
  function ve(e) {
101
101
  return e.map((n) => `${n.zoneKey}:${n.items.map((t) => t.id).join(",")}`).join("|");
@@ -105,47 +105,47 @@ function ye(e) {
105
105
  () => e.zones.map((l) => l.maxItems !== void 0 && l.items.length > l.maxItems ? (process.env.NODE_ENV !== "production" && console.warn(
106
106
  `useSortableZones: zone "${l.zoneKey}" exceeds maxItems (${l.items.length} > ${l.maxItems}); trimming to cap.`
107
107
  ), { ...l, items: l.items.slice(0, l.maxItems) }) : l)
108
- ), [r, o] = H(null), [a, c] = H(null), s = w(null), f = w(e.onZoneChange);
109
- f.current = e.onZoneChange;
110
- const u = V(
108
+ ), [r, s] = H(null), [a, c] = H(null), o = O(null), p = O(e.onZoneChange);
109
+ p.current = e.onZoneChange;
110
+ const u = $(
111
111
  () => ve(e.zones),
112
112
  [e.zones]
113
- ), d = w(u);
114
- L(() => {
113
+ ), d = O(u);
114
+ w(() => {
115
115
  d.current !== u && (d.current = u, !r && t(
116
116
  e.zones.map((l) => l.maxItems !== void 0 && l.items.length > l.maxItems ? (process.env.NODE_ENV !== "production" && console.warn(
117
117
  `useSortableZones: zone "${l.zoneKey}" exceeds maxItems (${l.items.length} > ${l.maxItems}); trimming to cap.`
118
118
  ), { ...l, items: l.items.slice(0, l.maxItems) }) : l)
119
119
  ));
120
120
  }, [u, e.zones, r]);
121
- const m = O(
121
+ const m = T(
122
122
  (l) => {
123
123
  const g = l.active.id;
124
124
  let S = null, y = null;
125
125
  for (const b of n) {
126
- const P = b.items.find((p) => p.id === g);
126
+ const P = b.items.find((f) => f.id === g);
127
127
  if (P) {
128
128
  S = P, y = b.zoneKey;
129
129
  break;
130
130
  }
131
131
  }
132
- s.current = y, o(S), c(y);
132
+ o.current = y, s(S), c(y);
133
133
  },
134
134
  [n]
135
- ), _ = O(
135
+ ), _ = T(
136
136
  (l) => {
137
137
  if (!l.over) {
138
- c(s.current);
138
+ c(o.current);
139
139
  return;
140
140
  }
141
141
  const g = Q(n, l.over.id);
142
142
  c(g);
143
143
  },
144
144
  [n]
145
- ), R = O(
145
+ ), R = T(
146
146
  (l) => {
147
147
  const { active: g, over: S } = l, y = () => {
148
- s.current = null, o(null), c(null);
148
+ o.current = null, s(null), c(null);
149
149
  };
150
150
  if (!S) {
151
151
  y();
@@ -156,42 +156,42 @@ function ye(e) {
156
156
  y();
157
157
  return;
158
158
  }
159
- let p = n.map((E) => ({ ...E, items: [...E.items] }));
159
+ let f = n.map((I) => ({ ...I, items: [...I.items] }));
160
160
  if (b === P) {
161
- const E = p.findIndex((D) => D.zoneKey === b), I = p[E], h = I.items.findIndex((D) => D.id === g.id), C = I.items.findIndex((D) => D.id === S.id), A = C >= 0 ? C : Math.max(0, I.items.length - 1);
162
- p[E] = {
163
- ...I,
164
- items: he(I.items, h, A)
161
+ const I = f.findIndex((D) => D.zoneKey === b), E = f[I], h = E.items.findIndex((D) => D.id === g.id), C = E.items.findIndex((D) => D.id === S.id), F = C >= 0 ? C : Math.max(0, E.items.length - 1);
162
+ f[I] = {
163
+ ...E,
164
+ items: he(E.items, h, F)
165
165
  };
166
166
  } else {
167
- const E = p.findIndex((v) => v.zoneKey === b), I = p.findIndex((v) => v.zoneKey === P), h = p[E], C = p[I], A = h.items.find((v) => v.id === g.id);
168
- if (!A) {
167
+ const I = f.findIndex((v) => v.zoneKey === b), E = f.findIndex((v) => v.zoneKey === P), h = f[I], C = f[E], F = h.items.find((v) => v.id === g.id);
168
+ if (!F) {
169
169
  y();
170
170
  return;
171
171
  }
172
- const D = h.items.filter((v) => v.id !== g.id), z = C.items.findIndex((v) => v.id === S.id), re = z >= 0 ? z : C.items.length;
172
+ const D = h.items.filter((v) => v.id !== g.id), z = C.items.findIndex((v) => v.id === S.id), oe = z >= 0 ? z : C.items.length;
173
173
  let j = D, x = [...C.items];
174
174
  if (C.maxItems !== void 0 && x.length >= C.maxItems) {
175
175
  const v = x[x.length - 1];
176
176
  x = x.slice(0, C.maxItems - 1), j = [...D, v];
177
177
  }
178
- const q = Math.min(re, x.length), oe = [
178
+ const q = Math.min(oe, x.length), se = [
179
179
  ...x.slice(0, q),
180
- A,
180
+ F,
181
181
  ...x.slice(q)
182
182
  ];
183
- p[E] = { ...h, items: j }, p[I] = { ...C, items: oe };
183
+ f[I] = { ...h, items: j }, f[E] = { ...C, items: se };
184
184
  }
185
- t(p), f.current?.(p), y();
185
+ t(f), p.current?.(f), y();
186
186
  },
187
187
  [n]
188
- ), B = O(
188
+ ), B = T(
189
189
  (l) => ({
190
190
  id: l,
191
191
  "data-zone-key": l
192
192
  }),
193
193
  []
194
- ), Z = O(
194
+ ), Z = T(
195
195
  (l) => {
196
196
  const g = U(n, l.id) ?? "";
197
197
  return {
@@ -213,8 +213,8 @@ function ye(e) {
213
213
  handleDragEnd: R
214
214
  };
215
215
  }
216
- let k = null, F = null, K = !1;
217
- const Ee = [
216
+ let k = null, A = null, K = !1;
217
+ const Ie = [
218
218
  "DndContext",
219
219
  "DragOverlay",
220
220
  "useSensors",
@@ -223,22 +223,22 @@ const Ee = [
223
223
  "PointerSensor",
224
224
  "KeyboardSensor",
225
225
  "closestCenter"
226
- ], Ie = [
226
+ ], Ee = [
227
227
  "SortableContext",
228
228
  "useSortable",
229
229
  "verticalListSortingStrategy"
230
230
  ];
231
231
  function Ce(e, n) {
232
232
  const t = [], r = e ?? {};
233
- for (const a of Ee)
234
- r[a] === void 0 && t.push(`@dnd-kit/core:${a}`);
235
- const o = n ?? {};
236
233
  for (const a of Ie)
237
- o[a] === void 0 && t.push(`@dnd-kit/sortable:${a}`);
234
+ r[a] === void 0 && t.push(`@dnd-kit/core:${a}`);
235
+ const s = n ?? {};
236
+ for (const a of Ee)
237
+ s[a] === void 0 && t.push(`@dnd-kit/sortable:${a}`);
238
238
  return t.length === 0 ? { ok: !0 } : { ok: !1, missing: t };
239
239
  }
240
240
  function Se() {
241
- return k ? Promise.resolve(k) : K ? Promise.resolve(null) : F || (F = (async () => {
241
+ return k ? Promise.resolve(k) : K ? Promise.resolve(null) : A || (A = (async () => {
242
242
  try {
243
243
  const [e, n, t] = await Promise.all([
244
244
  import("@dnd-kit/core"),
@@ -257,44 +257,44 @@ function Se() {
257
257
  } catch {
258
258
  return K = !0, null;
259
259
  }
260
- })(), F);
260
+ })(), A);
261
261
  }
262
262
  function be(e) {
263
- const { zones: n, onZoneChange: t, renderZone: r, renderItem: o, renderDragOverlay: a } = e, c = ye({ zones: n, onZoneChange: t }), [s, f] = M.useState(k);
263
+ const { zones: n, onZoneChange: t, renderZone: r, renderItem: s, renderDragOverlay: a } = e, c = ye({ zones: n, onZoneChange: t }), [o, p] = M.useState(k);
264
264
  return M.useEffect(() => {
265
- if (s) return;
265
+ if (o) return;
266
266
  let u = !0;
267
267
  return Se().then((d) => {
268
- u && f(d);
268
+ u && p(d);
269
269
  }), () => {
270
270
  u = !1;
271
271
  };
272
- }, [s]), s ? /* @__PURE__ */ i(
273
- ee,
272
+ }, [o]), o ? /* @__PURE__ */ i(
273
+ ne,
274
274
  {
275
275
  state: c,
276
- modules: s,
276
+ modules: o,
277
277
  renderZone: r,
278
- renderItem: o,
278
+ renderItem: s,
279
279
  renderDragOverlay: a
280
280
  }
281
281
  ) : /* @__PURE__ */ i("div", { "data-sortable-zones-passive": "true", children: c.zones.map((u) => {
282
- const d = u.items.map((m) => /* @__PURE__ */ i(M.Fragment, { children: o(m) }, m.id));
282
+ const d = u.items.map((m) => /* @__PURE__ */ i(M.Fragment, { children: s(m) }, m.id));
283
283
  return /* @__PURE__ */ i("div", { ...c.getZoneProps(u.zoneKey), children: r(u.zoneKey, u.items, d) }, u.zoneKey);
284
284
  }) });
285
285
  }
286
286
  be.displayName = "SortableZones";
287
- function ee({
287
+ function ne({
288
288
  state: e,
289
289
  modules: n,
290
290
  renderZone: t,
291
291
  renderItem: r,
292
- renderDragOverlay: o
292
+ renderDragOverlay: s
293
293
  }) {
294
- const { core: a, sortable: c, utilities: s } = n, { DndContext: f, DragOverlay: u, useSensors: d, useSensor: m, useDroppable: _, PointerSensor: R, KeyboardSensor: B, closestCenter: Z } = a, { SortableContext: l, verticalListSortingStrategy: g } = c, S = d(
294
+ const { core: a, sortable: c, utilities: o } = n, { DndContext: p, DragOverlay: u, useSensors: d, useSensor: m, useDroppable: _, PointerSensor: R, KeyboardSensor: B, closestCenter: Z } = a, { SortableContext: l, verticalListSortingStrategy: g } = c, S = d(
295
295
  m(R, { activationConstraint: { distance: 5 } }),
296
296
  m(B)
297
- ), y = f, b = u, P = l;
297
+ ), y = p, b = u, P = l;
298
298
  return /* @__PURE__ */ N(
299
299
  y,
300
300
  {
@@ -304,56 +304,56 @@ function ee({
304
304
  onDragOver: e.handleDragOver,
305
305
  onDragEnd: e.handleDragEnd,
306
306
  children: [
307
- e.zones.map((p) => {
308
- const E = p.items.map((h) => h.id), I = p.items.map((h) => /* @__PURE__ */ i(
309
- ne,
307
+ e.zones.map((f) => {
308
+ const I = f.items.map((h) => h.id), E = f.items.map((h) => /* @__PURE__ */ i(
309
+ te,
310
310
  {
311
311
  id: h.id,
312
312
  useSortable: c.useSortable,
313
- cssHelper: s.CSS,
313
+ cssHelper: o.CSS,
314
314
  children: r(h)
315
315
  },
316
316
  h.id
317
317
  ));
318
318
  return /* @__PURE__ */ i(
319
- te,
319
+ re,
320
320
  {
321
- zoneKey: p.zoneKey,
322
- zoneProps: e.getZoneProps(p.zoneKey),
321
+ zoneKey: f.zoneKey,
322
+ zoneProps: e.getZoneProps(f.zoneKey),
323
323
  useDroppable: _,
324
- children: /* @__PURE__ */ i(P, { items: E, strategy: g, children: t(p.zoneKey, p.items, I) })
324
+ children: /* @__PURE__ */ i(P, { items: I, strategy: g, children: t(f.zoneKey, f.items, E) })
325
325
  },
326
- p.zoneKey
326
+ f.zoneKey
327
327
  );
328
328
  }),
329
- /* @__PURE__ */ i(b, { children: e.activeItem ? o?.(e.activeItem) ?? r(e.activeItem) : null })
329
+ /* @__PURE__ */ i(b, { children: e.activeItem ? s?.(e.activeItem) ?? r(e.activeItem) : null })
330
330
  ]
331
331
  }
332
332
  );
333
333
  }
334
- ee.displayName = "SortableZonesInner";
335
- function ne({ id: e, useSortable: n, cssHelper: t, children: r }) {
336
- const { attributes: o, listeners: a, setNodeRef: c, transform: s, transition: f, isDragging: u } = n({ id: e }), d = {
337
- transform: t?.Transform?.toString(s) ?? void 0,
338
- transition: f,
334
+ ne.displayName = "SortableZonesInner";
335
+ function te({ id: e, useSortable: n, cssHelper: t, children: r }) {
336
+ const { attributes: s, listeners: a, setNodeRef: c, transform: o, transition: p, isDragging: u } = n({ id: e }), d = {
337
+ transform: t?.Transform?.toString(o) ?? void 0,
338
+ transition: p,
339
339
  opacity: u ? 0.5 : 1
340
340
  };
341
- return /* @__PURE__ */ i("div", { ref: c, style: d, "data-sortable-item-id": e, ...o, ...a, children: r });
341
+ return /* @__PURE__ */ i("div", { ref: c, style: d, "data-sortable-item-id": e, ...s, ...a, children: r });
342
342
  }
343
- ne.displayName = "SortableItem";
344
- function te({
343
+ te.displayName = "SortableItem";
344
+ function re({
345
345
  zoneKey: e,
346
346
  zoneProps: n,
347
347
  useDroppable: t,
348
348
  children: r
349
349
  }) {
350
- const { setNodeRef: o, isOver: a } = t({ id: e });
351
- return /* @__PURE__ */ i("div", { ref: o, "data-zone-is-over": a || void 0, ...n, children: r });
350
+ const { setNodeRef: s, isOver: a } = t({ id: e });
351
+ return /* @__PURE__ */ i("div", { ref: s, "data-zone-is-over": a || void 0, ...n, children: r });
352
352
  }
353
- te.displayName = "ZoneDroppable";
354
- const $ = le(null);
353
+ re.displayName = "ZoneDroppable";
354
+ const V = ae(null);
355
355
  function _e() {
356
- const e = W($);
356
+ const e = W(V);
357
357
  if (!e)
358
358
  throw new Error(
359
359
  "[panels] usePanelContext must be used inside <PanelProvider>. See @mt-gloss/ui/composites/panels."
@@ -361,10 +361,10 @@ function _e() {
361
361
  return e;
362
362
  }
363
363
  function Pe() {
364
- return W($);
364
+ return W(V);
365
365
  }
366
- const De = T.number().min(0).max(100), xe = T.number().min(7).max(90), Ne = T.enum(["#1d6fd8", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6"]), Oe = T.array(T.string().min(1)).max(3), we = T.boolean();
367
- function Le(e, n) {
366
+ const De = L.number().min(0).max(100), xe = L.number().min(7).max(90), Ne = L.enum(["#1d6fd8", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6"]), Oe = L.array(L.string().min(1)).max(3), we = L.boolean();
367
+ function Te(e, n) {
368
368
  if (e === "threshold") {
369
369
  const t = De.safeParse(n);
370
370
  return t.success ? t.data : 80;
@@ -387,7 +387,7 @@ function Le(e, n) {
387
387
  }
388
388
  return n;
389
389
  }
390
- const Te = {
390
+ const Le = {
391
391
  activePanelId: null,
392
392
  activeTrigger: null,
393
393
  bellCutoutOpen: !1,
@@ -456,14 +456,14 @@ function ke(e, n) {
456
456
  case "CLOSE_PANEL": {
457
457
  if (e.activePanelId == null)
458
458
  return e;
459
- const t = e.activePanelId, r = e.activeTrigger?.cardId ?? null, o = r != null ? e.bufferByCard[r] : void 0, a = e.isDirty ? n.reason === "apply-button" ? r != null && o != null ? [
459
+ const t = e.activePanelId, r = e.activeTrigger?.cardId ?? null, s = r != null ? e.bufferByCard[r] : void 0, a = e.isDirty ? n.reason === "apply-button" ? r != null && s != null ? [
460
460
  {
461
461
  type: "COMMIT_BUFFER",
462
- payload: { cardId: r, delta: o }
462
+ payload: { cardId: r, delta: s }
463
463
  }
464
- ] : [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [], c = r != null && o != null ? (() => {
465
- const s = { ...e.bufferByCard };
466
- return delete s[r], s;
464
+ ] : [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [], c = r != null && s != null ? (() => {
465
+ const o = { ...e.bufferByCard };
466
+ return delete o[r], o;
467
467
  })() : e.bufferByCard;
468
468
  return {
469
469
  ...e,
@@ -501,13 +501,13 @@ function ke(e, n) {
501
501
  { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
502
502
  ]
503
503
  };
504
- const t = e.bufferByCard[n.cardId], r = t == null, o = Le(n.key, n.value);
505
- if (!r && t.changes[n.key] === o)
504
+ const t = e.bufferByCard[n.cardId], r = t == null, s = Te(n.key, n.value);
505
+ if (!r && t.changes[n.key] === s)
506
506
  return e;
507
507
  const c = { kind: "settings", changes: {
508
508
  ...t?.kind === "settings" ? t.changes : {},
509
- [n.key]: o
510
- } }, s = { ...e.bufferByCard, [n.cardId]: c }, f = r ? [
509
+ [n.key]: s
510
+ } }, o = { ...e.bufferByCard, [n.cardId]: c }, p = r ? [
511
511
  {
512
512
  type: "SCHEDULE_TIMER",
513
513
  ms: 0,
@@ -516,15 +516,15 @@ function ke(e, n) {
516
516
  ] : [];
517
517
  return {
518
518
  ...e,
519
- bufferByCard: s,
520
- pendingSideEffects: [...e.pendingSideEffects, ...f]
519
+ bufferByCard: o,
520
+ pendingSideEffects: [...e.pendingSideEffects, ...p]
521
521
  };
522
522
  }
523
523
  case "CLEAR_BUFFER": {
524
524
  if (e.bufferByCard[n.cardId] == null)
525
525
  return e;
526
- const r = Object.keys(e.bufferByCard).length === 1, o = { ...e.bufferByCard };
527
- delete o[n.cardId];
526
+ const r = Object.keys(e.bufferByCard).length === 1, s = { ...e.bufferByCard };
527
+ delete s[n.cardId];
528
528
  const a = r && e.isDirty ? [
529
529
  {
530
530
  type: "SCHEDULE_TIMER",
@@ -534,7 +534,7 @@ function ke(e, n) {
534
534
  ] : [];
535
535
  return {
536
536
  ...e,
537
- bufferByCard: o,
537
+ bufferByCard: s,
538
538
  pendingSideEffects: [...e.pendingSideEffects, ...a]
539
539
  };
540
540
  }
@@ -575,31 +575,31 @@ function ke(e, n) {
575
575
  return e;
576
576
  }
577
577
  }
578
- function Ae(e) {
578
+ function Fe(e) {
579
579
  return e.activePanelId === "notification-center" ? "notif-center" : e.activePanelId != null && e.bellCutoutOpen ? e.isDirty ? "panel-dirty+cutout" : "panel-clean+cutout" : e.activePanelId != null ? e.isDirty ? "panel-dirty" : "panel-clean" : e.bellCutoutOpen ? "bell-cutout-only" : "idle";
580
580
  }
581
- function Fe() {
582
- const [e, n] = ae(ke, Te), t = w([]), r = w(null);
583
- L(() => () => {
581
+ function Ae() {
582
+ const [e, n] = ce(ke, Le), t = O([]), r = O(null);
583
+ w(() => () => {
584
584
  r.current != null && (window.clearTimeout(r.current), r.current = null);
585
- }, []), L(() => {
585
+ }, []), w(() => {
586
586
  const c = e.pendingSideEffects.length;
587
587
  if (c !== 0) {
588
- for (const s of e.pendingSideEffects)
589
- s.type === "SCHEDULE_TIMER" ? (r.current != null && window.clearTimeout(r.current), r.current = window.setTimeout(() => {
590
- r.current = null, n(s.action);
591
- }, Math.max(0, s.ms))) : s.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: s.hint }) : s.type === "HANDOFF_CLOSE" ? t.current = [
588
+ for (const o of e.pendingSideEffects)
589
+ o.type === "SCHEDULE_TIMER" ? (r.current != null && window.clearTimeout(r.current), r.current = window.setTimeout(() => {
590
+ r.current = null, n(o.action);
591
+ }, Math.max(0, o.ms))) : o.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: o.hint }) : o.type === "HANDOFF_CLOSE" ? t.current = [
592
592
  ...t.current.slice(-99),
593
593
  {
594
- panelId: s.previousPanelId,
594
+ panelId: o.previousPanelId,
595
595
  reason: "mutex-handoff",
596
596
  at: Date.now(),
597
597
  note: "F22: mutex-handoff synthetic close-log entry"
598
598
  }
599
- ] : s.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", s.reason);
599
+ ] : o.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", o.reason);
600
600
  n({ type: "DRAIN_SIDE_EFFECTS", count: c });
601
601
  }
602
- }, [e.pendingSideEffects, n]), L(() => {
602
+ }, [e.pendingSideEffects, n]), w(() => {
603
603
  if (!e.lastClose) return;
604
604
  const c = {
605
605
  panelId: e.lastClose.panelId,
@@ -612,20 +612,20 @@ function Fe() {
612
612
  c
613
613
  ];
614
614
  }, [e.lastClose]);
615
- const o = V(
616
- () => Ae(e),
615
+ const s = $(
616
+ () => Fe(e),
617
617
  [e.activePanelId, e.bellCutoutOpen, e.isDirty]
618
- ), a = O(() => t.current.slice(), []);
619
- return { state: e, surfaceState: o, dispatch: n, getCloseLog: a };
618
+ ), a = T(() => t.current.slice(), []);
619
+ return { state: e, surfaceState: s, dispatch: n, getCloseLog: a };
620
620
  }
621
621
  function Je({ children: e }) {
622
- const n = Fe(), t = V(
622
+ const n = Ae(), t = $(
623
623
  () => n,
624
624
  // Re-publish only when one of the four coordinator fields changes identity.
625
625
  // dispatch + getCloseLog are stable. state + surfaceState change on dispatch.
626
626
  [n.state, n.surfaceState, n.dispatch, n.getCloseLog]
627
627
  );
628
- return /* @__PURE__ */ i($.Provider, { value: t, children: e });
628
+ return /* @__PURE__ */ i(V.Provider, { value: t, children: e });
629
629
  }
630
630
  function He({ title: e, onClose: n, titleId: t }) {
631
631
  return /* @__PURE__ */ N("div", { className: "gloss-panel-chrome-v2__header", children: [
@@ -671,29 +671,29 @@ function Ue({
671
671
  onClose: n,
672
672
  title: t,
673
673
  variant: r = "no-stage",
674
- stage: o,
674
+ stage: s,
675
675
  navigation: a,
676
676
  footer: c
677
677
  }) {
678
- const s = t == null && r === "with-stage", f = ce(), u = t != null;
678
+ const o = t == null && r === "with-stage", p = X(), u = t != null;
679
679
  return /* @__PURE__ */ N(
680
680
  "div",
681
681
  {
682
682
  "data-chrome": "panel-v2",
683
683
  "data-chrome-variant": r,
684
- "data-headerless": s || void 0,
684
+ "data-headerless": o || void 0,
685
685
  role: "dialog",
686
686
  "aria-modal": "true",
687
- "aria-labelledby": u ? f : void 0,
687
+ "aria-labelledby": u ? p : void 0,
688
688
  "aria-label": u ? void 0 : "Panel",
689
- className: `gloss-panel-chrome-v2 gloss-panel-chrome-v2--${r}${s ? " gloss-panel-chrome-v2--headerless" : ""}`,
689
+ className: `gloss-panel-chrome-v2 gloss-panel-chrome-v2--${r}${o ? " gloss-panel-chrome-v2--headerless" : ""}`,
690
690
  children: [
691
- !s && /* @__PURE__ */ i(He, { title: t, onClose: n, titleId: f }),
692
- r === "with-stage" && /* @__PURE__ */ i(Be, { children: o }),
691
+ !o && /* @__PURE__ */ i(He, { title: t, onClose: n, titleId: p }),
692
+ r === "with-stage" && /* @__PURE__ */ i(Be, { children: s }),
693
693
  a != null && /* @__PURE__ */ i(Ze, { children: a }),
694
694
  /* @__PURE__ */ i(Me, { children: e }),
695
695
  c != null && /* @__PURE__ */ i(Ke, { left: c.left, right: c.right }),
696
- s && /* @__PURE__ */ i(
696
+ o && /* @__PURE__ */ i(
697
697
  "button",
698
698
  {
699
699
  id: "panel-close",
@@ -728,27 +728,28 @@ function en({ isOpen: e }) {
728
728
  }
729
729
  );
730
730
  }
731
- const Ve = {
731
+ const $e = {
732
732
  position: "relative",
733
733
  pointerEvents: "auto"
734
734
  };
735
- function $e({ children: e, onClose: n, footer: t, title: r, variant: o = "default" }) {
735
+ function Ve({ children: e, onClose: n, footer: t, title: r, variant: s = "default" }) {
736
+ const a = `panel-close-${X().replace(/:/g, "-")}`;
736
737
  return /* @__PURE__ */ N(
737
738
  "div",
738
739
  {
739
740
  "data-chrome": "panel",
740
- "data-chrome-variant": o,
741
+ "data-chrome-variant": s,
741
742
  role: "dialog",
742
743
  "aria-modal": "true",
743
- className: o === "merged-stage" ? "gloss-panel-chrome gloss-panel-chrome--merged-stage" : "gloss-panel-chrome",
744
- style: Ve,
744
+ className: s === "merged-stage" ? "gloss-panel-chrome gloss-panel-chrome--merged-stage" : "gloss-panel-chrome",
745
+ style: $e,
745
746
  children: [
746
747
  /* @__PURE__ */ N("div", { className: "gloss-panel-chrome__header", children: [
747
748
  r != null && /* @__PURE__ */ i("span", { className: "gloss-panel-chrome__title", children: r }),
748
749
  /* @__PURE__ */ i(
749
750
  "button",
750
751
  {
751
- id: "panel-close",
752
+ id: a,
752
753
  type: "button",
753
754
  "aria-label": "Close panel",
754
755
  className: "gloss-panel-chrome__close",
@@ -775,22 +776,22 @@ function ze(e) {
775
776
  );
776
777
  }
777
778
  function je({ isOpen: e, children: n }) {
778
- const t = J(), r = w(null);
779
- X(() => {
779
+ const t = ee(), r = O(null);
780
+ G(() => {
780
781
  ze(r.current);
781
782
  }, []);
782
- const [o, a] = H(!1);
783
- L(() => {
783
+ const [s, a] = H(!1);
784
+ w(() => {
784
785
  if (!e) {
785
786
  a(!1);
786
787
  return;
787
788
  }
788
- const s = requestAnimationFrame(() => a(!0));
789
- return () => cancelAnimationFrame(s);
789
+ const o = requestAnimationFrame(() => a(!0));
790
+ return () => cancelAnimationFrame(o);
790
791
  }, [e]);
791
792
  const c = [
792
793
  "gloss-panel-mount",
793
- o ? "has-panel" : "",
794
+ s ? "has-panel" : "",
794
795
  t ? "reduced-motion" : ""
795
796
  ].filter(Boolean).join(" ");
796
797
  return /* @__PURE__ */ i(
@@ -823,60 +824,55 @@ const qe = {
823
824
  bottom: 0,
824
825
  zIndex: 1,
825
826
  // CR-03 fix: pass-through tint — scrim is visual-only and must not intercept
826
- // grid card clicks. Click-outside / scrim-dismiss is handled via the onClick
827
- // on the div below, which still fires because pointer events on the element
828
- // itself are honoured when explicitly set; using 'none' prevents the invisible
829
- // overlay from swallowing clicks on underlying controls (same class as the
830
- // panel-wrapper-covers-grid-cards bug fixed at V2FeedbackSurface).
827
+ // grid card clicks. Dismiss is via ESC keydown (see useEffect above) only;
828
+ // no scrim-click-to-close by design (prevents accidental dismissal while
829
+ // interacting with cards behind the scrim).
831
830
  pointerEvents: "none",
832
831
  background: "rgba(0, 0, 0, 0.04)"
833
832
  };
834
833
  function nn({ panelComponents: e }) {
835
- const { state: n, dispatch: t, getCloseLog: r } = _e(), o = n.activePanelId ? e[n.activePanelId] : null;
836
- n.activePanelId && !o && process.env.NODE_ENV !== "production" && console.error(
834
+ const { state: n, dispatch: t, getCloseLog: r } = _e(), s = n.activePanelId ? e[n.activePanelId] : null;
835
+ n.activePanelId && !s && process.env.NODE_ENV !== "production" && console.error(
837
836
  "[panels] No panel component registered for activePanelId:",
838
837
  n.activePanelId
839
- ), L(() => {
838
+ ), w(() => {
840
839
  if (n.activePanelId == null) return;
841
- function f(u) {
842
- u.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
840
+ function o(p) {
841
+ p.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
843
842
  }
844
- return document.addEventListener("keydown", f), () => {
845
- document.removeEventListener("keydown", f);
843
+ return document.addEventListener("keydown", o), () => {
844
+ document.removeEventListener("keydown", o);
846
845
  };
847
846
  }, [n.activePanelId, t]);
848
- const a = w(n);
849
- X(() => {
847
+ const a = O(n);
848
+ G(() => {
850
849
  a.current = n;
851
- }), L(() => {
850
+ }), w(() => {
852
851
  if (process.env.NODE_ENV === "production") return;
853
- const f = window;
854
- return f.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), f.__panelsHostHandle = {
852
+ const o = window;
853
+ return o.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), o.__panelsHostHandle = {
855
854
  dispatch: t,
856
855
  getState: () => a.current,
857
856
  getCloseLog: r
858
857
  }, () => {
859
- f.__panelsHostHandle?.dispatch === t && delete f.__panelsHostHandle;
858
+ o.__panelsHostHandle?.dispatch === t && delete o.__panelsHostHandle;
860
859
  };
861
860
  }, [t, r]);
862
- const c = O(() => {
863
- t({ type: "CLOSE_PANEL", reason: "nav-escape-hatch" });
864
- }, [t]), s = n.activePanelId != null && o != null;
861
+ const c = n.activePanelId != null && s != null;
865
862
  return /* @__PURE__ */ N("div", { "data-panel-host": "true", style: qe, children: [
866
- s && /* @__PURE__ */ i(
863
+ c && /* @__PURE__ */ i(
867
864
  "div",
868
865
  {
869
866
  "data-panel-scrim": "true",
870
- style: Qe,
871
- onClick: c
867
+ style: Qe
872
868
  }
873
869
  ),
874
- /* @__PURE__ */ i(je, { isOpen: s, children: s && /* @__PURE__ */ i(
875
- $e,
870
+ /* @__PURE__ */ i(je, { isOpen: c, children: c && /* @__PURE__ */ i(
871
+ Ve,
876
872
  {
877
873
  isOpen: !0,
878
874
  onClose: () => t({ type: "CLOSE_PANEL", reason: "header-x" }),
879
- children: /* @__PURE__ */ i(o, { isOpen: !0 })
875
+ children: /* @__PURE__ */ i(s, { isOpen: !0 })
880
876
  }
881
877
  ) })
882
878
  ] });
@@ -904,19 +900,18 @@ export {
904
900
  ye as a,
905
901
  _e as b,
906
902
  nn as c,
907
- $e as d,
903
+ Ae as d,
908
904
  Fe as e,
909
- Ae as f,
910
- ge as g,
911
- J as h,
912
- Te as i,
913
- Ue as j,
914
- je as k,
915
- He as l,
916
- Be as m,
917
- Ze as n,
918
- Me as o,
919
- Ke as p,
905
+ ge as f,
906
+ ee as g,
907
+ Ue as h,
908
+ Le as i,
909
+ je as j,
910
+ He as k,
911
+ Be as l,
912
+ Ze as m,
913
+ Me as n,
914
+ Ke as o,
920
915
  ke as r,
921
916
  Pe as u
922
917
  };