@mono-lit/helper 0.0.8 → 0.0.10

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 (161) 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-CLqE8F8P.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-DUXo_jxd.js → mono-data-dropdown-Bgj2PDfm.js} +1 -1
  38. package/dist/{mono-data-grid-Bb00QM72.js → mono-data-grid-DJkp96N-.js} +346 -51
  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/otp-core-DXg3vFLh.js +758 -0
  45. package/dist/radio-utils-Dk9Tl1jz.js +319 -0
  46. package/dist/rich-text-editor-core-Ddd_QaLn.js +1280 -0
  47. package/dist/select-utils-BgArYHk8.js +2140 -0
  48. package/dist/sidebar-core-CD6txDo3.js +583 -0
  49. package/dist/slider-core-vcWr321-.js +1014 -0
  50. package/dist/src/components/dropdown-table/dropdown-table-core.d.ts +2 -2
  51. package/dist/src/components/dropdown-table/dropdown-table-types.d.ts +1 -1
  52. package/dist/src/components/dropdown-table/index.d.ts +1 -1
  53. package/dist/src/components/dropdown-table/index.shadow.d.ts +1 -1
  54. package/dist/src/components/dropdown-table/mono-data-dropdown.d.ts +1 -1
  55. package/dist/src/components/form/form-types.d.ts +9 -3
  56. package/dist/src/components/input/input-core.d.ts +1 -1
  57. package/dist/src/components/input/input-types.d.ts +1 -1
  58. package/dist/src/components/otp/otp-core.d.ts +1 -1
  59. package/dist/src/components/select/select-core.d.ts +1 -1
  60. package/dist/src/components/select/select-types.d.ts +1 -1
  61. package/dist/src/components/slider/slider-core.d.ts +1 -1
  62. package/dist/src/components/slider/slider-types.d.ts +1 -1
  63. package/dist/src/components/table/filter-suggestion.d.ts +171 -0
  64. package/dist/src/components/table/index.d.ts +5 -4
  65. package/dist/src/components/table/index.shadow.d.ts +5 -4
  66. package/dist/src/components/table/mono-data-grid.d.ts +58 -3
  67. package/dist/src/components/table/mono-table-empty-core.d.ts +37 -0
  68. package/dist/src/components/table/mono-table-search-core.d.ts +22 -3
  69. package/dist/src/components/table/table-types.d.ts +74 -4
  70. package/dist/src/components/tag-input/tag-input-core.d.ts +1 -1
  71. package/dist/src/components/tag-input/tag-input-types.d.ts +1 -1
  72. package/dist/src/components/textarea/textarea-core.d.ts +1 -1
  73. package/dist/src/composables/mono-event.d.ts +7 -1
  74. package/dist/src/entries/index.d.ts +8 -6
  75. package/dist/src/entries/index.node.d.ts +8 -6
  76. package/dist/src/search/index.d.ts +1 -1
  77. package/dist/src/utils/group-count.d.ts +36 -0
  78. package/dist/switch-utils-CTZ4id2V.js +338 -0
  79. package/dist/tabs-core-r5-B8k_N.js +317 -0
  80. package/dist/tag-input-utils-D2JA90DQ.js +3060 -0
  81. package/dist/textarea-utils-VU1KeXm8.js +821 -0
  82. package/dist/ui/accordion.js +2 -274
  83. package/dist/ui/alert.js +2 -131
  84. package/dist/ui/breadcrumb.js +4 -745
  85. package/dist/ui/button-dropdown.js +4 -652
  86. package/dist/ui/button.js +2 -63
  87. package/dist/ui/card.js +2 -310
  88. package/dist/ui/chart.js +4 -800
  89. package/dist/ui/checkbox.js +4 -335
  90. package/dist/ui/chip.js +4 -402
  91. package/dist/ui/date.js +3 -732
  92. package/dist/ui/drawer.js +3 -757
  93. package/dist/ui/dropdown-table.js +5 -1341
  94. package/dist/ui/dropdown.js +4 -509
  95. package/dist/ui/file-upload.js +3 -622
  96. package/dist/ui/filter.js +5 -380
  97. package/dist/ui/form.js +1 -1
  98. package/dist/ui/index.css +130 -5
  99. package/dist/ui/input.js +3 -1141
  100. package/dist/ui/menu.js +4 -828
  101. package/dist/ui/modal.js +4 -843
  102. package/dist/ui/nav.js +4 -223
  103. package/dist/ui/otp.js +4 -756
  104. package/dist/ui/radio.js +4 -317
  105. package/dist/ui/rich-text-editor.js +4 -1278
  106. package/dist/ui/select.js +5 -2138
  107. package/dist/ui/shadow/accordion.js +4 -273
  108. package/dist/ui/shadow/alert.js +4 -130
  109. package/dist/ui/shadow/breadcrumb.js +5 -744
  110. package/dist/ui/shadow/button-dropdown.js +6 -652
  111. package/dist/ui/shadow/button.js +3 -63
  112. package/dist/ui/shadow/card.js +4 -309
  113. package/dist/ui/shadow/chart.js +6 -1576
  114. package/dist/ui/shadow/checkbox.js +4 -334
  115. package/dist/ui/shadow/chip.js +4 -396
  116. package/dist/ui/shadow/date.js +7 -731
  117. package/dist/ui/shadow/drawer.js +4 -756
  118. package/dist/ui/shadow/dropdown-table.js +8 -1762
  119. package/dist/ui/shadow/dropdown.js +4 -508
  120. package/dist/ui/shadow/file-upload.js +4 -620
  121. package/dist/ui/shadow/filter.js +7 -379
  122. package/dist/ui/shadow/input.js +6 -1140
  123. package/dist/ui/shadow/menu.js +5 -828
  124. package/dist/ui/shadow/modal.js +6 -1063
  125. package/dist/ui/shadow/nav.js +5 -223
  126. package/dist/ui/shadow/otp.js +6 -754
  127. package/dist/ui/shadow/radio.js +4 -316
  128. package/dist/ui/shadow/rich-text-editor.js +4 -1276
  129. package/dist/ui/shadow/select.js +6 -2136
  130. package/dist/ui/shadow/sidebar.js +5 -581
  131. package/dist/ui/shadow/slider.js +5 -1010
  132. package/dist/ui/shadow/switch.js +4 -335
  133. package/dist/ui/shadow/table.js +10 -4501
  134. package/dist/ui/shadow/tabs.js +6 -315
  135. package/dist/ui/shadow/tag-input.js +7 -3057
  136. package/dist/ui/shadow/textarea.js +6 -817
  137. package/dist/ui/sidebar.js +3 -581
  138. package/dist/ui/slider.js +4 -1012
  139. package/dist/ui/switch.js +4 -336
  140. package/dist/ui/table.js +9 -4502
  141. package/dist/ui/tabs.js +4 -315
  142. package/dist/ui/tag-input.js +5 -3058
  143. package/dist/ui/textarea.js +4 -819
  144. package/dist/vue.d.ts +3 -2
  145. package/package.json +3 -3
  146. package/dist/chip-strip-bNfLn52Z.js +0 -215
  147. package/dist/data-source-controller-Dx6IQ2CN.js +0 -243
  148. package/dist/data-source-options-BM4r4PRw.js +0 -558
  149. package/dist/data-source-read-HyBCRg1t.js +0 -242
  150. package/dist/excel-BXzr3uI1.js +0 -784
  151. package/dist/export-ixRdCS2y.js +0 -2388
  152. package/dist/field-tooltip-addon-CWCp19mJ.js +0 -702
  153. package/dist/field-tooltip.css_raw-U5UeTa2d.js +0 -269
  154. package/dist/filter-builder-C0T3pMx2.js +0 -208
  155. package/dist/form-control-core-BbiACMtL.js +0 -226
  156. package/dist/icon-ClxnYhBG.js +0 -19
  157. package/dist/import-Dc4eXC02.js +0 -612
  158. package/dist/light-slots-_no0r2Z-.js +0 -246
  159. package/dist/markdown-uGlE_OfJ.js +0 -20191
  160. package/dist/mono-data-grid-Bkr-e1-i.js +0 -4043
  161. package/dist/normalize-error-BmLbgANw.js +0 -1048
@@ -0,0 +1,747 @@
1
+ import { a as defineHybridPropAliases, n as arrayHasChanged, 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, isServer, nothing } from "lit";
5
+ import { property, state } from "lit/decorators.js";
6
+
7
+ //#region src/components/breadcrumb/breadcrumb-utils.ts
8
+ /**
9
+ * Coerce any `items` input to a `BreadcrumbItem[]`. Accepts an array (pass-through),
10
+ * a JSON string (`items='[...]'` attribute, or a string assigned to the PROPERTY —
11
+ * which is what nuxt-ssr-lit does when forwarding a Vue `:items="<json>"` binding
12
+ * to the SSR renderer), or anything else (→ `[]`).
13
+ */
14
+ function coerceItems(value) {
15
+ if (Array.isArray(value)) return value;
16
+ if (typeof value === "string") {
17
+ if (!value) return [];
18
+ try {
19
+ const parsed = JSON.parse(value);
20
+ return Array.isArray(parsed) ? parsed : [];
21
+ } catch {
22
+ return [];
23
+ }
24
+ }
25
+ return [];
26
+ }
27
+ function findItem(items, id) {
28
+ for (const item of items) if (item.id === id) return item;
29
+ return null;
30
+ }
31
+ function findItemIndex(items, id) {
32
+ for (let i = 0; i < items.length; i++) if (items[i].id === id) return i;
33
+ return -1;
34
+ }
35
+ /**
36
+ * Resolve which breadcrumb item is the "current" segment.
37
+ * Priority: explicit `modelValue` → first item with `current: true` → last item.
38
+ */
39
+ function resolveCurrentId(items, modelValue) {
40
+ if (modelValue?.id) return modelValue.id;
41
+ for (const item of items) if (item.current) return item.id;
42
+ if (items.length) return items[items.length - 1].id;
43
+ return "";
44
+ }
45
+ function generateBreadcrumbRootClasses(props) {
46
+ return [
47
+ "mono-breadcrumb",
48
+ props.variant,
49
+ props.size,
50
+ props.color,
51
+ props.truncate ? "truncate" : "",
52
+ props.disabled ? "disabled" : "",
53
+ props.cssClassName ?? "",
54
+ props.rootExtra ?? ""
55
+ ].filter(Boolean).join(" ");
56
+ }
57
+ function validateBreadcrumbProps(props) {
58
+ const errors = [];
59
+ if (props.variant && ![
60
+ "default",
61
+ "contained",
62
+ "underlined"
63
+ ].includes(props.variant)) errors.push(`Invalid variant: ${String(props.variant)}`);
64
+ if (props.size && ![
65
+ "xs",
66
+ "sm",
67
+ "md",
68
+ "lg",
69
+ "xl",
70
+ "xxl"
71
+ ].includes(props.size)) errors.push(`Invalid size: ${String(props.size)}`);
72
+ if (props.color && ![
73
+ "primary",
74
+ "secondary",
75
+ "success",
76
+ "danger",
77
+ "warning",
78
+ "info",
79
+ "surface"
80
+ ].includes(props.color)) errors.push(`Invalid color: ${String(props.color)}`);
81
+ return errors;
82
+ }
83
+ /**
84
+ * The Basecoat styling attributes for the breadcrumb ROOT, mirroring the props
85
+ * one for one. A prop at its DEFAULT emits nothing — `:not([mono-size])` is md,
86
+ * `:not([mono-color])` is primary, `:not([mono-variant])` is default — so the
87
+ * rendered DOM is also the shortest hand-written markup that paints the same
88
+ * (see breadcrumb.css). Shared so `<mono-breadcrumb>` and a standalone
89
+ * `<mono-breadcrumb-list>` cannot drift apart.
90
+ */
91
+ function breadcrumbRootAttrs(props) {
92
+ return {
93
+ size: props.size === "md" ? null : props.size,
94
+ color: props.color === "primary" ? null : props.color,
95
+ variant: props.variant === "default" ? null : props.variant
96
+ };
97
+ }
98
+
99
+ //#endregion
100
+ //#region src/components/breadcrumb/breadcrumb-render.ts
101
+ function clsFor(base, key, cssClass) {
102
+ const extra = cssClass?.[key];
103
+ return extra ? `${base} ${extra}` : base;
104
+ }
105
+ function renderBreadcrumbIcon(item, ctx) {
106
+ const slotNodes = ctx.getSlotIconNodes(item.id);
107
+ const hasSlot = !!(slotNodes && slotNodes.length);
108
+ if (!hasSlot && !item.icon) return nothing;
109
+ if (ctx.iconSlot && (hasSlot || isIconifyClass(item.icon))) return html`
110
+ <span
111
+ class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
112
+ mono-icon
113
+ aria-hidden="true"
114
+ >
115
+ <slot name=${`icon-${item.id}`}></slot>
116
+ </span>
117
+ `;
118
+ if (hasSlot) return html`
119
+ <span
120
+ class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
121
+ mono-icon
122
+ aria-hidden="true"
123
+ >
124
+ <span data-mono-slot=${`icon-${item.id}`}></span>
125
+ </span>
126
+ `;
127
+ if (isIconifyClass(item.icon)) return html`
128
+ <span
129
+ class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
130
+ mono-icon
131
+ aria-hidden="true"
132
+ >
133
+ <span class=${`mono-breadcrumb-iconify ${item.icon}`} mono-glyph></span>
134
+ </span>
135
+ `;
136
+ return html`
137
+ <span
138
+ class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
139
+ mono-icon
140
+ aria-hidden="true"
141
+ >
142
+ ${item.icon}
143
+ </span>
144
+ `;
145
+ }
146
+ function renderBreadcrumbBadge(item, ctx) {
147
+ if (item.badge === void 0 || item.badge === null || item.badge === "") return nothing;
148
+ const colorClass = item.badgeColor && item.badgeColor !== "default" ? item.badgeColor : "";
149
+ return html`
150
+ <span
151
+ class=${`${clsFor("mono-breadcrumb-badge", "badge", ctx.cssClass)} ${colorClass}`.trim()}
152
+ mono-badge=${colorClass}
153
+ >
154
+ ${item.badge}
155
+ </span>
156
+ `;
157
+ }
158
+ function renderBreadcrumbItemRow(item, index, ctx) {
159
+ const current = ctx.isCurrent(item.id);
160
+ const itemClasses = [
161
+ clsFor("mono-breadcrumb-item", "item", ctx.cssClass),
162
+ current ? "current" : "",
163
+ current && ctx.cssClass?.itemCurrent ? ctx.cssClass.itemCurrent : "",
164
+ item.disabled ? "disabled" : "",
165
+ item.disabled && ctx.cssClass?.itemDisabled ? ctx.cssClass.itemDisabled : ""
166
+ ].filter(Boolean).join(" ");
167
+ const itemAttrs = {
168
+ current,
169
+ disabled: !!item.disabled
170
+ };
171
+ const inner = html`
172
+ ${renderBreadcrumbIcon(item, ctx)}
173
+ <span class=${clsFor("mono-breadcrumb-content", "content", ctx.cssClass)} mono-content>
174
+ <span class=${clsFor("mono-breadcrumb-title", "title", ctx.cssClass)} mono-title>
175
+ ${item.title ?? item.id}
176
+ </span>
177
+ </span>
178
+ ${renderBreadcrumbBadge(item, ctx)}
179
+ `;
180
+ if (current) return html`
181
+ <li
182
+ class=${itemClasses}
183
+ mono-item
184
+ ?mono-current=${itemAttrs.current}
185
+ ?mono-disabled=${itemAttrs.disabled}
186
+ aria-current="page"
187
+ >
188
+ <span
189
+ class=${clsFor("mono-breadcrumb-action", "action", ctx.cssClass)}
190
+ mono-action
191
+ aria-disabled=${item.disabled ? "true" : "false"}
192
+ >
193
+ ${inner}
194
+ </span>
195
+ </li>
196
+ `;
197
+ if (item.href) return html`
198
+ <li class=${itemClasses} mono-item ?mono-disabled=${itemAttrs.disabled}>
199
+ <a
200
+ class=${clsFor("mono-breadcrumb-action", "action", ctx.cssClass)}
201
+ mono-action
202
+ href=${item.href}
203
+ aria-disabled=${item.disabled ? "true" : "false"}
204
+ @click=${(e) => ctx.onItemClick(item, index, e)}
205
+ >
206
+ ${inner}
207
+ </a>
208
+ </li>
209
+ `;
210
+ return html`
211
+ <li class=${itemClasses} mono-item ?mono-disabled=${itemAttrs.disabled}>
212
+ <button
213
+ type="button"
214
+ class=${clsFor("mono-breadcrumb-action", "action", ctx.cssClass)}
215
+ mono-action
216
+ aria-disabled=${item.disabled ? "true" : "false"}
217
+ ?disabled=${item.disabled || ctx.disabled}
218
+ @click=${(e) => ctx.onItemClick(item, index, e)}
219
+ >
220
+ ${inner}
221
+ </button>
222
+ </li>
223
+ `;
224
+ }
225
+ function renderBreadcrumbSeparator(ctx, index) {
226
+ if (ctx.hasSeparatorSlot) return html`
227
+ <li
228
+ class=${clsFor("mono-breadcrumb-sep", "separator", ctx.cssClass)}
229
+ mono-separator
230
+ aria-hidden="true"
231
+ >
232
+ <span data-mono-slot=${`separator-${index}`}></span>
233
+ </li>
234
+ `;
235
+ return html`
236
+ <li
237
+ class=${clsFor("mono-breadcrumb-sep", "separator", ctx.cssClass)}
238
+ mono-separator
239
+ aria-hidden="true"
240
+ >
241
+ ${ctx.separator}
242
+ </li>
243
+ `;
244
+ }
245
+ function renderBreadcrumbList(items, ctx) {
246
+ const out = [];
247
+ items.forEach((item, index) => {
248
+ if (index > 0) out.push(renderBreadcrumbSeparator(ctx, index));
249
+ out.push(renderBreadcrumbItemRow(item, index, ctx));
250
+ });
251
+ return out;
252
+ }
253
+ /**
254
+ * Render items with a leading separator BEFORE each item — used when the child
255
+ * `<mono-breadcrumb-list>` is composed inside a parent `<mono-breadcrumb>` and
256
+ * we don't know whether this child is the first sibling. The very first
257
+ * separator is hidden via CSS:
258
+ * `.mono-breadcrumb-list > mono-breadcrumb-list:first-child > .mono-breadcrumb-sep:first-child { display: none; }`
259
+ */
260
+ function renderBreadcrumbItemsLeadingSep(items, ctx, startIndex = 0) {
261
+ const out = [];
262
+ items.forEach((item, i) => {
263
+ const index = startIndex + i;
264
+ out.push(renderBreadcrumbSeparator(ctx, index));
265
+ out.push(renderBreadcrumbItemRow(item, index, ctx));
266
+ });
267
+ return out;
268
+ }
269
+
270
+ //#endregion
271
+ //#region src/components/breadcrumb/breadcrumb-core.ts
272
+ /**
273
+ * `MonoBreadcrumbCore` — all render-mode-agnostic logic for `mono-breadcrumb`:
274
+ * reactive props (incl. the SSR `items` string→array coercion), hybrid aliases,
275
+ * camelCase attribute fallbacks, the child-list registry + state propagation,
276
+ * item activation + events, and the `<nav>` chrome `render()`. The light build
277
+ * keeps its `[data-mono-slot]` capture (`slot="body"`/`separator`/`icon-*`) and
278
+ * overrides `_renderBody()`; the shadow build renders the whole list from `items`
279
+ * in one shadow root and overrides `_useIconSlots()` (mirrors `mono-menu`).
280
+ *
281
+ * SSR-safe: no `document`/`window` access except `focus()` (guarded by isServer).
282
+ */
283
+ const MonoBreadcrumbCore = (superClass) => {
284
+ class MonoBreadcrumbCoreClass extends superClass {
285
+ constructor(...args) {
286
+ super(...args);
287
+ this.items = [];
288
+ this.modelValue = null;
289
+ this.variant = "default";
290
+ this.size = "md";
291
+ this.color = "primary";
292
+ this.separator = "›";
293
+ this.truncate = false;
294
+ this.disabled = false;
295
+ this.ariaLabel = "Breadcrumb";
296
+ this.cssClass = {};
297
+ this.cssClassName = "";
298
+ this._slotIcons = /* @__PURE__ */ new Map();
299
+ this._slotSeparator = [];
300
+ this._listChildren = /* @__PURE__ */ new Set();
301
+ defineHybridPropAliases(this, ["modelValue", "cssClass"]);
302
+ Object.defineProperty(this, "css-class", {
303
+ get: () => this.cssClass,
304
+ set: (value) => this._setCssClass(value),
305
+ configurable: true,
306
+ enumerable: false
307
+ });
308
+ Object.defineProperty(this, "cssclass", {
309
+ get: () => this.cssClass,
310
+ set: (value) => this._setCssClass(value),
311
+ configurable: true,
312
+ enumerable: false
313
+ });
314
+ }
315
+ static get observedAttributes() {
316
+ return [
317
+ ...super.observedAttributes ?? [],
318
+ "modelvalue",
319
+ "model-value",
320
+ "css-class",
321
+ "cssclass"
322
+ ];
323
+ }
324
+ attributeChangedCallback(name, oldValue, newValue) {
325
+ super.attributeChangedCallback(name, oldValue, newValue);
326
+ if (oldValue === newValue) return;
327
+ if (name === "modelvalue" || name === "model-value") {
328
+ this._setModelValueFromAttribute(newValue);
329
+ return;
330
+ }
331
+ if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
332
+ }
333
+ willUpdate(changed) {
334
+ if (typeof this.items === "string") this.items = coerceItems(this.items);
335
+ if (typeof this.modelValue === "string") this._setModelValueFromAttribute(this.modelValue);
336
+ super.willUpdate(changed);
337
+ }
338
+ _setModelValueFromAttribute(value) {
339
+ if (value == null || value === "") {
340
+ this.modelValue = null;
341
+ return;
342
+ }
343
+ const trimmed = value.trim();
344
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
345
+ this.modelValue = JSON.parse(trimmed);
346
+ return;
347
+ } catch {}
348
+ const found = findItem(this.items, trimmed);
349
+ this.modelValue = found ?? { id: trimmed };
350
+ }
351
+ _setCssClass(value) {
352
+ if (value == null) {
353
+ this.cssClass = {};
354
+ this.cssClassName = "";
355
+ return;
356
+ }
357
+ if (typeof value === "object") {
358
+ this.cssClass = value;
359
+ return;
360
+ }
361
+ if (typeof value === "string") {
362
+ const trimmed = value.trim();
363
+ if (!trimmed) {
364
+ this.cssClass = {};
365
+ this.cssClassName = "";
366
+ return;
367
+ }
368
+ if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
369
+ this.cssClass = JSON.parse(trimmed);
370
+ return;
371
+ } catch {}
372
+ this.cssClassName = trimmed;
373
+ }
374
+ }
375
+ _cls(base, key) {
376
+ const extra = this.cssClass?.[key];
377
+ return extra ? `${base} ${extra}` : base;
378
+ }
379
+ get _rootClasses() {
380
+ return generateBreadcrumbRootClasses({
381
+ variant: this.variant,
382
+ size: this.size,
383
+ color: this.color,
384
+ truncate: this.truncate,
385
+ disabled: this.disabled,
386
+ cssClassName: this.cssClassName,
387
+ rootExtra: this.cssClass?.root
388
+ });
389
+ }
390
+ _resolvedCurrentId() {
391
+ return resolveCurrentId(this.items, this.modelValue);
392
+ }
393
+ _isCurrent(id) {
394
+ if (this._listChildren.size && !this.items.length) {
395
+ if (this.modelValue?.id) return this.modelValue.id === id;
396
+ return resolveCurrentId(this._registeredItems(), null) === id;
397
+ }
398
+ return this._resolvedCurrentId() === id;
399
+ }
400
+ /** Every child list's items, in registration (DOM) order. */
401
+ _registeredItems() {
402
+ const out = [];
403
+ for (const child of this._listChildren) out.push(...child.getBreadcrumbItems?.() ?? []);
404
+ return out;
405
+ }
406
+ _findRegisteredItem(id) {
407
+ for (const child of this._listChildren) {
408
+ const items = child.getBreadcrumbItems?.() ?? [];
409
+ const found = findItem(items, id);
410
+ if (found) return found;
411
+ }
412
+ return null;
413
+ }
414
+ _findAnyItem(id) {
415
+ return findItem(this.items, id) ?? this._findRegisteredItem(id);
416
+ }
417
+ /** Programmatic select. Updates modelValue and emits `change`. */
418
+ select(id) {
419
+ const item = this._findAnyItem(id);
420
+ if (!item) return;
421
+ this._handleItemActivation(item, findItemIndex(this.items, id));
422
+ }
423
+ focus() {
424
+ if (isServer) return;
425
+ this.renderRoot.querySelector("a.mono-breadcrumb-action, button.mono-breadcrumb-action")?.focus();
426
+ }
427
+ /**
428
+ * Public hooks consumed by descendant `<mono-breadcrumb-list>` instances
429
+ * rendered inside `slot="body"` (light build).
430
+ */
431
+ requestItemActivation(item, index, event) {
432
+ this._handleItemActivation(item, index, event);
433
+ }
434
+ isItemCurrent(id) {
435
+ return this._isCurrent(id);
436
+ }
437
+ getSlotIconNodes(id) {
438
+ return this._slotIcons.get(id);
439
+ }
440
+ hasSeparatorSlot() {
441
+ return this._slotSeparator.length > 0;
442
+ }
443
+ getSeparatorString() {
444
+ return this.separator;
445
+ }
446
+ /** @internal called by `<mono-breadcrumb-list>` from its connectedCallback. */
447
+ _registerListChild(child) {
448
+ this._listChildren.add(child);
449
+ }
450
+ /** @internal called by `<mono-breadcrumb-list>` from its disconnectedCallback. */
451
+ _unregisterListChild(child) {
452
+ this._listChildren.delete(child);
453
+ }
454
+ _handleItemActivation(item, index, event) {
455
+ if (item.disabled || this.disabled) return;
456
+ dispatchMonoEvent(this, "click", {
457
+ value: item.id,
458
+ item,
459
+ index,
460
+ sourceEvent: event
461
+ });
462
+ const oldValue = this.modelValue;
463
+ if (oldValue?.id === item.id) return;
464
+ this.modelValue = item;
465
+ const detail = {
466
+ modelValue: item,
467
+ currentValue: item,
468
+ oldValue,
469
+ sourceEvent: event
470
+ };
471
+ dispatchMonoEvent(this, "change", detail);
472
+ }
473
+ _notifyListChildren(changed) {
474
+ if (!this._listChildren.size) return;
475
+ if (![
476
+ "modelValue",
477
+ "variant",
478
+ "size",
479
+ "color",
480
+ "separator",
481
+ "truncate",
482
+ "disabled",
483
+ "cssClass",
484
+ "cssClassName"
485
+ ].some((k) => changed.has(k))) return;
486
+ for (const child of this._listChildren) child.requestUpdate();
487
+ }
488
+ /** Build the shared render context. */
489
+ _renderContext() {
490
+ return {
491
+ cssClass: this.cssClass,
492
+ separator: this.separator,
493
+ hasSeparatorSlot: this._slotSeparator.length > 0,
494
+ iconSlot: this._useIconSlots(),
495
+ disabled: this.disabled,
496
+ isCurrent: (id) => this._isCurrent(id),
497
+ getSlotIconNodes: (id) => this._slotIcons.get(id),
498
+ onItemClick: (item, index, e) => this._handleItemActivation(item, index, e)
499
+ };
500
+ }
501
+ /**
502
+ * Whether per-item icons render through a native `<slot>` (shadow build) vs
503
+ * the light-DOM `data-mono-slot` + inline `i-…` span (light build).
504
+ */
505
+ _useIconSlots() {
506
+ return false;
507
+ }
508
+ /**
509
+ * The items to render for THIS render pass. Defaults to the full `items`.
510
+ * The shadow build overrides this to slice down to the server-rendered crumb
511
+ * count during the hydration render, so the first client render matches the
512
+ * SSR'd DOM exactly (avoids "shorter than expected iterable" + double render
513
+ * when `items` arrives via `.prop`, which @lit-labs/ssr does not forward).
514
+ */
515
+ _itemsForRender() {
516
+ return this.items;
517
+ }
518
+ /** The list body. Light build overrides this to support `slot="body"`. */
519
+ _renderBody() {
520
+ return html`
521
+ <ol class=${this._cls("mono-breadcrumb-list", "list")} mono-list>
522
+ ${renderBreadcrumbList(this._itemsForRender(), this._renderContext())}
523
+ </ol>
524
+ `;
525
+ }
526
+ render() {
527
+ const attrs = breadcrumbRootAttrs(this);
528
+ return html`
529
+ <nav
530
+ class=${this._rootClasses}
531
+ aria-label=${this.ariaLabel ?? "Breadcrumb"}
532
+ mono-breadcrumb
533
+ mono-size=${attrs.size ?? nothing}
534
+ mono-color=${attrs.color ?? nothing}
535
+ mono-variant=${attrs.variant ?? nothing}
536
+ ?mono-truncate=${this.truncate}
537
+ ?mono-disabled=${this.disabled}
538
+ >
539
+ ${this._renderBody()}
540
+ </nav>
541
+ `;
542
+ }
543
+ }
544
+ __decorate([property({
545
+ attribute: "items",
546
+ converter: {
547
+ fromAttribute: (value) => coerceItems(value),
548
+ toAttribute: () => null
549
+ },
550
+ hasChanged: arrayHasChanged
551
+ })], MonoBreadcrumbCoreClass.prototype, "items", void 0);
552
+ __decorate([property({ attribute: false })], MonoBreadcrumbCoreClass.prototype, "modelValue", void 0);
553
+ __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "variant", void 0);
554
+ __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "size", void 0);
555
+ __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "color", void 0);
556
+ __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "separator", void 0);
557
+ __decorate([property({
558
+ reflect: true,
559
+ converter: booleanStringConverter
560
+ })], MonoBreadcrumbCoreClass.prototype, "truncate", void 0);
561
+ __decorate([property({
562
+ reflect: true,
563
+ converter: booleanStringConverter
564
+ })], MonoBreadcrumbCoreClass.prototype, "disabled", void 0);
565
+ __decorate([property({ attribute: "aria-label" })], MonoBreadcrumbCoreClass.prototype, "ariaLabel", void 0);
566
+ __decorate([property({ attribute: false })], MonoBreadcrumbCoreClass.prototype, "cssClass", void 0);
567
+ __decorate([property({ attribute: false })], MonoBreadcrumbCoreClass.prototype, "cssClassName", void 0);
568
+ __decorate([state()], MonoBreadcrumbCoreClass.prototype, "_slotIcons", void 0);
569
+ return MonoBreadcrumbCoreClass;
570
+ };
571
+
572
+ //#endregion
573
+ //#region src/components/breadcrumb/breadcrumb-list-core.ts
574
+ let autoBreadcrumbListId = 0;
575
+ /**
576
+ * `MonoBreadcrumbListCore` — render-mode-agnostic logic for the STANDALONE
577
+ * `mono-breadcrumb-list`: reactive props (incl. the SSR `items` string→array
578
+ * coercion), item resolution (`items` array / single `item` / direct single-row
579
+ * props), the self-contained `<nav><ol>` render, and the `_useIconSlots()` /
580
+ * `_itemsForRender()` hooks.
581
+ *
582
+ * The light build (`mono-breadcrumb-list.ts`) extends this and layers the
583
+ * light-only CHILD composition (registering with a parent `<mono-breadcrumb>`
584
+ * via `closest()` and rendering bare items). The shadow build
585
+ * (`mono-breadcrumb-list.shadow.ts`) extends this for `@lit-labs/ssr`, rendering
586
+ * standalone in one shadow root and overriding `_useIconSlots()`. Child mode is
587
+ * a light-only feature (cross-element `closest()` can't work under SSR).
588
+ *
589
+ * SSR-safe: no `document`/`window` access.
590
+ */
591
+ const MonoBreadcrumbListCore = (superClass) => {
592
+ class MonoBreadcrumbListCoreClass extends superClass {
593
+ constructor(..._args) {
594
+ super(..._args);
595
+ this.items = [];
596
+ this.title = "";
597
+ this.href = "";
598
+ this.icon = "";
599
+ this.current = false;
600
+ this.disabled = false;
601
+ this.variant = "default";
602
+ this.size = "md";
603
+ this.color = "primary";
604
+ this.separator = "›";
605
+ this.truncate = false;
606
+ this._autoId = `mono-breadcrumb-list-item-${++autoBreadcrumbListId}`;
607
+ }
608
+ willUpdate(changed) {
609
+ if (typeof this.items === "string") this.items = coerceItems(this.items);
610
+ super.willUpdate?.(changed);
611
+ }
612
+ getBreadcrumbItems() {
613
+ return this._getEffectiveItems();
614
+ }
615
+ _hasDirectItemProps() {
616
+ return !!(this.id || this.title || this.href || this.icon || this.badge !== void 0 || this.current || this.disabled);
617
+ }
618
+ _normalizeItem(item) {
619
+ const title = item.title ?? "";
620
+ const fallbackId = this.id || item.id || item.href || title.toLowerCase().trim().replace(/\s+/g, "-") || this._autoId;
621
+ const normalized = { id: String(item.id ?? fallbackId) };
622
+ if (item.title !== void 0) normalized.title = item.title;
623
+ if (item.icon !== void 0) normalized.icon = item.icon;
624
+ if (item.badge !== void 0) normalized.badge = item.badge;
625
+ if (item.badgeColor !== void 0) normalized.badgeColor = item.badgeColor;
626
+ if (item.href !== void 0) normalized.href = item.href;
627
+ if (item.current !== void 0) normalized.current = item.current;
628
+ if (item.disabled !== void 0) normalized.disabled = item.disabled;
629
+ return normalized;
630
+ }
631
+ _buildDirectItem() {
632
+ return this._normalizeItem({
633
+ id: this.id || void 0,
634
+ title: this.title || void 0,
635
+ href: this.href || void 0,
636
+ icon: this.icon || void 0,
637
+ badge: this.badge,
638
+ badgeColor: this.badgeColor,
639
+ current: this.current,
640
+ disabled: this.disabled
641
+ });
642
+ }
643
+ _getEffectiveItems() {
644
+ if (this.item) return [this._normalizeItem(this.item)];
645
+ if (this._hasDirectItemProps()) return [this._buildDirectItem()];
646
+ if (Array.isArray(this.items) && this.items.length) return this.items;
647
+ return [];
648
+ }
649
+ /**
650
+ * The items to render for THIS render pass. Defaults to the effective items.
651
+ * The shadow build overrides this to cap the hydration render at the
652
+ * server-rendered count.
653
+ */
654
+ _itemsForRender() {
655
+ return this._getEffectiveItems();
656
+ }
657
+ /**
658
+ * Whether per-item icons render through a native `<slot>` (shadow build) vs
659
+ * the light-DOM inline `i-…` span (light build).
660
+ */
661
+ _useIconSlots() {
662
+ return false;
663
+ }
664
+ _standaloneContext() {
665
+ return {
666
+ cssClass: {},
667
+ separator: this.separator,
668
+ hasSeparatorSlot: false,
669
+ disabled: this.disabled,
670
+ iconSlot: this._useIconSlots(),
671
+ isCurrent: (id) => {
672
+ const items = this._getEffectiveItems();
673
+ for (const it of items) if (it.current && it.id === id) return true;
674
+ if (items.length && items.every((it) => !it.current)) return items[items.length - 1].id === id;
675
+ return false;
676
+ },
677
+ getSlotIconNodes: () => void 0,
678
+ onItemClick: () => {}
679
+ };
680
+ }
681
+ /** Light build overrides this to return a parent-aware context. */
682
+ _buildContext() {
683
+ return this._standaloneContext();
684
+ }
685
+ _standaloneRootClasses() {
686
+ return generateBreadcrumbRootClasses({
687
+ variant: this.variant,
688
+ size: this.size,
689
+ color: this.color,
690
+ truncate: this.truncate,
691
+ disabled: this.disabled
692
+ });
693
+ }
694
+ render() {
695
+ const ctx = this._buildContext();
696
+ const listClass = ctx.cssClass?.list ? `mono-breadcrumb-list ${ctx.cssClass.list}` : "mono-breadcrumb-list";
697
+ const attrs = breadcrumbRootAttrs(this);
698
+ return html`
699
+ <nav
700
+ class=${this._standaloneRootClasses()}
701
+ aria-label="Breadcrumb"
702
+ mono-breadcrumb
703
+ mono-size=${attrs.size ?? nothing}
704
+ mono-color=${attrs.color ?? nothing}
705
+ mono-variant=${attrs.variant ?? nothing}
706
+ ?mono-truncate=${this.truncate}
707
+ ?mono-disabled=${this.disabled}
708
+ >
709
+ <ol class=${listClass} mono-list>
710
+ ${renderBreadcrumbList(this._itemsForRender(), ctx)}
711
+ </ol>
712
+ </nav>
713
+ `;
714
+ }
715
+ }
716
+ __decorate([property({
717
+ attribute: "items",
718
+ converter: {
719
+ fromAttribute: (value) => coerceItems(value),
720
+ toAttribute: () => null
721
+ },
722
+ hasChanged: arrayHasChanged
723
+ })], MonoBreadcrumbListCoreClass.prototype, "items", void 0);
724
+ __decorate([property({ attribute: false })], MonoBreadcrumbListCoreClass.prototype, "item", void 0);
725
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "title", void 0);
726
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "href", void 0);
727
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "icon", void 0);
728
+ __decorate([property()], MonoBreadcrumbListCoreClass.prototype, "badge", void 0);
729
+ __decorate([property({ attribute: "badge-color" })], MonoBreadcrumbListCoreClass.prototype, "badgeColor", void 0);
730
+ __decorate([property({
731
+ type: Boolean,
732
+ reflect: true
733
+ })], MonoBreadcrumbListCoreClass.prototype, "current", void 0);
734
+ __decorate([property({
735
+ type: Boolean,
736
+ reflect: true
737
+ })], MonoBreadcrumbListCoreClass.prototype, "disabled", void 0);
738
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "variant", void 0);
739
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "size", void 0);
740
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "color", void 0);
741
+ __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "separator", void 0);
742
+ __decorate([property({ type: Boolean })], MonoBreadcrumbListCoreClass.prototype, "truncate", void 0);
743
+ return MonoBreadcrumbListCoreClass;
744
+ };
745
+
746
+ //#endregion
747
+ export { renderBreadcrumbItemRow as a, renderBreadcrumbSeparator as c, generateBreadcrumbRootClasses as d, resolveCurrentId as f, renderBreadcrumbIcon as i, coerceItems as l, MonoBreadcrumbCore as n, renderBreadcrumbItemsLeadingSep as o, validateBreadcrumbProps as p, renderBreadcrumbBadge as r, renderBreadcrumbList as s, MonoBreadcrumbListCore as t, findItemIndex as u };