@vrembem/drawer
Advanced tools
Comparing version 4.0.0-next.8 to 4.0.0-next.9
127
dev/index.js
@@ -1,33 +0,18 @@ | ||
var __accessCheck = (obj, member, msg) => { | ||
if (!member.has(obj)) | ||
throw TypeError("Cannot " + msg); | ||
var __typeError = (msg) => { | ||
throw TypeError(msg); | ||
}; | ||
var __privateGet = (obj, member, getter) => { | ||
__accessCheck(obj, member, "read from private field"); | ||
return getter ? getter.call(obj) : member.get(obj); | ||
}; | ||
var __privateAdd = (obj, member, value) => { | ||
if (member.has(obj)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
member instanceof WeakSet ? member.add(obj) : member.set(obj, value); | ||
}; | ||
var __privateSet = (obj, member, value, setter) => { | ||
__accessCheck(obj, member, "write to private field"); | ||
setter ? setter.call(obj, value) : member.set(obj, value); | ||
return value; | ||
}; | ||
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg); | ||
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)); | ||
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value); | ||
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value); | ||
var _handleClick, _handleKeydown; | ||
var b = (t, e, n) => { | ||
if (!e.has(t)) | ||
throw TypeError("Cannot " + n); | ||
var b = (t) => { | ||
throw TypeError(t); | ||
}; | ||
var o = (t, e, n) => (b(t, e, "read from private field"), n ? n.call(t) : e.get(t)), m = (t, e, n) => { | ||
if (e.has(t)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
e instanceof WeakSet ? e.add(t) : e.set(t, n); | ||
}, a = (t, e, n, i) => (b(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n); | ||
var g = (t, e, n) => e.has(t) || b("Cannot " + n); | ||
var o = (t, e, n) => (g(t, e, "read from private field"), n ? n.call(t) : e.get(t)), m = (t, e, n) => e.has(t) ? b("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, n), a = (t, e, n, i) => (g(t, e, "write to private field"), e.set(t, n), n); | ||
var l; | ||
class I { | ||
class L { | ||
constructor(e, n) { | ||
m(this, l, void 0); | ||
m(this, l); | ||
this.value = e, a(this, l, n), this.mql = null; | ||
@@ -50,3 +35,3 @@ } | ||
l = /* @__PURE__ */ new WeakMap(); | ||
class L { | ||
class S { | ||
constructor() { | ||
@@ -86,3 +71,3 @@ this.collection = []; | ||
disabled: ":not(:disabled)" | ||
}, g = [ | ||
}, $ = [ | ||
`a[href]${s.inert}${s.negTabIndex}`, | ||
@@ -106,8 +91,8 @@ `area[href]${s.inert}${s.negTabIndex}`, | ||
var f, u, d; | ||
class S { | ||
class q { | ||
constructor(e = null, n = "[data-focus]") { | ||
m(this, f, void 0); | ||
m(this, u, void 0); | ||
m(this, d, void 0); | ||
this.el = e, this.selectorFocus = n, a(this, u, $.bind(this)), a(this, d, v.bind(this)); | ||
m(this, f); | ||
m(this, u); | ||
m(this, d); | ||
this.el = e, this.selectorFocus = n, a(this, u, v.bind(this)), a(this, d, y.bind(this)); | ||
} | ||
@@ -137,3 +122,3 @@ get focusable() { | ||
const n = [], i = document.activeElement, r = e.scrollTop; | ||
return e.querySelectorAll(g.join(",")).forEach((h) => { | ||
return e.querySelectorAll($.join(",")).forEach((h) => { | ||
h.focus(), document.activeElement === h && n.push(h); | ||
@@ -144,14 +129,14 @@ }), e.scrollTop = r, i.focus(), n; | ||
f = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(); | ||
function $(t) { | ||
function v(t) { | ||
(t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus())); | ||
} | ||
function v(t) { | ||
function y(t) { | ||
(t.key === "Tab" || t.keyCode === 9) && t.preventDefault(); | ||
} | ||
function y() { | ||
function T() { | ||
return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim(); | ||
} | ||
function T(t, e = document.body) { | ||
function E(t, e = document.body) { | ||
if (t.slice(0, 2) !== "--") { | ||
const i = y(); | ||
const i = T(); | ||
i && (t = `${i}${t}`), t = `--${t}`; | ||
@@ -164,7 +149,7 @@ } | ||
} | ||
function q(t, e) { | ||
function F(t, e) { | ||
const i = (t.getAttribute(`data-${e}`) || "").replace(/'/g, '"'); | ||
return i ? JSON.parse(i) : {}; | ||
} | ||
function F(t, e = true) { | ||
function k(t, e = true) { | ||
const n = localStorage.getItem(t), i = n ? JSON.parse(n) : {}; | ||
@@ -180,6 +165,6 @@ return { | ||
} | ||
function w(t, e, n, i = "transition-duration") { | ||
function C(t, e, n, i = "transition-duration") { | ||
return new Promise((r) => { | ||
if (typeof i == "string") { | ||
const c = T(i, t), h = !!c.includes("ms"); | ||
const c = E(i, t), h = !!c.includes("ms"); | ||
i = parseFloat(c) * (h ? 1 : 1e3); | ||
@@ -192,3 +177,3 @@ } | ||
} | ||
function E(t, e) { | ||
function p(t, e) { | ||
e && document.querySelectorAll(e).forEach((i) => { | ||
@@ -198,3 +183,3 @@ t ? i.style.overflow = "hidden" : i.style.removeProperty("overflow"); | ||
} | ||
function p(t, e) { | ||
function x(t, e) { | ||
e && document.querySelectorAll(e).forEach((i) => { | ||
@@ -204,4 +189,4 @@ t ? (i.inert = true, i.setAttribute("aria-hidden", true)) : (i.inert = null, i.removeAttribute("aria-hidden")); | ||
} | ||
function C(t, e) { | ||
p(!!t, e.selectorInert), E(!!t, e.selectorOverflow); | ||
function N(t, e) { | ||
x(!!t, e.selectorInert), p(!!t, e.selectorOverflow); | ||
} | ||
@@ -278,3 +263,3 @@ const defaults = { | ||
function getBreakpoint(drawer) { | ||
const prefix = y(); | ||
const prefix = T(); | ||
const bp = drawer.getAttribute(`data-${this.settings.dataBreakpoint}`); | ||
@@ -345,4 +330,3 @@ if (this.settings.breakpoints && this.settings.breakpoints[bp]) { | ||
const parent = event.target.closest(this.settings.selectorDrawer); | ||
if (parent) | ||
return this.close(parent); | ||
if (parent) return this.close(parent); | ||
} | ||
@@ -359,4 +343,3 @@ }); | ||
if (event.key === "Escape") { | ||
if (this.activeModal) | ||
return this.close(this.activeModal); | ||
if (this.activeModal) return this.close(this.activeModal); | ||
} | ||
@@ -385,8 +368,7 @@ } | ||
const config = { ...this.settings, ...entry.settings }; | ||
if (enableTransition !== void 0) | ||
config.transition = enableTransition; | ||
if (enableTransition !== void 0) config.transition = enableTransition; | ||
if (entry.state === "closed" || entry.state === "indeterminate") { | ||
entry.state = "opening"; | ||
if (config.transition) { | ||
await w(entry.el, { | ||
await C(entry.el, { | ||
start: config.stateClosing, | ||
@@ -403,4 +385,3 @@ finish: config.stateClosed | ||
entry.state = "opened"; | ||
if (entry.mode === "modal") | ||
C(true, config); | ||
if (entry.mode === "modal") N(true, config); | ||
if (focus) { | ||
@@ -419,4 +400,3 @@ updateFocusState.call(this, entry); | ||
const config = { ...this.settings, ...entry.settings }; | ||
if (enableTransition !== void 0) | ||
config.transition = enableTransition; | ||
if (enableTransition !== void 0) config.transition = enableTransition; | ||
if (entry.state === "opened" || entry.state === "indeterminate") { | ||
@@ -426,3 +406,3 @@ entry.state = "closing"; | ||
if (config.transition) { | ||
await w(entry.el, { | ||
await C(entry.el, { | ||
start: config.stateOpening, | ||
@@ -439,4 +419,3 @@ finish: config.stateOpened | ||
entry.state = "closed"; | ||
if (entry.mode === "modal") | ||
C(false, config); | ||
if (entry.mode === "modal") N(false, config); | ||
if (focus) { | ||
@@ -473,3 +452,3 @@ updateFocusState.call(this, entry); | ||
entry.dialog.removeAttribute("aria-modal"); | ||
C(false, { ...this.settings, ...entry.settings }); | ||
N(false, { ...this.settings, ...entry.settings }); | ||
this.focusTrap.unmount(); | ||
@@ -496,3 +475,3 @@ await applyInlineState(entry); | ||
const root = this; | ||
const breakpoint = new I(); | ||
const breakpoint = new L(); | ||
let _mode, _state = "indeterminate"; | ||
@@ -504,3 +483,3 @@ const entry = { | ||
trigger: null, | ||
settings: { ...q(el, this.settings.dataConfig), ...config }, | ||
settings: { ...F(el, this.settings.dataConfig), ...config }, | ||
inlineState: "indeterminate", | ||
@@ -585,15 +564,14 @@ get breakpoint() { | ||
} | ||
class Drawer extends L { | ||
class Drawer extends S { | ||
constructor(options) { | ||
super(); | ||
__privateAdd(this, _handleClick, void 0); | ||
__privateAdd(this, _handleKeydown, void 0); | ||
__privateAdd(this, _handleClick); | ||
__privateAdd(this, _handleKeydown); | ||
this.defaults = defaults; | ||
this.settings = { ...this.defaults, ...options }; | ||
this.focusTrap = new S(); | ||
this.store = F(this.settings.storeKey, this.settings.store); | ||
this.focusTrap = new q(); | ||
this.store = k(this.settings.storeKey, this.settings.store); | ||
__privateSet(this, _handleClick, handleClick.bind(this)); | ||
__privateSet(this, _handleKeydown, handleKeydown.bind(this)); | ||
if (this.settings.autoMount) | ||
this.mount(); | ||
if (this.settings.autoMount) this.mount(); | ||
} | ||
@@ -606,4 +584,3 @@ get activeModal() { | ||
async mount(options = null) { | ||
if (options) | ||
this.settings = { ...this.settings, ...options }; | ||
if (options) this.settings = { ...this.settings, ...options }; | ||
const drawers = document.querySelectorAll(this.settings.selectorDrawer); | ||
@@ -610,0 +587,0 @@ await this.registerCollection(drawers); |
@@ -1,21 +0,12 @@ | ||
var I = (t, s, e) => { | ||
if (!s.has(t)) | ||
throw TypeError("Cannot " + e); | ||
var I = (t) => { | ||
throw TypeError(t); | ||
}; | ||
var w = (t, s, e) => (I(t, s, "read from private field"), e ? e.call(t) : s.get(t)), S = (t, s, e) => { | ||
if (s.has(t)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
s instanceof WeakSet ? s.add(t) : s.set(t, e); | ||
}, L = (t, s, e, i) => (I(t, s, "write to private field"), i ? i.call(t, e) : s.set(t, e), e); | ||
var O = (t, s, e) => { | ||
if (!s.has(t)) | ||
throw TypeError("Cannot " + e); | ||
}, l = (t, s, e) => (O(t, s, "read from private field"), e ? e.call(t) : s.get(t)), $ = (t, s, e) => { | ||
if (s.has(t)) | ||
throw TypeError("Cannot add the same private member more than once"); | ||
s instanceof WeakSet ? s.add(t) : s.set(t, e); | ||
}, h = (t, s, e, i) => (O(t, s, "write to private field"), i ? i.call(t, e) : s.set(t, e), e), d; | ||
class P { | ||
var O = (t, s, e) => s.has(t) || I("Cannot " + e); | ||
var w = (t, s, e) => (O(t, s, "read from private field"), e ? e.call(t) : s.get(t)), S = (t, s, e) => s.has(t) ? I("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), k = (t, s, e, i) => (O(t, s, "write to private field"), i ? i.call(t, e) : s.set(t, e), e); | ||
var M = (t) => { | ||
throw TypeError(t); | ||
}, y = (t, s, e) => s.has(t) || M("Cannot " + e), l = (t, s, e) => (y(t, s, "read from private field"), e ? e.call(t) : s.get(t)), $ = (t, s, e) => s.has(t) ? M("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(t) : s.set(t, e), h = (t, s, e, i) => (y(t, s, "write to private field"), s.set(t, e), e), d; | ||
class B { | ||
constructor(s, e) { | ||
$(this, d, void 0), this.value = s, h(this, d, e), this.mql = null; | ||
$(this, d), this.value = s, h(this, d, e), this.mql = null; | ||
} | ||
@@ -37,3 +28,3 @@ get handler() { | ||
d = /* @__PURE__ */ new WeakMap(); | ||
class A { | ||
class j { | ||
constructor() { | ||
@@ -73,3 +64,3 @@ this.collection = []; | ||
disabled: ":not(:disabled)" | ||
}, B = [ | ||
}, N = [ | ||
`a[href]${o.inert}${o.negTabIndex}`, | ||
@@ -93,5 +84,5 @@ `area[href]${o.inert}${o.negTabIndex}`, | ||
var v, g, f; | ||
class j { | ||
class q { | ||
constructor(s = null, e = "[data-focus]") { | ||
$(this, v, void 0), $(this, g, void 0), $(this, f, void 0), this.el = s, this.selectorFocus = e, h(this, g, q.bind(this)), h(this, f, K.bind(this)); | ||
$(this, v), $(this, g), $(this, f), this.el = s, this.selectorFocus = e, h(this, g, K.bind(this)), h(this, f, V.bind(this)); | ||
} | ||
@@ -121,3 +112,3 @@ get focusable() { | ||
const e = [], i = document.activeElement, n = s.scrollTop; | ||
return s.querySelectorAll(B.join(",")).forEach((c) => { | ||
return s.querySelectorAll(N.join(",")).forEach((c) => { | ||
c.focus(), document.activeElement === c && e.push(c); | ||
@@ -128,14 +119,14 @@ }), s.scrollTop = n, i.focus(), e; | ||
v = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(); | ||
function q(t) { | ||
function K(t) { | ||
(t.key === "Tab" || t.keyCode === 9) && (t.shiftKey ? (document.activeElement === this.focusableFirst || document.activeElement === this.el) && (t.preventDefault(), this.focusableLast.focus()) : (document.activeElement === this.focusableLast || document.activeElement === this.el) && (t.preventDefault(), this.focusableFirst.focus())); | ||
} | ||
function K(t) { | ||
function V(t) { | ||
(t.key === "Tab" || t.keyCode === 9) && t.preventDefault(); | ||
} | ||
function M() { | ||
function D() { | ||
return getComputedStyle(document.body).getPropertyValue("--vb-prefix").trim(); | ||
} | ||
function N(t, s = document.body) { | ||
function W(t, s = document.body) { | ||
if (t.slice(0, 2) !== "--") { | ||
const i = M(); | ||
const i = D(); | ||
i && (t = `${i}${t}`), t = `--${t}`; | ||
@@ -148,7 +139,7 @@ } | ||
} | ||
function V(t, s) { | ||
function _(t, s) { | ||
const e = (t.getAttribute(`data-${s}`) || "").replace(/'/g, '"'); | ||
return e ? JSON.parse(e) : {}; | ||
} | ||
function W(t, s = !0) { | ||
function J(t, s = !0) { | ||
const e = localStorage.getItem(t), i = e ? JSON.parse(e) : {}; | ||
@@ -164,6 +155,6 @@ return { | ||
} | ||
function y(t, s, e, i = "transition-duration") { | ||
function F(t, s, e, i = "transition-duration") { | ||
return new Promise((n) => { | ||
if (typeof i == "string") { | ||
const c = N(i, t), r = !!c.includes("ms"); | ||
const c = W(i, t), r = !!c.includes("ms"); | ||
i = parseFloat(c) * (r ? 1 : 1e3); | ||
@@ -176,3 +167,3 @@ } | ||
} | ||
function _(t, s) { | ||
function z(t, s) { | ||
s && document.querySelectorAll(s).forEach((e) => { | ||
@@ -182,3 +173,3 @@ t ? e.style.overflow = "hidden" : e.style.removeProperty("overflow"); | ||
} | ||
function J(t, s) { | ||
function G(t, s) { | ||
s && document.querySelectorAll(s).forEach((e) => { | ||
@@ -189,5 +180,5 @@ t ? (e.inert = !0, e.setAttribute("aria-hidden", !0)) : (e.inert = null, e.removeAttribute("aria-hidden")); | ||
function C(t, s) { | ||
J(!!t, s.selectorInert), _(!!t, s.selectorOverflow); | ||
G(!!t, s.selectorInert), z(!!t, s.selectorOverflow); | ||
} | ||
const z = { | ||
const H = { | ||
autoMount: !1, | ||
@@ -224,10 +215,10 @@ // Data attributes | ||
}; | ||
function G(t) { | ||
function Q(t) { | ||
t.store === "opened" ? t.open(!1, !1) : t.store === "closed" ? t.close(!1, !1) : t.store === "indeterminate" ? t.state = "indeterminate" : t.el.classList.contains(t.getSetting("stateOpened")) ? t.open(!1, !1) : t.el.classList.contains(t.getSetting("stateClosed")) ? t.close(!1, !1) : t.state = "indeterminate"; | ||
} | ||
async function H(t) { | ||
async function R(t) { | ||
t.store === "opened" ? await t.open(!1, !1) : t.store === "closed" ? await t.close(!1, !1) : t.store === "indeterminate" ? t.state != "indeterminate" && (t.state = "indeterminate") : (t.state != t.inlineState && (t.state = t.inlineState), t.inlineState === "opened" ? await t.open(!1, !1) : t.inlineState === "closed" && await t.close(!1, !1)); | ||
} | ||
function Q(t) { | ||
const s = M(), e = t.getAttribute(`data-${this.settings.dataBreakpoint}`); | ||
function U(t) { | ||
const s = D(), e = t.getAttribute(`data-${this.settings.dataBreakpoint}`); | ||
return this.settings.breakpoints && this.settings.breakpoints[e] ? this.settings.breakpoints[e] : getComputedStyle(document.body).getPropertyValue(`--${s}breakpoint-${e}`).trim() ? getComputedStyle(document.body).getPropertyValue(`--${s}breakpoint-${e}`).trim() : e; | ||
@@ -241,6 +232,6 @@ } | ||
} | ||
function D(t) { | ||
function P(t) { | ||
t.state === "opened" ? t.mode === "modal" ? this.focusTrap.mount(t.dialog, this.settings.selectorFocus) : this.focusTrap.focus(t.dialog, this.settings.selectorFocus) : (t.trigger && (t.trigger.focus(), t.trigger = null), this.focusTrap.unmount()); | ||
} | ||
async function R(t) { | ||
async function X(t) { | ||
const s = t.target.closest(` | ||
@@ -264,4 +255,3 @@ [data-${this.settings.dataOpen}], | ||
const n = t.target.closest(this.settings.selectorDrawer); | ||
if (n) | ||
return this.close(n); | ||
if (n) return this.close(n); | ||
} | ||
@@ -274,7 +264,7 @@ }); | ||
} | ||
function U(t) { | ||
function Y(t) { | ||
if (t.key === "Escape" && this.activeModal) | ||
return this.close(this.activeModal); | ||
} | ||
async function k(t, s = !0) { | ||
async function L(t, s = !0) { | ||
const e = this.collection.findIndex((i) => i.id === t.id); | ||
@@ -291,3 +281,3 @@ if (e >= 0) { | ||
const i = m.call(this, t), n = { ...this.settings, ...i.settings }; | ||
return s !== void 0 && (n.transition = s), (i.state === "closed" || i.state === "indeterminate") && (i.state = "opening", n.transition ? await y(i.el, { | ||
return s !== void 0 && (n.transition = s), (i.state === "closed" || i.state === "indeterminate") && (i.state = "opening", n.transition ? await F(i.el, { | ||
start: n.stateClosing, | ||
@@ -298,3 +288,3 @@ finish: n.stateClosed | ||
finish: n.stateOpened | ||
}, n.transitionDuration) : (i.el.classList.add(n.stateOpened), i.el.classList.remove(n.stateClosed)), i.state = "opened", i.mode === "modal" && C(!0, n), e && D.call(this, i), i.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "opened", { | ||
}, n.transitionDuration) : (i.el.classList.add(n.stateOpened), i.el.classList.remove(n.stateClosed)), i.state = "opened", i.mode === "modal" && C(!0, n), e && P.call(this, i), i.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "opened", { | ||
detail: this, | ||
@@ -306,3 +296,3 @@ bubbles: !0 | ||
const i = m.call(this, t), n = { ...this.settings, ...i.settings }; | ||
return s !== void 0 && (n.transition = s), (i.state === "opened" || i.state === "indeterminate") && (i.state = "closing", document.activeElement.blur(), n.transition ? await y(i.el, { | ||
return s !== void 0 && (n.transition = s), (i.state === "opened" || i.state === "indeterminate") && (i.state = "closing", document.activeElement.blur(), n.transition ? await F(i.el, { | ||
start: n.stateOpening, | ||
@@ -313,3 +303,3 @@ finish: n.stateOpened | ||
finish: n.stateClosed | ||
}, n.transitionDuration) : (i.el.classList.add(n.stateClosed), i.el.classList.remove(n.stateOpened)), i.state = "closed", i.mode === "modal" && C(!1, n), e && D.call(this, i), i.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "closed", { | ||
}, n.transitionDuration) : (i.el.classList.add(n.stateClosed), i.el.classList.remove(n.stateOpened)), i.state = "closed", i.mode === "modal" && C(!1, n), e && P.call(this, i), i.el.dispatchEvent(new CustomEvent(n.customEventPrefix + "closed", { | ||
detail: this, | ||
@@ -319,12 +309,12 @@ bubbles: !0 | ||
} | ||
async function F(t, s, e) { | ||
async function A(t, s, e) { | ||
const i = m.call(this, t); | ||
return i.state === "closed" ? x.call(this, i, s, e) : E.call(this, i, s, e); | ||
} | ||
function X(t) { | ||
function Z(t) { | ||
switch (t.mode) { | ||
case "inline": | ||
return Y.call(this, t); | ||
return tt.call(this, t); | ||
case "modal": | ||
return Z.call(this, t); | ||
return et.call(this, t); | ||
default: | ||
@@ -334,4 +324,4 @@ throw new Error(`"${t.mode}" is not a valid drawer mode.`); | ||
} | ||
async function Y(t) { | ||
return t.el.classList.remove(t.getSetting("classModal")), t.dialog.removeAttribute("aria-modal"), C(!1, { ...this.settings, ...t.settings }), this.focusTrap.unmount(), await H(t), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", { | ||
async function tt(t) { | ||
return t.el.classList.remove(t.getSetting("classModal")), t.dialog.removeAttribute("aria-modal"), C(!1, { ...this.settings, ...t.settings }), this.focusTrap.unmount(), await R(t), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", { | ||
detail: this, | ||
@@ -341,3 +331,3 @@ bubbles: !0 | ||
} | ||
async function Z(t) { | ||
async function et(t) { | ||
return t.el.classList.add(t.getSetting("classModal")), t.dialog.setAttribute("aria-modal", "true"), await E.call(this, t, !1, !1), t.el.dispatchEvent(new CustomEvent(t.getSetting("customEventPrefix") + "switchMode", { | ||
@@ -348,5 +338,5 @@ detail: this, | ||
} | ||
async function tt(t, s = {}) { | ||
await k.call(this, t, !1); | ||
const e = this, i = new P(); | ||
async function st(t, s = {}) { | ||
await L.call(this, t, !1); | ||
const e = this, i = new B(); | ||
let n, c = "indeterminate"; | ||
@@ -358,6 +348,6 @@ const r = { | ||
trigger: null, | ||
settings: { ...V(t, this.settings.dataConfig), ...s }, | ||
settings: { ..._(t, this.settings.dataConfig), ...s }, | ||
inlineState: "indeterminate", | ||
get breakpoint() { | ||
return Q.call(e, t); | ||
return U.call(e, t); | ||
}, | ||
@@ -371,3 +361,3 @@ get store() { | ||
set mode(a) { | ||
n = a, X.call(e, this); | ||
n = a, Z.call(e, this); | ||
}, | ||
@@ -387,6 +377,6 @@ get state() { | ||
toggle(a, u) { | ||
return F.call(e, this, a, u); | ||
return A.call(e, this, a, u); | ||
}, | ||
deregister() { | ||
return k.call(e, this); | ||
return L.call(e, this); | ||
}, | ||
@@ -410,11 +400,11 @@ mountBreakpoint() { | ||
const T = t.querySelector(r.getSetting("selectorDialog")); | ||
return r.dialog = T || t, r.getSetting("setTabindex") && r.dialog.setAttribute("tabindex", "-1"), await G(r), r.inlineState = r.state, r.mode = t.classList.contains(r.getSetting("classModal")) ? "modal" : "inline", r.breakpoint && r.mountBreakpoint(), r; | ||
return r.dialog = T || t, r.getSetting("setTabindex") && r.dialog.setAttribute("tabindex", "-1"), await Q(r), r.inlineState = r.state, r.mode = t.classList.contains(r.getSetting("classModal")) ? "modal" : "inline", r.breakpoint && r.mountBreakpoint(), r; | ||
} | ||
var p, b; | ||
class st extends A { | ||
class nt extends j { | ||
constructor(e) { | ||
super(); | ||
S(this, p, void 0); | ||
S(this, b, void 0); | ||
this.defaults = z, this.settings = { ...this.defaults, ...e }, this.focusTrap = new j(), this.store = W(this.settings.storeKey, this.settings.store), L(this, p, R.bind(this)), L(this, b, U.bind(this)), this.settings.autoMount && this.mount(); | ||
S(this, p); | ||
S(this, b); | ||
this.defaults = H, this.settings = { ...this.defaults, ...e }, this.focusTrap = new q(), this.store = J(this.settings.storeKey, this.settings.store), k(this, p, X.bind(this)), k(this, b, Y.bind(this)), this.settings.autoMount && this.mount(); | ||
} | ||
@@ -440,7 +430,7 @@ get activeModal() { | ||
let n = typeof e == "string" ? document.getElementById(e) : e; | ||
return n ? tt.call(this, n, i) : Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${e.id || e}".`)); | ||
return n ? st.call(this, n, i) : Promise.reject(new Error(`Failed to register; drawer not found with ID of: "${e.id || e}".`)); | ||
} | ||
deregister(e) { | ||
let i = this.get(e.id || e); | ||
return i ? k.call(this, i) : Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${e.id || e}".`)); | ||
return i ? L.call(this, i) : Promise.reject(new Error(`Failed to deregister; drawer does not exist in collection with ID of: "${e.id || e}".`)); | ||
} | ||
@@ -454,3 +444,3 @@ open(e, i, n) { | ||
toggle(e, i, n) { | ||
return F.call(this, e, i, n); | ||
return A.call(this, e, i, n); | ||
} | ||
@@ -460,4 +450,4 @@ } | ||
export { | ||
st as default | ||
nt as default | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@vrembem/drawer", | ||
"description": "A container component that slides in from the left or right. Typically containing menus, search or other content.", | ||
"version": "4.0.0-next.8", | ||
"version": "4.0.0-next.9", | ||
"license": "MIT", | ||
@@ -56,3 +56,3 @@ "type": "module", | ||
"dependencies": { | ||
"@vrembem/core": "^4.0.0-next.8" | ||
"@vrembem/core": "^4.0.0-next.9" | ||
}, | ||
@@ -62,3 +62,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "474b73d3bf693d58dea2b81695e8de8c75621834" | ||
"gitHead": "64bb6ea0967d83f8269a12ffe87e83fa532cd284" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
290024
37
2491
Updated@vrembem/core@^4.0.0-next.9