@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.
- package/{COMMITS-qn5rIipN.js → COMMITS-DAem0P4s.js} +107 -98
- package/composites-panels.js +2 -2
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { createContext as h, useContext as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const e =
|
|
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
|
|
13
|
-
return
|
|
12
|
+
function q() {
|
|
13
|
+
return E(f);
|
|
14
14
|
}
|
|
15
|
-
const
|
|
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
|
-
},
|
|
24
|
-
function
|
|
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
|
|
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 &&
|
|
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
|
-
] : [],
|
|
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:
|
|
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,
|
|
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, ...
|
|
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 || !
|
|
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
|
|
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
|
|
141
|
-
const [e, n] = m(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
}, []),
|
|
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
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}, Math.max(0,
|
|
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:
|
|
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
|
-
] :
|
|
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]),
|
|
160
|
+
}, [e.pendingSideEffects, n]), s(() => {
|
|
161
161
|
if (!e.lastClose) return;
|
|
162
|
-
const
|
|
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
|
-
|
|
170
|
+
l
|
|
171
171
|
];
|
|
172
172
|
}, [e.lastClose]);
|
|
173
|
-
const
|
|
174
|
-
() =>
|
|
173
|
+
const o = g(
|
|
174
|
+
() => N(e),
|
|
175
175
|
[e.activePanelId, e.bellCutoutOpen, e.isDirty]
|
|
176
|
-
),
|
|
177
|
-
return { state: e, surfaceState:
|
|
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 =
|
|
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(
|
|
186
|
+
return /* @__PURE__ */ i(f.Provider, { value: t, children: e });
|
|
187
187
|
}
|
|
188
|
-
const
|
|
188
|
+
const x = {
|
|
189
189
|
position: "relative",
|
|
190
190
|
pointerEvents: "auto"
|
|
191
191
|
};
|
|
192
|
-
function
|
|
193
|
-
return /* @__PURE__ */
|
|
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:
|
|
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
|
|
220
|
-
function
|
|
221
|
-
return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(
|
|
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
|
|
224
|
-
const n =
|
|
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
|
|
231
|
-
const e =
|
|
230
|
+
function F() {
|
|
231
|
+
const e = C();
|
|
232
232
|
return e ? e.matches : !1;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function R() {
|
|
235
235
|
return !1;
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return S(
|
|
237
|
+
function k() {
|
|
238
|
+
return S(A, F, R);
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
const t =
|
|
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
|
-
|
|
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:
|
|
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
|
|
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
|
-
},
|
|
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
|
|
284
|
-
const { state: n, dispatch: t, getCloseLog:
|
|
285
|
-
n.activePanelId && !
|
|
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
|
-
),
|
|
297
|
+
), s(() => {
|
|
289
298
|
if (n.activePanelId == null) return;
|
|
290
|
-
function
|
|
291
|
-
|
|
299
|
+
function c(I) {
|
|
300
|
+
I.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
|
|
292
301
|
}
|
|
293
|
-
return document.addEventListener("keydown",
|
|
294
|
-
document.removeEventListener("keydown",
|
|
302
|
+
return document.addEventListener("keydown", c), () => {
|
|
303
|
+
document.removeEventListener("keydown", c);
|
|
295
304
|
};
|
|
296
305
|
}, [n.activePanelId, t]);
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}),
|
|
306
|
+
const a = d(n);
|
|
307
|
+
P(() => {
|
|
308
|
+
a.current = n;
|
|
309
|
+
}), s(() => {
|
|
301
310
|
if (process.env.NODE_ENV === "production") return;
|
|
302
|
-
const
|
|
303
|
-
return
|
|
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: () =>
|
|
306
|
-
getCloseLog:
|
|
314
|
+
getState: () => a.current,
|
|
315
|
+
getCloseLog: r
|
|
307
316
|
}, () => {
|
|
308
|
-
|
|
317
|
+
c.__panelsHostHandle?.dispatch === t && delete c.__panelsHostHandle;
|
|
309
318
|
};
|
|
310
|
-
}, [t,
|
|
311
|
-
const
|
|
319
|
+
}, [t, r]);
|
|
320
|
+
const l = v(() => {
|
|
312
321
|
t({ type: "CLOSE_PANEL", reason: "nav-escape-hatch" });
|
|
313
|
-
}, [t]);
|
|
314
|
-
return /* @__PURE__ */
|
|
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:
|
|
320
|
-
onClick:
|
|
328
|
+
style: B,
|
|
329
|
+
onClick: l
|
|
321
330
|
}
|
|
322
331
|
),
|
|
323
|
-
/* @__PURE__ */ i(
|
|
324
|
-
|
|
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(
|
|
337
|
+
children: /* @__PURE__ */ i(o, { isOpen: !0 })
|
|
329
338
|
}
|
|
330
339
|
) })
|
|
331
|
-
] })
|
|
340
|
+
] });
|
|
332
341
|
}
|
|
333
|
-
const
|
|
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
|
-
|
|
356
|
+
Q as C,
|
|
348
357
|
j as P,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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
|
};
|
package/composites-panels.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as r, u, f as p, c as f } from "./COMMITS-
|
|
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-
|
|
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-
|
|
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";
|