@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,583 @@
1
+ import { a as setExternalScrollLock } from "./popup-stack-C64WCuXq.js";
2
+ import { a as defineHybridPropAliases, o as numberStringConverter, r as booleanStringConverter, t as __decorate } from "./decorate-DbYFpi8R.js";
3
+ import { t as dispatchMonoEvent } from "./mono-event-CAZf0F_k.js";
4
+ import { n as cssPart, r as defineCssClassAliases, t as applyCssClass } from "./css-class-B6Tc_MAx.js";
5
+ import { a as validateColorProp, i as isThemeColorToken, n as colorClassToken, r as customColorStyle, t as CUSTOM_COLOR_CLASS } from "./color-CEYYtRX-.js";
6
+ import { n as releaseLayoutVar, t as claimLayoutVar } from "./layout-var-BSBKY49k.js";
7
+ import { html, isServer, nothing } from "lit";
8
+ import { property, state } from "lit/decorators.js";
9
+
10
+ //#region src/components/sidebar/sidebar-utils.ts
11
+ const SIDEBAR_AUTO_BREAKPOINT = 768;
12
+ /**
13
+ * `typeof window === 'undefined'` alone is NOT a safe server guard: a DOM shim
14
+ * can define `window` without `matchMedia` (the @lit-labs/ssr v3 shim happens
15
+ * to leave `window` undefined, but that is an implementation detail). Check
16
+ * lit's `isServer` first, then feature-detect `matchMedia`.
17
+ */
18
+ function isAutoTemporary() {
19
+ if (isServer || typeof window === "undefined") return false;
20
+ if (typeof window.matchMedia !== "function") return false;
21
+ return window.matchMedia(`(max-width: 767px)`).matches;
22
+ }
23
+ /**
24
+ * Resolves the effective mode for `auto`. Other modes pass through.
25
+ */
26
+ function resolveMode(mode) {
27
+ if (mode !== "auto") return mode;
28
+ return isAutoTemporary() ? "temporary" : "permanent";
29
+ }
30
+ function generateSidebarRootClasses(props) {
31
+ return [
32
+ "mono-sidebar",
33
+ `mode-${props.mode}`,
34
+ `effective-${props.resolvedMode}`,
35
+ `location-${props.location}`,
36
+ props.density,
37
+ colorClassToken(props.color),
38
+ props.variant,
39
+ props.open ? "open" : "closed",
40
+ props.expandOnHover ? "expand-on-hover" : "",
41
+ props.contained ? "contained" : "",
42
+ props.persistent ? "persistent" : "",
43
+ props.showScrim ? "" : "no-scrim",
44
+ props.cssClassName ?? "",
45
+ props.rootExtra ?? ""
46
+ ].filter(Boolean).join(" ");
47
+ }
48
+ function validateSidebarProps(props) {
49
+ const errors = [];
50
+ if (props.mode && ![
51
+ "permanent",
52
+ "temporary",
53
+ "rail",
54
+ "auto"
55
+ ].includes(props.mode)) errors.push(`Invalid mode: ${String(props.mode)}`);
56
+ if (props.location && !["left", "right"].includes(props.location)) errors.push(`Invalid location: ${String(props.location)}`);
57
+ if (props.density && ![
58
+ "compact",
59
+ "comfortable",
60
+ "default"
61
+ ].includes(props.density)) errors.push(`Invalid density: ${String(props.density)}`);
62
+ if (props.variant && ![
63
+ "flat",
64
+ "elevated",
65
+ "outlined"
66
+ ].includes(props.variant)) errors.push(`Invalid variant: ${String(props.variant)}`);
67
+ const colorError = validateColorProp(props.color);
68
+ if (colorError) errors.push(colorError);
69
+ if (typeof props.width === "number" && props.width < 0) errors.push(`width must be non-negative`);
70
+ if (typeof props.railWidth === "number" && props.railWidth < 0) errors.push(`railWidth must be non-negative`);
71
+ return errors;
72
+ }
73
+ /**
74
+ * The Basecoat styling attributes for the sidebar ROOT, mirroring the props one
75
+ * for one. A prop at its DEFAULT emits nothing — `:not([mono-density])` is
76
+ * comfortable, `:not([mono-color])` is surface, `:not([mono-variant])` is
77
+ * elevated and `:not([mono-location])` is left — so the rendered DOM is also
78
+ * the shortest hand-written markup that paints the same (see sidebar.css).
79
+ *
80
+ * `mono-effective` is always written: it carries the mode AFTER `auto`
81
+ * resolves, and it is what every layout rule keys on. A literal `color`
82
+ * collapses to `custom`, with the colour itself arriving inline.
83
+ */
84
+ function sidebarRootAttrs(props) {
85
+ return {
86
+ mode: props.mode === "auto" ? null : props.mode,
87
+ effective: props.resolvedMode,
88
+ location: props.location === "left" ? null : props.location,
89
+ density: props.density === "comfortable" ? null : props.density,
90
+ variant: props.variant === "elevated" ? null : props.variant,
91
+ color: !props.color || props.color === "surface" ? null : isThemeColorToken(props.color) ? props.color : CUSTOM_COLOR_CLASS
92
+ };
93
+ }
94
+
95
+ //#endregion
96
+ //#region src/components/sidebar/sidebar-core.ts
97
+ /**
98
+ * `MonoSidebarCore` — all render-mode-agnostic logic for `mono-sidebar`:
99
+ * reactive props, hybrid aliases, mode resolution (auto→permanent/temporary via
100
+ * the breakpoint), layout-var side effects, scroll-lock/escape side effects,
101
+ * open/close state + events, and the chrome `render()`.
102
+ *
103
+ * SSR-safe: every `document`/`window` path is guarded by `isServer` (lit) — NOT
104
+ * `typeof document/window`, which is unreliable under @lit-labs/ssr (it defines
105
+ * both on the server).
106
+ *
107
+ * Leaves to each build: `createRenderRoot()`, the slot strategy, `renderSlot()`
108
+ * (light: empty + capture into `[data-mono-slot]`; shadow: native `<slot>`), and
109
+ * `renderIcon()` (light: `.mono-icon` UnoCSS icon; shadow: inline SVG).
110
+ */
111
+ const MonoSidebarCore = (superClass) => {
112
+ class MonoSidebarCoreClass extends superClass {
113
+ constructor(...args) {
114
+ super(...args);
115
+ this.modelValue = false;
116
+ this.mode = "auto";
117
+ this.location = "left";
118
+ this.density = "comfortable";
119
+ this.color = "surface";
120
+ this.variant = "elevated";
121
+ this.width = 264;
122
+ this.railWidth = 64;
123
+ this.expandOnHover = false;
124
+ this.rail = null;
125
+ this.contained = false;
126
+ this.persistent = false;
127
+ this.closeOnEscape = true;
128
+ this.closeOnScrim = true;
129
+ this.lockScroll = true;
130
+ this.showScrim = true;
131
+ this.cssClass = {};
132
+ this.cssClassName = "";
133
+ this._resolvedMode = "permanent";
134
+ this._escapeListener = null;
135
+ this._autoMql = null;
136
+ this._autoMqlListener = null;
137
+ this._railHovered = false;
138
+ this._railPointerEnter = null;
139
+ this._railPointerLeave = null;
140
+ this._writtenVar = null;
141
+ defineHybridPropAliases(this, [
142
+ "modelValue",
143
+ "railWidth",
144
+ "expandOnHover",
145
+ "closeOnEscape",
146
+ "closeOnScrim",
147
+ "lockScroll",
148
+ "showScrim"
149
+ ]);
150
+ defineCssClassAliases(this, (value) => this._setCssClass(value));
151
+ }
152
+ static get observedAttributes() {
153
+ return [
154
+ ...super.observedAttributes ?? [],
155
+ "modelvalue",
156
+ "css-class",
157
+ "cssclass"
158
+ ];
159
+ }
160
+ attributeChangedCallback(name, oldValue, newValue) {
161
+ super.attributeChangedCallback(name, oldValue, newValue);
162
+ if (oldValue === newValue) return;
163
+ if (name === "modelvalue") this.modelValue = booleanStringConverter.fromAttribute(newValue);
164
+ else if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
165
+ }
166
+ connectedCallback() {
167
+ super.connectedCallback();
168
+ this._recomputeResolvedMode();
169
+ this._recomputeRailCollapsedAttr();
170
+ if (isServer) return;
171
+ this._setupAutoModeListener();
172
+ this._setupRailHoverListeners();
173
+ this._writeLayoutVar();
174
+ if (this._resolvedMode === "temporary" && this.modelValue) this._applyOpenSideEffects();
175
+ }
176
+ disconnectedCallback() {
177
+ if (!isServer) {
178
+ this._releaseSideEffects();
179
+ this._teardownAutoModeListener();
180
+ this._teardownRailHoverListeners();
181
+ this._clearLayoutVar();
182
+ }
183
+ super.disconnectedCallback();
184
+ }
185
+ willUpdate(changed) {
186
+ if (changed.has("rail") && this.rail !== null && this.modelValue !== this.rail) this.modelValue = this.rail;
187
+ if (changed.has("mode")) this._recomputeResolvedMode();
188
+ if (changed.has("mode") || changed.has("_resolvedMode") || changed.has("modelValue") || changed.has("rail") || changed.has("expandOnHover")) this._recomputeRailCollapsedAttr();
189
+ if (isServer) return;
190
+ if (changed.has("modelValue") || changed.has("mode")) {
191
+ if (this._resolvedMode === "temporary" && this.modelValue) this._applyOpenSideEffects();
192
+ else this._releaseSideEffects();
193
+ }
194
+ if (changed.has("mode") || changed.has("width") || changed.has("railWidth") || changed.has("location") || changed.has("modelValue") || changed.has("contained")) this._writeLayoutVar();
195
+ }
196
+ /**
197
+ * `connectedCallback` computes `_resolvedMode` / `data-rail-collapsed` /
198
+ * the layout var against SERVER assumptions (no `matchMedia`, no
199
+ * `localStorage` → always "desktop, rail, collapsed"). Under SSR the host's
200
+ * viewport-derived props only settle after Vue mounts, and nothing else
201
+ * re-runs these if no prop happens to change afterwards. Re-run them once
202
+ * after the first real client render so the viewport wins.
203
+ */
204
+ firstUpdated(changed) {
205
+ super.firstUpdated?.(changed);
206
+ if (isServer) return;
207
+ this._recomputeResolvedMode();
208
+ this._recomputeRailCollapsedAttr();
209
+ this._writeLayoutVar();
210
+ this._syncRootFromState();
211
+ }
212
+ updated(changed) {
213
+ super.updated?.(changed);
214
+ if (isServer) return;
215
+ this._syncRootFromState();
216
+ }
217
+ /**
218
+ * Re-assert the root element's class / style / aria-hidden from live state.
219
+ *
220
+ * `@lit-labs/ssr-client`'s hydration records the values it is handed as
221
+ * ALREADY COMMITTED without writing them to the DOM — it assumes the server
222
+ * markup already matches. Under nuxt-ssr-lit that assumption is routinely
223
+ * false: the server has no viewport (no `matchMedia`, no `localStorage`) so
224
+ * it always emits desktop assumptions, and Vue has since set the real
225
+ * mobile props. Lit then sees "no change" and never commits, freezing the
226
+ * rail visible on a phone while `mode` already reads `temporary`.
227
+ *
228
+ * These three attributes carry every viewport-derived decision, so writing
229
+ * them imperatively after each update keeps the DOM honest. Idempotent —
230
+ * a no-op whenever lit's own bindings are working.
231
+ */
232
+ _syncRootFromState() {
233
+ const root = this.renderRoot?.querySelector?.("[mono-sidebar], .mono-sidebar");
234
+ if (!root) return;
235
+ const classes = this._rootClasses;
236
+ if (root.getAttribute("class") !== classes) root.setAttribute("class", classes);
237
+ const style = this._inlineRootStyle;
238
+ if (root.getAttribute("style") !== style) root.setAttribute("style", style);
239
+ const aria = this._rootAriaHidden;
240
+ if (root.getAttribute("aria-hidden") !== aria) root.setAttribute("aria-hidden", aria);
241
+ const attrs = sidebarRootAttrs({
242
+ mode: this.mode,
243
+ resolvedMode: this._resolvedMode,
244
+ location: this.location,
245
+ density: this.density,
246
+ color: this.color,
247
+ variant: this.variant
248
+ });
249
+ const wanted = {
250
+ "mono-effective": attrs.effective,
251
+ "mono-mode": attrs.mode ?? null,
252
+ "mono-location": attrs.location ?? null,
253
+ "mono-density": attrs.density ?? null,
254
+ "mono-color": attrs.color ?? null,
255
+ "mono-variant": attrs.variant ?? null,
256
+ "mono-open": this.modelValue ? "" : null,
257
+ "mono-expand-on-hover": this.expandOnHover ? "" : null,
258
+ "mono-contained": this.contained ? "" : null,
259
+ "mono-persistent": this.persistent ? "" : null,
260
+ "mono-no-scrim": this.showScrim ? null : ""
261
+ };
262
+ for (const [name, value] of Object.entries(wanted)) if (value === null) {
263
+ if (root.hasAttribute(name)) root.removeAttribute(name);
264
+ } else if (root.getAttribute(name) !== value) root.setAttribute(name, value);
265
+ }
266
+ _setupAutoModeListener() {
267
+ if (typeof window === "undefined" || !window.matchMedia) return;
268
+ this._autoMql = window.matchMedia(`(max-width: ${768 - 1}px)`);
269
+ this._autoMqlListener = () => {
270
+ if (this.mode === "auto") {
271
+ this._recomputeResolvedMode();
272
+ this._writeLayoutVar();
273
+ this.requestUpdate();
274
+ }
275
+ };
276
+ this._autoMql.addEventListener("change", this._autoMqlListener);
277
+ }
278
+ _teardownAutoModeListener() {
279
+ if (this._autoMql && this._autoMqlListener) this._autoMql.removeEventListener("change", this._autoMqlListener);
280
+ this._autoMql = null;
281
+ this._autoMqlListener = null;
282
+ }
283
+ _recomputeResolvedMode() {
284
+ this._resolvedMode = resolveMode(this.mode);
285
+ }
286
+ /**
287
+ * Publish the rail-collapsed state as a host attribute (`data-rail-collapsed`).
288
+ * Cross-shadow CSS (descendant selectors + inherited custom properties on the
289
+ * shadow `.mono-sidebar-body`) cannot reach a slotted *light* `<mono-menu>`, so
290
+ * the menu mirrors this attribute and collapses itself. Collapsed = rail mode,
291
+ * not toggled-open, and not hover-expanded. Pure attribute toggle → SSR-safe.
292
+ */
293
+ _recomputeRailCollapsedAttr() {
294
+ if (this._resolvedMode === "rail" && !this.modelValue && !(this.expandOnHover && this._railHovered)) this.setAttribute("data-rail-collapsed", "");
295
+ else this.removeAttribute("data-rail-collapsed");
296
+ }
297
+ _setupRailHoverListeners() {
298
+ if (this._railPointerEnter) return;
299
+ this._railPointerEnter = () => {
300
+ if (this.expandOnHover) this._railHovered = true;
301
+ this._recomputeRailCollapsedAttr();
302
+ };
303
+ this._railPointerLeave = () => {
304
+ this._railHovered = false;
305
+ this._recomputeRailCollapsedAttr();
306
+ };
307
+ this.addEventListener("pointerenter", this._railPointerEnter);
308
+ this.addEventListener("pointerleave", this._railPointerLeave);
309
+ }
310
+ _teardownRailHoverListeners() {
311
+ if (this._railPointerEnter) this.removeEventListener("pointerenter", this._railPointerEnter);
312
+ if (this._railPointerLeave) this.removeEventListener("pointerleave", this._railPointerLeave);
313
+ this._railPointerEnter = null;
314
+ this._railPointerLeave = null;
315
+ this._railHovered = false;
316
+ }
317
+ _writeLayoutVar() {
318
+ if (isServer) return;
319
+ if (this.contained) {
320
+ if (this._writtenVar) releaseLayoutVar(this._writtenVar, this);
321
+ this._writtenVar = null;
322
+ return;
323
+ }
324
+ const myVar = this.location === "right" ? "--mono-sidebar-right-width" : "--mono-sidebar-left-width";
325
+ if (this._writtenVar && this._writtenVar !== myVar) releaseLayoutVar(this._writtenVar, this);
326
+ let pushPx = 0;
327
+ if (this._resolvedMode === "permanent") pushPx = this.width;
328
+ else if (this._resolvedMode === "rail") pushPx = this.modelValue ? this.width : this.railWidth;
329
+ else pushPx = 0;
330
+ this._writtenVar = myVar;
331
+ claimLayoutVar(myVar, this, `${pushPx}px`);
332
+ }
333
+ _clearLayoutVar() {
334
+ if (isServer) return;
335
+ if (this._writtenVar) releaseLayoutVar(this._writtenVar, this);
336
+ this._writtenVar = null;
337
+ }
338
+ _setCssClass(value) {
339
+ applyCssClass(this, value);
340
+ }
341
+ _cls(base, key) {
342
+ return cssPart(this.cssClass, base, key);
343
+ }
344
+ get _rootClasses() {
345
+ return generateSidebarRootClasses({
346
+ mode: this.mode,
347
+ resolvedMode: this._resolvedMode,
348
+ location: this.location,
349
+ density: this.density,
350
+ color: this.color,
351
+ variant: this.variant,
352
+ open: this.modelValue,
353
+ expandOnHover: this.expandOnHover,
354
+ contained: this.contained,
355
+ persistent: this.persistent,
356
+ showScrim: this.showScrim,
357
+ cssClassName: this.cssClassName,
358
+ rootExtra: this.cssClass?.root
359
+ });
360
+ }
361
+ _applyOpenSideEffects() {
362
+ if (isServer || this.contained) return;
363
+ setExternalScrollLock(this, this.lockScroll);
364
+ if (this.closeOnEscape && !this._escapeListener) {
365
+ const listener = (event) => {
366
+ if (event.key === "Escape" && this.modelValue && !this.persistent && this._resolvedMode === "temporary") this.hide("escape", event);
367
+ };
368
+ this._escapeListener = listener;
369
+ document.addEventListener("keydown", listener);
370
+ }
371
+ }
372
+ _releaseSideEffects() {
373
+ if (isServer) return;
374
+ setExternalScrollLock(this, false);
375
+ if (this._escapeListener) {
376
+ document.removeEventListener("keydown", this._escapeListener);
377
+ this._escapeListener = null;
378
+ }
379
+ }
380
+ _emitChange(detail) {
381
+ dispatchMonoEvent(this, "change", detail);
382
+ if (detail.value && !detail.oldValue) dispatchMonoEvent(this, "open", detail);
383
+ else if (!detail.value && detail.oldValue) dispatchMonoEvent(this, "close", detail);
384
+ }
385
+ open(source = "manual", sourceEvent) {
386
+ if (this.modelValue) return;
387
+ const oldValue = this.modelValue;
388
+ this.modelValue = true;
389
+ this._emitChange({
390
+ modelValue: true,
391
+ currentValue: true,
392
+ oldValue,
393
+ value: true,
394
+ source,
395
+ sourceEvent
396
+ });
397
+ }
398
+ hide(source = "manual", sourceEvent) {
399
+ if (!this.modelValue) return;
400
+ const oldValue = this.modelValue;
401
+ this.modelValue = false;
402
+ this._emitChange({
403
+ modelValue: false,
404
+ currentValue: false,
405
+ oldValue,
406
+ value: false,
407
+ source,
408
+ sourceEvent
409
+ });
410
+ }
411
+ close(source = "manual", sourceEvent) {
412
+ this.hide(source, sourceEvent);
413
+ }
414
+ toggle(source = "manual", sourceEvent) {
415
+ if (this.modelValue) this.hide(source, sourceEvent);
416
+ else this.open(source, sourceEvent);
417
+ }
418
+ expandRail() {
419
+ if (this._resolvedMode !== "rail") return;
420
+ this.open("rail-toggle");
421
+ }
422
+ collapseRail() {
423
+ if (this._resolvedMode !== "rail") return;
424
+ this.hide("rail-toggle");
425
+ }
426
+ _handleScrimClick(event) {
427
+ if (!this.closeOnScrim || this.persistent) return;
428
+ if (this._resolvedMode !== "temporary") return;
429
+ this.hide("scrim", event);
430
+ }
431
+ _handleRailToggle(event) {
432
+ if (this._resolvedMode !== "rail") return;
433
+ this.toggle("rail-toggle", event);
434
+ }
435
+ /** Per-region slot content — overridden per build. */
436
+ renderSlot(_name) {
437
+ return html``;
438
+ }
439
+ /** Internal icon — light: UnoCSS `.mono-icon`; shadow: inline SVG. */
440
+ renderIcon(_name) {
441
+ return html``;
442
+ }
443
+ /**
444
+ * The root's inline style. This getter is the ONLY safe place to put an inline
445
+ * custom property on the root: `_syncRootFromState()` re-asserts the whole `style`
446
+ * attribute after every update, so anything written out-of-band is wiped.
447
+ *
448
+ * `customColorStyle` returns '' unless `color` is a literal rather than a palette
449
+ * slot; on the root it outranks the class-based `.mono-sidebar.<token>` presets,
450
+ * which is exactly the precedence we want (flavor < prop).
451
+ */
452
+ get _inlineRootStyle() {
453
+ return `--mono-sidebar-width: ${this.width}px; --mono-sidebar-rail-width: ${this.railWidth}px;` + customColorStyle(isThemeColorToken(this.color) || this.color === "surface" ? "" : this.color, "sidebar");
454
+ }
455
+ get _rootAriaHidden() {
456
+ return this._resolvedMode === "temporary" && !this.modelValue ? "true" : "false";
457
+ }
458
+ render() {
459
+ const inlineStyle = this._inlineRootStyle;
460
+ const showDefaultRailToggle = this._resolvedMode === "rail" && this.rail === null;
461
+ const attrs = sidebarRootAttrs({
462
+ mode: this.mode,
463
+ resolvedMode: this._resolvedMode,
464
+ location: this.location,
465
+ density: this.density,
466
+ color: this.color,
467
+ variant: this.variant
468
+ });
469
+ return html`
470
+ <div
471
+ class=${this._rootClasses}
472
+ style=${inlineStyle}
473
+ role="navigation"
474
+ aria-hidden=${this._resolvedMode === "temporary" && !this.modelValue ? "true" : "false"}
475
+ mono-sidebar
476
+ mono-effective=${attrs.effective}
477
+ mono-mode=${attrs.mode ?? nothing}
478
+ mono-location=${attrs.location ?? nothing}
479
+ mono-density=${attrs.density ?? nothing}
480
+ mono-color=${attrs.color ?? nothing}
481
+ mono-variant=${attrs.variant ?? nothing}
482
+ ?mono-open=${this.modelValue}
483
+ ?mono-expand-on-hover=${this.expandOnHover}
484
+ ?mono-contained=${this.contained}
485
+ ?mono-persistent=${this.persistent}
486
+ ?mono-no-scrim=${!this.showScrim}
487
+ >
488
+ <div class=${this._cls("mono-sidebar-scrim", "scrim")} mono-scrim @click=${this._handleScrimClick}></div>
489
+
490
+ <aside class=${this._cls("mono-sidebar-panel", "panel")} mono-panel>
491
+ <div class="mono-sidebar-topbar" mono-topbar>
492
+ <div class=${this._cls("mono-sidebar-header", "header")} mono-header data-mono-slot="header">
493
+ ${this.renderSlot("header")}
494
+ </div>
495
+ ${showDefaultRailToggle ? html`
496
+ <div class=${this._cls("mono-sidebar-rail", "rail")} mono-rail>
497
+ <button
498
+ type="button"
499
+ class=${this._cls("mono-sidebar-rail-toggle", "railToggle")}
500
+ mono-rail-toggle
501
+ aria-label=${this.modelValue ? "Collapse sidebar" : "Expand sidebar"}
502
+ @click=${this._handleRailToggle}
503
+ >
504
+ ${this.renderIcon("chevron")}
505
+ </button>
506
+ </div>
507
+ ` : nothing}
508
+ </div>
509
+ <div class=${this._cls("mono-sidebar-body", "body")} mono-body data-mono-slot="body">
510
+ ${this.renderSlot("body")}
511
+ </div>
512
+ <div class=${this._cls("mono-sidebar-footer", "footer")} mono-footer data-mono-slot="footer">
513
+ ${this.renderSlot("footer")}
514
+ </div>
515
+ </aside>
516
+ </div>
517
+ `;
518
+ }
519
+ }
520
+ __decorate([property({
521
+ attribute: "model-value",
522
+ reflect: true,
523
+ converter: booleanStringConverter
524
+ })], MonoSidebarCoreClass.prototype, "modelValue", void 0);
525
+ __decorate([property({ type: String })], MonoSidebarCoreClass.prototype, "mode", void 0);
526
+ __decorate([property({ type: String })], MonoSidebarCoreClass.prototype, "location", void 0);
527
+ __decorate([property({ type: String })], MonoSidebarCoreClass.prototype, "density", void 0);
528
+ __decorate([property({ type: String })], MonoSidebarCoreClass.prototype, "color", void 0);
529
+ __decorate([property({ type: String })], MonoSidebarCoreClass.prototype, "variant", void 0);
530
+ __decorate([property({ converter: numberStringConverter })], MonoSidebarCoreClass.prototype, "width", void 0);
531
+ __decorate([property({
532
+ attribute: "rail-width",
533
+ converter: numberStringConverter
534
+ })], MonoSidebarCoreClass.prototype, "railWidth", void 0);
535
+ __decorate([property({
536
+ attribute: "expand-on-hover",
537
+ converter: booleanStringConverter
538
+ })], MonoSidebarCoreClass.prototype, "expandOnHover", void 0);
539
+ __decorate([property({
540
+ attribute: "rail",
541
+ converter: {
542
+ fromAttribute(value) {
543
+ if (value === null) return null;
544
+ const normalized = value.toLowerCase().trim();
545
+ return normalized === "" || normalized === "true";
546
+ },
547
+ toAttribute() {
548
+ return null;
549
+ }
550
+ }
551
+ })], MonoSidebarCoreClass.prototype, "rail", void 0);
552
+ __decorate([property({
553
+ reflect: true,
554
+ converter: booleanStringConverter
555
+ })], MonoSidebarCoreClass.prototype, "contained", void 0);
556
+ __decorate([property({
557
+ reflect: true,
558
+ converter: booleanStringConverter
559
+ })], MonoSidebarCoreClass.prototype, "persistent", void 0);
560
+ __decorate([property({
561
+ attribute: "close-on-escape",
562
+ converter: booleanStringConverter
563
+ })], MonoSidebarCoreClass.prototype, "closeOnEscape", void 0);
564
+ __decorate([property({
565
+ attribute: "close-on-scrim",
566
+ converter: booleanStringConverter
567
+ })], MonoSidebarCoreClass.prototype, "closeOnScrim", void 0);
568
+ __decorate([property({
569
+ attribute: "lock-scroll",
570
+ converter: booleanStringConverter
571
+ })], MonoSidebarCoreClass.prototype, "lockScroll", void 0);
572
+ __decorate([property({
573
+ attribute: "show-scrim",
574
+ converter: booleanStringConverter
575
+ })], MonoSidebarCoreClass.prototype, "showScrim", void 0);
576
+ __decorate([property({ attribute: false })], MonoSidebarCoreClass.prototype, "cssClass", void 0);
577
+ __decorate([property({ attribute: false })], MonoSidebarCoreClass.prototype, "cssClassName", void 0);
578
+ __decorate([state()], MonoSidebarCoreClass.prototype, "_resolvedMode", void 0);
579
+ return MonoSidebarCoreClass;
580
+ };
581
+
582
+ //#endregion
583
+ export { resolveMode as a, isAutoTemporary as i, SIDEBAR_AUTO_BREAKPOINT as n, validateSidebarProps as o, generateSidebarRootClasses as r, MonoSidebarCore as t };