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