@flexilla/dismissible 2.0.3 → 2.0.6

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 UnifyUI Dev
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 UnifyUI Dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,39 +1,39 @@
1
- # @flexilla/dismissible | Dismissible Component
2
-
3
- `@flexilla/dismissible` is a lightweight package that provides a way to dismiss elements from the DOM or hide them from the screen.
4
-
5
- ## Installation
6
-
7
- ```shell
8
- npm install @flexilla/dismissible
9
- ```
10
- Import
11
- ```js
12
- import Dismissible from '@flexilla/dismissible';
13
- ```
14
-
15
- ## Params
16
-
17
- | Name | Description | Data Attributes | Type | | --------------------- | -------------------------------------- | --------------- | -------------------- | | dismissibleElement | The element to be dismissed. | - | HTMLElement | | action | The action to perform when dismissing the element. Available options: "remove-from-dom", "hide-from-screen". | data-action | "remove-from-dom" \| "hide-from-screen" | | onDismiss | The callback function to be executed when the element is dismissed. | - | () => void |
18
-
19
- ## Example
20
- ```html
21
- <div class="dismissable-element" data-action="remove-from-dom">
22
- <button class="dismiss-button" data-dismiss-btn>Dismiss</button>
23
- </div>
24
-
25
- <script>
26
- const dismissible = new Dismissible('.dismissable-element',
27
- action: "remove-from-dom",
28
- onDismiss: () => {
29
- console.log("Element dismissed!");
30
- });
31
-
32
- // or
33
- fDismissible('.dismissable-element',
34
- action: "remove-from-dom",
35
- onDismiss: () => {
36
- console.log("Element dismissed!");
37
- })
38
- </script>
1
+ # @flexilla/dismissible | Dismissible Component
2
+
3
+ `@flexilla/dismissible` is a lightweight package that provides a way to dismiss elements from the DOM or hide them from the screen.
4
+
5
+ ## Installation
6
+
7
+ ```shell
8
+ npm install @flexilla/dismissible
9
+ ```
10
+ Import
11
+ ```js
12
+ import Dismissible from '@flexilla/dismissible';
13
+ ```
14
+
15
+ ## Params
16
+
17
+ | Name | Description | Data Attributes | Type | | --------------------- | -------------------------------------- | --------------- | -------------------- | | dismissibleElement | The element to be dismissed. | - | HTMLElement | | action | The action to perform when dismissing the element. Available options: "remove-from-dom", "hide-from-screen". | data-action | "remove-from-dom" \| "hide-from-screen" | | onDismiss | The callback function to be executed when the element is dismissed. | - | () => void |
18
+
19
+ ## Example
20
+ ```html
21
+ <div class="dismissable-element" data-action="remove-from-dom">
22
+ <button class="dismiss-button" data-dismiss-btn>Dismiss</button>
23
+ </div>
24
+
25
+ <script>
26
+ const dismissible = new Dismissible('.dismissable-element',
27
+ action: "remove-from-dom",
28
+ onDismiss: () => {
29
+ console.log("Element dismissed!");
30
+ });
31
+
32
+ // or
33
+ fDismissible('.dismissable-element',
34
+ action: "remove-from-dom",
35
+ onDismiss: () => {
36
+ console.log("Element dismissed!");
37
+ })
38
+ </script>
39
39
  ```
@@ -1,38 +1,38 @@
1
1
  var b = Object.defineProperty;
2
- var u = (t, e, s) => e in t ? b(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
3
- var i = (t, e, s) => u(t, typeof e != "symbol" ? e + "" : e, s);
4
- const E = (t, e = document.body) => e.querySelector(t), r = (t, e = document.body) => Array.from(e.querySelectorAll(t)), f = ({
5
- element: t,
2
+ var u = (s, e, t) => e in s ? b(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
3
+ var i = (s, e, t) => u(s, typeof e != "symbol" ? e + "" : e, t);
4
+ const E = (s, e = document.body) => e.querySelector(s), r = (s, e = document.body) => Array.from(e.querySelectorAll(s)), f = ({
5
+ element: s,
6
6
  callback: e,
7
- type: s,
7
+ type: t,
8
8
  keysCheck: n
9
9
  }) => {
10
- const l = getComputedStyle(t), o = s === "transition" ? l.transition : l.animation;
11
- if (o !== "none" && o !== "" && !n.includes(o)) {
12
- const d = s === "transition" ? "transitionend" : "animationend", a = () => {
13
- t.removeEventListener(d, a), e();
10
+ const m = getComputedStyle(s), d = m.transition;
11
+ if (d !== "none" && d !== "" && !n.includes(d)) {
12
+ const o = "transitionend", a = () => {
13
+ s.removeEventListener(o, a), e();
14
14
  };
15
- t.addEventListener(d, a, { once: !0 });
15
+ s.addEventListener(o, a, { once: !0 });
16
16
  } else
17
17
  e();
18
18
  }, c = ({
19
- element: t,
19
+ element: s,
20
20
  callback: e
21
21
  }) => {
22
22
  f({
23
- element: t,
23
+ element: s,
24
24
  callback: e,
25
25
  type: "transition",
26
26
  keysCheck: ["all 0s ease 0s", "all"]
27
27
  });
28
- }, m = class m {
28
+ }, l = class l {
29
29
  /**
30
30
  * Dismissible Component
31
31
  * @param dismissible
32
32
  * @param action
33
33
  * @param onDissmiss
34
34
  */
35
- constructor(e, s, n) {
35
+ constructor(e, t, n) {
36
36
  i(this, "dismissibleElement");
37
37
  i(this, "dismissButtons");
38
38
  i(this, "action");
@@ -42,8 +42,8 @@ const E = (t, e = document.body) => e.querySelector(t), r = (t, e = document.bod
42
42
  this.dismissibleElement.style.display = "none", (e = this.onDismiss) == null || e.call(this);
43
43
  });
44
44
  i(this, "removeFromDom", () => {
45
- var e, s;
46
- (e = this.onDismiss) == null || e.call(this), (s = this.dismissibleElement.parentElement) == null || s.removeChild(this.dismissibleElement);
45
+ var e, t;
46
+ (e = this.onDismiss) == null || e.call(this), (t = this.dismissibleElement.parentElement) == null || t.removeChild(this.dismissibleElement);
47
47
  });
48
48
  i(this, "dismiss", () => {
49
49
  switch (this.action) {
@@ -61,9 +61,9 @@ const E = (t, e = document.body) => e.querySelector(t), r = (t, e = document.bod
61
61
  break;
62
62
  }
63
63
  });
64
- const l = typeof e == "string" ? E(e, document.body) : e;
65
- if (!(l instanceof HTMLElement)) throw new Error("Provided Element not a valid HTMLElement");
66
- this.dismissibleElement = l, this.action = s || this.dismissibleElement.dataset.action || "hide-from-screen", this.dismissButtons = r("[data-dismiss-btn]", this.dismissibleElement), this.onDismiss = n, this.dismissibleElement.setAttribute("aria-hidden", "false"), this.setupDismissible();
64
+ const m = typeof e == "string" ? E(e, document.body) : e;
65
+ if (!(m instanceof HTMLElement)) throw new Error("Provided Element not a valid HTMLElement");
66
+ this.dismissibleElement = m, this.action = t || this.dismissibleElement.dataset.action || "hide-from-screen", this.dismissButtons = r("[data-dismiss-btn]", this.dismissibleElement), this.onDismiss = n, this.dismissibleElement.setAttribute("aria-hidden", "false"), this.setupDismissible();
67
67
  }
68
68
  setupDismissible() {
69
69
  for (const e of this.dismissButtons)
@@ -74,9 +74,9 @@ const E = (t, e = document.body) => e.querySelector(t), r = (t, e = document.bod
74
74
  * auto init Dismissible Element based on the selector provided
75
75
  * @param selector {string} default is [data-fx-dismissible]
76
76
  */
77
- i(m, "autoInit", (e = "[data-fx-dismissible]") => {
78
- const s = r(e);
79
- for (const n of s) new m(n);
77
+ i(l, "autoInit", (e = "[data-fx-dismissible]") => {
78
+ const t = r(e);
79
+ for (const n of t) new l(n);
80
80
  }), /**
81
81
  *
82
82
  * @param dismissible
@@ -84,8 +84,8 @@ i(m, "autoInit", (e = "[data-fx-dismissible]") => {
84
84
  * @param onDissmiss
85
85
  * @returns
86
86
  */
87
- i(m, "init", (e, s, n) => new m(e, s, n));
88
- let h = m;
87
+ i(l, "init", (e, t, n) => new l(e, t, n));
88
+ let h = l;
89
89
  export {
90
90
  h as Dismissible
91
91
  };
@@ -1 +1 @@
1
- (function(i,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i["@flexilla/dismissible"]={}))})(this,function(i){"use strict";var E=Object.defineProperty;var y=(i,s,o)=>s in i?E(i,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):i[s]=o;var n=(i,s,o)=>y(i,typeof s!="symbol"?s+"":s,o);const s=(l,e=document.body)=>e.querySelector(l),o=(l,e=document.body)=>Array.from(e.querySelectorAll(l)),f=({element:l,callback:e,type:t,keysCheck:d})=>{const a=getComputedStyle(l),c=t==="transition"?a.transition:a.animation;if(c!=="none"&&c!==""&&!d.includes(c)){const b=t==="transition"?"transitionend":"animationend",u=()=>{l.removeEventListener(b,u),e()};l.addEventListener(b,u,{once:!0})}else e()},h=({element:l,callback:e})=>{f({element:l,callback:e,type:"transition",keysCheck:["all 0s ease 0s","all"]})},m=class m{constructor(e,t,d){n(this,"dismissibleElement");n(this,"dismissButtons");n(this,"action");n(this,"onDismiss");n(this,"hideFromScreen",()=>{var e;this.dismissibleElement.style.display="none",(e=this.onDismiss)==null||e.call(this)});n(this,"removeFromDom",()=>{var e,t;(e=this.onDismiss)==null||e.call(this),(t=this.dismissibleElement.parentElement)==null||t.removeChild(this.dismissibleElement)});n(this,"dismiss",()=>{switch(this.action){case"hide-from-screen":this.dismissibleElement.setAttribute("aria-hidden","true"),this.dismissibleElement.setAttribute("data-state","hidden"),h({element:this.dismissibleElement,callback:this.hideFromScreen});break;default:this.dismissibleElement.setAttribute("data-hidden",""),this.dismissibleElement.setAttribute("aria-hidden","true"),this.dismissibleElement.setAttribute("data-state","removed"),h({element:this.dismissibleElement,callback:this.removeFromDom});break}});const a=typeof e=="string"?s(e,document.body):e;if(!(a instanceof HTMLElement))throw new Error("Provided Element not a valid HTMLElement");this.dismissibleElement=a,this.action=t||this.dismissibleElement.dataset.action||"hide-from-screen",this.dismissButtons=o("[data-dismiss-btn]",this.dismissibleElement),this.onDismiss=d,this.dismissibleElement.setAttribute("aria-hidden","false"),this.setupDismissible()}setupDismissible(){for(const e of this.dismissButtons)e.addEventListener("click",this.dismiss)}};n(m,"autoInit",(e="[data-fx-dismissible]")=>{const t=o(e);for(const d of t)new m(d)}),n(m,"init",(e,t,d)=>new m(e,t,d));let r=m;i.Dismissible=r,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(i=typeof globalThis<"u"?globalThis:i||self,s(i["@flexilla/dismissible"]={}))})(this,function(i){"use strict";var E=Object.defineProperty;var y=(i,s,d)=>s in i?E(i,s,{enumerable:!0,configurable:!0,writable:!0,value:d}):i[s]=d;var t=(i,s,d)=>y(i,typeof s!="symbol"?s+"":s,d);const s=(n,e=document.body)=>e.querySelector(n),d=(n,e=document.body)=>Array.from(e.querySelectorAll(n)),f=({element:n,callback:e,type:l,keysCheck:m})=>{const a=getComputedStyle(n),c=a.transition;if(c!=="none"&&c!==""&&!m.includes(c)){const b="transitionend",u=()=>{n.removeEventListener(b,u),e()};n.addEventListener(b,u,{once:!0})}else e()},h=({element:n,callback:e})=>{f({element:n,callback:e,type:"transition",keysCheck:["all 0s ease 0s","all"]})},o=class o{constructor(e,l,m){t(this,"dismissibleElement");t(this,"dismissButtons");t(this,"action");t(this,"onDismiss");t(this,"hideFromScreen",()=>{var e;this.dismissibleElement.style.display="none",(e=this.onDismiss)==null||e.call(this)});t(this,"removeFromDom",()=>{var e,l;(e=this.onDismiss)==null||e.call(this),(l=this.dismissibleElement.parentElement)==null||l.removeChild(this.dismissibleElement)});t(this,"dismiss",()=>{switch(this.action){case"hide-from-screen":this.dismissibleElement.setAttribute("aria-hidden","true"),this.dismissibleElement.setAttribute("data-state","hidden"),h({element:this.dismissibleElement,callback:this.hideFromScreen});break;default:this.dismissibleElement.setAttribute("data-hidden",""),this.dismissibleElement.setAttribute("aria-hidden","true"),this.dismissibleElement.setAttribute("data-state","removed"),h({element:this.dismissibleElement,callback:this.removeFromDom});break}});const a=typeof e=="string"?s(e,document.body):e;if(!(a instanceof HTMLElement))throw new Error("Provided Element not a valid HTMLElement");this.dismissibleElement=a,this.action=l||this.dismissibleElement.dataset.action||"hide-from-screen",this.dismissButtons=d("[data-dismiss-btn]",this.dismissibleElement),this.onDismiss=m,this.dismissibleElement.setAttribute("aria-hidden","false"),this.setupDismissible()}setupDismissible(){for(const e of this.dismissButtons)e.addEventListener("click",this.dismiss)}};t(o,"autoInit",(e="[data-fx-dismissible]")=>{const l=d(e);for(const m of l)new o(m)}),t(o,"init",(e,l,m)=>new o(e,l,m));let r=o;i.Dismissible=r,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@flexilla/dismissible",
3
3
  "private": false,
4
- "version": "2.0.3",
4
+ "version": "2.0.6",
5
5
  "type": "module",
6
6
  "description": "A lightweight JavaScript component that automatically makes a component dismissible for easy user interaction.",
7
7
  "publishConfig": {
@@ -34,11 +34,9 @@
34
34
  "scripts": {
35
35
  "dev": "vite",
36
36
  "build": "tsc && vite build",
37
- "preview": "vite preview",
38
- "format": "biome format --write ./src"
37
+ "preview": "vite preview"
39
38
  },
40
39
  "devDependencies": {
41
- "@biomejs/biome": "1.5.1",
42
40
  "@flexilla/utilities": "latest",
43
41
  "typescript": "^5.2.2",
44
42
  "vite": "^5.0.8",
@@ -57,12 +55,11 @@
57
55
  "homepage": "",
58
56
  "repository": {
59
57
  "type": "git",
60
- "url": "https://github.com/unify-ui-dev/flexilla"
58
+ "url": "https://github.com/unoforge/flexilla"
61
59
  },
62
60
  "bugs": {
63
- "url": "https://github.com/unify-ui-dev/flexilla/issues"
61
+ "url": "https://github.com/unoforge/flexilla/issues"
64
62
  },
65
63
  "license": "MIT",
66
- "author": "johnkat-mj",
67
- "gitHead": "2eb26c556c72eb0c607dfc2de61b3ca6ef3128c9"
64
+ "author": "johnkat-mj"
68
65
  }