Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@flexilla/offcanvas

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@flexilla/offcanvas - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

2

dist/index.d.ts

@@ -12,2 +12,4 @@ declare type BackdropHidden = {

export declare const fOffcanvas: (offcanvas: string | HTMLElement, options?: OffcanvasOptions) => OffCanvas;
/**

@@ -14,0 +16,0 @@ * Class representing an Offcanvas element.

70

dist/offcanvas.js

@@ -1,5 +0,5 @@

var C = Object.defineProperty;
var E = (e, t, s) => t in e ? C(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var n = (e, t, s) => (E(e, typeof t != "symbol" ? t + "" : t, s), s);
const c = (e, t = document.body) => t.querySelector(e), l = (e, t = document.body) => Array.from(t.querySelectorAll(e)), u = ({
var u = Object.defineProperty;
var C = (e, t, s) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
var n = (e, t, s) => (C(e, typeof t != "symbol" ? t + "" : t, s), s);
const c = (e, t = document.body) => t.querySelector(e), l = (e, t = document.body) => Array.from(t.querySelectorAll(e)), E = ({
newElement: e,

@@ -20,3 +20,3 @@ existingElement: t

const s = getComputedStyle(e).transition;
s !== "none" && s !== "" && s !== "all 0s ease 0s" ? e.addEventListener(
s !== "none" && s !== "" && s !== "all 0s ease 0s" && s !== "all" ? e.addEventListener(
"transitionend",

@@ -36,9 +36,10 @@ function a() {

return s || "";
}, g = (e, t) => {
t.removeChild(e);
}, m = (e, t) => {
p({
}, g = (e) => {
var t;
return (t = e.parentElement) == null ? void 0 : t.removeChild(e);
}, m = (e) => {
e.setAttribute("data-state", "invisible"), p({
element: e,
callback() {
g(e, t);
g(e);
}

@@ -54,5 +55,5 @@ });

return;
const f = i.split(" ");
return i !== "" && a.classList.add(...f), a;
}, v = (e, t, s) => {
const r = i.split(" ");
return i !== "" && a.classList.add(...r), a;
}, h = (e, t, s) => {
e.setAttribute("aria-hidden", s === "open" ? "false" : "true"), e.setAttribute("data-state", s), t || O(s);

@@ -66,3 +67,3 @@ }, O = (e) => {

const s = c(`[data-fx-offcanvas-overlay][data-offcanvas-el=${e.getAttribute("id")}]`, e.parentElement);
s instanceof HTMLElement && m(s, e.parentElement);
s instanceof HTMLElement && m(s);
}, A = (e) => {

@@ -73,3 +74,3 @@ const t = l("[data-fx-offcanvas][data-state=open]");

k(s, e);
}, r = class r {
}, f = class f {
/**

@@ -88,9 +89,17 @@ * Offcanvas Component

n(this, "backdrop");
n(this, "closeOffCanvas", () => {
const t = this.offCanvasElement.getAttribute("id"), s = c(`[data-fx-offcanvas-overlay][data-offcanvas-el=${t}]`);
s instanceof HTMLElement && m(s), h(
this.offCanvasElement,
this.allowBodyScroll,
"close"
), document.removeEventListener("keydown", this.closeWithEsc), !this.allowBodyScroll && !s && document.removeEventListener("click", (a) => this.closeWhenClickOutSide(a));
});
const a = typeof t == "string" ? c(t) : t;
if (!(a instanceof HTMLElement))
throw new Error("Invalid Offcanvas, the provided Element is not a valid HTMLElement");
const { staticBackdrop: o, allowBodyScroll: i, backdrop: f } = s;
const { staticBackdrop: o, allowBodyScroll: i, backdrop: r } = s;
this.offCanvasElement = a, this.setupAttributes(), this.staticBackdrop = o || a.hasAttribute("data-static-backdrop") && a.dataset.staticBackdrop !== "false" || !1, this.allowBodyScroll = i || a.hasAttribute("data-allow-body-scroll") && a.dataset.allowBodyScroll !== "false" || !1;
const d = this.offCanvasElement.getAttribute("id");
this.offCanvasTriggers = this.findOffCanvasElements("[data-offcanvas-trigger]", !1, d), this.offCanvasCloseBtns = this.findOffCanvasElements("[data-offcanvas-close]", !0, d, this.offCanvasElement), this.backdrop = f, this.backdropClass = this.offCanvasElement.dataset.offcanvasBackdrop || "", this.init();
const v = this.offCanvasElement.getAttribute("id");
this.offCanvasTriggers = this.findOffCanvasElements("[data-offcanvas-trigger]", !1, v), this.offCanvasCloseBtns = this.findOffCanvasElements("[data-offcanvas-close]", !0, v, this.offCanvasElement), this.backdrop = r, this.backdropClass = this.offCanvasElement.dataset.offcanvasBackdrop || "", this.init();
}

@@ -110,13 +119,4 @@ findOffCanvasElements(t, s, a, o) {

}
closeOffCanvas() {
v(
this.offCanvasElement,
this.allowBodyScroll,
"close"
);
const t = this.offCanvasElement.getAttribute("id"), s = c(`[data-fx-offcanvas-overlay][data-offcanvas-el=${t}]`, this.offCanvasElement.parentElement);
s instanceof HTMLElement && m(s, this.offCanvasElement.parentElement), document.removeEventListener("keydown", this.closeWithEsc), !this.allowBodyScroll && !s && document.removeEventListener("click", (a) => this.closeWhenClickOutSide(a));
}
openOffCanvas() {
A(this.offCanvasElement), v(
A(this.offCanvasElement), h(
this.offCanvasElement,

@@ -131,5 +131,3 @@ this.allowBodyScroll,

);
s instanceof HTMLElement && (u({ newElement: s, existingElement: this.offCanvasElement }), this.staticBackdrop || s.addEventListener("click", () => {
this.closeOffCanvas();
})), document.addEventListener("keydown", (a) => this.closeWithEsc(a));
s instanceof HTMLElement && (E({ newElement: s, existingElement: this.offCanvasElement }), this.staticBackdrop || s.addEventListener("click", this.closeOffCanvas)), document.addEventListener("keydown", (a) => this.closeWithEsc(a));
}

@@ -167,10 +165,12 @@ /**

*/
n(r, "autoInit", (t = "[data-fx-offcanvas]") => {
n(f, "autoInit", (t = "[data-fx-offcanvas]") => {
const s = l(t);
for (const a of s)
new r(a);
new f(a);
});
let h = r;
let d = f;
const B = (e, t = {}) => new d(e, t);
export {
h as OffCanvas
d as OffCanvas,
B as fOffcanvas
};
{
"name": "@flexilla/offcanvas",
"private": false,
"version": "2.0.2",
"version": "2.0.3",
"type": "module",

@@ -67,3 +67,4 @@ "description": "An offcanvas component for creating responsive and off-screen navigation panels in web applications.",

"license": "MIT",
"author": "johnkat-mj"
"author": "johnkat-mj",
"gitHead": "98932fa7279389be90368e974e58fab0fb1ba654"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc