diff --git a/CHANGELOG.md b/CHANGELOG.md index a00edf5..bd5a310 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change Log +## 1.1.8 + +*2024-02-06* + +- Fix GitHub workflow badge + ## 1.1.7 *2022-08-16* diff --git a/dist/class-change.esm.js b/dist/class-change.esm.js index 7e7f410..e37670f 100644 --- a/dist/class-change.esm.js +++ b/dist/class-change.esm.js @@ -1,8 +1,8 @@ /*! * class-change - * v1.1.7 + * v1.1.8 * https://jhildenbiddle.github.io/class-change - * (c) 2016-2022 John Hildenbiddle + * (c) 2016-2024 John Hildenbiddle * MIT license */ function classNamesToArray(classNames) { diff --git a/dist/class-change.esm.min.js b/dist/class-change.esm.min.js index 4101f71..4f4e162 100644 --- a/dist/class-change.esm.min.js +++ b/dist/class-change.esm.min.js @@ -1,8 +1,8 @@ /*! * class-change - * v1.1.7 + * v1.1.8 * https://jhildenbiddle.github.io/class-change - * (c) 2016-2022 John Hildenbiddle + * (c) 2016-2024 John Hildenbiddle * MIT license */ function t(t){return"string"==typeof t&&(t=t.trim().replace(/\s+/g," ").split(" ")),Array.isArray(t)&&(t=(t=t.map((function(t){return t&&t.length?t.trim():null}))).filter(Boolean)),t}function e(t){return"string"==typeof t?t=Array.apply(null,document.querySelectorAll(t)):t instanceof window.HTMLCollection||t instanceof window.NodeList?t=Array.apply(null,t):t&&!Array.isArray(t)&&(t=[t]),Array.isArray(t)?t.filter((function(t,e,n){return n.indexOf(t)===e})):[]}function n(t,e){for(var n=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector,a=[],r=t.parentNode;r&&r!==document;)(!e||e&&n.call(r,e))&&a.push(r),r=r.parentNode;return a}function a(t,e){return(t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector).call(t,e)}function r(n,a){var r=e(n);return r.forEach((function(e,n){var r=t(a instanceof Function?a(e,n):a);if(r&&r.length){var c=e.className.length?e.className.split(" "):[],o=r.filter((function(t){return-1===c.indexOf(t)})),i=c.concat(o);e.className=i.join(" ")}})),1===r.length?r[0]:r}function c(n,a){var r=e(n);return r.forEach((function(e,n){var r=t(a instanceof Function?a(e,n):a);if(e.className.trim().length&&r&&r.length){var c=e.className.split(" ").filter((function(t){return-1===r.indexOf(t)}));c.length?e.className=c.join(" "):e.removeAttribute("class")}})),1===r.length?r[0]:r}var o={add:r,remove:c};function i(n,a,r){if(!0===r)return o.add(n,a);if(!1===r)return o.remove(n,a);var c=e(n);return c.forEach((function(e,n){var r=t(a instanceof Function?a(e,n):a);if(r&&r.length){var c=e.className.length?e.className.split(" "):[],o=c.filter((function(t){return-1===r.indexOf(t)})),i=r.filter((function(t){return-1===c.indexOf(t)})),l=o.concat(i);e.className=l.join(" ")}})),1===c.length?c[0]:c}var l={add:r,remove:c,toggle:i};function s(t){var r=[t.target].concat(n(t.target)),c=["add","remove","toggle"];r.forEach((function(t){if(a(t,"[data-class-add],[data-class-remove],[data-class-toggle]")){var r={};c.forEach((function(c){var o=t.getAttribute("data-class-".concat(c));if(o&&o.length){var i=t.getAttribute("data-class-".concat(c,"-closest"))||t.getAttribute("data-class-closest"),l=t.getAttribute("data-class-".concat(c,"-parents"))||t.getAttribute("data-class-parents"),s=t.getAttribute("data-class-".concat(c,"-siblings"))||t.getAttribute("data-class-siblings"),f=t.getAttribute("data-class-".concat(c,"-target"))||t.getAttribute("data-class-target"),u=[];if(i){var g=function(t,e){for(var n=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector,a=null,r=t;r&&r!==document;){if(n.call(r,e)){a=r;break}r=r.parentNode}return a}(t,i);u=u.concat(g)}if(l){var d=n(t,l);u=u.concat(d)}if(s)e(t.parentNode.children).forEach((function(e){var n=e!==t,r=a(e,s);n&&r&&u.push(e)}));if(f){var m=e(document.querySelectorAll(f));u=u.concat(m)}r[c]={target:u.length?u:t,classNames:o}}})),c.forEach((function(t){r[t]&&l[t](r[t].target,r[t].classNames)}))}}))}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}var u={add:r,remove:c,toggle:i};var g={add:r,attrs:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];n="boolean"==typeof t?t:n;var a=e(t="boolean"==typeof t?document:t),r=!1===t||!1===n?"removeEventListener":"addEventListener";return a.forEach((function(t){t[r]("click",s)})),{remove:function(){a.forEach((function(t){t.removeEventListener("click",s)}))}}},listener:function(t){var r={target:e(t.target||document.body),event:t.event||"click",match:t.match||!0,change:t.change||!0,add:t.add||null,remove:t.remove||null,toggle:t.toggle||null};function c(t){!function(t,r){var c,o=r.match instanceof Function?r.match(t):r.match;if(!0===o)o=[t.target],c=t.target;else if("string"==typeof o){var i=a(t.target,o);c=i?t.target:n(t.target).filter((function(t){return a(t,o)}))[0]||null,o=e(o)}else if("object"===f(o)){var l=t.target===o;o=e(o),c=l?t.target:o[o.indexOf(t.target)]||n(t.target).filter((function(t){return-1!==o.indexOf(t)}))[0]||null}if(c){var s=o.indexOf(c),g=r.change instanceof Function?r.change(t,c,s):r.change;g=!0===g?[t.target]:e(g),["toggle","remove","add"].forEach((function(e){if(r[e]instanceof Function)g.forEach((function(n,a){var o=r[e](t,c,s,n,a);u[e](n,o)}));else{var n=r[e];u[e](g,n)}}))}}(t,r)}return r.target.forEach((function(t){t.addEventListener(r.event,c)})),{remove:function(){r.target.forEach((function(t){t.removeEventListener(r.event,c)}))}}},remove:c,toggle:i};export{g as default}; diff --git a/dist/class-change.js b/dist/class-change.js index 7388cb9..3d7f773 100644 --- a/dist/class-change.js +++ b/dist/class-change.js @@ -1,8 +1,8 @@ /*! * class-change - * v1.1.7 + * v1.1.8 * https://jhildenbiddle.github.io/class-change - * (c) 2016-2022 John Hildenbiddle + * (c) 2016-2024 John Hildenbiddle * MIT license */ (function(global, factory) { diff --git a/dist/class-change.min.js b/dist/class-change.min.js index 62e35aa..28707e5 100644 --- a/dist/class-change.min.js +++ b/dist/class-change.min.js @@ -1,8 +1,8 @@ /*! * class-change - * v1.1.7 + * v1.1.8 * https://jhildenbiddle.github.io/class-change - * (c) 2016-2022 John Hildenbiddle + * (c) 2016-2024 John Hildenbiddle * MIT license */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).classChange=e()}(this,(function(){"use strict";function t(t){return"string"==typeof t&&(t=t.trim().replace(/\s+/g," ").split(" ")),Array.isArray(t)&&(t=(t=t.map((function(t){return t&&t.length?t.trim():null}))).filter(Boolean)),t}function e(t){return"string"==typeof t?t=Array.apply(null,document.querySelectorAll(t)):t instanceof window.HTMLCollection||t instanceof window.NodeList?t=Array.apply(null,t):t&&!Array.isArray(t)&&(t=[t]),Array.isArray(t)?t.filter((function(t,e,n){return n.indexOf(t)===e})):[]}function n(t,e){for(var n=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector,a=[],r=t.parentNode;r&&r!==document;)(!e||e&&n.call(r,e))&&a.push(r),r=r.parentNode;return a}function a(t,e){return(t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector).call(t,e)}function r(n,a){var r=e(n);return r.forEach((function(e,n){var r=t(a instanceof Function?a(e,n):a);if(r&&r.length){var o=e.className.length?e.className.split(" "):[],c=r.filter((function(t){return-1===o.indexOf(t)})),i=o.concat(c);e.className=i.join(" ")}})),1===r.length?r[0]:r}function o(n,a){var r=e(n);return r.forEach((function(e,n){var r=t(a instanceof Function?a(e,n):a);if(e.className.trim().length&&r&&r.length){var o=e.className.split(" ").filter((function(t){return-1===r.indexOf(t)}));o.length?e.className=o.join(" "):e.removeAttribute("class")}})),1===r.length?r[0]:r}var c={add:r,remove:o};function i(n,a,r){if(!0===r)return c.add(n,a);if(!1===r)return c.remove(n,a);var o=e(n);return o.forEach((function(e,n){var r=t(a instanceof Function?a(e,n):a);if(r&&r.length){var o=e.className.length?e.className.split(" "):[],c=o.filter((function(t){return-1===r.indexOf(t)})),i=r.filter((function(t){return-1===o.indexOf(t)})),l=c.concat(i);e.className=l.join(" ")}})),1===o.length?o[0]:o}var l={add:r,remove:o,toggle:i};function s(t){var r=[t.target].concat(n(t.target)),o=["add","remove","toggle"];r.forEach((function(t){if(a(t,"[data-class-add],[data-class-remove],[data-class-toggle]")){var r={};o.forEach((function(o){var c=t.getAttribute("data-class-".concat(o));if(c&&c.length){var i=t.getAttribute("data-class-".concat(o,"-closest"))||t.getAttribute("data-class-closest"),l=t.getAttribute("data-class-".concat(o,"-parents"))||t.getAttribute("data-class-parents"),s=t.getAttribute("data-class-".concat(o,"-siblings"))||t.getAttribute("data-class-siblings"),f=t.getAttribute("data-class-".concat(o,"-target"))||t.getAttribute("data-class-target"),u=[];if(i){var g=function(t,e){for(var n=t.matches||t.matchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector||t.oMatchesSelector,a=null,r=t;r&&r!==document;){if(n.call(r,e)){a=r;break}r=r.parentNode}return a}(t,i);u=u.concat(g)}if(l){var d=n(t,l);u=u.concat(d)}if(s)e(t.parentNode.children).forEach((function(e){var n=e!==t,r=a(e,s);n&&r&&u.push(e)}));if(f){var m=e(document.querySelectorAll(f));u=u.concat(m)}r[o]={target:u.length?u:t,classNames:c}}})),o.forEach((function(t){r[t]&&l[t](r[t].target,r[t].classNames)}))}}))}function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}var u={add:r,remove:o,toggle:i};var g={add:r,attrs:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];n="boolean"==typeof t?t:n;var a=e(t="boolean"==typeof t?document:t),r=!1===t||!1===n?"removeEventListener":"addEventListener";return a.forEach((function(t){t[r]("click",s)})),{remove:function(){a.forEach((function(t){t.removeEventListener("click",s)}))}}},listener:function(t){var r={target:e(t.target||document.body),event:t.event||"click",match:t.match||!0,change:t.change||!0,add:t.add||null,remove:t.remove||null,toggle:t.toggle||null};function o(t){!function(t,r){var o,c=r.match instanceof Function?r.match(t):r.match;if(!0===c)c=[t.target],o=t.target;else if("string"==typeof c){var i=a(t.target,c);o=i?t.target:n(t.target).filter((function(t){return a(t,c)}))[0]||null,c=e(c)}else if("object"===f(c)){var l=t.target===c;c=e(c),o=l?t.target:c[c.indexOf(t.target)]||n(t.target).filter((function(t){return-1!==c.indexOf(t)}))[0]||null}if(o){var s=c.indexOf(o),g=r.change instanceof Function?r.change(t,o,s):r.change;g=!0===g?[t.target]:e(g),["toggle","remove","add"].forEach((function(e){if(r[e]instanceof Function)g.forEach((function(n,a){var c=r[e](t,o,s,n,a);u[e](n,c)}));else{var n=r[e];u[e](g,n)}}))}}(t,r)}return r.target.forEach((function(t){t.addEventListener(r.event,o)})),{remove:function(){r.target.forEach((function(t){t.removeEventListener(r.event,o)}))}}},remove:o,toggle:i};return g})); diff --git a/package-lock.json b/package-lock.json index 7038b47..2028470 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "class-change", - "version": "1.1.7", + "version": "1.1.8", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "class-change", - "version": "1.1.7", + "version": "1.1.8", "license": "MIT", "devDependencies": { "@babel/core": "^7.6.0", diff --git a/package.json b/package.json index 05b9d76..e790288 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "class-change", - "version": "1.1.7", + "version": "1.1.8", "description": "A versatile Element.classList alternative for manipulating CSS class names, triggering change events using HTML data attributes, and creating class-related event listeners using a simple, declarative API.", "author": "John Hildenbiddle ", "license": "MIT",