@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
@@ -1,578 +1,11 @@
1
1
  import { g as monoHostChildNodes } from "../mono-ui-kvLVIf1V.js";
2
2
  import { t as customElement } from "../mono-element-CKcT0rwv.js";
3
- import { a as defineHybridPropAliases, n as arrayHasChanged, r as booleanStringConverter, t as __decorate } from "../decorate-DbYFpi8R.js";
4
- import { t as dispatchMonoEvent } from "../mono-event-BPku9HpS.js";
5
- import { t as isIconifyClass } from "../icon-ClxnYhBG.js";
3
+ import { t as __decorate } from "../decorate-DbYFpi8R.js";
6
4
  import { a as parkDetachedNodes, s as placeSlotNode } from "../light-slots-B5Ck0t_E.js";
7
- import { LitElement, html, isServer, nothing } from "lit";
8
- import { property, state } from "lit/decorators.js";
5
+ import { a as renderBreadcrumbItemRow, c as renderBreadcrumbSeparator, d as generateBreadcrumbRootClasses, f as resolveCurrentId, i as renderBreadcrumbIcon, n as MonoBreadcrumbCore, o as renderBreadcrumbItemsLeadingSep, p as validateBreadcrumbProps, r as renderBreadcrumbBadge, s as renderBreadcrumbList, t as MonoBreadcrumbListCore, u as findItemIndex } from "../breadcrumb-list-core-Dh68T8Cf.js";
6
+ import { LitElement, html } from "lit";
7
+ import { state } from "lit/decorators.js";
9
8
 
10
- //#region src/components/breadcrumb/breadcrumb-utils.ts
11
- /**
12
- * Coerce any `items` input to a `BreadcrumbItem[]`. Accepts an array (pass-through),
13
- * a JSON string (`items='[...]'` attribute, or a string assigned to the PROPERTY —
14
- * which is what nuxt-ssr-lit does when forwarding a Vue `:items="<json>"` binding
15
- * to the SSR renderer), or anything else (→ `[]`).
16
- */
17
- function coerceItems(value) {
18
- if (Array.isArray(value)) return value;
19
- if (typeof value === "string") {
20
- if (!value) return [];
21
- try {
22
- const parsed = JSON.parse(value);
23
- return Array.isArray(parsed) ? parsed : [];
24
- } catch {
25
- return [];
26
- }
27
- }
28
- return [];
29
- }
30
- function findItem(items, id) {
31
- for (const item of items) if (item.id === id) return item;
32
- return null;
33
- }
34
- function findItemIndex(items, id) {
35
- for (let i = 0; i < items.length; i++) if (items[i].id === id) return i;
36
- return -1;
37
- }
38
- /**
39
- * Resolve which breadcrumb item is the "current" segment.
40
- * Priority: explicit `modelValue` → first item with `current: true` → last item.
41
- */
42
- function resolveCurrentId(items, modelValue) {
43
- if (modelValue?.id) return modelValue.id;
44
- for (const item of items) if (item.current) return item.id;
45
- if (items.length) return items[items.length - 1].id;
46
- return "";
47
- }
48
- function generateBreadcrumbRootClasses(props) {
49
- return [
50
- "mono-breadcrumb",
51
- props.variant,
52
- props.size,
53
- props.color,
54
- props.truncate ? "truncate" : "",
55
- props.disabled ? "disabled" : "",
56
- props.cssClassName ?? "",
57
- props.rootExtra ?? ""
58
- ].filter(Boolean).join(" ");
59
- }
60
- function validateBreadcrumbProps(props) {
61
- const errors = [];
62
- if (props.variant && ![
63
- "default",
64
- "contained",
65
- "underlined"
66
- ].includes(props.variant)) errors.push(`Invalid variant: ${String(props.variant)}`);
67
- if (props.size && ![
68
- "xs",
69
- "sm",
70
- "md",
71
- "lg",
72
- "xl",
73
- "xxl"
74
- ].includes(props.size)) errors.push(`Invalid size: ${String(props.size)}`);
75
- if (props.color && ![
76
- "primary",
77
- "secondary",
78
- "success",
79
- "danger",
80
- "warning",
81
- "info",
82
- "surface"
83
- ].includes(props.color)) errors.push(`Invalid color: ${String(props.color)}`);
84
- return errors;
85
- }
86
- /**
87
- * The Basecoat styling attributes for the breadcrumb ROOT, mirroring the props
88
- * one for one. A prop at its DEFAULT emits nothing — `:not([mono-size])` is md,
89
- * `:not([mono-color])` is primary, `:not([mono-variant])` is default — so the
90
- * rendered DOM is also the shortest hand-written markup that paints the same
91
- * (see breadcrumb.css). Shared so `<mono-breadcrumb>` and a standalone
92
- * `<mono-breadcrumb-list>` cannot drift apart.
93
- */
94
- function breadcrumbRootAttrs(props) {
95
- return {
96
- size: props.size === "md" ? null : props.size,
97
- color: props.color === "primary" ? null : props.color,
98
- variant: props.variant === "default" ? null : props.variant
99
- };
100
- }
101
-
102
- //#endregion
103
- //#region src/components/breadcrumb/breadcrumb-render.ts
104
- function clsFor(base, key, cssClass) {
105
- const extra = cssClass?.[key];
106
- return extra ? `${base} ${extra}` : base;
107
- }
108
- function renderBreadcrumbIcon(item, ctx) {
109
- const slotNodes = ctx.getSlotIconNodes(item.id);
110
- const hasSlot = !!(slotNodes && slotNodes.length);
111
- if (!hasSlot && !item.icon) return nothing;
112
- if (ctx.iconSlot && (hasSlot || isIconifyClass(item.icon))) return html`
113
- <span
114
- class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
115
- mono-icon
116
- aria-hidden="true"
117
- >
118
- <slot name=${`icon-${item.id}`}></slot>
119
- </span>
120
- `;
121
- if (hasSlot) return html`
122
- <span
123
- class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
124
- mono-icon
125
- aria-hidden="true"
126
- >
127
- <span data-mono-slot=${`icon-${item.id}`}></span>
128
- </span>
129
- `;
130
- if (isIconifyClass(item.icon)) return html`
131
- <span
132
- class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
133
- mono-icon
134
- aria-hidden="true"
135
- >
136
- <span class=${`mono-breadcrumb-iconify ${item.icon}`} mono-glyph></span>
137
- </span>
138
- `;
139
- return html`
140
- <span
141
- class=${clsFor("mono-breadcrumb-icon", "icon", ctx.cssClass)}
142
- mono-icon
143
- aria-hidden="true"
144
- >
145
- ${item.icon}
146
- </span>
147
- `;
148
- }
149
- function renderBreadcrumbBadge(item, ctx) {
150
- if (item.badge === void 0 || item.badge === null || item.badge === "") return nothing;
151
- const colorClass = item.badgeColor && item.badgeColor !== "default" ? item.badgeColor : "";
152
- return html`
153
- <span
154
- class=${`${clsFor("mono-breadcrumb-badge", "badge", ctx.cssClass)} ${colorClass}`.trim()}
155
- mono-badge=${colorClass}
156
- >
157
- ${item.badge}
158
- </span>
159
- `;
160
- }
161
- function renderBreadcrumbItemRow(item, index, ctx) {
162
- const current = ctx.isCurrent(item.id);
163
- const itemClasses = [
164
- clsFor("mono-breadcrumb-item", "item", ctx.cssClass),
165
- current ? "current" : "",
166
- current && ctx.cssClass?.itemCurrent ? ctx.cssClass.itemCurrent : "",
167
- item.disabled ? "disabled" : "",
168
- item.disabled && ctx.cssClass?.itemDisabled ? ctx.cssClass.itemDisabled : ""
169
- ].filter(Boolean).join(" ");
170
- const itemAttrs = {
171
- current,
172
- disabled: !!item.disabled
173
- };
174
- const inner = html`
175
- ${renderBreadcrumbIcon(item, ctx)}
176
- <span class=${clsFor("mono-breadcrumb-content", "content", ctx.cssClass)} mono-content>
177
- <span class=${clsFor("mono-breadcrumb-title", "title", ctx.cssClass)} mono-title>
178
- ${item.title ?? item.id}
179
- </span>
180
- </span>
181
- ${renderBreadcrumbBadge(item, ctx)}
182
- `;
183
- if (current) return html`
184
- <li
185
- class=${itemClasses}
186
- mono-item
187
- ?mono-current=${itemAttrs.current}
188
- ?mono-disabled=${itemAttrs.disabled}
189
- aria-current="page"
190
- >
191
- <span
192
- class=${clsFor("mono-breadcrumb-action", "action", ctx.cssClass)}
193
- mono-action
194
- aria-disabled=${item.disabled ? "true" : "false"}
195
- >
196
- ${inner}
197
- </span>
198
- </li>
199
- `;
200
- if (item.href) return html`
201
- <li class=${itemClasses} mono-item ?mono-disabled=${itemAttrs.disabled}>
202
- <a
203
- class=${clsFor("mono-breadcrumb-action", "action", ctx.cssClass)}
204
- mono-action
205
- href=${item.href}
206
- aria-disabled=${item.disabled ? "true" : "false"}
207
- @click=${(e) => ctx.onItemClick(item, index, e)}
208
- >
209
- ${inner}
210
- </a>
211
- </li>
212
- `;
213
- return html`
214
- <li class=${itemClasses} mono-item ?mono-disabled=${itemAttrs.disabled}>
215
- <button
216
- type="button"
217
- class=${clsFor("mono-breadcrumb-action", "action", ctx.cssClass)}
218
- mono-action
219
- aria-disabled=${item.disabled ? "true" : "false"}
220
- ?disabled=${item.disabled || ctx.disabled}
221
- @click=${(e) => ctx.onItemClick(item, index, e)}
222
- >
223
- ${inner}
224
- </button>
225
- </li>
226
- `;
227
- }
228
- function renderBreadcrumbSeparator(ctx, index) {
229
- if (ctx.hasSeparatorSlot) return html`
230
- <li
231
- class=${clsFor("mono-breadcrumb-sep", "separator", ctx.cssClass)}
232
- mono-separator
233
- aria-hidden="true"
234
- >
235
- <span data-mono-slot=${`separator-${index}`}></span>
236
- </li>
237
- `;
238
- return html`
239
- <li
240
- class=${clsFor("mono-breadcrumb-sep", "separator", ctx.cssClass)}
241
- mono-separator
242
- aria-hidden="true"
243
- >
244
- ${ctx.separator}
245
- </li>
246
- `;
247
- }
248
- function renderBreadcrumbList(items, ctx) {
249
- const out = [];
250
- items.forEach((item, index) => {
251
- if (index > 0) out.push(renderBreadcrumbSeparator(ctx, index));
252
- out.push(renderBreadcrumbItemRow(item, index, ctx));
253
- });
254
- return out;
255
- }
256
- /**
257
- * Render items with a leading separator BEFORE each item — used when the child
258
- * `<mono-breadcrumb-list>` is composed inside a parent `<mono-breadcrumb>` and
259
- * we don't know whether this child is the first sibling. The very first
260
- * separator is hidden via CSS:
261
- * `.mono-breadcrumb-list > mono-breadcrumb-list:first-child > .mono-breadcrumb-sep:first-child { display: none; }`
262
- */
263
- function renderBreadcrumbItemsLeadingSep(items, ctx, startIndex = 0) {
264
- const out = [];
265
- items.forEach((item, i) => {
266
- const index = startIndex + i;
267
- out.push(renderBreadcrumbSeparator(ctx, index));
268
- out.push(renderBreadcrumbItemRow(item, index, ctx));
269
- });
270
- return out;
271
- }
272
-
273
- //#endregion
274
- //#region src/components/breadcrumb/breadcrumb-core.ts
275
- /**
276
- * `MonoBreadcrumbCore` — all render-mode-agnostic logic for `mono-breadcrumb`:
277
- * reactive props (incl. the SSR `items` string→array coercion), hybrid aliases,
278
- * camelCase attribute fallbacks, the child-list registry + state propagation,
279
- * item activation + events, and the `<nav>` chrome `render()`. The light build
280
- * keeps its `[data-mono-slot]` capture (`slot="body"`/`separator`/`icon-*`) and
281
- * overrides `_renderBody()`; the shadow build renders the whole list from `items`
282
- * in one shadow root and overrides `_useIconSlots()` (mirrors `mono-menu`).
283
- *
284
- * SSR-safe: no `document`/`window` access except `focus()` (guarded by isServer).
285
- */
286
- const MonoBreadcrumbCore = (superClass) => {
287
- class MonoBreadcrumbCoreClass extends superClass {
288
- constructor(...args) {
289
- super(...args);
290
- this.items = [];
291
- this.modelValue = null;
292
- this.variant = "default";
293
- this.size = "md";
294
- this.color = "primary";
295
- this.separator = "›";
296
- this.truncate = false;
297
- this.disabled = false;
298
- this.ariaLabel = "Breadcrumb";
299
- this.cssClass = {};
300
- this.cssClassName = "";
301
- this._slotIcons = /* @__PURE__ */ new Map();
302
- this._slotSeparator = [];
303
- this._listChildren = /* @__PURE__ */ new Set();
304
- defineHybridPropAliases(this, ["modelValue", "cssClass"]);
305
- Object.defineProperty(this, "css-class", {
306
- get: () => this.cssClass,
307
- set: (value) => this._setCssClass(value),
308
- configurable: true,
309
- enumerable: false
310
- });
311
- Object.defineProperty(this, "cssclass", {
312
- get: () => this.cssClass,
313
- set: (value) => this._setCssClass(value),
314
- configurable: true,
315
- enumerable: false
316
- });
317
- }
318
- static get observedAttributes() {
319
- return [
320
- ...super.observedAttributes ?? [],
321
- "modelvalue",
322
- "model-value",
323
- "css-class",
324
- "cssclass"
325
- ];
326
- }
327
- attributeChangedCallback(name, oldValue, newValue) {
328
- super.attributeChangedCallback(name, oldValue, newValue);
329
- if (oldValue === newValue) return;
330
- if (name === "modelvalue" || name === "model-value") {
331
- this._setModelValueFromAttribute(newValue);
332
- return;
333
- }
334
- if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
335
- }
336
- willUpdate(changed) {
337
- if (typeof this.items === "string") this.items = coerceItems(this.items);
338
- if (typeof this.modelValue === "string") this._setModelValueFromAttribute(this.modelValue);
339
- super.willUpdate(changed);
340
- }
341
- _setModelValueFromAttribute(value) {
342
- if (value == null || value === "") {
343
- this.modelValue = null;
344
- return;
345
- }
346
- const trimmed = value.trim();
347
- if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
348
- this.modelValue = JSON.parse(trimmed);
349
- return;
350
- } catch {}
351
- const found = findItem(this.items, trimmed);
352
- this.modelValue = found ?? { id: trimmed };
353
- }
354
- _setCssClass(value) {
355
- if (value == null) {
356
- this.cssClass = {};
357
- this.cssClassName = "";
358
- return;
359
- }
360
- if (typeof value === "object") {
361
- this.cssClass = value;
362
- return;
363
- }
364
- if (typeof value === "string") {
365
- const trimmed = value.trim();
366
- if (!trimmed) {
367
- this.cssClass = {};
368
- this.cssClassName = "";
369
- return;
370
- }
371
- if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
372
- this.cssClass = JSON.parse(trimmed);
373
- return;
374
- } catch {}
375
- this.cssClassName = trimmed;
376
- }
377
- }
378
- _cls(base, key) {
379
- const extra = this.cssClass?.[key];
380
- return extra ? `${base} ${extra}` : base;
381
- }
382
- get _rootClasses() {
383
- return generateBreadcrumbRootClasses({
384
- variant: this.variant,
385
- size: this.size,
386
- color: this.color,
387
- truncate: this.truncate,
388
- disabled: this.disabled,
389
- cssClassName: this.cssClassName,
390
- rootExtra: this.cssClass?.root
391
- });
392
- }
393
- _resolvedCurrentId() {
394
- return resolveCurrentId(this.items, this.modelValue);
395
- }
396
- _isCurrent(id) {
397
- if (this._listChildren.size && !this.items.length) {
398
- if (this.modelValue?.id) return this.modelValue.id === id;
399
- return resolveCurrentId(this._registeredItems(), null) === id;
400
- }
401
- return this._resolvedCurrentId() === id;
402
- }
403
- /** Every child list's items, in registration (DOM) order. */
404
- _registeredItems() {
405
- const out = [];
406
- for (const child of this._listChildren) out.push(...child.getBreadcrumbItems?.() ?? []);
407
- return out;
408
- }
409
- _findRegisteredItem(id) {
410
- for (const child of this._listChildren) {
411
- const items = child.getBreadcrumbItems?.() ?? [];
412
- const found = findItem(items, id);
413
- if (found) return found;
414
- }
415
- return null;
416
- }
417
- _findAnyItem(id) {
418
- return findItem(this.items, id) ?? this._findRegisteredItem(id);
419
- }
420
- /** Programmatic select. Updates modelValue and emits `change`. */
421
- select(id) {
422
- const item = this._findAnyItem(id);
423
- if (!item) return;
424
- this._handleItemActivation(item, findItemIndex(this.items, id));
425
- }
426
- focus() {
427
- if (isServer) return;
428
- this.renderRoot.querySelector("a.mono-breadcrumb-action, button.mono-breadcrumb-action")?.focus();
429
- }
430
- /**
431
- * Public hooks consumed by descendant `<mono-breadcrumb-list>` instances
432
- * rendered inside `slot="body"` (light build).
433
- */
434
- requestItemActivation(item, index, event) {
435
- this._handleItemActivation(item, index, event);
436
- }
437
- isItemCurrent(id) {
438
- return this._isCurrent(id);
439
- }
440
- getSlotIconNodes(id) {
441
- return this._slotIcons.get(id);
442
- }
443
- hasSeparatorSlot() {
444
- return this._slotSeparator.length > 0;
445
- }
446
- getSeparatorString() {
447
- return this.separator;
448
- }
449
- /** @internal called by `<mono-breadcrumb-list>` from its connectedCallback. */
450
- _registerListChild(child) {
451
- this._listChildren.add(child);
452
- }
453
- /** @internal called by `<mono-breadcrumb-list>` from its disconnectedCallback. */
454
- _unregisterListChild(child) {
455
- this._listChildren.delete(child);
456
- }
457
- _handleItemActivation(item, index, event) {
458
- if (item.disabled || this.disabled) return;
459
- dispatchMonoEvent(this, "click", {
460
- value: item.id,
461
- item,
462
- index,
463
- sourceEvent: event
464
- });
465
- const oldValue = this.modelValue;
466
- if (oldValue?.id === item.id) return;
467
- this.modelValue = item;
468
- const detail = {
469
- modelValue: item,
470
- currentValue: item,
471
- oldValue,
472
- sourceEvent: event
473
- };
474
- dispatchMonoEvent(this, "change", detail);
475
- }
476
- _notifyListChildren(changed) {
477
- if (!this._listChildren.size) return;
478
- if (![
479
- "modelValue",
480
- "variant",
481
- "size",
482
- "color",
483
- "separator",
484
- "truncate",
485
- "disabled",
486
- "cssClass",
487
- "cssClassName"
488
- ].some((k) => changed.has(k))) return;
489
- for (const child of this._listChildren) child.requestUpdate();
490
- }
491
- /** Build the shared render context. */
492
- _renderContext() {
493
- return {
494
- cssClass: this.cssClass,
495
- separator: this.separator,
496
- hasSeparatorSlot: this._slotSeparator.length > 0,
497
- iconSlot: this._useIconSlots(),
498
- disabled: this.disabled,
499
- isCurrent: (id) => this._isCurrent(id),
500
- getSlotIconNodes: (id) => this._slotIcons.get(id),
501
- onItemClick: (item, index, e) => this._handleItemActivation(item, index, e)
502
- };
503
- }
504
- /**
505
- * Whether per-item icons render through a native `<slot>` (shadow build) vs
506
- * the light-DOM `data-mono-slot` + inline `i-…` span (light build).
507
- */
508
- _useIconSlots() {
509
- return false;
510
- }
511
- /**
512
- * The items to render for THIS render pass. Defaults to the full `items`.
513
- * The shadow build overrides this to slice down to the server-rendered crumb
514
- * count during the hydration render, so the first client render matches the
515
- * SSR'd DOM exactly (avoids "shorter than expected iterable" + double render
516
- * when `items` arrives via `.prop`, which @lit-labs/ssr does not forward).
517
- */
518
- _itemsForRender() {
519
- return this.items;
520
- }
521
- /** The list body. Light build overrides this to support `slot="body"`. */
522
- _renderBody() {
523
- return html`
524
- <ol class=${this._cls("mono-breadcrumb-list", "list")} mono-list>
525
- ${renderBreadcrumbList(this._itemsForRender(), this._renderContext())}
526
- </ol>
527
- `;
528
- }
529
- render() {
530
- const attrs = breadcrumbRootAttrs(this);
531
- return html`
532
- <nav
533
- class=${this._rootClasses}
534
- aria-label=${this.ariaLabel ?? "Breadcrumb"}
535
- mono-breadcrumb
536
- mono-size=${attrs.size ?? nothing}
537
- mono-color=${attrs.color ?? nothing}
538
- mono-variant=${attrs.variant ?? nothing}
539
- ?mono-truncate=${this.truncate}
540
- ?mono-disabled=${this.disabled}
541
- >
542
- ${this._renderBody()}
543
- </nav>
544
- `;
545
- }
546
- }
547
- __decorate([property({
548
- attribute: "items",
549
- converter: {
550
- fromAttribute: (value) => coerceItems(value),
551
- toAttribute: () => null
552
- },
553
- hasChanged: arrayHasChanged
554
- })], MonoBreadcrumbCoreClass.prototype, "items", void 0);
555
- __decorate([property({ attribute: false })], MonoBreadcrumbCoreClass.prototype, "modelValue", void 0);
556
- __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "variant", void 0);
557
- __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "size", void 0);
558
- __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "color", void 0);
559
- __decorate([property({ type: String })], MonoBreadcrumbCoreClass.prototype, "separator", void 0);
560
- __decorate([property({
561
- reflect: true,
562
- converter: booleanStringConverter
563
- })], MonoBreadcrumbCoreClass.prototype, "truncate", void 0);
564
- __decorate([property({
565
- reflect: true,
566
- converter: booleanStringConverter
567
- })], MonoBreadcrumbCoreClass.prototype, "disabled", void 0);
568
- __decorate([property({ attribute: "aria-label" })], MonoBreadcrumbCoreClass.prototype, "ariaLabel", void 0);
569
- __decorate([property({ attribute: false })], MonoBreadcrumbCoreClass.prototype, "cssClass", void 0);
570
- __decorate([property({ attribute: false })], MonoBreadcrumbCoreClass.prototype, "cssClassName", void 0);
571
- __decorate([state()], MonoBreadcrumbCoreClass.prototype, "_slotIcons", void 0);
572
- return MonoBreadcrumbCoreClass;
573
- };
574
-
575
- //#endregion
576
9
  //#region src/components/breadcrumb/mono-breadcrumb.ts
577
10
  let MonoBreadcrumb = class MonoBreadcrumb extends MonoBreadcrumbCore(LitElement) {
578
11
  constructor(..._args) {
@@ -678,180 +111,6 @@ __decorate([state()], MonoBreadcrumb.prototype, "_slotsCaptured", void 0);
678
111
  __decorate([state()], MonoBreadcrumb.prototype, "_hasBodySlot", void 0);
679
112
  MonoBreadcrumb = __decorate([customElement("mono-breadcrumb")], MonoBreadcrumb);
680
113
 
681
- //#endregion
682
- //#region src/components/breadcrumb/breadcrumb-list-core.ts
683
- let autoBreadcrumbListId = 0;
684
- /**
685
- * `MonoBreadcrumbListCore` — render-mode-agnostic logic for the STANDALONE
686
- * `mono-breadcrumb-list`: reactive props (incl. the SSR `items` string→array
687
- * coercion), item resolution (`items` array / single `item` / direct single-row
688
- * props), the self-contained `<nav><ol>` render, and the `_useIconSlots()` /
689
- * `_itemsForRender()` hooks.
690
- *
691
- * The light build (`mono-breadcrumb-list.ts`) extends this and layers the
692
- * light-only CHILD composition (registering with a parent `<mono-breadcrumb>`
693
- * via `closest()` and rendering bare items). The shadow build
694
- * (`mono-breadcrumb-list.shadow.ts`) extends this for `@lit-labs/ssr`, rendering
695
- * standalone in one shadow root and overriding `_useIconSlots()`. Child mode is
696
- * a light-only feature (cross-element `closest()` can't work under SSR).
697
- *
698
- * SSR-safe: no `document`/`window` access.
699
- */
700
- const MonoBreadcrumbListCore = (superClass) => {
701
- class MonoBreadcrumbListCoreClass extends superClass {
702
- constructor(..._args) {
703
- super(..._args);
704
- this.items = [];
705
- this.title = "";
706
- this.href = "";
707
- this.icon = "";
708
- this.current = false;
709
- this.disabled = false;
710
- this.variant = "default";
711
- this.size = "md";
712
- this.color = "primary";
713
- this.separator = "›";
714
- this.truncate = false;
715
- this._autoId = `mono-breadcrumb-list-item-${++autoBreadcrumbListId}`;
716
- }
717
- willUpdate(changed) {
718
- if (typeof this.items === "string") this.items = coerceItems(this.items);
719
- super.willUpdate?.(changed);
720
- }
721
- getBreadcrumbItems() {
722
- return this._getEffectiveItems();
723
- }
724
- _hasDirectItemProps() {
725
- return !!(this.id || this.title || this.href || this.icon || this.badge !== void 0 || this.current || this.disabled);
726
- }
727
- _normalizeItem(item) {
728
- const title = item.title ?? "";
729
- const fallbackId = this.id || item.id || item.href || title.toLowerCase().trim().replace(/\s+/g, "-") || this._autoId;
730
- const normalized = { id: String(item.id ?? fallbackId) };
731
- if (item.title !== void 0) normalized.title = item.title;
732
- if (item.icon !== void 0) normalized.icon = item.icon;
733
- if (item.badge !== void 0) normalized.badge = item.badge;
734
- if (item.badgeColor !== void 0) normalized.badgeColor = item.badgeColor;
735
- if (item.href !== void 0) normalized.href = item.href;
736
- if (item.current !== void 0) normalized.current = item.current;
737
- if (item.disabled !== void 0) normalized.disabled = item.disabled;
738
- return normalized;
739
- }
740
- _buildDirectItem() {
741
- return this._normalizeItem({
742
- id: this.id || void 0,
743
- title: this.title || void 0,
744
- href: this.href || void 0,
745
- icon: this.icon || void 0,
746
- badge: this.badge,
747
- badgeColor: this.badgeColor,
748
- current: this.current,
749
- disabled: this.disabled
750
- });
751
- }
752
- _getEffectiveItems() {
753
- if (this.item) return [this._normalizeItem(this.item)];
754
- if (this._hasDirectItemProps()) return [this._buildDirectItem()];
755
- if (Array.isArray(this.items) && this.items.length) return this.items;
756
- return [];
757
- }
758
- /**
759
- * The items to render for THIS render pass. Defaults to the effective items.
760
- * The shadow build overrides this to cap the hydration render at the
761
- * server-rendered count.
762
- */
763
- _itemsForRender() {
764
- return this._getEffectiveItems();
765
- }
766
- /**
767
- * Whether per-item icons render through a native `<slot>` (shadow build) vs
768
- * the light-DOM inline `i-…` span (light build).
769
- */
770
- _useIconSlots() {
771
- return false;
772
- }
773
- _standaloneContext() {
774
- return {
775
- cssClass: {},
776
- separator: this.separator,
777
- hasSeparatorSlot: false,
778
- disabled: this.disabled,
779
- iconSlot: this._useIconSlots(),
780
- isCurrent: (id) => {
781
- const items = this._getEffectiveItems();
782
- for (const it of items) if (it.current && it.id === id) return true;
783
- if (items.length && items.every((it) => !it.current)) return items[items.length - 1].id === id;
784
- return false;
785
- },
786
- getSlotIconNodes: () => void 0,
787
- onItemClick: () => {}
788
- };
789
- }
790
- /** Light build overrides this to return a parent-aware context. */
791
- _buildContext() {
792
- return this._standaloneContext();
793
- }
794
- _standaloneRootClasses() {
795
- return generateBreadcrumbRootClasses({
796
- variant: this.variant,
797
- size: this.size,
798
- color: this.color,
799
- truncate: this.truncate,
800
- disabled: this.disabled
801
- });
802
- }
803
- render() {
804
- const ctx = this._buildContext();
805
- const listClass = ctx.cssClass?.list ? `mono-breadcrumb-list ${ctx.cssClass.list}` : "mono-breadcrumb-list";
806
- const attrs = breadcrumbRootAttrs(this);
807
- return html`
808
- <nav
809
- class=${this._standaloneRootClasses()}
810
- aria-label="Breadcrumb"
811
- mono-breadcrumb
812
- mono-size=${attrs.size ?? nothing}
813
- mono-color=${attrs.color ?? nothing}
814
- mono-variant=${attrs.variant ?? nothing}
815
- ?mono-truncate=${this.truncate}
816
- ?mono-disabled=${this.disabled}
817
- >
818
- <ol class=${listClass} mono-list>
819
- ${renderBreadcrumbList(this._itemsForRender(), ctx)}
820
- </ol>
821
- </nav>
822
- `;
823
- }
824
- }
825
- __decorate([property({
826
- attribute: "items",
827
- converter: {
828
- fromAttribute: (value) => coerceItems(value),
829
- toAttribute: () => null
830
- },
831
- hasChanged: arrayHasChanged
832
- })], MonoBreadcrumbListCoreClass.prototype, "items", void 0);
833
- __decorate([property({ attribute: false })], MonoBreadcrumbListCoreClass.prototype, "item", void 0);
834
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "title", void 0);
835
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "href", void 0);
836
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "icon", void 0);
837
- __decorate([property()], MonoBreadcrumbListCoreClass.prototype, "badge", void 0);
838
- __decorate([property({ attribute: "badge-color" })], MonoBreadcrumbListCoreClass.prototype, "badgeColor", void 0);
839
- __decorate([property({
840
- type: Boolean,
841
- reflect: true
842
- })], MonoBreadcrumbListCoreClass.prototype, "current", void 0);
843
- __decorate([property({
844
- type: Boolean,
845
- reflect: true
846
- })], MonoBreadcrumbListCoreClass.prototype, "disabled", void 0);
847
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "variant", void 0);
848
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "size", void 0);
849
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "color", void 0);
850
- __decorate([property({ type: String })], MonoBreadcrumbListCoreClass.prototype, "separator", void 0);
851
- __decorate([property({ type: Boolean })], MonoBreadcrumbListCoreClass.prototype, "truncate", void 0);
852
- return MonoBreadcrumbListCoreClass;
853
- };
854
-
855
114
  //#endregion
856
115
  //#region src/components/breadcrumb/mono-breadcrumb-list.ts
857
116
  let MonoBreadcrumbList = class MonoBreadcrumbList extends MonoBreadcrumbListCore(LitElement) {