easy-toggler
Advanced tools
Comparing version 2.2.6 to 2.2.7
# CHANGELOG | ||
## 2.2.6 - 2022-08-17 | ||
### Fixes | ||
- fix .npmignore | ||
## 2.2.5 - 2022-08-17 | ||
@@ -4,0 +10,0 @@ |
/*! | ||
* EasyToggler v2.2.6 (https://github.com/rah-emil/easy-toggler#readme) | ||
* EasyToggler v2.2.7 (https://github.com/rah-emil/easy-toggler#readme) | ||
* Copyright 2022 Rah Emil <013131@mail.ru> | ||
@@ -10,4 +10,2 @@ * Licensed under MIT (https://github.com/rah-emil/easy-toggler/blob/master/LICENSE) | ||
const toggle = ($toggler, attrs) => { | ||
attrs.onToggle($toggler); | ||
const _target = $toggler.getAttribute(attrs.toggle); | ||
@@ -33,7 +31,7 @@ | ||
} | ||
attrs.onToggle($toggler); | ||
}; | ||
const add = ($add, attrs) => { | ||
attrs.onAdd($add); | ||
const _target = $add.getAttribute(attrs.add); | ||
@@ -52,7 +50,7 @@ | ||
} | ||
attrs.onAdd($add); | ||
}; | ||
const remove = ($remove, attrs) => { | ||
attrs.onRemove($remove); | ||
const _target = $remove.getAttribute(attrs.remove); | ||
@@ -71,2 +69,4 @@ | ||
} | ||
attrs.onRemove($remove); | ||
}; | ||
@@ -81,3 +81,2 @@ | ||
if (!e.target.closest(block)) { | ||
attrs.onRcoe($rcoe); | ||
document.querySelector(block)?.classList.remove(block_class); | ||
@@ -90,2 +89,4 @@ | ||
} | ||
attrs.onRcoe($rcoe); | ||
} | ||
@@ -92,0 +93,0 @@ }); |
/*! | ||
* EasyToggler v2.2.6 (https://github.com/rah-emil/easy-toggler#readme) | ||
* EasyToggler v2.2.7 (https://github.com/rah-emil/easy-toggler#readme) | ||
* Copyright 2022 Rah Emil <013131@mail.ru> | ||
* Licensed under MIT (https://github.com/rah-emil/easy-toggler/blob/master/LICENSE) | ||
*/ | ||
!function(){"use strict";function e(e,t){const s=e.target.closest(`[${t.toggle}]`),o=e.target.closest(`[${t.remove}]`),l=e.target.closest(`[${t.add}]`);s&&(e.preventDefault(),((e,t)=>{t.onToggle(e);const s=e.getAttribute(t.toggle);document.querySelectorAll(`[${t.toggle}]`).forEach((s=>{if(!s.hasAttribute(t.parallel)&&s!==e){document.querySelector(s.getAttribute(t.toggle)).classList.remove(s.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.remove(o)}})),document.querySelector(s)?.classList.toggle(e.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.toggle(o)})(s,t)),o&&(e.preventDefault(),((e,t)=>{t.onRemove(e);const s=e.getAttribute(t.remove),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.remove(o)}));const l=e.getAttribute(t.self);l&&e.classList.remove(l)})(o,t)),l&&(e.preventDefault(),((e,t)=>{t.onAdd(e);const s=e.getAttribute(t.add),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.add(o)}));const l=e.getAttribute(t.self);l&&e.classList.add(l)})(l,t)),s||o||l||((e,t)=>{const s=document.querySelectorAll(`[${t.rcoe}]`);Array.from(s).forEach((s=>{let o=s.getAttribute(t.toggle),l=s.getAttribute(t.class);if(!e.target.closest(o)){t.onRcoe(s),document.querySelector(o)?.classList.remove(l);const e=s.getAttribute(t.self);e&&s.classList.remove(e)}}))})(e,t)}const t={toggle:"easy-toggle",add:"easy-add",remove:"easy-remove",class:"easy-class",rcoe:"easy-rcoe",parallel:"easy-parallel",self:"easy-self",selfRcoe:"easy-self-rcoe",onToggle(e){},onAdd(e){},onRemove(e){},onRcoe(e){}};document.addEventListener("DOMContentLoaded",(()=>{document.addEventListener("click",(s=>{e(s,t)}))}))}(); | ||
!function(){"use strict";function e(e,t){const s=e.target.closest(`[${t.toggle}]`),o=e.target.closest(`[${t.remove}]`),l=e.target.closest(`[${t.add}]`);s&&(e.preventDefault(),((e,t)=>{const s=e.getAttribute(t.toggle);document.querySelectorAll(`[${t.toggle}]`).forEach((s=>{if(!s.hasAttribute(t.parallel)&&s!==e){document.querySelector(s.getAttribute(t.toggle)).classList.remove(s.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.remove(o)}})),document.querySelector(s)?.classList.toggle(e.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.toggle(o),t.onToggle(e)})(s,t)),o&&(e.preventDefault(),((e,t)=>{const s=e.getAttribute(t.remove),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.remove(o)}));const l=e.getAttribute(t.self);l&&e.classList.remove(l),t.onRemove(e)})(o,t)),l&&(e.preventDefault(),((e,t)=>{const s=e.getAttribute(t.add),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.add(o)}));const l=e.getAttribute(t.self);l&&e.classList.add(l),t.onAdd(e)})(l,t)),s||o||l||((e,t)=>{const s=document.querySelectorAll(`[${t.rcoe}]`);Array.from(s).forEach((s=>{let o=s.getAttribute(t.toggle),l=s.getAttribute(t.class);if(!e.target.closest(o)){document.querySelector(o)?.classList.remove(l);const e=s.getAttribute(t.self);e&&s.classList.remove(e),t.onRcoe(s)}}))})(e,t)}const t={toggle:"easy-toggle",add:"easy-add",remove:"easy-remove",class:"easy-class",rcoe:"easy-rcoe",parallel:"easy-parallel",self:"easy-self",selfRcoe:"easy-self-rcoe",onToggle(e){},onAdd(e){},onRemove(e){},onRcoe(e){}};document.addEventListener("DOMContentLoaded",(()=>{document.addEventListener("click",(s=>{e(s,t)}))}))}(); | ||
//# sourceMappingURL=easy-toggler.iife.min.js.map |
/*! | ||
* EasyToggler v2.2.6 (https://github.com/rah-emil/easy-toggler#readme) | ||
* EasyToggler v2.2.7 (https://github.com/rah-emil/easy-toggler#readme) | ||
* Copyright 2022 Rah Emil <013131@mail.ru> | ||
@@ -7,4 +7,2 @@ * Licensed under MIT (https://github.com/rah-emil/easy-toggler/blob/master/LICENSE) | ||
const toggle = ($toggler, attrs) => { | ||
attrs.onToggle($toggler); | ||
const _target = $toggler.getAttribute(attrs.toggle); | ||
@@ -30,7 +28,7 @@ | ||
} | ||
attrs.onToggle($toggler); | ||
}; | ||
const add = ($add, attrs) => { | ||
attrs.onAdd($add); | ||
const _target = $add.getAttribute(attrs.add); | ||
@@ -49,7 +47,7 @@ | ||
} | ||
attrs.onAdd($add); | ||
}; | ||
const remove = ($remove, attrs) => { | ||
attrs.onRemove($remove); | ||
const _target = $remove.getAttribute(attrs.remove); | ||
@@ -68,2 +66,4 @@ | ||
} | ||
attrs.onRemove($remove); | ||
}; | ||
@@ -78,3 +78,2 @@ | ||
if (!e.target.closest(block)) { | ||
attrs.onRcoe($rcoe); | ||
document.querySelector(block)?.classList.remove(block_class); | ||
@@ -87,2 +86,4 @@ | ||
} | ||
attrs.onRcoe($rcoe); | ||
} | ||
@@ -89,0 +90,0 @@ }); |
/*! | ||
* EasyToggler v2.2.6 (https://github.com/rah-emil/easy-toggler#readme) | ||
* EasyToggler v2.2.7 (https://github.com/rah-emil/easy-toggler#readme) | ||
* Copyright 2022 Rah Emil <013131@mail.ru> | ||
* Licensed under MIT (https://github.com/rah-emil/easy-toggler/blob/master/LICENSE) | ||
*/ | ||
function e(e,t){const s=e.target.closest(`[${t.toggle}]`),o=e.target.closest(`[${t.remove}]`),l=e.target.closest(`[${t.add}]`);s&&(e.preventDefault(),((e,t)=>{t.onToggle(e);const s=e.getAttribute(t.toggle);document.querySelectorAll(`[${t.toggle}]`).forEach((s=>{if(!s.hasAttribute(t.parallel)&&s!==e){document.querySelector(s.getAttribute(t.toggle)).classList.remove(s.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.remove(o)}})),document.querySelector(s)?.classList.toggle(e.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.toggle(o)})(s,t)),o&&(e.preventDefault(),((e,t)=>{t.onRemove(e);const s=e.getAttribute(t.remove),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.remove(o)}));const l=e.getAttribute(t.self);l&&e.classList.remove(l)})(o,t)),l&&(e.preventDefault(),((e,t)=>{t.onAdd(e);const s=e.getAttribute(t.add),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.add(o)}));const l=e.getAttribute(t.self);l&&e.classList.add(l)})(l,t)),s||o||l||((e,t)=>{const s=document.querySelectorAll(`[${t.rcoe}]`);Array.from(s).forEach((s=>{let o=s.getAttribute(t.toggle),l=s.getAttribute(t.class);if(!e.target.closest(o)){t.onRcoe(s),document.querySelector(o)?.classList.remove(l);const e=s.getAttribute(t.self);e&&s.classList.remove(e)}}))})(e,t)}const t={toggle:"easy-toggle",add:"easy-add",remove:"easy-remove",class:"easy-class",rcoe:"easy-rcoe",parallel:"easy-parallel",self:"easy-self",selfRcoe:"easy-self-rcoe",onToggle(e){},onAdd(e){},onRemove(e){},onRcoe(e){}},s=s=>{const o={...t,...s};document.addEventListener("click",(t=>{e(t,o)}))};export{s as default}; | ||
function e(e,t){const s=e.target.closest(`[${t.toggle}]`),o=e.target.closest(`[${t.remove}]`),l=e.target.closest(`[${t.add}]`);s&&(e.preventDefault(),((e,t)=>{const s=e.getAttribute(t.toggle);document.querySelectorAll(`[${t.toggle}]`).forEach((s=>{if(!s.hasAttribute(t.parallel)&&s!==e){document.querySelector(s.getAttribute(t.toggle)).classList.remove(s.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.remove(o)}})),document.querySelector(s)?.classList.toggle(e.getAttribute(t.class));const o=e.getAttribute(t.self);o&&e.classList.toggle(o),t.onToggle(e)})(s,t)),o&&(e.preventDefault(),((e,t)=>{const s=e.getAttribute(t.remove),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.remove(o)}));const l=e.getAttribute(t.self);l&&e.classList.remove(l),t.onRemove(e)})(o,t)),l&&(e.preventDefault(),((e,t)=>{const s=e.getAttribute(t.add),o=e.getAttribute(t.class);document.querySelectorAll(s).forEach((e=>{e.classList.add(o)}));const l=e.getAttribute(t.self);l&&e.classList.add(l),t.onAdd(e)})(l,t)),s||o||l||((e,t)=>{const s=document.querySelectorAll(`[${t.rcoe}]`);Array.from(s).forEach((s=>{let o=s.getAttribute(t.toggle),l=s.getAttribute(t.class);if(!e.target.closest(o)){document.querySelector(o)?.classList.remove(l);const e=s.getAttribute(t.self);e&&s.classList.remove(e),t.onRcoe(s)}}))})(e,t)}const t={toggle:"easy-toggle",add:"easy-add",remove:"easy-remove",class:"easy-class",rcoe:"easy-rcoe",parallel:"easy-parallel",self:"easy-self",selfRcoe:"easy-self-rcoe",onToggle(e){},onAdd(e){},onRemove(e){},onRcoe(e){}},s=s=>{const o={...t,...s};document.addEventListener("click",(t=>{e(t,o)}))};export{s as default}; | ||
//# sourceMappingURL=easy-toggler.min.js.map |
{ | ||
"name": "easy-toggler", | ||
"version": "2.2.6", | ||
"version": "2.2.7", | ||
"description": "Simple class switcher on web elements. JavaScript only.", | ||
@@ -5,0 +5,0 @@ "main": "dist/easy-toggler.cjs", |
@@ -146,5 +146,5 @@ # EasyToggler.js 🔗🚀 | ||
## Hooks | ||
- **onToggle($el)** - hook before toggle action | ||
- **onAdd($el)** - hook before add action | ||
- **onRemove($el)** - hook before remove action | ||
- **onRcoe($el)** - hook before rcoe action | ||
- **onToggle($el)** - hook after action toggle | ||
- **onAdd($el)** - hook after action add | ||
- **onRemove($el)** - hook after action remove | ||
- **onRcoe($el)** - hook after action rcoe |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
853526