@vrembem/drawer
Advanced tools
Comparing version 4.0.0-next.1 to 4.0.0-next.2
@@ -24,3 +24,3 @@ var __accessCheck = (obj, member, msg) => { | ||
}; | ||
var o = (t, e, n) => (b(t, e, "read from private field"), n ? n.call(t) : e.get(t)), f = (t, e, n) => { | ||
var o = (t, e, n) => (b(t, e, "read from private field"), n ? n.call(t) : e.get(t)), h = (t, e, n) => { | ||
if (e.has(t)) | ||
@@ -30,23 +30,23 @@ throw TypeError("Cannot add the same private member more than once"); | ||
}, a = (t, e, n, i) => (b(t, e, "write to private field"), i ? i.call(t, n) : e.set(t, n), n); | ||
var r; | ||
var l; | ||
class $ { | ||
constructor(e, n) { | ||
f(this, r, void 0); | ||
this.value = e, a(this, r, n), this.mql = null; | ||
h(this, l, void 0); | ||
this.value = e, a(this, l, n), this.mql = null; | ||
} | ||
get handler() { | ||
return o(this, r); | ||
return o(this, l); | ||
} | ||
// Unmount existing handler before setting a new one. | ||
set handler(e) { | ||
this.mql && (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o(this, r)) : this.mql.removeListener(o(this, r))), a(this, r, e); | ||
this.mql && (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o(this, l)) : this.mql.removeListener(o(this, l))), a(this, l, e); | ||
} | ||
mount(e, n) { | ||
return e && (this.value = e), n && a(this, r, n), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), typeof this.mql.addEventListener == "function" ? this.mql.addEventListener("change", o(this, r)) : this.mql.addListener(o(this, r)), o(this, r).call(this, this.mql), this) : this; | ||
return e && (this.value = e), n && a(this, l, n), this.value ? (this.mql = window.matchMedia(`(min-width: ${this.value})`), typeof this.mql.addEventListener == "function" ? this.mql.addEventListener("change", o(this, l)) : this.mql.addListener(o(this, l)), o(this, l).call(this, this.mql), this) : this; | ||
} | ||
unmount() { | ||
return this.mql ? (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o(this, r)) : this.mql.removeListener(o(this, r)), this.value = null, a(this, r, null), this.mql = null, this) : this; | ||
return this.mql ? (typeof this.mql.removeEventListener == "function" ? this.mql.removeEventListener("change", o(this, l)) : this.mql.removeListener(o(this, l)), this.value = null, a(this, l, null), this.mql = null, this) : this; | ||
} | ||
} | ||
r = /* @__PURE__ */ new WeakMap(); | ||
l = /* @__PURE__ */ new WeakMap(); | ||
class T { | ||
@@ -63,4 +63,4 @@ constructor() { | ||
const i = this.collection[n]; | ||
Object.getOwnPropertyNames(i).forEach((l) => { | ||
delete i[l]; | ||
Object.getOwnPropertyNames(i).forEach((r) => { | ||
delete i[r]; | ||
}), this.collection.splice(n, 1); | ||
@@ -106,15 +106,15 @@ } | ||
]; | ||
var h, d, u; | ||
var f, d, u; | ||
class x { | ||
constructor(e = null, n = "[data-focus]") { | ||
f(this, h, void 0); | ||
f(this, d, void 0); | ||
f(this, u, void 0); | ||
this.el = e, this.selectorFocus = n, a(this, d, p.bind(this)), a(this, u, g.bind(this)); | ||
h(this, f, void 0); | ||
h(this, d, void 0); | ||
h(this, u, void 0); | ||
this.el = e, this.selectorFocus = n, a(this, d, g.bind(this)), a(this, u, p.bind(this)); | ||
} | ||
get focusable() { | ||
return o(this, h); | ||
return o(this, f); | ||
} | ||
set focusable(e) { | ||
a(this, h, e), o(this, h).length ? (document.removeEventListener("keydown", o(this, u)), document.addEventListener("keydown", o(this, d))) : (document.removeEventListener("keydown", o(this, d)), document.addEventListener("keydown", o(this, u))); | ||
a(this, f, e), o(this, f).length ? (document.removeEventListener("keydown", o(this, u)), document.addEventListener("keydown", o(this, d))) : (document.removeEventListener("keydown", o(this, d)), document.addEventListener("keydown", o(this, u))); | ||
} | ||
@@ -137,13 +137,13 @@ get focusableFirst() { | ||
getFocusable(e = this.el) { | ||
const n = [], i = document.activeElement, l = e.scrollTop; | ||
const n = [], i = document.activeElement, r = e.scrollTop; | ||
return e.querySelectorAll(v.join(",")).forEach((m) => { | ||
m.focus(), document.activeElement === m && n.push(m); | ||
}), e.scrollTop = l, i.focus(), n; | ||
}), e.scrollTop = r, i.focus(), n; | ||
} | ||
} | ||
h = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(); | ||
function p(t) { | ||
f = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new WeakMap(); | ||
function g(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 g(t) { | ||
function p(t) { | ||
(t.key === "Tab" || t.keyCode === 9) && t.preventDefault(); | ||
@@ -161,7 +161,7 @@ } | ||
return { | ||
get(l) { | ||
return l ? i[l] : i; | ||
get(r) { | ||
return r ? i[r] : i; | ||
}, | ||
set(l, c) { | ||
return c ? i[l] = c : delete i[l], e && localStorage.setItem(t, JSON.stringify(i)), i; | ||
set(r, c) { | ||
return c ? i[r] = c : delete i[r], e && localStorage.setItem(t, JSON.stringify(i)), i; | ||
} | ||
@@ -171,8 +171,8 @@ }; | ||
const S = (t, e) => new Promise((n) => { | ||
e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i() { | ||
t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), n(t), this.removeEventListener("transitionend", i); | ||
e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i(r) { | ||
r.target == t && (t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), n(t), this.removeEventListener("transitionend", i)); | ||
})) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), n(t)); | ||
}), F = (t, e) => new Promise((n) => { | ||
e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i() { | ||
t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), n(t), this.removeEventListener("transitionend", i); | ||
e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i(r) { | ||
r.target == t && (t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), n(t), this.removeEventListener("transitionend", i)); | ||
})) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), n(t)); | ||
@@ -179,0 +179,0 @@ }); |
@@ -149,8 +149,8 @@ var S = (t, e, s) => { | ||
const J = (t, e) => new Promise((s) => { | ||
e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i() { | ||
t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), s(t), this.removeEventListener("transitionend", i); | ||
e.transition ? (t.classList.remove(e.stateClosed), t.classList.add(e.stateOpening), t.addEventListener("transitionend", function i(n) { | ||
n.target == t && (t.classList.add(e.stateOpened), t.classList.remove(e.stateOpening), s(t), this.removeEventListener("transitionend", i)); | ||
})) : (t.classList.add(e.stateOpened), t.classList.remove(e.stateClosed), s(t)); | ||
}), z = (t, e) => new Promise((s) => { | ||
e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i() { | ||
t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), s(t), this.removeEventListener("transitionend", i); | ||
e.transition ? (t.classList.add(e.stateClosing), t.classList.remove(e.stateOpened), t.addEventListener("transitionend", function i(n) { | ||
n.target == t && (t.classList.remove(e.stateClosing), t.classList.add(e.stateClosed), s(t), this.removeEventListener("transitionend", i)); | ||
})) : (t.classList.add(e.stateClosed), t.classList.remove(e.stateOpened), s(t)); | ||
@@ -157,0 +157,0 @@ }); |
{ | ||
"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.1", | ||
"version": "4.0.0-next.2", | ||
"license": "MIT", | ||
@@ -56,3 +56,3 @@ "type": "module", | ||
"dependencies": { | ||
"@vrembem/core": "^4.0.0-next.1" | ||
"@vrembem/core": "^4.0.0-next.2" | ||
}, | ||
@@ -59,0 +59,0 @@ "publishConfig": { |
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
287951
Updated@vrembem/core@^4.0.0-next.2