@muibook/components 5.2.0 → 5.2.1
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.
|
@@ -51,7 +51,7 @@ class p extends HTMLElement {
|
|
|
51
51
|
if (!this.shadowRoot) return;
|
|
52
52
|
const t = this.getAttribute("width") || "400px", e = this.getAttribute("variant") || "overlay", i = !!this.querySelector('[slot="before"]');
|
|
53
53
|
this._computedSide = this.getAttribute("side") || (i ? "right" : "left"), this.getAttribute("side") !== this._computedSide && this.setAttribute("side", this._computedSide);
|
|
54
|
-
const
|
|
54
|
+
const o = (
|
|
55
55
|
/*css*/
|
|
56
56
|
`
|
|
57
57
|
header {
|
|
@@ -88,7 +88,7 @@ class p extends HTMLElement {
|
|
|
88
88
|
justify-content: flex-end;
|
|
89
89
|
padding: var(--space-400) var(--space-500) calc(var(--space-400) + env(safe-area-inset-bottom));
|
|
90
90
|
border-top: var(--border-thin);
|
|
91
|
-
background: var(--
|
|
91
|
+
background: var(--drawer-background);
|
|
92
92
|
gap: var(--space-300);
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
position: fixed;
|
|
@@ -179,11 +179,11 @@ class p extends HTMLElement {
|
|
|
179
179
|
visibility: visible;
|
|
180
180
|
}
|
|
181
181
|
`
|
|
182
|
-
), r = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);",
|
|
182
|
+
), r = this._computedSide === "left" ? "border-right: var(--border-thin);" : "border-left: var(--border-thin);", d = (
|
|
183
183
|
/*css*/
|
|
184
184
|
`
|
|
185
185
|
.inner {
|
|
186
|
-
background: var(--
|
|
186
|
+
background: var(--drawer-background);
|
|
187
187
|
width: ${t};
|
|
188
188
|
position: fixed;
|
|
189
189
|
top: 0;
|
|
@@ -319,12 +319,12 @@ class p extends HTMLElement {
|
|
|
319
319
|
}
|
|
320
320
|
|
|
321
321
|
`
|
|
322
|
-
),
|
|
323
|
-
let
|
|
322
|
+
), l = this.getAttribute("side") || this._computedSide, h = e === "overlay" || e === "push";
|
|
323
|
+
let a = "";
|
|
324
324
|
const c = this.hasAttribute("drawer-space") ? "no-padding" : "";
|
|
325
|
-
e === "overlay" ?
|
|
325
|
+
e === "overlay" ? a = /*html*/
|
|
326
326
|
`
|
|
327
|
-
<style>${
|
|
327
|
+
<style>${o}${s}${n}</style>
|
|
328
328
|
<div class="overlay"></div>
|
|
329
329
|
<div class="inner" role="dialog" aria-modal="true">
|
|
330
330
|
<header hidden>
|
|
@@ -340,20 +340,20 @@ class p extends HTMLElement {
|
|
|
340
340
|
<slot name="actions"></slot>
|
|
341
341
|
</footer>
|
|
342
342
|
</div>
|
|
343
|
-
` : (e === "push" || e === "persistent") && (
|
|
343
|
+
` : (e === "push" || e === "persistent") && (a = /*html*/
|
|
344
344
|
`
|
|
345
|
-
<style>${
|
|
345
|
+
<style>${o}${d}${n}</style>
|
|
346
346
|
<div class="shell">
|
|
347
|
-
${
|
|
347
|
+
${l === "left" ? this.getDrawerTemplate(h) + '<slot name="page"></slot>' : '<slot name="page"></slot>' + this.getDrawerTemplate(h)}
|
|
348
348
|
</div>
|
|
349
|
-
`), this.shadowRoot.innerHTML =
|
|
349
|
+
`), this.shadowRoot.innerHTML = a;
|
|
350
350
|
}
|
|
351
351
|
cacheEls() {
|
|
352
352
|
this.innerEl = this.shadowRoot.querySelector(".inner"), this.overlayEl = this.shadowRoot.querySelector(".overlay"), this.footerEl = this.shadowRoot.querySelector("footer"), this.actionsSlot = this.shadowRoot.querySelector('slot[name="actions"]'), this.outer = this.shadowRoot.querySelector(".outer"), this.pushLayout = this.shadowRoot.querySelector(".shell"), this.persistentLayout = this.shadowRoot.querySelector(".shell"), this.headerEl = this.shadowRoot.querySelector("header"), this.headerSlot = this.shadowRoot.querySelector('slot[name="title"]');
|
|
353
353
|
}
|
|
354
354
|
attachEvents() {
|
|
355
|
-
var t, e, i,
|
|
356
|
-
(t = this.shadowRoot.querySelector(".close")) == null || t.addEventListener("click", () => this.close()), (e = this.overlayEl) == null || e.addEventListener("click", () => this.close()), (i = this.actionsSlot) == null || i.addEventListener("slotchange", () => this.updateFooterVisibility()), (
|
|
355
|
+
var t, e, i, o;
|
|
356
|
+
(t = this.shadowRoot.querySelector(".close")) == null || t.addEventListener("click", () => this.close()), (e = this.overlayEl) == null || e.addEventListener("click", () => this.close()), (i = this.actionsSlot) == null || i.addEventListener("slotchange", () => this.updateFooterVisibility()), (o = this.headerSlot) == null || o.addEventListener("slotchange", () => this.updateHeaderVisibility());
|
|
357
357
|
}
|
|
358
358
|
updateFooterVisibility() {
|
|
359
359
|
if (!this.footerEl || !this.actionsSlot) return;
|
|
@@ -371,17 +371,17 @@ class p extends HTMLElement {
|
|
|
371
371
|
t === "open" && this.syncOpenState(), t === "width" && this.innerEl && (this.innerEl.style.width = i || "400px"), t === "side" && (this.render(), this.cacheEls(), this.attachEvents(), this.syncOpenState()), t === "variant" && (this.render(), this.cacheEls(), this.attachEvents(), this.syncOpenState());
|
|
372
372
|
}
|
|
373
373
|
syncOpenState() {
|
|
374
|
-
const t = this.hasAttribute("open"), e = this.getAttribute("variant") || "overlay", i = this.getAttribute("z-index"),
|
|
375
|
-
e === "overlay" && this.overlayEl && (this.overlayEl.style.visibility = t ? "visible" : "hidden", this.overlayEl.style.opacity = t ? "1" : "0", this.overlayEl.style.zIndex =
|
|
374
|
+
const t = this.hasAttribute("open"), e = this.getAttribute("variant") || "overlay", i = this.getAttribute("z-index"), o = i ? Number(i) : 10, s = i ? Number(i) + 1 : 11;
|
|
375
|
+
e === "overlay" && this.overlayEl && (this.overlayEl.style.visibility = t ? "visible" : "hidden", this.overlayEl.style.opacity = t ? "1" : "0", this.overlayEl.style.zIndex = o.toString(), this.innerEl.style.zIndex = s.toString(), this.inert = !t), e === "push" && this.outer && (this.updateLayout(e, t), this.outer.style.zIndex = s.toString(), this.outer.inert = !t), e === "persistent" && this.outer && (this.updateLayout(e, t), this.outer.inert = !1);
|
|
376
376
|
}
|
|
377
377
|
updateLayout(t, e) {
|
|
378
|
-
const i = this.getAttribute("width") || "300px",
|
|
378
|
+
const i = this.getAttribute("width") || "300px", o = this.getAttribute("side") || this._computedSide, s = t === "push" ? this.pushLayout : t === "persistent" ? this.persistentLayout : null;
|
|
379
379
|
if (!s) return;
|
|
380
380
|
if (window.innerWidth <= this.getBreakpoint()) {
|
|
381
381
|
t === "push" ? s.style.removeProperty("grid-template-columns") : t === "persistent" && (s.style.display = "grid", s.style.removeProperty("grid-template-columns"));
|
|
382
382
|
return;
|
|
383
383
|
}
|
|
384
|
-
s.style.display = "grid", t === "push" ? s.style.gridTemplateColumns =
|
|
384
|
+
s.style.display = "grid", t === "push" ? s.style.gridTemplateColumns = o === "left" ? e ? `${i} auto` : "0 auto" : e ? `auto ${i}` : "auto 0" : t === "persistent" && (s.style.gridTemplateColumns = o === "left" ? `${i} auto` : `auto ${i}`);
|
|
385
385
|
}
|
|
386
386
|
open() {
|
|
387
387
|
this.setAttribute("open", ""), this.dispatchEvent(new CustomEvent("mui-drawer-open", { bubbles: !0, composed: !0 }));
|