jizy-dom 2.1.6 → 2.1.8

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/README.md CHANGED
@@ -1,10 +1,141 @@
1
- # jizy-dom
2
- DOM js implementation
3
-
4
-
5
- ## `lib/js` Directory
6
-
7
- This folder contains the core JavaScript modules for DOM manipulation:
8
-
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.
1
+ # jizy-dom
2
+
3
+ A lightweight, chainable DOM manipulation library — a small jQuery-like wrapper over native DOM APIs, with no runtime dependencies.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install jizy-dom
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ESM (Node / bundlers):
14
+
15
+ ```js
16
+ import DOM from 'jizy-dom';
17
+
18
+ const $items = new DOM('.item');
19
+ $items.addClass('active').on('click', (e) => console.log(e.target));
20
+ ```
21
+
22
+ Browser (UMD/IIFE bundle, exposes the `DOM` global):
23
+
24
+ ```html
25
+ <script src="node_modules/jizy-dom/dist/js/jizy-dom.min.js"></script>
26
+ <script>
27
+ new DOM('.item').show();
28
+ </script>
29
+ ```
30
+
31
+ ## Constructor
32
+
33
+ ```js
34
+ new DOM(selector, parent)
35
+ ```
36
+
37
+ `selector` may be a CSS string, a single `Element`, an array/NodeList of elements, or another `DOM` instance. `parent` is optional and may be a CSS string, an `Element`, or another `DOM` instance — when given, the lookup is scoped to it. Passing a `DOM` instance as `selector` returns it as-is.
38
+
39
+ ## `lib/js` directory
40
+
41
+ - **dom.js** — the `DOM` class (chainable API), CSS/data/class helpers, and a small `slide` animation primitive.
42
+ - **selector.js** — lightweight selector engine that normalizes the input (string, node, NodeList, window/document) and returns a flat array of elements.
43
+
44
+ ## API
45
+
46
+ All chainable methods return the `DOM` instance. Read methods return the requested value (or `null`/`false`/`undefined` when nothing matches).
47
+
48
+ ### Traversal & access
49
+
50
+ - `toArray()` — underlying elements as a plain array.
51
+ - `exists()` / `size()` — has matches / count.
52
+ - `each(cb)` — iterate `(el, i)`.
53
+ - `map(cb)` — collect callback return values; entries returning `false` are skipped.
54
+ - `filter(cbOrSelector)` — keep elements matching a selector or for which the callback returns truthy.
55
+ - `not(selector)` — inverse of `filter`.
56
+ - `get(index)` — single-element `DOM` at `index` (negative indexes count from the end).
57
+ - `getElement(tag)` — the first raw `Element`, or a freshly created `<tag>` (default `div`) when empty.
58
+ - `is(selector)` — match against a selector, an `Element`, a `DOM` instance, or the pseudo-selectors `:visible` / `:hidden`.
59
+ - `find(selector)` — descendants matching the selector; supports comma lists and a leading `>` for direct children.
60
+ - `parent(selector?)`, `children(selector?)`, `closest(selector)`, `prev(selector?)`, `next(selector?)`, `first(selector?)`, `last(selector?)`.
61
+
62
+ ### Mutation
63
+
64
+ - `insert(newEl, position)` — `position` accepts `before` / `after` / `prepend` / `append` (mapped to `insertAdjacent*`). `newEl` may be a `DOM`, an `Element`, or an HTML string.
65
+ - `before(newEl)`, `after(newEl)`, `append(newEl)`, `prepend(newEl)`.
66
+ - `replaceWith(newEl)`, `remove()`, `wrap(wrapper)`.
67
+
68
+ ### Content
69
+
70
+ - `text(value?)`, `html(value?)`, `content(value?)` — getter when called with no argument, setter otherwise.
71
+
72
+ ### Classes
73
+
74
+ - `addClass(name)`, `removeClass(name)`, `toggleClass(name)`, `replaceClass(oldClass, newClass)`.
75
+ - `hasClass(name)`, `hasClasses(names)` (any), `hasAllClasses(names)` (all), `containsClass(substring)`.
76
+
77
+ ### CSS / visibility
78
+
79
+ - `css(prop)` — read computed/inline value.
80
+ - `css(prop, value, important?)` — set; numeric values get `px` appended for size/spacing properties; pass `null` to remove.
81
+ - `css(['prop1','prop2'])` — read multiple values into an object.
82
+ - `show()`, `hide()`, `toggle()` — track the original `display` via `data-css-initial-display`.
83
+ - `offset()` — `{ top, left }` relative to the document.
84
+ - `outerHeight()`, `outerWidth()` — content + padding + margin.
85
+
86
+ ### Data & attributes
87
+
88
+ - `data()` / `data(key)` / `data(key, value)` — read all dataset values, read one, or write one. Values are deserialized: `"true"`/`"false"`/`"null"`, numbers, and JSON literals are parsed; everything else stays a string. Object values are written as `data-key-subkey`.
89
+ - `attr(name)` / `attr(name, value)` — `setAttribute` / `getAttribute`; passing `null` removes the attribute.
90
+ - `prop(name)` / `prop(name, value)` — DOM property access with HTML→DOM remapping (`class` → `className`, `for` → `htmlFor`, `tabindex` → `tabIndex`, etc.).
91
+ - `tagName(uppercase?)` — tag name of the first element.
92
+ - `val(value?)` — form-control value getter/setter.
93
+
94
+ ### Events
95
+
96
+ - `on(events, listener, options?)` — space-separated event list; `options` is forwarded to `addEventListener`.
97
+ - `off(events, listener)`.
98
+ - `delegate(events, selector, listener, options?)` — runs `listener` only when `event.target` matches `selector`.
99
+ - `trigger(eventName, eventData?, bubbles?, cancellable?)` — dispatches a `CustomEvent` when `eventData` is given, otherwise a plain `Event`.
100
+ - `submit()`, `focus()`.
101
+ - `swipe(swipeCb, ignoreCb?, params?)` — touch-swipe detector. `swipeCb(event, dir)` receives `'left' | 'right' | 'up' | 'down' | 'none'`. `params` overrides `{ scrolling: false, threshold: 10, restraint: 100, allowedTime: 300 }`. Uses passive listeners when supported.
102
+
103
+ ### Animation & scroll
104
+
105
+ - `slideDown(speed?, easing?, delay?, display?)`.
106
+ - `slideUp(speed?, easing?, delay?)`.
107
+ - `slideToggle(speed?, easing?, delay?, display?)` — falls back to `show`/`hide`/`toggle` when `Promise` is unavailable. Defaults: `speed=500`, `easing='cubic-bezier(0.25, 0.1, 0.44, 1.4)'`, `delay=200`. Hidden state is tracked via the `slider-hidden` class.
108
+ - `scrollTop(position?)` — read or smooth-scroll the first element.
109
+
110
+ ### Forms
111
+
112
+ - `serialize()` — first matched form serialized as a URL-encoded query string via `FormData` + `URLSearchParams`.
113
+
114
+ ## Per-element helpers
115
+
116
+ Inside `each`/`map` callbacks, the raw `Element` is decorated with shorthand methods bound to that element: `el.data`, `el.css`, `el.addClass`, `el.removeClass`, `el.hasClass`, `el.hasClasses`, `el.hasAllClasses`. They behave like their `DOM` counterparts but operate on the single element.
117
+
118
+ ## Build
119
+
120
+ This package follows the standard `jizy-*` packer layout. Build commands:
121
+
122
+ ```bash
123
+ npm run jpack:dist # build dist/ from lib/
124
+ npm run jpack:export # consumer-specific build (--name perso)
125
+ ```
126
+
127
+ The browser bundle exposes the global `DOM` (configured in `config/jpack.js`).
128
+
129
+ ## Tests
130
+
131
+ Vitest + happy-dom. Tests live under `tests/`.
132
+
133
+ ```bash
134
+ npm run test # watch mode
135
+ npm run test:run # one-shot
136
+ npm run test:coverage # with coverage
137
+ ```
138
+
139
+ ## License
140
+
141
+ MIT — see [LICENSE](LICENSE).
@@ -1,2 +1,2 @@
1
- /*! DOM v2.1.6 | MIT | 2026-04-23T09:17Z | [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);
1
+ /*! DOM v2.1.7 | MIT | 2026-05-06T16:13Z | [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 u(e){return e.replace(/-([a-z])/g,e=>e[1].toUpperCase())}function d(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(t)]&&l.test(u(t))&&(s+="px"),void(n?e.style.setProperty(h(t),s,"important"):e.style[u(t)]=s)):e.style[u(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),u="none"===h.getPropertyValue("display"),d=n||(u||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"!==d||u||e.classList.contains("slider-hidden")?"up"===d&&e.classList.contains("slider-hidden")?Promise.resolve(e):(e.dataset.sliding=!0,e.setAttribute("aria-hidden","down"===d?"false":"true"),"down"===d&&u&&(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++){const t=this.elems[e];t.data=function(e,s){return 0===arguments.length?b(t):1===arguments.length?b(t,e):(b(t,e,s),t)},t.css=function(e,s,n){return arguments.length>=2?w(t,e,s,n||!1):w(t,e)},t.addClass=e=>v(t,"add",e),t.removeClass=e=>v(t,"remove",e),t.hasClass=e=>v(t,"contains",e),t.hasClasses=e=>g(t,e),t.hasAllClasses=e=>y(t,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=>!!d(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{let 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"):d(this.elems[0],e))}find(e){const t=e.trim().split(/,\s*/);let 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)d(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){let t=[];return this.each(e=>{const s=e.parentNode;s&&(t=t.concat(s))}),m(t,e||null)}children(e){let t=[];return this.each(e=>{const s=e.childNodes;s&&(t=t.concat(Array.from(s)))}),m(t,e||null)}closest(e){let t=[];return this.each(s=>{const n=s.closest(e);n&&(t=t.concat(n))}),new E(t)}prev(e){let t=[];return this.each(e=>{const s=e.previousElementSibling;s&&(t=t.concat(s))}),m(t,e||null)}next(e){let t=[];return this.each(e=>{const s=e.nextElementSibling;s&&(t=t.concat(s))}),m(t,e||null)}first(e){let t=[];return this.each(e=>{const s=e.firstElementChild;s&&(t=t.concat(s))}),m(t,e||null)}last(e){let 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,u,d,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,d=(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,u=(new Date).getTime()-d,u<=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/js/dom.js CHANGED
@@ -168,7 +168,7 @@ function css(element, key, value, priority) {
168
168
  return;
169
169
  }
170
170
 
171
- if (typeof value == "number" && !cssNumber[dasherize(name)] && stylePropertyInPxRE.test(camelize(name))) {
171
+ if (typeof value == "number" && !cssNumber[dasherize(key)] && stylePropertyInPxRE.test(camelize(key))) {
172
172
  value += "px";
173
173
  }
174
174
 
@@ -305,42 +305,25 @@ class DOM {
305
305
  this.elems = Selector(selector, parent);
306
306
 
307
307
  for (let i = 0; i < this.elems.length; i++) {
308
- this.elems[i].data = (key, value) => {
309
- if (0 in arguments && key) {
310
- if (1 in arguments) {
311
- data(this, key, value);
312
- return this;
313
- }
314
-
315
- return data(this, key);
316
- }
317
-
318
- return data(this);
319
- };
320
-
321
- this.elems[i].css = (key, value, priority) => {
322
- return 1 in arguments ? css(this, key, value, priority || false) : css(this, key);
323
- };
324
-
325
- this.elems[i].addClass = (className) => {
326
- return classList(this, 'add', className);
327
- };
308
+ const el = this.elems[i];
328
309
 
329
- this.elems[i].removeClass = (className) => {
330
- return classList(this, 'remove', className);
310
+ el.data = function (key, value) {
311
+ if (arguments.length === 0) return data(el);
312
+ if (arguments.length === 1) return data(el, key);
313
+ data(el, key, value);
314
+ return el;
331
315
  };
332
316
 
333
- this.elems[i].hasClass = (className) => {
334
- return classList(this, 'contains', className);
317
+ el.css = function (key, value, priority) {
318
+ if (arguments.length >= 2) return css(el, key, value, priority || false);
319
+ return css(el, key);
335
320
  };
336
321
 
337
- this.elems[i].hasClasses = (classNames) => {
338
- return hasClasses(this, classNames);
339
- };
340
-
341
- this.elems[i].hasAllClasses = (classNames) => {
342
- return hasAllClasses(this, classNames);
343
- };
322
+ el.addClass = (className) => classList(el, 'add', className);
323
+ el.removeClass = (className) => classList(el, 'remove', className);
324
+ el.hasClass = (className) => classList(el, 'contains', className);
325
+ el.hasClasses = (classNames) => hasClasses(el, classNames);
326
+ el.hasAllClasses = (classNames) => hasAllClasses(el, classNames);
344
327
  }
345
328
 
346
329
  return this;
@@ -396,7 +379,7 @@ class DOM {
396
379
  });
397
380
  }
398
381
  else {
399
- const excludes = [];
382
+ let excludes = [];
400
383
  if (typeof selector == 'string') {
401
384
  excludes = this.filter(selector);
402
385
  }
@@ -453,7 +436,7 @@ class DOM {
453
436
  }
454
437
  find(selector) {
455
438
  const selectors = selector.trim().split(/,\s*/);
456
- const elems = [];
439
+ let elems = [];
457
440
 
458
441
  this.each(function (el) {
459
442
  for (let i = 0, n = selectors.length; i < n; i++) {
@@ -533,7 +516,7 @@ class DOM {
533
516
  });
534
517
  }
535
518
  parent(selector) {
536
- const elems = [];
519
+ let elems = [];
537
520
 
538
521
  this.each((el) => {
539
522
  const elFound = el.parentNode;
@@ -545,19 +528,19 @@ class DOM {
545
528
  return filtered(elems, selector || null);
546
529
  }
547
530
  children(selector) {
548
- const elems = [];
531
+ let elems = [];
549
532
 
550
533
  this.each((el) => {
551
534
  const children = el.childNodes;
552
535
  if (children) {
553
- elems = elems.concat(children);
536
+ elems = elems.concat(Array.from(children));
554
537
  }
555
538
  });
556
539
 
557
540
  return filtered(elems, selector || null);
558
541
  }
559
542
  closest(selector) {
560
- const elems = [];
543
+ let elems = [];
561
544
 
562
545
  this.each((el) => {
563
546
  const elFound = el.closest(selector);
@@ -569,7 +552,7 @@ class DOM {
569
552
  return new DOM(elems);
570
553
  }
571
554
  prev(selector) {
572
- const elems = [];
555
+ let elems = [];
573
556
 
574
557
  this.each((el) => {
575
558
  const prev = el.previousElementSibling;
@@ -581,7 +564,7 @@ class DOM {
581
564
  return filtered(elems, selector || null);
582
565
  }
583
566
  next(selector) {
584
- const elems = [];
567
+ let elems = [];
585
568
 
586
569
  this.each((el) => {
587
570
  const next = el.nextElementSibling;
@@ -593,7 +576,7 @@ class DOM {
593
576
  return filtered(elems, selector || null);
594
577
  }
595
578
  first(selector) {
596
- const elems = [];
579
+ let elems = [];
597
580
 
598
581
  this.each((el) => {
599
582
  const first = el.firstElementChild;
@@ -605,7 +588,7 @@ class DOM {
605
588
  return filtered(elems, selector || null);
606
589
  }
607
590
  last(selector) {
608
- const elems = [];
591
+ let elems = [];
609
592
 
610
593
  this.each((el) => {
611
594
  const last = el.lastElementChild;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jizy-dom",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "browser": "dist/js/jizy-dom.min.js",
5
5
  "main": "lib/index.js",
6
6
  "type": "module",
@@ -11,9 +11,10 @@
11
11
  ],
12
12
  "scripts": {
13
13
  "jpack:export": "node ./cli/jpack.js --action build --name perso",
14
- "jpack:export-debug": "node ./cli/jpack.js --action build --name perso --debug",
15
14
  "jpack:dist": "node ./cli/jpack.js",
16
- "jpack:dist-debug": "node ./cli/jpack.js --debug"
15
+ "test": "vitest",
16
+ "test:run": "vitest run",
17
+ "test:coverage": "vitest run --coverage"
17
18
  },
18
19
  "repository": {
19
20
  "type": "git",
@@ -28,6 +29,8 @@
28
29
  "description": "A lightweight DOM manipulation library",
29
30
  "homepage": "https://jizy.joffreydemetz.com/dom",
30
31
  "devDependencies": {
31
- "jizy-packer": "^2.1.44"
32
+ "happy-dom": "^20.9.0",
33
+ "jizy-packer": "^2.1.44",
34
+ "vitest": "^4.1.5"
32
35
  }
33
- }
36
+ }