@mt-gloss/ui 0.1.90 → 0.1.92

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,18 +1,18 @@
1
- import { jsx as i, jsxs as f, Fragment as I } from "react/jsx-runtime";
2
- import { createContext as h, useContext as p, useReducer as m, useRef as u, useEffect as a, useMemo as E, useCallback as g, useSyncExternalStore as S, useLayoutEffect as _ } from "react";
3
- const d = h(null);
4
- function P() {
5
- const e = p(d);
1
+ import { jsx as i, jsxs as p } from "react/jsx-runtime";
2
+ import { createContext as h, useContext as E, useReducer as m, useRef as d, useEffect as s, useMemo as g, useCallback as v, useSyncExternalStore as S, useState as _, useLayoutEffect as P } from "react";
3
+ const f = h(null);
4
+ function y() {
5
+ const e = E(f);
6
6
  if (!e)
7
7
  throw new Error(
8
8
  "[panels] usePanelContext must be used inside <PanelProvider>. See @mt-gloss/ui/composites/panels."
9
9
  );
10
10
  return e;
11
11
  }
12
- function V() {
13
- return p(d);
12
+ function q() {
13
+ return E(f);
14
14
  }
15
- const y = {
15
+ const O = {
16
16
  activePanelId: null,
17
17
  activeTrigger: null,
18
18
  bellCutoutOpen: !1,
@@ -20,8 +20,8 @@ const y = {
20
20
  lockHint: null,
21
21
  lastClose: null,
22
22
  pendingSideEffects: []
23
- }, O = /* @__PURE__ */ new Set(["settings"]);
24
- function L(e, n) {
23
+ }, L = /* @__PURE__ */ new Set(["settings"]);
24
+ function T(e, n) {
25
25
  if (e == null || e.kind !== n.kind) return !1;
26
26
  switch (e.kind) {
27
27
  case "bell":
@@ -34,7 +34,7 @@ function L(e, n) {
34
34
  return e.global === n.global && e.align === n.align;
35
35
  }
36
36
  }
37
- function T(e, n) {
37
+ function D(e, n) {
38
38
  switch (n.type) {
39
39
  case "OPEN_PANEL": {
40
40
  if (e.activePanelId && e.isDirty)
@@ -52,7 +52,7 @@ function T(e, n) {
52
52
  }
53
53
  ]
54
54
  };
55
- if (e.activePanelId === n.panelId && L(e.activeTrigger, n.trigger))
55
+ if (e.activePanelId === n.panelId && T(e.activeTrigger, n.trigger))
56
56
  return e;
57
57
  const t = e.activePanelId != null ? [
58
58
  {
@@ -60,13 +60,13 @@ function T(e, n) {
60
60
  reason: "mutex-handoff",
61
61
  previousPanelId: e.activePanelId
62
62
  }
63
- ] : [], l = n.panelId === "notification-center" && e.bellCutoutOpen;
63
+ ] : [], r = n.panelId === "notification-center" && e.bellCutoutOpen;
64
64
  return {
65
65
  ...e,
66
66
  activePanelId: n.panelId,
67
67
  activeTrigger: n.trigger,
68
68
  isDirty: !1,
69
- bellCutoutOpen: l ? !1 : e.bellCutoutOpen,
69
+ bellCutoutOpen: r ? !1 : e.bellCutoutOpen,
70
70
  lastClose: null,
71
71
  // reset on fresh open
72
72
  pendingSideEffects: [...e.pendingSideEffects, ...t]
@@ -75,7 +75,7 @@ function T(e, n) {
75
75
  case "CLOSE_PANEL": {
76
76
  if (e.activePanelId == null)
77
77
  return e;
78
- const t = e.activePanelId, l = e.isDirty ? n.reason === "apply-button" ? [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [];
78
+ const t = e.activePanelId, r = e.isDirty ? n.reason === "apply-button" ? [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [];
79
79
  return {
80
80
  ...e,
81
81
  activePanelId: null,
@@ -84,7 +84,7 @@ function T(e, n) {
84
84
  lockHint: null,
85
85
  // closing clears any active lockHint (dirty-buffer condition gone)
86
86
  lastClose: { panelId: t, reason: n.reason },
87
- pendingSideEffects: [...e.pendingSideEffects, ...l]
87
+ pendingSideEffects: [...e.pendingSideEffects, ...r]
88
88
  };
89
89
  }
90
90
  case "OPEN_BELL_CUTOUT":
@@ -101,7 +101,7 @@ function T(e, n) {
101
101
  case "CLOSE_BELL_CUTOUT":
102
102
  return e.bellCutoutOpen ? { ...e, bellCutoutOpen: !1 } : e;
103
103
  case "BUFFER_BECOMES_DIRTY":
104
- return e.activePanelId == null || !O.has(e.activePanelId) ? {
104
+ return e.activePanelId == null || !L.has(e.activePanelId) ? {
105
105
  ...e,
106
106
  pendingSideEffects: [
107
107
  ...e.pendingSideEffects,
@@ -134,32 +134,32 @@ function T(e, n) {
134
134
  return e;
135
135
  }
136
136
  }
137
- function D(e) {
137
+ function N(e) {
138
138
  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";
139
139
  }
140
- function N() {
141
- const [e, n] = m(T, y), t = u([]), l = u(null);
142
- a(() => () => {
143
- l.current != null && (window.clearTimeout(l.current), l.current = null);
144
- }, []), a(() => {
140
+ function w() {
141
+ const [e, n] = m(D, O), t = d([]), r = d(null);
142
+ s(() => () => {
143
+ r.current != null && (window.clearTimeout(r.current), r.current = null);
144
+ }, []), s(() => {
145
145
  if (e.pendingSideEffects.length !== 0) {
146
- for (const r of e.pendingSideEffects)
147
- r.type === "SCHEDULE_TIMER" ? (l.current != null && window.clearTimeout(l.current), l.current = window.setTimeout(() => {
148
- l.current = null, n(r.action);
149
- }, Math.max(0, r.ms))) : r.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: r.hint }) : r.type === "HANDOFF_CLOSE" ? t.current = [
146
+ for (const l of e.pendingSideEffects)
147
+ l.type === "SCHEDULE_TIMER" ? (r.current != null && window.clearTimeout(r.current), r.current = window.setTimeout(() => {
148
+ r.current = null, n(l.action);
149
+ }, Math.max(0, l.ms))) : l.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: l.hint }) : l.type === "HANDOFF_CLOSE" ? t.current = [
150
150
  ...t.current.slice(-99),
151
151
  {
152
- panelId: r.previousPanelId,
152
+ panelId: l.previousPanelId,
153
153
  reason: "mutex-handoff",
154
154
  at: Date.now(),
155
155
  note: "F22: mutex-handoff synthetic close-log entry"
156
156
  }
157
- ] : r.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", r.reason);
157
+ ] : l.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", l.reason);
158
158
  n({ type: "DRAIN_SIDE_EFFECTS" });
159
159
  }
160
- }, [e.pendingSideEffects, n]), a(() => {
160
+ }, [e.pendingSideEffects, n]), s(() => {
161
161
  if (!e.lastClose) return;
162
- const r = {
162
+ const l = {
163
163
  panelId: e.lastClose.panelId,
164
164
  reason: e.lastClose.reason,
165
165
  at: Date.now(),
@@ -167,37 +167,37 @@ function N() {
167
167
  };
168
168
  t.current = [
169
169
  ...t.current.slice(-99),
170
- r
170
+ l
171
171
  ];
172
172
  }, [e.lastClose]);
173
- const c = E(
174
- () => D(e),
173
+ const o = g(
174
+ () => N(e),
175
175
  [e.activePanelId, e.bellCutoutOpen, e.isDirty]
176
- ), s = g(() => t.current.slice(), []);
177
- return { state: e, surfaceState: c, dispatch: n, getCloseLog: s };
176
+ ), a = v(() => t.current.slice(), []);
177
+ return { state: e, surfaceState: o, dispatch: n, getCloseLog: a };
178
178
  }
179
179
  function j({ children: e }) {
180
- const n = N(), t = E(
180
+ const n = w(), t = g(
181
181
  () => n,
182
182
  // Re-publish only when one of the four coordinator fields changes identity.
183
183
  // dispatch + getCloseLog are stable. state + surfaceState change on dispatch.
184
184
  [n.state, n.surfaceState, n.dispatch, n.getCloseLog]
185
185
  );
186
- return /* @__PURE__ */ i(d.Provider, { value: t, children: e });
186
+ return /* @__PURE__ */ i(f.Provider, { value: t, children: e });
187
187
  }
188
- const w = {
188
+ const x = {
189
189
  position: "relative",
190
190
  pointerEvents: "auto"
191
191
  };
192
- function x({ children: e, onClose: n, footer: t }) {
193
- return /* @__PURE__ */ f(
192
+ function H({ children: e, onClose: n, footer: t }) {
193
+ return /* @__PURE__ */ p(
194
194
  "div",
195
195
  {
196
196
  "data-chrome": "panel",
197
197
  role: "dialog",
198
198
  "aria-modal": "true",
199
199
  className: "gloss-panel-chrome",
200
- style: w,
200
+ style: x,
201
201
  children: [
202
202
  /* @__PURE__ */ i("div", { className: "gloss-panel-chrome__header", children: /* @__PURE__ */ i(
203
203
  "button",
@@ -216,44 +216,53 @@ function x({ children: e, onClose: n, footer: t }) {
216
216
  }
217
217
  );
218
218
  }
219
- const H = "(prefers-reduced-motion: reduce)";
220
- function v() {
221
- return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(H);
219
+ const b = "(prefers-reduced-motion: reduce)";
220
+ function C() {
221
+ return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(b);
222
222
  }
223
- function b(e) {
224
- const n = v();
223
+ function A(e) {
224
+ const n = C();
225
225
  return n ? (n.addEventListener("change", e), () => {
226
226
  n.removeEventListener("change", e);
227
227
  }) : () => {
228
228
  };
229
229
  }
230
- function A() {
231
- const e = v();
230
+ function F() {
231
+ const e = C();
232
232
  return e ? e.matches : !1;
233
233
  }
234
- function F() {
234
+ function R() {
235
235
  return !1;
236
236
  }
237
- function R() {
238
- return S(b, A, F);
237
+ function k() {
238
+ return S(A, F, R);
239
239
  }
240
- function k({ isOpen: e, children: n }) {
241
- const t = R(), l = [
240
+ function M({ isOpen: e, children: n }) {
241
+ const t = k(), [r, o] = _(!1);
242
+ s(() => {
243
+ if (!e) {
244
+ o(!1);
245
+ return;
246
+ }
247
+ const l = requestAnimationFrame(() => o(!0));
248
+ return () => cancelAnimationFrame(l);
249
+ }, [e]);
250
+ const a = [
242
251
  "gloss-panel-mount",
243
- e ? "has-panel" : "",
252
+ r ? "has-panel" : "",
244
253
  t ? "reduced-motion" : ""
245
254
  ].filter(Boolean).join(" ");
246
255
  return /* @__PURE__ */ i(
247
256
  "div",
248
257
  {
249
- className: l,
258
+ className: a,
250
259
  "data-mount": "panel",
251
260
  "data-open": e ? "true" : "false",
252
261
  children: n
253
262
  }
254
263
  );
255
264
  }
256
- const M = {
265
+ const U = {
257
266
  position: "fixed",
258
267
  top: 0,
259
268
  left: 0,
@@ -264,7 +273,7 @@ const M = {
264
273
  overflow: "visible",
265
274
  pointerEvents: "none",
266
275
  zIndex: 55
267
- }, U = {
276
+ }, B = {
268
277
  position: "fixed",
269
278
  top: "var(--tb-h, 60px)",
270
279
  left: 0,
@@ -280,57 +289,57 @@ const M = {
280
289
  pointerEvents: "none",
281
290
  background: "rgba(0, 0, 0, 0.04)"
282
291
  };
283
- function q({ panelComponents: e }) {
284
- const { state: n, dispatch: t, getCloseLog: l } = P(), c = n.activePanelId ? e[n.activePanelId] : null;
285
- n.activePanelId && !c && process.env.NODE_ENV !== "production" && console.error(
292
+ function z({ panelComponents: e }) {
293
+ const { state: n, dispatch: t, getCloseLog: r } = y(), o = n.activePanelId ? e[n.activePanelId] : null;
294
+ n.activePanelId && !o && process.env.NODE_ENV !== "production" && console.error(
286
295
  "[panels] No panel component registered for activePanelId:",
287
296
  n.activePanelId
288
- ), a(() => {
297
+ ), s(() => {
289
298
  if (n.activePanelId == null) return;
290
- function o(C) {
291
- C.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
299
+ function c(I) {
300
+ I.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
292
301
  }
293
- return document.addEventListener("keydown", o), () => {
294
- document.removeEventListener("keydown", o);
302
+ return document.addEventListener("keydown", c), () => {
303
+ document.removeEventListener("keydown", c);
295
304
  };
296
305
  }, [n.activePanelId, t]);
297
- const s = u(n);
298
- _(() => {
299
- s.current = n;
300
- }), a(() => {
306
+ const a = d(n);
307
+ P(() => {
308
+ a.current = n;
309
+ }), s(() => {
301
310
  if (process.env.NODE_ENV === "production") return;
302
- const o = window;
303
- return o.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), o.__panelsHostHandle = {
311
+ const c = window;
312
+ return c.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), c.__panelsHostHandle = {
304
313
  dispatch: t,
305
- getState: () => s.current,
306
- getCloseLog: l
314
+ getState: () => a.current,
315
+ getCloseLog: r
307
316
  }, () => {
308
- o.__panelsHostHandle?.dispatch === t && delete o.__panelsHostHandle;
317
+ c.__panelsHostHandle?.dispatch === t && delete c.__panelsHostHandle;
309
318
  };
310
- }, [t, l]);
311
- const r = g(() => {
319
+ }, [t, r]);
320
+ const l = v(() => {
312
321
  t({ type: "CLOSE_PANEL", reason: "nav-escape-hatch" });
313
- }, [t]);
314
- return /* @__PURE__ */ i("div", { "data-panel-host": "true", style: M, children: n.activePanelId != null && c != null && /* @__PURE__ */ f(I, { children: [
315
- /* @__PURE__ */ i(
322
+ }, [t]), u = n.activePanelId != null && o != null;
323
+ return /* @__PURE__ */ p("div", { "data-panel-host": "true", style: U, children: [
324
+ u && /* @__PURE__ */ i(
316
325
  "div",
317
326
  {
318
327
  "data-panel-scrim": "true",
319
- style: U,
320
- onClick: r
328
+ style: B,
329
+ onClick: l
321
330
  }
322
331
  ),
323
- /* @__PURE__ */ i(k, { isOpen: !0, children: /* @__PURE__ */ i(
324
- x,
332
+ /* @__PURE__ */ i(M, { isOpen: u, children: u && /* @__PURE__ */ i(
333
+ H,
325
334
  {
326
335
  isOpen: !0,
327
336
  onClose: () => t({ type: "CLOSE_PANEL", reason: "header-x" }),
328
- children: /* @__PURE__ */ i(c, { isOpen: !0 })
337
+ children: /* @__PURE__ */ i(o, { isOpen: !0 })
329
338
  }
330
339
  ) })
331
- ] }) });
340
+ ] });
332
341
  }
333
- const z = {
342
+ const Q = {
334
343
  "apply-button": !0,
335
344
  // the ONLY commit reason
336
345
  "cancel-button": !1,
@@ -344,16 +353,16 @@ const z = {
344
353
  "nav-escape-hatch": !1
345
354
  };
346
355
  export {
347
- z as C,
356
+ Q as C,
348
357
  j as P,
349
- V as a,
350
- q as b,
351
- x as c,
352
- N as d,
353
- D as e,
354
- k as f,
355
- R as g,
356
- y as i,
357
- T as r,
358
- P as u
358
+ q as a,
359
+ z as b,
360
+ H as c,
361
+ w as d,
362
+ N as e,
363
+ M as f,
364
+ k as g,
365
+ O as i,
366
+ D as r,
367
+ y as u
359
368
  };
@@ -1,5 +1,5 @@
1
- import { a as r, u, f as p, c as f } from "./COMMITS-qn5rIipN.js";
2
- import { C as H, b as N, P as O, e as w, i as A, r as z, d as M, g as D } from "./COMMITS-qn5rIipN.js";
1
+ import { a as r, u, f as p, c as f } from "./COMMITS-DAem0P4s.js";
2
+ import { C as H, b as N, P as O, e as w, i as A, r as z, d as M, g as D } from "./COMMITS-DAem0P4s.js";
3
3
  import { jsxs as c, jsx as a, Fragment as m } from "react/jsx-runtime";
4
4
  import { useEffect as i, useRef as P, useLayoutEffect as h, useCallback as v } from "react";
5
5
  function _({ isOpen: e }) {
package/index.js CHANGED
@@ -6,7 +6,7 @@ import F, { useRef as P, useEffect as A, useState as E, useCallback as C, useId
6
6
  import { motion as G, useMotionValue as tt, AnimatePresence as at, useDragControls as nt } from "framer-motion";
7
7
  import { B as rt, a as X, b as ce, U as fe } from "./UIContext-DP6JGCto.js";
8
8
  import { c as Wo, u as Vo } from "./UIContext-DP6JGCto.js";
9
- import { C as Uo, c as Yo, b as Zo, P as qo, e as Qo, i as Xo, r as Jo, u as el, a as tl, d as al } from "./COMMITS-qn5rIipN.js";
9
+ import { C as Uo, c as Yo, b as Zo, P as qo, e as Qo, i as Xo, r as Jo, u as el, a as tl, d as al } from "./COMMITS-DAem0P4s.js";
10
10
  import { createPortal as st } from "react-dom";
11
11
  import { DEFAULT_MARKET_PRESETS as rl, DEFAULT_PINNED as sl, PERIOD_OPTIONS as il, ROLLING_OPTIONS as ol, TODAY_PRESET as ll, findPreset as cl, formatDateRange as dl, formatMarketDates as ul, formatTrend as ml, formatValue as gl, generateMarketId as pl, getAllPresets as hl, getDateRangeForPreset as fl, getPresetLabel as bl, isInRange as vl, isMarketActive as yl, isSameDay as wl, normalizePresetId as _l, toUppercasePresetId as Cl } from "@mt-gloss/utils";
12
12
  import it from "@mui/icons-material/AccessTime";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mt-gloss/ui",
3
- "version": "0.1.90",
3
+ "version": "0.1.92",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "restricted"