@mt-gloss/ui 0.1.138 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/{BaseAsyncButton-CJlY7Uik.js → BaseAsyncButton-Cq_l7clO.js} +29 -30
  2. package/COMMITS-Dm8qIHaq.js +444 -0
  3. package/Expandable-BcmIxWR8.js +13807 -0
  4. package/UIContext-DP6JGCto.js +1731 -0
  5. package/catalog.js +120 -122
  6. package/composites-panels.js +578 -1442
  7. package/index.d.ts +4 -2
  8. package/index.js +2368 -2029
  9. package/internals.js +80 -81
  10. package/lib/base/BaseAccordion/BaseAccordion.d.ts +4 -24
  11. package/lib/base/BaseCard/BaseCard.d.ts +8 -48
  12. package/lib/base/BaseCheckbox/BaseCheckbox.d.ts +1 -6
  13. package/lib/base/BaseInput/BaseInput.d.ts +1 -6
  14. package/lib/base/BaseMaskedInput/BaseMaskedInput.d.ts +1 -6
  15. package/lib/base/BaseMenu/BaseMenu.d.ts +2 -12
  16. package/lib/base/BaseRadio/BaseRadio.d.ts +1 -6
  17. package/lib/base/BaseRating/BaseRating.d.ts +1 -6
  18. package/lib/base/BaseSegmentedControl/BaseSegmentedControl.d.ts +1 -6
  19. package/lib/base/BaseSelect/BaseSelect.d.ts +2 -12
  20. package/lib/base/BaseTextarea/BaseTextarea.d.ts +1 -6
  21. package/lib/base/BaseToggle/BaseToggle.d.ts +1 -6
  22. package/lib/base/BaseTooltip/BaseTooltip.d.ts +1 -6
  23. package/lib/composites/dashboard/BellPopover/BellPopover.d.ts +0 -12
  24. package/lib/composites/forms/PasswordInput.d.ts +1 -6
  25. package/lib/composites/forms/PhoneInput.d.ts +1 -6
  26. package/lib/composites/forms/SearchInput.d.ts +1 -6
  27. package/lib/composites/forms/TagInput.d.ts +1 -6
  28. package/lib/composites/inputs/FilterChip.d.ts +1 -6
  29. package/lib/composites/overlay/SplitButton/SplitButton.d.ts +1 -6
  30. package/lib/composites/panels/PanelChrome.d.ts +1 -23
  31. package/lib/composites/panels/PanelSlot.d.ts +3 -14
  32. package/lib/composites/panels/coordinator/types.d.ts +1 -12
  33. package/lib/composites/panels/index.d.ts +4 -5
  34. package/lib/composites/panels/shells/CatalogAddShell.d.ts +8 -21
  35. package/lib/composites/panels/shells/CatalogReplaceShell.d.ts +4 -9
  36. package/lib/composites/panels/shells/PageMgmtShell.d.ts +3 -28
  37. package/lib/composites/panels/shells/SettingsShell.d.ts +3 -55
  38. package/lib/composites/panels/shells/index.d.ts +2 -2
  39. package/lib/composites/panels/shells/internals/CatalogLensPicker.d.ts +1 -14
  40. package/lib/composites/panels/shells/internals/CatalogTileGrid.d.ts +1 -18
  41. package/lib/composites/panels/shells/internals/PageMgmtFooter.d.ts +0 -11
  42. package/lib/composites/panels/shells/internals/PageMgmtRow.d.ts +1 -6
  43. package/lib/composites/panels/shells/internals/catalog-mocks.d.ts +8 -145
  44. package/lib/composites/panels/stage3d/CloneStage.d.ts +1 -11
  45. package/lib/containers/ContainerDialog/ContainerDialog.d.ts +3 -18
  46. package/lib/containers/ContainerFormSection/ContainerFormSection.d.ts +1 -6
  47. package/lib/containers/ContainerPanel/ContainerPanel.d.ts +1 -6
  48. package/lib/containers/ContainerTable/ContainerTable.d.ts +1 -6
  49. package/lib/containers/ContainerToolbar/ContainerToolbar.d.ts +1 -6
  50. package/lib/facade/index.d.ts +2 -0
  51. package/lib/presets/PresetAccordion/PresetAccordion.d.ts +4 -24
  52. package/lib/presets/PresetBadge/PresetBadge.d.ts +1 -6
  53. package/lib/presets/PresetCard/PresetCard.d.ts +8 -48
  54. package/lib/presets/PresetCheckbox/PresetCheckbox.d.ts +1 -6
  55. package/lib/presets/PresetChip/PresetChip.d.ts +1 -6
  56. package/lib/presets/PresetColorPicker/PresetColorPicker.d.ts +1 -6
  57. package/lib/presets/PresetDatePicker/PresetDatePicker.d.ts +1 -6
  58. package/lib/presets/PresetDateRangePicker/PresetDateRangePicker.d.ts +1 -6
  59. package/lib/presets/PresetFileUpload/PresetFileUpload.d.ts +1 -6
  60. package/lib/presets/PresetInput/PresetInput.d.ts +1 -6
  61. package/lib/presets/PresetLink/PresetLink.d.ts +1 -6
  62. package/lib/presets/PresetMaskedInput/PresetMaskedInput.d.ts +1 -6
  63. package/lib/presets/PresetMenu/PresetMenu.d.ts +2 -13
  64. package/lib/presets/PresetNumberInput/PresetNumberInput.d.ts +1 -6
  65. package/lib/presets/PresetRadio/PresetRadio.d.ts +1 -6
  66. package/lib/presets/PresetRangeSlider/PresetRangeSlider.d.ts +1 -6
  67. package/lib/presets/PresetRating/PresetRating.d.ts +1 -6
  68. package/lib/presets/PresetTextarea/PresetTextarea.d.ts +1 -6
  69. package/lib/presets/PresetTimePicker/PresetTimePicker.d.ts +1 -6
  70. package/lib/presets/PresetToggle/PresetToggle.d.ts +1 -6
  71. package/lib/primitives/dashboard/ResizePill/ResizePill.d.ts +1 -7
  72. package/lib/primitives/dashboard/index.d.ts +0 -1
  73. package/lib/wrappers/Actionable/Actionable.d.ts +1 -6
  74. package/lib/wrappers/AsyncLoader/AsyncLoader.d.ts +1 -6
  75. package/lib/wrappers/ButtonGroup/ButtonGroup.d.ts +1 -6
  76. package/lib/wrappers/CheckboxGroup/CheckboxGroup.d.ts +1 -6
  77. package/lib/wrappers/Dismissible/Dismissible.d.ts +1 -6
  78. package/lib/wrappers/Expandable/Expandable.d.ts +1 -6
  79. package/lib/wrappers/InputGroup/InputGroup.d.ts +2 -12
  80. package/lib/wrappers/RadioGroup/RadioGroup.d.ts +1 -6
  81. package/lib/wrappers/Selectable/Selectable.d.ts +1 -6
  82. package/lib/wrappers/Sortable/Sortable.d.ts +1 -6
  83. package/package.json +1 -1
  84. package/ui.css +1 -1
  85. package/BaseText-Dxbk1JJa.js +0 -66
  86. package/COMMITS-aGwevMtR.js +0 -975
  87. package/Expandable-G7SCUlMb.js +0 -13245
  88. package/MetricCard-DOPtBpek.js +0 -698
  89. package/UIContext-CGQI_KJk.js +0 -1808
  90. package/lib/composites/panels/chrome-v2/PanelBody.d.ts +0 -5
  91. package/lib/composites/panels/chrome-v2/PanelChromeV2.d.ts +0 -18
  92. package/lib/composites/panels/chrome-v2/PanelFooter.d.ts +0 -6
  93. package/lib/composites/panels/chrome-v2/PanelFooterMessage.d.ts +0 -6
  94. package/lib/composites/panels/chrome-v2/PanelHeader.d.ts +0 -10
  95. package/lib/composites/panels/chrome-v2/PanelNavigation.d.ts +0 -5
  96. package/lib/composites/panels/chrome-v2/PanelStage.d.ts +0 -5
  97. package/lib/composites/panels/chrome-v2/index.d.ts +0 -23
  98. package/lib/composites/panels/coordinator/settingsBufferSchemas.d.ts +0 -18
  99. package/lib/composites/panels/hooks/useEditingCardId.d.ts +0 -16
  100. package/lib/composites/panels/shells/NotificationCenterShell.d.ts +0 -2
  101. package/lib/composites/panels/shells/settings/ColorControls.d.ts +0 -13
  102. package/lib/composites/panels/shells/settings/SlotsControls.d.ts +0 -6
  103. package/lib/composites/panels/shells/settings/ThresholdControls.d.ts +0 -10
  104. package/lib/composites/panels/shells/settings/TimeframeControls.d.ts +0 -6
  105. package/lib/composites/panels/shells/settings/index.d.ts +0 -12
  106. package/lib/primitives/dashboard/SettingsTabStrip/SettingsTabStrip.d.ts +0 -17
  107. package/lib/primitives/dashboard/SettingsTabStrip/index.d.ts +0 -6
  108. package/lib/primitives/dashboard/SettingsTabStrip/types.d.ts +0 -12
@@ -1,49 +1,48 @@
1
1
  import { jsx as o, jsxs as m } from "react/jsx-runtime";
2
- import { c as p } from "./BaseText-Dxbk1JJa.js";
3
- import b, { useEffect as B } from "react";
4
- import { b as f, ah as g, e as _ } from "./UIContext-CGQI_KJk.js";
5
- const h = function(t) {
6
- const { as: e, htmlFor: s, className: l, ...n } = t;
2
+ import { g as p, d as B, al as g, i as _ } from "./UIContext-DP6JGCto.js";
3
+ import b, { useEffect as f } from "react";
4
+ const N = function(l) {
5
+ const { as: e, htmlFor: s, className: t, ...n } = l;
7
6
  return /* @__PURE__ */ o(
8
7
  p,
9
8
  {
10
9
  as: e || "label",
11
10
  htmlFor: s,
12
- className: l ? `gloss-base-label ${l}` : "gloss-base-label",
11
+ className: t ? `gloss-base-label ${t}` : "gloss-base-label",
13
12
  ...n
14
13
  }
15
14
  );
16
15
  };
17
- h.displayName = "BaseLabel";
18
- const N = function(t) {
19
- const { as: e, className: s, ...l } = t;
16
+ N.displayName = "BaseLabel";
17
+ const h = function(l) {
18
+ const { as: e, className: s, ...t } = l;
20
19
  return /* @__PURE__ */ o(
21
20
  p,
22
21
  {
23
22
  as: e || "span",
24
23
  "data-role": "value",
25
24
  className: s ? `gloss-base-value ${s}` : "gloss-base-value",
26
- ...l
25
+ ...t
27
26
  }
28
27
  );
29
28
  };
30
- N.displayName = "BaseValue";
29
+ h.displayName = "BaseValue";
31
30
  function v({
32
31
  definition: a,
33
- open: t,
32
+ open: l,
34
33
  onDismiss: e,
35
34
  className: s,
36
- style: l,
35
+ style: t,
37
36
  children: n
38
37
  }) {
39
38
  const c = a?.position ?? "top-right", r = a?.duration ?? 0;
40
- B(() => {
41
- if (!t || r <= 0 || !e) return;
39
+ f(() => {
40
+ if (!l || r <= 0 || !e) return;
42
41
  const y = setTimeout(() => {
43
42
  e();
44
43
  }, r);
45
44
  return () => clearTimeout(y);
46
- }, [t, r, e]);
45
+ }, [l, r, e]);
47
46
  const i = {
48
47
  portal: !0,
49
48
  dismissOnClickOutside: !1,
@@ -55,16 +54,16 @@ function v({
55
54
  zIndex: a?.zIndex
56
55
  }, u = ["gloss-base-toast", `gloss-base-toast--${c}`];
57
56
  return s && u.push(s), /* @__PURE__ */ o(
58
- f,
57
+ B,
59
58
  {
60
59
  definition: i,
61
- open: t,
60
+ open: l,
62
61
  onDismiss: e,
63
62
  children: /* @__PURE__ */ o(
64
63
  "div",
65
64
  {
66
65
  className: u.join(" "),
67
- style: l,
66
+ style: t,
68
67
  role: "status",
69
68
  "aria-live": "polite",
70
69
  children: n
@@ -83,11 +82,11 @@ const A = {
83
82
  iconColor: "--_icon-color"
84
83
  };
85
84
  function C(a) {
86
- const { definition: t, className: e, style: s, role: l, children: n, ...c } = a, { style: r, dataAttrs: i } = g(t, A);
85
+ const { definition: l, className: e, style: s, role: t, children: n, ...c } = a, { style: r, dataAttrs: i } = g(l, A);
87
86
  return /* @__PURE__ */ o(
88
87
  "div",
89
88
  {
90
- role: l || "alert",
89
+ role: t || "alert",
91
90
  className: e ? `gloss-base-alert ${e}` : "gloss-base-alert",
92
91
  style: { ...r, ...s },
93
92
  ...i,
@@ -103,8 +102,8 @@ const S = {
103
102
  fontSize: "--_font-size"
104
103
  };
105
104
  function $(a) {
106
- const { definition: t, separator: e = "/", className: s, style: l, children: n } = a, { style: c } = g(
107
- t,
105
+ const { definition: l, separator: e = "/", className: s, style: t, children: n } = a, { style: c } = g(
106
+ l,
108
107
  S
109
108
  ), r = b.Children.toArray(n);
110
109
  return /* @__PURE__ */ o(
@@ -112,7 +111,7 @@ function $(a) {
112
111
  {
113
112
  "aria-label": "Breadcrumb",
114
113
  className: s ? `gloss-base-breadcrumbs-nav ${s}` : "gloss-base-breadcrumbs-nav",
115
- style: { ...c, ...l },
114
+ style: { ...c, ...t },
116
115
  children: /* @__PURE__ */ o("ol", { className: "gloss-base-breadcrumbs", children: r.map((i, d) => {
117
116
  const u = d === r.length - 1;
118
117
  return /* @__PURE__ */ m(b.Fragment, { children: [
@@ -133,10 +132,10 @@ function $(a) {
133
132
  $.displayName = "BaseBreadcrumbs";
134
133
  function T(a) {
135
134
  const {
136
- as: t,
135
+ as: l,
137
136
  definition: e,
138
137
  loading: s = !1,
139
- disabled: l = !1,
138
+ disabled: t = !1,
140
139
  className: n,
141
140
  style: c,
142
141
  children: r,
@@ -148,9 +147,9 @@ function T(a) {
148
147
  return /* @__PURE__ */ m(
149
148
  _,
150
149
  {
151
- as: t,
150
+ as: l,
152
151
  definition: e,
153
- disabled: l || s,
152
+ disabled: t || s,
154
153
  loading: s,
155
154
  className: d,
156
155
  style: c,
@@ -171,8 +170,8 @@ function T(a) {
171
170
  }
172
171
  T.displayName = "BaseAsyncButton";
173
172
  export {
174
- h as B,
175
- N as a,
173
+ N as B,
174
+ h as a,
176
175
  v as b,
177
176
  C as c,
178
177
  $ as d,
@@ -0,0 +1,444 @@
1
+ import { jsx as a, jsxs as E } from "react/jsx-runtime";
2
+ import { createContext as S, useContext as g, useReducer as m, useRef as d, useEffect as u, useMemo as C, useCallback as v, useSyncExternalStore as _, useLayoutEffect as I, useState as P } from "react";
3
+ const f = S(null);
4
+ function O() {
5
+ const e = g(f);
6
+ if (!e)
7
+ throw new Error(
8
+ "[panels] usePanelContext must be used inside <PanelProvider>. See @mt-gloss/ui/composites/panels."
9
+ );
10
+ return e;
11
+ }
12
+ function q() {
13
+ return g(f);
14
+ }
15
+ const L = {
16
+ activePanelId: null,
17
+ activeTrigger: null,
18
+ bellCutoutOpen: !1,
19
+ isDirty: !1,
20
+ lockHint: null,
21
+ bufferByCard: {},
22
+ lastClose: null,
23
+ pendingSideEffects: []
24
+ }, p = /* @__PURE__ */ new Set(["settings"]);
25
+ function b(e, n) {
26
+ if (e == null || e.kind !== n.kind) return !1;
27
+ switch (e.kind) {
28
+ case "bell":
29
+ return !0;
30
+ case "card-overflow":
31
+ return e.cardId === n.cardId && e.sectionIndex === n.sectionIndex && e.action === n.action;
32
+ case "empty-cell":
33
+ return e.sectionIndex === n.sectionIndex && e.cellPosition.row === n.cellPosition.row && e.cellPosition.col === n.cellPosition.col;
34
+ case "manage-pages-action":
35
+ return e.global === n.global && e.align === n.align;
36
+ }
37
+ }
38
+ function T(e, n) {
39
+ switch (n.type) {
40
+ case "OPEN_PANEL": {
41
+ if (e.activePanelId && e.isDirty)
42
+ return {
43
+ ...e,
44
+ pendingSideEffects: [
45
+ ...e.pendingSideEffects,
46
+ {
47
+ type: "SET_LOCK_HINT",
48
+ hint: {
49
+ blockedTrigger: n.trigger,
50
+ activeCardId: e.activeTrigger?.cardId ?? null,
51
+ expiresAt: Date.now() + 4e3
52
+ }
53
+ }
54
+ ]
55
+ };
56
+ if (e.activePanelId === n.panelId && b(e.activeTrigger, n.trigger))
57
+ return e;
58
+ const t = e.activePanelId != null ? [
59
+ {
60
+ type: "HANDOFF_CLOSE",
61
+ reason: "mutex-handoff",
62
+ previousPanelId: e.activePanelId
63
+ }
64
+ ] : [], r = n.panelId === "notification-center" && e.bellCutoutOpen;
65
+ return {
66
+ ...e,
67
+ activePanelId: n.panelId,
68
+ activeTrigger: n.trigger,
69
+ isDirty: !1,
70
+ bellCutoutOpen: r ? !1 : e.bellCutoutOpen,
71
+ lastClose: null,
72
+ // reset on fresh open
73
+ pendingSideEffects: [...e.pendingSideEffects, ...t]
74
+ };
75
+ }
76
+ case "CLOSE_PANEL": {
77
+ if (e.activePanelId == null)
78
+ return e;
79
+ const t = e.activePanelId, r = e.activeTrigger?.cardId ?? null, i = r != null ? e.bufferByCard[r] : void 0, o = e.isDirty ? n.reason === "apply-button" ? r != null && i != null ? [
80
+ {
81
+ type: "COMMIT_BUFFER",
82
+ payload: { cardId: r, delta: i }
83
+ }
84
+ ] : [{ type: "COMMIT_BUFFER" }] : [{ type: "DISCARD_BUFFER" }] : [], c = r != null && i != null ? (() => {
85
+ const l = { ...e.bufferByCard };
86
+ return delete l[r], l;
87
+ })() : e.bufferByCard;
88
+ return {
89
+ ...e,
90
+ activePanelId: null,
91
+ activeTrigger: null,
92
+ isDirty: !1,
93
+ lockHint: null,
94
+ // closing clears any active lockHint (dirty-buffer condition gone)
95
+ bufferByCard: c,
96
+ lastClose: { panelId: t, reason: n.reason },
97
+ pendingSideEffects: [...e.pendingSideEffects, ...o]
98
+ };
99
+ }
100
+ case "OPEN_BELL_CUTOUT":
101
+ return e.bellCutoutOpen ? e : e.activePanelId === "notification-center" ? {
102
+ ...e,
103
+ activePanelId: null,
104
+ activeTrigger: null,
105
+ bellCutoutOpen: !0,
106
+ pendingSideEffects: [
107
+ ...e.pendingSideEffects,
108
+ { type: "AUTO_CLOSE_NOTIF_CENTER" }
109
+ ]
110
+ } : { ...e, bellCutoutOpen: !0 };
111
+ case "CLOSE_BELL_CUTOUT":
112
+ return e.bellCutoutOpen ? { ...e, bellCutoutOpen: !1 } : e;
113
+ case "SET_BUFFER_VALUE": {
114
+ if (e.activePanelId == null || !p.has(e.activePanelId))
115
+ return {
116
+ ...e,
117
+ pendingSideEffects: [
118
+ ...e.pendingSideEffects,
119
+ { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
120
+ ]
121
+ };
122
+ const t = e.bufferByCard[n.cardId], r = t == null;
123
+ if (!r && t.changes[n.key] === n.value)
124
+ return e;
125
+ const o = { kind: "settings", changes: {
126
+ ...t?.kind === "settings" ? t.changes : {},
127
+ [n.key]: n.value
128
+ } }, c = { ...e.bufferByCard, [n.cardId]: o }, l = r ? [
129
+ {
130
+ type: "SCHEDULE_TIMER",
131
+ ms: 0,
132
+ action: { type: "BUFFER_BECOMES_DIRTY" }
133
+ }
134
+ ] : [];
135
+ return {
136
+ ...e,
137
+ bufferByCard: c,
138
+ pendingSideEffects: [...e.pendingSideEffects, ...l]
139
+ };
140
+ }
141
+ case "CLEAR_BUFFER": {
142
+ if (e.bufferByCard[n.cardId] == null)
143
+ return e;
144
+ const r = Object.keys(e.bufferByCard).length === 1, i = { ...e.bufferByCard };
145
+ delete i[n.cardId];
146
+ const o = r && e.isDirty ? [
147
+ {
148
+ type: "SCHEDULE_TIMER",
149
+ ms: 0,
150
+ action: { type: "BUFFER_BECOMES_CLEAN" }
151
+ }
152
+ ] : [];
153
+ return {
154
+ ...e,
155
+ bufferByCard: i,
156
+ pendingSideEffects: [...e.pendingSideEffects, ...o]
157
+ };
158
+ }
159
+ case "BUFFER_BECOMES_DIRTY":
160
+ return e.activePanelId == null || !p.has(e.activePanelId) ? {
161
+ ...e,
162
+ pendingSideEffects: [
163
+ ...e.pendingSideEffects,
164
+ { type: "INVALID_DISPATCH", reason: "no-buffer-panel" }
165
+ ]
166
+ } : e.isDirty ? e : { ...e, isDirty: !0 };
167
+ case "BUFFER_BECOMES_CLEAN":
168
+ return e.isDirty ? { ...e, isDirty: !1 } : e;
169
+ case "SET_LOCK_HINT":
170
+ return {
171
+ ...e,
172
+ lockHint: n.hint,
173
+ pendingSideEffects: [
174
+ ...e.pendingSideEffects,
175
+ {
176
+ type: "SCHEDULE_TIMER",
177
+ ms: Math.max(0, n.hint.expiresAt - Date.now()),
178
+ action: { type: "CLEAR_LOCK_HINT" }
179
+ }
180
+ ]
181
+ };
182
+ case "CLEAR_LOCK_HINT":
183
+ return e.lockHint == null ? e : { ...e, lockHint: null };
184
+ case "DRAIN_SIDE_EFFECTS":
185
+ return e.pendingSideEffects.length === 0 ? e : typeof n.count == "number" && n.count > 0 ? n.count >= e.pendingSideEffects.length ? { ...e, pendingSideEffects: [] } : {
186
+ ...e,
187
+ pendingSideEffects: e.pendingSideEffects.slice(n.count)
188
+ } : {
189
+ ...e,
190
+ pendingSideEffects: []
191
+ };
192
+ default:
193
+ return e;
194
+ }
195
+ }
196
+ function D(e) {
197
+ 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";
198
+ }
199
+ function w() {
200
+ const [e, n] = m(T, L), t = d([]), r = d(null);
201
+ u(() => () => {
202
+ r.current != null && (window.clearTimeout(r.current), r.current = null);
203
+ }, []), u(() => {
204
+ const c = e.pendingSideEffects.length;
205
+ if (c !== 0) {
206
+ for (const l of e.pendingSideEffects)
207
+ l.type === "SCHEDULE_TIMER" ? (r.current != null && window.clearTimeout(r.current), r.current = window.setTimeout(() => {
208
+ r.current = null, n(l.action);
209
+ }, Math.max(0, l.ms))) : l.type === "SET_LOCK_HINT" ? n({ type: "SET_LOCK_HINT", hint: l.hint }) : l.type === "HANDOFF_CLOSE" ? t.current = [
210
+ ...t.current.slice(-99),
211
+ {
212
+ panelId: l.previousPanelId,
213
+ reason: "mutex-handoff",
214
+ at: Date.now(),
215
+ note: "F22: mutex-handoff synthetic close-log entry"
216
+ }
217
+ ] : l.type === "INVALID_DISPATCH" && process.env.NODE_ENV !== "production" && console.warn("[panels] INVALID_DISPATCH:", l.reason);
218
+ n({ type: "DRAIN_SIDE_EFFECTS", count: c });
219
+ }
220
+ }, [e.pendingSideEffects, n]), u(() => {
221
+ if (!e.lastClose) return;
222
+ const c = {
223
+ panelId: e.lastClose.panelId,
224
+ reason: e.lastClose.reason,
225
+ at: Date.now(),
226
+ note: e.lastClose.reason === "nav-escape-hatch" ? "F21: backdrop-click OR page-nav escape" : void 0
227
+ };
228
+ t.current = [
229
+ ...t.current.slice(-99),
230
+ c
231
+ ];
232
+ }, [e.lastClose]);
233
+ const i = C(
234
+ () => D(e),
235
+ [e.activePanelId, e.bellCutoutOpen, e.isDirty]
236
+ ), o = v(() => t.current.slice(), []);
237
+ return { state: e, surfaceState: i, dispatch: n, getCloseLog: o };
238
+ }
239
+ function Y({ children: e }) {
240
+ const n = w(), t = C(
241
+ () => n,
242
+ // Re-publish only when one of the four coordinator fields changes identity.
243
+ // dispatch + getCloseLog are stable. state + surfaceState change on dispatch.
244
+ [n.state, n.surfaceState, n.dispatch, n.getCloseLog]
245
+ );
246
+ return /* @__PURE__ */ a(f.Provider, { value: t, children: e });
247
+ }
248
+ const N = "(prefers-reduced-motion: reduce)";
249
+ function y() {
250
+ return typeof window > "u" || typeof window.matchMedia != "function" ? null : window.matchMedia(N);
251
+ }
252
+ function x(e) {
253
+ const n = y();
254
+ return n ? (n.addEventListener("change", e), () => {
255
+ n.removeEventListener("change", e);
256
+ }) : () => {
257
+ };
258
+ }
259
+ function H() {
260
+ const e = y();
261
+ return e ? e.matches : !1;
262
+ }
263
+ function F() {
264
+ return !1;
265
+ }
266
+ function R() {
267
+ return _(x, H, F);
268
+ }
269
+ const B = {
270
+ position: "relative",
271
+ pointerEvents: "auto"
272
+ };
273
+ function A({ children: e, onClose: n, footer: t }) {
274
+ return /* @__PURE__ */ E(
275
+ "div",
276
+ {
277
+ "data-chrome": "panel",
278
+ role: "dialog",
279
+ "aria-modal": "true",
280
+ className: "gloss-panel-chrome",
281
+ style: B,
282
+ children: [
283
+ /* @__PURE__ */ a("div", { className: "gloss-panel-chrome__header", children: /* @__PURE__ */ a(
284
+ "button",
285
+ {
286
+ id: "panel-close",
287
+ type: "button",
288
+ "aria-label": "Close panel",
289
+ className: "gloss-panel-chrome__close",
290
+ onClick: n,
291
+ children: "×"
292
+ }
293
+ ) }),
294
+ /* @__PURE__ */ a("div", { className: "gloss-panel-chrome__body", children: e }),
295
+ t != null && /* @__PURE__ */ a("div", { className: "gloss-panel-chrome__footer", children: t })
296
+ ]
297
+ }
298
+ );
299
+ }
300
+ function k(e) {
301
+ if (process.env.NODE_ENV === "production" || !e || !e.parentElement) return;
302
+ const n = e.parentElement, t = window.getComputedStyle(n);
303
+ t.perspective === "none" && console.warn(
304
+ "[PanelMount] §2.7 violation: parent of .gloss-panel-mount has perspective:none. Rotated mount will render flat. Parent:",
305
+ n
306
+ ), (t.overflow === "hidden" || t.overflowY === "hidden") && console.warn(
307
+ "[PanelMount] §2.9 violation: parent of .gloss-panel-mount has overflow:hidden. Rising panel will be clipped. Parent:",
308
+ n
309
+ );
310
+ }
311
+ function M({ isOpen: e, children: n }) {
312
+ const t = R(), r = d(null);
313
+ I(() => {
314
+ k(r.current);
315
+ }, []);
316
+ const [i, o] = P(!1);
317
+ u(() => {
318
+ if (!e) {
319
+ o(!1);
320
+ return;
321
+ }
322
+ const l = requestAnimationFrame(() => o(!0));
323
+ return () => cancelAnimationFrame(l);
324
+ }, [e]);
325
+ const c = [
326
+ "gloss-panel-mount",
327
+ i ? "has-panel" : "",
328
+ t ? "reduced-motion" : ""
329
+ ].filter(Boolean).join(" ");
330
+ return /* @__PURE__ */ a(
331
+ "div",
332
+ {
333
+ ref: r,
334
+ className: c,
335
+ "data-mount": "panel",
336
+ "data-open": e ? "true" : "false",
337
+ children: n
338
+ }
339
+ );
340
+ }
341
+ const U = {
342
+ position: "fixed",
343
+ top: 0,
344
+ left: 0,
345
+ right: 0,
346
+ height: "var(--tb-h, 60px)",
347
+ perspective: "var(--panel-perspective, 1500px)",
348
+ perspectiveOrigin: "center bottom",
349
+ overflow: "visible",
350
+ pointerEvents: "none",
351
+ zIndex: 55
352
+ }, V = {
353
+ position: "fixed",
354
+ top: "var(--tb-h, 60px)",
355
+ left: 0,
356
+ right: 0,
357
+ bottom: 0,
358
+ zIndex: 1,
359
+ // CR-03 fix: pass-through tint — scrim is visual-only and must not intercept
360
+ // grid card clicks. Click-outside / scrim-dismiss is handled via the onClick
361
+ // on the div below, which still fires because pointer events on the element
362
+ // itself are honoured when explicitly set; using 'none' prevents the invisible
363
+ // overlay from swallowing clicks on underlying controls (same class as the
364
+ // panel-wrapper-covers-grid-cards bug fixed at V2FeedbackSurface).
365
+ pointerEvents: "none",
366
+ background: "rgba(0, 0, 0, 0.04)"
367
+ };
368
+ function z({ panelComponents: e }) {
369
+ const { state: n, dispatch: t, getCloseLog: r } = O(), i = n.activePanelId ? e[n.activePanelId] : null;
370
+ n.activePanelId && !i && process.env.NODE_ENV !== "production" && console.error(
371
+ "[panels] No panel component registered for activePanelId:",
372
+ n.activePanelId
373
+ ), u(() => {
374
+ if (n.activePanelId == null) return;
375
+ function s(h) {
376
+ h.key === "Escape" && t({ type: "CLOSE_PANEL", reason: "escape-key" });
377
+ }
378
+ return document.addEventListener("keydown", s), () => {
379
+ document.removeEventListener("keydown", s);
380
+ };
381
+ }, [n.activePanelId, t]);
382
+ const o = d(n);
383
+ I(() => {
384
+ o.current = n;
385
+ }), u(() => {
386
+ if (process.env.NODE_ENV === "production") return;
387
+ const s = window;
388
+ return s.__panelsHostHandle && console.warn("[panels] multiple PanelHost/PanelHostShell instances mounted; dev handle is unreliable"), s.__panelsHostHandle = {
389
+ dispatch: t,
390
+ getState: () => o.current,
391
+ getCloseLog: r
392
+ }, () => {
393
+ s.__panelsHostHandle?.dispatch === t && delete s.__panelsHostHandle;
394
+ };
395
+ }, [t, r]);
396
+ const c = v(() => {
397
+ t({ type: "CLOSE_PANEL", reason: "nav-escape-hatch" });
398
+ }, [t]), l = n.activePanelId != null && i != null;
399
+ return /* @__PURE__ */ E("div", { "data-panel-host": "true", style: U, children: [
400
+ l && /* @__PURE__ */ a(
401
+ "div",
402
+ {
403
+ "data-panel-scrim": "true",
404
+ style: V,
405
+ onClick: c
406
+ }
407
+ ),
408
+ /* @__PURE__ */ a(M, { isOpen: l, children: l && /* @__PURE__ */ a(
409
+ A,
410
+ {
411
+ isOpen: !0,
412
+ onClose: () => t({ type: "CLOSE_PANEL", reason: "header-x" }),
413
+ children: /* @__PURE__ */ a(i, { isOpen: !0 })
414
+ }
415
+ ) })
416
+ ] });
417
+ }
418
+ const Q = {
419
+ "apply-button": !0,
420
+ // the ONLY commit reason
421
+ "cancel-button": !1,
422
+ "header-x": !1,
423
+ "escape-key": !1,
424
+ "page-nav": !1,
425
+ "mutex-handoff": !1,
426
+ "ghost-anchor": !1,
427
+ "viewport-collapse": !1,
428
+ unmount: !1,
429
+ "nav-escape-hatch": !1
430
+ };
431
+ export {
432
+ Q as C,
433
+ Y as P,
434
+ O as a,
435
+ z as b,
436
+ A as c,
437
+ w as d,
438
+ D as e,
439
+ R as f,
440
+ M as g,
441
+ L as i,
442
+ T as r,
443
+ q as u
444
+ };