mirror of
https://github.com/jaandrle/deka-dom-el
synced 2026-11-16 17:10:13 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7d62dbce7
|
||
|
|
029ef5adb4
|
||
|
|
97da5441ee
|
||
|
|
19fd857dac
|
No files matched your search
+23
-12
@@ -1,15 +1,19 @@
|
|||||||
#!/usr/bin/env -S npx nodejsscript
|
#!/usr/bin/env -S npx nodejsscript
|
||||||
const files= [ "index.js", "index-with-signals.js" ];
|
import { bundle as bundleDTS } from "dts-bundler";
|
||||||
|
const files= [ "index", "index-with-signals" ];
|
||||||
const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark);
|
const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark);
|
||||||
|
|
||||||
for(const file of files){
|
$.api("", true)
|
||||||
|
.option("--minify", "Level of minification [ full (default), partial ]")
|
||||||
|
.action(function main({ minify= "full" }){
|
||||||
|
for(const file_root of files){
|
||||||
|
const file= file_root+".js";
|
||||||
const out= filesOut(file);
|
const out= filesOut(file);
|
||||||
s.run([
|
s.run([
|
||||||
"npx esbuild '::file::'",
|
"npx esbuild '::file::'",
|
||||||
"--platform=neutral",
|
"--platform=neutral",
|
||||||
"--bundle",
|
"--bundle",
|
||||||
//"--minify",
|
minify==="full" ? "--minify" : "--minify-syntax --minify-identifiers",
|
||||||
"--minify-syntax --minify-identifiers",
|
|
||||||
"--legal-comments=inline",
|
"--legal-comments=inline",
|
||||||
"--packages=external",
|
"--packages=external",
|
||||||
"--outfile='::out::'"
|
"--outfile='::out::'"
|
||||||
@@ -18,23 +22,30 @@ for(const file of files){
|
|||||||
f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)),
|
f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)),
|
||||||
f=> s.echo(f).to(out)
|
f=> s.echo(f).to(out)
|
||||||
)(s.cat(out));
|
)(s.cat(out));
|
||||||
|
const file_dts= file_root+".d.ts";
|
||||||
|
const file_dts_out= filesOut(file_dts);
|
||||||
|
echo(` ${file_dts_out}`)
|
||||||
|
s.echo(bundleDTS(file_dts)).to(file_dts_out);
|
||||||
|
echo("⚡ Done");
|
||||||
toDDE(out, filesOut(file, "dde"));
|
toDDE(out, filesOut(file, "dde"));
|
||||||
}
|
}
|
||||||
$.exit(0);
|
$.exit(0);
|
||||||
|
|
||||||
function toDDE(file, out){
|
function toDDE(file, out){
|
||||||
const name= "dde";
|
const name= "dde";
|
||||||
echo(`\n ${out} (${file} → globalThis.${name})\n`);
|
echo(` ${out} (${file} → globalThis.${name})`);
|
||||||
|
|
||||||
let content= s.cat(file).toString().split(/export ?{/);
|
let content= s.cat(file).toString().split(/export ?{/);
|
||||||
content.splice(1, 0, `\nglobalThis.${name}= {`);
|
content.splice(1, 0, `\nglobalThis.${name}= {`);
|
||||||
content[2]= content[2].replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
|
content[2]= content[2].replace(/,(?!\n)/g, ",\n").replace(/(?<!\n)}/, "\n}").replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4");
|
||||||
s.echo([
|
s.echo([
|
||||||
`//deka-dom-el library is available via global namespace \`${name}\``,
|
`//deka-dom-el library is available via global namespace \`${name}\``,
|
||||||
"(()=> {",
|
"(()=> {",
|
||||||
"\t"+content.join("").split("\n").join("\n "),
|
content.join(""),
|
||||||
"})();"
|
"})();"
|
||||||
].join("\n")).to(out);
|
].join("\n")).to(out);
|
||||||
|
|
||||||
echo("⚡ Done\n");
|
echo("⚡ Done");
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.parse();
|
||||||
Vendored
+17
-526
@@ -1,530 +1,21 @@
|
|||||||
//deka-dom-el library is available via global namespace `dde`
|
//deka-dom-el library is available via global namespace `dde`
|
||||||
(()=> {
|
(()=> {
|
||||||
// src/signals-common.js
|
var w={isSignal(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function T(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 E(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 z={setDeleteAttr:X};function X(t,e,n){if(Reflect.set(t,e,n),!!E(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}],H=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=H(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=H(t.namespace)),y.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return y.pop()}};function lt(t,e,...n){let r=O(this),{namespace:o}=b,c=0,s;switch((Object(e)!==e||r.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{c=1,b.push({scope:t,host:a=>a?(c===1?n.unshift(a):a(s),void 0):s}),s=t(e||void 0),(s instanceof HTMLElement?J:V)(s,"Attribute","dde-fun",t.name);break}case t==="#text":s=C.call(this,document.createTextNode(""),e);break;case 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 n.forEach(a=>a(s)),c&&b.pop(),c=2,s}var{setDeleteAttr:U}=z,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,(a,d)=>q.call(c,t,a,d));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return $(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 U(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return M(o,n,$.bind(null,t[e]));case"ariaset":return M(o,n,(a,d)=>r("aria-"+a,d));case"classList":return Y.call(c,t,n)}return tt(t,e)?U(t,e,n):r(e,n)}function B(t,e){if(L.has(t))return L.get(t);let r=(t instanceof SVGElement?V:J).bind(null,t,"Attribute"),o=O(e);return{setRemoveAttr:r,s:o}}function Y(t,e){let n=O(this);return M(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 tt(t,e){if(!Reflect.has(t,e))return!1;let n=G(t,e);return!E(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 M(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 J(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,I(r))}function V(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,I(r))}function $(t,e,n){if(Reflect.set(t,e,n),!!E(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(d){for(let{attributeName:m,target:_}of d)_.dispatchEvent(new CustomEvent(c,{detail:[m,_.getAttribute(m)]}))});return R(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function nt(){let t=new MapLine truncated
|
||||||
var w = {
|
* Investigate `__dde_attributes` key of the element.*/let[s,a]=c,d=r[S][s];d&&d(a)})(r),v.disconnected(function(){/*! This removes all signals mapped to attributes (`S.attribute`).
|
||||||
isSignal(t) {
|
* Investigate `__dde_attributes` key of the element.*/h.clear(...Object.values(r[S]))})(r),r}),n};h.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),!l.has(o))return;let c=l.get(o);c.delete(n),!(c.size>1)&&(h.clear(...c),l.delete(o))})}};var P="__dde_reactive";h.el=function(t,e){let n=document.createComment("<dde:reactive>"),r=document.createComment("</dde:reactive>"),o=document.createDocumentFragment();o.append(n,r);let{current:c}=b,s=a=>{if(!n.parentNode||!r.parentNode)return A(t,s);b.push(c);let d=e(a);b.pop(),Array.isArray(d)||(d=[d]);let m=n;for(;(m=n.nextSibling)!==r;)m.remove();n.after(...d)};return k(t,s),Q(t,s,n,e),s(t()),o};var K={isSignal:j,processReactiveAttribute(t,e,n,r){if(!j(n))return n;let o=c=>r(e,c);return k(n,o),Q(n,o,t,e),n()}};function Q(t,e,...n){let{current:r}=b;r.prevent||r.host(function(o){o[P]||(o[P]=[],v.disconnected(()=>o[P].forEach(([[c,s]])=>A(c,s,c[p]?.host()===o)))(o)),o[P].push([[t,e],...n])})}function Z(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}}),W=class extends Error{constructor(){super();let[e,...n]=this.stack.split(`
|
||||||
return !1;
|
`),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}=h.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 W},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[p],rt),t}function ct(){return D[D.length-1]}function st(t){if(!t[p])return;let{value:e,listeners:n}=t[p],r=ct();return r&&n.add(r),l.has(r)&&l.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 k(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(h.clear(t),!l.has(r))return o;let c=l.get(r);if(!l.has(c))return o;l.get(c).forEach(s=>A(s,c,!0))}return o}T(K);
|
||||||
},
|
globalThis.dde= {S: h,
|
||||||
processReactiveAttribute(t, e, n, o) {
|
assign: C,
|
||||||
return n;
|
assignAttribute: q,
|
||||||
}
|
classListDeclarative: Y,
|
||||||
};
|
createElement: lt,
|
||||||
function j(t, e = !0) {
|
dispatchEvent: Et,
|
||||||
return e ? Object.assign(w, t) : (Object.setPrototypeOf(t, w), t);
|
el: lt,
|
||||||
}
|
empty: gt,
|
||||||
function A(t) {
|
isSignal: j,
|
||||||
return w.isPrototypeOf(t) && t !== w ? t : w;
|
on: v,
|
||||||
}
|
registerReactivity: T,
|
||||||
|
scope: b
|
||||||
// src/helpers.js
|
};
|
||||||
function E(t) {
|
|
||||||
return typeof t > "u";
|
|
||||||
}
|
|
||||||
function k(t) {
|
|
||||||
let e = typeof t;
|
|
||||||
return e !== "object" ? e : t === null ? "null" : Object.prototype.toString.call(t);
|
|
||||||
}
|
|
||||||
function O(t, e) {
|
|
||||||
if (!t || !(t instanceof AbortSignal))
|
|
||||||
return !0;
|
|
||||||
if (!t.aborted)
|
|
||||||
return t.addEventListener("abort", e), function() {
|
|
||||||
t.removeEventListener("abort", e);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom-common.js
|
|
||||||
var F = { setDeleteAttr: Q };
|
|
||||||
function Q(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!E(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, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom.js
|
|
||||||
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, h = {
|
|
||||||
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 h.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 pt(t, e, ...n) {
|
|
||||||
let o = A(this), { namespace: r } = h, c = 0, s;
|
|
||||||
switch ((Object(e) !== e || o.isSignal(e)) && (e = { textContent: e }), !0) {
|
|
||||||
case typeof t == "function": {
|
|
||||||
c = 1, h.push({ scope: t, host: (a) => a ? (c === 1 ? n.unshift(a) : a(s), void 0) : s }), s = t(e || void 0), (s instanceof HTMLElement ? I : J)(s, "Attribute", "dde-fun", t.name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case t === "#text":
|
|
||||||
s = R.call(this, document.createTextNode(""), e);
|
|
||||||
break;
|
|
||||||
case t === "<>":
|
|
||||||
s = R.call(this, document.createDocumentFragment(), e);
|
|
||||||
break;
|
|
||||||
case r !== "html":
|
|
||||||
s = R.call(this, document.createElementNS(r, t), e);
|
|
||||||
break;
|
|
||||||
case !s:
|
|
||||||
s = R.call(this, document.createElement(t), e);
|
|
||||||
}
|
|
||||||
return n.forEach((a) => a(s)), c && h.pop(), c = 2, s;
|
|
||||||
}
|
|
||||||
var { setDeleteAttr: H } = F, C = /* @__PURE__ */ new WeakMap();
|
|
||||||
function R(t, ...e) {
|
|
||||||
if (!e.length)
|
|
||||||
return t;
|
|
||||||
C.set(t, q(t, this));
|
|
||||||
for (let [n, o] of Object.entries(Object.assign({}, ...e)))
|
|
||||||
$.call(this, t, n, o);
|
|
||||||
return C.delete(t), t;
|
|
||||||
}
|
|
||||||
function $(t, e, n) {
|
|
||||||
let { setRemoveAttr: o, s: r } = q(t, this), c = this;
|
|
||||||
n = r.processReactiveAttribute(
|
|
||||||
t,
|
|
||||||
e,
|
|
||||||
n,
|
|
||||||
(a, p) => $.call(c, t, a, p)
|
|
||||||
);
|
|
||||||
let [s] = e;
|
|
||||||
if (s === "=")
|
|
||||||
return o(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(), o(e, n);
|
|
||||||
switch (e === "className" && (e = "class"), e) {
|
|
||||||
case "xlink:href":
|
|
||||||
return o(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(r, n, U.bind(null, t[e]));
|
|
||||||
case "ariaset":
|
|
||||||
return T(r, n, (a, p) => o("aria-" + a, p));
|
|
||||||
case "classList":
|
|
||||||
return X.call(c, t, n);
|
|
||||||
}
|
|
||||||
return Y(t, e) ? H(t, e, n) : o(e, n);
|
|
||||||
}
|
|
||||||
function q(t, e) {
|
|
||||||
if (C.has(t))
|
|
||||||
return C.get(t);
|
|
||||||
let o = (t instanceof SVGElement ? J : I).bind(null, t, "Attribute"), r = A(e);
|
|
||||||
return { setRemoveAttr: o, s: r };
|
|
||||||
}
|
|
||||||
function X(t, e) {
|
|
||||||
let n = A(this);
|
|
||||||
return T(
|
|
||||||
n,
|
|
||||||
e,
|
|
||||||
(o, r) => t.classList.toggle(o, r === -1 ? void 0 : !!r)
|
|
||||||
), t;
|
|
||||||
}
|
|
||||||
function ht(t) {
|
|
||||||
return Array.from(t.children).forEach((e) => e.remove()), t;
|
|
||||||
}
|
|
||||||
function Y(t, e) {
|
|
||||||
if (!Reflect.has(t, e))
|
|
||||||
return !1;
|
|
||||||
let n = B(t, e);
|
|
||||||
return !E(n.set);
|
|
||||||
}
|
|
||||||
function B(t, e) {
|
|
||||||
if (t = Object.getPrototypeOf(t), !t)
|
|
||||||
return {};
|
|
||||||
let n = Object.getOwnPropertyDescriptor(t, e);
|
|
||||||
return n || B(t, e);
|
|
||||||
}
|
|
||||||
function T(t, e, n) {
|
|
||||||
if (!(typeof e != "object" || e === null))
|
|
||||||
return Object.entries(e).forEach(function([r, c]) {
|
|
||||||
r && (c = t.processReactiveAttribute(e, r, c, n), n(r, c));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function G(t) {
|
|
||||||
return Array.isArray(t) ? t.filter(Boolean).join(" ") : t;
|
|
||||||
}
|
|
||||||
function I(t, e, n, o) {
|
|
||||||
return t[(E(o) ? "remove" : "set") + e](n, G(o));
|
|
||||||
}
|
|
||||||
function J(t, e, n, o, r = null) {
|
|
||||||
return t[(E(o) ? "remove" : "set") + e + "NS"](r, n, G(o));
|
|
||||||
}
|
|
||||||
function U(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!E(n))
|
|
||||||
return Reflect.deleteProperty(t, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/events.js
|
|
||||||
function bt(t, e, ...n) {
|
|
||||||
let o = n.length ? new CustomEvent(e, { detail: n[0] }) : new Event(e);
|
|
||||||
return t.dispatchEvent(o);
|
|
||||||
}
|
|
||||||
function v(t, e, n) {
|
|
||||||
return function(r) {
|
|
||||||
return r.addEventListener(t, e, n), r;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var L = et(), tt = /* @__PURE__ */ new WeakSet();
|
|
||||||
v.connected = function(t, e) {
|
|
||||||
let n = "connected";
|
|
||||||
return typeof e != "object" && (e = {}), e.once = !0, function(r) {
|
|
||||||
let c = "dde:" + n;
|
|
||||||
return r.addEventListener(c, t, e), r.__dde_lifecycleToEvents ? r : r.isConnected ? (r.dispatchEvent(new Event(c)), r) : (O(e.signal, () => L.offConnected(r, t)) && L.onConnected(r, t), r);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
v.disconnected = function(t, e) {
|
|
||||||
let n = "disconnected";
|
|
||||||
return typeof e != "object" && (e = {}), e.once = !0, function(r) {
|
|
||||||
let c = "dde:" + n;
|
|
||||||
return r.addEventListener(c, t, e), r.__dde_lifecycleToEvents || O(e.signal, () => L.offDisconnected(r, t)) && L.onDisconnected(r, t), r;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
v.attributeChanged = function(t, e) {
|
|
||||||
let n = "attributeChanged";
|
|
||||||
return typeof e != "object" && (e = {}), function(r) {
|
|
||||||
let c = "dde:" + n;
|
|
||||||
if (r.addEventListener(c, t, e), r.__dde_lifecycleToEvents || tt.has(r))
|
|
||||||
return r;
|
|
||||||
let s = new MutationObserver(function(p) {
|
|
||||||
for (let { attributeName: b, target: _ } of p)
|
|
||||||
_.dispatchEvent(
|
|
||||||
new CustomEvent(c, { detail: [b, _.getAttribute(b)] })
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return O(e.signal, () => s.disconnect()) && s.observe(r, { attributes: !0 }), r;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
function et() {
|
|
||||||
let t = /* @__PURE__ */ new Map(), e = !1, n = new MutationObserver(function(i) {
|
|
||||||
for (let u of i)
|
|
||||||
if (u.type === "childList") {
|
|
||||||
if (b(u.addedNodes, !0)) {
|
|
||||||
s();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_(u.removedNodes, !0) && s();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
onConnected(i, u) {
|
|
||||||
c();
|
|
||||||
let f = r(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, o(i, f));
|
|
||||||
},
|
|
||||||
onDisconnected(i, u) {
|
|
||||||
c();
|
|
||||||
let f = r(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, o(i, f));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function o(i, u) {
|
|
||||||
u.length_c || u.length_d || (t.delete(i), s());
|
|
||||||
}
|
|
||||||
function r(i) {
|
|
||||||
if (t.has(i))
|
|
||||||
return t.get(i);
|
|
||||||
let u = {
|
|
||||||
connected: /* @__PURE__ */ new WeakSet(),
|
|
||||||
length_c: 0,
|
|
||||||
disconnected: /* @__PURE__ */ 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 a() {
|
|
||||||
return new Promise(function(i) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(i);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function p(i) {
|
|
||||||
t.size > 30 && await a();
|
|
||||||
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 b(i, u) {
|
|
||||||
let f = !1;
|
|
||||||
for (let m of i) {
|
|
||||||
if (u && p(m).then(b), !t.has(m))
|
|
||||||
continue;
|
|
||||||
let x = t.get(m);
|
|
||||||
x.length_c && (m.dispatchEvent(new Event("dde:connected")), x.connected = /* @__PURE__ */ new WeakSet(), x.length_c = 0, x.length_d || t.delete(m), f = !0);
|
|
||||||
}
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
function _(i, u) {
|
|
||||||
let f = !1;
|
|
||||||
for (let m of i)
|
|
||||||
u && p(m).then(_), !(!t.has(m) || !t.get(m).length_d) && (m.dispatchEvent(new Event("dde:disconnected")), t.delete(m), f = !0);
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// index.js
|
|
||||||
[HTMLElement, SVGElement, DocumentFragment].forEach((t) => {
|
|
||||||
let { append: e } = t.prototype;
|
|
||||||
t.prototype.append = function(...n) {
|
|
||||||
return e.apply(this, n), this;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// src/signals-lib.js
|
|
||||||
var d = Symbol.for("Signal");
|
|
||||||
function N(t) {
|
|
||||||
try {
|
|
||||||
return Reflect.has(t, d);
|
|
||||||
} catch {
|
|
||||||
return !1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var P = [], l = /* @__PURE__ */ new WeakMap();
|
|
||||||
function g(t, e) {
|
|
||||||
if (typeof t != "function")
|
|
||||||
return V(t, e);
|
|
||||||
if (N(t))
|
|
||||||
return t;
|
|
||||||
let n = V(), o = function() {
|
|
||||||
let [r, ...c] = l.get(o);
|
|
||||||
if (l.set(o, /* @__PURE__ */ new Set([r])), P.push(o), n(t()), P.pop(), !c.length)
|
|
||||||
return;
|
|
||||||
let s = l.get(o);
|
|
||||||
for (let a of c)
|
|
||||||
s.has(a) || S(a, o);
|
|
||||||
};
|
|
||||||
return l.set(n[d], o), l.set(o, /* @__PURE__ */ new Set([n])), o(), n;
|
|
||||||
}
|
|
||||||
g.action = function(t, e, ...n) {
|
|
||||||
let o = t[d], { actions: r } = o;
|
|
||||||
if (!r || !Reflect.has(r, e))
|
|
||||||
throw new Error(`'${t}' has no action with name '${e}'!`);
|
|
||||||
if (r[e].apply(o, n), o.skip)
|
|
||||||
return Reflect.deleteProperty(o, "skip");
|
|
||||||
o.listeners.forEach((c) => c(o.value));
|
|
||||||
};
|
|
||||||
g.on = function t(e, n, o = {}) {
|
|
||||||
let { signal: r } = o;
|
|
||||||
if (!(r && r.aborted)) {
|
|
||||||
if (Array.isArray(e))
|
|
||||||
return e.forEach((c) => t(c, n, o));
|
|
||||||
W(e, n), r && r.addEventListener("abort", () => S(e, n));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
g.symbols = {
|
|
||||||
signal: d,
|
|
||||||
onclear: Symbol.for("Signal.onclear")
|
|
||||||
};
|
|
||||||
g.attribute = function(t, e = void 0) {
|
|
||||||
let { host: n } = h, o = n() && n().hasAttribute(t) ? n().getAttribute(t) : e, r = new AbortController(), c = g(o, {
|
|
||||||
[g.symbols.onclear]() {
|
|
||||||
r.abort();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return h.host(v.attributeChanged(function({ detail: a }) {
|
|
||||||
let [p, b] = a;
|
|
||||||
p === t && c(b);
|
|
||||||
}, { signal: r.signal })), c;
|
|
||||||
};
|
|
||||||
g.clear = function(...t) {
|
|
||||||
for (let n of t) {
|
|
||||||
Reflect.deleteProperty(n, "toJSON");
|
|
||||||
let o = n[d];
|
|
||||||
o.onclear.forEach((r) => r.call(o)), e(n, o), Reflect.deleteProperty(n, d);
|
|
||||||
}
|
|
||||||
function e(n, o) {
|
|
||||||
o.listeners.forEach((r) => {
|
|
||||||
if (o.listeners.delete(r), !l.has(r))
|
|
||||||
return;
|
|
||||||
let c = l.get(r);
|
|
||||||
c.delete(n), !(c.size > 1) && (g.clear(...c), l.delete(r));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var D = "__dde_reactive";
|
|
||||||
g.el = function(t, e) {
|
|
||||||
let n = document.createComment("<dde:reactive>"), o = document.createComment("</dde:reactive>"), r = document.createDocumentFragment();
|
|
||||||
r.append(n, o);
|
|
||||||
let { current: c } = h, s = (a) => {
|
|
||||||
if (!n.parentNode || !o.parentNode)
|
|
||||||
return S(t, s);
|
|
||||||
h.push(c);
|
|
||||||
let p = e(a);
|
|
||||||
h.pop(), Array.isArray(p) || (p = [p]);
|
|
||||||
let b = n;
|
|
||||||
for (; (b = n.nextSibling) !== o; )
|
|
||||||
b.remove();
|
|
||||||
n.after(...p);
|
|
||||||
};
|
|
||||||
return W(t, s), K(t, s, n, e), s(t()), r;
|
|
||||||
};
|
|
||||||
var Z = {
|
|
||||||
isSignal: N,
|
|
||||||
processReactiveAttribute(t, e, n, o) {
|
|
||||||
if (!N(n))
|
|
||||||
return n;
|
|
||||||
let r = (c) => o(e, c);
|
|
||||||
return W(n, r), K(n, r, t, e), n();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function K(t, e, ...n) {
|
|
||||||
let { current: o } = h;
|
|
||||||
o.prevent || o.host(function(r) {
|
|
||||||
r[D] || (r[D] = [], v.disconnected(
|
|
||||||
() => (
|
|
||||||
/*!
|
|
||||||
* Clears all signals listeners added in the current scope/host (`S.el`, `assign`, …?).
|
|
||||||
* You can investigate the `__dde_reactive` key of the element.
|
|
||||||
* */
|
|
||||||
r[D].forEach(([[c, s]]) => S(c, s, c[d]?.host() === r))
|
|
||||||
)
|
|
||||||
)(r)), r[D].push([[t, e], ...n]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function V(t, e) {
|
|
||||||
let n = (...o) => o.length ? st(n, ...o) : ct(n);
|
|
||||||
return rt(n, t, e);
|
|
||||||
}
|
|
||||||
var nt = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
||||||
stopPropagation() {
|
|
||||||
this.skip = !0;
|
|
||||||
}
|
|
||||||
}), M = class extends Error {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
let [e, ...n] = this.stack.split(`
|
|
||||||
`), o = e.slice(e.indexOf("@"), e.indexOf(".js:") + 4);
|
|
||||||
this.stack = n.find((r) => !r.includes(o));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function rt(t, e, n) {
|
|
||||||
let o = [];
|
|
||||||
k(n) !== "[object Object]" && (n = {});
|
|
||||||
let { onclear: r } = g.symbols;
|
|
||||||
n[r] && (o.push(n[r]), Reflect.deleteProperty(n, r));
|
|
||||||
let { host: c } = h;
|
|
||||||
return t[d] = {
|
|
||||||
value: e,
|
|
||||||
actions: n,
|
|
||||||
onclear: o,
|
|
||||||
host: c,
|
|
||||||
listeners: /* @__PURE__ */ new Set(),
|
|
||||||
defined: new M()
|
|
||||||
}, t.toJSON = () => t(), Object.setPrototypeOf(t[d], nt), t;
|
|
||||||
}
|
|
||||||
function ot() {
|
|
||||||
return P[P.length - 1];
|
|
||||||
}
|
|
||||||
function ct(t) {
|
|
||||||
if (!t[d])
|
|
||||||
return;
|
|
||||||
let { value: e, listeners: n } = t[d], o = ot();
|
|
||||||
return o && n.add(o), l.has(o) && l.get(o).add(t), e;
|
|
||||||
}
|
|
||||||
function st(t, e, n) {
|
|
||||||
if (!t[d])
|
|
||||||
return;
|
|
||||||
let o = t[d];
|
|
||||||
if (!(!n && o.value === e))
|
|
||||||
return o.value = e, o.listeners.forEach((r) => r(e)), e;
|
|
||||||
}
|
|
||||||
function W(t, e) {
|
|
||||||
if (t[d])
|
|
||||||
return t[d].listeners.add(e);
|
|
||||||
}
|
|
||||||
function S(t, e, n) {
|
|
||||||
let o = t[d];
|
|
||||||
if (!o)
|
|
||||||
return;
|
|
||||||
let r = o.listeners.delete(e);
|
|
||||||
if (n && !o.listeners.size) {
|
|
||||||
if (g.clear(t), !l.has(o))
|
|
||||||
return r;
|
|
||||||
let c = l.get(o);
|
|
||||||
if (!l.has(c))
|
|
||||||
return r;
|
|
||||||
l.get(c).forEach((s) => S(s, c, !0));
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// signals.js
|
|
||||||
j(Z);
|
|
||||||
|
|
||||||
globalThis.dde= {
|
|
||||||
S: g,
|
|
||||||
assign: R,
|
|
||||||
assignAttribute: $,
|
|
||||||
classListDeclarative: X,
|
|
||||||
createElement: pt,
|
|
||||||
dispatchEvent: bt,
|
|
||||||
el: pt,
|
|
||||||
empty: ht,
|
|
||||||
isSignal: N,
|
|
||||||
on: v,
|
|
||||||
registerReactivity: j,
|
|
||||||
scope: h
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
Vendored
+12
-339
@@ -1,343 +1,16 @@
|
|||||||
//deka-dom-el library is available via global namespace `dde`
|
//deka-dom-el library is available via global namespace `dde`
|
||||||
(()=> {
|
(()=> {
|
||||||
// src/signals-common.js
|
var v={isSignal(t){return!1},processReactiveAttribute(t,e,n,c){return n}};function F(t,e=!0){return e?Object.assign(v,t):(Object.setPrototypeOf(t,v),t)}function m(t){return v.isPrototypeOf(t)&&t!==v?t:v}function h(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:H};function H(t,e,n){if(Reflect.set(t,e,n),!!h(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 E=[{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 E[E.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[...E]},push(t={}){return t.namespace&&(t.namespace=S(t.namespace)),E.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return E.pop()}};function J(t,e,...n){let c=m(this),{namespace:r}=x,f=0,u;switch((Object(e)!==e||c.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{f=1,x.push({scope:t,host:a=>a?(f===1?n.unshift(a):a(u),void 0):u}),u=t(e||void 0),(u instanceof HTMLElement?M:W)(u,"Attribute","dde-fun",t.name);break}case t==="#text":u=w.call(this,document.createTextNode(""),e);break;case t==="<>":u=w.call(this,document.createDocumentFragment(),e);break;case r!=="html":u=w.call(this,document.createElementNS(r,t),e);break;case!u:u=w.call(this,document.createElement(t),e)}return n.forEach(a=>a(u)),f&&x.pop(),f=2,u}var{setDeleteAttr:L}=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),f=this;n=r.processReactiveAttribute(t,e,n,(a,p)=>N.call(f,t,a,p));let[u]=e;if(u==="=")return c(e.slice(1),n);if(u===".")return D(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 L(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return y(r,n,D.bind(null,t[e]));case"ariaset":return y(r,n,(a,p)=>c("aria-"+a,p));case"classList":return U.call(f,t,n)}return q(t,e)?L(t,e,n):c(e,n)}function P(t,e){if(A.has(t))return A.get(t);let c=(t instanceof SVGElement?W:M).bind(null,t,"Attribute"),r=m(e);return{setRemoveAttr:c,s:r}}function U(t,e){let n=m(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 q(t,e){if(!Reflect.has(t,e))return!1;let n=j(t,e);return!h(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,f]){r&&(f=t.processReactiveAttribute(e,r,f,n),n(r,f))})}function T(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function M(t,e,n,c){return t[(h(c)?"remove":"set")+e](n,T(c))}function W(t,e,n,c,r=null){return t[(h(c)?"remove":"set")+e+"NS"](r,n,T(c))}function D(t,e,n){if(Reflect.set(t,e,n),!!h(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=B(),z=new WeakSet;C.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let f="dde:"+n;return r.addEventListener(f,t,e),r.__dde_lifecycleToEvents?r:r.isConnected?(r.dispatchEvent(new Event(f)),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 f="dde:"+n;return r.addEventListener(f,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 f="dde:"+n;if(r.addEventListener(f,t,e),r.__dde_lifecycleToEvents||z.has(r))return r;let u=new MutationObserver(function(p){for(let{attributeName:l,target:g}of p)g.dispatchEvent(new CustomEvent(f,{detail:[l,g.getAttribute(l)]}))});return _(e.signal,()=>u.disconnect())&&u.observe(r,{attributes:!0}),r}};function B(){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)){u();coLine truncated
|
||||||
var v = {
|
globalThis.dde= {assign: w,
|
||||||
isSignal(t) {
|
assignAttribute: N,
|
||||||
return !1;
|
classListDeclarative: U,
|
||||||
},
|
createElement: J,
|
||||||
processReactiveAttribute(t, e, n, c) {
|
dispatchEvent: k,
|
||||||
return n;
|
el: J,
|
||||||
}
|
empty: Q,
|
||||||
};
|
on: C,
|
||||||
function F(t, e = !0) {
|
registerReactivity: F,
|
||||||
return e ? Object.assign(v, t) : (Object.setPrototypeOf(t, v), t);
|
scope: x
|
||||||
}
|
};
|
||||||
function m(t) {
|
|
||||||
return v.isPrototypeOf(t) && t !== v ? t : v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/helpers.js
|
|
||||||
function h(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);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom-common.js
|
|
||||||
var R = { setDeleteAttr: H };
|
|
||||||
function H(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!h(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, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom.js
|
|
||||||
var E = [{
|
|
||||||
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 E[E.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 [...E];
|
|
||||||
},
|
|
||||||
push(t = {}) {
|
|
||||||
return t.namespace && (t.namespace = S(t.namespace)), E.push(Object.assign({}, this.current, { prevent: !1 }, t));
|
|
||||||
},
|
|
||||||
pop() {
|
|
||||||
return E.pop();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function J(t, e, ...n) {
|
|
||||||
let c = m(this), { namespace: r } = x, f = 0, u;
|
|
||||||
switch ((Object(e) !== e || c.isSignal(e)) && (e = { textContent: e }), !0) {
|
|
||||||
case typeof t == "function": {
|
|
||||||
f = 1, x.push({ scope: t, host: (a) => a ? (f === 1 ? n.unshift(a) : a(u), void 0) : u }), u = t(e || void 0), (u instanceof HTMLElement ? M : W)(u, "Attribute", "dde-fun", t.name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case t === "#text":
|
|
||||||
u = w.call(this, document.createTextNode(""), e);
|
|
||||||
break;
|
|
||||||
case t === "<>":
|
|
||||||
u = w.call(this, document.createDocumentFragment(), e);
|
|
||||||
break;
|
|
||||||
case r !== "html":
|
|
||||||
u = w.call(this, document.createElementNS(r, t), e);
|
|
||||||
break;
|
|
||||||
case !u:
|
|
||||||
u = w.call(this, document.createElement(t), e);
|
|
||||||
}
|
|
||||||
return n.forEach((a) => a(u)), f && x.pop(), f = 2, u;
|
|
||||||
}
|
|
||||||
var { setDeleteAttr: L } = R, A = /* @__PURE__ */ 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), f = this;
|
|
||||||
n = r.processReactiveAttribute(
|
|
||||||
t,
|
|
||||||
e,
|
|
||||||
n,
|
|
||||||
(a, p) => N.call(f, t, a, p)
|
|
||||||
);
|
|
||||||
let [u] = e;
|
|
||||||
if (u === "=")
|
|
||||||
return c(e.slice(1), n);
|
|
||||||
if (u === ".")
|
|
||||||
return D(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 L(t, e, n);
|
|
||||||
case "style":
|
|
||||||
if (typeof n != "object")
|
|
||||||
break;
|
|
||||||
case "dataset":
|
|
||||||
return y(r, n, D.bind(null, t[e]));
|
|
||||||
case "ariaset":
|
|
||||||
return y(r, n, (a, p) => c("aria-" + a, p));
|
|
||||||
case "classList":
|
|
||||||
return U.call(f, t, n);
|
|
||||||
}
|
|
||||||
return q(t, e) ? L(t, e, n) : c(e, n);
|
|
||||||
}
|
|
||||||
function P(t, e) {
|
|
||||||
if (A.has(t))
|
|
||||||
return A.get(t);
|
|
||||||
let c = (t instanceof SVGElement ? W : M).bind(null, t, "Attribute"), r = m(e);
|
|
||||||
return { setRemoveAttr: c, s: r };
|
|
||||||
}
|
|
||||||
function U(t, e) {
|
|
||||||
let n = m(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 q(t, e) {
|
|
||||||
if (!Reflect.has(t, e))
|
|
||||||
return !1;
|
|
||||||
let n = j(t, e);
|
|
||||||
return !h(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, f]) {
|
|
||||||
r && (f = t.processReactiveAttribute(e, r, f, n), n(r, f));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function T(t) {
|
|
||||||
return Array.isArray(t) ? t.filter(Boolean).join(" ") : t;
|
|
||||||
}
|
|
||||||
function M(t, e, n, c) {
|
|
||||||
return t[(h(c) ? "remove" : "set") + e](n, T(c));
|
|
||||||
}
|
|
||||||
function W(t, e, n, c, r = null) {
|
|
||||||
return t[(h(c) ? "remove" : "set") + e + "NS"](r, n, T(c));
|
|
||||||
}
|
|
||||||
function D(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!h(n))
|
|
||||||
return Reflect.deleteProperty(t, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/events.js
|
|
||||||
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 = B(), z = /* @__PURE__ */ new WeakSet();
|
|
||||||
C.connected = function(t, e) {
|
|
||||||
let n = "connected";
|
|
||||||
return typeof e != "object" && (e = {}), e.once = !0, function(r) {
|
|
||||||
let f = "dde:" + n;
|
|
||||||
return r.addEventListener(f, t, e), r.__dde_lifecycleToEvents ? r : r.isConnected ? (r.dispatchEvent(new Event(f)), 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 f = "dde:" + n;
|
|
||||||
return r.addEventListener(f, 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 f = "dde:" + n;
|
|
||||||
if (r.addEventListener(f, t, e), r.__dde_lifecycleToEvents || z.has(r))
|
|
||||||
return r;
|
|
||||||
let u = new MutationObserver(function(p) {
|
|
||||||
for (let { attributeName: l, target: g } of p)
|
|
||||||
g.dispatchEvent(
|
|
||||||
new CustomEvent(f, { detail: [l, g.getAttribute(l)] })
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return _(e.signal, () => u.disconnect()) && u.observe(r, { attributes: !0 }), r;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
function B() {
|
|
||||||
let t = /* @__PURE__ */ new Map(), e = !1, n = new MutationObserver(function(o) {
|
|
||||||
for (let s of o)
|
|
||||||
if (s.type === "childList") {
|
|
||||||
if (l(s.addedNodes, !0)) {
|
|
||||||
u();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
g(s.removedNodes, !0) && u();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
onConnected(o, s) {
|
|
||||||
f();
|
|
||||||
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) {
|
|
||||||
f();
|
|
||||||
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), u());
|
|
||||||
}
|
|
||||||
function r(o) {
|
|
||||||
if (t.has(o))
|
|
||||||
return t.get(o);
|
|
||||||
let s = {
|
|
||||||
connected: /* @__PURE__ */ new WeakSet(),
|
|
||||||
length_c: 0,
|
|
||||||
disconnected: /* @__PURE__ */ new WeakSet(),
|
|
||||||
length_d: 0
|
|
||||||
};
|
|
||||||
return t.set(o, s), s;
|
|
||||||
}
|
|
||||||
function f() {
|
|
||||||
e || (e = !0, n.observe(document.body, { childList: !0, subtree: !0 }));
|
|
||||||
}
|
|
||||||
function u() {
|
|
||||||
!e || t.size || (e = !1, n.disconnect());
|
|
||||||
}
|
|
||||||
function a() {
|
|
||||||
return new Promise(function(o) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(o);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function p(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 d of o) {
|
|
||||||
if (s && p(d).then(l), !t.has(d))
|
|
||||||
continue;
|
|
||||||
let b = t.get(d);
|
|
||||||
b.length_c && (d.dispatchEvent(new Event("dde:connected")), b.connected = /* @__PURE__ */ new WeakSet(), b.length_c = 0, b.length_d || t.delete(d), i = !0);
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
function g(o, s) {
|
|
||||||
let i = !1;
|
|
||||||
for (let d of o)
|
|
||||||
s && p(d).then(g), !(!t.has(d) || !t.get(d).length_d) && (d.dispatchEvent(new Event("dde:disconnected")), t.delete(d), i = !0);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// index.js
|
|
||||||
[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: U,
|
|
||||||
createElement: J,
|
|
||||||
dispatchEvent: k,
|
|
||||||
el: J,
|
|
||||||
empty: Q,
|
|
||||||
on: C,
|
|
||||||
registerReactivity: F,
|
|
||||||
scope: x
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
Vendored
+248
@@ -0,0 +1,248 @@
|
|||||||
|
declare global {
|
||||||
|
type ddeComponentAttributes= Record<any, any> | undefined | string;
|
||||||
|
type ddeElementExtender<El extends Element>= (element: El)=> El;
|
||||||
|
}
|
||||||
|
type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & {
|
||||||
|
'#text': Text
|
||||||
|
}
|
||||||
|
type Element= ElementTagNameMap[keyof ElementTagNameMap];
|
||||||
|
type AttrsModified= {
|
||||||
|
/**
|
||||||
|
* In fact argumen for `*.setAttribute("style", *)`.
|
||||||
|
*/
|
||||||
|
style: string
|
||||||
|
/**
|
||||||
|
* 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<string,-1|0|1>,
|
||||||
|
/**
|
||||||
|
* By default simiral to `className`, but also supports `string[]`
|
||||||
|
* */
|
||||||
|
className: string | (string|boolean|undefined)[];
|
||||||
|
/**
|
||||||
|
* Sets `aria-*` simiraly to `dataset`
|
||||||
|
* */
|
||||||
|
ariaset: Record<string,string>,
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Just element attributtes
|
||||||
|
*
|
||||||
|
* In most cases, you can use native propertie such as [MDN WEB/API/Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) and so on (e.g. [`Text`](https://developer.mozilla.org/en-US/docs/Web/API/Text)).
|
||||||
|
*
|
||||||
|
* There is added support for `data[A-Z].*`/`aria[A-Z].*` to be converted to the kebab-case alternatives.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
type ElementAttributes<T extends keyof ElementTagNameMap | ElementTagNameMap[keyof ElementTagNameMap]>=
|
||||||
|
T extends keyof ElementTagNameMap ?
|
||||||
|
Omit<ElementTagNameMap[T],"classList"|"className"> & AttrsModified :
|
||||||
|
Omit<T,"classList"|"className"> & AttrsModified;
|
||||||
|
export function assign<El extends Element>(element: El, ...attrs_array: Partial<ElementAttributes<El>>[]): El
|
||||||
|
type TagNameFragment= "<>";
|
||||||
|
export function el<TAG extends keyof ElementTagNameMap>(
|
||||||
|
tag_name: TAG,
|
||||||
|
attrs?: Partial<ElementAttributes<ElementTagNameMap[TAG]>>,
|
||||||
|
...extenders: ddeElementExtender<ElementTagNameMap[TAG]>[]
|
||||||
|
): ElementTagNameMap[TAG]
|
||||||
|
export function el<T>(
|
||||||
|
tag_name: TagNameFragment,
|
||||||
|
): DocumentFragment
|
||||||
|
export function el<
|
||||||
|
A extends ddeComponentAttributes,
|
||||||
|
C extends (attr: A)=> Element>(
|
||||||
|
fComponent: C,
|
||||||
|
attrs?: A,
|
||||||
|
...extenders: ddeElementExtender<ReturnType<C>>[]
|
||||||
|
): ReturnType<C>
|
||||||
|
export function dispatchEvent(element: HTMLElement, name: keyof DocumentEventMap): void;
|
||||||
|
export function dispatchEvent(element: HTMLElement, name: string, data: any): void;
|
||||||
|
interface On{
|
||||||
|
<
|
||||||
|
EE extends ddeElementExtender<Element>,
|
||||||
|
El extends ( EE extends ddeElementExtender<infer El> ? El : never ),
|
||||||
|
Event extends keyof DocumentEventMap>(
|
||||||
|
type: Event,
|
||||||
|
listener: (this: El, ev: DocumentEventMap[Event]) => any,
|
||||||
|
options?: AddEventListenerOptions
|
||||||
|
) : EE;
|
||||||
|
connected<
|
||||||
|
EE extends ddeElementExtender<Element>,
|
||||||
|
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
|
||||||
|
>(
|
||||||
|
listener: (el: El) => any,
|
||||||
|
options?: AddEventListenerOptions
|
||||||
|
) : EE;
|
||||||
|
disconnected<
|
||||||
|
EE extends ddeElementExtender<Element>,
|
||||||
|
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
|
||||||
|
>(
|
||||||
|
listener: (el: El) => any,
|
||||||
|
options?: AddEventListenerOptions
|
||||||
|
) : EE;
|
||||||
|
}
|
||||||
|
export const on: On;
|
||||||
|
//TODO for SVG
|
||||||
|
declare global{
|
||||||
|
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
|
||||||
|
interface HTMLAnchorElement{ append(...nodes: (Node | string)[]): HTMLAnchorElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLAreaElement{ append(...nodes: (Node | string)[]): HTMLAreaElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLAudioElement{ append(...nodes: (Node | string)[]): HTMLAudioElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLBaseElement{ append(...nodes: (Node | string)[]): HTMLBaseElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
|
||||||
|
interface HTMLBodyElement{ append(...nodes: (Node | string)[]): HTMLBodyElement; }
|
||||||
|
interface HTMLBRElement{ append(...nodes: (Node | string)[]): HTMLBRElement; }
|
||||||
|
interface HTMLButtonElement{ append(...nodes: (Node | string)[]): HTMLButtonElement; }
|
||||||
|
interface HTMLCanvasElement{ append(...nodes: (Node | string)[]): HTMLCanvasElement; }
|
||||||
|
interface HTMLTableCaptionElement{ append(...nodes: (Node | string)[]): HTMLTableCaptionElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
|
||||||
|
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
|
||||||
|
interface HTMLDataElement{ append(...nodes: (Node | string)[]): HTMLDataElement; }
|
||||||
|
interface HTMLDataListElement{ append(...nodes: (Node | string)[]): HTMLDataListElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
|
||||||
|
interface HTMLDetailsElement{ append(...nodes: (Node | string)[]): HTMLDetailsElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLDialogElement{ append(...nodes: (Node | string)[]): HTMLDialogElement; }
|
||||||
|
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
|
||||||
|
interface HTMLDListElement{ append(...nodes: (Node | string)[]): HTMLDListElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLEmbedElement{ append(...nodes: (Node | string)[]): HTMLEmbedElement; }
|
||||||
|
interface HTMLFieldSetElement{ append(...nodes: (Node | string)[]): HTMLFieldSetElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLFormElement{ append(...nodes: (Node | string)[]): HTMLFormElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadElement{ append(...nodes: (Node | string)[]): HTMLHeadElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLHRElement{ append(...nodes: (Node | string)[]): HTMLHRElement; }
|
||||||
|
interface HTMLHtmlElement{ append(...nodes: (Node | string)[]): HTMLHtmlElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLIFrameElement{ append(...nodes: (Node | string)[]): HTMLIFrameElement; }
|
||||||
|
interface HTMLImageElement{ append(...nodes: (Node | string)[]): HTMLImageElement; }
|
||||||
|
interface HTMLInputElement{ append(...nodes: (Node | string)[]): HTMLInputElement; }
|
||||||
|
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLLabelElement{ append(...nodes: (Node | string)[]): HTMLLabelElement; }
|
||||||
|
interface HTMLLegendElement{ append(...nodes: (Node | string)[]): HTMLLegendElement; }
|
||||||
|
interface HTMLLIElement{ append(...nodes: (Node | string)[]): HTMLLIElement; }
|
||||||
|
interface HTMLLinkElement{ append(...nodes: (Node | string)[]): HTMLLinkElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLMapElement{ append(...nodes: (Node | string)[]): HTMLMapElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLMenuElement{ append(...nodes: (Node | string)[]): HTMLMenuElement; }
|
||||||
|
interface HTMLMetaElement{ append(...nodes: (Node | string)[]): HTMLMetaElement; }
|
||||||
|
interface HTMLMeterElement{ append(...nodes: (Node | string)[]): HTMLMeterElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLObjectElement{ append(...nodes: (Node | string)[]): HTMLObjectElement; }
|
||||||
|
interface HTMLOListElement{ append(...nodes: (Node | string)[]): HTMLOListElement; }
|
||||||
|
interface HTMLOptGroupElement{ append(...nodes: (Node | string)[]): HTMLOptGroupElement; }
|
||||||
|
interface HTMLOptionElement{ append(...nodes: (Node | string)[]): HTMLOptionElement; }
|
||||||
|
interface HTMLOutputElement{ append(...nodes: (Node | string)[]): HTMLOutputElement; }
|
||||||
|
interface HTMLParagraphElement{ append(...nodes: (Node | string)[]): HTMLParagraphElement; }
|
||||||
|
interface HTMLPictureElement{ append(...nodes: (Node | string)[]): HTMLPictureElement; }
|
||||||
|
interface HTMLPreElement{ append(...nodes: (Node | string)[]): HTMLPreElement; }
|
||||||
|
interface HTMLProgressElement{ append(...nodes: (Node | string)[]): HTMLProgressElement; }
|
||||||
|
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLScriptElement{ append(...nodes: (Node | string)[]): HTMLScriptElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLSelectElement{ append(...nodes: (Node | string)[]): HTMLSelectElement; }
|
||||||
|
interface HTMLSlotElement{ append(...nodes: (Node | string)[]): HTMLSlotElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLSourceElement{ append(...nodes: (Node | string)[]): HTMLSourceElement; }
|
||||||
|
interface HTMLSpanElement{ append(...nodes: (Node | string)[]): HTMLSpanElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLStyleElement{ append(...nodes: (Node | string)[]): HTMLStyleElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLTableElement{ append(...nodes: (Node | string)[]): HTMLTableElement; }
|
||||||
|
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
|
||||||
|
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
|
||||||
|
interface HTMLTemplateElement{ append(...nodes: (Node | string)[]): HTMLTemplateElement; }
|
||||||
|
interface HTMLTextAreaElement{ append(...nodes: (Node | string)[]): HTMLTextAreaElement; }
|
||||||
|
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
|
||||||
|
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
|
||||||
|
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
|
||||||
|
interface HTMLTimeElement{ append(...nodes: (Node | string)[]): HTMLTimeElement; }
|
||||||
|
interface HTMLTitleElement{ append(...nodes: (Node | string)[]): HTMLTitleElement; }
|
||||||
|
interface HTMLTableRowElement{ append(...nodes: (Node | string)[]): HTMLTableRowElement; }
|
||||||
|
interface HTMLTrackElement{ append(...nodes: (Node | string)[]): HTMLTrackElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLUListElement{ append(...nodes: (Node | string)[]): HTMLUListElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLVideoElement{ append(...nodes: (Node | string)[]): HTMLVideoElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface DocumentFragment{ append(...nodes: (Node | string)[]): DocumentFragment; }
|
||||||
|
}
|
||||||
|
export type Signal<V, A>= (set?: V)=> V & A;
|
||||||
|
type Action<V>= (this: { value: V }, ...a: any[])=> typeof S._ | void;
|
||||||
|
type SymbolOnclear= Symbol;
|
||||||
|
type SymbolSignal= Symbol;
|
||||||
|
type Actions<V>= Record<string, Action<V>>;
|
||||||
|
interface S {
|
||||||
|
_: Symbol
|
||||||
|
/**
|
||||||
|
* Simple example:
|
||||||
|
* ```js
|
||||||
|
* const hello= S("Hello Signal");
|
||||||
|
* ```
|
||||||
|
* …simple todo signal:
|
||||||
|
* ```js
|
||||||
|
* const todos= S([], {
|
||||||
|
* add(v){ this.value.push(S(v)); },
|
||||||
|
* remove(i){ this.value.splice(i, 1); },
|
||||||
|
* [S.symbols.onclear](){ S.clear(...this.value); },
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
|
* …computed signal:
|
||||||
|
* ```js
|
||||||
|
* const name= S("Jan");
|
||||||
|
* const surname= S("Andrle");
|
||||||
|
* const fullname= S(()=> name()+" "+surname());
|
||||||
|
* ```
|
||||||
|
* @param value Initial signal value. Or function computing value from other signals.
|
||||||
|
* @param actions Use to define actions on the signal. Such as add item to the array.
|
||||||
|
* There is also a reserved function `S.symbol.onclear` which is called when the signal is cleared
|
||||||
|
* by `S.clear`.
|
||||||
|
* */
|
||||||
|
<V, A extends Actions<V>>(value: V, actions?: A): Signal<V, A>;
|
||||||
|
action<S extends Signal<any, Actions<any>>, A extends (S extends Signal<any, infer A> ? A : never), N extends keyof A>(
|
||||||
|
signal: S,
|
||||||
|
name: N,
|
||||||
|
...params: A[N] extends (...args: infer P)=> any ? P : never
|
||||||
|
): void;
|
||||||
|
clear(...signals: Signal<any, any>[]): void;
|
||||||
|
on<T>(signal: Signal<T, any>, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
|
||||||
|
symbols: {
|
||||||
|
signal: SymbolSignal;
|
||||||
|
onclear: SymbolOnclear;
|
||||||
|
}
|
||||||
|
el<S extends any, T extends HTMLElement>(signal: Signal<S, any>, el: (v: S)=> T): T;
|
||||||
|
}
|
||||||
|
export const S: S;
|
||||||
|
declare global {
|
||||||
|
type ddeSignal<T, A= {}>= Signal<T, A>;
|
||||||
|
type ddeActions<V>= Actions<V>
|
||||||
|
}
|
||||||
Vendored
+4
-525
@@ -1,525 +1,4 @@
|
|||||||
// src/signals-common.js
|
var w={isSignal(t){return!1},processReactiveAttribute(t,e,n,r){return n}};function T(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 E(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 z={setDeleteAttr:X};function X(t,e,n){if(Reflect.set(t,e,n),!!E(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}],H=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=H(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=H(t.namespace)),y.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return y.pop()}};function lt(t,e,...n){let r=O(this),{namespace:o}=b,c=0,s;switch((Object(e)!==e||r.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{c=1,b.push({scope:t,host:a=>a?(c===1?n.unshift(a):a(s),void 0):s}),s=t(e||void 0),(s instanceof HTMLElement?J:V)(s,"Attribute","dde-fun",t.name);break}case t==="#text":s=C.call(this,document.createTextNode(""),e);break;case 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 n.forEach(a=>a(s)),c&&b.pop(),c=2,s}var{setDeleteAttr:U}=z,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,(a,d)=>q.call(c,t,a,d));let[s]=e;if(s==="=")return r(e.slice(1),n);if(s===".")return $(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 U(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return M(o,n,$.bind(null,t[e]));case"ariaset":return M(o,n,(a,d)=>r("aria-"+a,d));case"classList":return Y.call(c,t,n)}return tt(t,e)?U(t,e,n):r(e,n)}function B(t,e){if(L.has(t))return L.get(t);let r=(t instanceof SVGElement?V:J).bind(null,t,"Attribute"),o=O(e);return{setRemoveAttr:r,s:o}}function Y(t,e){let n=O(this);return M(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 tt(t,e){if(!Reflect.has(t,e))return!1;let n=G(t,e);return!E(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 M(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 J(t,e,n,r){return t[(E(r)?"remove":"set")+e](n,I(r))}function V(t,e,n,r,o=null){return t[(E(r)?"remove":"set")+e+"NS"](o,n,I(r))}function $(t,e,n){if(Reflect.set(t,e,n),!!E(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(d){for(let{attributeName:m,target:_}of d)_.dispatchEvent(new CustomEvent(c,{detail:[m,_.getAttribute(m)]}))});return R(e.signal,()=>s.disconnect())&&s.observe(o,{attributes:!0}),o}};function nt(){let t=new MapLine truncated
|
||||||
var w = {
|
* Investigate `__dde_attributes` key of the element.*/let[s,a]=c,d=r[S][s];d&&d(a)})(r),v.disconnected(function(){/*! This removes all signals mapped to attributes (`S.attribute`).
|
||||||
isSignal(t) {
|
* Investigate `__dde_attributes` key of the element.*/h.clear(...Object.values(r[S]))})(r),r}),n};h.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),!l.has(o))return;let c=l.get(o);c.delete(n),!(c.size>1)&&(h.clear(...c),l.delete(o))})}};var P="__dde_reactive";h.el=function(t,e){let n=document.createComment("<dde:reactive>"),r=document.createComment("</dde:reactive>"),o=document.createDocumentFragment();o.append(n,r);let{current:c}=b,s=a=>{if(!n.parentNode||!r.parentNode)return A(t,s);b.push(c);let d=e(a);b.pop(),Array.isArray(d)||(d=[d]);let m=n;for(;(m=n.nextSibling)!==r;)m.remove();n.after(...d)};return k(t,s),Q(t,s,n,e),s(t()),o};var K={isSignal:j,processReactiveAttribute(t,e,n,r){if(!j(n))return n;let o=c=>r(e,c);return k(n,o),Q(n,o,t,e),n()}};function Q(t,e,...n){let{current:r}=b;r.prevent||r.host(function(o){o[P]||(o[P]=[],v.disconnected(()=>o[P].forEach(([[c,s]])=>A(c,s,c[p]?.host()===o)))(o)),o[P].push([[t,e],...n])})}function Z(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}}),W=class extends Error{constructor(){super();let[e,...n]=this.stack.split(`
|
||||||
return !1;
|
`),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}=h.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 W},enumerable:!1,writable:!1,configurable:!0}),t.toJSON=()=>t(),Object.setPrototypeOf(t[p],rt),t}function ct(){return D[D.length-1]}function st(t){if(!t[p])return;let{value:e,listeners:n}=t[p],r=ct();return r&&n.add(r),l.has(r)&&l.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 k(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(h.clear(t),!l.has(r))return o;let c=l.get(r);if(!l.has(c))return o;l.get(c).forEach(s=>A(s,c,!0))}return o}T(K);export{h as S,C as assign,q as assignAttribute,Y as classListDeclarative,lt as createElement,Et as dispatchEvent,lt as el,gt as empty,j as isSignal,v as on,T as registerReactivity,b as scope};
|
||||||
},
|
|
||||||
processReactiveAttribute(t, e, n, o) {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function j(t, e = !0) {
|
|
||||||
return e ? Object.assign(w, t) : (Object.setPrototypeOf(t, w), t);
|
|
||||||
}
|
|
||||||
function A(t) {
|
|
||||||
return w.isPrototypeOf(t) && t !== w ? t : w;
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/helpers.js
|
|
||||||
function E(t) {
|
|
||||||
return typeof t > "u";
|
|
||||||
}
|
|
||||||
function k(t) {
|
|
||||||
let e = typeof t;
|
|
||||||
return e !== "object" ? e : t === null ? "null" : Object.prototype.toString.call(t);
|
|
||||||
}
|
|
||||||
function O(t, e) {
|
|
||||||
if (!t || !(t instanceof AbortSignal))
|
|
||||||
return !0;
|
|
||||||
if (!t.aborted)
|
|
||||||
return t.addEventListener("abort", e), function() {
|
|
||||||
t.removeEventListener("abort", e);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom-common.js
|
|
||||||
var F = { setDeleteAttr: Q };
|
|
||||||
function Q(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!E(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, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom.js
|
|
||||||
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, h = {
|
|
||||||
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 h.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 pt(t, e, ...n) {
|
|
||||||
let o = A(this), { namespace: r } = h, c = 0, s;
|
|
||||||
switch ((Object(e) !== e || o.isSignal(e)) && (e = { textContent: e }), !0) {
|
|
||||||
case typeof t == "function": {
|
|
||||||
c = 1, h.push({ scope: t, host: (a) => a ? (c === 1 ? n.unshift(a) : a(s), void 0) : s }), s = t(e || void 0), (s instanceof HTMLElement ? I : J)(s, "Attribute", "dde-fun", t.name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case t === "#text":
|
|
||||||
s = R.call(this, document.createTextNode(""), e);
|
|
||||||
break;
|
|
||||||
case t === "<>":
|
|
||||||
s = R.call(this, document.createDocumentFragment(), e);
|
|
||||||
break;
|
|
||||||
case r !== "html":
|
|
||||||
s = R.call(this, document.createElementNS(r, t), e);
|
|
||||||
break;
|
|
||||||
case !s:
|
|
||||||
s = R.call(this, document.createElement(t), e);
|
|
||||||
}
|
|
||||||
return n.forEach((a) => a(s)), c && h.pop(), c = 2, s;
|
|
||||||
}
|
|
||||||
var { setDeleteAttr: H } = F, C = /* @__PURE__ */ new WeakMap();
|
|
||||||
function R(t, ...e) {
|
|
||||||
if (!e.length)
|
|
||||||
return t;
|
|
||||||
C.set(t, q(t, this));
|
|
||||||
for (let [n, o] of Object.entries(Object.assign({}, ...e)))
|
|
||||||
$.call(this, t, n, o);
|
|
||||||
return C.delete(t), t;
|
|
||||||
}
|
|
||||||
function $(t, e, n) {
|
|
||||||
let { setRemoveAttr: o, s: r } = q(t, this), c = this;
|
|
||||||
n = r.processReactiveAttribute(
|
|
||||||
t,
|
|
||||||
e,
|
|
||||||
n,
|
|
||||||
(a, p) => $.call(c, t, a, p)
|
|
||||||
);
|
|
||||||
let [s] = e;
|
|
||||||
if (s === "=")
|
|
||||||
return o(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(), o(e, n);
|
|
||||||
switch (e === "className" && (e = "class"), e) {
|
|
||||||
case "xlink:href":
|
|
||||||
return o(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(r, n, U.bind(null, t[e]));
|
|
||||||
case "ariaset":
|
|
||||||
return T(r, n, (a, p) => o("aria-" + a, p));
|
|
||||||
case "classList":
|
|
||||||
return X.call(c, t, n);
|
|
||||||
}
|
|
||||||
return Y(t, e) ? H(t, e, n) : o(e, n);
|
|
||||||
}
|
|
||||||
function q(t, e) {
|
|
||||||
if (C.has(t))
|
|
||||||
return C.get(t);
|
|
||||||
let o = (t instanceof SVGElement ? J : I).bind(null, t, "Attribute"), r = A(e);
|
|
||||||
return { setRemoveAttr: o, s: r };
|
|
||||||
}
|
|
||||||
function X(t, e) {
|
|
||||||
let n = A(this);
|
|
||||||
return T(
|
|
||||||
n,
|
|
||||||
e,
|
|
||||||
(o, r) => t.classList.toggle(o, r === -1 ? void 0 : !!r)
|
|
||||||
), t;
|
|
||||||
}
|
|
||||||
function ht(t) {
|
|
||||||
return Array.from(t.children).forEach((e) => e.remove()), t;
|
|
||||||
}
|
|
||||||
function Y(t, e) {
|
|
||||||
if (!Reflect.has(t, e))
|
|
||||||
return !1;
|
|
||||||
let n = B(t, e);
|
|
||||||
return !E(n.set);
|
|
||||||
}
|
|
||||||
function B(t, e) {
|
|
||||||
if (t = Object.getPrototypeOf(t), !t)
|
|
||||||
return {};
|
|
||||||
let n = Object.getOwnPropertyDescriptor(t, e);
|
|
||||||
return n || B(t, e);
|
|
||||||
}
|
|
||||||
function T(t, e, n) {
|
|
||||||
if (!(typeof e != "object" || e === null))
|
|
||||||
return Object.entries(e).forEach(function([r, c]) {
|
|
||||||
r && (c = t.processReactiveAttribute(e, r, c, n), n(r, c));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function G(t) {
|
|
||||||
return Array.isArray(t) ? t.filter(Boolean).join(" ") : t;
|
|
||||||
}
|
|
||||||
function I(t, e, n, o) {
|
|
||||||
return t[(E(o) ? "remove" : "set") + e](n, G(o));
|
|
||||||
}
|
|
||||||
function J(t, e, n, o, r = null) {
|
|
||||||
return t[(E(o) ? "remove" : "set") + e + "NS"](r, n, G(o));
|
|
||||||
}
|
|
||||||
function U(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!E(n))
|
|
||||||
return Reflect.deleteProperty(t, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/events.js
|
|
||||||
function bt(t, e, ...n) {
|
|
||||||
let o = n.length ? new CustomEvent(e, { detail: n[0] }) : new Event(e);
|
|
||||||
return t.dispatchEvent(o);
|
|
||||||
}
|
|
||||||
function v(t, e, n) {
|
|
||||||
return function(r) {
|
|
||||||
return r.addEventListener(t, e, n), r;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
var L = et(), tt = /* @__PURE__ */ new WeakSet();
|
|
||||||
v.connected = function(t, e) {
|
|
||||||
let n = "connected";
|
|
||||||
return typeof e != "object" && (e = {}), e.once = !0, function(r) {
|
|
||||||
let c = "dde:" + n;
|
|
||||||
return r.addEventListener(c, t, e), r.__dde_lifecycleToEvents ? r : r.isConnected ? (r.dispatchEvent(new Event(c)), r) : (O(e.signal, () => L.offConnected(r, t)) && L.onConnected(r, t), r);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
v.disconnected = function(t, e) {
|
|
||||||
let n = "disconnected";
|
|
||||||
return typeof e != "object" && (e = {}), e.once = !0, function(r) {
|
|
||||||
let c = "dde:" + n;
|
|
||||||
return r.addEventListener(c, t, e), r.__dde_lifecycleToEvents || O(e.signal, () => L.offDisconnected(r, t)) && L.onDisconnected(r, t), r;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
v.attributeChanged = function(t, e) {
|
|
||||||
let n = "attributeChanged";
|
|
||||||
return typeof e != "object" && (e = {}), function(r) {
|
|
||||||
let c = "dde:" + n;
|
|
||||||
if (r.addEventListener(c, t, e), r.__dde_lifecycleToEvents || tt.has(r))
|
|
||||||
return r;
|
|
||||||
let s = new MutationObserver(function(p) {
|
|
||||||
for (let { attributeName: b, target: _ } of p)
|
|
||||||
_.dispatchEvent(
|
|
||||||
new CustomEvent(c, { detail: [b, _.getAttribute(b)] })
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return O(e.signal, () => s.disconnect()) && s.observe(r, { attributes: !0 }), r;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
function et() {
|
|
||||||
let t = /* @__PURE__ */ new Map(), e = !1, n = new MutationObserver(function(i) {
|
|
||||||
for (let u of i)
|
|
||||||
if (u.type === "childList") {
|
|
||||||
if (b(u.addedNodes, !0)) {
|
|
||||||
s();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
_(u.removedNodes, !0) && s();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
onConnected(i, u) {
|
|
||||||
c();
|
|
||||||
let f = r(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, o(i, f));
|
|
||||||
},
|
|
||||||
onDisconnected(i, u) {
|
|
||||||
c();
|
|
||||||
let f = r(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, o(i, f));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function o(i, u) {
|
|
||||||
u.length_c || u.length_d || (t.delete(i), s());
|
|
||||||
}
|
|
||||||
function r(i) {
|
|
||||||
if (t.has(i))
|
|
||||||
return t.get(i);
|
|
||||||
let u = {
|
|
||||||
connected: /* @__PURE__ */ new WeakSet(),
|
|
||||||
length_c: 0,
|
|
||||||
disconnected: /* @__PURE__ */ 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 a() {
|
|
||||||
return new Promise(function(i) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(i);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function p(i) {
|
|
||||||
t.size > 30 && await a();
|
|
||||||
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 b(i, u) {
|
|
||||||
let f = !1;
|
|
||||||
for (let m of i) {
|
|
||||||
if (u && p(m).then(b), !t.has(m))
|
|
||||||
continue;
|
|
||||||
let x = t.get(m);
|
|
||||||
x.length_c && (m.dispatchEvent(new Event("dde:connected")), x.connected = /* @__PURE__ */ new WeakSet(), x.length_c = 0, x.length_d || t.delete(m), f = !0);
|
|
||||||
}
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
function _(i, u) {
|
|
||||||
let f = !1;
|
|
||||||
for (let m of i)
|
|
||||||
u && p(m).then(_), !(!t.has(m) || !t.get(m).length_d) && (m.dispatchEvent(new Event("dde:disconnected")), t.delete(m), f = !0);
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// index.js
|
|
||||||
[HTMLElement, SVGElement, DocumentFragment].forEach((t) => {
|
|
||||||
let { append: e } = t.prototype;
|
|
||||||
t.prototype.append = function(...n) {
|
|
||||||
return e.apply(this, n), this;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// src/signals-lib.js
|
|
||||||
var d = Symbol.for("Signal");
|
|
||||||
function N(t) {
|
|
||||||
try {
|
|
||||||
return Reflect.has(t, d);
|
|
||||||
} catch {
|
|
||||||
return !1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var P = [], l = /* @__PURE__ */ new WeakMap();
|
|
||||||
function g(t, e) {
|
|
||||||
if (typeof t != "function")
|
|
||||||
return V(t, e);
|
|
||||||
if (N(t))
|
|
||||||
return t;
|
|
||||||
let n = V(), o = function() {
|
|
||||||
let [r, ...c] = l.get(o);
|
|
||||||
if (l.set(o, /* @__PURE__ */ new Set([r])), P.push(o), n(t()), P.pop(), !c.length)
|
|
||||||
return;
|
|
||||||
let s = l.get(o);
|
|
||||||
for (let a of c)
|
|
||||||
s.has(a) || S(a, o);
|
|
||||||
};
|
|
||||||
return l.set(n[d], o), l.set(o, /* @__PURE__ */ new Set([n])), o(), n;
|
|
||||||
}
|
|
||||||
g.action = function(t, e, ...n) {
|
|
||||||
let o = t[d], { actions: r } = o;
|
|
||||||
if (!r || !Reflect.has(r, e))
|
|
||||||
throw new Error(`'${t}' has no action with name '${e}'!`);
|
|
||||||
if (r[e].apply(o, n), o.skip)
|
|
||||||
return Reflect.deleteProperty(o, "skip");
|
|
||||||
o.listeners.forEach((c) => c(o.value));
|
|
||||||
};
|
|
||||||
g.on = function t(e, n, o = {}) {
|
|
||||||
let { signal: r } = o;
|
|
||||||
if (!(r && r.aborted)) {
|
|
||||||
if (Array.isArray(e))
|
|
||||||
return e.forEach((c) => t(c, n, o));
|
|
||||||
W(e, n), r && r.addEventListener("abort", () => S(e, n));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
g.symbols = {
|
|
||||||
signal: d,
|
|
||||||
onclear: Symbol.for("Signal.onclear")
|
|
||||||
};
|
|
||||||
g.attribute = function(t, e = void 0) {
|
|
||||||
let { host: n } = h, o = n() && n().hasAttribute(t) ? n().getAttribute(t) : e, r = new AbortController(), c = g(o, {
|
|
||||||
[g.symbols.onclear]() {
|
|
||||||
r.abort();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return h.host(v.attributeChanged(function({ detail: a }) {
|
|
||||||
let [p, b] = a;
|
|
||||||
p === t && c(b);
|
|
||||||
}, { signal: r.signal })), c;
|
|
||||||
};
|
|
||||||
g.clear = function(...t) {
|
|
||||||
for (let n of t) {
|
|
||||||
Reflect.deleteProperty(n, "toJSON");
|
|
||||||
let o = n[d];
|
|
||||||
o.onclear.forEach((r) => r.call(o)), e(n, o), Reflect.deleteProperty(n, d);
|
|
||||||
}
|
|
||||||
function e(n, o) {
|
|
||||||
o.listeners.forEach((r) => {
|
|
||||||
if (o.listeners.delete(r), !l.has(r))
|
|
||||||
return;
|
|
||||||
let c = l.get(r);
|
|
||||||
c.delete(n), !(c.size > 1) && (g.clear(...c), l.delete(r));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var D = "__dde_reactive";
|
|
||||||
g.el = function(t, e) {
|
|
||||||
let n = document.createComment("<dde:reactive>"), o = document.createComment("</dde:reactive>"), r = document.createDocumentFragment();
|
|
||||||
r.append(n, o);
|
|
||||||
let { current: c } = h, s = (a) => {
|
|
||||||
if (!n.parentNode || !o.parentNode)
|
|
||||||
return S(t, s);
|
|
||||||
h.push(c);
|
|
||||||
let p = e(a);
|
|
||||||
h.pop(), Array.isArray(p) || (p = [p]);
|
|
||||||
let b = n;
|
|
||||||
for (; (b = n.nextSibling) !== o; )
|
|
||||||
b.remove();
|
|
||||||
n.after(...p);
|
|
||||||
};
|
|
||||||
return W(t, s), K(t, s, n, e), s(t()), r;
|
|
||||||
};
|
|
||||||
var Z = {
|
|
||||||
isSignal: N,
|
|
||||||
processReactiveAttribute(t, e, n, o) {
|
|
||||||
if (!N(n))
|
|
||||||
return n;
|
|
||||||
let r = (c) => o(e, c);
|
|
||||||
return W(n, r), K(n, r, t, e), n();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function K(t, e, ...n) {
|
|
||||||
let { current: o } = h;
|
|
||||||
o.prevent || o.host(function(r) {
|
|
||||||
r[D] || (r[D] = [], v.disconnected(
|
|
||||||
() => (
|
|
||||||
/*!
|
|
||||||
* Clears all signals listeners added in the current scope/host (`S.el`, `assign`, …?).
|
|
||||||
* You can investigate the `__dde_reactive` key of the element.
|
|
||||||
* */
|
|
||||||
r[D].forEach(([[c, s]]) => S(c, s, c[d]?.host() === r))
|
|
||||||
)
|
|
||||||
)(r)), r[D].push([[t, e], ...n]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function V(t, e) {
|
|
||||||
let n = (...o) => o.length ? st(n, ...o) : ct(n);
|
|
||||||
return rt(n, t, e);
|
|
||||||
}
|
|
||||||
var nt = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
||||||
stopPropagation() {
|
|
||||||
this.skip = !0;
|
|
||||||
}
|
|
||||||
}), M = class extends Error {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
let [e, ...n] = this.stack.split(`
|
|
||||||
`), o = e.slice(e.indexOf("@"), e.indexOf(".js:") + 4);
|
|
||||||
this.stack = n.find((r) => !r.includes(o));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function rt(t, e, n) {
|
|
||||||
let o = [];
|
|
||||||
k(n) !== "[object Object]" && (n = {});
|
|
||||||
let { onclear: r } = g.symbols;
|
|
||||||
n[r] && (o.push(n[r]), Reflect.deleteProperty(n, r));
|
|
||||||
let { host: c } = h;
|
|
||||||
return t[d] = {
|
|
||||||
value: e,
|
|
||||||
actions: n,
|
|
||||||
onclear: o,
|
|
||||||
host: c,
|
|
||||||
listeners: /* @__PURE__ */ new Set(),
|
|
||||||
defined: new M()
|
|
||||||
}, t.toJSON = () => t(), Object.setPrototypeOf(t[d], nt), t;
|
|
||||||
}
|
|
||||||
function ot() {
|
|
||||||
return P[P.length - 1];
|
|
||||||
}
|
|
||||||
function ct(t) {
|
|
||||||
if (!t[d])
|
|
||||||
return;
|
|
||||||
let { value: e, listeners: n } = t[d], o = ot();
|
|
||||||
return o && n.add(o), l.has(o) && l.get(o).add(t), e;
|
|
||||||
}
|
|
||||||
function st(t, e, n) {
|
|
||||||
if (!t[d])
|
|
||||||
return;
|
|
||||||
let o = t[d];
|
|
||||||
if (!(!n && o.value === e))
|
|
||||||
return o.value = e, o.listeners.forEach((r) => r(e)), e;
|
|
||||||
}
|
|
||||||
function W(t, e) {
|
|
||||||
if (t[d])
|
|
||||||
return t[d].listeners.add(e);
|
|
||||||
}
|
|
||||||
function S(t, e, n) {
|
|
||||||
let o = t[d];
|
|
||||||
if (!o)
|
|
||||||
return;
|
|
||||||
let r = o.listeners.delete(e);
|
|
||||||
if (n && !o.listeners.size) {
|
|
||||||
if (g.clear(t), !l.has(o))
|
|
||||||
return r;
|
|
||||||
let c = l.get(o);
|
|
||||||
if (!l.has(c))
|
|
||||||
return r;
|
|
||||||
l.get(c).forEach((s) => S(s, c, !0));
|
|
||||||
}
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
// signals.js
|
|
||||||
j(Z);
|
|
||||||
export {
|
|
||||||
g as S,
|
|
||||||
R as assign,
|
|
||||||
$ as assignAttribute,
|
|
||||||
X as classListDeclarative,
|
|
||||||
pt as createElement,
|
|
||||||
bt as dispatchEvent,
|
|
||||||
pt as el,
|
|
||||||
ht as empty,
|
|
||||||
N as isSignal,
|
|
||||||
v as on,
|
|
||||||
j as registerReactivity,
|
|
||||||
h as scope
|
|
||||||
};
|
|
||||||
Vendored
+198
@@ -0,0 +1,198 @@
|
|||||||
|
declare global {
|
||||||
|
type ddeComponentAttributes= Record<any, any> | undefined | string;
|
||||||
|
type ddeElementExtender<El extends Element>= (element: El)=> El;
|
||||||
|
}
|
||||||
|
type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & {
|
||||||
|
'#text': Text
|
||||||
|
}
|
||||||
|
type Element= ElementTagNameMap[keyof ElementTagNameMap];
|
||||||
|
type AttrsModified= {
|
||||||
|
/**
|
||||||
|
* In fact argumen for `*.setAttribute("style", *)`.
|
||||||
|
*/
|
||||||
|
style: string
|
||||||
|
/**
|
||||||
|
* 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<string,-1|0|1>,
|
||||||
|
/**
|
||||||
|
* By default simiral to `className`, but also supports `string[]`
|
||||||
|
* */
|
||||||
|
className: string | (string|boolean|undefined)[];
|
||||||
|
/**
|
||||||
|
* Sets `aria-*` simiraly to `dataset`
|
||||||
|
* */
|
||||||
|
ariaset: Record<string,string>,
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Just element attributtes
|
||||||
|
*
|
||||||
|
* In most cases, you can use native propertie such as [MDN WEB/API/Element](https://developer.mozilla.org/en-US/docs/Web/API/Element) and so on (e.g. [`Text`](https://developer.mozilla.org/en-US/docs/Web/API/Text)).
|
||||||
|
*
|
||||||
|
* There is added support for `data[A-Z].*`/`aria[A-Z].*` to be converted to the kebab-case alternatives.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
type ElementAttributes<T extends keyof ElementTagNameMap | ElementTagNameMap[keyof ElementTagNameMap]>=
|
||||||
|
T extends keyof ElementTagNameMap ?
|
||||||
|
Omit<ElementTagNameMap[T],"classList"|"className"> & AttrsModified :
|
||||||
|
Omit<T,"classList"|"className"> & AttrsModified;
|
||||||
|
export function assign<El extends Element>(element: El, ...attrs_array: Partial<ElementAttributes<El>>[]): El
|
||||||
|
type TagNameFragment= "<>";
|
||||||
|
export function el<TAG extends keyof ElementTagNameMap>(
|
||||||
|
tag_name: TAG,
|
||||||
|
attrs?: Partial<ElementAttributes<ElementTagNameMap[TAG]>>,
|
||||||
|
...extenders: ddeElementExtender<ElementTagNameMap[TAG]>[]
|
||||||
|
): ElementTagNameMap[TAG]
|
||||||
|
export function el<T>(
|
||||||
|
tag_name: TagNameFragment,
|
||||||
|
): DocumentFragment
|
||||||
|
export function el<
|
||||||
|
A extends ddeComponentAttributes,
|
||||||
|
C extends (attr: A)=> Element>(
|
||||||
|
fComponent: C,
|
||||||
|
attrs?: A,
|
||||||
|
...extenders: ddeElementExtender<ReturnType<C>>[]
|
||||||
|
): ReturnType<C>
|
||||||
|
export function dispatchEvent(element: HTMLElement, name: keyof DocumentEventMap): void;
|
||||||
|
export function dispatchEvent(element: HTMLElement, name: string, data: any): void;
|
||||||
|
interface On{
|
||||||
|
<
|
||||||
|
EE extends ddeElementExtender<Element>,
|
||||||
|
El extends ( EE extends ddeElementExtender<infer El> ? El : never ),
|
||||||
|
Event extends keyof DocumentEventMap>(
|
||||||
|
type: Event,
|
||||||
|
listener: (this: El, ev: DocumentEventMap[Event]) => any,
|
||||||
|
options?: AddEventListenerOptions
|
||||||
|
) : EE;
|
||||||
|
connected<
|
||||||
|
EE extends ddeElementExtender<Element>,
|
||||||
|
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
|
||||||
|
>(
|
||||||
|
listener: (el: El) => any,
|
||||||
|
options?: AddEventListenerOptions
|
||||||
|
) : EE;
|
||||||
|
disconnected<
|
||||||
|
EE extends ddeElementExtender<Element>,
|
||||||
|
El extends ( EE extends ddeElementExtender<infer El> ? El : never )
|
||||||
|
>(
|
||||||
|
listener: (el: El) => any,
|
||||||
|
options?: AddEventListenerOptions
|
||||||
|
) : EE;
|
||||||
|
}
|
||||||
|
export const on: On;
|
||||||
|
//TODO for SVG
|
||||||
|
declare global{
|
||||||
|
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
|
||||||
|
interface HTMLAnchorElement{ append(...nodes: (Node | string)[]): HTMLAnchorElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLAreaElement{ append(...nodes: (Node | string)[]): HTMLAreaElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLAudioElement{ append(...nodes: (Node | string)[]): HTMLAudioElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLBaseElement{ append(...nodes: (Node | string)[]): HTMLBaseElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
|
||||||
|
interface HTMLBodyElement{ append(...nodes: (Node | string)[]): HTMLBodyElement; }
|
||||||
|
interface HTMLBRElement{ append(...nodes: (Node | string)[]): HTMLBRElement; }
|
||||||
|
interface HTMLButtonElement{ append(...nodes: (Node | string)[]): HTMLButtonElement; }
|
||||||
|
interface HTMLCanvasElement{ append(...nodes: (Node | string)[]): HTMLCanvasElement; }
|
||||||
|
interface HTMLTableCaptionElement{ append(...nodes: (Node | string)[]): HTMLTableCaptionElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
|
||||||
|
interface HTMLTableColElement{ append(...nodes: (Node | string)[]): HTMLTableColElement; }
|
||||||
|
interface HTMLDataElement{ append(...nodes: (Node | string)[]): HTMLDataElement; }
|
||||||
|
interface HTMLDataListElement{ append(...nodes: (Node | string)[]): HTMLDataListElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
|
||||||
|
interface HTMLDetailsElement{ append(...nodes: (Node | string)[]): HTMLDetailsElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLDialogElement{ append(...nodes: (Node | string)[]): HTMLDialogElement; }
|
||||||
|
interface HTMLDivElement{ append(...nodes: (Node | string)[]): HTMLDivElement; }
|
||||||
|
interface HTMLDListElement{ append(...nodes: (Node | string)[]): HTMLDListElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLEmbedElement{ append(...nodes: (Node | string)[]): HTMLEmbedElement; }
|
||||||
|
interface HTMLFieldSetElement{ append(...nodes: (Node | string)[]): HTMLFieldSetElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLFormElement{ append(...nodes: (Node | string)[]): HTMLFormElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadingElement{ append(...nodes: (Node | string)[]): HTMLHeadingElement; }
|
||||||
|
interface HTMLHeadElement{ append(...nodes: (Node | string)[]): HTMLHeadElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLHRElement{ append(...nodes: (Node | string)[]): HTMLHRElement; }
|
||||||
|
interface HTMLHtmlElement{ append(...nodes: (Node | string)[]): HTMLHtmlElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLIFrameElement{ append(...nodes: (Node | string)[]): HTMLIFrameElement; }
|
||||||
|
interface HTMLImageElement{ append(...nodes: (Node | string)[]): HTMLImageElement; }
|
||||||
|
interface HTMLInputElement{ append(...nodes: (Node | string)[]): HTMLInputElement; }
|
||||||
|
interface HTMLModElement{ append(...nodes: (Node | string)[]): HTMLModElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLLabelElement{ append(...nodes: (Node | string)[]): HTMLLabelElement; }
|
||||||
|
interface HTMLLegendElement{ append(...nodes: (Node | string)[]): HTMLLegendElement; }
|
||||||
|
interface HTMLLIElement{ append(...nodes: (Node | string)[]): HTMLLIElement; }
|
||||||
|
interface HTMLLinkElement{ append(...nodes: (Node | string)[]): HTMLLinkElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLMapElement{ append(...nodes: (Node | string)[]): HTMLMapElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLMenuElement{ append(...nodes: (Node | string)[]): HTMLMenuElement; }
|
||||||
|
interface HTMLMetaElement{ append(...nodes: (Node | string)[]): HTMLMetaElement; }
|
||||||
|
interface HTMLMeterElement{ append(...nodes: (Node | string)[]): HTMLMeterElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLObjectElement{ append(...nodes: (Node | string)[]): HTMLObjectElement; }
|
||||||
|
interface HTMLOListElement{ append(...nodes: (Node | string)[]): HTMLOListElement; }
|
||||||
|
interface HTMLOptGroupElement{ append(...nodes: (Node | string)[]): HTMLOptGroupElement; }
|
||||||
|
interface HTMLOptionElement{ append(...nodes: (Node | string)[]): HTMLOptionElement; }
|
||||||
|
interface HTMLOutputElement{ append(...nodes: (Node | string)[]): HTMLOutputElement; }
|
||||||
|
interface HTMLParagraphElement{ append(...nodes: (Node | string)[]): HTMLParagraphElement; }
|
||||||
|
interface HTMLPictureElement{ append(...nodes: (Node | string)[]): HTMLPictureElement; }
|
||||||
|
interface HTMLPreElement{ append(...nodes: (Node | string)[]): HTMLPreElement; }
|
||||||
|
interface HTMLProgressElement{ append(...nodes: (Node | string)[]): HTMLProgressElement; }
|
||||||
|
interface HTMLQuoteElement{ append(...nodes: (Node | string)[]): HTMLQuoteElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLScriptElement{ append(...nodes: (Node | string)[]): HTMLScriptElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLSelectElement{ append(...nodes: (Node | string)[]): HTMLSelectElement; }
|
||||||
|
interface HTMLSlotElement{ append(...nodes: (Node | string)[]): HTMLSlotElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLSourceElement{ append(...nodes: (Node | string)[]): HTMLSourceElement; }
|
||||||
|
interface HTMLSpanElement{ append(...nodes: (Node | string)[]): HTMLSpanElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLStyleElement{ append(...nodes: (Node | string)[]): HTMLStyleElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLTableElement{ append(...nodes: (Node | string)[]): HTMLTableElement; }
|
||||||
|
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
|
||||||
|
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
|
||||||
|
interface HTMLTemplateElement{ append(...nodes: (Node | string)[]): HTMLTemplateElement; }
|
||||||
|
interface HTMLTextAreaElement{ append(...nodes: (Node | string)[]): HTMLTextAreaElement; }
|
||||||
|
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
|
||||||
|
interface HTMLTableCellElement{ append(...nodes: (Node | string)[]): HTMLTableCellElement; }
|
||||||
|
interface HTMLTableSectionElement{ append(...nodes: (Node | string)[]): HTMLTableSectionElement; }
|
||||||
|
interface HTMLTimeElement{ append(...nodes: (Node | string)[]): HTMLTimeElement; }
|
||||||
|
interface HTMLTitleElement{ append(...nodes: (Node | string)[]): HTMLTitleElement; }
|
||||||
|
interface HTMLTableRowElement{ append(...nodes: (Node | string)[]): HTMLTableRowElement; }
|
||||||
|
interface HTMLTrackElement{ append(...nodes: (Node | string)[]): HTMLTrackElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLUListElement{ append(...nodes: (Node | string)[]): HTMLUListElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface HTMLVideoElement{ append(...nodes: (Node | string)[]): HTMLVideoElement; }
|
||||||
|
interface HTMLElement{ append(...nodes: (Node | string)[]): HTMLElement; }
|
||||||
|
interface DocumentFragment{ append(...nodes: (Node | string)[]): DocumentFragment; }
|
||||||
|
}
|
||||||
Vendored
+1
-338
@@ -1,338 +1 @@
|
|||||||
// src/signals-common.js
|
var v={isSignal(t){return!1},processReactiveAttribute(t,e,n,c){return n}};function F(t,e=!0){return e?Object.assign(v,t):(Object.setPrototypeOf(t,v),t)}function m(t){return v.isPrototypeOf(t)&&t!==v?t:v}function h(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:H};function H(t,e,n){if(Reflect.set(t,e,n),!!h(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 E=[{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 E[E.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[...E]},push(t={}){return t.namespace&&(t.namespace=S(t.namespace)),E.push(Object.assign({},this.current,{prevent:!1},t))},pop(){return E.pop()}};function J(t,e,...n){let c=m(this),{namespace:r}=x,f=0,u;switch((Object(e)!==e||c.isSignal(e))&&(e={textContent:e}),!0){case typeof t=="function":{f=1,x.push({scope:t,host:a=>a?(f===1?n.unshift(a):a(u),void 0):u}),u=t(e||void 0),(u instanceof HTMLElement?M:W)(u,"Attribute","dde-fun",t.name);break}case t==="#text":u=w.call(this,document.createTextNode(""),e);break;case t==="<>":u=w.call(this,document.createDocumentFragment(),e);break;case r!=="html":u=w.call(this,document.createElementNS(r,t),e);break;case!u:u=w.call(this,document.createElement(t),e)}return n.forEach(a=>a(u)),f&&x.pop(),f=2,u}var{setDeleteAttr:L}=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),f=this;n=r.processReactiveAttribute(t,e,n,(a,p)=>N.call(f,t,a,p));let[u]=e;if(u==="=")return c(e.slice(1),n);if(u===".")return D(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 L(t,e,n);case"style":if(typeof n!="object")break;case"dataset":return y(r,n,D.bind(null,t[e]));case"ariaset":return y(r,n,(a,p)=>c("aria-"+a,p));case"classList":return U.call(f,t,n)}return q(t,e)?L(t,e,n):c(e,n)}function P(t,e){if(A.has(t))return A.get(t);let c=(t instanceof SVGElement?W:M).bind(null,t,"Attribute"),r=m(e);return{setRemoveAttr:c,s:r}}function U(t,e){let n=m(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 q(t,e){if(!Reflect.has(t,e))return!1;let n=j(t,e);return!h(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,f]){r&&(f=t.processReactiveAttribute(e,r,f,n),n(r,f))})}function T(t){return Array.isArray(t)?t.filter(Boolean).join(" "):t}function M(t,e,n,c){return t[(h(c)?"remove":"set")+e](n,T(c))}function W(t,e,n,c,r=null){return t[(h(c)?"remove":"set")+e+"NS"](r,n,T(c))}function D(t,e,n){if(Reflect.set(t,e,n),!!h(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=B(),z=new WeakSet;C.connected=function(t,e){let n="connected";return typeof e!="object"&&(e={}),e.once=!0,function(r){let f="dde:"+n;return r.addEventListener(f,t,e),r.__dde_lifecycleToEvents?r:r.isConnected?(r.dispatchEvent(new Event(f)),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 f="dde:"+n;return r.addEventListener(f,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 f="dde:"+n;if(r.addEventListener(f,t,e),r.__dde_lifecycleToEvents||z.has(r))return r;let u=new MutationObserver(function(p){for(let{attributeName:l,target:g}of p)g.dispatchEvent(new CustomEvent(f,{detail:[l,g.getAttribute(l)]}))});return _(e.signal,()=>u.disconnect())&&u.observe(r,{attributes:!0}),r}};function B(){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)){u();coLine truncated
|
||||||
var v = {
|
|
||||||
isSignal(t) {
|
|
||||||
return !1;
|
|
||||||
},
|
|
||||||
processReactiveAttribute(t, e, n, c) {
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function F(t, e = !0) {
|
|
||||||
return e ? Object.assign(v, t) : (Object.setPrototypeOf(t, v), t);
|
|
||||||
}
|
|
||||||
function m(t) {
|
|
||||||
return v.isPrototypeOf(t) && t !== v ? t : v;
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/helpers.js
|
|
||||||
function h(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);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom-common.js
|
|
||||||
var R = { setDeleteAttr: H };
|
|
||||||
function H(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!h(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, "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/dom.js
|
|
||||||
var E = [{
|
|
||||||
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 E[E.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 [...E];
|
|
||||||
},
|
|
||||||
push(t = {}) {
|
|
||||||
return t.namespace && (t.namespace = S(t.namespace)), E.push(Object.assign({}, this.current, { prevent: !1 }, t));
|
|
||||||
},
|
|
||||||
pop() {
|
|
||||||
return E.pop();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function J(t, e, ...n) {
|
|
||||||
let c = m(this), { namespace: r } = x, f = 0, u;
|
|
||||||
switch ((Object(e) !== e || c.isSignal(e)) && (e = { textContent: e }), !0) {
|
|
||||||
case typeof t == "function": {
|
|
||||||
f = 1, x.push({ scope: t, host: (a) => a ? (f === 1 ? n.unshift(a) : a(u), void 0) : u }), u = t(e || void 0), (u instanceof HTMLElement ? M : W)(u, "Attribute", "dde-fun", t.name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case t === "#text":
|
|
||||||
u = w.call(this, document.createTextNode(""), e);
|
|
||||||
break;
|
|
||||||
case t === "<>":
|
|
||||||
u = w.call(this, document.createDocumentFragment(), e);
|
|
||||||
break;
|
|
||||||
case r !== "html":
|
|
||||||
u = w.call(this, document.createElementNS(r, t), e);
|
|
||||||
break;
|
|
||||||
case !u:
|
|
||||||
u = w.call(this, document.createElement(t), e);
|
|
||||||
}
|
|
||||||
return n.forEach((a) => a(u)), f && x.pop(), f = 2, u;
|
|
||||||
}
|
|
||||||
var { setDeleteAttr: L } = R, A = /* @__PURE__ */ 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), f = this;
|
|
||||||
n = r.processReactiveAttribute(
|
|
||||||
t,
|
|
||||||
e,
|
|
||||||
n,
|
|
||||||
(a, p) => N.call(f, t, a, p)
|
|
||||||
);
|
|
||||||
let [u] = e;
|
|
||||||
if (u === "=")
|
|
||||||
return c(e.slice(1), n);
|
|
||||||
if (u === ".")
|
|
||||||
return D(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 L(t, e, n);
|
|
||||||
case "style":
|
|
||||||
if (typeof n != "object")
|
|
||||||
break;
|
|
||||||
case "dataset":
|
|
||||||
return y(r, n, D.bind(null, t[e]));
|
|
||||||
case "ariaset":
|
|
||||||
return y(r, n, (a, p) => c("aria-" + a, p));
|
|
||||||
case "classList":
|
|
||||||
return U.call(f, t, n);
|
|
||||||
}
|
|
||||||
return q(t, e) ? L(t, e, n) : c(e, n);
|
|
||||||
}
|
|
||||||
function P(t, e) {
|
|
||||||
if (A.has(t))
|
|
||||||
return A.get(t);
|
|
||||||
let c = (t instanceof SVGElement ? W : M).bind(null, t, "Attribute"), r = m(e);
|
|
||||||
return { setRemoveAttr: c, s: r };
|
|
||||||
}
|
|
||||||
function U(t, e) {
|
|
||||||
let n = m(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 q(t, e) {
|
|
||||||
if (!Reflect.has(t, e))
|
|
||||||
return !1;
|
|
||||||
let n = j(t, e);
|
|
||||||
return !h(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, f]) {
|
|
||||||
r && (f = t.processReactiveAttribute(e, r, f, n), n(r, f));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function T(t) {
|
|
||||||
return Array.isArray(t) ? t.filter(Boolean).join(" ") : t;
|
|
||||||
}
|
|
||||||
function M(t, e, n, c) {
|
|
||||||
return t[(h(c) ? "remove" : "set") + e](n, T(c));
|
|
||||||
}
|
|
||||||
function W(t, e, n, c, r = null) {
|
|
||||||
return t[(h(c) ? "remove" : "set") + e + "NS"](r, n, T(c));
|
|
||||||
}
|
|
||||||
function D(t, e, n) {
|
|
||||||
if (Reflect.set(t, e, n), !!h(n))
|
|
||||||
return Reflect.deleteProperty(t, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// src/events.js
|
|
||||||
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 = B(), z = /* @__PURE__ */ new WeakSet();
|
|
||||||
C.connected = function(t, e) {
|
|
||||||
let n = "connected";
|
|
||||||
return typeof e != "object" && (e = {}), e.once = !0, function(r) {
|
|
||||||
let f = "dde:" + n;
|
|
||||||
return r.addEventListener(f, t, e), r.__dde_lifecycleToEvents ? r : r.isConnected ? (r.dispatchEvent(new Event(f)), 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 f = "dde:" + n;
|
|
||||||
return r.addEventListener(f, 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 f = "dde:" + n;
|
|
||||||
if (r.addEventListener(f, t, e), r.__dde_lifecycleToEvents || z.has(r))
|
|
||||||
return r;
|
|
||||||
let u = new MutationObserver(function(p) {
|
|
||||||
for (let { attributeName: l, target: g } of p)
|
|
||||||
g.dispatchEvent(
|
|
||||||
new CustomEvent(f, { detail: [l, g.getAttribute(l)] })
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return _(e.signal, () => u.disconnect()) && u.observe(r, { attributes: !0 }), r;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
function B() {
|
|
||||||
let t = /* @__PURE__ */ new Map(), e = !1, n = new MutationObserver(function(o) {
|
|
||||||
for (let s of o)
|
|
||||||
if (s.type === "childList") {
|
|
||||||
if (l(s.addedNodes, !0)) {
|
|
||||||
u();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
g(s.removedNodes, !0) && u();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
onConnected(o, s) {
|
|
||||||
f();
|
|
||||||
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) {
|
|
||||||
f();
|
|
||||||
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), u());
|
|
||||||
}
|
|
||||||
function r(o) {
|
|
||||||
if (t.has(o))
|
|
||||||
return t.get(o);
|
|
||||||
let s = {
|
|
||||||
connected: /* @__PURE__ */ new WeakSet(),
|
|
||||||
length_c: 0,
|
|
||||||
disconnected: /* @__PURE__ */ new WeakSet(),
|
|
||||||
length_d: 0
|
|
||||||
};
|
|
||||||
return t.set(o, s), s;
|
|
||||||
}
|
|
||||||
function f() {
|
|
||||||
e || (e = !0, n.observe(document.body, { childList: !0, subtree: !0 }));
|
|
||||||
}
|
|
||||||
function u() {
|
|
||||||
!e || t.size || (e = !1, n.disconnect());
|
|
||||||
}
|
|
||||||
function a() {
|
|
||||||
return new Promise(function(o) {
|
|
||||||
(requestIdleCallback || requestAnimationFrame)(o);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async function p(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 d of o) {
|
|
||||||
if (s && p(d).then(l), !t.has(d))
|
|
||||||
continue;
|
|
||||||
let b = t.get(d);
|
|
||||||
b.length_c && (d.dispatchEvent(new Event("dde:connected")), b.connected = /* @__PURE__ */ new WeakSet(), b.length_c = 0, b.length_d || t.delete(d), i = !0);
|
|
||||||
}
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
function g(o, s) {
|
|
||||||
let i = !1;
|
|
||||||
for (let d of o)
|
|
||||||
s && p(d).then(g), !(!t.has(d) || !t.get(d).length_d) && (d.dispatchEvent(new Event("dde:disconnected")), t.delete(d), i = !0);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// index.js
|
|
||||||
[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,
|
|
||||||
U as classListDeclarative,
|
|
||||||
J as createElement,
|
|
||||||
k as dispatchEvent,
|
|
||||||
J as el,
|
|
||||||
Q as empty,
|
|
||||||
C as on,
|
|
||||||
F as registerReactivity,
|
|
||||||
x as scope
|
|
||||||
};
|
|
||||||
Vendored
+2
@@ -0,0 +1,2 @@
|
|||||||
|
export * from "./index";
|
||||||
|
export * from "./signals";
|
||||||
Generated
+161
-137
@@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "deka-dom-el",
|
"name": "deka-dom-el",
|
||||||
"version": "0.4.0",
|
"version": "0.6.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "deka-dom-el",
|
"name": "deka-dom-el",
|
||||||
"version": "0.4.0",
|
"version": "0.6.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@size-limit/preset-small-lib": "^8.2.6",
|
"@size-limit/preset-small-lib": "^8.2.6",
|
||||||
|
"dts-bundler": "^0.1.0",
|
||||||
"esbuild": "^0.19.2",
|
"esbuild": "^0.19.2",
|
||||||
"jshint": "^2.13.6",
|
"jshint": "^2.13.6",
|
||||||
"nodejsscript": "github:jaandrle/nodejsscript#dev-v1",
|
"nodejsscript": "github:jaandrle/nodejsscript#dev-v1",
|
||||||
@@ -20,9 +21,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-arm": {
|
"node_modules/@esbuild/android-arm": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.5.tgz",
|
||||||
"integrity": "sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==",
|
"integrity": "sha512-bhvbzWFF3CwMs5tbjf3ObfGqbl/17ict2/uwOSfr3wmxDE6VdS2GqY/FuzIPe0q0bdhj65zQsvqfArI9MY6+AA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -36,9 +37,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-arm64": {
|
"node_modules/@esbuild/android-arm64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.5.tgz",
|
||||||
"integrity": "sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==",
|
"integrity": "sha512-5d1OkoJxnYQfmC+Zd8NBFjkhyCNYwM4n9ODrycTFY6Jk1IGiZ+tjVJDDSwDt77nK+tfpGP4T50iMtVi4dEGzhQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -52,9 +53,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/android-x64": {
|
"node_modules/@esbuild/android-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==",
|
"integrity": "sha512-9t+28jHGL7uBdkBjL90QFxe7DVA+KGqWlHCF8ChTKyaKO//VLuoBricQCgwhOjA1/qOczsw843Fy4cbs4H3DVA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -68,9 +69,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/darwin-arm64": {
|
"node_modules/@esbuild/darwin-arm64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.5.tgz",
|
||||||
"integrity": "sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==",
|
"integrity": "sha512-mvXGcKqqIqyKoxq26qEDPHJuBYUA5KizJncKOAf9eJQez+L9O+KfvNFu6nl7SCZ/gFb2QPaRqqmG0doSWlgkqw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -84,9 +85,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/darwin-x64": {
|
"node_modules/@esbuild/darwin-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==",
|
"integrity": "sha512-Ly8cn6fGLNet19s0X4unjcniX24I0RqjPv+kurpXabZYSXGM4Pwpmf85WHJN3lAgB8GSth7s5A0r856S+4DyiA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -100,9 +101,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/freebsd-arm64": {
|
"node_modules/@esbuild/freebsd-arm64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.5.tgz",
|
||||||
"integrity": "sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==",
|
"integrity": "sha512-GGDNnPWTmWE+DMchq1W8Sd0mUkL+APvJg3b11klSGUDvRXh70JqLAO56tubmq1s2cgpVCSKYywEiKBfju8JztQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -116,9 +117,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/freebsd-x64": {
|
"node_modules/@esbuild/freebsd-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==",
|
"integrity": "sha512-1CCwDHnSSoA0HNwdfoNY0jLfJpd7ygaLAp5EHFos3VWJCRX9DMwWODf96s9TSse39Br7oOTLryRVmBoFwXbuuQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -132,9 +133,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-arm": {
|
"node_modules/@esbuild/linux-arm": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.5.tgz",
|
||||||
"integrity": "sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==",
|
"integrity": "sha512-lrWXLY/vJBzCPC51QN0HM71uWgIEpGSjSZZADQhq7DKhPcI6NH1IdzjfHkDQws2oNpJKpR13kv7/pFHBbDQDwQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm"
|
"arm"
|
||||||
],
|
],
|
||||||
@@ -148,9 +149,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-arm64": {
|
"node_modules/@esbuild/linux-arm64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.5.tgz",
|
||||||
"integrity": "sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==",
|
"integrity": "sha512-o3vYippBmSrjjQUCEEiTZ2l+4yC0pVJD/Dl57WfPwwlvFkrxoSO7rmBZFii6kQB3Wrn/6GwJUPLU5t52eq2meA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -164,9 +165,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-ia32": {
|
"node_modules/@esbuild/linux-ia32": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.5.tgz",
|
||||||
"integrity": "sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==",
|
"integrity": "sha512-MkjHXS03AXAkNp1KKkhSKPOCYztRtK+KXDNkBa6P78F8Bw0ynknCSClO/ztGszILZtyO/lVKpa7MolbBZ6oJtQ==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -180,9 +181,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-loong64": {
|
"node_modules/@esbuild/linux-loong64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.5.tgz",
|
||||||
"integrity": "sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==",
|
"integrity": "sha512-42GwZMm5oYOD/JHqHska3Jg0r+XFb/fdZRX+WjADm3nLWLcIsN27YKtqxzQmGNJgu0AyXg4HtcSK9HuOk3v1Dw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"loong64"
|
"loong64"
|
||||||
],
|
],
|
||||||
@@ -196,9 +197,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-mips64el": {
|
"node_modules/@esbuild/linux-mips64el": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.5.tgz",
|
||||||
"integrity": "sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==",
|
"integrity": "sha512-kcjndCSMitUuPJobWCnwQ9lLjiLZUR3QLQmlgaBfMX23UEa7ZOrtufnRds+6WZtIS9HdTXqND4yH8NLoVVIkcg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"mips64el"
|
"mips64el"
|
||||||
],
|
],
|
||||||
@@ -212,9 +213,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-ppc64": {
|
"node_modules/@esbuild/linux-ppc64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.5.tgz",
|
||||||
"integrity": "sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==",
|
"integrity": "sha512-yJAxJfHVm0ZbsiljbtFFP1BQKLc8kUF6+17tjQ78QjqjAQDnhULWiTA6u0FCDmYT1oOKS9PzZ2z0aBI+Mcyj7Q==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ppc64"
|
"ppc64"
|
||||||
],
|
],
|
||||||
@@ -228,9 +229,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-riscv64": {
|
"node_modules/@esbuild/linux-riscv64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.5.tgz",
|
||||||
"integrity": "sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==",
|
"integrity": "sha512-5u8cIR/t3gaD6ad3wNt1MNRstAZO+aNyBxu2We8X31bA8XUNyamTVQwLDA1SLoPCUehNCymhBhK3Qim1433Zag==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"riscv64"
|
"riscv64"
|
||||||
],
|
],
|
||||||
@@ -244,9 +245,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-s390x": {
|
"node_modules/@esbuild/linux-s390x": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.5.tgz",
|
||||||
"integrity": "sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==",
|
"integrity": "sha512-Z6JrMyEw/EmZBD/OFEFpb+gao9xJ59ATsoTNlj39jVBbXqoZm4Xntu6wVmGPB/OATi1uk/DB+yeDPv2E8PqZGw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"s390x"
|
"s390x"
|
||||||
],
|
],
|
||||||
@@ -260,9 +261,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/linux-x64": {
|
"node_modules/@esbuild/linux-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==",
|
"integrity": "sha512-psagl+2RlK1z8zWZOmVdImisMtrUxvwereIdyJTmtmHahJTKb64pAcqoPlx6CewPdvGvUKe2Jw+0Z/0qhSbG1A==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -276,9 +277,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/netbsd-x64": {
|
"node_modules/@esbuild/netbsd-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==",
|
"integrity": "sha512-kL2l+xScnAy/E/3119OggX8SrWyBEcqAh8aOY1gr4gPvw76la2GlD4Ymf832UCVbmuWeTf2adkZDK+h0Z/fB4g==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -292,9 +293,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/openbsd-x64": {
|
"node_modules/@esbuild/openbsd-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==",
|
"integrity": "sha512-sPOfhtzFufQfTBgRnE1DIJjzsXukKSvZxloZbkJDG383q0awVAq600pc1nfqBcl0ice/WN9p4qLc39WhBShRTA==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -308,9 +309,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/sunos-x64": {
|
"node_modules/@esbuild/sunos-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==",
|
"integrity": "sha512-dGZkBXaafuKLpDSjKcB0ax0FL36YXCvJNnztjKV+6CO82tTYVDSH2lifitJ29jxRMoUhgkg9a+VA/B03WK5lcg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -324,9 +325,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/win32-arm64": {
|
"node_modules/@esbuild/win32-arm64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.5.tgz",
|
||||||
"integrity": "sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==",
|
"integrity": "sha512-dWVjD9y03ilhdRQ6Xig1NWNgfLtf2o/STKTS+eZuF90fI2BhbwD6WlaiCGKptlqXlURVB5AUOxUj09LuwKGDTg==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"arm64"
|
"arm64"
|
||||||
],
|
],
|
||||||
@@ -340,9 +341,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/win32-ia32": {
|
"node_modules/@esbuild/win32-ia32": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.5.tgz",
|
||||||
"integrity": "sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==",
|
"integrity": "sha512-4liggWIA4oDgUxqpZwrDhmEfAH4d0iljanDOK7AnVU89T6CzHon/ony8C5LeOdfgx60x5cnQJFZwEydVlYx4iw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"ia32"
|
"ia32"
|
||||||
],
|
],
|
||||||
@@ -356,9 +357,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@esbuild/win32-x64": {
|
"node_modules/@esbuild/win32-x64": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.5.tgz",
|
||||||
"integrity": "sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==",
|
"integrity": "sha512-czTrygUsB/jlM8qEW5MD8bgYU2Xg14lo6kBDXW6HdxKjh8M5PzETGiSHaz9MtbXBYDloHNUAUW2tMiKW4KM9Mw==",
|
||||||
"cpu": [
|
"cpu": [
|
||||||
"x64"
|
"x64"
|
||||||
],
|
],
|
||||||
@@ -857,30 +858,33 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/mri": {
|
"node_modules/@types/mri": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mri/-/mri-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mri/-/mri-1.1.3.tgz",
|
||||||
"integrity": "sha512-nJOuiTlsvmClSr3+a/trTSx4DTuY/VURsWGKSf/eeavh0LRMqdsK60ti0TlwM5iHiGOK3/Ibkxsbr7i9rzGreA==",
|
"integrity": "sha512-U2Dng2M0MSOi+W3PQq3nX57/0Mgo0HRsIrGswobuu1/W6DlxH+bhlBapzxlpQyVv+rcsSc+qeUXgQ1CqmUhV0w==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.5.6",
|
"version": "20.8.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.7.tgz",
|
||||||
"integrity": "sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==",
|
"integrity": "sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==",
|
||||||
"dev": true
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~5.25.1"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/sade": {
|
"node_modules/@types/sade": {
|
||||||
"version": "1.7.4",
|
"version": "1.7.6",
|
||||||
"resolved": "https://registry.npmjs.org/@types/sade/-/sade-1.7.4.tgz",
|
"resolved": "https://registry.npmjs.org/@types/sade/-/sade-1.7.6.tgz",
|
||||||
"integrity": "sha512-6ys13kmtlY0aIOz4KtMdeBD9BHs6vSE3aRcj4vAZqXjypT2el8WZt6799CMjElVgh1cbOH/t3vrpQ4IpwytcPA==",
|
"integrity": "sha512-YfIO6wZicRVmJZQ/fWmHrFrqDtES2byhP6HZ34il6S2RoGJucwO5ZjhXOOI7g1IcVUX7xdkSZVl8Z+nVXoiHJw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/mri": "*"
|
"@types/mri": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/shelljs": {
|
"node_modules/@types/shelljs": {
|
||||||
"version": "0.8.12",
|
"version": "0.8.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.12.tgz",
|
"resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.14.tgz",
|
||||||
"integrity": "sha512-ZA8U81/gldY+rR5zl/7HSHrG2KDfEb3lzG6uCUDhW1DTQE9yC/VBQ45fXnXq8f3CgInfhZmjtdu/WOUlrXRQUg==",
|
"integrity": "sha512-eqKaGPi60riuxI9pUVeCT02EGo94Y6HT119h7w5bXSELsis6+JqzdEy6H/w2xXl881wcN3VDnb/D0WlgSety5w==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/glob": "~7.2.0",
|
"@types/glob": "~7.2.0",
|
||||||
@@ -1192,6 +1196,15 @@
|
|||||||
"domelementtype": "1"
|
"domelementtype": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dts-bundler": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dts-bundler/-/dts-bundler-0.1.0.tgz",
|
||||||
|
"integrity": "sha512-h0llx8DbWDMLJoB/jT5+YghYse1RA7SKDDPG3h0E+ecgkRDFMsr1aa8vaPTmrv6Qta79mme78tIyFStXBxijCg==",
|
||||||
|
"dev": true,
|
||||||
|
"peerDependencies": {
|
||||||
|
"typescript": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/emoji-regex": {
|
"node_modules/emoji-regex": {
|
||||||
"version": "8.0.0",
|
"version": "8.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||||
@@ -1205,9 +1218,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/esbuild": {
|
"node_modules/esbuild": {
|
||||||
"version": "0.19.2",
|
"version": "0.19.5",
|
||||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.2.tgz",
|
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.5.tgz",
|
||||||
"integrity": "sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==",
|
"integrity": "sha512-bUxalY7b1g8vNhQKdB24QDmHeY4V4tw/s6Ak5z+jJX9laP5MoQseTOMemAr0gxssjNcH0MCViG8ONI2kksvfFQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -1217,28 +1230,28 @@
|
|||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@esbuild/android-arm": "0.19.2",
|
"@esbuild/android-arm": "0.19.5",
|
||||||
"@esbuild/android-arm64": "0.19.2",
|
"@esbuild/android-arm64": "0.19.5",
|
||||||
"@esbuild/android-x64": "0.19.2",
|
"@esbuild/android-x64": "0.19.5",
|
||||||
"@esbuild/darwin-arm64": "0.19.2",
|
"@esbuild/darwin-arm64": "0.19.5",
|
||||||
"@esbuild/darwin-x64": "0.19.2",
|
"@esbuild/darwin-x64": "0.19.5",
|
||||||
"@esbuild/freebsd-arm64": "0.19.2",
|
"@esbuild/freebsd-arm64": "0.19.5",
|
||||||
"@esbuild/freebsd-x64": "0.19.2",
|
"@esbuild/freebsd-x64": "0.19.5",
|
||||||
"@esbuild/linux-arm": "0.19.2",
|
"@esbuild/linux-arm": "0.19.5",
|
||||||
"@esbuild/linux-arm64": "0.19.2",
|
"@esbuild/linux-arm64": "0.19.5",
|
||||||
"@esbuild/linux-ia32": "0.19.2",
|
"@esbuild/linux-ia32": "0.19.5",
|
||||||
"@esbuild/linux-loong64": "0.19.2",
|
"@esbuild/linux-loong64": "0.19.5",
|
||||||
"@esbuild/linux-mips64el": "0.19.2",
|
"@esbuild/linux-mips64el": "0.19.5",
|
||||||
"@esbuild/linux-ppc64": "0.19.2",
|
"@esbuild/linux-ppc64": "0.19.5",
|
||||||
"@esbuild/linux-riscv64": "0.19.2",
|
"@esbuild/linux-riscv64": "0.19.5",
|
||||||
"@esbuild/linux-s390x": "0.19.2",
|
"@esbuild/linux-s390x": "0.19.5",
|
||||||
"@esbuild/linux-x64": "0.19.2",
|
"@esbuild/linux-x64": "0.19.5",
|
||||||
"@esbuild/netbsd-x64": "0.19.2",
|
"@esbuild/netbsd-x64": "0.19.5",
|
||||||
"@esbuild/openbsd-x64": "0.19.2",
|
"@esbuild/openbsd-x64": "0.19.5",
|
||||||
"@esbuild/sunos-x64": "0.19.2",
|
"@esbuild/sunos-x64": "0.19.5",
|
||||||
"@esbuild/win32-arm64": "0.19.2",
|
"@esbuild/win32-arm64": "0.19.5",
|
||||||
"@esbuild/win32-ia32": "0.19.2",
|
"@esbuild/win32-ia32": "0.19.5",
|
||||||
"@esbuild/win32-x64": "0.19.2"
|
"@esbuild/win32-x64": "0.19.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/event-target-shim": {
|
"node_modules/event-target-shim": {
|
||||||
@@ -1351,12 +1364,6 @@
|
|||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/function-bind": {
|
|
||||||
"version": "1.1.1",
|
|
||||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
|
||||||
"integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==",
|
|
||||||
"dev": true
|
|
||||||
},
|
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "7.2.3",
|
"version": "7.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
|
||||||
@@ -1389,6 +1396,18 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/glob/node_modules/minimatch": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"brace-expansion": "^1.1.7"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/globby": {
|
"node_modules/globby": {
|
||||||
"version": "11.1.0",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
|
||||||
@@ -1410,13 +1429,10 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/has": {
|
"node_modules/has": {
|
||||||
"version": "1.0.3",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz",
|
||||||
"integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
|
"integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
|
||||||
"function-bind": "^1.1.1"
|
|
||||||
},
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4.0"
|
"node": ">= 0.4.0"
|
||||||
}
|
}
|
||||||
@@ -1561,18 +1577,6 @@
|
|||||||
"jshint": "bin/jshint"
|
"jshint": "bin/jshint"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/jshint/node_modules/minimatch": {
|
|
||||||
"version": "3.0.8",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
|
|
||||||
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"brace-expansion": "^1.1.7"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/just-flatten-it": {
|
"node_modules/just-flatten-it": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/just-flatten-it/-/just-flatten-it-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/just-flatten-it/-/just-flatten-it-2.2.1.tgz",
|
||||||
@@ -1656,9 +1660,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimatch": {
|
"node_modules/minimatch": {
|
||||||
"version": "3.1.2",
|
"version": "3.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.8.tgz",
|
||||||
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
|
"integrity": "sha512-6FsRAQsxQ61mw+qP1ZzbL9Bc78x2p5OqNgNpnoAFLTrX8n5Kxph0CsnhmKKNXTWjXqU5L0pGPR7hYk+XWZr60Q==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brace-expansion": "^1.1.7"
|
"brace-expansion": "^1.1.7"
|
||||||
@@ -1742,7 +1746,7 @@
|
|||||||
},
|
},
|
||||||
"node_modules/nodejsscript": {
|
"node_modules/nodejsscript": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "git+ssh://git@github.com/jaandrle/nodejsscript.git#efb342b22c1a3e6ef0d5d460aafae7276946cca6",
|
"resolved": "git+ssh://git@github.com/jaandrle/nodejsscript.git#0e368f4f74b4c8f7a30f1f595128b5d0b823015d",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -1893,9 +1897,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/resolve": {
|
"node_modules/resolve": {
|
||||||
"version": "1.22.4",
|
"version": "1.22.8",
|
||||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz",
|
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz",
|
||||||
"integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==",
|
"integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-core-module": "^2.13.0",
|
"is-core-module": "^2.13.0",
|
||||||
@@ -2130,6 +2134,26 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "2.9.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz",
|
||||||
|
"integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==",
|
||||||
|
"dev": true,
|
||||||
|
"peer": true,
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "5.25.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz",
|
||||||
|
"integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/web-streams-polyfill": {
|
"node_modules/web-streams-polyfill": {
|
||||||
"version": "3.2.1",
|
"version": "3.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz",
|
||||||
|
|||||||
+4
-3
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "deka-dom-el",
|
"name": "deka-dom-el",
|
||||||
"version": "0.5.3",
|
"version": "0.6.0",
|
||||||
"description": "A low-code library that simplifies the creation of native DOM elements/components using small wrappers and tweaks.",
|
"description": "A low-code library that simplifies the creation of native DOM elements/components using small wrappers and tweaks.",
|
||||||
"author": "Jan Andrle <andrle.jan@centrum.cz>",
|
"author": "Jan Andrle <andrle.jan@centrum.cz>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "./signals.js",
|
"path": "./signals.js",
|
||||||
"limit": "8 kB",
|
"limit": "8.5 kB",
|
||||||
"gzip": false
|
"gzip": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "./examples/components/webComponent.js",
|
"path": "./examples/components/webComponent.js",
|
||||||
"limit": "12kb",
|
"limit": "12.5 kB",
|
||||||
"gzip": false
|
"gzip": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -91,6 +91,7 @@
|
|||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@size-limit/preset-small-lib": "^8.2.6",
|
"@size-limit/preset-small-lib": "^8.2.6",
|
||||||
|
"dts-bundler": "^0.1.0",
|
||||||
"esbuild": "^0.19.2",
|
"esbuild": "^0.19.2",
|
||||||
"jshint": "^2.13.6",
|
"jshint": "^2.13.6",
|
||||||
"nodejsscript": "github:jaandrle/nodejsscript#dev-v1",
|
"nodejsscript": "github:jaandrle/nodejsscript#dev-v1",
|
||||||
|
|||||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ interface S {
|
|||||||
name: N,
|
name: N,
|
||||||
...params: A[N] extends (...args: infer P)=> any ? P : never
|
...params: A[N] extends (...args: infer P)=> any ? P : never
|
||||||
): void;
|
): void;
|
||||||
clear(...signals: Signal<any, any>): void;
|
clear(...signals: Signal<any, any>[]): void;
|
||||||
on<T>(signal: Signal<T, any>, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
|
on<T>(signal: Signal<T, any>, onchange: (a: T)=> void, options?: AddEventListenerOptions): void;
|
||||||
symbols: {
|
symbols: {
|
||||||
signal: SymbolSignal;
|
signal: SymbolSignal;
|
||||||
|
|||||||
+36
-13
@@ -8,7 +8,9 @@ export function isSignal(candidate){
|
|||||||
const stack_watch= [];
|
const stack_watch= [];
|
||||||
/**
|
/**
|
||||||
* ### `WeakMap<function, Set<ddeSignal<any, any>>>`
|
* ### `WeakMap<function, Set<ddeSignal<any, any>>>`
|
||||||
* The `Set` is in the form of `[ source, ...depended signals (DSs) ]`. When the DS is cleaned it is removed from DSs, if remains only one (`source`) it is cleared too.
|
* The `Set` is in the form of `[ source, ...depended signals (DSs) ]`.
|
||||||
|
* When the DS is cleaned (`S.clear`) it is removed from DSs,
|
||||||
|
* if remains only one (`source`) it is cleared too.
|
||||||
* ### `WeakMap<object, function>`
|
* ### `WeakMap<object, function>`
|
||||||
* This is used for revesed deps, the `function` is also key for `deps`.
|
* This is used for revesed deps, the `function` is also key for `deps`.
|
||||||
* @type {WeakMap<function|object,Set<ddeSignal<any, any>>|function>}
|
* @type {WeakMap<function|object,Set<ddeSignal<any, any>>|function>}
|
||||||
@@ -62,18 +64,34 @@ S.symbols= {
|
|||||||
};
|
};
|
||||||
import { on } from "./events.js";
|
import { on } from "./events.js";
|
||||||
import { scope } from "./dom.js";
|
import { scope } from "./dom.js";
|
||||||
|
const key_attributes= "__dde_attributes";
|
||||||
S.attribute= function(name, initial= undefined){
|
S.attribute= function(name, initial= undefined){
|
||||||
const { host }= scope;
|
const out= S(initial);
|
||||||
const value= host() && host().hasAttribute(name) ? host().getAttribute(name) : initial;
|
scope.host(element=> {
|
||||||
const ac= new AbortController();
|
if(element instanceof HTMLElement){
|
||||||
const out= S(value, {
|
if(element.hasAttribute(name)) out(element.getAttribute(name));
|
||||||
[S.symbols.onclear](){ ac.abort(); }
|
} else {
|
||||||
|
if(element.hasAttributeNS(null, name)) out(element.getAttributeNS(null, name));
|
||||||
|
}
|
||||||
|
if(element[key_attributes]){
|
||||||
|
element[key_attributes][name]= out;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
element[key_attributes]= { [name]: out };
|
||||||
|
on.attributeChanged(function attributeChangeToSignal({ detail }){
|
||||||
|
/*! This maps attributes to signals (`S.attribute`).
|
||||||
|
* Investigate `__dde_attributes` key of the element.*/
|
||||||
|
const [ name, value ]= detail;
|
||||||
|
const curr= element[key_attributes][name];
|
||||||
|
if(curr) curr(value);
|
||||||
|
})(element);
|
||||||
|
on.disconnected(function(){
|
||||||
|
/*! This removes all signals mapped to attributes (`S.attribute`).
|
||||||
|
* Investigate `__dde_attributes` key of the element.*/
|
||||||
|
S.clear(...Object.values(element[key_attributes]));
|
||||||
|
})(element);
|
||||||
|
return element;
|
||||||
});
|
});
|
||||||
scope.host(on.attributeChanged(function attributeChangeToSignal({ detail }){
|
|
||||||
const [ name_c, value ]= detail;
|
|
||||||
if(name_c!==name) return;
|
|
||||||
out(value);
|
|
||||||
}, { signal: ac.signal }));
|
|
||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
S.clear= function(...signals){
|
S.clear= function(...signals){
|
||||||
@@ -182,11 +200,16 @@ function toSignal(signal, value, actions){
|
|||||||
Reflect.deleteProperty(actions, ocs);
|
Reflect.deleteProperty(actions, ocs);
|
||||||
}
|
}
|
||||||
const { host }= scope;
|
const { host }= scope;
|
||||||
signal[mark]= {
|
Reflect.defineProperty(signal, mark, {
|
||||||
|
value: {
|
||||||
value, actions, onclear, host,
|
value, actions, onclear, host,
|
||||||
listeners: new Set(),
|
listeners: new Set(),
|
||||||
defined: new SignalDefined()
|
defined: new SignalDefined()
|
||||||
};
|
},
|
||||||
|
enumerable: false,
|
||||||
|
writable: false,
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
signal.toJSON= ()=> signal();
|
signal.toJSON= ()=> signal();
|
||||||
Object.setPrototypeOf(signal[mark], protoSigal);
|
Object.setPrototypeOf(signal[mark], protoSigal);
|
||||||
return signal;
|
return signal;
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDeclarationOnly": true,
|
||||||
|
"declaration": true,
|
||||||
|
"declarationDir": "dist"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user