@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
package/dist/ui/drawer.js CHANGED
@@ -1,764 +1,10 @@
1
1
  import { g as monoHostChildNodes } from "../mono-ui-kvLVIf1V.js";
2
- import { i as registerPopupLayer, o as unregisterPopupLayer, r as refreshPopupStack, t as getOpenPopupLayers } from "../popup-stack-C64WCuXq.js";
3
2
  import { t as customElement } from "../mono-element-CKcT0rwv.js";
4
- import { a as defineHybridPropAliases, r as booleanStringConverter, s as optionalNumberConverter, t as __decorate } from "../decorate-DbYFpi8R.js";
5
- import { t as dispatchMonoEvent } from "../mono-event-BPku9HpS.js";
3
+ import { t as __decorate } from "../decorate-DbYFpi8R.js";
6
4
  import { a as parkDetachedNodes, i as guardHostTextContent, s as placeSlotNode } from "../light-slots-B5Ck0t_E.js";
7
- import { i as pathOwnedBy } from "../popup-portal-CINuVjNY.js";
8
- import { n as isBelowBreakpoint, r as resolveAutoFullscreen, t as autoFullscreenConverter } from "../breakpoints-DllybT82.js";
9
- import { LitElement, html, isServer, nothing } from "lit";
10
- import { property, query, state } from "lit/decorators.js";
5
+ import { t as MonoDrawerCore } from "../drawer-core-DbFWvNln.js";
6
+ import { LitElement } from "lit";
11
7
 
12
- //#region src/components/drawer/drawer-core.ts
13
- /** Per-instance id seed for the light build's heading ids (they live in the
14
- * document, so they must be unique). The shadow build scopes ids to its own
15
- * root and uses a constant — see `_headingIdBase`. */
16
- let drawerIdSeq = 0;
17
- /**
18
- * Named dimension presets for `width` / `height` — `width="lg"`, `height="sm"`.
19
- *
20
- * The same six tokens the `size` prop uses, on a different axis: `size` is the
21
- * CONTENT scale (padding, type, close icon) and never touches the panel's box, while
22
- * these name a MEASURE. `size="sm" width="xl"` is a compact, wide drawer.
23
- *
24
- * These are the dimensions the drawer has always shipped — `md` reproduces the
25
- * stylesheet defaults (`420px` / `50vh`) exactly. Only the axis `position` leaves
26
- * free is ever read, so a token on the pinned axis is simply inert.
27
- */
28
- const WIDTH_PRESETS = {
29
- xs: "220px",
30
- sm: "280px",
31
- md: "420px",
32
- lg: "560px",
33
- xl: "720px",
34
- xxl: "900px"
35
- };
36
- const HEIGHT_PRESETS = {
37
- xs: "22vh",
38
- sm: "30vh",
39
- md: "50vh",
40
- lg: "70vh",
41
- xl: "85vh",
42
- xxl: "95vh"
43
- };
44
- /**
45
- * Normalize a dimension prop to a CSS length.
46
- * - a preset token (`"xs"`…`"xxl"`) → the ladder for `axis`
47
- * - `number` (or a numeric string) → `${n}px`
48
- * - any other non-empty string → passed through (`"80%"`, `"100vw"`, `"32rem"`)
49
- * - `null` / `undefined` / `''` → `undefined` ("not set", fall back to the var)
50
- *
51
- * Mirrors `toCssSize` in modal-core.ts, ladders included.
52
- */
53
- function toCssSize(value, axis) {
54
- if (value === null || value === void 0) return void 0;
55
- if (typeof value === "number") return Number.isFinite(value) ? `${value}px` : void 0;
56
- const trimmed = String(value).trim();
57
- if (trimmed === "") return void 0;
58
- const preset = (axis === "width" ? WIDTH_PRESETS : HEIGHT_PRESETS)[trimmed.toLowerCase()];
59
- if (preset) return preset;
60
- if (/^-?\d+(\.\d+)?$/.test(trimmed)) return `${trimmed}px`;
61
- return trimmed;
62
- }
63
- /**
64
- * `MonoDrawerCore` — render-mode-agnostic logic for `mono-drawer`: props/hybrid
65
- * aliases, the open/close model (`show`/`hide`/`toggle` + `mno-*` events), the
66
- * `PopupLayer` surface (shared z-stack / scroll-lock / topmost-Escape via the
67
- * SSR-safe `popup-stack`), resizeable-edge logic, and the shared drawer markup
68
- * (`_renderDrawerBody`). SSR-safe: `popup-stack` no-ops server-side and the
69
- * `window`/resize access is `isServer`-guarded. Mirrors `modal-core.ts`.
70
- *
71
- * Each build supplies the render root + slot/icon strategy:
72
- * - light (`mono-drawer.ts`): a `<body>` portal that IS the `.mono-drawer` root,
73
- * `data-mono-slot` placeholders, UnoCSS `.i-mdi-close`.
74
- * - shadow (`mono-drawer.shadow.ts`): a real shadow root with an inner
75
- * `.mono-drawer` root, native `<slot>`s, inline-SVG ✕.
76
- */
77
- const MonoDrawerCore = (superClass) => {
78
- class MonoDrawerCoreClass extends superClass {
79
- static {
80
- this.monoPendingAuto = "never";
81
- }
82
- constructor(...args) {
83
- super(...args);
84
- this.position = "right";
85
- this.size = "md";
86
- this.color = "primary";
87
- this.title = "";
88
- this.subtitle = "";
89
- this.modelValue = false;
90
- this.dismissible = true;
91
- this.persistent = false;
92
- this.overlay = true;
93
- this.closeOnEscape = true;
94
- this.closeOnOverlay = true;
95
- this.lockScroll = true;
96
- this.resizeable = false;
97
- this.autoFullscreen = false;
98
- this.stackable = false;
99
- this.cssClass = {};
100
- this.cssClassName = "";
101
- this._slotsCaptured = false;
102
- this._hasHeaderSlotState = false;
103
- this._hasTitleSlotState = false;
104
- this._hasSubtitleSlotState = false;
105
- this._hasBodySlotState = false;
106
- this._hasFooterSlotState = false;
107
- this._hasDrawerAbove = false;
108
- this._resizing = false;
109
- this._drawerZ = 9990;
110
- this._resizeStartX = 0;
111
- this._resizeStartY = 0;
112
- this._resizeBaseW = 0;
113
- this._resizeBaseH = 0;
114
- this._rootEl = null;
115
- this.bindRoot = (el) => {
116
- this._rootEl = el ?? null;
117
- this._applyRootAttrs(this._rootEl);
118
- };
119
- this._outsideBound = false;
120
- this._outsideArm = null;
121
- this._openedAt = 0;
122
- this._onOutsideClick = (event) => {
123
- if (!this.modelValue || this.overlay) return;
124
- if (!this.closeOnOverlay || !this.dismissible || this.persistent) return;
125
- if (event.timeStamp <= this._openedAt) return;
126
- const layers = getOpenPopupLayers();
127
- if (layers[layers.length - 1] !== this) return;
128
- const root = this.renderRoot instanceof Element ? this.renderRoot : null;
129
- if (pathOwnedBy(event.composedPath(), root ? [this, root] : [this])) return;
130
- this.hide("overlay", event);
131
- };
132
- this._onResizeStart = (event) => {
133
- if (isServer || typeof window === "undefined") return;
134
- if (!this.resizeable || event.button !== 0) return;
135
- if (this._autoFullscreenActive) return;
136
- event.preventDefault();
137
- event.stopPropagation();
138
- const rect = this._panelEl?.getBoundingClientRect();
139
- this._resizeBaseW = rect?.width ?? 0;
140
- this._resizeBaseH = rect?.height ?? 0;
141
- this._resizeStartX = event.clientX;
142
- this._resizeStartY = event.clientY;
143
- this._resizing = true;
144
- window.addEventListener("pointermove", this._onResizeMove);
145
- window.addEventListener("pointerup", this._onResizeEnd, { once: true });
146
- window.addEventListener("pointercancel", this._onResizeEnd, { once: true });
147
- };
148
- this._onResizeMove = (event) => {
149
- if (typeof window === "undefined") return;
150
- const MIN = 200;
151
- if (this._isHorizontal) {
152
- const delta = this.position === "right" ? this._resizeStartX - event.clientX : event.clientX - this._resizeStartX;
153
- const next = Math.max(MIN, Math.min(this._resizeBaseW + delta, window.innerWidth));
154
- this._setDrawerSizeVar("--mono-drawer-width", `${next}px`);
155
- } else {
156
- const delta = this.position === "top" ? event.clientY - this._resizeStartY : this._resizeStartY - event.clientY;
157
- const next = Math.max(MIN, Math.min(this._resizeBaseH + delta, window.innerHeight));
158
- this._setDrawerSizeVar("--mono-drawer-height", `${next}px`);
159
- }
160
- };
161
- this._onResizeEnd = () => {
162
- if (typeof window !== "undefined") window.removeEventListener("pointermove", this._onResizeMove);
163
- this._resizing = false;
164
- };
165
- defineHybridPropAliases(this, [
166
- "modelValue",
167
- "cssClass",
168
- "closeOnEscape",
169
- "closeOnOverlay",
170
- "lockScroll",
171
- "autoFullscreen",
172
- "zIndex"
173
- ]);
174
- Object.defineProperty(this, "css-class", {
175
- get: () => this.cssClass,
176
- set: (value) => this._setCssClass(value),
177
- configurable: true,
178
- enumerable: false
179
- });
180
- Object.defineProperty(this, "cssclass", {
181
- get: () => this.cssClass,
182
- set: (value) => this._setCssClass(value),
183
- configurable: true,
184
- enumerable: false
185
- });
186
- }
187
- static get observedAttributes() {
188
- return [
189
- ...super.observedAttributes ?? [],
190
- "modelvalue",
191
- "css-class",
192
- "cssclass"
193
- ];
194
- }
195
- attributeChangedCallback(name, oldValue, newValue) {
196
- super.attributeChangedCallback(name, oldValue, newValue);
197
- if (oldValue === newValue) return;
198
- if (name === "modelvalue") {
199
- this.modelValue = booleanStringConverter.fromAttribute(newValue);
200
- return;
201
- }
202
- if (name === "css-class" || name === "cssclass") this._setCssClass(newValue);
203
- }
204
- /** Duck-type marker so the exclusive-close logic targets only OTHER drawers in
205
- * the shared stack (not modals/dropdowns) without an `instanceof` that the
206
- * light + shadow builds — distinct classes — would each fail. */
207
- get _isMonoDrawer() {
208
- return true;
209
- }
210
- connectedCallback() {
211
- super.connectedCallback();
212
- if (this.modelValue) this._applyOpenSideEffects();
213
- }
214
- disconnectedCallback() {
215
- this._releaseSideEffects();
216
- this._teardownResize();
217
- super.disconnectedCallback();
218
- }
219
- willUpdate(changed) {
220
- for (const key of [
221
- "modelValue",
222
- "dismissible",
223
- "persistent",
224
- "overlay",
225
- "closeOnEscape",
226
- "closeOnOverlay",
227
- "lockScroll",
228
- "resizeable",
229
- "stackable"
230
- ]) if (typeof this[key] === "string") this[key] = this._toBoolean(this[key]);
231
- if (changed.has("modelValue")) {
232
- if (this.modelValue) this._applyOpenSideEffects();
233
- else this._releaseSideEffects();
234
- }
235
- super.willUpdate?.(changed);
236
- }
237
- updated(changed) {
238
- super.updated?.(changed);
239
- if (isServer) return;
240
- if (changed.has("width") || changed.has("height")) this._applyDimensionProps();
241
- if (changed.has("zIndex") && this.modelValue) refreshPopupStack();
242
- if (changed.has("lockScroll") && this.modelValue) refreshPopupStack();
243
- if (changed.has("overlay") && this.modelValue) {
244
- this._syncOutsideClick();
245
- refreshPopupStack();
246
- }
247
- }
248
- /**
249
- * Publish `width`/`height` as the public sizing vars.
250
- *
251
- * Deliberately the same vars the resize handle writes (`_setDrawerSizeVar`) rather
252
- * than an inline panel style: that keeps one channel for dimensions, so dragging
253
- * still works and a later prop change simply re-asserts. Clearing a prop removes
254
- * the var so the stylesheet default comes back.
255
- */
256
- _applyDimensionProps() {
257
- const width = toCssSize(this.width, "width");
258
- const height = toCssSize(this.height, "height");
259
- if (width) this._setDrawerSizeVar("--mono-drawer-width", width);
260
- else this._removeDrawerSizeVar("--mono-drawer-width");
261
- if (height) this._setDrawerSizeVar("--mono-drawer-height", height);
262
- else this._removeDrawerSizeVar("--mono-drawer-height");
263
- }
264
- /** `auto-fullscreen-<bp>` for the CSS to key its media blocks on, else null. */
265
- get _autoFullscreenClass() {
266
- const bp = resolveAutoFullscreen(this.autoFullscreen);
267
- return bp ? `auto-fullscreen-${bp}` : null;
268
- }
269
- /**
270
- * Whether auto-fullscreen is in force RIGHT NOW. Only for pointer handlers that
271
- * CSS cannot reach — never for rendering, which would reintroduce the SSR
272
- * viewport-guess problem the `@media` approach exists to avoid.
273
- */
274
- get _autoFullscreenActive() {
275
- const bp = resolveAutoFullscreen(this.autoFullscreen);
276
- return !!bp && isBelowBreakpoint(bp);
277
- }
278
- /** The state-class list for the `.mono-drawer` root (light: on the portal;
279
- * shadow: on the inner root). */
280
- _computeDrawerClasses() {
281
- return [
282
- "mono-drawer",
283
- this.size,
284
- this.color,
285
- `position-${this.position}`,
286
- this.modelValue ? "open" : "closed",
287
- this.overlay ? null : "no-overlay",
288
- this.persistent ? "persistent" : null,
289
- this.dismissible ? null : "no-dismiss",
290
- this._hasDrawerAbove ? "has-drawer-above" : null,
291
- this.resizeable ? "resizeable" : null,
292
- this._autoFullscreenClass,
293
- this._resizing ? "resizing" : null,
294
- this.cssClassName || null,
295
- this.cssClass?.root || null
296
- ].filter((c) => Boolean(c));
297
- }
298
- /**
299
- * The prop mirrors and the states, for the same root the classes go on — the
300
- * `<body>` portal in the light build, the inner root in the shadow one. Each
301
- * is omitted at its default so `:not([mono-size])` means "md" and
302
- * `:not([mono-position])` means RIGHT for hand-written markup exactly as they
303
- * do for the element.
304
- */
305
- _computeRootAttrs() {
306
- return {
307
- "mono-size": this.size === "md" ? null : this.size,
308
- "mono-color": this.color === "primary" ? null : this.color,
309
- "mono-position": this.position === "right" ? null : this.position,
310
- "mono-open": this.modelValue ? "" : null,
311
- "mono-no-overlay": this.overlay ? null : "",
312
- "mono-persistent": this.persistent ? "" : null,
313
- "mono-no-dismiss": this.dismissible ? null : "",
314
- "mono-has-drawer-above": this._hasDrawerAbove ? "" : null,
315
- "mono-resizeable": this.resizeable ? "" : null,
316
- "mono-resizing": this._resizing ? "" : null,
317
- "mono-auto-fullscreen": this._autoFullscreenClass ? this._autoFullscreenClass.replace("auto-fullscreen-", "") : null
318
- };
319
- }
320
- _applyRootAttrs(root) {
321
- if (!root) return;
322
- if (!root.hasAttribute("mono-drawer")) root.setAttribute("mono-drawer", "");
323
- for (const [name, value] of Object.entries(this._computeRootAttrs())) if (value === null) root.removeAttribute(name);
324
- else if (root.getAttribute(name) !== value) root.setAttribute(name, value);
325
- }
326
- _setCssClass(value) {
327
- if (value == null) {
328
- this.cssClass = {};
329
- this.cssClassName = "";
330
- return;
331
- }
332
- if (typeof value === "object") {
333
- this.cssClass = value;
334
- return;
335
- }
336
- if (typeof value === "string") {
337
- const trimmed = value.trim();
338
- if (!trimmed) {
339
- this.cssClass = {};
340
- this.cssClassName = "";
341
- return;
342
- }
343
- if (trimmed.startsWith("{") && trimmed.endsWith("}")) try {
344
- this.cssClass = JSON.parse(trimmed);
345
- return;
346
- } catch {}
347
- this.cssClassName = trimmed;
348
- }
349
- }
350
- _cls(base, key) {
351
- const extra = this.cssClass?.[key];
352
- return extra ? `${base} ${extra}` : base;
353
- }
354
- _toBoolean(value) {
355
- if (typeof value === "boolean") return value;
356
- if (typeof value === "string") {
357
- const normalized = value.toLowerCase().trim();
358
- return normalized === "" || normalized === "true";
359
- }
360
- return Boolean(value);
361
- }
362
- /**
363
- * Join the shared stack: assigns z-order, coordinates body-scroll lock, and
364
- * arms the shared Escape listener. Per-drawer scroll-lock / Escape behaviour
365
- * is owned by the stack manager so nesting works (see composables/popup-stack).
366
- */
367
- _applyOpenSideEffects() {
368
- if (!this.stackable) {
369
- for (const other of [...getOpenPopupLayers()]) if (other !== this && other._isMonoDrawer) other.hide?.("manual");
370
- }
371
- registerPopupLayer(this);
372
- this._syncOutsideClick();
373
- }
374
- _releaseSideEffects() {
375
- unregisterPopupLayer(this);
376
- this._unbindOutsideClick();
377
- }
378
- /** Bind when open without an overlay, unbind otherwise — safe to call repeatedly. */
379
- _syncOutsideClick() {
380
- if (isServer) return;
381
- const wanted = this.modelValue && !this.overlay;
382
- if (wanted && !this._outsideBound && !this._outsideArm) {
383
- this._openedAt = performance.now();
384
- this._outsideArm = setTimeout(() => {
385
- this._outsideArm = null;
386
- if (!this.modelValue || this.overlay) return;
387
- document.addEventListener("click", this._onOutsideClick);
388
- this._outsideBound = true;
389
- }, 0);
390
- } else if (!wanted) this._unbindOutsideClick();
391
- }
392
- _unbindOutsideClick() {
393
- if (this._outsideArm) {
394
- clearTimeout(this._outsideArm);
395
- this._outsideArm = null;
396
- }
397
- if (this._outsideBound) {
398
- document.removeEventListener("click", this._onOutsideClick);
399
- this._outsideBound = false;
400
- }
401
- }
402
- /**
403
- * PopupLayer hook — the path lands in this drawer: the host, its render root,
404
- * or a popup opened from within. The same test `_onOutsideClick` uses; the stack
405
- * asks it so a dropdown open BELOW this drawer leaves its clicks alone.
406
- */
407
- containsEventPath(path) {
408
- const root = this.renderRoot instanceof Element ? this.renderRoot : null;
409
- return pathOwnedBy(path, root ? [this, root] : [this]);
410
- }
411
- /** Body-scroll lock is wanted while this drawer is open and `lockScroll` is set. */
412
- get lockBodyScroll() {
413
- return this.lockScroll;
414
- }
415
- /**
416
- * Whether this drawer dims what is beneath it — see `isTopBackdrop` in popup-stack.
417
- * Only while `overlay` is on: an `overlay="false"` drawer stacked above another
418
- * dialog used to count as a backdrop, so the one below hid its overlay and
419
- * nothing dimmed the page at all.
420
- */
421
- get hasBackdrop() {
422
- return this.overlay;
423
- }
424
- /** Topmost-only Escape from the shared stack — close unless persistent. */
425
- onStackEscape(event) {
426
- if (this.closeOnEscape && !this.persistent) this.hide("escape", event);
427
- }
428
- /**
429
- * Called by the stack manager whenever stack order changes. `z` raises this
430
- * drawer's overlay + panel above the ones below; when another backdrop layer
431
- * sits above it (`isTopBackdrop` is false) its own backdrop is hidden so
432
- * stacked overlays don't compound. An `overlay="false"` modal/drawer above
433
- * does not count (see `hasBackdrop`). Both builds read `_drawerZ` into the
434
- * `.mono-drawer` root's `--drawer-z`.
435
- */
436
- setStackZ(z, isTopBackdrop) {
437
- this._drawerZ = z;
438
- this._hasDrawerAbove = !isTopBackdrop;
439
- }
440
- /**
441
- * PopupLayer hook — the level this drawer pins itself to, or `undefined` to take
442
- * the stack's slot. The stack reads it so layers opened ABOVE a pinned drawer
443
- * clear it instead of landing back at the base (see popup-stack).
444
- *
445
- * Coerced through `Number` rather than read directly because the prop can arrive
446
- * as a numeric STRING — a plain `z-index="1500"` attribute goes through the
447
- * converter, but `el.zIndex = '1500'` (or a framework binding that stringifies)
448
- * does not.
449
- *
450
- * `null` and `''` are screened out FIRST, and that guard is load-bearing:
451
- * `Number(null)` and `Number('')` are both `0` and both finite, so `:z-index="null"`
452
- * — Vue's ordinary spelling for "no value" — used to pin the drawer to `z-index: 0`
453
- * and drop it behind the page. Only the attribute path was safe, because
454
- * `optionalNumberConverter` maps `''`/`null` to `undefined`; the PROPERTY path,
455
- * which is what Vue actually uses (the hybrid alias makes `'z-index' in el` true),
456
- * was not.
457
- */
458
- get pinnedZ() {
459
- const raw = this.zIndex;
460
- if (raw === null || raw === void 0) return void 0;
461
- if (typeof raw === "string" && raw.trim() === "") return void 0;
462
- const manual = Number(raw);
463
- return Number.isFinite(manual) ? manual : void 0;
464
- }
465
- /**
466
- * The level actually published to CSS: the `zIndex` prop when the consumer set
467
- * one, otherwise the stack's slot.
468
- */
469
- get _effectiveZ() {
470
- return this.pinnedZ ?? this._drawerZ;
471
- }
472
- get _isHorizontal() {
473
- return this.position === "left" || this.position === "right";
474
- }
475
- /**
476
- * Apply a sizing CSS var to the `.mono-drawer` root. Build hook: light writes
477
- * to the portal; shadow (default here) writes to the inner root element.
478
- */
479
- _setDrawerSizeVar(name, value) {
480
- this.renderRoot.querySelector(".mono-drawer")?.style.setProperty(name, value);
481
- }
482
- /** Counterpart of {@link _setDrawerSizeVar} — same build hook, same root. */
483
- _removeDrawerSizeVar(name) {
484
- this.renderRoot.querySelector(".mono-drawer")?.style.removeProperty(name);
485
- }
486
- _teardownResize() {
487
- if (typeof window === "undefined") return;
488
- window.removeEventListener("pointermove", this._onResizeMove);
489
- window.removeEventListener("pointerup", this._onResizeEnd);
490
- window.removeEventListener("pointercancel", this._onResizeEnd);
491
- }
492
- /**
493
- * Every open-state change emits `toggle` (historically `mno-click`, which is
494
- * kept), then the transition-specific `open` / `close`. `toggle` rather than
495
- * a plain `click`: a real click from inside the panel already bubbles to the
496
- * host on its own, and this is not one — it is a state change.
497
- */
498
- _emitChange(detail) {
499
- dispatchMonoEvent(this, "click", detail, { alias: "toggle" });
500
- if (detail.value && !detail.oldValue) dispatchMonoEvent(this, "open", detail);
501
- else if (!detail.value && detail.oldValue) dispatchMonoEvent(this, "close", detail);
502
- }
503
- show(source = "manual", sourceEvent) {
504
- if (this.modelValue) return;
505
- const oldValue = this.modelValue;
506
- this.modelValue = true;
507
- this._emitChange({
508
- modelValue: true,
509
- currentValue: true,
510
- oldValue,
511
- value: true,
512
- source,
513
- sourceEvent
514
- });
515
- }
516
- hide(source = "manual", sourceEvent) {
517
- if (!this.modelValue) return;
518
- const oldValue = this.modelValue;
519
- this.modelValue = false;
520
- this._emitChange({
521
- modelValue: false,
522
- currentValue: false,
523
- oldValue,
524
- value: false,
525
- source,
526
- sourceEvent
527
- });
528
- }
529
- toggle(source = "manual", sourceEvent) {
530
- if (this.modelValue) this.hide(source, sourceEvent);
531
- else this.show(source, sourceEvent);
532
- }
533
- _handleClose(event) {
534
- if (!this.dismissible) return;
535
- this.hide("close", event);
536
- }
537
- _handleOverlayClick(event) {
538
- if (!this.closeOnOverlay || !this.dismissible || this.persistent) return;
539
- this.hide("overlay", event);
540
- }
541
- /** Title / subtitle / heading-column presence, shared by the head render and
542
- * the dialog's `aria-labelledby` / `aria-describedby`. */
543
- get _headingState() {
544
- const title = !!this.title || this._hasTitleSlotState;
545
- const subtitle = !!this.subtitle || this._hasSubtitleSlotState;
546
- return {
547
- title,
548
- subtitle,
549
- heading: this._hasHeaderSlotState || title || subtitle
550
- };
551
- }
552
- /**
553
- * Prefix of the heading ids (`<base>-heading` / `-title` / `-subtitle`). The
554
- * light build's panel lives in the document, so the ids must be unique per
555
- * instance; the shadow build overrides this with a constant (ids are scoped to
556
- * its own root, and a counter would differ between server and client).
557
- */
558
- get _headingIdBase() {
559
- this._idSeq ??= ++drawerIdSeq;
560
- return `mono-drawer-${this._idSeq}`;
561
- }
562
- /** `aria-labelledby` / `aria-describedby` for the `role="dialog"` root. A
563
- * `slot="header"` labels the dialog with its whole column; otherwise the
564
- * title labels it and the subtitle describes it. */
565
- _headingAria() {
566
- const s = this._headingState;
567
- const base = this._headingIdBase;
568
- if (this._hasHeaderSlotState) return { labelledby: `${base}-heading` };
569
- return {
570
- labelledby: s.title ? `${base}-title` : void 0,
571
- describedby: s.subtitle ? `${base}-subtitle` : void 0
572
- };
573
- }
574
- _renderHead() {
575
- const s = this._headingState;
576
- const hasContent = s.heading || this.dismissible;
577
- if (!hasContent && !this._slotsAlwaysRender) return nothing;
578
- const base = this._headingIdBase;
579
- const heading = html`
580
- <div
581
- class=${this._cls("mono-drawer-title", "title")}
582
- mono-title
583
- id=${`${base}-title`}
584
- ?mono-empty=${!s.title}
585
- >${this._slotOutlet("title", this.title || nothing)}</div>
586
- <div
587
- class=${this._cls("mono-drawer-subtitle", "subtitle")}
588
- mono-subtitle
589
- id=${`${base}-subtitle`}
590
- ?mono-empty=${!s.subtitle}
591
- >${this._slotOutlet("subtitle", this.subtitle || nothing)}</div>
592
- `;
593
- return html`
594
- <div
595
- class=${this._cls("mono-drawer-head", "head")}
596
- mono-header
597
- ?mono-empty=${!hasContent}
598
- >
599
- <div
600
- class=${this._cls("mono-drawer-heading", "heading")}
601
- mono-heading
602
- id=${`${base}-heading`}
603
- ?mono-empty=${!s.heading}
604
- >
605
- ${this._slotOutlet("header", heading)}
606
- </div>
607
- ${this.dismissible ? html`
608
- <button
609
- type="button"
610
- class=${this._cls("mono-drawer-close", "close")}
611
- mono-close
612
- aria-label="Close drawer"
613
- @click=${this._handleClose}
614
- >
615
- ${this.renderIcon("close")}
616
- </button>
617
- ` : nothing}
618
- </div>
619
- `;
620
- }
621
- _renderFoot() {
622
- if (!this._hasFooterSlotState && !this._slotsAlwaysRender) return nothing;
623
- return html`
624
- <div
625
- class=${this._cls("mono-drawer-foot", "foot")}
626
- mono-footer
627
- ?mono-empty=${!this._hasFooterSlotState}
628
- >
629
- ${this._slotOutlet("footer")}
630
- </div>
631
- `;
632
- }
633
- /** Shared drawer markup (overlay + panel[resizer + head + body + foot]). The
634
- * light build renders this directly into the portal (which IS `.mono-drawer`);
635
- * the shadow build wraps it in an inner `.mono-drawer` root. */
636
- _renderDrawerBody() {
637
- return html`
638
- <div
639
- class=${this._cls("mono-drawer-overlay", "overlay")}
640
- mono-overlay
641
- @click=${this._handleOverlayClick}
642
- ></div>
643
- <div
644
- class=${this._cls("mono-drawer-panel", "panel")}
645
- mono-panel
646
- role="document"
647
- @click=${(e) => e.stopPropagation()}
648
- >
649
- ${this.resizeable ? html`<div
650
- class=${this._cls("mono-drawer-resizer", "resizer")}
651
- mono-resizer
652
- role="separator"
653
- aria-orientation=${this._isHorizontal ? "vertical" : "horizontal"}
654
- @pointerdown=${this._onResizeStart}
655
- ></div>` : nothing}
656
- ${this._renderHead()}
657
- <div class=${this._cls("mono-drawer-body", "body")} mono-body>
658
- ${this._slotOutlet("body")}
659
- </div>
660
- ${this._renderFoot()}
661
- </div>
662
- `;
663
- }
664
- /** Whether the slot regions render even when empty. Light: no (omit empty
665
- * regions). Shadow: yes — the native `<slot>`s must exist to project DSD
666
- * content + be scanned (hidden via `[data-empty]` when empty). */
667
- get _slotsAlwaysRender() {
668
- return false;
669
- }
670
- _hasSlot(name) {
671
- return name === "header" ? this._hasHeaderSlotState : name === "title" ? this._hasTitleSlotState : name === "subtitle" ? this._hasSubtitleSlotState : name === "body" ? this._hasBodySlotState : this._hasFooterSlotState;
672
- }
673
- _setSlotState(name, has) {
674
- if (name === "header") this._hasHeaderSlotState = has;
675
- else if (name === "title") this._hasTitleSlotState = has;
676
- else if (name === "subtitle") this._hasSubtitleSlotState = has;
677
- else if (name === "body") this._hasBodySlotState = has;
678
- else this._hasFooterSlotState = has;
679
- }
680
- /**
681
- * Slot outlet. Light build (default): a `data-mono-slot` placeholder the
682
- * captured light-DOM nodes are re-parented into when present, else the
683
- * `fallback`. Shadow build overrides this with a native `<slot name>`.
684
- */
685
- _slotOutlet(name, fallback = nothing) {
686
- return this._hasSlot(name) ? html`<span data-mono-slot=${name}></span>` : html`${fallback}`;
687
- }
688
- /** Close ✕. Light (default): UnoCSS icon span. Shadow overrides → inline SVG
689
- * (global `.i-mdi-close` can't reach a shadow root). */
690
- renderIcon(_name) {
691
- return html`<span class="mono-icon i-mdi-close" aria-hidden="true"></span>`;
692
- }
693
- }
694
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "position", void 0);
695
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "size", void 0);
696
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "color", void 0);
697
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "title", void 0);
698
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "subtitle", void 0);
699
- __decorate([property({
700
- attribute: "model-value",
701
- reflect: true,
702
- converter: booleanStringConverter
703
- })], MonoDrawerCoreClass.prototype, "modelValue", void 0);
704
- __decorate([property({
705
- reflect: true,
706
- converter: booleanStringConverter
707
- })], MonoDrawerCoreClass.prototype, "dismissible", void 0);
708
- __decorate([property({
709
- reflect: true,
710
- converter: booleanStringConverter
711
- })], MonoDrawerCoreClass.prototype, "persistent", void 0);
712
- __decorate([property({
713
- reflect: true,
714
- converter: booleanStringConverter
715
- })], MonoDrawerCoreClass.prototype, "overlay", void 0);
716
- __decorate([property({
717
- attribute: "close-on-escape",
718
- converter: booleanStringConverter
719
- })], MonoDrawerCoreClass.prototype, "closeOnEscape", void 0);
720
- __decorate([property({
721
- attribute: "close-on-overlay",
722
- converter: booleanStringConverter
723
- })], MonoDrawerCoreClass.prototype, "closeOnOverlay", void 0);
724
- __decorate([property({
725
- attribute: "lock-scroll",
726
- converter: booleanStringConverter
727
- })], MonoDrawerCoreClass.prototype, "lockScroll", void 0);
728
- __decorate([property({
729
- reflect: true,
730
- converter: booleanStringConverter
731
- })], MonoDrawerCoreClass.prototype, "resizeable", void 0);
732
- __decorate([property({
733
- attribute: "auto-fullscreen",
734
- converter: autoFullscreenConverter
735
- })], MonoDrawerCoreClass.prototype, "autoFullscreen", void 0);
736
- __decorate([property({
737
- reflect: true,
738
- converter: booleanStringConverter
739
- })], MonoDrawerCoreClass.prototype, "stackable", void 0);
740
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "width", void 0);
741
- __decorate([property({ type: String })], MonoDrawerCoreClass.prototype, "height", void 0);
742
- __decorate([property({
743
- attribute: "z-index",
744
- converter: optionalNumberConverter
745
- })], MonoDrawerCoreClass.prototype, "zIndex", void 0);
746
- __decorate([property({ attribute: false })], MonoDrawerCoreClass.prototype, "cssClass", void 0);
747
- __decorate([property({ attribute: false })], MonoDrawerCoreClass.prototype, "cssClassName", void 0);
748
- __decorate([state()], MonoDrawerCoreClass.prototype, "_slotsCaptured", void 0);
749
- __decorate([state()], MonoDrawerCoreClass.prototype, "_hasHeaderSlotState", void 0);
750
- __decorate([state()], MonoDrawerCoreClass.prototype, "_hasTitleSlotState", void 0);
751
- __decorate([state()], MonoDrawerCoreClass.prototype, "_hasSubtitleSlotState", void 0);
752
- __decorate([state()], MonoDrawerCoreClass.prototype, "_hasBodySlotState", void 0);
753
- __decorate([state()], MonoDrawerCoreClass.prototype, "_hasFooterSlotState", void 0);
754
- __decorate([state()], MonoDrawerCoreClass.prototype, "_hasDrawerAbove", void 0);
755
- __decorate([state()], MonoDrawerCoreClass.prototype, "_resizing", void 0);
756
- __decorate([state()], MonoDrawerCoreClass.prototype, "_drawerZ", void 0);
757
- __decorate([query(".mono-drawer-panel")], MonoDrawerCoreClass.prototype, "_panelEl", void 0);
758
- return MonoDrawerCoreClass;
759
- };
760
-
761
- //#endregion
762
8
  //#region src/components/drawer/mono-drawer.ts
763
9
  let MonoDrawer = class MonoDrawer extends MonoDrawerCore(LitElement) {
764
10
  constructor(..._args) {