From caa4cd84ed9d821b52ff87f0e79d2b3b4b3f16ba Mon Sep 17 00:00:00 2001 From: Jan Andrle Date: Tue, 7 Nov 2023 21:58:48 +0100 Subject: [PATCH] docs + readme --- README.md | 140 +++++----------- bs/build.js | 9 -- dist/dde-with-signals.gzip.js | Bin 4173 -> 0 bytes dist/dde-with-signals.js | 8 +- dist/dde.gzip.js | Bin 2722 -> 0 bytes dist/dde.js | 6 +- dist/esm-with-signals.d.ts | 34 ++-- dist/esm-with-signals.gzip.js | Bin 4107 -> 0 bytes dist/esm-with-signals.js | 6 +- dist/esm.d.ts | 34 ++-- dist/esm.gzip.js | Bin 2654 -> 0 bytes dist/esm.js | 2 +- docs/elements.html | 14 +- docs/index.html | 4 +- docs_src/index.html.js | 17 -- package-lock.json | 292 ---------------------------------- package.json | 1 - 17 files changed, 106 insertions(+), 461 deletions(-) delete mode 100644 dist/dde-with-signals.gzip.js delete mode 100644 dist/dde.gzip.js delete mode 100644 dist/esm-with-signals.gzip.js delete mode 100644 dist/esm.gzip.js diff --git a/README.md b/README.md index a4622aa..f765216 100644 --- a/README.md +++ b/README.md @@ -1,104 +1,8 @@ **WIP** (the experimentation phase) | [source code on GitHub](https://github.com/jaandrle/deka-dom-el) | [*mirrored* on Gitea](https://gitea.jaandrle.cz/jaandrle/deka-dom-el) -# Deka DOM Elements -This is reimplementation of [jaandrle/dollar_dom_component: Functional DOM components without JSX and virtual DOM.](https://github.com/jaandrle/dollar_dom_component). +***Vanilla by default — steroids if needed*** +*…use simple DOM API by default and library tools and logic when you need them* -The goal is to be even more close to the native JavaScript. - -# Native JavaScript DOM elements creations -Let’s go through all patterns we would like to use and what needs to be improved for better experience. - -## Creating element and DOM templates natively -```js -document.body.append( - document.createElement("div"), - document.createElement("span"), - document.createElement("main") -); -//=> HTML output:
-const template= document.createElement("main").append( - document.createElement("div"), - document.createElement("span"), -); -//=> ★:: typeof template==="undefined" -``` -**Pitfalls**: -- there is lots of text -- `.append` methdo returns `void`⇒ it cannot be chained (see ★) - -## Set properties of created element -```js -const element= Object.assign(document.createElement("p"), { className: "red", textContent: "paragraph" }); -document.body.append(element); -//=> HTML output:

paragraph

-``` -**Pitfalls**: -- there is lots of text -- `Object.assign` isn’t ideal as it can set only (some) [IDL](https://developer.mozilla.org/en-US/docs/Glossary/IDL) - -# Events and dynamic parts -```js -const input= document.createElement("input"); -const output= document.createElement("output"); -input.addEventListener("change", function(event){ - output.value= event.target.value; -}); -document.body.append( - output, - input -); -//=> HTML output: -``` -**Pitfalls**: -- there is lots of text -- very hard to organize code - -# Helpers and modifications -Now, let's introduce library helpers and modifications. - -## `.append` -The `.append` is owerwrote to always returns element. This seem to be the best way to do it as it is very hard -to create Proxy around `HTMLElement`, …. -```js -document.body.append( - document.createElement("main").append( - document.createElement("div"), - document.createElement("span"), - ) -); -//=> HTML output:
-``` - -## `el` and `assign` functions -```js -const element= assign(document.createElement("a"), { - className: "red", - dataTest: "test", - href: "www.seznam.cz", - textContent: "Link", - style: { color: "blue" } -}); -document.body.append(element); -assign(element, { style: undefined }); -//=> HTML output: Link -``` -…but for elements/template creations `el` is even better: -```js -document.body.append( - el("div").append( - el("p").append( - el("#text", { textContent: "Link: " }), - el("a", { - href: "www.seznam.cz", - textContent: "example", - }) - ) - ) -); -``` - -## Events and signals for reactivity -*investigation*: ```js const value= S(""); document.body.append( @@ -107,3 +11,43 @@ document.body.append( on("change", event=> value(event.target.value))) ); ``` +# Deka DOM Elements +Creating reactive elements, components and Web components using [IDL](https://developer.mozilla.org/en-US/docs/Glossary/IDL)/JavaScript DOM API and signals ([Signals — whats going on behind the scenes | by Ryan Hoffnan | +ITNEXT](https://itnext.io/signals-whats-going-on-behind-the-scenes-ec858589ea63) or [The Evolution of Signals in JavaScript - DEV Community](https://dev.to/this-is-learning/the-evolution-of-signals-in-javascript-8ob)). + +## Inspiration and suggested alternatives +- my previous (mostly internal) library: [jaandrle/dollar_dom_component: Functional DOM components without JSX and virtual DOM.](https://github.com/jaandrle/dollar_dom_component) +- [vanjs-org/van: 🍦 VanJS: World's smallest reactive UI framework. Incredibly Powerful, Insanely Small - Everyone can build a useful UI app in an hour.](https://github.com/vanjs-org/van) +- [hyperhype/hyperscript: Create HyperText with JavaScript.](https://github.com/hyperhype/hyperscript) +- [adamhaile/S: S.js - Simple, Clean, Fast Reactive Programming in Javascript](https://github.com/adamhaile/S) ([adamhaile/surplus: High performance JSX web views for S.js applications](https://github.com/adamhaile/surplus)) +- [potch/signals: a small reactive signals library](https://github.com/potch/signals) + +## Why an another one? +This library should lies somewhere between van/hyperscript and [solid-js](https://github.com/solidjs/solid) (S). +In the meaning of size, complexity and usability. + +An another goal is making clear library logic. Starting from pure native JavaScript (DOM API), +then using small utils (`assign`, `S`, …, `el`, …) and end up with way to write complex code. +Therefore, you can use any „internal” function to make live with native JavaScript easier +(`assign`, `classListDeclarative`, `on`, `dispatchEvent`, …, `S`, …) regarding if you don’t +need complex library/framework. + +As consequence of that, it shouldn’t be hard to incorporate the library into existing projects. +That can make potecial migration easier. + +To balance all requirements above, lots of compromises have been made. To sumarize: +- [x] library size 10–15kB minified (10kB originaly) +- [x] allow using *signals optionaly* and allow registering *own signals implementation* +- [x] *no build step required* +- [x] prefer a *declarative/functional* approach +- [x] prefer zero/minimal dependencies +- [ ] support/enhance custom elements (web components) +- [x] support SSR ([jsdom](https://github.com/jsdom/jsdom)) +- [ ] WIP provide types + +## First steps +- [**Guide**](https://jaandrle.github.io/deka-dom-el) +- Documentation +- Instalation + - npm + - [dist/](dist/) (`https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/`…) diff --git a/bs/build.js b/bs/build.js index 4079552..a0d756b 100755 --- a/bs/build.js +++ b/bs/build.js @@ -1,6 +1,5 @@ #!/usr/bin/env -S npx nodejsscript import { bundle as bundleDTS } from "dts-bundler"; -import compressing from "compressing"; const files= [ "index", "index-with-signals" ]; const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark); const css= echo.css` @@ -31,10 +30,6 @@ $.api("", true) f=> s.echo(f).to(out) )(s.cat(out)); - const file_gzip_out= filesOut(file_root+".gzip.js"); - echoVariant(file_gzip_out); - await compressing.gzip.compressFile(out, file_gzip_out); - const file_dts= file_root+".d.ts"; const file_dts_out= filesOut(file_dts); echoVariant(file_dts_out); @@ -58,10 +53,6 @@ $.api("", true) content.join(""), "})();" ].join("\n")).to(out); - - const out_gzip= filesOut(file_root+".gzip.js", name); - echoVariant(out_gzip); - await compressing.gzip.compressFile(out, out_gzip); } }) .parse(); diff --git a/dist/dde-with-signals.gzip.js b/dist/dde-with-signals.gzip.js deleted file mode 100644 index dd146c5ac60acac44581dd669a73e618555e3153..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4173 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 X-s+%D4i2E;3X}f@G*O7V6e<7!L)ZE5 diff --git a/dist/dde-with-signals.js b/dist/dde-with-signals.js index 4372403..32c3b60 100644 --- a/dist/dde-with-signals.js +++ b/dist/dde-with-signals.js @@ -1,9 +1,9 @@ //deka-dom-el library is available via global namespace `dde` (()=> { -var w={isSignal(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function k(t,e=!0){return e?Object.assign(w,t):(Object.setPrototypeOf(t,w),t)}function O(t){return w.isPrototypeOf(t)&&t!==w?t:w}function _(t){return typeof t>"u"}function F(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function R(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var $={setDeleteAttr:K};function K(t,e,n){if(Reflect.set(t,e,n),!!_(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var y=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],z=t=>t==="svg"?"http://www.w3.org/2000/svg":t,m={get current(){return y[y.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=z(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return m.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...y]},push(t={}){return t.namespace&&(t.namespace=z(t.namespace)),y.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return y.pop()}};function ht(t,e,...n){let r=O(this),{namespace:o}=m,c=0,s,d;switch((Object(e)!==e||r.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{c=1,m.push({scope:t,host:E=>E?(c===1?n.unshift(E):E(d),void 0):d}),s=t(e||void 0);let a=s instanceof DocumentFragment,g=document.createComment(``);s.prepend(g),a&&(d=g);break}case t==="#text":s=C.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):s=C.call(this,document.createDocumentFragment(),e);break;case o!=="html":s=C.call(this,document.createElementNS(o,t),e);break;case!s:s=C.call(this,document.createElement(t),e)}return d||(d=s),n.forEach(a=>a(d)),c&&m.pop(),c=2,s}var{setDeleteAttr:H}=$,L=new WeakMap;function C(t,...e){if(!e.length)return t;L.set(t,B(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))q.call(this,t,n,r);return L.delete(t),t}function q(t,e,n){let{setRemoveAttr:r,s:o}=B(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,a)=>q.call(c,t,d,a));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return U(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return H(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return T(o,n,U.bind(null,t[e]));case"ariaset":return T(o,n,(d,a)=>r("aria-"+d,a));case"classList":return Q.call(c,t,n)}return X(t,e)?H(t,e,n):r(e,n)}function B(t,e){if(L.has(t))return L.get(t);let r=(t instanceof SVGElement?tt:Y).bind(null,t,"Attribute"),o=O(e);return{setRemoveAttr:r,s:o}}function Q(t,e){let n=O(this);return T(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function gt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function X(t,e){if(!Reflect.has(t,e))return!1;let n=G(t,e);return!_(n.set)}function G(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||G(t,e)}function T(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function I(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Y(t,e,n,r){return t[(_(r)?"remove":"set")+e](n,I(r))}function tt(t,e,n,r,o=null){return t[(_(r)?"remove":"set")+e+"NS"](o,n,I(r))}function U(t,e,n){if(Reflect.set(t,e,n),!!_(n))return Reflect.deleteProperty(t,e)}function Et(t,e,...n){let r=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(r)}function v(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var N=nt(),et=new WeakSet;v.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents?o:o.isConnected?(o.dispatchEvent(new Event(c)),o):(R(e.signal,()=>N.offConnected(o,t))&&N.onConnected(o,t),o)}};v.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||R(e.signal,()=>N.offDisconnected(o,t))&&N.onDisconnected(o,t),o}};v.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||et.has(o))return o;let s=new MutationObserver(function(a){for(let{attributeName:g,target:E}of a)E.dispatchEvent(new CustomEvent(c,{detail:[g,E.getAttribute(g)]}))});return R(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function nt(){let t=new Map,e=!1,n=new MutationObserver(function(i){for(let u of i)if(u.type==="childList"){if(g(u.addedNodes,!0)){s();continue}E(u.removedNodes,!0)&&s()}});return{onConnected(i,u){c();let f=o(i);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let f=t.get(i);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(i,f))},onDisconnected(i,u){c();let f=o(i);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let f=t.get(i);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(i,f))}};function r(i,u){u.length_c||u.length_d||(t.delete(i),s())}function o(i){if(t.has(i))return t.get(i);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,u),u}function c(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function s(){!e||t.size||(e=!1,n.disconnect())}function d(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function a(i){t.size>30&&await d();let u=[];if(!(i instanceof Node))return u;for(let f of t.keys())f===i||!(f instanceof Node)||i.contains(f)&&u.push(f);return u}function g(i,u){let f=!1;for(let b of i){if(u&&a(b).then(g),!t.has(b))continue;let x=t.get(b);x.length_c&&(b.dispatchEvent(new Event("dde:connected")),x.connected=new WeakSet,x.length_c=0,x.length_d||t.delete(b),f=!0)}return f}function E(i,u){let f=!1;for(let b of i)u&&a(b).then(E),!(!t.has(b)||!t.get(b).length_d)&&(b.dispatchEvent(new Event("dde:disconnected")),t.delete(b),f=!0);return f}}[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}});var p=Symbol.for("Signal");function P(t){try{return Reflect.has(t,p)}catch{return!1}}var j=[],h=new WeakMap;function l(t,e){if(typeof t!="function")return J(t,e);if(P(t))return t;let n=J(),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),j.push(r),n(t()),j.pop(),!c.length)return;let s=h.get(r);for(let d of c)s.has(d)||A(d,r)};return h.set(n[p],r),h.set(r,new Set([n])),r(),n}l.action=function(t,e,...n){let r=t[p],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};l.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));W(e,n),o&&o.addEventListener("abort",()=>A(e,n))}};l.symbols={signal:p,onclear:Symbol.for("Signal.onclear")};var S="__dde_attributes";l.attribute=function(t,e=void 0){let n=l(e);return m.host(r=>{if(r instanceof HTMLElement?r.hasAttribute(t)&&n(r.getAttribute(t)):r.hasAttributeNS(null,t)&&n(r.getAttributeNS(null,t)),r[S]){r[S][t]=n;return}return r[S]={[t]:n},v.attributeChanged(function({detail:c}){/*! This maps attributes to signals (`S.attribute`). +var w={isSignal(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function k(t,e=!0){return e?Object.assign(w,t):(Object.setPrototypeOf(t,w),t)}function O(t){return w.isPrototypeOf(t)&&t!==w?t:w}function _(t){return typeof t>"u"}function W(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function R(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var $={setDeleteAttr:K};function K(t,e,n){if(Reflect.set(t,e,n),!!_(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var y=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],z=t=>t==="svg"?"http://www.w3.org/2000/svg":t,b={get current(){return y[y.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=z(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return b.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...y]},push(t={}){return t.namespace&&(t.namespace=z(t.namespace)),y.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return y.pop()}};function ht(t,e,...n){let r=O(this),{namespace:o}=b,c=0,s,d;switch((Object(e)!==e||r.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{c=1,b.push({scope:t,host:E=>E?(c===1?n.unshift(E):E(d),void 0):d}),s=t(e||void 0);let a=s instanceof DocumentFragment,g=document.createComment(``);s.prepend(g),a&&(d=g);break}case t==="#text":s=C.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):s=C.call(this,document.createDocumentFragment(),e);break;case o!=="html":s=C.call(this,document.createElementNS(o,t),e);break;case!s:s=C.call(this,document.createElement(t),e)}return d||(d=s),n.forEach(a=>a(d)),c&&b.pop(),c=2,s}var{setDeleteAttr:H}=$,L=new WeakMap;function C(t,...e){if(!e.length)return t;L.set(t,B(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))q.call(this,t,n,r);return L.delete(t),t}function q(t,e,n){let{setRemoveAttr:r,s:o}=B(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,a)=>q.call(c,t,d,a));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return U(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return H(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return T(o,n,U.bind(null,t[e]));case"ariaset":return T(o,n,(d,a)=>r("aria-"+d,a));case"classList":return Q.call(c,t,n)}return X(t,e)?H(t,e,n):r(e,n)}function B(t,e){if(L.has(t))return L.get(t);let r=(t instanceof SVGElement?tt:Y).bind(null,t,"Attribute"),o=O(e);return{setRemoveAttr:r,s:o}}function Q(t,e){let n=O(this);return T(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function gt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function X(t,e){if(!Reflect.has(t,e))return!1;let n=G(t,e);return!_(n.set)}function G(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||G(t,e)}function T(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function I(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Y(t,e,n,r){return t[(_(r)?"remove":"set")+e](n,I(r))}function tt(t,e,n,r,o=null){return t[(_(r)?"remove":"set")+e+"NS"](o,n,I(r))}function U(t,e,n){if(Reflect.set(t,e,n),!!_(n))return Reflect.deleteProperty(t,e)}function Et(t,e,...n){let r=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(r)}function v(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var D=nt(),et=new WeakSet;v.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents?o:o.isConnected?(o.dispatchEvent(new Event(c)),o):(R(e.signal,()=>D.offConnected(o,t))&&D.onConnected(o,t),o)}};v.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||R(e.signal,()=>D.offDisconnected(o,t))&&D.onDisconnected(o,t),o}};v.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||et.has(o))return o;let s=new MutationObserver(function(a){for(let{attributeName:g,target:E}of a)E.dispatchEvent(new CustomEvent(c,{detail:[g,E.getAttribute(g)]}))});return R(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function nt(){let t=new Map,e=!1,n=new MutationObserver(function(i){for(let u of i)if(u.type==="childList"){if(g(u.addedNodes,!0)){s();continue}E(u.removedNodes,!0)&&s()}});return{onConnected(i,u){c();let f=o(i);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let f=t.get(i);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(i,f))},onDisconnected(i,u){c();let f=o(i);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let f=t.get(i);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(i,f))}};function r(i,u){u.length_c||u.length_d||(t.delete(i),s())}function o(i){if(t.has(i))return t.get(i);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,u),u}function c(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function s(){!e||t.size||(e=!1,n.disconnect())}function d(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function a(i){t.size>30&&await d();let u=[];if(!(i instanceof Node))return u;for(let f of t.keys())f===i||!(f instanceof Node)||i.contains(f)&&u.push(f);return u}function g(i,u){let f=!1;for(let m of i){if(u&&a(m).then(g),!t.has(m))continue;let x=t.get(m);x.length_c&&(m.dispatchEvent(new Event("dde:connected")),x.connected=new WeakSet,x.length_c=0,x.length_d||t.delete(m),f=!0)}return f}function E(i,u){let f=!1;for(let m of i)u&&a(m).then(E),!(!t.has(m)||!t.get(m).length_d)&&(m.dispatchEvent(new Event("dde:disconnected")),t.delete(m),f=!0);return f}}typeof document.createDocumentFragment().append()>"u"&&[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}});var p=Symbol.for("Signal");function P(t){try{return Reflect.has(t,p)}catch{return!1}}var j=[],h=new WeakMap;function l(t,e){if(typeof t!="function")return J(t,e);if(P(t))return t;let n=J(),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),j.push(r),n(t()),j.pop(),!c.length)return;let s=h.get(r);for(let d of c)s.has(d)||A(d,r)};return h.set(n[p],r),h.set(r,new Set([n])),r(),n}l.action=function(t,e,...n){let r=t[p],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};l.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));M(e,n),o&&o.addEventListener("abort",()=>A(e,n))}};l.symbols={signal:p,onclear:Symbol.for("Signal.onclear")};var S="__dde_attributes";l.attribute=function(t,e=void 0){let n=l(e);return b.host(r=>{if(r instanceof HTMLElement?r.hasAttribute(t)&&n(r.getAttribute(t)):r.hasAttributeNS(null,t)&&n(r.getAttributeNS(null,t)),r[S]){r[S][t]=n;return}return r[S]={[t]:n},v.attributeChanged(function({detail:c}){/*! This maps attributes to signals (`S.attribute`). * Investigate `__dde_attributes` key of the element.*/let[s,d]=c,a=r[S][s];a&&a(d)})(r),v.disconnected(function(){/*! This removes all signals mapped to attributes (`S.attribute`). -* Investigate `__dde_attributes` key of the element.*/l.clear(...Object.values(r[S]))})(r),r}),n};l.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[p];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,p)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(l.clear(...c),h.delete(o))})}};var D="__dde_reactive";l.el=function(t,e){let n=document.createComment(''),r=document.createComment(""),o=document.createDocumentFragment();o.append(n,r);let{current:c}=m,s=d=>{if(!n.parentNode||!r.parentNode)return A(t,s);m.push(c);let a=e(d);m.pop(),Array.isArray(a)||(a=[a]);let g=n;for(;(g=n.nextSibling)!==r;)g.remove();n.after(...a)};return W(t,s),Z(t,s,n,e),s(t()),o};var V={isSignal:P,processReactiveAttribute(t,e,n,r){if(!P(n))return n;let o=c=>r(e,c);return W(n,o),Z(n,o,t,e),n()}};function Z(t,e,...n){let{current:r}=m;r.prevent||r.host(function(o){o[D]||(o[D]=[],v.disconnected(()=>o[D].forEach(([[c,s]])=>A(c,s,c[p]?.host()===o)))(o)),o[D].push([[t,e],...n])})}function J(t,e){let n=(...r)=>r.length?it(n,...r):st(n);return ot(n,t,e)}var rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),M=class extends Error{constructor(){super();let[e,...n]=this.stack.split(` -`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ot(t,e,n){let r=[];F(n)!=="[object Object]"&&(n={});let{onclear:o}=l.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=m;return Reflect.defineProperty(t,p,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new M},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[p],rt),t}function ct(){return j[j.length-1]}function st(t){if(!t[p])return;let{value:e,listeners:n}=t[p],r=ct();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function it(t,e,n){if(!t[p])return;let r=t[p];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function W(t,e){if(t[p])return t[p].listeners.add(e)}function A(t,e,n){let r=t[p];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(l.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>A(s,c,!0))}return o}k(V); +* Investigate `__dde_attributes` key of the element.*/l.clear(...Object.values(r[S]))})(r),r}),n};l.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[p];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,p)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(l.clear(...c),h.delete(o))})}};var N="__dde_reactive";l.el=function(t,e){let n=document.createComment(''),r=document.createComment(""),o=document.createDocumentFragment();o.append(n,r);let{current:c}=b,s=d=>{if(!n.parentNode||!r.parentNode)return A(t,s);b.push(c);let a=e(d);b.pop(),Array.isArray(a)||(a=[a]);let g=n;for(;(g=n.nextSibling)!==r;)g.remove();n.after(...a)};return M(t,s),Z(t,s,n,e),s(t()),o};var V={isSignal:P,processReactiveAttribute(t,e,n,r){if(!P(n))return n;let o=c=>r(e,c);return M(n,o),Z(n,o,t,e),n()}};function Z(t,e,...n){let{current:r}=b;r.prevent||r.host(function(o){o[N]||(o[N]=[],v.disconnected(()=>o[N].forEach(([[c,s]])=>A(c,s,c[p]?.host()===o)))(o)),o[N].push([[t,e],...n])})}function J(t,e){let n=(...r)=>r.length?it(n,...r):st(n);return ot(n,t,e)}var rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),F=class extends Error{constructor(){super();let[e,...n]=this.stack.split(` +`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ot(t,e,n){let r=[];W(n)!=="[object Object]"&&(n={});let{onclear:o}=l.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=b;return Reflect.defineProperty(t,p,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new F},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[p],rt),t}function ct(){return j[j.length-1]}function st(t){if(!t[p])return;let{value:e,listeners:n}=t[p],r=ct();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function it(t,e,n){if(!t[p])return;let r=t[p];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function M(t,e){if(t[p])return t[p].listeners.add(e)}function A(t,e,n){let r=t[p];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(l.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>A(s,c,!0))}return o}k(V); globalThis.dde= {S: l, assign: C, assignAttribute: q, @@ -15,7 +15,7 @@ empty: gt, isSignal: P, on: v, registerReactivity: k, -scope: m +scope: b }; })(); \ No newline at end of file diff --git a/dist/dde.gzip.js b/dist/dde.gzip.js deleted file mode 100644 index cfaf269563853277d5e2691920cf9bd9ddbd58fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2722 zcmV;T3SIRdiwFP!000001I<}mZ`(K)e)q4CwM8JJjN){jDvx4hlXkj;H0d;%EwF}> z(h_B>ktLU+oVc?7`yO6IQBKkn`?L>1Z1V8%T)uOokB(w`M-Jm+bx1QOOXrNRt&^4x z*^o3N^Nc#1lsJp5n3K%O$%>Y15>e-C9Mi7@&qLvfQx7(TIrFei%jdgeRRTxn2(}x;?Oi95GxyW7M~n^*_%ICT6CTXFBMa+@ zpez!HpSYFVQQQgUwFDUO^Oi>tyZk5M0Npl*z zoytlRn{sSjx=BYgqoe!#d;k77zhH}_H>1($NNffiKZG@? z;Y1Z`KEsvB%u8rKFzkPbN#wl3BdAbk1N&VGMNTq}zRV@4rl zFkp#r-C>zE;RCM15l%1}m-i`;mY$Xb!U-}O-R&aZBxMj6l%ZkG=>tD2axNsI4Fo+T z*@%?Xq&Wb1D~TJ_Rd|dal$tuYxQd@;c(R;$m2!$-<>fL>xVJ>X(j#D*B8{C93JBbg zgdovwr7oP~QXJ}XwzvtNIQ(i5x*yOZ*UZd9z+MGjl8#C+(!s+Er# zR|b|?h$pTvpBuPqB3z>LmD{*SCtuMx5pb4p$qH)M=LSi5 z??)udq(ktYls77kSh#vlNo-F?awO3g1v%27**~Nqt zJpyc3&MIzIx*#pBER!J!NMC&5Ft6f@aHLHfxOBx%%^mQG*@B2 z$JE+`ktg>L-Pg*2@`Th|^l0YH`_9q1iKoA1n=@&32$V%T=zTIh=Bd9VB>)o{tjZ=y zWz#6^cc0h){zHfF&u|4(AOljXgVMckLS^=NDil7j+Xgc%qF zGDxdE0A{hssMr8>93D?p4G4xqhI%pfm(`}6GDfz3!ip7C+i00)G30Dy5)KVdsO}%V zK9j$@j=b#=rO~j#`S5tGq10A zdU`%DQ4EA)49EfA74#{VWH*oela}&7tWUU~q#1`<6Q3AgDR;0P-IxY$<_q=*E z^6{y+@FFyEl{=w6izq{{=?w6613Q)k-`mpwC24^dnY?x{uicpp)jeJpzcdEzjT=u) zLLJAuM;%++v`$2|JF7}wtmNPZX0Bt(VZ07RE8Czz5a=z`b=YwVZ64%RwG&x)owd?y zTH|PDme}K&QtQUlsB{&6fCT=-l;Ug3$7g<2<%9(cFnHFAH1XJ; z$vU$FmLV|(-mR#gvKz+Y<>JaOlEg5OEfTcIu$uQ5;Vd-gXM+6;2C^ys4{WsCJ*Dxv zC8VwNqjiB5P@A*~;%rIs#dE6fQ~iqiKT#S2^M6wKhs^lQ1TT|`IgvR3Si$@U*Ims^ z$~M5x+#jP__mZ{ILo_h~6imV(n+MAVbcoUN35?mXU76UPW_a0u49O4#J0#WCFnhj9 zEPQ#wCy8GuLBScFSfzN2P_8iv;e(piVN8)~lC^j`JI477S{FuZr*uHQ0)f>_UyfCx zl@pa$wlFeJX0Qbgp|O~6N-;IUaSz%Z=*QB$qRkQrR0{4$KnpS1nhwJbtpb;*t~}Mj zq#*-&#%Y&=q$5iN1Bbl`62Kx(b#lFpUWdmpQ1=2^GFDG*f=AJUL0_bvm!7-~kZCXK zX`pxCA&kQjT#<@7elKXA*2qo@wo<+IeZ69%*W(+0Nwp_#mD=^zpHMKi6|^uGsk=*K zh~3V7jzOQcKEmx7d~TI1VFuYq^+k4!uo8e_ZNv(!qJ-P)f)Tbwe~Km!Mom{gMLicH z~#uQtGkP{U<4=ZsPrb(T_~Vm$;_a8LR}vxJE2$8bkZy5}At zI5ZKf6h?1%@9vsBp8V1cJ&Bbes2KpMIHqS_H zRvPMSG+r4*0>0PJ_5iZ7bj2Auf|b?o*l6k)hNJFFEPSmYzJ_=azfH7LT-vF){JDxf z^_HNXXA~6gLRu$tCwf_>UdtiIp?x98M#yGrz18DxM#TH?O*1n?@bE;wdZ^dbfHrD= zP(#qz`mEnuyWXJpoGZ7pt$K5TCRF?vRbilhSh^9frJzjc)atb+aPILyeKhqma4zw{ z43_5 { -var b={isSignal(t){return!1},processReactiveAttribute(t,e,n,c){return n}};function M(t,e=!0){return e?Object.assign(b,t):(Object.setPrototypeOf(t,b),t)}function E(t){return b.isPrototypeOf(t)&&t!==b?t:b}function g(t){return typeof t>"u"}function _(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var R={setDeleteAttr:W};function W(t,e,n){if(Reflect.set(t,e,n),!!g(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var v=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],S=t=>t==="svg"?"http://www.w3.org/2000/svg":t,x={get current(){return v[v.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=S(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return x.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...v]},push(t={}){return t.namespace&&(t.namespace=S(t.namespace)),v.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return v.pop()}};function J(t,e,...n){let c=E(this),{namespace:r}=x,u=0,f,a;switch((Object(e)!==e||c.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{u=1,x.push({scope:t,host:h=>h?(u===1?n.unshift(h):h(a),void 0):a}),f=t(e||void 0);let d=f instanceof DocumentFragment,l=document.createComment(``);f.prepend(l),d&&(a=l);break}case t==="#text":f=w.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):f=w.call(this,document.createDocumentFragment(),e);break;case r!=="html":f=w.call(this,document.createElementNS(r,t),e);break;case!f:f=w.call(this,document.createElement(t),e)}return a||(a=f),n.forEach(d=>d(a)),u&&x.pop(),u=2,f}var{setDeleteAttr:D}=R,A=new WeakMap;function w(t,...e){if(!e.length)return t;A.set(t,P(t,this));for(let[n,c]of Object.entries(Object.assign({},...e)))N.call(this,t,n,c);return A.delete(t),t}function N(t,e,n){let{setRemoveAttr:c,s:r}=P(t,this),u=this;n=r.processReactiveAttribute(t,e,n,(a,d)=>N.call(u,t,a,d));let[f]=e;if(f==="=")return c(e.slice(1),n);if(f===".")return L(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return c(e,n,"http://www.w3.org/1999/xlink");case"textContent":return D(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return y(r,n,L.bind(null,t[e]));case"ariaset":return y(r,n,(a,d)=>c("aria-"+a,d));case"classList":return F.call(u,t,n)}return U(t,e)?D(t,e,n):c(e,n)}function P(t,e){if(A.has(t))return A.get(t);let c=(t instanceof SVGElement?q:$).bind(null,t,"Attribute"),r=E(e);return{setRemoveAttr:c,s:r}}function F(t,e){let n=E(this);return y(n,e,(c,r)=>t.classList.toggle(c,r===-1?void 0:!!r)),t}function Q(t){return Array.from(t.children).forEach(e=>e.remove()),t}function U(t,e){if(!Reflect.has(t,e))return!1;let n=j(t,e);return!g(n.set)}function j(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||j(t,e)}function y(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([r,u]){r&&(u=t.processReactiveAttribute(e,r,u,n),n(r,u))})}function T(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function $(t,e,n,c){return t[(g(c)?"remove":"set")+e](n,T(c))}function q(t,e,n,c,r=null){return t[(g(c)?"remove":"set")+e+"NS"](r,n,T(c))}function L(t,e,n){if(Reflect.set(t,e,n),!!g(n))return Reflect.deleteProperty(t,e)}function k(t,e,...n){let c=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(c)}function C(t,e,n){return function(r){return r.addEventListener(t,e,n),r}}var O=H(),z=new WeakSet;C.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents?r:r.isConnected?(r.dispatchEvent(new Event(u)),r):(_(e.signal,()=>O.offConnected(r,t))&&O.onConnected(r,t),r)}};C.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||_(e.signal,()=>O.offDisconnected(r,t))&&O.onDisconnected(r,t),r}};C.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(r){let u="dde:"+n;if(r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||z.has(r))return r;let f=new MutationObserver(function(d){for(let{attributeName:l,target:h}of d)h.dispatchEvent(new CustomEvent(u,{detail:[l,h.getAttribute(l)]}))});return _(e.signal,()=>f.disconnect())&&f.observe(r,{attributes:!0}),r}};function H(){let t=new Map,e=!1,n=new MutationObserver(function(o){for(let s of o)if(s.type==="childList"){if(l(s.addedNodes,!0)){f();continue}h(s.removedNodes,!0)&&f()}});return{onConnected(o,s){u();let i=r(o);i.connected.has(s)||(i.connected.add(s),i.length_c+=1)},offConnected(o,s){if(!t.has(o))return;let i=t.get(o);i.connected.has(s)&&(i.connected.delete(s),i.length_c-=1,c(o,i))},onDisconnected(o,s){u();let i=r(o);i.disconnected.has(s)||(i.disconnected.add(s),i.length_d+=1)},offDisconnected(o,s){if(!t.has(o))return;let i=t.get(o);i.disconnected.has(s)&&(i.disconnected.delete(s),i.length_d-=1,c(o,i))}};function c(o,s){s.length_c||s.length_d||(t.delete(o),f())}function r(o){if(t.has(o))return t.get(o);let s={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(o,s),s}function u(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,n.disconnect())}function a(){return new Promise(function(o){(requestIdleCallback||requestAnimationFrame)(o)})}async function d(o){t.size>30&&await a();let s=[];if(!(o instanceof Node))return s;for(let i of t.keys())i===o||!(i instanceof Node)||o.contains(i)&&s.push(i);return s}function l(o,s){let i=!1;for(let p of o){if(s&&d(p).then(l),!t.has(p))continue;let m=t.get(p);m.length_c&&(p.dispatchEvent(new Event("dde:connected")),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(p),i=!0)}return i}function h(o,s){let i=!1;for(let p of o)s&&d(p).then(h),!(!t.has(p)||!t.get(p).length_d)&&(p.dispatchEvent(new Event("dde:disconnected")),t.delete(p),i=!0);return i}}[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}}); +var b={isSignal(t){return!1},processReactiveAttribute(t,e,n,c){return n}};function F(t,e=!0){return e?Object.assign(b,t):(Object.setPrototypeOf(t,b),t)}function E(t){return b.isPrototypeOf(t)&&t!==b?t:b}function g(t){return typeof t>"u"}function _(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var R={setDeleteAttr:M};function M(t,e,n){if(Reflect.set(t,e,n),!!g(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var v=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],D=t=>t==="svg"?"http://www.w3.org/2000/svg":t,x={get current(){return v[v.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=D(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return x.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...v]},push(t={}){return t.namespace&&(t.namespace=D(t.namespace)),v.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return v.pop()}};function J(t,e,...n){let c=E(this),{namespace:r}=x,u=0,f,a;switch((Object(e)!==e||c.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{u=1,x.push({scope:t,host:h=>h?(u===1?n.unshift(h):h(a),void 0):a}),f=t(e||void 0);let d=f instanceof DocumentFragment,l=document.createComment(``);f.prepend(l),d&&(a=l);break}case t==="#text":f=w.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):f=w.call(this,document.createDocumentFragment(),e);break;case r!=="html":f=w.call(this,document.createElementNS(r,t),e);break;case!f:f=w.call(this,document.createElement(t),e)}return a||(a=f),n.forEach(d=>d(a)),u&&x.pop(),u=2,f}var{setDeleteAttr:S}=R,A=new WeakMap;function w(t,...e){if(!e.length)return t;A.set(t,P(t,this));for(let[n,c]of Object.entries(Object.assign({},...e)))N.call(this,t,n,c);return A.delete(t),t}function N(t,e,n){let{setRemoveAttr:c,s:r}=P(t,this),u=this;n=r.processReactiveAttribute(t,e,n,(a,d)=>N.call(u,t,a,d));let[f]=e;if(f==="=")return c(e.slice(1),n);if(f===".")return L(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return c(e,n,"http://www.w3.org/1999/xlink");case"textContent":return S(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return O(r,n,L.bind(null,t[e]));case"ariaset":return O(r,n,(a,d)=>c("aria-"+a,d));case"classList":return W.call(u,t,n)}return U(t,e)?S(t,e,n):c(e,n)}function P(t,e){if(A.has(t))return A.get(t);let c=(t instanceof SVGElement?q:$).bind(null,t,"Attribute"),r=E(e);return{setRemoveAttr:c,s:r}}function W(t,e){let n=E(this);return O(n,e,(c,r)=>t.classList.toggle(c,r===-1?void 0:!!r)),t}function Q(t){return Array.from(t.children).forEach(e=>e.remove()),t}function U(t,e){if(!Reflect.has(t,e))return!1;let n=j(t,e);return!g(n.set)}function j(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||j(t,e)}function O(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([r,u]){r&&(u=t.processReactiveAttribute(e,r,u,n),n(r,u))})}function T(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function $(t,e,n,c){return t[(g(c)?"remove":"set")+e](n,T(c))}function q(t,e,n,c,r=null){return t[(g(c)?"remove":"set")+e+"NS"](r,n,T(c))}function L(t,e,n){if(Reflect.set(t,e,n),!!g(n))return Reflect.deleteProperty(t,e)}function k(t,e,...n){let c=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(c)}function C(t,e,n){return function(r){return r.addEventListener(t,e,n),r}}var y=H(),z=new WeakSet;C.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents?r:r.isConnected?(r.dispatchEvent(new Event(u)),r):(_(e.signal,()=>y.offConnected(r,t))&&y.onConnected(r,t),r)}};C.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||_(e.signal,()=>y.offDisconnected(r,t))&&y.onDisconnected(r,t),r}};C.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(r){let u="dde:"+n;if(r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||z.has(r))return r;let f=new MutationObserver(function(d){for(let{attributeName:l,target:h}of d)h.dispatchEvent(new CustomEvent(u,{detail:[l,h.getAttribute(l)]}))});return _(e.signal,()=>f.disconnect())&&f.observe(r,{attributes:!0}),r}};function H(){let t=new Map,e=!1,n=new MutationObserver(function(o){for(let s of o)if(s.type==="childList"){if(l(s.addedNodes,!0)){f();continue}h(s.removedNodes,!0)&&f()}});return{onConnected(o,s){u();let i=r(o);i.connected.has(s)||(i.connected.add(s),i.length_c+=1)},offConnected(o,s){if(!t.has(o))return;let i=t.get(o);i.connected.has(s)&&(i.connected.delete(s),i.length_c-=1,c(o,i))},onDisconnected(o,s){u();let i=r(o);i.disconnected.has(s)||(i.disconnected.add(s),i.length_d+=1)},offDisconnected(o,s){if(!t.has(o))return;let i=t.get(o);i.disconnected.has(s)&&(i.disconnected.delete(s),i.length_d-=1,c(o,i))}};function c(o,s){s.length_c||s.length_d||(t.delete(o),f())}function r(o){if(t.has(o))return t.get(o);let s={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(o,s),s}function u(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,n.disconnect())}function a(){return new Promise(function(o){(requestIdleCallback||requestAnimationFrame)(o)})}async function d(o){t.size>30&&await a();let s=[];if(!(o instanceof Node))return s;for(let i of t.keys())i===o||!(i instanceof Node)||o.contains(i)&&s.push(i);return s}function l(o,s){let i=!1;for(let p of o){if(s&&d(p).then(l),!t.has(p))continue;let m=t.get(p);m.length_c&&(p.dispatchEvent(new Event("dde:connected")),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(p),i=!0)}return i}function h(o,s){let i=!1;for(let p of o)s&&d(p).then(h),!(!t.has(p)||!t.get(p).length_d)&&(p.dispatchEvent(new Event("dde:disconnected")),t.delete(p),i=!0);return i}}typeof document.createDocumentFragment().append()>"u"&&[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}}); globalThis.dde= {assign: w, assignAttribute: N, -classListDeclarative: F, +classListDeclarative: W, createElement: J, dispatchEvent: k, el: J, empty: Q, on: C, -registerReactivity: M, +registerReactivity: F, scope: x }; diff --git a/dist/esm-with-signals.d.ts b/dist/esm-with-signals.d.ts index 72c520c..0c0dacb 100644 --- a/dist/esm-with-signals.d.ts +++ b/dist/esm-with-signals.d.ts @@ -1,8 +1,8 @@ declare global { type ddeComponentAttributes= Record | undefined | string; - type ddeElementExtender= (element: El)=> El; + type ddeElementModifier= (element: El)=> El; } -type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & { +type ElementTagNameMap= HTMLElementTagNameMap & { // & SVGElementTagNameMap '#text': Text } type Element= ElementTagNameMap[keyof ElementTagNameMap]; @@ -14,7 +14,7 @@ type AttrsModified= { /** * Provide option to add/remove/toggle CSS clasess (index of object) using 1/0/-1. In fact `el.classList.toggle(class_name)` for `-1` and `el.classList.toggle(class_name, Boolean(...))` for others. */ - classList: Record, + classList: Record, /** * By default simiral to `className`, but also supports `string[]` * */ @@ -40,45 +40,55 @@ export function assign(element: El, ...attrs_array: Partial< export function el( tag_name: TAG, attrs?: Partial>, - ...extenders: ddeElementExtender[] + ...modifiers: ddeElementModifier[] ): ElementTagNameMap[TAG] export function el( tag_name?: "<>", ): DocumentFragment export function el< A extends ddeComponentAttributes, - C extends (attr: A)=> Element>( + C extends (attr: A)=> Element | DocumentFragment>( fComponent: C, attrs?: A, - ...extenders: ddeElementExtender>[] + ...modifiers: ddeElementModifier>[] ): ReturnType +export function el( + tag_name: string, + attrs?: Record, + ...modifiers: ddeElementModifier[] +): HTMLElement export function dispatchEvent(element: HTMLElement, name: keyof DocumentEventMap): void; export function dispatchEvent(element: HTMLElement, name: string, data: any): void; interface On{ < - EE extends ddeElementExtender, - El extends ( EE extends ddeElementExtender ? El : never ), + EE extends ddeElementModifier, + El extends ( EE extends ddeElementModifier ? El : never ), Event extends keyof DocumentEventMap>( type: Event, listener: (this: El, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions ) : EE; connected< - EE extends ddeElementExtender, - El extends ( EE extends ddeElementExtender ? El : never ) + EE extends ddeElementModifier, + El extends ( EE extends ddeElementModifier ? El : never ) >( listener: (el: El) => any, options?: AddEventListenerOptions ) : EE; disconnected< - EE extends ddeElementExtender, - El extends ( EE extends ddeElementExtender ? El : never ) + EE extends ddeElementModifier, + El extends ( EE extends ddeElementModifier ? El : never ) >( listener: (el: El) => any, options?: AddEventListenerOptions ) : EE; } export const on: On; +export const scope: { + namespace: string, + host: ddeElementModifier, + elNamespace: (ns: string)=> ({ append(...els: (HTMLElement | SVGElement)[]): HTMLElement | SVGElement | DocumentFragment }) +}; //TODO for SVG declare global{ interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; } diff --git a/dist/esm-with-signals.gzip.js b/dist/esm-with-signals.gzip.js deleted file mode 100644 index f6c0a54dbabcbf926a58a740524bb20baae42789..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4107 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 diff --git a/dist/esm-with-signals.js b/dist/esm-with-signals.js index 603263f..d39c21c 100644 --- a/dist/esm-with-signals.js +++ b/dist/esm-with-signals.js @@ -1,4 +1,4 @@ -var w={isSignal(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function k(t,e=!0){return e?Object.assign(w,t):(Object.setPrototypeOf(t,w),t)}function O(t){return w.isPrototypeOf(t)&&t!==w?t:w}function _(t){return typeof t>"u"}function F(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function R(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var $={setDeleteAttr:K};function K(t,e,n){if(Reflect.set(t,e,n),!!_(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var y=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],z=t=>t==="svg"?"http://www.w3.org/2000/svg":t,m={get current(){return y[y.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=z(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return m.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...y]},push(t={}){return t.namespace&&(t.namespace=z(t.namespace)),y.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return y.pop()}};function ht(t,e,...n){let r=O(this),{namespace:o}=m,c=0,s,d;switch((Object(e)!==e||r.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{c=1,m.push({scope:t,host:E=>E?(c===1?n.unshift(E):E(d),void 0):d}),s=t(e||void 0);let a=s instanceof DocumentFragment,g=document.createComment(``);s.prepend(g),a&&(d=g);break}case t==="#text":s=C.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):s=C.call(this,document.createDocumentFragment(),e);break;case o!=="html":s=C.call(this,document.createElementNS(o,t),e);break;case!s:s=C.call(this,document.createElement(t),e)}return d||(d=s),n.forEach(a=>a(d)),c&&m.pop(),c=2,s}var{setDeleteAttr:H}=$,L=new WeakMap;function C(t,...e){if(!e.length)return t;L.set(t,B(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))q.call(this,t,n,r);return L.delete(t),t}function q(t,e,n){let{setRemoveAttr:r,s:o}=B(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,a)=>q.call(c,t,d,a));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return U(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return H(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return T(o,n,U.bind(null,t[e]));case"ariaset":return T(o,n,(d,a)=>r("aria-"+d,a));case"classList":return Q.call(c,t,n)}return X(t,e)?H(t,e,n):r(e,n)}function B(t,e){if(L.has(t))return L.get(t);let r=(t instanceof SVGElement?tt:Y).bind(null,t,"Attribute"),o=O(e);return{setRemoveAttr:r,s:o}}function Q(t,e){let n=O(this);return T(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function gt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function X(t,e){if(!Reflect.has(t,e))return!1;let n=G(t,e);return!_(n.set)}function G(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||G(t,e)}function T(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function I(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Y(t,e,n,r){return t[(_(r)?"remove":"set")+e](n,I(r))}function tt(t,e,n,r,o=null){return t[(_(r)?"remove":"set")+e+"NS"](o,n,I(r))}function U(t,e,n){if(Reflect.set(t,e,n),!!_(n))return Reflect.deleteProperty(t,e)}function Et(t,e,...n){let r=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(r)}function v(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var N=nt(),et=new WeakSet;v.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents?o:o.isConnected?(o.dispatchEvent(new Event(c)),o):(R(e.signal,()=>N.offConnected(o,t))&&N.onConnected(o,t),o)}};v.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||R(e.signal,()=>N.offDisconnected(o,t))&&N.onDisconnected(o,t),o}};v.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||et.has(o))return o;let s=new MutationObserver(function(a){for(let{attributeName:g,target:E}of a)E.dispatchEvent(new CustomEvent(c,{detail:[g,E.getAttribute(g)]}))});return R(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function nt(){let t=new Map,e=!1,n=new MutationObserver(function(i){for(let u of i)if(u.type==="childList"){if(g(u.addedNodes,!0)){s();continue}E(u.removedNodes,!0)&&s()}});return{onConnected(i,u){c();let f=o(i);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let f=t.get(i);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(i,f))},onDisconnected(i,u){c();let f=o(i);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let f=t.get(i);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(i,f))}};function r(i,u){u.length_c||u.length_d||(t.delete(i),s())}function o(i){if(t.has(i))return t.get(i);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,u),u}function c(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function s(){!e||t.size||(e=!1,n.disconnect())}function d(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function a(i){t.size>30&&await d();let u=[];if(!(i instanceof Node))return u;for(let f of t.keys())f===i||!(f instanceof Node)||i.contains(f)&&u.push(f);return u}function g(i,u){let f=!1;for(let b of i){if(u&&a(b).then(g),!t.has(b))continue;let x=t.get(b);x.length_c&&(b.dispatchEvent(new Event("dde:connected")),x.connected=new WeakSet,x.length_c=0,x.length_d||t.delete(b),f=!0)}return f}function E(i,u){let f=!1;for(let b of i)u&&a(b).then(E),!(!t.has(b)||!t.get(b).length_d)&&(b.dispatchEvent(new Event("dde:disconnected")),t.delete(b),f=!0);return f}}[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}});var p=Symbol.for("Signal");function P(t){try{return Reflect.has(t,p)}catch{return!1}}var j=[],h=new WeakMap;function l(t,e){if(typeof t!="function")return J(t,e);if(P(t))return t;let n=J(),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),j.push(r),n(t()),j.pop(),!c.length)return;let s=h.get(r);for(let d of c)s.has(d)||A(d,r)};return h.set(n[p],r),h.set(r,new Set([n])),r(),n}l.action=function(t,e,...n){let r=t[p],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};l.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));W(e,n),o&&o.addEventListener("abort",()=>A(e,n))}};l.symbols={signal:p,onclear:Symbol.for("Signal.onclear")};var S="__dde_attributes";l.attribute=function(t,e=void 0){let n=l(e);return m.host(r=>{if(r instanceof HTMLElement?r.hasAttribute(t)&&n(r.getAttribute(t)):r.hasAttributeNS(null,t)&&n(r.getAttributeNS(null,t)),r[S]){r[S][t]=n;return}return r[S]={[t]:n},v.attributeChanged(function({detail:c}){/*! This maps attributes to signals (`S.attribute`). +var w={isSignal(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function k(t,e=!0){return e?Object.assign(w,t):(Object.setPrototypeOf(t,w),t)}function O(t){return w.isPrototypeOf(t)&&t!==w?t:w}function _(t){return typeof t>"u"}function W(t){let e=typeof t;return e!=="object"?e:t===null?"null":Object.prototype.toString.call(t)}function R(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var $={setDeleteAttr:K};function K(t,e,n){if(Reflect.set(t,e,n),!!_(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var y=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],z=t=>t==="svg"?"http://www.w3.org/2000/svg":t,b={get current(){return y[y.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=z(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return b.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...y]},push(t={}){return t.namespace&&(t.namespace=z(t.namespace)),y.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return y.pop()}};function ht(t,e,...n){let r=O(this),{namespace:o}=b,c=0,s,d;switch((Object(e)!==e||r.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{c=1,b.push({scope:t,host:E=>E?(c===1?n.unshift(E):E(d),void 0):d}),s=t(e||void 0);let a=s instanceof DocumentFragment,g=document.createComment(``);s.prepend(g),a&&(d=g);break}case t==="#text":s=C.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):s=C.call(this,document.createDocumentFragment(),e);break;case o!=="html":s=C.call(this,document.createElementNS(o,t),e);break;case!s:s=C.call(this,document.createElement(t),e)}return d||(d=s),n.forEach(a=>a(d)),c&&b.pop(),c=2,s}var{setDeleteAttr:H}=$,L=new WeakMap;function C(t,...e){if(!e.length)return t;L.set(t,B(t,this));for(let[n,r]of Object.entries(Object.assign({},...e)))q.call(this,t,n,r);return L.delete(t),t}function q(t,e,n){let{setRemoveAttr:r,s:o}=B(t,this),c=this;n=o.processReactiveAttribute(t,e,n,(d,a)=>q.call(c,t,d,a));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return U(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return r(e,n,"http://www.w3.org/1999/xlink");case"textContent":return H(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return T(o,n,U.bind(null,t[e]));case"ariaset":return T(o,n,(d,a)=>r("aria-"+d,a));case"classList":return Q.call(c,t,n)}return X(t,e)?H(t,e,n):r(e,n)}function B(t,e){if(L.has(t))return L.get(t);let r=(t instanceof SVGElement?tt:Y).bind(null,t,"Attribute"),o=O(e);return{setRemoveAttr:r,s:o}}function Q(t,e){let n=O(this);return T(n,e,(r,o)=>t.classList.toggle(r,o===-1?void 0:!!o)),t}function gt(t){return Array.from(t.children).forEach(e=>e.remove()),t}function X(t,e){if(!Reflect.has(t,e))return!1;let n=G(t,e);return!_(n.set)}function G(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||G(t,e)}function T(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([o,c]){o&&(c=t.processReactiveAttribute(e,o,c,n),n(o,c))})}function I(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function Y(t,e,n,r){return t[(_(r)?"remove":"set")+e](n,I(r))}function tt(t,e,n,r,o=null){return t[(_(r)?"remove":"set")+e+"NS"](o,n,I(r))}function U(t,e,n){if(Reflect.set(t,e,n),!!_(n))return Reflect.deleteProperty(t,e)}function Et(t,e,...n){let r=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(r)}function v(t,e,n){return function(o){return o.addEventListener(t,e,n),o}}var D=nt(),et=new WeakSet;v.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents?o:o.isConnected?(o.dispatchEvent(new Event(c)),o):(R(e.signal,()=>D.offConnected(o,t))&&D.onConnected(o,t),o)}};v.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(o){let c="dde:"+n;return o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||R(e.signal,()=>D.offDisconnected(o,t))&&D.onDisconnected(o,t),o}};v.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(o){let c="dde:"+n;if(o.addEventListener(c,t,e),o.__dde_lifecycleToEvents||et.has(o))return o;let s=new MutationObserver(function(a){for(let{attributeName:g,target:E}of a)E.dispatchEvent(new CustomEvent(c,{detail:[g,E.getAttribute(g)]}))});return R(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function nt(){let t=new Map,e=!1,n=new MutationObserver(function(i){for(let u of i)if(u.type==="childList"){if(g(u.addedNodes,!0)){s();continue}E(u.removedNodes,!0)&&s()}});return{onConnected(i,u){c();let f=o(i);f.connected.has(u)||(f.connected.add(u),f.length_c+=1)},offConnected(i,u){if(!t.has(i))return;let f=t.get(i);f.connected.has(u)&&(f.connected.delete(u),f.length_c-=1,r(i,f))},onDisconnected(i,u){c();let f=o(i);f.disconnected.has(u)||(f.disconnected.add(u),f.length_d+=1)},offDisconnected(i,u){if(!t.has(i))return;let f=t.get(i);f.disconnected.has(u)&&(f.disconnected.delete(u),f.length_d-=1,r(i,f))}};function r(i,u){u.length_c||u.length_d||(t.delete(i),s())}function o(i){if(t.has(i))return t.get(i);let u={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(i,u),u}function c(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function s(){!e||t.size||(e=!1,n.disconnect())}function d(){return new Promise(function(i){(requestIdleCallback||requestAnimationFrame)(i)})}async function a(i){t.size>30&&await d();let u=[];if(!(i instanceof Node))return u;for(let f of t.keys())f===i||!(f instanceof Node)||i.contains(f)&&u.push(f);return u}function g(i,u){let f=!1;for(let m of i){if(u&&a(m).then(g),!t.has(m))continue;let x=t.get(m);x.length_c&&(m.dispatchEvent(new Event("dde:connected")),x.connected=new WeakSet,x.length_c=0,x.length_d||t.delete(m),f=!0)}return f}function E(i,u){let f=!1;for(let m of i)u&&a(m).then(E),!(!t.has(m)||!t.get(m).length_d)&&(m.dispatchEvent(new Event("dde:disconnected")),t.delete(m),f=!0);return f}}typeof document.createDocumentFragment().append()>"u"&&[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}});var p=Symbol.for("Signal");function P(t){try{return Reflect.has(t,p)}catch{return!1}}var j=[],h=new WeakMap;function l(t,e){if(typeof t!="function")return J(t,e);if(P(t))return t;let n=J(),r=function(){let[o,...c]=h.get(r);if(h.set(r,new Set([o])),j.push(r),n(t()),j.pop(),!c.length)return;let s=h.get(r);for(let d of c)s.has(d)||A(d,r)};return h.set(n[p],r),h.set(r,new Set([n])),r(),n}l.action=function(t,e,...n){let r=t[p],{actions:o}=r;if(!o||!Reflect.has(o,e))throw new Error(`'${t}' has no action with name '${e}'!`);if(o[e].apply(r,n),r.skip)return Reflect.deleteProperty(r,"skip");r.listeners.forEach(c=>c(r.value))};l.on=function t(e,n,r={}){let{signal:o}=r;if(!(o&&o.aborted)){if(Array.isArray(e))return e.forEach(c=>t(c,n,r));M(e,n),o&&o.addEventListener("abort",()=>A(e,n))}};l.symbols={signal:p,onclear:Symbol.for("Signal.onclear")};var S="__dde_attributes";l.attribute=function(t,e=void 0){let n=l(e);return b.host(r=>{if(r instanceof HTMLElement?r.hasAttribute(t)&&n(r.getAttribute(t)):r.hasAttributeNS(null,t)&&n(r.getAttributeNS(null,t)),r[S]){r[S][t]=n;return}return r[S]={[t]:n},v.attributeChanged(function({detail:c}){/*! This maps attributes to signals (`S.attribute`). * Investigate `__dde_attributes` key of the element.*/let[s,d]=c,a=r[S][s];a&&a(d)})(r),v.disconnected(function(){/*! This removes all signals mapped to attributes (`S.attribute`). -* Investigate `__dde_attributes` key of the element.*/l.clear(...Object.values(r[S]))})(r),r}),n};l.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[p];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,p)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(l.clear(...c),h.delete(o))})}};var D="__dde_reactive";l.el=function(t,e){let n=document.createComment(''),r=document.createComment(""),o=document.createDocumentFragment();o.append(n,r);let{current:c}=m,s=d=>{if(!n.parentNode||!r.parentNode)return A(t,s);m.push(c);let a=e(d);m.pop(),Array.isArray(a)||(a=[a]);let g=n;for(;(g=n.nextSibling)!==r;)g.remove();n.after(...a)};return W(t,s),Z(t,s,n,e),s(t()),o};var V={isSignal:P,processReactiveAttribute(t,e,n,r){if(!P(n))return n;let o=c=>r(e,c);return W(n,o),Z(n,o,t,e),n()}};function Z(t,e,...n){let{current:r}=m;r.prevent||r.host(function(o){o[D]||(o[D]=[],v.disconnected(()=>o[D].forEach(([[c,s]])=>A(c,s,c[p]?.host()===o)))(o)),o[D].push([[t,e],...n])})}function J(t,e){let n=(...r)=>r.length?it(n,...r):st(n);return ot(n,t,e)}var rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),M=class extends Error{constructor(){super();let[e,...n]=this.stack.split(` -`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ot(t,e,n){let r=[];F(n)!=="[object Object]"&&(n={});let{onclear:o}=l.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=m;return Reflect.defineProperty(t,p,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new M},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[p],rt),t}function ct(){return j[j.length-1]}function st(t){if(!t[p])return;let{value:e,listeners:n}=t[p],r=ct();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function it(t,e,n){if(!t[p])return;let r=t[p];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function W(t,e){if(t[p])return t[p].listeners.add(e)}function A(t,e,n){let r=t[p];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(l.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>A(s,c,!0))}return o}k(V);export{l as S,C as assign,q as assignAttribute,Q as classListDeclarative,ht as createElement,Et as dispatchEvent,ht as el,gt as empty,P as isSignal,v as on,k as registerReactivity,m as scope}; +* Investigate `__dde_attributes` key of the element.*/l.clear(...Object.values(r[S]))})(r),r}),n};l.clear=function(...t){for(let n of t){Reflect.deleteProperty(n,"toJSON");let r=n[p];r.onclear.forEach(o=>o.call(r)),e(n,r),Reflect.deleteProperty(n,p)}function e(n,r){r.listeners.forEach(o=>{if(r.listeners.delete(o),!h.has(o))return;let c=h.get(o);c.delete(n),!(c.size>1)&&(l.clear(...c),h.delete(o))})}};var N="__dde_reactive";l.el=function(t,e){let n=document.createComment(''),r=document.createComment(""),o=document.createDocumentFragment();o.append(n,r);let{current:c}=b,s=d=>{if(!n.parentNode||!r.parentNode)return A(t,s);b.push(c);let a=e(d);b.pop(),Array.isArray(a)||(a=[a]);let g=n;for(;(g=n.nextSibling)!==r;)g.remove();n.after(...a)};return M(t,s),Z(t,s,n,e),s(t()),o};var V={isSignal:P,processReactiveAttribute(t,e,n,r){if(!P(n))return n;let o=c=>r(e,c);return M(n,o),Z(n,o,t,e),n()}};function Z(t,e,...n){let{current:r}=b;r.prevent||r.host(function(o){o[N]||(o[N]=[],v.disconnected(()=>o[N].forEach(([[c,s]])=>A(c,s,c[p]?.host()===o)))(o)),o[N].push([[t,e],...n])})}function J(t,e){let n=(...r)=>r.length?it(n,...r):st(n);return ot(n,t,e)}var rt=Object.assign(Object.create(null),{stopPropagation(){this.skip=!0}}),F=class extends Error{constructor(){super();let[e,...n]=this.stack.split(` +`),r=e.slice(e.indexOf("@"),e.indexOf(".js:")+4);this.stack=n.find(o=>!o.includes(r))}};function ot(t,e,n){let r=[];W(n)!=="[object Object]"&&(n={});let{onclear:o}=l.symbols;n[o]&&(r.push(n[o]),Reflect.deleteProperty(n,o));let{host:c}=b;return Reflect.defineProperty(t,p,{value:{value:e,actions:n,onclear:r,host:c,listeners:new Set,defined:new F},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[p],rt),t}function ct(){return j[j.length-1]}function st(t){if(!t[p])return;let{value:e,listeners:n}=t[p],r=ct();return r&&n.add(r),h.has(r)&&h.get(r).add(t),e}function it(t,e,n){if(!t[p])return;let r=t[p];if(!(!n&&r.value===e))return r.value=e,r.listeners.forEach(o=>o(e)),e}function M(t,e){if(t[p])return t[p].listeners.add(e)}function A(t,e,n){let r=t[p];if(!r)return;let o=r.listeners.delete(e);if(n&&!r.listeners.size){if(l.clear(t),!h.has(r))return o;let c=h.get(r);if(!h.has(c))return o;h.get(c).forEach(s=>A(s,c,!0))}return o}k(V);export{l as S,C as assign,q as assignAttribute,Q as classListDeclarative,ht as createElement,Et as dispatchEvent,ht as el,gt as empty,P as isSignal,v as on,k as registerReactivity,b as scope}; diff --git a/dist/esm.d.ts b/dist/esm.d.ts index a251c32..2c88f96 100644 --- a/dist/esm.d.ts +++ b/dist/esm.d.ts @@ -1,8 +1,8 @@ declare global { type ddeComponentAttributes= Record | undefined | string; - type ddeElementExtender= (element: El)=> El; + type ddeElementModifier= (element: El)=> El; } -type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & { +type ElementTagNameMap= HTMLElementTagNameMap & { // & SVGElementTagNameMap '#text': Text } type Element= ElementTagNameMap[keyof ElementTagNameMap]; @@ -14,7 +14,7 @@ type AttrsModified= { /** * Provide option to add/remove/toggle CSS clasess (index of object) using 1/0/-1. In fact `el.classList.toggle(class_name)` for `-1` and `el.classList.toggle(class_name, Boolean(...))` for others. */ - classList: Record, + classList: Record, /** * By default simiral to `className`, but also supports `string[]` * */ @@ -40,45 +40,55 @@ export function assign(element: El, ...attrs_array: Partial< export function el( tag_name: TAG, attrs?: Partial>, - ...extenders: ddeElementExtender[] + ...modifiers: ddeElementModifier[] ): ElementTagNameMap[TAG] export function el( tag_name?: "<>", ): DocumentFragment export function el< A extends ddeComponentAttributes, - C extends (attr: A)=> Element>( + C extends (attr: A)=> Element | DocumentFragment>( fComponent: C, attrs?: A, - ...extenders: ddeElementExtender>[] + ...modifiers: ddeElementModifier>[] ): ReturnType +export function el( + tag_name: string, + attrs?: Record, + ...modifiers: ddeElementModifier[] +): HTMLElement export function dispatchEvent(element: HTMLElement, name: keyof DocumentEventMap): void; export function dispatchEvent(element: HTMLElement, name: string, data: any): void; interface On{ < - EE extends ddeElementExtender, - El extends ( EE extends ddeElementExtender ? El : never ), + EE extends ddeElementModifier, + El extends ( EE extends ddeElementModifier ? El : never ), Event extends keyof DocumentEventMap>( type: Event, listener: (this: El, ev: DocumentEventMap[Event]) => any, options?: AddEventListenerOptions ) : EE; connected< - EE extends ddeElementExtender, - El extends ( EE extends ddeElementExtender ? El : never ) + EE extends ddeElementModifier, + El extends ( EE extends ddeElementModifier ? El : never ) >( listener: (el: El) => any, options?: AddEventListenerOptions ) : EE; disconnected< - EE extends ddeElementExtender, - El extends ( EE extends ddeElementExtender ? El : never ) + EE extends ddeElementModifier, + El extends ( EE extends ddeElementModifier ? El : never ) >( listener: (el: El) => any, options?: AddEventListenerOptions ) : EE; } export const on: On; +export const scope: { + namespace: string, + host: ddeElementModifier, + elNamespace: (ns: string)=> ({ append(...els: (HTMLElement | SVGElement)[]): HTMLElement | SVGElement | DocumentFragment }) +}; //TODO for SVG declare global{ interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; } diff --git a/dist/esm.gzip.js b/dist/esm.gzip.js deleted file mode 100644 index fe5fd6fc052a9c16714a558cfb243b15aba5b730..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2654 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"u"}function _(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var R={setDeleteAttr:W};function W(t,e,n){if(Reflect.set(t,e,n),!!g(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var v=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],S=t=>t==="svg"?"http://www.w3.org/2000/svg":t,x={get current(){return v[v.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=S(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return x.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...v]},push(t={}){return t.namespace&&(t.namespace=S(t.namespace)),v.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return v.pop()}};function J(t,e,...n){let c=E(this),{namespace:r}=x,u=0,f,a;switch((Object(e)!==e||c.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{u=1,x.push({scope:t,host:h=>h?(u===1?n.unshift(h):h(a),void 0):a}),f=t(e||void 0);let d=f instanceof DocumentFragment,l=document.createComment(``);f.prepend(l),d&&(a=l);break}case t==="#text":f=w.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):f=w.call(this,document.createDocumentFragment(),e);break;case r!=="html":f=w.call(this,document.createElementNS(r,t),e);break;case!f:f=w.call(this,document.createElement(t),e)}return a||(a=f),n.forEach(d=>d(a)),u&&x.pop(),u=2,f}var{setDeleteAttr:D}=R,A=new WeakMap;function w(t,...e){if(!e.length)return t;A.set(t,P(t,this));for(let[n,c]of Object.entries(Object.assign({},...e)))N.call(this,t,n,c);return A.delete(t),t}function N(t,e,n){let{setRemoveAttr:c,s:r}=P(t,this),u=this;n=r.processReactiveAttribute(t,e,n,(a,d)=>N.call(u,t,a,d));let[f]=e;if(f==="=")return c(e.slice(1),n);if(f===".")return L(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return c(e,n,"http://www.w3.org/1999/xlink");case"textContent":return D(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return y(r,n,L.bind(null,t[e]));case"ariaset":return y(r,n,(a,d)=>c("aria-"+a,d));case"classList":return F.call(u,t,n)}return U(t,e)?D(t,e,n):c(e,n)}function P(t,e){if(A.has(t))return A.get(t);let c=(t instanceof SVGElement?q:$).bind(null,t,"Attribute"),r=E(e);return{setRemoveAttr:c,s:r}}function F(t,e){let n=E(this);return y(n,e,(c,r)=>t.classList.toggle(c,r===-1?void 0:!!r)),t}function Q(t){return Array.from(t.children).forEach(e=>e.remove()),t}function U(t,e){if(!Reflect.has(t,e))return!1;let n=j(t,e);return!g(n.set)}function j(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||j(t,e)}function y(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([r,u]){r&&(u=t.processReactiveAttribute(e,r,u,n),n(r,u))})}function T(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function $(t,e,n,c){return t[(g(c)?"remove":"set")+e](n,T(c))}function q(t,e,n,c,r=null){return t[(g(c)?"remove":"set")+e+"NS"](r,n,T(c))}function L(t,e,n){if(Reflect.set(t,e,n),!!g(n))return Reflect.deleteProperty(t,e)}function k(t,e,...n){let c=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(c)}function C(t,e,n){return function(r){return r.addEventListener(t,e,n),r}}var O=H(),z=new WeakSet;C.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents?r:r.isConnected?(r.dispatchEvent(new Event(u)),r):(_(e.signal,()=>O.offConnected(r,t))&&O.onConnected(r,t),r)}};C.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||_(e.signal,()=>O.offDisconnected(r,t))&&O.onDisconnected(r,t),r}};C.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(r){let u="dde:"+n;if(r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||z.has(r))return r;let f=new MutationObserver(function(d){for(let{attributeName:l,target:h}of d)h.dispatchEvent(new CustomEvent(u,{detail:[l,h.getAttribute(l)]}))});return _(e.signal,()=>f.disconnect())&&f.observe(r,{attributes:!0}),r}};function H(){let t=new Map,e=!1,n=new MutationObserver(function(o){for(let s of o)if(s.type==="childList"){if(l(s.addedNodes,!0)){f();continue}h(s.removedNodes,!0)&&f()}});return{onConnected(o,s){u();let i=r(o);i.connected.has(s)||(i.connected.add(s),i.length_c+=1)},offConnected(o,s){if(!t.has(o))return;let i=t.get(o);i.connected.has(s)&&(i.connected.delete(s),i.length_c-=1,c(o,i))},onDisconnected(o,s){u();let i=r(o);i.disconnected.has(s)||(i.disconnected.add(s),i.length_d+=1)},offDisconnected(o,s){if(!t.has(o))return;let i=t.get(o);i.disconnected.has(s)&&(i.disconnected.delete(s),i.length_d-=1,c(o,i))}};function c(o,s){s.length_c||s.length_d||(t.delete(o),f())}function r(o){if(t.has(o))return t.get(o);let s={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(o,s),s}function u(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,n.disconnect())}function a(){return new Promise(function(o){(requestIdleCallback||requestAnimationFrame)(o)})}async function d(o){t.size>30&&await a();let s=[];if(!(o instanceof Node))return s;for(let i of t.keys())i===o||!(i instanceof Node)||o.contains(i)&&s.push(i);return s}function l(o,s){let i=!1;for(let p of o){if(s&&d(p).then(l),!t.has(p))continue;let m=t.get(p);m.length_c&&(p.dispatchEvent(new Event("dde:connected")),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(p),i=!0)}return i}function h(o,s){let i=!1;for(let p of o)s&&d(p).then(h),!(!t.has(p)||!t.get(p).length_d)&&(p.dispatchEvent(new Event("dde:disconnected")),t.delete(p),i=!0);return i}}[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}});export{w as assign,N as assignAttribute,F as classListDeclarative,J as createElement,k as dispatchEvent,J as el,Q as empty,C as on,M as registerReactivity,x as scope}; +var b={isSignal(t){return!1},processReactiveAttribute(t,e,n,c){return n}};function F(t,e=!0){return e?Object.assign(b,t):(Object.setPrototypeOf(t,b),t)}function E(t){return b.isPrototypeOf(t)&&t!==b?t:b}function g(t){return typeof t>"u"}function _(t,e){if(!t||!(t instanceof AbortSignal))return!0;if(!t.aborted)return t.addEventListener("abort",e),function(){t.removeEventListener("abort",e)}}var R={setDeleteAttr:M};function M(t,e,n){if(Reflect.set(t,e,n),!!g(n)){if(Reflect.deleteProperty(t,e),t instanceof HTMLElement&&t.getAttribute(e)==="undefined")return t.removeAttribute(e);if(Reflect.get(t,e)==="undefined")return Reflect.set(t,e,"")}}var v=[{scope:document.body,namespace:"html",host:t=>t?t(document.body):document.body,prevent:!0}],D=t=>t==="svg"?"http://www.w3.org/2000/svg":t,x={get current(){return v[v.length-1]},get host(){return this.current.host},get namespace(){return this.current.namespace},set namespace(t){return this.current.namespace=D(t)},preventDefault(){let{current:t}=this;return t.prevent=!0,t},elNamespace(t){let e=this.namespace;return this.namespace=t,{append(...n){return x.namespace=e,n.length===1?n[0]:document.createDocumentFragment().append(...n)}}},get state(){return[...v]},push(t={}){return t.namespace&&(t.namespace=D(t.namespace)),v.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return v.pop()}};function J(t,e,...n){let c=E(this),{namespace:r}=x,u=0,f,a;switch((Object(e)!==e||c.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{u=1,x.push({scope:t,host:h=>h?(u===1?n.unshift(h):h(a),void 0):a}),f=t(e||void 0);let d=f instanceof DocumentFragment,l=document.createComment(``);f.prepend(l),d&&(a=l);break}case t==="#text":f=w.call(this,document.createTextNode(""),e);break;case(t==="<>"||!t):f=w.call(this,document.createDocumentFragment(),e);break;case r!=="html":f=w.call(this,document.createElementNS(r,t),e);break;case!f:f=w.call(this,document.createElement(t),e)}return a||(a=f),n.forEach(d=>d(a)),u&&x.pop(),u=2,f}var{setDeleteAttr:S}=R,A=new WeakMap;function w(t,...e){if(!e.length)return t;A.set(t,P(t,this));for(let[n,c]of Object.entries(Object.assign({},...e)))N.call(this,t,n,c);return A.delete(t),t}function N(t,e,n){let{setRemoveAttr:c,s:r}=P(t,this),u=this;n=r.processReactiveAttribute(t,e,n,(a,d)=>N.call(u,t,a,d));let[f]=e;if(f==="=")return c(e.slice(1),n);if(f===".")return L(t,e.slice(1),n);if(/(aria|data)([A-Z])/.test(e))return e=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c(e,n);switch(e==="className"&&(e="class"),e){case"xlink:href":return c(e,n,"http://www.w3.org/1999/xlink");case"textContent":return S(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return O(r,n,L.bind(null,t[e]));case"ariaset":return O(r,n,(a,d)=>c("aria-"+a,d));case"classList":return W.call(u,t,n)}return U(t,e)?S(t,e,n):c(e,n)}function P(t,e){if(A.has(t))return A.get(t);let c=(t instanceof SVGElement?q:$).bind(null,t,"Attribute"),r=E(e);return{setRemoveAttr:c,s:r}}function W(t,e){let n=E(this);return O(n,e,(c,r)=>t.classList.toggle(c,r===-1?void 0:!!r)),t}function Q(t){return Array.from(t.children).forEach(e=>e.remove()),t}function U(t,e){if(!Reflect.has(t,e))return!1;let n=j(t,e);return!g(n.set)}function j(t,e){if(t=Object.getPrototypeOf(t),!t)return{};let n=Object.getOwnPropertyDescriptor(t,e);return n||j(t,e)}function O(t,e,n){if(!(typeof e!="object"||e===null))return Object.entries(e).forEach(function([r,u]){r&&(u=t.processReactiveAttribute(e,r,u,n),n(r,u))})}function T(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function $(t,e,n,c){return t[(g(c)?"remove":"set")+e](n,T(c))}function q(t,e,n,c,r=null){return t[(g(c)?"remove":"set")+e+"NS"](r,n,T(c))}function L(t,e,n){if(Reflect.set(t,e,n),!!g(n))return Reflect.deleteProperty(t,e)}function k(t,e,...n){let c=n.length?new CustomEvent(e,{detail:n[0]}):new Event(e);return t.dispatchEvent(c)}function C(t,e,n){return function(r){return r.addEventListener(t,e,n),r}}var y=H(),z=new WeakSet;C.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents?r:r.isConnected?(r.dispatchEvent(new Event(u)),r):(_(e.signal,()=>y.offConnected(r,t))&&y.onConnected(r,t),r)}};C.disconnected=function(t,e){let n="disconnected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let u="dde:"+n;return r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||_(e.signal,()=>y.offDisconnected(r,t))&&y.onDisconnected(r,t),r}};C.attributeChanged=function(t,e){let n="attributeChanged";return typeof e!="object"&&(e={}),function(r){let u="dde:"+n;if(r.addEventListener(u,t,e),r.__dde_lifecycleToEvents||z.has(r))return r;let f=new MutationObserver(function(d){for(let{attributeName:l,target:h}of d)h.dispatchEvent(new CustomEvent(u,{detail:[l,h.getAttribute(l)]}))});return _(e.signal,()=>f.disconnect())&&f.observe(r,{attributes:!0}),r}};function H(){let t=new Map,e=!1,n=new MutationObserver(function(o){for(let s of o)if(s.type==="childList"){if(l(s.addedNodes,!0)){f();continue}h(s.removedNodes,!0)&&f()}});return{onConnected(o,s){u();let i=r(o);i.connected.has(s)||(i.connected.add(s),i.length_c+=1)},offConnected(o,s){if(!t.has(o))return;let i=t.get(o);i.connected.has(s)&&(i.connected.delete(s),i.length_c-=1,c(o,i))},onDisconnected(o,s){u();let i=r(o);i.disconnected.has(s)||(i.disconnected.add(s),i.length_d+=1)},offDisconnected(o,s){if(!t.has(o))return;let i=t.get(o);i.disconnected.has(s)&&(i.disconnected.delete(s),i.length_d-=1,c(o,i))}};function c(o,s){s.length_c||s.length_d||(t.delete(o),f())}function r(o){if(t.has(o))return t.get(o);let s={connected:new WeakSet,length_c:0,disconnected:new WeakSet,length_d:0};return t.set(o,s),s}function u(){e||(e=!0,n.observe(document.body,{childList:!0,subtree:!0}))}function f(){!e||t.size||(e=!1,n.disconnect())}function a(){return new Promise(function(o){(requestIdleCallback||requestAnimationFrame)(o)})}async function d(o){t.size>30&&await a();let s=[];if(!(o instanceof Node))return s;for(let i of t.keys())i===o||!(i instanceof Node)||o.contains(i)&&s.push(i);return s}function l(o,s){let i=!1;for(let p of o){if(s&&d(p).then(l),!t.has(p))continue;let m=t.get(p);m.length_c&&(p.dispatchEvent(new Event("dde:connected")),m.connected=new WeakSet,m.length_c=0,m.length_d||t.delete(p),i=!0)}return i}function h(o,s){let i=!1;for(let p of o)s&&d(p).then(h),!(!t.has(p)||!t.get(p).length_d)&&(p.dispatchEvent(new Event("dde:disconnected")),t.delete(p),i=!0);return i}}typeof document.createDocumentFragment().append()>"u"&&[HTMLElement,SVGElement,DocumentFragment].forEach(t=>{let{append:e}=t.prototype;t.prototype.append=function(...n){return e.apply(this,n),this}});export{w as assign,N as assignAttribute,W as classListDeclarative,J as createElement,k as dispatchEvent,J as el,Q as empty,C as on,F as registerReactivity,x as scope}; diff --git a/docs/elements.html b/docs/elements.html index 21bdd1c..0ddfa65 100644 --- a/docs/elements.html +++ b/docs/elements.html @@ -1,4 +1,4 @@ -`deka-dom-el` — Elements

`deka-dom-el` — Elements

Basic concepts of elements modifications and creations.

Native JavaScript DOM elements creations

Let’s go through all patterns we would like to use and what needs to be improved for better experience.

Creating element(s) (with custom attributes)

You can create a native DOM element by using the document.createElement(). It is also possible to provide a some attribute(s) declaratively using Object.assign(). More precisely, this way you can sets some IDL.

document.body.append(
+`deka-dom-el` — Elements

`deka-dom-el` — Elements

Basic concepts of elements modifications and creations.

Native JavaScript DOM elements creations

Let’s go through all patterns we would like to use and what needs to be improved for better experience.

Creating element(s) (with custom attributes)

You can create a native DOM element by using the document.createElement(). It is also possible to provide a some attribute(s) declaratively using Object.assign(). More precisely, this way you can sets some IDL.

document.body.append(
 	document.createElement("div")
 );
 console.log(
@@ -12,7 +12,7 @@ document.body.append(
 		{ textContent: "Element’s text content.", style: "color: coral;" }
 	)
 );
-

To make this easier, you can use the el function. Internally in basic examples, it is wrapper around assign(document.createElement(…), { … }).

import { el, assign } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
+

To make this easier, you can use the el function. Internally in basic examples, it is wrapper around assign(document.createElement(…), { … }).

import { el, assign } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
 const color= "lightcoral";
 document.body.append(
 	el("p", { textContent: "Hello (first time)", style: { color } })
@@ -23,7 +23,7 @@ document.body.append(
 		{ textContent: "Hello (second time)", style: { color } }
 	)
 );
-

The assign function provides improved behaviour of Object.assign(). You can declaratively sets any IDL and attribute of the given element. Function prefers IDL and fallback to the element.setAttribute if there is no writable property in the element prototype.

You can study all JavaScript elements interfaces to the corresponding HTML elements. All HTML elements inherits from HTMLElement. To see all available IDLs for example for paragraphs, see HTMLParagraphElement. Moreover, the assign provides a way to sets declaratively some convenient properties:

  • It is possible to sets data-*/aria-* attributes using object notation.
  • In opposite, it is also possible to sets data-*/aria-* attribute using camelCase notation.
  • You can use string or object as a value for style property.
  • className (IDL – preffered)/class are ways to add CSS class to the element. You can use string (similarly to class="…" syntax in HTML) or array of strings. This is handy to concat conditional classes.
  • Use classList to toggle specific classes. This will be handy later when the reactivity via signals is beeing introduced.
  • The assign also accepts the undefined as a value for any property to remove it from the element declaratively. Also for some IDL the corresponding attribute is removed as it can be confusing. For example, natievly the element’s id is removed by setting the IDL to an empty string.

For processing, the assign internally uses assignAttribute and classListDeclarative.

import { assignAttribute, classListDeclarative } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
+

The assign function provides improved behaviour of Object.assign(). You can declaratively sets any IDL and attribute of the given element. Function prefers IDL and fallback to the element.setAttribute if there is no writable property in the element prototype.

You can study all JavaScript elements interfaces to the corresponding HTML elements. All HTML elements inherits from HTMLElement. To see all available IDLs for example for paragraphs, see HTMLParagraphElement. Moreover, the assign provides a way to sets declaratively some convenient properties:

  • It is possible to sets data-*/aria-* attributes using object notation.
  • In opposite, it is also possible to sets data-*/aria-* attribute using camelCase notation.
  • You can use string or object as a value for style property.
  • className (IDL – preffered)/class are ways to add CSS class to the element. You can use string (similarly to class="…" syntax in HTML) or array of strings. This is handy to concat conditional classes.
  • Use classList to toggle specific classes. This will be handy later when the reactivity via signals is beeing introduced.
  • The assign also accepts the undefined as a value for any property to remove it from the element declaratively. Also for some IDL the corresponding attribute is removed as it can be confusing. For example, natievly the element’s id is removed by setting the IDL to an empty string.

For processing, the assign internally uses assignAttribute and classListDeclarative.

import { assignAttribute, classListDeclarative } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
 const paragraph= document.createElement("p");
 
 assignAttribute(paragraph, "textContent", "Hello, world!");
@@ -48,7 +48,7 @@ console.log(paragraph.outerHTML);
 document.body.append(
 	paragraph
 );
-

Native JavaScript templating

By default, the native JS has no good way to define HTML template using DOM API:

document.body.append(
+

Native JavaScript templating

By default, the native JS has no good way to define HTML template using DOM API:

document.body.append(
 	document.createElement("div"),
 	document.createElement("span"),
 	document.createElement("main")
@@ -59,7 +59,7 @@ const template= document.createElement("main").append(
 	document.createElement("span"),
 );
 console.log(typeof template==="undefined");
-

This library therefore ooverwrites the append method to always return parent element.

import { el } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
+

This library therefore ooverwrites the append method to always return parent element.

import { el } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
 document.head.append(
 	el("style").append(
 		"tr, td{ border: 1px solid red; padding: 1em; }",
@@ -83,7 +83,7 @@ document.body.append(
 		)
 	)
 );
-

Creating advanced (reactive) templates and components

Basic components

You can use functions for encapsulation (repeating) logic. The el accepts function as first argument. In that case, the function should return dom elements and the second argument for el is argument for given element.

import { el } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
+

Creating advanced (reactive) templates and components

Basic components

You can use functions for encapsulation (repeating) logic. The el accepts function as first argument. In that case, the function should return dom elements and the second argument for el is argument for given element.

import { el } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
 document.head.append(
 	el("style").append(
 		".class1{ font-weight: bold; }",
@@ -100,4 +100,4 @@ function component({ className, textContent }){
 		el("p", textContent)
 	);
 }
-

It is nice to use similar naming convention as native DOM API.

\ No newline at end of file +

It is nice to use similar naming convention as native DOM API.

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 79c9d68..9f1255d 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,4 +1,4 @@ -`deka-dom-el` — Introduction

`deka-dom-el` — Introduction

Introducing a library and motivations.

The library tries to provide pure JavaScript tool(s) to create reactive interfaces.

The main goals are:

  • provide a small wrappers/utilities around the native JavaScript DOM
  • keep library size around 10kB at maximum (if possible)
  • zero dependencies (if possible)
  • prefer a declarative/functional approach
  • unopinionated (allow alternative methods)

It is, in fact, an reimplementation of jaandrle/dollar_dom_component.

import { el, S } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
+`deka-dom-el` — Introduction

`deka-dom-el` — Introduction

Introducing a library and motivations.

The library tries to provide pure JavaScript tool(s) to create reactive interfaces.

import { el, S } from "https://cdn.jsdelivr.net/gh/jaandrle/deka-dom-el/dist/esm-with-signals.js";
 const clicks= S(0);
 document.body.append(
 	el().append(
@@ -12,4 +12,4 @@ document.body.append(
 		})
 	)
 );
-
\ No newline at end of file +
\ No newline at end of file diff --git a/docs_src/index.html.js b/docs_src/index.html.js index 1506104..5ad98c3 100644 --- a/docs_src/index.html.js +++ b/docs_src/index.html.js @@ -19,23 +19,6 @@ export function page({ pkg, info, path_target, pages, registerClientFile }){ el(header, { info, pkg, path_target, pages }), el("main").append( el("p", "The library tries to provide pure JavaScript tool(s) to create reactive interfaces. "), - el("p", "The main goals are:"), - el("ul").append( - el("li", "provide a small wrappers/utilities around the native JavaScript DOM"), - el("li", "keep library size around 10kB at maximum (if possible)"), - el("li", "zero dependencies (if possible)"), - el("li", "prefer a declarative/functional approach"), - el("li", "unopinionated (allow alternative methods)"), - ), - el("p", { className: "note" }).append( - "It is, in fact, an reimplementation of ", - el("a", { - href: "https://github.com/jaandrle/dollar_dom_component", - title: "GitHub repository of library. Motto: Functional DOM components without JSX and virtual DOM.", - textContent: "jaandrle/dollar_dom_component" - }), - ".", - ), el(example, { src: new URL("./components/examples/helloWorld.js", import.meta.url), page_id, registerClientFile }), ) ); diff --git a/package-lock.json b/package-lock.json index cae0e83..6ea7149 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "devDependencies": { "@size-limit/preset-small-lib": "^8.2.6", - "compressing": "^1.10.0", "dts-bundler": "^0.1.0", "esbuild": "^0.19.2", "jsdom": "^22.1.0", @@ -22,16 +21,6 @@ "node": ">=18" } }, - "node_modules/@eggjs/yauzl": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/@eggjs/yauzl/-/yauzl-2.11.0.tgz", - "integrity": "sha512-Jq+k2fCZJ3i3HShb0nxLUiAgq5pwo8JTT1TrH22JoehZQ0Nm2dvByGIja1NYfNyuE4Tx5/Dns5nVsBN/mlC8yg==", - "dev": true, - "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer2": "^1.2.0" - } - }, "node_modules/@esbuild/android-arm": { "version": "0.19.5", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz", @@ -1039,52 +1028,6 @@ "node": ">=8" } }, - "node_modules/bl": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.3.tgz", - "integrity": "sha512-pvcNpa0UU69UT341rO6AYy4FVAIkUHuZXRIWbq+zHnsVcRzDDjIAhGuuYoi0d//cwIwtt4pkpKycWEfjdV+vww==", - "dev": true, - "dependencies": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" - } - }, - "node_modules/bl/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/bl/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/bl/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/bl/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -1107,37 +1050,6 @@ "node": ">=8" } }, - "node_modules/buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "dev": true, - "dependencies": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "node_modules/buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==", - "dev": true - }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha512-T7zexNBwiiaCOGDg9xNX9PBmjrubblRkENuptryuI64URkXDFum9il/JGL8Lm8wYfAXpredVXXZz7eMHilimiQ==", - "dev": true - }, "node_modules/bytes-iec": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.1.1.tgz", @@ -1217,38 +1129,6 @@ "node": ">= 0.8" } }, - "node_modules/compressing": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/compressing/-/compressing-1.10.0.tgz", - "integrity": "sha512-k2vpbZLaJoHe9euyUZjYYE8vOrbR19aU3HcWIYw5EBXiUs34ygfDVnXU+ubI41JXMriHutnoiu0ZFdwCkH6jPA==", - "dev": true, - "dependencies": { - "@eggjs/yauzl": "^2.11.0", - "flushwritable": "^1.0.0", - "get-ready": "^1.0.0", - "iconv-lite": "^0.5.0", - "mkdirp": "^0.5.1", - "pump": "^3.0.0", - "streamifier": "^0.1.1", - "tar-stream": "^1.5.2", - "yazl": "^2.4.2" - }, - "engines": { - "node": ">= 4.0.0" - } - }, - "node_modules/compressing/node_modules/iconv-lite": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.2.tgz", - "integrity": "sha512-kERHXvpSaB4aU3eANwidg79K8FlrN77m8G9V+0vOR3HYaRifrlwMEpT7ZBJqLSEIHnEgJTHcWK82wwLwwKwtag==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1447,15 +1327,6 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", - "dev": true, - "dependencies": { - "once": "^1.4.0" - } - }, "node_modules/entities": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", @@ -1542,15 +1413,6 @@ "reusify": "^1.0.4" } }, - "node_modules/fd-slicer2": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/fd-slicer2/-/fd-slicer2-1.2.0.tgz", - "integrity": "sha512-3lBUNUckhMZduCc4g+Pw4Ve16LD9vpX9b8qUkkKq2mgDRLYWzblszZH2luADnJqjJe+cypngjCuKRm/IW12rRw==", - "dev": true, - "dependencies": { - "pend": "^1.2.0" - } - }, "node_modules/fetch-blob": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", @@ -1586,12 +1448,6 @@ "node": ">=8" } }, - "node_modules/flushwritable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/flushwritable/-/flushwritable-1.0.0.tgz", - "integrity": "sha512-3VELfuWCLVzt5d2Gblk8qcqFro6nuwvxwMzHaENVDHI7rxcBRtMCwTk/E9FXcgh+82DSpavPNDueA9+RxXJoFg==", - "dev": true - }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -1618,12 +1474,6 @@ "node": ">=12.20.0" } }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true - }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1644,12 +1494,6 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/get-ready": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/get-ready/-/get-ready-1.0.0.tgz", - "integrity": "sha512-mFXCZPJIlcYcth+N8267+mghfYN9h3EhsDa6JSnbA3Wrhh/XFpuowviFcsDeYZtKspQyWyJqfs4O6P8CHeTwzw==", - "dev": true - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2077,27 +1921,6 @@ "node": "*" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", - "dev": true, - "dependencies": { - "minimist": "^1.2.6" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -2285,12 +2108,6 @@ "node": ">=8" } }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true - }, "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", @@ -2309,28 +2126,12 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, "node_modules/psl": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==", "dev": true }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "dev": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -2584,15 +2385,6 @@ "node": ">=8" } }, - "node_modules/streamifier": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/streamifier/-/streamifier-0.1.1.tgz", - "integrity": "sha512-zDgl+muIlWzXNsXeyUfOk9dChMjlpkq0DRsxujtYPgyJ676yQ8jEm6zzaaWHFDg5BNcLuif0eD2MTyJdZqXpdg==", - "dev": true, - "engines": { - "node": ">=0.10" - } - }, "node_modules/string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", @@ -2655,66 +2447,6 @@ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==", "dev": true }, - "node_modules/tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "dev": true, - "dependencies": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - }, - "engines": { - "node": ">= 0.8.0" - } - }, - "node_modules/tar-stream/node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/tar-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/tar-stream/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==", - "dev": true - }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2811,12 +2543,6 @@ "requires-port": "^1.0.0" } }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz", @@ -2940,29 +2666,11 @@ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", "dev": true }, - "node_modules/xtend": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", - "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true, - "engines": { - "node": ">=0.4" - } - }, "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true - }, - "node_modules/yazl": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", - "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", - "dev": true, - "dependencies": { - "buffer-crc32": "~0.2.3" - } } } } diff --git a/package.json b/package.json index 8d11ea7..4445d9a 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,6 @@ ], "devDependencies": { "@size-limit/preset-small-lib": "^8.2.6", - "compressing": "^1.10.0", "dts-bundler": "^0.1.0", "esbuild": "^0.19.2", "jsdom": "^22.1.0",