@mono-lit/helper 0.0.9 → 0.1.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 (164) hide show
  1. package/dist/accordion-core-DaNyPWRr.js +277 -0
  2. package/dist/alert-core-DWtHbX_-.js +134 -0
  3. package/dist/breadcrumb-list-core-Dh68T8Cf.js +747 -0
  4. package/dist/{mono-button-CLkHg3WW.js → button-core-DerXg84Q.js} +3 -276
  5. package/dist/button-dropdown-core-DKYEOyjy.js +654 -0
  6. package/dist/button-utils-D5-66M02.js +63 -0
  7. package/dist/card-utils-l80qAmrN.js +312 -0
  8. package/dist/chart-core-DV7hD3ZY.js +801 -0
  9. package/dist/checkbox-utils-DKdrhAzF.js +337 -0
  10. package/dist/chip-utils-DpRrd7Zj.js +403 -0
  11. package/dist/{data-source-controller-C6C4ej_M.js → data-source-controller-DS_JLrmS.js} +1 -1
  12. package/dist/{data-source-options-fxT5QIX4.js → data-source-options-DJUNU26C.js} +6 -6
  13. package/dist/{data-source-read-BL266IW0.js → data-source-read-uKJpRAzx.js} +2 -2
  14. package/dist/date-core-CyuSyvvG.js +734 -0
  15. package/dist/drawer-core-DbFWvNln.js +759 -0
  16. package/dist/dropdown-core-BCH1pK14.js +511 -0
  17. package/dist/dropdown-table-core-SfHUJVFq.js +1342 -0
  18. package/dist/export.js +1 -1
  19. package/dist/{field-path-BabiMrrA.js → field-path-DK2VBWHl.js} +1 -1
  20. package/dist/field-tooltip.css_raw-DVblekCl.js +5 -0
  21. package/dist/{field-validation.css_raw-Cx6SGrfP.js → field-validation.css_raw-BU7C6173.js} +1 -170
  22. package/dist/file-upload-core-Cz_dBQMx.js +624 -0
  23. package/dist/filter-builder-core-DyWjbBP7.js +381 -0
  24. package/dist/{filter-builder-B6Y2mmbM.js → filter-builder-vbqIuPhX.js} +1 -1
  25. package/dist/{filter-eval-ChDSaAUH.js → filter-eval-CqeBnMYh.js} +1 -1
  26. package/dist/{filter-odata-Bi27XUpQ.js → filter-odata-GsczYKNC.js} +1 -1
  27. package/dist/{hydration-flush-BaE9gN3C.js → hydration-flush-Volt9X7Q.js} +2 -1071
  28. package/dist/index.js +11 -11
  29. package/dist/{index.node-DTqDBca7.js → index.node-Csy9zrr1.js} +4 -4
  30. package/dist/index.node.js +11 -11
  31. package/dist/input-utils-BglY-k0H.js +1145 -0
  32. package/dist/menu-core-DkAYuCZ2.js +831 -0
  33. package/dist/modal-core-CSBSPN_m.js +844 -0
  34. package/dist/mono-button-DVvZ03P-.js +280 -0
  35. package/dist/{mono-button.shadow-DqZMpcqY.js → mono-button.shadow-BANxMGln.js} +6 -594
  36. package/dist/{mono-data-chart-NKPdAgVq.js → mono-data-chart-ChF4J9RT.js} +6 -6
  37. package/dist/{mono-data-dropdown-B2iRpJuI.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
  38. package/dist/{mono-data-grid-llJCX9MC.js → mono-data-grid-DJkp96N-.js} +144 -46
  39. package/dist/{mono-event-BPku9HpS.js → mono-event-CAZf0F_k.js} +14 -9
  40. package/dist/{mono-form-controller-BrA10erm.js → mono-form-controller-DxZLvyg6.js} +2 -1
  41. package/dist/mono-table-checkbox-core-BKOMx8R5.js +5288 -0
  42. package/dist/nav-core-B5qU2dzn.js +225 -0
  43. package/dist/{normalize-error-D93O4q8g.js → normalize-error-BEcd1tmS.js} +2 -2
  44. package/dist/nuxt.js +1 -1
  45. package/dist/otp-core-DXg3vFLh.js +758 -0
  46. package/dist/radio-utils-Dk9Tl1jz.js +319 -0
  47. package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
  48. package/dist/select-utils-BgArYHk8.js +2140 -0
  49. package/dist/sidebar-core-CD6txDo3.js +583 -0
  50. package/dist/slider-core-vcWr321-.js +1014 -0
  51. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
  52. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
  53. package/dist/src/components/dropdown-table/index.d.ts +1 -1
  54. package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
  55. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
  56. package/dist/src/components/form/form-types.d.ts +9 -3
  57. package/dist/src/components/input/input-core.d.ts +1 -1
  58. package/dist/src/components/input/input-types.d.ts +1 -1
  59. package/dist/src/components/otp/otp-core.d.ts +1 -1
  60. package/dist/src/components/select/select-core.d.ts +1 -1
  61. package/dist/src/components/select/select-types.d.ts +1 -1
  62. package/dist/src/components/slider/slider-core.d.ts +1 -1
  63. package/dist/src/components/slider/slider-types.d.ts +1 -1
  64. package/dist/src/components/table/filter-suggestion.d.ts +171 -0
  65. package/dist/src/components/table/index.d.ts +5 -4
  66. package/dist/src/components/table/index.shadow.d.ts +5 -4
  67. package/dist/src/components/table/mono-data-grid.d.ts +22 -3
  68. package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
  69. package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
  70. package/dist/src/components/table/table-types.d.ts +74 -4
  71. package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
  72. package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
  73. package/dist/src/components/textarea/textarea-core.d.ts +1 -1
  74. package/dist/src/composables/mono-event.d.ts +7 -1
  75. package/dist/src/entries/index.d.ts +8 -6
  76. package/dist/src/entries/index.node.d.ts +8 -6
  77. package/dist/src/search/index.d.ts +1 -1
  78. package/dist/src/utils/group-count.d.ts +36 -0
  79. package/dist/switch-utils-CTZ4id2V.js +338 -0
  80. package/dist/tabs-core-r5-B8k_N.js +317 -0
  81. package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
  82. package/dist/textarea-utils-VU1KeXm8.js +821 -0
  83. package/dist/ui/accordion.js +2 -274
  84. package/dist/ui/alert.js +2 -131
  85. package/dist/ui/breadcrumb.js +4 -745
  86. package/dist/ui/button-dropdown.js +4 -652
  87. package/dist/ui/button.js +2 -63
  88. package/dist/ui/card.js +2 -310
  89. package/dist/ui/chart.js +4 -800
  90. package/dist/ui/checkbox.js +4 -335
  91. package/dist/ui/chip.js +4 -402
  92. package/dist/ui/date.js +3 -732
  93. package/dist/ui/drawer.js +3 -757
  94. package/dist/ui/dropdown-table.js +5 -1341
  95. package/dist/ui/dropdown.js +4 -509
  96. package/dist/ui/file-upload.js +3 -622
  97. package/dist/ui/filter.js +5 -380
  98. package/dist/ui/form.js +1 -1
  99. package/dist/ui/index.css +118 -1
  100. package/dist/ui/input.js +3 -1141
  101. package/dist/ui/menu.js +4 -828
  102. package/dist/ui/modal.js +4 -843
  103. package/dist/ui/nav.js +4 -223
  104. package/dist/ui/otp.js +4 -756
  105. package/dist/ui/radio.js +4 -317
  106. package/dist/ui/rich-text-editor.js +4 -1278
  107. package/dist/ui/select.js +5 -2138
  108. package/dist/ui/shadow/accordion.js +4 -273
  109. package/dist/ui/shadow/alert.js +4 -130
  110. package/dist/ui/shadow/breadcrumb.js +5 -744
  111. package/dist/ui/shadow/button-dropdown.js +6 -652
  112. package/dist/ui/shadow/button.js +3 -63
  113. package/dist/ui/shadow/card.js +4 -309
  114. package/dist/ui/shadow/chart.js +6 -1576
  115. package/dist/ui/shadow/checkbox.js +4 -334
  116. package/dist/ui/shadow/chip.js +4 -396
  117. package/dist/ui/shadow/date.js +7 -731
  118. package/dist/ui/shadow/drawer.js +4 -756
  119. package/dist/ui/shadow/dropdown-table.js +8 -1762
  120. package/dist/ui/shadow/dropdown.js +4 -508
  121. package/dist/ui/shadow/file-upload.js +4 -620
  122. package/dist/ui/shadow/filter.js +7 -379
  123. package/dist/ui/shadow/input.js +6 -1140
  124. package/dist/ui/shadow/menu.js +5 -828
  125. package/dist/ui/shadow/modal.js +6 -1063
  126. package/dist/ui/shadow/nav.js +5 -223
  127. package/dist/ui/shadow/otp.js +6 -754
  128. package/dist/ui/shadow/radio.js +4 -316
  129. package/dist/ui/shadow/rich-text-editor.js +4 -1276
  130. package/dist/ui/shadow/select.js +6 -2136
  131. package/dist/ui/shadow/sidebar.js +5 -581
  132. package/dist/ui/shadow/slider.js +5 -1010
  133. package/dist/ui/shadow/switch.js +4 -335
  134. package/dist/ui/shadow/table.js +10 -4501
  135. package/dist/ui/shadow/tabs.js +6 -315
  136. package/dist/ui/shadow/tag-input.js +7 -3057
  137. package/dist/ui/shadow/textarea.js +6 -817
  138. package/dist/ui/sidebar.js +3 -581
  139. package/dist/ui/slider.js +4 -1012
  140. package/dist/ui/switch.js +4 -336
  141. package/dist/ui/table.js +9 -4502
  142. package/dist/ui/tabs.js +4 -315
  143. package/dist/ui/tag-input.js +5 -3058
  144. package/dist/ui/textarea.js +4 -819
  145. package/dist/{vite-CivRCJaf.js → vite-CfW7z2wn.js} +21 -14
  146. package/dist/vite.js +1 -1
  147. package/dist/vue.d.ts +3 -2
  148. package/package.json +10 -11
  149. package/dist/chip-strip-bNfLn52Z.js +0 -215
  150. package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
  151. package/dist/data-source-options-BM4r4PRw.js +0 -558
  152. package/dist/data-source-read-HyBCRg1t.js +0 -242
  153. package/dist/excel-BXzr3uI1.js +0 -784
  154. package/dist/export-ixRdCS2y.js +0 -2388
  155. package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
  156. package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
  157. package/dist/filter-builder-C0T3pMx2.js +0 -208
  158. package/dist/form-control-core-BbiACMtL.js +0 -226
  159. package/dist/icon-ClxnYhBG.js +0 -19
  160. package/dist/import-Dc4eXC02.js +0 -612
  161. package/dist/light-slots-_no0r2Z-.js +0 -246
  162. package/dist/markdown-uGlE_OfJ.js +0 -20191
  163. package/dist/mono-data-grid-e9ZVBlNN.js +0 -4240
  164. package/dist/normalize-error-BmLbgANw.js +0 -1048
@@ -0,0 +1,277 @@
1
+ import { a as defineHybridPropAliases, i as defineHybridPropAlias, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
2
+ import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
3
+ import { t as isIconifyClass } from "./icon-BM9N-jOt.js";
4
+ import { html, nothing } from "lit";
5
+ import { property, query, state } from "lit/decorators.js";
6
+
7
+ //#region src/components/accordion/accordion-core.ts
8
+ /**
9
+ * `MonoAccordionCore` — all render-mode-agnostic logic for `mono-accordion`:
10
+ * reactive props, hybrid aliases, the camelCase attribute fallbacks, slot-presence
11
+ * `@state`, class/getter computation, click/toggle interactivity, and the
12
+ * imperative `focus/blur`. No `render()` — the light build keeps its
13
+ * `[data-mono-slot]` capture strategy and the shadow build uses native `<slot>`
14
+ * (each ships its own `render()`, mirroring `mono-card`).
15
+ *
16
+ * SSR-safe: no `document`/`window` access. `_headEl` (`@query`) is lazy and
17
+ * `focus/blur` only run client-side.
18
+ */
19
+ const MonoAccordionCore = (superClass) => {
20
+ class MonoAccordionCoreClass extends superClass {
21
+ constructor(...args) {
22
+ super(...args);
23
+ this.size = "md";
24
+ this.color = "primary";
25
+ this.modelValue = false;
26
+ this.disabled = false;
27
+ this.cssClass = {};
28
+ this.cssClassName = "";
29
+ this._hasTitleSlotState = false;
30
+ this._hasSubtitleSlotState = false;
31
+ this._hasHeaderSlotState = false;
32
+ this._hasIconSlotState = false;
33
+ this._hasActionsSlotState = false;
34
+ this._hasBodySlotState = false;
35
+ this._rootEl = null;
36
+ this.bindRoot = (el) => {
37
+ this._rootEl = el ?? null;
38
+ this._applyRootAttrs(this._rootEl);
39
+ };
40
+ defineHybridPropAliases(this, ["modelValue", "cssClass"]);
41
+ defineHybridPropAlias(this, "label", "title");
42
+ defineHybridPropAlias(this, "description", "subtitle");
43
+ this.title = "";
44
+ this.subtitle = "";
45
+ this.icon = "";
46
+ /**
47
+ * Vue support:
48
+ *
49
+ * <mono-accordion :cssClass="{}" />
50
+ * <mono-accordion :css-class="{}" />
51
+ * <mono-accordion :cssclass="{}" />
52
+ */
53
+ Object.defineProperty(this, "css-class", {
54
+ get: () => this.cssClass,
55
+ set: (value) => {
56
+ this._setCssClass(value);
57
+ },
58
+ configurable: true,
59
+ enumerable: false
60
+ });
61
+ Object.defineProperty(this, "cssclass", {
62
+ get: () => this.cssClass,
63
+ set: (value) => {
64
+ this._setCssClass(value);
65
+ },
66
+ configurable: true,
67
+ enumerable: false
68
+ });
69
+ }
70
+ static get observedAttributes() {
71
+ return [
72
+ ...super.observedAttributes ?? [],
73
+ "modelvalue",
74
+ "css-class",
75
+ "cssclass",
76
+ "label",
77
+ "description"
78
+ ];
79
+ }
80
+ attributeChangedCallback(name, oldValue, newValue) {
81
+ super.attributeChangedCallback(name, oldValue, newValue);
82
+ if (oldValue === newValue) return;
83
+ if (name === "modelvalue") {
84
+ this.modelValue = this._toBoolean(newValue);
85
+ return;
86
+ }
87
+ if (name === "css-class" || name === "cssclass") {
88
+ this._setCssClass(newValue);
89
+ return;
90
+ }
91
+ if (name === "label") {
92
+ this.title = newValue ?? "";
93
+ return;
94
+ }
95
+ if (name === "description") this.subtitle = newValue ?? "";
96
+ }
97
+ _toBoolean(value) {
98
+ if (typeof value === "boolean") return value;
99
+ if (typeof value === "string") {
100
+ const normalized = value.toLowerCase().trim();
101
+ return normalized === "" || normalized === "true";
102
+ }
103
+ return Boolean(value);
104
+ }
105
+ _setCssClass(value) {
106
+ if (value == null) {
107
+ this.cssClass = {};
108
+ this.cssClassName = "";
109
+ return;
110
+ }
111
+ if (typeof value === "object") {
112
+ this.cssClass = value;
113
+ return;
114
+ }
115
+ if (typeof value === "string") {
116
+ const trimmed = value.trim();
117
+ if (!trimmed) {
118
+ this.cssClass = {};
119
+ this.cssClassName = "";
120
+ return;
121
+ }
122
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
123
+ this.cssClass = JSON.parse(trimmed);
124
+ return;
125
+ } catch {}
126
+ this.cssClassName = trimmed;
127
+ }
128
+ }
129
+ _cls(base, key) {
130
+ const extra = this.cssClass?.[key];
131
+ return extra ? `${base} ${extra}` : base;
132
+ }
133
+ /**
134
+ * The prop mirrors, each omitted at its default so `:not([mono-size])` means
135
+ * "md" for hand-written markup exactly as it does for the element.
136
+ */
137
+ _computeRootAttrs() {
138
+ return {
139
+ "mono-size": this.size === "md" ? null : this.size,
140
+ "mono-color": this.color === "primary" ? null : this.color,
141
+ "mono-open": this.modelValue ? "" : null,
142
+ "mono-disabled": this.disabled ? "" : null,
143
+ "mono-grouped": this._inGroup() ? "" : null
144
+ };
145
+ }
146
+ /**
147
+ * Is this item inside an accordion group?
148
+ *
149
+ * The CSS can see that for hand-written markup — `[mono-accordion-group] >
150
+ * [mono-accordion]` — but not for the ELEMENT: the light build puts the
151
+ * custom-element host between the group and the root, and the shadow build
152
+ * puts a boundary there, and a selector crosses neither. So the element
153
+ * detects its own group and writes it as an attribute, which is the one thing
154
+ * that reaches the root in both builds.
155
+ *
156
+ * Only MEMBERSHIP, never position: "am I the last one?" would be answered
157
+ * from however many siblings existed at this render, and appending a fourth
158
+ * item does not re-render the third. The divider is the group's business and
159
+ * rides its own `:last-child` (see accordion.css).
160
+ *
161
+ * `closest()` on the HOST, not the root: the group is the consumer's wrapper
162
+ * around `<mono-accordion>`, so the host is what sits inside it.
163
+ */
164
+ _inGroup() {
165
+ if (typeof this.closest !== "function") return false;
166
+ return Boolean(this.closest("[mono-accordion-group], .mono-accordion-group"));
167
+ }
168
+ _applyRootAttrs(root) {
169
+ if (!root) return;
170
+ if (!root.hasAttribute("mono-accordion")) root.setAttribute("mono-accordion", "");
171
+ for (const [name, value] of Object.entries(this._computeRootAttrs())) if (value === null) root.removeAttribute(name);
172
+ else if (root.getAttribute(name) !== value) root.setAttribute(name, value);
173
+ }
174
+ updated(changed) {
175
+ super.updated?.(changed);
176
+ this._applyRootAttrs(this._rootEl);
177
+ }
178
+ get _wrapperClasses() {
179
+ return [
180
+ "mono-accordion",
181
+ this.size,
182
+ this.color,
183
+ this.modelValue ? "open" : "",
184
+ this.disabled ? "disabled" : "",
185
+ this.cssClassName,
186
+ this.cssClass?.root
187
+ ].filter(Boolean).join(" ");
188
+ }
189
+ get _hasTitleContent() {
190
+ return Boolean(this.title) || this._hasTitleSlotState;
191
+ }
192
+ get _hasSubtitleContent() {
193
+ return Boolean(this.subtitle) || this._hasSubtitleSlotState;
194
+ }
195
+ get _hasIconContent() {
196
+ return this._hasIconSlotState || Boolean(this.icon);
197
+ }
198
+ /**
199
+ * The `icon` prop: an iconify class becomes an empty masked span, anything
200
+ * else is text. The shadow build overrides this with inline SVG (a page
201
+ * utility class cannot reach inside a shadow root).
202
+ */
203
+ _renderIconGlyph() {
204
+ if (!this.icon) return nothing;
205
+ if (isIconifyClass(this.icon)) return html`<span class=${`mono-accordion-iconify ${this.icon}`}></span>`;
206
+ return html`${this.icon}`;
207
+ }
208
+ /**
209
+ * The open state changed. `mno-click` is the historical name; the plain
210
+ * event is `toggle`, and the transition also fires `open` / `close`
211
+ * (+ `mno-open` / `mno-close`) — the same trio modal and drawer emit.
212
+ */
213
+ _emitClick(detail) {
214
+ dispatchMonoEvent(this, "click", detail, { alias: "toggle" });
215
+ dispatchMonoEvent(this, detail.modelValue ? "open" : "close", detail);
216
+ }
217
+ _setOpen(next, sourceEvent) {
218
+ if (this.disabled) return;
219
+ if (this.modelValue === next) return;
220
+ const oldValue = this.modelValue;
221
+ this.modelValue = next;
222
+ this._emitClick({
223
+ modelValue: next,
224
+ currentValue: next,
225
+ oldValue,
226
+ value: next,
227
+ sourceEvent
228
+ });
229
+ }
230
+ _handleClick(event) {
231
+ if (this.disabled) return;
232
+ this._setOpen(!this.modelValue, event);
233
+ }
234
+ toggle() {
235
+ this._setOpen(!this.modelValue);
236
+ }
237
+ expand() {
238
+ this._setOpen(true);
239
+ }
240
+ collapse() {
241
+ this._setOpen(false);
242
+ }
243
+ focus() {
244
+ this._headEl?.focus();
245
+ }
246
+ blur() {
247
+ this._headEl?.blur();
248
+ }
249
+ }
250
+ __decorate([property({ type: String })], MonoAccordionCoreClass.prototype, "size", void 0);
251
+ __decorate([property({ type: String })], MonoAccordionCoreClass.prototype, "color", void 0);
252
+ __decorate([property({ type: String })], MonoAccordionCoreClass.prototype, "title", void 0);
253
+ __decorate([property({ type: String })], MonoAccordionCoreClass.prototype, "subtitle", void 0);
254
+ __decorate([property({ type: String })], MonoAccordionCoreClass.prototype, "icon", void 0);
255
+ __decorate([property({
256
+ attribute: "model-value",
257
+ reflect: true,
258
+ converter: booleanStringConverter
259
+ })], MonoAccordionCoreClass.prototype, "modelValue", void 0);
260
+ __decorate([property({
261
+ reflect: true,
262
+ converter: booleanStringConverter
263
+ })], MonoAccordionCoreClass.prototype, "disabled", void 0);
264
+ __decorate([property({ attribute: false })], MonoAccordionCoreClass.prototype, "cssClass", void 0);
265
+ __decorate([property({ attribute: false })], MonoAccordionCoreClass.prototype, "cssClassName", void 0);
266
+ __decorate([state()], MonoAccordionCoreClass.prototype, "_hasTitleSlotState", void 0);
267
+ __decorate([state()], MonoAccordionCoreClass.prototype, "_hasSubtitleSlotState", void 0);
268
+ __decorate([state()], MonoAccordionCoreClass.prototype, "_hasHeaderSlotState", void 0);
269
+ __decorate([state()], MonoAccordionCoreClass.prototype, "_hasIconSlotState", void 0);
270
+ __decorate([state()], MonoAccordionCoreClass.prototype, "_hasActionsSlotState", void 0);
271
+ __decorate([state()], MonoAccordionCoreClass.prototype, "_hasBodySlotState", void 0);
272
+ __decorate([query(".mono-accordion-head")], MonoAccordionCoreClass.prototype, "_headEl", void 0);
273
+ return MonoAccordionCoreClass;
274
+ };
275
+
276
+ //#endregion
277
+ export { MonoAccordionCore as t };
@@ -0,0 +1,134 @@
1
+ import { a as defineHybridPropAliases, i as defineHybridPropAlias, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
2
+ import { t as isIconifyClass } from "./icon-BM9N-jOt.js";
3
+ import { a as closeIcon } from "./field-icons-t8rXRCKs.js";
4
+ import { html, nothing } from "lit";
5
+ import { property, state } from "lit/decorators.js";
6
+
7
+ //#region src/components/alert/alert-core.ts
8
+ /**
9
+ * `MonoAlertCore` — everything both builds share: props (with the `closeable`
10
+ * alias), the ✕ that hides the alert, and the root template. The regions are
11
+ * one overridable hook, `_renderMain()`: the light build fills `[data-mono-slot]`
12
+ * placeholders, the shadow build uses native `<slot>`s.
13
+ *
14
+ * The alert emits NO events of its own. `@click` on it is the browser's click;
15
+ * the ✕ only hides the element (the native `hidden` attribute), and stops its
16
+ * own click so a listener on the alert does not fire for it.
17
+ *
18
+ * SSR-safe: no `document`/`window` access.
19
+ */
20
+ const MonoAlertCore = (superClass) => {
21
+ class MonoAlertCoreClass extends superClass {
22
+ constructor(...args) {
23
+ super(...args);
24
+ this._hasIconSlot = false;
25
+ this._hasTitleSlot = false;
26
+ this._hasSubtitleSlot = false;
27
+ this._hasBodySlot = false;
28
+ this._clear = (event) => {
29
+ event.stopPropagation();
30
+ this.hidden = true;
31
+ };
32
+ defineHybridPropAliases(this, ["clearLabel", "cssClass"]);
33
+ defineHybridPropAlias(this, "closeable", "clearable");
34
+ this.title = "";
35
+ this.subtitle = "";
36
+ this.icon = "";
37
+ this.color = "neutral";
38
+ this.variant = "outline";
39
+ this.size = "md";
40
+ this.clearable = false;
41
+ this.clearLabel = "Close";
42
+ this.cssClass = {};
43
+ }
44
+ static get observedAttributes() {
45
+ return [
46
+ ...super.observedAttributes ?? [],
47
+ "closeable",
48
+ "clearlabel",
49
+ "cssclass"
50
+ ];
51
+ }
52
+ attributeChangedCallback(name, oldValue, newValue) {
53
+ super.attributeChangedCallback(name, oldValue, newValue);
54
+ if (oldValue === newValue) return;
55
+ if (name === "closeable") {
56
+ this.clearable = booleanStringConverter.fromAttribute(newValue);
57
+ return;
58
+ }
59
+ if (name === "clearlabel") this.clearLabel = newValue ?? "Close";
60
+ }
61
+ _cls(base, key) {
62
+ const extra = this.cssClass?.[key];
63
+ return extra ? `${base} ${extra}` : base;
64
+ }
65
+ get _showsIcon() {
66
+ return !this._hasBodySlot && (this._hasIconSlot || Boolean(this.icon));
67
+ }
68
+ get _showsTitle() {
69
+ return !this._hasBodySlot && (this._hasTitleSlot || Boolean(this.title));
70
+ }
71
+ get _showsSubtitle() {
72
+ return !this._hasBodySlot && (this._hasSubtitleSlot || Boolean(this.subtitle));
73
+ }
74
+ /**
75
+ * The `icon` prop: an iconify class becomes an empty masked span, anything
76
+ * else is text. The shadow build overrides this with inline SVG (a page
77
+ * utility class cannot reach inside a shadow root).
78
+ */
79
+ _renderIconGlyph() {
80
+ if (!this.icon) return nothing;
81
+ if (isIconifyClass(this.icon)) return html`<span class=${`mono-alert-iconify ${this.icon}`} mono-glyph></span>`;
82
+ return html`${this.icon}`;
83
+ }
84
+ /** The regions — each build renders its own slot strategy here. */
85
+ _renderMain() {
86
+ return nothing;
87
+ }
88
+ _renderClear() {
89
+ if (!this.clearable) return nothing;
90
+ return html`<button
91
+ type="button"
92
+ class=${this._cls("mono-alert-clear", "clear")}
93
+ mono-clear
94
+ aria-label=${this.clearLabel}
95
+ @click=${this._clear}
96
+ >${closeIcon()}</button>`;
97
+ }
98
+ render() {
99
+ return html`<div
100
+ class=${this._cls("mono-alert", "root")}
101
+ mono-alert
102
+ mono-size=${this.size && this.size !== "md" ? this.size : nothing}
103
+ mono-variant=${this.variant && this.variant !== "outline" ? this.variant : nothing}
104
+ mono-color=${this.color && this.color !== "neutral" ? this.color : nothing}
105
+ ?mono-clearable=${this.clearable}
106
+ role="alert"
107
+ title=""
108
+ >${this._renderMain()}${this._renderClear()}</div>`;
109
+ }
110
+ }
111
+ __decorate([property({ type: String })], MonoAlertCoreClass.prototype, "title", void 0);
112
+ __decorate([property({ type: String })], MonoAlertCoreClass.prototype, "subtitle", void 0);
113
+ __decorate([property({ type: String })], MonoAlertCoreClass.prototype, "icon", void 0);
114
+ __decorate([property({ type: String })], MonoAlertCoreClass.prototype, "color", void 0);
115
+ __decorate([property({ type: String })], MonoAlertCoreClass.prototype, "variant", void 0);
116
+ __decorate([property({ type: String })], MonoAlertCoreClass.prototype, "size", void 0);
117
+ __decorate([property({
118
+ reflect: true,
119
+ converter: booleanStringConverter
120
+ })], MonoAlertCoreClass.prototype, "clearable", void 0);
121
+ __decorate([property({
122
+ type: String,
123
+ attribute: "clear-label"
124
+ })], MonoAlertCoreClass.prototype, "clearLabel", void 0);
125
+ __decorate([property({ attribute: false })], MonoAlertCoreClass.prototype, "cssClass", void 0);
126
+ __decorate([state()], MonoAlertCoreClass.prototype, "_hasIconSlot", void 0);
127
+ __decorate([state()], MonoAlertCoreClass.prototype, "_hasTitleSlot", void 0);
128
+ __decorate([state()], MonoAlertCoreClass.prototype, "_hasSubtitleSlot", void 0);
129
+ __decorate([state()], MonoAlertCoreClass.prototype, "_hasBodySlot", void 0);
130
+ return MonoAlertCoreClass;
131
+ };
132
+
133
+ //#endregion
134
+ export { MonoAlertCore as t };