jizy-dom 2.0.1 → 2.1.0
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 +0 -3
- package/README.md +3 -27
- package/dist/js/jizy-dom.min.js +2 -0
- package/lib/index.js +43 -1
- package/package.json +16 -45
- package/dist/jizy-dom.min.js +0 -2
package/LICENSE
CHANGED
|
@@ -2,9 +2,6 @@ MIT License
|
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2015-present Joffrey Demetz
|
|
4
4
|
|
|
5
|
-
Joffrey Demetz <joffrey.demetz@gmail.com>
|
|
6
|
-
<https://jdz.joffreydemetz.com/jizydom/>
|
|
7
|
-
|
|
8
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
9
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
10
7
|
in the Software without restriction, including without limitation the rights
|
package/README.md
CHANGED
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
# jizy-dom
|
|
2
2
|
DOM js implementation
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
## `lib/js` Directory
|
|
5
6
|
|
|
6
7
|
This folder contains the core JavaScript modules for DOM manipulation:
|
|
7
8
|
|
|
8
|
-
- **dom.js**:
|
|
9
|
-
- **selector.js**:
|
|
10
|
-
|
|
11
|
-
## Build process
|
|
12
|
-
|
|
13
|
-
The build process is managed by `jpack`, which compiles and bundles the JavaScript files into a single output file. The configuration for the build can be found in `config/jpack.js`.
|
|
14
|
-
|
|
15
|
-
### Build Command
|
|
16
|
-
|
|
17
|
-
To build the project, run:
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm run build
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
This command executes `node cli/command.js`, which uses the `jpack` configuration to bundle the JavaScript source files.
|
|
24
|
-
You can pass additional options:
|
|
25
|
-
|
|
26
|
-
- `--target <path>`: Set a custom output directory.
|
|
27
|
-
- `--zip`: Create a zip archive of the build.
|
|
28
|
-
- `--name <name>`: Set a custom build name.
|
|
29
|
-
|
|
30
|
-
Example:
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
npm run build -- --target test --name custom-build
|
|
34
|
-
```
|
|
9
|
+
- **dom.js**: Utility functions, CSS property handling, and other DOM-related helpers.
|
|
10
|
+
- **selector.js**: Lightweight selector engine and helper functions for working with DOM elements.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! DOM v2.1.0 | 2025-08-25T20:44Z | [default] */
|
|
2
|
+
!function(e){"use strict";if("object"!=typeof e||!e||!e.document)throw new Error("DOM requires a window with a document");if(void 0!==e.DOM)throw new Error("DOM is already defined");var t=function(){const e="compareDocumentPosition"in document.documentElement?function(e,t){return!(16&~t.compareDocumentPosition(e))}:function(e,t){return(t=t==document||t==window?document.documentElement:t)!==e&&t.contains(e)};function t(e){return[].slice.call(e,0)}function s(e){let t;return e&&"object"==typeof e&&(t=e.nodeType)&&(1==t||9==t)}function n(e){return"object"==typeof e&&isFinite(e.length)}function i(r,l){const a=function(e){return e?"string"==typeof e?i(e)[0]:!e.nodeType&&n(e)?e[0]:e:document}(l);let o;return a&&r?r===window||s(r)?!l||r!==window&&s(a)&&e(r,a)?[r]:[]:r&&n(r)?function(e){for(var t=[],s=0,i=e.length;s<i;++s)n(e[s])?t=t.concat(e[s]):t[t.length]=e[s];return t}(r):document.getElementsByClassName&&"string"==r&&(o=r.match(/^\.([\w\-]+)$/))?t(a.getElementsByClassName(o[1])):r&&(r.document||r.nodeType&&9==r.nodeType)?l?[]:[r]:t(a.querySelectorAll(r)):[]}function r(...e){let t=!1,s=0,n={};"boolean"==typeof e[0]&&(t=e[0],s=1);const i=e=>e&&"[object Object]"===Object.prototype.toString.call(e),l=e=>{for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t&&i(e[s])?n[s]=r(!0,n[s]||{},e[s]):void 0!==e[s]&&(n[s]=e[s]))};for(;s<e.length;s++)e[s]&&l(e[s]);return n}const l=/^(?:(width|height|top|right|bottom|left|margin|padding)|((min|max)(Width|Height))|((margin|padding)(Top|Right|Bottom|Left)))$/,a={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},o={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},c=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function h(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function d(e){return e.replace(/-([a-z])/g,e=>e[1].toUpperCase())}function u(e,t){return!!(t&&e&&1===e.nodeType&&e.matches(t))}function m(e,t){return null==t?new E(e):new E(e).filter(t)}function p(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)}function f(e){if(e.data("cssInitialDisplay"))return e.data("cssInitialDisplay");if(e.css("display")&&"none"!==e.css("display"))return e.css("display");switch(e.tagName.toLowerCase()){case"table":return"table";case"thead":return"table-header-group";case"tfoot":return"table-footer-group";case"tr":return"table-row";case"th":case"td":return"table-cell";case"span":return"inline";case"li":return"list-item"}return"block"}function g(e,t){for(var s in t)if(!0===e.classList.contains(t[s]))return!0;return!1}function y(e,t){for(var s in t)if(!1===e.classList.contains(t[s]))return!1;return!0}function w(e,t,s,n){return 2 in arguments?null===s?void e.style.removeProperty(h(t)):("number"==typeof s&&!a[h(name)]&&l.test(d(name))&&(s+="px"),void(n?e.style.setProperty(h(t),s,"important"):e.style[d(t)]=s)):e.style[d(t)]||getComputedStyle(e,null).getPropertyValue(h(t))}function b(e,t,s){if(1===arguments.length){const t={};for(let s in e.dataset)t[s]=b(e,s);return t}const n="data-"+h(t);if(!(2 in arguments))return null!==(s=e.getAttribute(n))?function(e){try{return e?"true"==e||"false"!=e&&("null"==e?null:+e+""==e?+e:/^[\[\{]/.test(e)?JSON.parse(e):e):e}catch(t){return e}}(s):void 0;if("object"!=typeof s||null===s||Array.isArray(s))p(e,n,s);else for(let n in s)b(e,t+"-"+n,s[n])}function v(e,t,s){const n=s.split(" ");return e.classList[t].apply(e.classList,n)}async function C(e,t){const s=t.slideSpeed,n=t.direction,i=t.easing,r=t.delay,l=void 0===r?0:r,a=t.visibleDisplayValue,o=void 0===a?"block":a,c=e.dataset.domSliderId||(Date.now()*Math.random()).toFixed(0);e.dataset.domSliderId||(e.dataset.domSliderId=c);const h=window.getComputedStyle(e),d="none"===h.getPropertyValue("display"),u=n||(d||e.classList.contains("slider-hidden")?"down":"up"),m=s||(0===s?0:300),p=h.getPropertyValue("box-sizing"),f=parseInt(h.getPropertyValue("padding-top").split("px")[0]),g=parseInt(h.getPropertyValue("padding-bottom").split("px")[0]);let y=Math.max(e.scrollHeight-f-g,0);return"border-box"===p&&(y=Math.max(e.scrollHeight,0)),e.dataset.sliding?Promise.resolve(e):"down"!==u||d||e.classList.contains("slider-hidden")?"up"===u&&e.classList.contains("slider-hidden")?Promise.resolve(e):(e.dataset.sliding=!0,e.setAttribute("aria-hidden","down"===u?"false":"true"),"down"===u&&d&&(e.classList.add("slider-hidden"),e.style.display=o,y=e.scrollHeight),e.style.height="".concat(y,"px"),e.style.transition="all ".concat(m,"ms ").concat(i||""),e.style.overflow="hidden",await new Promise(t=>{setTimeout(()=>{e.classList.contains("slider-hidden")||setTimeout(()=>{e.style.display="none"},300),e.classList.toggle("slider-hidden"),t()},+l>20?+l:20)}),await new Promise(t=>{setTimeout(()=>{e.style.removeProperty("height"),e.style.removeProperty("transition"),e.style.removeProperty("overflow"),e.removeAttribute("data-sliding"),t(e)},m)})):Promise.resolve(e)}class E{constructor(e,t){if(t=t||document,e instanceof E)return e;if(t instanceof E)return t.find(e);this.elems=i(e,t);for(let e=0;e<this.elems.length;e++)this.elems[e].data=(e,t)=>0 in arguments&&e?1 in arguments?(b(this,e,t),this):b(this,e):b(this),this.elems[e].css=(e,t,s)=>1 in arguments?w(this,e,t,s||!1):w(this,e),this.elems[e].addClass=e=>v(this,"add",e),this.elems[e].removeClass=e=>v(this,"remove",e),this.elems[e].hasClass=e=>v(this,"contains",e),this.elems[e].hasClasses=e=>g(this,e),this.elems[e].hasAllClasses=e=>y(this,e);return this}toArray(){return this.elems}exists(){return this.elems.length>0}size(){return this.elems.length}each(e){for(let t=0,s=this.elems.length;t<s;t++)e.call(this,this.elems[t],t);return this}map(e){const t=[];for(let s=0,n=this.elems.length;s<n;s++){const n=e.call(this,this.elems[s],s);!1!==n&&t.push(n)}return t}filter(e){if("function"!=typeof e){const t=e;e=e=>!!u(e,t)&&e}const t=[];for(let s=0,n=this.elems.length;s<n;s++){const n=e.call(this,this.elems[s],s);!1!==n&&t.push(n)}return new E(t)}not(e){const t=[];if("function"==typeof e&&void 0!==e.call)this.each(function(s,n){!1===e.call(s,n)&&t.push(s)});else{const s=[];s="string"==typeof e?this.filter(e):new E(e),s instanceof E&&(s=s.elems),this.each(function(e,n){s.indexOf(e)<0&&t.push(e)})}return new E(t)}get(e){const t=(e=e||0)>=0?e:this.elems.length+e;return void 0!==this.elems[t]?new E(this.elems[t]):this}getElement(e){return 0 in this.elems?this.elems[0]:document.createElement(e||"div")}is(e){return e instanceof HTMLElement?e===this.getElement():e instanceof E?e.getElement()===this.getElement():0 in this.elems&&"string"==typeof e&&(":visible"===e?"none"!==this.elems[0].css("display"):":hidden"===e?"none"===this.elems[0].css("display"):u(this.elems[0],e))}find(e){const t=e.trim().split(/,\s*/),s=[];return this.each(function(e){for(let n=0,r=t.length;n<r;n++){const r=t[n].match(/^>\s*(.+)$/);if(t[n].match(/^\:(first|last)/),r){if(i(r[1],e))for(const t in e.childNodes)u(e.childNodes[t],r[1])&&(s=s.concat(e.childNodes[t]))}else{const r=i(t[n],e);r&&(s=s.concat(r))}}}),new E(s)}insert(e,t){return"before"===t&&(t="beforebegin"),"after"===t&&(t="afterend"),"prepend"===t&&(t="afterbegin"),"append"===t&&(t="beforeend"),this.each(s=>{e instanceof E?e.each(e=>{s.insertAdjacentElement(t,e)}):e instanceof Element?s.insertAdjacentElement(t,e):s.insertAdjacentHTML(t,e)})}before(e){return this.insert(e,"before")}after(e){return this.insert(e,"after")}append(e){return this.insert(e,"append")}prepend(e){return this.insert(e,"prepend")}replaceWith(e){return this.insert(e,"before"),this.remove(),this}remove(){return this.each(e=>e.parentNode.removeChild(e))}parent(e){const t=[];return this.each(e=>{const s=e.parentNode;s&&(t=t.concat(s))}),m(t,e||null)}children(e){const t=[];return this.each(e=>{const s=e.childNodes;s&&(t=t.concat(s))}),m(t,e||null)}closest(e){const t=[];return this.each(s=>{const n=s.closest(e);n&&(t=t.concat(n))}),new E(t)}prev(e){const t=[];return this.each(e=>{const s=e.previousElementSibling;s&&(t=t.concat(s))}),m(t,e||null)}next(e){const t=[];return this.each(e=>{const s=e.nextElementSibling;s&&(t=t.concat(s))}),m(t,e||null)}first(e){const t=[];return this.each(e=>{const s=e.firstElementChild;s&&(t=t.concat(s))}),m(t,e||null)}last(e){const t=[];return this.each(e=>{const s=e.lastElementChild;s&&(t=t.concat(s))}),m(t,e||null)}wrap(e){return this.each(t=>{t.parentNode.insertBefore(e,t),e.appendChild(t)}),this}on(e,t,s){return s=s||!1,e.split(" ").forEach(e=>{this.each(n=>{n.addEventListener(e,t,s)})}),this}delegate(e,t,s,n){return n=n||!1,this.on(e,e=>{new E(e.target).is(t)&&s(...arguments)},n)}off(e,t){return e.split(" ").forEach(e=>{this.each(s=>{s.removeEventListener(e,t)})}),this}submit(){return 0 in this.elems&&this.elems[0]instanceof HTMLFormElement&&this.elems[0].submit(),this}focus(){return 0 in this.elems&&this.elems[0].focus(),this}trigger(e,t,s,n){let i;return arguments.length<4&&(n=!0),arguments.length<3&&(s=!1),arguments.length<2&&(t=null),i=t?new CustomEvent(e,{bubbles:s,cancellable:n,detail:t}):new Event(e,{bubbles:s,cancellable:n}),this.each(e=>{e.dispatchEvent(i)})}swipe(e,t,s){return this.each(n=>{let i,l,a,o,h,d,u,m=e||function(e,t){},p=t||function(e){return!1},f=r({scrolling:!1,threshold:10,restraint:100,allowedTime:300},s||{});return n.addEventListener("touchstart",e=>{if(!1===p(e)){const t=e.changedTouches[0];i="none",l=t.pageX,a=t.pageY,u=(new Date).getTime(),!c&&e.preventDefault()}},c?{passive:!0}:void 0),n.addEventListener("touchmove",e=>{!1===p(e)&&!1===f.scrolling&&!c&&e.preventDefault()},c?{passive:!0}:void 0),n.addEventListener("touchend",e=>{if(!1===p(e)){const t=e.changedTouches[0];o=t.pageX-l,h=t.pageY-a,d=(new Date).getTime()-u,d<=f.allowedTime&&(Math.abs(o)>=f.threshold&&Math.abs(h)<=f.restraint?i=o<0?"left":"right":Math.abs(h)>=f.threshold&&Math.abs(o)<=f.restraint&&(i=h<0?"up":"down")),!c&&e.preventDefault(),m(e,i)}},c?{passive:!0}:void 0),this})}text(e){return 0 in arguments?this.each(t=>{t.innerText=e}):0 in this.elems?this.elems[0].innerText:null}html(e){return 0 in arguments?this.each(t=>{t.innerHTML=e}):0 in this.elems?this.elems[0].innerHTML:null}content(e){return 0 in arguments?this.each(t=>{t.innerContent=e}):0 in this.elems?this.elems[0].innerContent:null}addClass(e){return this.each(t=>{t.addClass(e)})}removeClass(e){return this.each(t=>{t.removeClass(e)})}toggleClass(e){return this.each(t=>{t.classList.toggle(e)})}replaceClass(e,t){return this.each(s=>{s.classList.replace(e,t)})}hasClass(e){return 0 in this.elems&&this.elems[0].classList.contains(e)}hasClasses(e){return 0 in this.elems&&this.elems[0].hasClasses(e)}hasAllClasses(e){return 0 in this.elems&&this.elems[0].hasAllClasses(e)}containsClass(e){if(0 in this.elems)for(var t=this.elems[0].classList,s=0;s<t.length;s++)if(t[s].indexOf(e)>-1)return!0;return!1}toggle(){return this.each(e=>{const t=f(e);e.data("cssInitialDisplay")||e.data("cssInitialDisplay",t),"none"===e.css("display")?e.style.display="block":e.style.display="none"})}show(){return this.each(e=>{const t=f(e);e.data("cssInitialDisplay")||e.data("cssInitialDisplay",t),e.style.display=t})}hide(){return this.each(e=>{e.data("cssInitialDisplay")||e.data("cssInitialDisplay",f(e)),e.style.display="none"})}offset(){if(0===this.elems.length)return{top:0,left:0};const e=this.elems[0].getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}}serialize(){if(!(0 in this.elems))return"";const e=new FormData(this.elems[0]);return new URLSearchParams(e).toString()}css(e,t,s){if(1 in arguments)return this.each(n=>{w(n,e,t,s||!1)});if(0 in this.elems){if("string"==typeof e)return w(this.elems[0],e);const t={};if(Array.isArray(e)){const s=this.elems[0];e.forEach(e=>{t[e]=w(s,e)})}return t}return null}data(e,t){return 0 in arguments&&e?1 in arguments?this.each(s=>{b(s,e,t)}):0 in this.elems?b(this.elems[0],e):void 0:0 in this.elems?b(this.elems[0]):{}}attr(e,t){if(1 in arguments)return this.each(s=>{1===s.nodeType&&p(s,e,t)});let s=null;return 0 in this.elems&&1==this.elems[0].nodeType&&(s=this.elems[0].getAttribute(e)),s}prop(e,t){if(e=o[e]||e,1 in arguments)return this.each(s=>{s[e]=t});let s=null;return 0 in this.elems&&(s=this.elems[0][e]),s}tagName(e){let t=0 in this.elems?this.elems[0].tagName:null;return t&&(t=t.toLowerCase(),e&&(t=t.toUpperCase())),t}val(e){return 0 in arguments?(null==e&&(e=""),this.each(t=>{t.value=e})):0 in this.elems?this.elems[0].value:null}outerHeight(){let e=0;return 0 in this.elems&&(e+=parseInt(this.elems[0].css("height")),e+=parseInt(this.elems[0].css("padding-top")),e+=parseInt(this.elems[0].css("padding-bottom")),e+=parseInt(this.elems[0].css("margin-top")),e+=parseInt(this.elems[0].css("margin-bottom"))),e}outerWidth(){let e=0;return 0 in this.elems&&(e+=parseInt(this.elems[0].css("width")),e+=parseInt(this.elems[0].css("padding-left")),e+=parseInt(this.elems[0].css("padding-right")),e+=parseInt(this.elems[0].css("margin-left")),e+=parseInt(this.elems[0].css("margin-right"))),e}slideDown(e,t,s,n){return window.Promise?(e=e||500,t=t||"cubic-bezier(0.25, 0.1, 0.44, 1.4)",s=s||200,this.each(i=>C(i,{direction:"down",slideSpeed:e,easing:t,delay:s,visibleDisplayValue:n||f(i)}))):this.show()}slideUp(e,t,s){return window.Promise?(e=e||500,t=t||"cubic-bezier(0.25, 0.1, 0.44, 1.4)",s=s||200,this.each(n=>C(n,{direction:"up",slideSpeed:e,easing:t,delay:s}))):this.hide()}slideToggle(e,t,s,n){return window.Promise?(e=e||500,t=t||"cubic-bezier(0.25, 0.1, 0.44, 1.4)",s=s||200,this.each(i=>C(i,{slideSpeed:e,easing:t,delay:s,visibleDisplayValue:n||f(i)}))):this.toggle()}scrollTop(e){return 0 in arguments?this.each(t=>{t.style.scrollBehavior="smooth",t.scrollTop=e||0}):0 in this.elems?this.elems[0].scrollTop:0}}return E}();e.DOM=t}("undefined"!=typeof window?window:this);
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,49 @@
|
|
|
1
1
|
import Selector from './js/selector.js';
|
|
2
2
|
import DOM from './js/dom.js';
|
|
3
3
|
|
|
4
|
+
const jDOM = function (selector, parent) {
|
|
5
|
+
return new DOM(selector, parent);
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
const jDOMplugin = function (name, fn) {
|
|
9
|
+
DOM[name] = fn;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const jDOMcreate = function (tagName, attrs) {
|
|
13
|
+
const el = document.createElement(tagName);
|
|
14
|
+
|
|
15
|
+
if (attrs) {
|
|
16
|
+
if (attrs.className) {
|
|
17
|
+
el.classList.add(attrs.className);
|
|
18
|
+
delete attrs.className;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (attrs.text) {
|
|
22
|
+
el.innerText = attrs.text;
|
|
23
|
+
delete attrs.text;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (attrs.html) {
|
|
27
|
+
el.innerHTML = attrs.html;
|
|
28
|
+
delete attrs.html;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
for (var key in attrs) {
|
|
32
|
+
if (attrs.hasOwnProperty(key)) {
|
|
33
|
+
el.setAttribute(key, attrs[key]);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return new DOM(el);
|
|
39
|
+
};
|
|
40
|
+
|
|
4
41
|
export {
|
|
5
42
|
Selector,
|
|
6
|
-
DOM
|
|
43
|
+
DOM,
|
|
44
|
+
jDOM,
|
|
45
|
+
jDOMplugin,
|
|
46
|
+
jDOMcreate
|
|
7
47
|
};
|
|
48
|
+
|
|
49
|
+
export default DOM;
|
package/package.json
CHANGED
|
@@ -1,62 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jizy-dom",
|
|
3
|
-
"version": "2.0
|
|
4
|
-
"browser": "dist/jizy-dom.min.js",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"browser": "dist/js/jizy-dom.min.js",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/js/jizy-dom.min.js",
|
|
9
|
+
"lib/js/dom.js",
|
|
10
|
+
"lib/js/selector.js",
|
|
11
|
+
"lib/index.js"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"jpack:export": "node ./cli/jpack.js --action build --name perso",
|
|
15
|
+
"jpack:export-debug": "node ./cli/jpack.js --action build --name perso --debug",
|
|
16
|
+
"jpack:dist": "node ./cli/jpack.js",
|
|
17
|
+
"jpack:dist-debug": "node ./cli/jpack.js --debug"
|
|
18
|
+
},
|
|
7
19
|
"repository": {
|
|
8
20
|
"type": "git",
|
|
9
21
|
"url": "https://github.com/joffreydemetz/jizy-dom"
|
|
10
22
|
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"test": "jest",
|
|
13
|
-
"dist": "node cli/dist.js",
|
|
14
|
-
"build": "node cli/command.js",
|
|
15
|
-
"build-dev": "cross-env DEBUG=true node cli/command.js"
|
|
16
|
-
},
|
|
17
23
|
"keywords": [
|
|
18
24
|
"JiZy",
|
|
19
25
|
"DOM"
|
|
20
26
|
],
|
|
21
|
-
"files": [
|
|
22
|
-
"dist/jizy-dom.min.js",
|
|
23
|
-
"lib/js/dom.js",
|
|
24
|
-
"lib/js/selector.js",
|
|
25
|
-
"lib/index.js"
|
|
26
|
-
],
|
|
27
27
|
"author": "Joffrey Demetz <joffrey.demetz@gmail.com> (https://joffreydemetz.com/)",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"description": "A lightweight DOM manipulation library",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"@babel/preset-env": "^7.26.9",
|
|
33
|
-
"@rollup/plugin-commonjs": "^28.0.3",
|
|
34
|
-
"@rollup/plugin-json": "^6.1.0",
|
|
35
|
-
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
36
|
-
"@rollup/plugin-terser": "^0.4.4",
|
|
37
|
-
"@rollup/plugin-url": "^8.0.2",
|
|
38
|
-
"autoprefixer": "^10.4.21",
|
|
39
|
-
"babel-jest": "^29.7.0",
|
|
40
|
-
"clean-css": "^5.3.3",
|
|
41
|
-
"cross-env": "^7.0.3",
|
|
42
|
-
"cssnano": "^7.0.6",
|
|
43
|
-
"globals": "^16.1.0",
|
|
44
|
-
"jest": "^29.7.0",
|
|
45
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
46
|
-
"jsdom": "^26.1.0",
|
|
47
|
-
"less": "^4.3.0",
|
|
48
|
-
"less-plugin-clean-css": "^1.6.0",
|
|
49
|
-
"postcss": "^8.5.3",
|
|
50
|
-
"rollup": "^4.40.1",
|
|
51
|
-
"rollup-plugin-copy": "^3.5.0",
|
|
52
|
-
"rollup-plugin-delete": "^3.0.1",
|
|
53
|
-
"rollup-plugin-postcss": "^4.0.2",
|
|
54
|
-
"yargs": "^17.7.2"
|
|
55
|
-
},
|
|
56
|
-
"jest": {
|
|
57
|
-
"testEnvironment": "jsdom",
|
|
58
|
-
"transform": {
|
|
59
|
-
"^.+\\.js$": "babel-jest"
|
|
60
|
-
}
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"jizy-packer": "^2.1.0"
|
|
61
32
|
}
|
|
62
33
|
}
|
package/dist/jizy-dom.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! DOM v2.0.0 | 2025-08-13T16:53Z | [default] */
|
|
2
|
-
!function(e){"use strict";if("object"!=typeof e||!e||!e.document)throw new Error("DOM requires a window with a document");if(void 0!==e.DOM)throw new Error("DOM is already defined");var t=function(){const e="compareDocumentPosition"in document.documentElement?function(e,t){return!(16&~t.compareDocumentPosition(e))}:function(e,t){return(t=t==document||t==window?document.documentElement:t)!==e&&t.contains(e)};function t(e){return[].slice.call(e,0)}function s(e){let t;return e&&"object"==typeof e&&(t=e.nodeType)&&(1==t||9==t)}function n(e){return"object"==typeof e&&isFinite(e.length)}function i(r,l){const a=function(e){return e?"string"==typeof e?i(e)[0]:!e.nodeType&&n(e)?e[0]:e:document}(l);let o;return a&&r?r===window||s(r)?!l||r!==window&&s(a)&&e(r,a)?[r]:[]:r&&n(r)?function(e){for(var t=[],s=0,i=e.length;s<i;++s)n(e[s])?t=t.concat(e[s]):t[t.length]=e[s];return t}(r):document.getElementsByClassName&&"string"==r&&(o=r.match(/^\.([\w\-]+)$/))?t(a.getElementsByClassName(o[1])):r&&(r.document||r.nodeType&&9==r.nodeType)?l?[]:[r]:t(a.querySelectorAll(r)):[]}function r(...e){let t=!1,s=0,n={};"boolean"==typeof e[0]&&(t=e[0],s=1);const i=e=>e&&"[object Object]"===Object.prototype.toString.call(e),l=e=>{for(const s in e)Object.prototype.hasOwnProperty.call(e,s)&&(t&&i(e[s])?n[s]=r(!0,n[s]||{},e[s]):void 0!==e[s]&&(n[s]=e[s]))};for(;s<e.length;s++)e[s]&&l(e[s]);return n}const l=/^(?:(width|height|top|right|bottom|left|margin|padding)|((min|max)(Width|Height))|((margin|padding)(Top|Right|Bottom|Left)))$/,a={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},o={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},c=(()=>{let e=!1;try{const t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener("test",null,t),window.removeEventListener("test",null,t)}catch(e){}return e})();function h(e){return e.replace(/([A-Z])/g,"-$1").toLowerCase()}function d(e){return e.replace(/-([a-z])/g,(e=>e[1].toUpperCase()))}function u(e,t){return!!(t&&e&&1===e.nodeType&&e.matches(t))}function m(e,t){return null==t?new E(e):new E(e).filter(t)}function p(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)}function f(e){if(e.data("cssInitialDisplay"))return e.data("cssInitialDisplay");if(e.css("display")&&"none"!==e.css("display"))return e.css("display");switch(e.tagName.toLowerCase()){case"table":return"table";case"thead":return"table-header-group";case"tfoot":return"table-footer-group";case"tr":return"table-row";case"th":case"td":return"table-cell";case"span":return"inline";case"li":return"list-item"}return"block"}function g(e,t){for(var s in t)if(!0===e.classList.contains(t[s]))return!0;return!1}function y(e,t){for(var s in t)if(!1===e.classList.contains(t[s]))return!1;return!0}function w(e,t,s,n){return 2 in arguments?null===s?void e.style.removeProperty(h(t)):("number"==typeof s&&!a[h(name)]&&l.test(d(name))&&(s+="px"),void(n?e.style.setProperty(h(t),s,"important"):e.style[d(t)]=s)):e.style[d(t)]||getComputedStyle(e,null).getPropertyValue(h(t))}function b(e,t,s){if(1===arguments.length){const t={};for(let s in e.dataset)t[s]=b(e,s);return t}const n="data-"+h(t);if(!(2 in arguments))return null!==(s=e.getAttribute(n))?function(e){try{return e?"true"==e||"false"!=e&&("null"==e?null:+e+""==e?+e:/^[\[\{]/.test(e)?JSON.parse(e):e):e}catch(t){return e}}(s):void 0;if("object"!=typeof s||null===s||Array.isArray(s))p(e,n,s);else for(let n in s)b(e,t+"-"+n,s[n])}function v(e,t,s){const n=s.split(" ");return e.classList[t].apply(e.classList,n)}async function C(e,t){const s=t.slideSpeed,n=t.direction,i=t.easing,r=t.delay,l=void 0===r?0:r,a=t.visibleDisplayValue,o=void 0===a?"block":a,c=e.dataset.domSliderId||(Date.now()*Math.random()).toFixed(0);e.dataset.domSliderId||(e.dataset.domSliderId=c);const h=window.getComputedStyle(e),d="none"===h.getPropertyValue("display"),u=n||(d||e.classList.contains("slider-hidden")?"down":"up"),m=s||(0===s?0:300),p=h.getPropertyValue("box-sizing"),f=parseInt(h.getPropertyValue("padding-top").split("px")[0]),g=parseInt(h.getPropertyValue("padding-bottom").split("px")[0]);let y=Math.max(e.scrollHeight-f-g,0);return"border-box"===p&&(y=Math.max(e.scrollHeight,0)),e.dataset.sliding?Promise.resolve(e):"down"!==u||d||e.classList.contains("slider-hidden")?"up"===u&&e.classList.contains("slider-hidden")?Promise.resolve(e):(e.dataset.sliding=!0,e.setAttribute("aria-hidden","down"===u?"false":"true"),"down"===u&&d&&(e.classList.add("slider-hidden"),e.style.display=o,y=e.scrollHeight),e.style.height="".concat(y,"px"),e.style.transition="all ".concat(m,"ms ").concat(i||""),e.style.overflow="hidden",await new Promise((t=>{setTimeout((()=>{e.classList.contains("slider-hidden")||setTimeout((()=>{e.style.display="none"}),300),e.classList.toggle("slider-hidden"),t()}),+l>20?+l:20)})),await new Promise((t=>{setTimeout((()=>{e.style.removeProperty("height"),e.style.removeProperty("transition"),e.style.removeProperty("overflow"),e.removeAttribute("data-sliding"),t(e)}),m)}))):Promise.resolve(e)}class E{constructor(e,t){if(t=t||document,e instanceof E)return e;if(t instanceof E)return t.find(e);this.elems=i(e,t);for(let e=0;e<this.elems.length;e++)this.elems[e].data=(e,t)=>0 in arguments&&e?1 in arguments?(b(this,e,t),this):b(this,e):b(this),this.elems[e].css=(e,t,s)=>1 in arguments?w(this,e,t,s||!1):w(this,e),this.elems[e].addClass=e=>v(this,"add",e),this.elems[e].removeClass=e=>v(this,"remove",e),this.elems[e].hasClass=e=>v(this,"contains",e),this.elems[e].hasClasses=e=>g(this,e),this.elems[e].hasAllClasses=e=>y(this,e);return this}toArray(){return this.elems}exists(){return this.elems.length>0}size(){return this.elems.length}each(e){for(let t=0,s=this.elems.length;t<s;t++)e.call(this,this.elems[t],t);return this}map(e){const t=[];for(let s=0,n=this.elems.length;s<n;s++){const n=e.call(this,this.elems[s],s);!1!==n&&t.push(n)}return t}filter(e){if("function"!=typeof e){const t=e;e=e=>!!u(e,t)&&e}const t=[];for(let s=0,n=this.elems.length;s<n;s++){const n=e.call(this,this.elems[s],s);!1!==n&&t.push(n)}return new E(t)}not(e){const t=[];if("function"==typeof e&&void 0!==e.call)this.each((function(s,n){!1===e.call(s,n)&&t.push(s)}));else{const s=[];s="string"==typeof e?this.filter(e):new E(e),s instanceof E&&(s=s.elems),this.each((function(e,n){s.indexOf(e)<0&&t.push(e)}))}return new E(t)}get(e){const t=(e=e||0)>=0?e:this.elems.length+e;return void 0!==this.elems[t]?new E(this.elems[t]):this}getElement(e){return 0 in this.elems?this.elems[0]:document.createElement(e||"div")}is(e){return e instanceof HTMLElement?e===this.getElement():e instanceof E?e.getElement()===this.getElement():0 in this.elems&&"string"==typeof e&&(":visible"===e?"none"!==this.elems[0].css("display"):":hidden"===e?"none"===this.elems[0].css("display"):u(this.elems[0],e))}find(e){const t=e.trim().split(/,\s*/),s=[];return this.each((function(e){for(let n=0,r=t.length;n<r;n++){const r=t[n].match(/^>\s*(.+)$/);if(t[n].match(/^\:(first|last)/),r){if(i(r[1],e))for(const t in e.childNodes)u(e.childNodes[t],r[1])&&(s=s.concat(e.childNodes[t]))}else{const r=i(t[n],e);r&&(s=s.concat(r))}}})),new E(s)}insert(e,t){return"before"===t&&(t="beforebegin"),"after"===t&&(t="afterend"),"prepend"===t&&(t="afterbegin"),"append"===t&&(t="beforeend"),this.each((s=>{e instanceof E?e.each((e=>{s.insertAdjacentElement(t,e)})):e instanceof Element?s.insertAdjacentElement(t,e):s.insertAdjacentHTML(t,e)}))}before(e){return this.insert(e,"before")}after(e){return this.insert(e,"after")}append(e){return this.insert(e,"append")}prepend(e){return this.insert(e,"prepend")}replaceWith(e){return this.insert(e,"before"),this.remove(),this}remove(){return this.each((e=>e.parentNode.removeChild(e)))}parent(e){const t=[];return this.each((e=>{const s=e.parentNode;s&&(t=t.concat(s))})),m(t,e||null)}children(e){const t=[];return this.each((e=>{const s=e.childNodes;s&&(t=t.concat(s))})),m(t,e||null)}closest(e){const t=[];return this.each((s=>{const n=s.closest(e);n&&(t=t.concat(n))})),new E(t)}prev(e){const t=[];return this.each((e=>{const s=e.previousElementSibling;s&&(t=t.concat(s))})),m(t,e||null)}next(e){const t=[];return this.each((e=>{const s=e.nextElementSibling;s&&(t=t.concat(s))})),m(t,e||null)}first(e){const t=[];return this.each((e=>{const s=e.firstElementChild;s&&(t=t.concat(s))})),m(t,e||null)}last(e){const t=[];return this.each((e=>{const s=e.lastElementChild;s&&(t=t.concat(s))})),m(t,e||null)}wrap(e){return this.each((t=>{t.parentNode.insertBefore(e,t),e.appendChild(t)})),this}on(e,t,s){return s=s||!1,e.split(" ").forEach((e=>{this.each((n=>{n.addEventListener(e,t,s)}))})),this}delegate(e,t,s,n){return n=n||!1,this.on(e,(e=>{new E(e.target).is(t)&&s(...arguments)}),n)}off(e,t){return e.split(" ").forEach((e=>{this.each((s=>{s.removeEventListener(e,t)}))})),this}submit(){return 0 in this.elems&&this.elems[0]instanceof HTMLFormElement&&this.elems[0].submit(),this}focus(){return 0 in this.elems&&this.elems[0].focus(),this}trigger(e,t,s,n){let i;return arguments.length<4&&(n=!0),arguments.length<3&&(s=!1),arguments.length<2&&(t=null),i=t?new CustomEvent(e,{bubbles:s,cancellable:n,detail:t}):new Event(e,{bubbles:s,cancellable:n}),this.each((e=>{e.dispatchEvent(i)}))}swipe(e,t,s){return this.each((n=>{let i,l,a,o,h,d,u,m=e||function(e,t){},p=t||function(e){return!1},f=r({scrolling:!1,threshold:10,restraint:100,allowedTime:300},s||{});return n.addEventListener("touchstart",(e=>{if(!1===p(e)){const t=e.changedTouches[0];i="none",l=t.pageX,a=t.pageY,u=(new Date).getTime(),!c&&e.preventDefault()}}),c?{passive:!0}:void 0),n.addEventListener("touchmove",(e=>{!1===p(e)&&!1===f.scrolling&&!c&&e.preventDefault()}),c?{passive:!0}:void 0),n.addEventListener("touchend",(e=>{if(!1===p(e)){const t=e.changedTouches[0];o=t.pageX-l,h=t.pageY-a,d=(new Date).getTime()-u,d<=f.allowedTime&&(Math.abs(o)>=f.threshold&&Math.abs(h)<=f.restraint?i=o<0?"left":"right":Math.abs(h)>=f.threshold&&Math.abs(o)<=f.restraint&&(i=h<0?"up":"down")),!c&&e.preventDefault(),m(e,i)}}),c?{passive:!0}:void 0),this}))}text(e){return 0 in arguments?this.each((t=>{t.innerText=e})):0 in this.elems?this.elems[0].innerText:null}html(e){return 0 in arguments?this.each((t=>{t.innerHTML=e})):0 in this.elems?this.elems[0].innerHTML:null}content(e){return 0 in arguments?this.each((t=>{t.innerContent=e})):0 in this.elems?this.elems[0].innerContent:null}addClass(e){return this.each((t=>{t.addClass(e)}))}removeClass(e){return this.each((t=>{t.removeClass(e)}))}toggleClass(e){return this.each((t=>{t.classList.toggle(e)}))}replaceClass(e,t){return this.each((s=>{s.classList.replace(e,t)}))}hasClass(e){return 0 in this.elems&&this.elems[0].classList.contains(e)}hasClasses(e){return 0 in this.elems&&this.elems[0].hasClasses(e)}hasAllClasses(e){return 0 in this.elems&&this.elems[0].hasAllClasses(e)}containsClass(e){if(0 in this.elems)for(var t=this.elems[0].classList,s=0;s<t.length;s++)if(t[s].indexOf(e)>-1)return!0;return!1}toggle(){return this.each((e=>{const t=f(e);e.data("cssInitialDisplay")||e.data("cssInitialDisplay",t),"none"===e.css("display")?e.style.display="block":e.style.display="none"}))}show(){return this.each((e=>{const t=f(e);e.data("cssInitialDisplay")||e.data("cssInitialDisplay",t),e.style.display=t}))}hide(){return this.each((e=>{e.data("cssInitialDisplay")||e.data("cssInitialDisplay",f(e)),e.style.display="none"}))}offset(){if(0===this.elems.length)return{top:0,left:0};const e=this.elems[0].getBoundingClientRect();return{top:e.top+window.pageYOffset,left:e.left+window.pageXOffset}}serialize(){if(!(0 in this.elems))return"";const e=new FormData(this.elems[0]);return new URLSearchParams(e).toString()}css(e,t,s){if(1 in arguments)return this.each((n=>{w(n,e,t,s||!1)}));if(0 in this.elems){if("string"==typeof e)return w(this.elems[0],e);const t={};if(Array.isArray(e)){const s=this.elems[0];e.forEach((e=>{t[e]=w(s,e)}))}return t}return null}data(e,t){return 0 in arguments&&e?1 in arguments?this.each((s=>{b(s,e,t)})):0 in this.elems?b(this.elems[0],e):void 0:0 in this.elems?b(this.elems[0]):{}}attr(e,t){if(1 in arguments)return this.each((s=>{1===s.nodeType&&p(s,e,t)}));let s=null;return 0 in this.elems&&1==this.elems[0].nodeType&&(s=this.elems[0].getAttribute(e)),s}prop(e,t){if(e=o[e]||e,1 in arguments)return this.each((s=>{s[e]=t}));let s=null;return 0 in this.elems&&(s=this.elems[0][e]),s}tagName(e){let t=0 in this.elems?this.elems[0].tagName:null;return t&&(t=t.toLowerCase(),e&&(t=t.toUpperCase())),t}val(e){return 0 in arguments?(null==e&&(e=""),this.each((t=>{t.value=e}))):0 in this.elems?this.elems[0].value:null}outerHeight(){let e=0;return 0 in this.elems&&(e+=parseInt(this.elems[0].css("height")),e+=parseInt(this.elems[0].css("padding-top")),e+=parseInt(this.elems[0].css("padding-bottom")),e+=parseInt(this.elems[0].css("margin-top")),e+=parseInt(this.elems[0].css("margin-bottom"))),e}outerWidth(){let e=0;return 0 in this.elems&&(e+=parseInt(this.elems[0].css("width")),e+=parseInt(this.elems[0].css("padding-left")),e+=parseInt(this.elems[0].css("padding-right")),e+=parseInt(this.elems[0].css("margin-left")),e+=parseInt(this.elems[0].css("margin-right"))),e}slideDown(e,t,s,n){return window.Promise?(e=e||500,t=t||"cubic-bezier(0.25, 0.1, 0.44, 1.4)",s=s||200,this.each((i=>C(i,{direction:"down",slideSpeed:e,easing:t,delay:s,visibleDisplayValue:n||f(i)})))):this.show()}slideUp(e,t,s){return window.Promise?(e=e||500,t=t||"cubic-bezier(0.25, 0.1, 0.44, 1.4)",s=s||200,this.each((n=>C(n,{direction:"up",slideSpeed:e,easing:t,delay:s})))):this.hide()}slideToggle(e,t,s,n){return window.Promise?(e=e||500,t=t||"cubic-bezier(0.25, 0.1, 0.44, 1.4)",s=s||200,this.each((i=>C(i,{slideSpeed:e,easing:t,delay:s,visibleDisplayValue:n||f(i)})))):this.toggle()}scrollTop(e){return 0 in arguments?this.each((t=>{t.style.scrollBehavior="smooth",t.scrollTop=e||0})):0 in this.elems?this.elems[0].scrollTop:0}}return E}();e.DOM=t}("undefined"!=typeof window?window:this);
|