diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b53da94 --- /dev/null +++ b/.gitignore @@ -0,0 +1,127 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional stylelint cache +.stylelintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# vuepress v2.x temp and cache directory +.temp +.cache + +# Docusaurus cache and generated files +.docusaurus + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + diff --git a/bs/.lint.toml b/bs/.lint.toml new file mode 100644 index 0000000..a61791b --- /dev/null +++ b/bs/.lint.toml @@ -0,0 +1 @@ +info= "Lint size of lib and jshint" diff --git a/bs/README.md b/bs/README.md new file mode 100644 index 0000000..117df92 --- /dev/null +++ b/bs/README.md @@ -0,0 +1 @@ +[jaandrle/bs: The simplest possible build system using executables](https://github.com/jaandrle/bs/) diff --git a/bs/build.js b/bs/build.js new file mode 100755 index 0000000..39d901e --- /dev/null +++ b/bs/build.js @@ -0,0 +1,39 @@ +#!/usr/bin/env -S npx nodejsscript +const files= [ "index.js", "index-with-signals.js" ]; +const filesOut= (file, mark= "esm")=> "dist/"+file.replace("index", mark); + +for(const file of files){ + const out= filesOut(file); + s.run([ + "npx esbuild '::file::'", + "--platform=neutral", + "--bundle", + //"--minify", + "--minify-syntax --minify-identifiers", + "--packages=external", + "--outfile='::out::'" + ].join(" "), { file, out }); + pipe( + f=> f.replace(/^ +/gm, m=> "\t".repeat(m.length/2)), + f=> s.echo(f).to(out) + )(s.cat(out)); + toDDE(out, filesOut(file, "dde")); +} +$.exit(0); + +function toDDE(file, out){ + const name= "dde"; + echo(`\n ${out} (${file} → globalThis.${name})\n`); + + let content= s.cat(file).toString().split("export {"); + content.splice(1, 0, `\nglobalThis.${name}= {`); + content[2]= content[2].replace(/^(\t*)(.*) as ([^,\n]*)(,?)$/mg, "$1$3: $2$4"); + s.echo([ + `//deka-dom-el library is available via global namespace \`${name}\``, + "(()=> {", + "\t"+content.join("").split("\n").join("\n "), + "})();" + ].join("\n")).to(out); + + echo("⚡ Done\n"); +} diff --git a/bs/lint.sh b/bs/lint.sh new file mode 100755 index 0000000..867ea2c --- /dev/null +++ b/bs/lint.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +npx size-limit diff --git a/dist/dde-with-signals.js b/dist/dde-with-signals.js new file mode 100644 index 0000000..4c93714 --- /dev/null +++ b/dist/dde-with-signals.js @@ -0,0 +1,354 @@ +//deka-dom-el library is available via global namespace `dde` +(()=> { + // src/helpers.js + function h(e) { + let t = typeof e; + return t !== "object" ? t : e === null ? "null" : Object.prototype.toString.call(e); + } + + // src/signals-common.js + var m = { + isReactiveAtrribute(e, t) { + return !1; + }, + isTextContent(e) { + return h(e) !== "[object Object]"; + }, + processReactiveAttribute(e, t, n, r) { + return !1; + }, + reactiveElement(e, ...t) { + return document.createDocumentFragment(); + } + }; + function R(e, t = !0) { + return t ? Object.assign(m, e) : (Object.setPrototypeOf(e, m), e); + } + function A(e) { + return m.isPrototypeOf(e) && e !== m ? e : m; + } + + // src/dom.js + var E = "html"; + function K(e) { + return E = e === "svg" ? "http://www.w3.org/2000/svg" : e, { + append(t) { + return E = "html", t; + } + }; + } + function Q(e, t, ...n) { + let r = A(this), o; + if (e === "<>") { + if (r.isReactiveAtrribute(t)) + return r.reactiveElement(t, ...n); + o = document.createDocumentFragment(); + } + switch (r.isTextContent(t) && (t = { textContent: t }), !0) { + case typeof e == "function": + o = e(t || void 0); + break; + case e === "#text": + o = C(document.createTextNode(""), t); + break; + case E !== "html": + o = C(document.createElementNS(E, e), t); + break; + default: + o = C(document.createElement(e), t); + } + return n.forEach((l) => l(o)), o; + } + function C(e, ...t) { + let n = A(this); + if (!t.length) + return e; + let r = e instanceof SVGElement, o = (r ? z : D).bind(null, e, "Attribute"); + return Object.entries(Object.assign({}, ...t)).forEach(function l([s, f]) { + if (n.isReactiveAtrribute(f, s) && (f = n.processReactiveAttribute(el, s, f, l)), s[0] === "=") + return o(s.slice(1), f); + if (s[0] === ".") + return S(e, s.slice(1), f); + if (typeof f == "object") + switch (s) { + case "style": + return v(f, D.bind(null, e.style, "Property")); + case "dataset": + return v(f, S.bind(null, e.dataset)); + case "ariaset": + return v(f, (p, b) => o("aria-" + p, b)); + case "classList": + return q(e, f); + default: + return Reflect.set(e, s, f); + } + if (/(aria|data)([A-Z])/.test(s)) + return s = s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o(s, f); + switch (s) { + case "href": + return o(s, f); + case "xlink:href": + return o(s, f, "http://www.w3.org/1999/xlink"); + case "textContent": + if (!r) + break; + return e.appendChild(document.createTextNode(f)); + } + return s in e && !r ? S(e, s, f) : o(s, f); + }), e; + } + function q(e, t) { + return typeof t != "object" || v( + t, + (n, r) => e.classList.toggle(n, r === -1 ? void 0 : !!r) + ), e; + } + function X(e) { + return Array.from(e.children).forEach((t) => t.remove()), e; + } + function v(e, t) { + return Object.entries(e).forEach(([n, r]) => t(n, r)); + } + function j(e) { + return typeof e > "u"; + } + function D(e, t, n, r) { + return e[(j(r) ? "remove" : "set") + t](n, r); + } + function z(e, t, n, r, o = null) { + return e[(j(r) ? "remove" : "set") + t + "NS"](o, n, r); + } + function S(e, t, n) { + return Reflect[j(n) ? "deleteProperty" : "set"](e, t, n); + } + + // src/events.js + function _(e, t, n) { + return (r) => (r.addEventListener(e, t, n), r); + } + var w = M(); + _.connected = function(e, t) { + return function(r) { + w.onConnected(r, e), t && t.signal && t.signal.addEventListener("abort", () => w.offConnected(r, e)); + }; + }; + _.disconnected = function(e, t) { + return function(r) { + w.onDisconnected(r, e), t && t.signal && t.signal.addEventListener("abort", () => w.offDisconnected(r, e)); + }; + }; + function M() { + let e = /* @__PURE__ */ new Map(), t = !1, n = new MutationObserver(function(c) { + for (let i of c) + if (i.type === "childList") { + if (b(i.addedNodes, !0)) { + s(); + continue; + } + N(i.removedNodes, !0) && s(); + } + }); + return { + onConnected(c, i) { + l(), o(c).connected.push(i); + }, + offConnected(c, i) { + if (!e.has(c)) + return; + let u = e.get(c), a = u.connected; + a.splice(a.indexOf(i), 1), r(c, u); + }, + onDisconnected(c, i) { + l(), o(c).disconnected.push(i); + }, + offDisconnected(c, i) { + if (!e.has(c)) + return; + let u = e.get(c), a = u.disconnected; + a.splice(a.indexOf(i), 1), r(c, u); + } + }; + function r(c, i) { + i.connected.length || i.disconnect.length || (e.delete(c), s()); + } + function o(c) { + if (e.has(c)) + return e.get(c); + let i = { connected: [], disconnected: [] }; + return e.set(c, i), i; + } + function l() { + t || (t = !0, n.observe(document.body, { childList: !0, subtree: !0 })); + } + function s() { + !t || e.size || (t = !1, n.disconnect()); + } + function f() { + return new Promise(function(c) { + (requestIdleCallback || requestAnimationFrame)(c); + }); + } + async function p(c) { + e.size > 30 && await f(); + let i = []; + if (!(c instanceof Node)) + return i; + for (let u of e.keys()) + u === c || !(u instanceof Node) || c.contains(u) && i.push(u); + return i; + } + function b(c, i) { + for (let u of c) { + if (i && p(u).then(b), !e.has(u)) + return !1; + let a = e.get(u); + return a.connected.forEach((O) => O(u)), a.connected.length = 0, a.disconnected.length || e.delete(u), !0; + } + } + function N(c, i) { + for (let u of c) { + if (i && p(u).then(N), !e.has(u)) + return !1; + let a = e.get(u); + return a.disconnected.forEach((O) => O(u)), a.connected.length = 0, a.disconnected.length = 0, e.delete(u), !0; + } + } + } + + // index.js + [HTMLElement, DocumentFragment].forEach((e) => { + let { append: t } = e.prototype; + e.prototype.append = function(...n) { + return t.apply(this, n), this; + }; + }); + + // src/signals-lib.js + var d = Symbol.for("signal"); + function x(e) { + try { + return Reflect.has(e, d); + } catch { + return !1; + } + } + function y(e, t) { + if (typeof e != "function") + return P(e, t); + if (x(e)) + return e; + let n = P(); + return F(() => n(e())), n; + } + y.action = function(e, t, ...n) { + if (!x(e)) + throw new Error(`'${e}' is not a signal!`); + let r = e[d], { actions: o } = r; + if (!o || !Reflect.has(o, t)) + throw new Error(`'${e}' has no action with name '${t}'!`); + if (o[t].apply(r, n), r.skip) + return Reflect.deleteProperty(r, "skip"); + r.listeners.forEach((l) => l(r.value)); + }; + y.on = function e(t, n, r) { + if (Array.isArray(t)) + return t.forEach((o) => e(o, n, r)); + L(t, n), r && r.signal && r.signal.addEventListener("abort", () => $(t, n)); + }; + y.clear = function(...e) { + for (let t of e) + t[d].listeners.clear(), Reflect.deleteProperty(t, d); + }; + var T = { + isReactiveAtrribute(e, t) { + return x(e); + }, + isTextContent(e) { + return h(e) === "string" || x(e) && h(G(e)) === "string"; + }, + processReactiveAttribute(e, t, n, r) { + return L(n, (o) => r([t, o])), n(); + }, + reactiveElement(e, t) { + let n = document.createComment("<> #reactive"), r = document.createComment(" #reactive"), o = document.createDocumentFragment(); + o.append(n, r); + let l = (s) => { + if (!n.parentNode || !r.parentNode) + return $(e, l); + let f = t(s); + Array.isArray(f) || (f = [f]); + let p = n; + for (; (p = n.nextSibling) !== r; ) + p.remove(); + n.after(...f); + }; + return L(e, l), l(e()), o; + } + }; + function P(e, t) { + let n = (...r) => r.length ? B(n, r[0]) : k(n); + return W(n, e, t); + } + var I = Object.assign(/* @__PURE__ */ Object.create(null), { + stopPropagation() { + this.skip = !0; + } + }); + function W(e, t, n) { + return h(n) !== "[object Object]" && (n = {}), e[d] = { + value: t, + actions: n, + listeners: /* @__PURE__ */ new Set() + }, Object.setPrototypeOf(e[d], I), e; + } + var g = []; + function F(e) { + let t = function() { + g.push(t), e(), g.pop(); + }; + g.push(t), e(), g.pop(); + } + function Z() { + return g[g.length - 1]; + } + function k(e) { + if (!e[d]) + return; + let { value: t, listeners: n } = e[d], r = Z(); + return r && n.add(r), t; + } + function B(e, t) { + if (!e[d]) + return; + let n = e[d]; + if (n.value !== t) + return n.value = t, n.listeners.forEach((r) => r(t)), t; + } + function G(e) { + return e[d].value; + } + function L(e, t) { + return e[d].listeners.add(t); + } + function $(e, t) { + return e[d].listeners.delete(t); + } + + // src/signals.js + R(T); + + globalThis.dde= { + S: y, + assign: C, + classListDeclartive: q, + createElement: Q, + el: Q, + empty: X, + isSignal: x, + namespace: K, + on: _, + registerReactivity: R, + watch: F + }; + +})(); \ No newline at end of file diff --git a/dist/dde.js b/dist/dde.js new file mode 100644 index 0000000..976f604 --- /dev/null +++ b/dist/dde.js @@ -0,0 +1,237 @@ +//deka-dom-el library is available via global namespace `dde` +(()=> { + // src/helpers.js + function R(e) { + let t = typeof e; + return t !== "object" ? t : e === null ? "null" : Object.prototype.toString.call(e); + } + + // src/signals-common.js + var l = { + isReactiveAtrribute(e, t) { + return !1; + }, + isTextContent(e) { + return R(e) !== "[object Object]"; + }, + processReactiveAttribute(e, t, o, n) { + return !1; + }, + reactiveElement(e, ...t) { + return document.createDocumentFragment(); + } + }; + function y(e, t = !0) { + return t ? Object.assign(l, e) : (Object.setPrototypeOf(e, l), e); + } + function v(e) { + return l.isPrototypeOf(e) && e !== l ? e : l; + } + + // src/dom.js + var b = "html"; + function q(e) { + return b = e === "svg" ? "http://www.w3.org/2000/svg" : e, { + append(t) { + return b = "html", t; + } + }; + } + function z(e, t, ...o) { + let n = v(this), u; + if (e === "<>") { + if (n.isReactiveAtrribute(t)) + return n.reactiveElement(t, ...o); + u = document.createDocumentFragment(); + } + switch (n.isTextContent(t) && (t = { textContent: t }), !0) { + case typeof e == "function": + u = e(t || void 0); + break; + case e === "#text": + u = E(document.createTextNode(""), t); + break; + case b !== "html": + u = E(document.createElementNS(b, e), t); + break; + default: + u = E(document.createElement(e), t); + } + return o.forEach((d) => d(u)), u; + } + function E(e, ...t) { + let o = v(this); + if (!t.length) + return e; + let n = e instanceof SVGElement, u = (n ? L : A).bind(null, e, "Attribute"); + return Object.entries(Object.assign({}, ...t)).forEach(function d([i, f]) { + if (o.isReactiveAtrribute(f, i) && (f = o.processReactiveAttribute(el, i, f, d)), i[0] === "=") + return u(i.slice(1), f); + if (i[0] === ".") + return w(e, i.slice(1), f); + if (typeof f == "object") + switch (i) { + case "style": + return g(f, A.bind(null, e.style, "Property")); + case "dataset": + return g(f, w.bind(null, e.dataset)); + case "ariaset": + return g(f, (p, h) => u("aria-" + p, h)); + case "classList": + return N(e, f); + default: + return Reflect.set(e, i, f); + } + if (/(aria|data)([A-Z])/.test(i)) + return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), u(i, f); + switch (i) { + case "href": + return u(i, f); + case "xlink:href": + return u(i, f, "http://www.w3.org/1999/xlink"); + case "textContent": + if (!n) + break; + return e.appendChild(document.createTextNode(f)); + } + return i in e && !n ? w(e, i, f) : u(i, f); + }), e; + } + function N(e, t) { + return typeof t != "object" || g( + t, + (o, n) => e.classList.toggle(o, n === -1 ? void 0 : !!n) + ), e; + } + function M(e) { + return Array.from(e.children).forEach((t) => t.remove()), e; + } + function g(e, t) { + return Object.entries(e).forEach(([o, n]) => t(o, n)); + } + function O(e) { + return typeof e > "u"; + } + function A(e, t, o, n) { + return e[(O(n) ? "remove" : "set") + t](o, n); + } + function L(e, t, o, n, u = null) { + return e[(O(n) ? "remove" : "set") + t + "NS"](u, o, n); + } + function w(e, t, o) { + return Reflect[O(o) ? "deleteProperty" : "set"](e, t, o); + } + + // src/events.js + function j(e, t, o) { + return (n) => (n.addEventListener(e, t, o), n); + } + var m = D(); + j.connected = function(e, t) { + return function(n) { + m.onConnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => m.offConnected(n, e)); + }; + }; + j.disconnected = function(e, t) { + return function(n) { + m.onDisconnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => m.offDisconnected(n, e)); + }; + }; + function D() { + let e = /* @__PURE__ */ new Map(), t = !1, o = new MutationObserver(function(r) { + for (let c of r) + if (c.type === "childList") { + if (h(c.addedNodes, !0)) { + i(); + continue; + } + C(c.removedNodes, !0) && i(); + } + }); + return { + onConnected(r, c) { + d(), u(r).connected.push(c); + }, + offConnected(r, c) { + if (!e.has(r)) + return; + let s = e.get(r), a = s.connected; + a.splice(a.indexOf(c), 1), n(r, s); + }, + onDisconnected(r, c) { + d(), u(r).disconnected.push(c); + }, + offDisconnected(r, c) { + if (!e.has(r)) + return; + let s = e.get(r), a = s.disconnected; + a.splice(a.indexOf(c), 1), n(r, s); + } + }; + function n(r, c) { + c.connected.length || c.disconnect.length || (e.delete(r), i()); + } + function u(r) { + if (e.has(r)) + return e.get(r); + let c = { connected: [], disconnected: [] }; + return e.set(r, c), c; + } + function d() { + t || (t = !0, o.observe(document.body, { childList: !0, subtree: !0 })); + } + function i() { + !t || e.size || (t = !1, o.disconnect()); + } + function f() { + return new Promise(function(r) { + (requestIdleCallback || requestAnimationFrame)(r); + }); + } + async function p(r) { + e.size > 30 && await f(); + let c = []; + if (!(r instanceof Node)) + return c; + for (let s of e.keys()) + s === r || !(s instanceof Node) || r.contains(s) && c.push(s); + return c; + } + function h(r, c) { + for (let s of r) { + if (c && p(s).then(h), !e.has(s)) + return !1; + let a = e.get(s); + return a.connected.forEach((x) => x(s)), a.connected.length = 0, a.disconnected.length || e.delete(s), !0; + } + } + function C(r, c) { + for (let s of r) { + if (c && p(s).then(C), !e.has(s)) + return !1; + let a = e.get(s); + return a.disconnected.forEach((x) => x(s)), a.connected.length = 0, a.disconnected.length = 0, e.delete(s), !0; + } + } + } + + // index.js + [HTMLElement, DocumentFragment].forEach((e) => { + let { append: t } = e.prototype; + e.prototype.append = function(...o) { + return t.apply(this, o), this; + }; + }); + + globalThis.dde= { + assign: E, + classListDeclartive: N, + createElement: z, + el: z, + empty: M, + namespace: q, + on: j, + registerReactivity: y + }; + +})(); \ No newline at end of file diff --git a/dist/esm-with-signals.js b/dist/esm-with-signals.js new file mode 100644 index 0000000..c9e6f5d --- /dev/null +++ b/dist/esm-with-signals.js @@ -0,0 +1,349 @@ +// src/helpers.js +function h(e) { + let t = typeof e; + return t !== "object" ? t : e === null ? "null" : Object.prototype.toString.call(e); +} + +// src/signals-common.js +var m = { + isReactiveAtrribute(e, t) { + return !1; + }, + isTextContent(e) { + return h(e) !== "[object Object]"; + }, + processReactiveAttribute(e, t, n, r) { + return !1; + }, + reactiveElement(e, ...t) { + return document.createDocumentFragment(); + } +}; +function R(e, t = !0) { + return t ? Object.assign(m, e) : (Object.setPrototypeOf(e, m), e); +} +function A(e) { + return m.isPrototypeOf(e) && e !== m ? e : m; +} + +// src/dom.js +var E = "html"; +function K(e) { + return E = e === "svg" ? "http://www.w3.org/2000/svg" : e, { + append(t) { + return E = "html", t; + } + }; +} +function Q(e, t, ...n) { + let r = A(this), o; + if (e === "<>") { + if (r.isReactiveAtrribute(t)) + return r.reactiveElement(t, ...n); + o = document.createDocumentFragment(); + } + switch (r.isTextContent(t) && (t = { textContent: t }), !0) { + case typeof e == "function": + o = e(t || void 0); + break; + case e === "#text": + o = C(document.createTextNode(""), t); + break; + case E !== "html": + o = C(document.createElementNS(E, e), t); + break; + default: + o = C(document.createElement(e), t); + } + return n.forEach((l) => l(o)), o; +} +function C(e, ...t) { + let n = A(this); + if (!t.length) + return e; + let r = e instanceof SVGElement, o = (r ? z : D).bind(null, e, "Attribute"); + return Object.entries(Object.assign({}, ...t)).forEach(function l([s, f]) { + if (n.isReactiveAtrribute(f, s) && (f = n.processReactiveAttribute(el, s, f, l)), s[0] === "=") + return o(s.slice(1), f); + if (s[0] === ".") + return S(e, s.slice(1), f); + if (typeof f == "object") + switch (s) { + case "style": + return v(f, D.bind(null, e.style, "Property")); + case "dataset": + return v(f, S.bind(null, e.dataset)); + case "ariaset": + return v(f, (p, b) => o("aria-" + p, b)); + case "classList": + return q(e, f); + default: + return Reflect.set(e, s, f); + } + if (/(aria|data)([A-Z])/.test(s)) + return s = s.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o(s, f); + switch (s) { + case "href": + return o(s, f); + case "xlink:href": + return o(s, f, "http://www.w3.org/1999/xlink"); + case "textContent": + if (!r) + break; + return e.appendChild(document.createTextNode(f)); + } + return s in e && !r ? S(e, s, f) : o(s, f); + }), e; +} +function q(e, t) { + return typeof t != "object" || v( + t, + (n, r) => e.classList.toggle(n, r === -1 ? void 0 : !!r) + ), e; +} +function X(e) { + return Array.from(e.children).forEach((t) => t.remove()), e; +} +function v(e, t) { + return Object.entries(e).forEach(([n, r]) => t(n, r)); +} +function j(e) { + return typeof e > "u"; +} +function D(e, t, n, r) { + return e[(j(r) ? "remove" : "set") + t](n, r); +} +function z(e, t, n, r, o = null) { + return e[(j(r) ? "remove" : "set") + t + "NS"](o, n, r); +} +function S(e, t, n) { + return Reflect[j(n) ? "deleteProperty" : "set"](e, t, n); +} + +// src/events.js +function _(e, t, n) { + return (r) => (r.addEventListener(e, t, n), r); +} +var w = M(); +_.connected = function(e, t) { + return function(r) { + w.onConnected(r, e), t && t.signal && t.signal.addEventListener("abort", () => w.offConnected(r, e)); + }; +}; +_.disconnected = function(e, t) { + return function(r) { + w.onDisconnected(r, e), t && t.signal && t.signal.addEventListener("abort", () => w.offDisconnected(r, e)); + }; +}; +function M() { + let e = /* @__PURE__ */ new Map(), t = !1, n = new MutationObserver(function(c) { + for (let i of c) + if (i.type === "childList") { + if (b(i.addedNodes, !0)) { + s(); + continue; + } + N(i.removedNodes, !0) && s(); + } + }); + return { + onConnected(c, i) { + l(), o(c).connected.push(i); + }, + offConnected(c, i) { + if (!e.has(c)) + return; + let u = e.get(c), a = u.connected; + a.splice(a.indexOf(i), 1), r(c, u); + }, + onDisconnected(c, i) { + l(), o(c).disconnected.push(i); + }, + offDisconnected(c, i) { + if (!e.has(c)) + return; + let u = e.get(c), a = u.disconnected; + a.splice(a.indexOf(i), 1), r(c, u); + } + }; + function r(c, i) { + i.connected.length || i.disconnect.length || (e.delete(c), s()); + } + function o(c) { + if (e.has(c)) + return e.get(c); + let i = { connected: [], disconnected: [] }; + return e.set(c, i), i; + } + function l() { + t || (t = !0, n.observe(document.body, { childList: !0, subtree: !0 })); + } + function s() { + !t || e.size || (t = !1, n.disconnect()); + } + function f() { + return new Promise(function(c) { + (requestIdleCallback || requestAnimationFrame)(c); + }); + } + async function p(c) { + e.size > 30 && await f(); + let i = []; + if (!(c instanceof Node)) + return i; + for (let u of e.keys()) + u === c || !(u instanceof Node) || c.contains(u) && i.push(u); + return i; + } + function b(c, i) { + for (let u of c) { + if (i && p(u).then(b), !e.has(u)) + return !1; + let a = e.get(u); + return a.connected.forEach((O) => O(u)), a.connected.length = 0, a.disconnected.length || e.delete(u), !0; + } + } + function N(c, i) { + for (let u of c) { + if (i && p(u).then(N), !e.has(u)) + return !1; + let a = e.get(u); + return a.disconnected.forEach((O) => O(u)), a.connected.length = 0, a.disconnected.length = 0, e.delete(u), !0; + } + } +} + +// index.js +[HTMLElement, DocumentFragment].forEach((e) => { + let { append: t } = e.prototype; + e.prototype.append = function(...n) { + return t.apply(this, n), this; + }; +}); + +// src/signals-lib.js +var d = Symbol.for("signal"); +function x(e) { + try { + return Reflect.has(e, d); + } catch { + return !1; + } +} +function y(e, t) { + if (typeof e != "function") + return P(e, t); + if (x(e)) + return e; + let n = P(); + return F(() => n(e())), n; +} +y.action = function(e, t, ...n) { + if (!x(e)) + throw new Error(`'${e}' is not a signal!`); + let r = e[d], { actions: o } = r; + if (!o || !Reflect.has(o, t)) + throw new Error(`'${e}' has no action with name '${t}'!`); + if (o[t].apply(r, n), r.skip) + return Reflect.deleteProperty(r, "skip"); + r.listeners.forEach((l) => l(r.value)); +}; +y.on = function e(t, n, r) { + if (Array.isArray(t)) + return t.forEach((o) => e(o, n, r)); + L(t, n), r && r.signal && r.signal.addEventListener("abort", () => $(t, n)); +}; +y.clear = function(...e) { + for (let t of e) + t[d].listeners.clear(), Reflect.deleteProperty(t, d); +}; +var T = { + isReactiveAtrribute(e, t) { + return x(e); + }, + isTextContent(e) { + return h(e) === "string" || x(e) && h(G(e)) === "string"; + }, + processReactiveAttribute(e, t, n, r) { + return L(n, (o) => r([t, o])), n(); + }, + reactiveElement(e, t) { + let n = document.createComment("<> #reactive"), r = document.createComment(" #reactive"), o = document.createDocumentFragment(); + o.append(n, r); + let l = (s) => { + if (!n.parentNode || !r.parentNode) + return $(e, l); + let f = t(s); + Array.isArray(f) || (f = [f]); + let p = n; + for (; (p = n.nextSibling) !== r; ) + p.remove(); + n.after(...f); + }; + return L(e, l), l(e()), o; + } +}; +function P(e, t) { + let n = (...r) => r.length ? B(n, r[0]) : k(n); + return W(n, e, t); +} +var I = Object.assign(/* @__PURE__ */ Object.create(null), { + stopPropagation() { + this.skip = !0; + } +}); +function W(e, t, n) { + return h(n) !== "[object Object]" && (n = {}), e[d] = { + value: t, + actions: n, + listeners: /* @__PURE__ */ new Set() + }, Object.setPrototypeOf(e[d], I), e; +} +var g = []; +function F(e) { + let t = function() { + g.push(t), e(), g.pop(); + }; + g.push(t), e(), g.pop(); +} +function Z() { + return g[g.length - 1]; +} +function k(e) { + if (!e[d]) + return; + let { value: t, listeners: n } = e[d], r = Z(); + return r && n.add(r), t; +} +function B(e, t) { + if (!e[d]) + return; + let n = e[d]; + if (n.value !== t) + return n.value = t, n.listeners.forEach((r) => r(t)), t; +} +function G(e) { + return e[d].value; +} +function L(e, t) { + return e[d].listeners.add(t); +} +function $(e, t) { + return e[d].listeners.delete(t); +} + +// src/signals.js +R(T); +export { + y as S, + C as assign, + q as classListDeclartive, + Q as createElement, + Q as el, + X as empty, + x as isSignal, + K as namespace, + _ as on, + R as registerReactivity, + F as watch +}; diff --git a/dist/esm.js b/dist/esm.js new file mode 100644 index 0000000..cdca3ca --- /dev/null +++ b/dist/esm.js @@ -0,0 +1,232 @@ +// src/helpers.js +function R(e) { + let t = typeof e; + return t !== "object" ? t : e === null ? "null" : Object.prototype.toString.call(e); +} + +// src/signals-common.js +var l = { + isReactiveAtrribute(e, t) { + return !1; + }, + isTextContent(e) { + return R(e) !== "[object Object]"; + }, + processReactiveAttribute(e, t, o, n) { + return !1; + }, + reactiveElement(e, ...t) { + return document.createDocumentFragment(); + } +}; +function y(e, t = !0) { + return t ? Object.assign(l, e) : (Object.setPrototypeOf(e, l), e); +} +function v(e) { + return l.isPrototypeOf(e) && e !== l ? e : l; +} + +// src/dom.js +var b = "html"; +function q(e) { + return b = e === "svg" ? "http://www.w3.org/2000/svg" : e, { + append(t) { + return b = "html", t; + } + }; +} +function z(e, t, ...o) { + let n = v(this), u; + if (e === "<>") { + if (n.isReactiveAtrribute(t)) + return n.reactiveElement(t, ...o); + u = document.createDocumentFragment(); + } + switch (n.isTextContent(t) && (t = { textContent: t }), !0) { + case typeof e == "function": + u = e(t || void 0); + break; + case e === "#text": + u = E(document.createTextNode(""), t); + break; + case b !== "html": + u = E(document.createElementNS(b, e), t); + break; + default: + u = E(document.createElement(e), t); + } + return o.forEach((d) => d(u)), u; +} +function E(e, ...t) { + let o = v(this); + if (!t.length) + return e; + let n = e instanceof SVGElement, u = (n ? L : A).bind(null, e, "Attribute"); + return Object.entries(Object.assign({}, ...t)).forEach(function d([i, f]) { + if (o.isReactiveAtrribute(f, i) && (f = o.processReactiveAttribute(el, i, f, d)), i[0] === "=") + return u(i.slice(1), f); + if (i[0] === ".") + return w(e, i.slice(1), f); + if (typeof f == "object") + switch (i) { + case "style": + return g(f, A.bind(null, e.style, "Property")); + case "dataset": + return g(f, w.bind(null, e.dataset)); + case "ariaset": + return g(f, (p, h) => u("aria-" + p, h)); + case "classList": + return N(e, f); + default: + return Reflect.set(e, i, f); + } + if (/(aria|data)([A-Z])/.test(i)) + return i = i.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), u(i, f); + switch (i) { + case "href": + return u(i, f); + case "xlink:href": + return u(i, f, "http://www.w3.org/1999/xlink"); + case "textContent": + if (!n) + break; + return e.appendChild(document.createTextNode(f)); + } + return i in e && !n ? w(e, i, f) : u(i, f); + }), e; +} +function N(e, t) { + return typeof t != "object" || g( + t, + (o, n) => e.classList.toggle(o, n === -1 ? void 0 : !!n) + ), e; +} +function M(e) { + return Array.from(e.children).forEach((t) => t.remove()), e; +} +function g(e, t) { + return Object.entries(e).forEach(([o, n]) => t(o, n)); +} +function O(e) { + return typeof e > "u"; +} +function A(e, t, o, n) { + return e[(O(n) ? "remove" : "set") + t](o, n); +} +function L(e, t, o, n, u = null) { + return e[(O(n) ? "remove" : "set") + t + "NS"](u, o, n); +} +function w(e, t, o) { + return Reflect[O(o) ? "deleteProperty" : "set"](e, t, o); +} + +// src/events.js +function j(e, t, o) { + return (n) => (n.addEventListener(e, t, o), n); +} +var m = D(); +j.connected = function(e, t) { + return function(n) { + m.onConnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => m.offConnected(n, e)); + }; +}; +j.disconnected = function(e, t) { + return function(n) { + m.onDisconnected(n, e), t && t.signal && t.signal.addEventListener("abort", () => m.offDisconnected(n, e)); + }; +}; +function D() { + let e = /* @__PURE__ */ new Map(), t = !1, o = new MutationObserver(function(r) { + for (let c of r) + if (c.type === "childList") { + if (h(c.addedNodes, !0)) { + i(); + continue; + } + C(c.removedNodes, !0) && i(); + } + }); + return { + onConnected(r, c) { + d(), u(r).connected.push(c); + }, + offConnected(r, c) { + if (!e.has(r)) + return; + let s = e.get(r), a = s.connected; + a.splice(a.indexOf(c), 1), n(r, s); + }, + onDisconnected(r, c) { + d(), u(r).disconnected.push(c); + }, + offDisconnected(r, c) { + if (!e.has(r)) + return; + let s = e.get(r), a = s.disconnected; + a.splice(a.indexOf(c), 1), n(r, s); + } + }; + function n(r, c) { + c.connected.length || c.disconnect.length || (e.delete(r), i()); + } + function u(r) { + if (e.has(r)) + return e.get(r); + let c = { connected: [], disconnected: [] }; + return e.set(r, c), c; + } + function d() { + t || (t = !0, o.observe(document.body, { childList: !0, subtree: !0 })); + } + function i() { + !t || e.size || (t = !1, o.disconnect()); + } + function f() { + return new Promise(function(r) { + (requestIdleCallback || requestAnimationFrame)(r); + }); + } + async function p(r) { + e.size > 30 && await f(); + let c = []; + if (!(r instanceof Node)) + return c; + for (let s of e.keys()) + s === r || !(s instanceof Node) || r.contains(s) && c.push(s); + return c; + } + function h(r, c) { + for (let s of r) { + if (c && p(s).then(h), !e.has(s)) + return !1; + let a = e.get(s); + return a.connected.forEach((x) => x(s)), a.connected.length = 0, a.disconnected.length || e.delete(s), !0; + } + } + function C(r, c) { + for (let s of r) { + if (c && p(s).then(C), !e.has(s)) + return !1; + let a = e.get(s); + return a.disconnected.forEach((x) => x(s)), a.connected.length = 0, a.disconnected.length = 0, e.delete(s), !0; + } + } +} + +// index.js +[HTMLElement, DocumentFragment].forEach((e) => { + let { append: t } = e.prototype; + e.prototype.append = function(...o) { + return t.apply(this, o), this; + }; +}); +export { + E as assign, + N as classListDeclartive, + z as createElement, + z as el, + M as empty, + q as namespace, + j as on, + y as registerReactivity +}; diff --git a/index-with-signals.js b/index-with-signals.js new file mode 100644 index 0000000..12cccf7 --- /dev/null +++ b/index-with-signals.js @@ -0,0 +1,2 @@ +export * from "./index.js"; +export * from "./src/signals.js"; diff --git a/index.d.ts b/index.d.ts index 7f373fd..61ee3fc 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,15 +1,14 @@ -/** - * @private - */ -type T_DOM_HETNM= HTMLElementTagNameMap & SVGElementTagNameMap & { - '<>': DocumentFragment, - '': HTMLElement, - 'zzz_text': Text +import { Signal } from "./src/signals"; +//TODO? +declare global { + type ddeFires= ( (...a: any[])=> any ) & { events: T }; + type ddeSignal= Signal; } -/** - * @private - */ -type T_DOM_ATTRS_MODIFIED= { +type ElementTagNameMap= HTMLElementTagNameMap & SVGElementTagNameMap & { + '#text': Text +} +type Element= ElementTagNameMap[keyof ElementTagNameMap]; +type AttrsModified= { /** * In fact argumen for `*.setAttribute("style", *)`. */ @@ -17,7 +16,11 @@ type T_DOM_ATTRS_MODIFIED= { /** * Provide option to add/remove/toggle CSS clasess (index of object) using 1/0/-1. In fact `el.classList.toggle(class_name)` for `-1` and `el.classList.toggle(class_name, Boolean(...))` for others. */ - classList: Record + classList: Record, + /** + * Sets `aria-*` simiraly to `dataset` + * */ + ariaset: Record, } /** * Just element attributtes @@ -27,53 +30,172 @@ type T_DOM_ATTRS_MODIFIED= { * There is added support for `data[A-Z].*`/`aria[A-Z].*` to be converted to the kebab-case alternatives. * @private */ -type T_DOM_ATTRS= - T extends keyof T_DOM_HETNM ? - Omit & T_DOM_ATTRS_MODIFIED : - Omit & T_DOM_ATTRS_MODIFIED; -/** - * Procedure for merging object into the element properties. - * Very simple example: `$dom.assign(document.body, { className: "test" });` is equivalent to `document.body.className= "test";`. - * It is not deep copy in general, but it supports `style`, `style_vars` and `dataset` objects (see below). - * - * **#1: All together** - * ```javascript - * const el= document.body; - * const onclick= function(){ console.log(this.dataset.js_param); }; - * $dom.assign(el, { textContent: "BODY", style: "color: red;", dataset: { js_param: "CLICKED" }, onclick }); - * //result HTML: BODY - * //console output on click: "CLICKED" - * $dom.assign(el, { style: { color: "green" } }); - * //result HTML: BODY - * //console output on click: "CLICKED" - * ``` - * - * **`\*.classList.toggle`** - * ```javascript - * const el= document.body; - * $dom.assign(el, { classList: { testClass: -1 } }); - * //result HTML: … - * $dom.assign(el, { classList: { testClass: -1 } }); - * //result HTML: … - * - * $dom.assign(el, { classList: { testClass: true } });//or 1 - * //result HTML: … - * $dom.assign(el, { classList: { testClass: false } });//or 0 - * //result HTML: … - * //... - * ``` - * - * **#3 Links and images** - * ```javascript - * $dom.assign(A_ELEMENT, { href: "www.google.com" });//=> - * ``` - * @category Public - * @version 2.0.0 - */ -export function assign(element: EL, ...attrs_array: T_DOM_ATTRS[]): EL +type ElementAttributes= + T extends keyof ElementTagNameMap ? + Omit & AttrsModified : + Omit & AttrsModified; +export function assign(element: El, ...attrs_array: ElementAttributes[]): El -export function el(tag_name: TAG, attrs: T_DOM_ATTRS): T_DOM_HETNM[TAG] +type ElementExtender= (element: El)=> El; +type TagNameFragment= "<>"; +export function el( + tag_name: TAG, + attrs?: ElementAttributes, + ...extenders: ElementExtender[] +): ElementTagNameMap[TAG] +export function el( + tag_name: TagNameFragment, + signal?: Signal, + cb?: (a: T)=> HTMLElement | HTMLElement[] +): DocumentFragment +export function el Element>( + fComponent: T, + attrs?: Parameters & ElementAttributes>, + ...extenders: ElementExtender>[] +): ReturnType + +interface On{ + < + EE extends ElementExtender, + El extends ( EE extends ElementExtender ? El : never ), + Event extends keyof DocumentEventMap>( + type: Event, + listener: (this: El, ev: DocumentEventMap[Event]) => any, + options?: AddEventListenerOptions + ) : EE; + connected< + EE extends ElementExtender, + El extends ( EE extends ElementExtender ? El : never ) + >( + listener: (el: El) => any, + options?: AddEventListenerOptions + ) : EE; + disconnected< + EE extends ElementExtender, + El extends ( EE extends ElementExtender ? El : never ) + >( + listener: (el: El) => any, + options?: AddEventListenerOptions + ) : EE; +} +export const on: On; + +//TODO? +export type Fires= ( (...a: any[])=> any ) & { events: T }; + +//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; } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..9c01e1f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1981 @@ +{ + "name": "deka-dom-el", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "deka-dom-el", + "version": "0.1.0", + "license": "MIT", + "devDependencies": { + "@size-limit/preset-small-lib": "^8.2.6", + "esbuild": "^0.19.2", + "nodejsscript": "github:jaandrle/nodejsscript#dev-v1", + "size-limit-node-esbuild": "^0.2.0" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.2.tgz", + "integrity": "sha512-tM8yLeYVe7pRyAu9VMi/Q7aunpLwD139EY1S99xbQkT4/q2qa6eA4ige/WJQYdJ8GBL1K33pPFhPfPdJ/WzT8Q==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.19.2.tgz", + "integrity": "sha512-lsB65vAbe90I/Qe10OjkmrdxSX4UJDjosDgb8sZUKcg3oefEuW2OT2Vozz8ef7wrJbMcmhvCC+hciF8jY/uAkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.19.2.tgz", + "integrity": "sha512-qK/TpmHt2M/Hg82WXHRc/W/2SGo/l1thtDHZWqFq7oi24AjZ4O/CpPSu6ZuYKFkEgmZlFoa7CooAyYmuvnaG8w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.19.2.tgz", + "integrity": "sha512-Ora8JokrvrzEPEpZO18ZYXkH4asCdc1DLdcVy8TGf5eWtPO1Ie4WroEJzwI52ZGtpODy3+m0a2yEX9l+KUn0tA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.19.2.tgz", + "integrity": "sha512-tP+B5UuIbbFMj2hQaUr6EALlHOIOmlLM2FK7jeFBobPy2ERdohI4Ka6ZFjZ1ZYsrHE/hZimGuU90jusRE0pwDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.19.2.tgz", + "integrity": "sha512-YbPY2kc0acfzL1VPVK6EnAlig4f+l8xmq36OZkU0jzBVHcOTyQDhnKQaLzZudNJQyymd9OqQezeaBgkTGdTGeQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.19.2.tgz", + "integrity": "sha512-nSO5uZT2clM6hosjWHAsS15hLrwCvIWx+b2e3lZ3MwbYSaXwvfO528OF+dLjas1g3bZonciivI8qKR/Hm7IWGw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.19.2.tgz", + "integrity": "sha512-Odalh8hICg7SOD7XCj0YLpYCEc+6mkoq63UnExDCiRA2wXEmGlK5JVrW50vZR9Qz4qkvqnHcpH+OFEggO3PgTg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.19.2.tgz", + "integrity": "sha512-ig2P7GeG//zWlU0AggA3pV1h5gdix0MA3wgB+NsnBXViwiGgY77fuN9Wr5uoCrs2YzaYfogXgsWZbm+HGr09xg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.19.2.tgz", + "integrity": "sha512-mLfp0ziRPOLSTek0Gd9T5B8AtzKAkoZE70fneiiyPlSnUKKI4lp+mGEnQXcQEHLJAcIYDPSyBvsUbKUG2ri/XQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.19.2.tgz", + "integrity": "sha512-hn28+JNDTxxCpnYjdDYVMNTR3SKavyLlCHHkufHV91fkewpIyQchS1d8wSbmXhs1fiYDpNww8KTFlJ1dHsxeSw==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.19.2.tgz", + "integrity": "sha512-KbXaC0Sejt7vD2fEgPoIKb6nxkfYW9OmFUK9XQE4//PvGIxNIfPk1NmlHmMg6f25x57rpmEFrn1OotASYIAaTg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.19.2.tgz", + "integrity": "sha512-dJ0kE8KTqbiHtA3Fc/zn7lCd7pqVr4JcT0JqOnbj4LLzYnp+7h8Qi4yjfq42ZlHfhOCM42rBh0EwHYLL6LEzcw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.19.2.tgz", + "integrity": "sha512-7Z/jKNFufZ/bbu4INqqCN6DDlrmOTmdw6D0gH+6Y7auok2r02Ur661qPuXidPOJ+FSgbEeQnnAGgsVynfLuOEw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.19.2.tgz", + "integrity": "sha512-U+RinR6aXXABFCcAY4gSlv4CL1oOVvSSCdseQmGO66H+XyuQGZIUdhG56SZaDJQcLmrSfRmx5XZOWyCJPRqS7g==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.19.2.tgz", + "integrity": "sha512-oxzHTEv6VPm3XXNaHPyUTTte+3wGv7qVQtqaZCrgstI16gCuhNOtBXLEBkBREP57YTd68P0VgDgG73jSD8bwXQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.19.2.tgz", + "integrity": "sha512-WNa5zZk1XpTTwMDompZmvQLHszDDDN7lYjEHCUmAGB83Bgs20EMs7ICD+oKeT6xt4phV4NDdSi/8OfjPbSbZfQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.19.2.tgz", + "integrity": "sha512-S6kI1aT3S++Dedb7vxIuUOb3oAxqxk2Rh5rOXOTYnzN8JzW1VzBd+IqPiSpgitu45042SYD3HCoEyhLKQcDFDw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.19.2.tgz", + "integrity": "sha512-VXSSMsmb+Z8LbsQGcBMiM+fYObDNRm8p7tkUDMPG/g4fhFX5DEFmjxIEa3N8Zr96SjsJ1woAhF0DUnS3MF3ARw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.19.2.tgz", + "integrity": "sha512-5NayUlSAyb5PQYFAU9x3bHdsqB88RC3aM9lKDAz4X1mo/EchMIT1Q+pSeBXNgkfNmRecLXA0O8xP+x8V+g/LKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.19.2.tgz", + "integrity": "sha512-47gL/ek1v36iN0wL9L4Q2MFdujR0poLZMJwhO2/N3gA89jgHp4MR8DKCmwYtGNksbfJb9JoTtbkoe6sDhg2QTA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.19.2.tgz", + "integrity": "sha512-tcuhV7ncXBqbt/Ybf0IyrMcwVOAPDckMK9rXNHtF17UTK18OKLpg08glminN06pt2WCoALhXdLfSPbVvK/6fxw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@size-limit/esbuild": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@size-limit/esbuild/-/esbuild-8.2.6.tgz", + "integrity": "sha512-a4c8xVDuDMYw5jF655ADjQDluw3jGPPYer6UJock5rSnUlWnIbmT/Ohud7gJGq5gqyLUQOCrBD7NB3g+mlhj4g==", + "dev": true, + "dependencies": { + "esbuild": "^0.18.6", + "nanoid": "^3.3.6" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "size-limit": "8.2.6" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/android-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.20.tgz", + "integrity": "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/android-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.20.tgz", + "integrity": "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/android-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.20.tgz", + "integrity": "sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/darwin-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.20.tgz", + "integrity": "sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/darwin-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.20.tgz", + "integrity": "sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/freebsd-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.20.tgz", + "integrity": "sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/freebsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.20.tgz", + "integrity": "sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-arm": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.20.tgz", + "integrity": "sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.20.tgz", + "integrity": "sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.20.tgz", + "integrity": "sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-loong64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.20.tgz", + "integrity": "sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-mips64el": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.20.tgz", + "integrity": "sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-ppc64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.20.tgz", + "integrity": "sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-riscv64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.20.tgz", + "integrity": "sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-s390x": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.20.tgz", + "integrity": "sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/linux-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.20.tgz", + "integrity": "sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/netbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.20.tgz", + "integrity": "sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/openbsd-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.20.tgz", + "integrity": "sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/sunos-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.20.tgz", + "integrity": "sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/win32-arm64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.20.tgz", + "integrity": "sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/win32-ia32": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.20.tgz", + "integrity": "sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/@esbuild/win32-x64": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.20.tgz", + "integrity": "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/@size-limit/esbuild/node_modules/esbuild": { + "version": "0.18.20", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", + "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.18.20", + "@esbuild/android-arm64": "0.18.20", + "@esbuild/android-x64": "0.18.20", + "@esbuild/darwin-arm64": "0.18.20", + "@esbuild/darwin-x64": "0.18.20", + "@esbuild/freebsd-arm64": "0.18.20", + "@esbuild/freebsd-x64": "0.18.20", + "@esbuild/linux-arm": "0.18.20", + "@esbuild/linux-arm64": "0.18.20", + "@esbuild/linux-ia32": "0.18.20", + "@esbuild/linux-loong64": "0.18.20", + "@esbuild/linux-mips64el": "0.18.20", + "@esbuild/linux-ppc64": "0.18.20", + "@esbuild/linux-riscv64": "0.18.20", + "@esbuild/linux-s390x": "0.18.20", + "@esbuild/linux-x64": "0.18.20", + "@esbuild/netbsd-x64": "0.18.20", + "@esbuild/openbsd-x64": "0.18.20", + "@esbuild/sunos-x64": "0.18.20", + "@esbuild/win32-arm64": "0.18.20", + "@esbuild/win32-ia32": "0.18.20", + "@esbuild/win32-x64": "0.18.20" + } + }, + "node_modules/@size-limit/file": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@size-limit/file/-/file-8.2.6.tgz", + "integrity": "sha512-B7ayjxiJsbtXdIIWazJkB5gezi5WBMecdHTFPMDhI3NwEML1RVvUjAkrb1mPAAkIpt2LVHPnhdCUHjqDdjugwg==", + "dev": true, + "dependencies": { + "semver": "7.5.3" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + }, + "peerDependencies": { + "size-limit": "8.2.6" + } + }, + "node_modules/@size-limit/preset-small-lib": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/@size-limit/preset-small-lib/-/preset-small-lib-8.2.6.tgz", + "integrity": "sha512-roanEuscDaaXDsT5Cg9agMbmsQVlMr66eRg3AwT2o4vE7WFLR8Z42p0AHZiwucW1nGpCxAh8E08Qa/yyVuj5nA==", + "dev": true, + "dependencies": { + "@size-limit/esbuild": "8.2.6", + "@size-limit/file": "8.2.6", + "size-limit": "8.2.6" + }, + "peerDependencies": { + "size-limit": "8.2.6" + } + }, + "node_modules/@types/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==", + "dev": true, + "dependencies": { + "@types/minimatch": "*", + "@types/node": "*" + } + }, + "node_modules/@types/minimatch": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-5.1.2.tgz", + "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", + "dev": true + }, + "node_modules/@types/mri": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@types/mri/-/mri-1.1.1.tgz", + "integrity": "sha512-nJOuiTlsvmClSr3+a/trTSx4DTuY/VURsWGKSf/eeavh0LRMqdsK60ti0TlwM5iHiGOK3/Ibkxsbr7i9rzGreA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "20.5.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.5.6.tgz", + "integrity": "sha512-Gi5wRGPbbyOTX+4Y2iULQ27oUPrefaB0PxGQJnfyWN3kvEDGM3mIB5M/gQLmitZf7A9FmLeaqxD3L1CXpm3VKQ==", + "dev": true + }, + "node_modules/@types/sade": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/@types/sade/-/sade-1.7.4.tgz", + "integrity": "sha512-6ys13kmtlY0aIOz4KtMdeBD9BHs6vSE3aRcj4vAZqXjypT2el8WZt6799CMjElVgh1cbOH/t3vrpQ4IpwytcPA==", + "dev": true, + "dependencies": { + "@types/mri": "*" + } + }, + "node_modules/@types/shelljs": { + "version": "0.8.12", + "resolved": "https://registry.npmjs.org/@types/shelljs/-/shelljs-0.8.12.tgz", + "integrity": "sha512-ZA8U81/gldY+rR5zl/7HSHrG2KDfEb3lzG6uCUDhW1DTQE9yC/VBQ45fXnXq8f3CgInfhZmjtdu/WOUlrXRQUg==", + "dev": true, + "dependencies": { + "@types/glob": "~7.2.0", + "@types/node": "*" + } + }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dev": true, + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/any-shell-escape": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/any-shell-escape/-/any-shell-escape-0.1.1.tgz", + "integrity": "sha512-36j4l5HVkboyRhIWgtMh1I9i8LTdFqVwDEHy1cp+QioJyKgAUG40X0W8s7jakWRta/Sjvm8mUG1fU6Tj8mWagQ==", + "dev": true + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/async-exit-hook": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/async-exit-hook/-/async-exit-hook-1.1.2.tgz", + "integrity": "sha512-CeTSWB5Bou31xSHeO45ZKgLPRaJbV4I8csRcFYETDBehX7H+1GDO/v+v8G7fZmar1gOmYa6UTXn6d/WIiJbslw==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/bytes-iec": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/bytes-iec/-/bytes-iec-3.1.1.tgz", + "integrity": "sha512-fey6+4jDK7TFtFg/klGSvNKJctyU7n2aQdnM+CO0ruLPbqqMOM8Tio0Pc+deqUeVKX1tL5DQep1zQ7+37aTAsA==", + "dev": true, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/css-in-console": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/css-in-console/-/css-in-console-2.0.0.tgz", + "integrity": "sha512-Xbphn3qbe/XO67D8dr7Q39qSqi3ddnSsL72nixhKLiUEr8K3oTlk9aCOKRyCVNgPtgWwhynM19jj5mw1n/K2Tg==", + "dev": true, + "engines": { + "node": ">=18" + } + }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/esbuild": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.2.tgz", + "integrity": "sha512-G6hPax8UbFakEj3hWO0Vs52LQ8k3lnBhxZWomUJDxfz3rZTLqF5k/FCzuNdLx2RbpBiQQF9H9onlDDH1lZsnjg==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/android-arm": "0.19.2", + "@esbuild/android-arm64": "0.19.2", + "@esbuild/android-x64": "0.19.2", + "@esbuild/darwin-arm64": "0.19.2", + "@esbuild/darwin-x64": "0.19.2", + "@esbuild/freebsd-arm64": "0.19.2", + "@esbuild/freebsd-x64": "0.19.2", + "@esbuild/linux-arm": "0.19.2", + "@esbuild/linux-arm64": "0.19.2", + "@esbuild/linux-ia32": "0.19.2", + "@esbuild/linux-loong64": "0.19.2", + "@esbuild/linux-mips64el": "0.19.2", + "@esbuild/linux-ppc64": "0.19.2", + "@esbuild/linux-riscv64": "0.19.2", + "@esbuild/linux-s390x": "0.19.2", + "@esbuild/linux-x64": "0.19.2", + "@esbuild/netbsd-x64": "0.19.2", + "@esbuild/openbsd-x64": "0.19.2", + "@esbuild/sunos-x64": "0.19.2", + "@esbuild/win32-arm64": "0.19.2", + "@esbuild/win32-ia32": "0.19.2", + "@esbuild/win32-x64": "0.19.2" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dev": true, + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "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": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/ignore": { + "version": "5.2.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", + "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/inspect-custom-symbol": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/inspect-custom-symbol/-/inspect-custom-symbol-1.1.1.tgz", + "integrity": "sha512-GOucsp9EcdlLdhPUyOTvQDnbFJtp2WBWZV1Jqe+mVnkJQBL3w96+fB84C+JL+EKXOspMdB0eMDQPDp5w9fkfZA==", + "dev": true + }, + "node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/just-flatten-it": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/just-flatten-it/-/just-flatten-it-2.2.1.tgz", + "integrity": "sha512-VwvlzikphspzZL38LiZpoBsFGQy6MnmXYekBeZA8lSNwgSC87zA3a93bCZKkDuOM+djMZhfjd3lXAZyxficKCg==", + "dev": true + }, + "node_modules/just-zip-it": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/just-zip-it/-/just-zip-it-2.3.1.tgz", + "integrity": "sha512-h8Y3DAVTZRP3Weq7btWYfkYHQGhxiuKzfOO7Ec+x8XaDcBvbOsC2jIdezC6tEzbt+A4fTJTREnj3gF5DyMkFfw==", + "dev": true + }, + "node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/log-update-async-hook": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/log-update-async-hook/-/log-update-async-hook-2.0.7.tgz", + "integrity": "sha512-V9KpD1AZUBd/oiZ+/Xsgd5rRP9awhgtRiDv5Am4VQCixiDnAbXMdt/yKz41kCzYZtVbwC6YCxnWEF3zjNEwktA==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.3.2", + "async-exit-hook": "^1.1.2", + "onetime": "^2.0.1", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "dev": true, + "dependencies": { + "braces": "^3.0.2", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "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/mri": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", + "integrity": "sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/nanoid": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", + "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/nanospinner": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/nanospinner/-/nanospinner-1.1.0.tgz", + "integrity": "sha512-yFvNYMig4AthKYfHFl1sLj7B2nkHL4lzdig4osvl9/LdGbXwrdFRoqBS98gsEsOakr0yH+r5NZ/1Y9gdVB8trA==", + "dev": true, + "dependencies": { + "picocolors": "^1.0.0" + } + }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, + "node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dev": true, + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, + "node_modules/nodejsscript": { + "version": "1.0.0", + "resolved": "git+ssh://git@github.com/jaandrle/nodejsscript.git#efb342b22c1a3e6ef0d5d460aafae7276946cca6", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/sade": "^1.7.4", + "@types/shelljs": "^0.8.11", + "abort-controller": "^3.0.0", + "css-in-console": "^2.0.0", + "log-update-async-hook": "^2.0.7", + "node-fetch": "^3.3.0", + "sade": "^1.8.1", + "shell-escape-tag": "^2.0.2", + "shelljs": "^0.8.5" + }, + "bin": { + "njs": "bin/index.mjs", + "nodejsscript": "bin/index.mjs" + }, + "engines": { + "node": ">= 16.0.0" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha512-oyyPpiMaKARvvcgip+JV+7zci5L8D1W9RZIz2l1o08AM3pfspitVWnPt3mzHcBPp12oYMTy0pqrFs/C+m3EwsQ==", + "dev": true, + "dependencies": { + "mimic-fn": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dev": true, + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/resolve": { + "version": "1.22.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", + "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/sade": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", + "integrity": "sha512-xal3CZX1Xlo/k4ApwCFrHVACi9fBqJ7V+mwhBsuf/1IOKbBy098Fex+Wa/5QMubw09pSZ/u8EY8PWgevJsXp1A==", + "dev": true, + "dependencies": { + "mri": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/semver": { + "version": "7.5.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz", + "integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shell-escape-tag": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/shell-escape-tag/-/shell-escape-tag-2.0.2.tgz", + "integrity": "sha512-kqmtJG6VzTahZl8Y3384ldskA9rzoEMdXLoMEBAq9334/UDdmfWl3OtmrGJPlVcyXvcSy3poDKka57gMxskMPw==", + "dev": true, + "dependencies": { + "any-shell-escape": "^0.1.1", + "inspect-custom-symbol": "^1.1.1", + "just-flatten-it": "^2.1.0", + "just-zip-it": "^2.1.0" + } + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dev": true, + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/size-limit": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/size-limit/-/size-limit-8.2.6.tgz", + "integrity": "sha512-zpznim/tX/NegjoQuRKgWTF4XiB0cn2qt90uJzxYNTFAqexk4b94DOAkBD3TwhC6c3kw2r0KcnA5upziVMZqDg==", + "dev": true, + "dependencies": { + "bytes-iec": "^3.1.1", + "chokidar": "^3.5.3", + "globby": "^11.1.0", + "lilconfig": "^2.1.0", + "nanospinner": "^1.1.0", + "picocolors": "^1.0.0" + }, + "bin": { + "size-limit": "bin.js" + }, + "engines": { + "node": "^14.0.0 || ^16.0.0 || >=18.0.0" + } + }, + "node_modules/size-limit-node-esbuild": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/size-limit-node-esbuild/-/size-limit-node-esbuild-0.2.0.tgz", + "integrity": "sha512-iiIfHBH/+ZxgsE7YVQDEejAUGZYEu4QIai/QNZloEGxA+cmow79O8uGdu4sK64V8kafryqR1grK7nl7xIGv6rw==", + "dev": true, + "dependencies": { + "@size-limit/esbuild": "^8.1.0", + "nanoid": "^3.2.0", + "tslib": "^2.4.0" + }, + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tslib": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", + "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==", + "dev": true + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/web-streams-polyfill": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz", + "integrity": "sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..d05f87b --- /dev/null +++ b/package.json @@ -0,0 +1,88 @@ +{ + "name": "deka-dom-el", + "version": "0.1.0", + "description": "A low-code library that simplifies the creation of native DOM elements/components using small wrappers and tweaks.", + "author": "Jan Andrle ", + "license": "MIT", + "homepage": "https://gitea.jaandrle.cz/jaandrle/deka-dom-el", + "repository": { + "type": "git", + "url": "git@jaandrle.cz:jaandrle/deka-dom-el.git" + }, + "bugs": { + "url": "https://gitea.jaandrle.cz/jaandrle/deka-dom-el/issues" + }, + "main": "index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.js" + }, + "./signals": { + "import": "./src/signals.js" + }, + "./signals-lib": { + "import": "./src/signals-lib.js" + } + }, + "typesVersions": { + "*": { + ".": [ + "./index.d.ts" + ], + "./signals": [ + "./src/signals.d.ts" + ], + "./signals-lib": [ + "./src/signals.d.ts" + ] + } + }, + "files": [ + "index.js", + "index.d.ts", + "src" + ], + "engines": { + "node": ">=18" + }, + "jshintConfig": { + "esversion": 6, + "node": "true", + "undef": "true", + "latedef": "true", + "maxparams": 4, + "maxdepth": 3, + "maxcomplexity": 19 + }, + "size-limit": [ + { + "path": "./index.js", + "limit": "10 kB", + "gzip": false + }, + { + "path": "./index-with-signals.js", + "limit": "10 kB", + "gzip": false + } + ], + "modifyEsbuildConfig": { + "platform": "browser" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [ + "dom", + "javascript", + "low-code", + "typescript" + ], + "devDependencies": { + "@size-limit/preset-small-lib": "^8.2.6", + "esbuild": "^0.19.2", + "nodejsscript": "github:jaandrle/nodejsscript#dev-v1", + "size-limit-node-esbuild": "^0.2.0" + } +} diff --git a/src/dom.js b/src/dom.js index 9e9db00..ed84701 100644 --- a/src/dom.js +++ b/src/dom.js @@ -8,13 +8,15 @@ export function namespace(namespace){ }; } export function createElement(tag, attributes, ...connect){ + const s= signals(this); let el; + //TODO Array.isArray(tag) ⇒ set key (cache els) if("<>"===tag){ - if(signals.isReactiveAtrribute(attributes)) - return signals.reactiveElement(attributes, ...connect); + if(s.isReactiveAtrribute(attributes)) + return s.reactiveElement(attributes, ...connect); el= document.createDocumentFragment(); } - if(signals.isTextContent(attributes)) + if(s.isTextContent(attributes)) attributes= { textContent: attributes }; switch(true){ case typeof tag==="function": el= tag(attributes || undefined); break; @@ -27,16 +29,19 @@ export function createElement(tag, attributes, ...connect){ } export { createElement as el }; +const prop_cache= new Map(); export function assign(element, ...attributes){ + const s= signals(this); if(!attributes.length) return element; const is_svg= element instanceof SVGElement; const setRemoveAttr= (is_svg ? setRemoveNS : setRemove).bind(null, element, "Attribute"); Object.entries(Object.assign({}, ...attributes)).forEach(function assignNth([ key, attr ]){ - if(signals.isReactiveAtrribute(attr, key)) - attr= signals.process(key, attr, assignNth); - if(key[0]==="=") return setRemoveAttr(key.slice(1), attr); - if(key[0]===".") return setDelete(element, key.slice(1), attr); + if(s.isReactiveAtrribute(attr, key)) + attr= s.processReactiveAttribute(el, key, attr, assignNth); + const [ k ]= key; + if("="===k) return setRemoveAttr(key.slice(1), attr); + if("."===k) return setDelete(element, key.slice(1), attr); if(typeof attr === "object"){ switch(key){ case "style": return forEachEntries(attr, setRemove.bind(null, element.style, "Property")) @@ -51,17 +56,13 @@ export function assign(element, ...attributes){ return setRemoveAttr(key, attr); } switch(key){ - case "href" || "src" || "style": - return setRemoveAttr(key, attr); case "xlink:href": return setRemoveAttr(key, attr, "http://www.w3.org/1999/xlink"); case "textContent" || "innerText": if(!is_svg) break; return element.appendChild(document.createTextNode(attr)); } - if(key in element && !is_svg) - return setDelete(element, key, attr); - return setRemoveAttr(key, attr); + return isPropSetter(element, key) ? setDelete(element, key, attr) : setRemoveAttr(key, attr); }); return element; } @@ -73,8 +74,24 @@ export function classListDeclartive(element, toggle){ element.classList.toggle(class_name, val===-1 ? undefined : Boolean(val))) return element; } - -export function empty(el){ Array.from(el.children).forEach(el=> el.remove()); return el; } +export function empty(el){ + Array.from(el.children).forEach(el=> el.remove()); + return el; +} +function isPropSetter(el, key){ + const cache_key= el.nodeName+","+key; + if(prop_cache.has(cache_key)) return prop_cache.get(cache_key); + const des= getPropDescriptor(el, key); + const is_set= !isUndef(des.set); + prop_cache.set(cache_key, is_set); + return is_set; +} +function getPropDescriptor(p, key){ + p= Object.getPrototypeOf(p); + if(!p) return {}; + const des= Object.getOwnPropertyDescriptor(p, key); + return des ? des : getPropDescriptor(p, key); +} function forEachEntries(obj, cb){ return Object.entries(obj).forEach(([ key, val ])=> cb(key, val)); } function isUndef(value){ return typeof value==="undefined"; } diff --git a/src/events.js b/src/events.js index 9886e34..4dc1c8a 100644 --- a/src/events.js +++ b/src/events.js @@ -1,37 +1,25 @@ -import { signals } from './signals-common.js'; export { registerReactivity } from './signals-common.js'; export function on(event, listener, options){ - if(!signals.isReactiveAtrribute(event)) - return element=> element.addEventListener(event, listener, options); - //TODO cleanup when signal removed (also TODO) - if(options && options.signal) - options.signal.addEventListener("abort", ()=> signals.off(event, listener)); - return signals.on(event, listener); -} -export function off(){//TODO is needed? - const abort= new AbortController(); - return new Proxy(()=> abort.abort(), { - get(_, p){ return Reflect.get(abort, p); }, - ownKeys(){ return [ "signal" ]; } - }) -} -export function dispatch(event, detail){ - if(typeof event === "string") - event= typeof detail==="undefined" ? new Event(event) : new CustomEvent(event, { detail }); - return element=> element.dispatchEvent(event); + return element=> { + element.addEventListener(event, listener, options); + return element; + }; } const connections_changes= connectionsChangesObserverConstructor(); -//TODO remove listener(s) options -on.connected= function(listener){ +on.connected= function(listener, options){ return function registerElement(element){ connections_changes.onConnected(element, listener); + if(options && options.signal) + options.signal.addEventListener("abort", ()=> connections_changes.offConnected(element, listener)); }; }; -on.disconnected= function(listener){ +on.disconnected= function(listener, options){ return function registerElement(element){ connections_changes.onDisconnected(element, listener); + if(options && options.signal) + options.signal.addEventListener("abort", ()=> connections_changes.offDisconnected(element, listener)); }; }; diff --git a/src/signals-common.js b/src/signals-common.js index e1b577e..a2709e0 100644 --- a/src/signals-common.js +++ b/src/signals-common.js @@ -1,12 +1,15 @@ import { typeOf } from './helpers.js'; -export const signals= { +export const signals_global= { isReactiveAtrribute(attr, key){ return false; }, isTextContent(attributes){ return typeOf(attributes)!=="[object Object]"; }, - process(key, attr, assignNth){ return false; }, - on(signal, listener){ return false; }, - off(signal, listener){ return false; }, + processReactiveAttribute(el, key, attr, assignNth){ return false; }, reactiveElement(attributes, ...connect){ return document.createDocumentFragment(); } }; -export function registerReactivity(def){ - return Object.assign(signals, def); +export function registerReactivity(def, global= true){ + if(global) return Object.assign(signals_global, def); + Object.setPrototypeOf(def, signals_global); + return def; +} +export function signals(_this){ + return signals_global.isPrototypeOf(_this) && _this!==signals_global ? _this : signals_global; } diff --git a/src/signals-lib.js b/src/signals-lib.js new file mode 100644 index 0000000..4ed4573 --- /dev/null +++ b/src/signals-lib.js @@ -0,0 +1,131 @@ +export const mark= Symbol.for("signal"); + +export function isSignal(candidate){ + try{ return Reflect.has(candidate, mark); } + catch(e){ return false; } +} +export function S(value, actions){ + if(typeof value!=="function") + return create(value, actions); + if(isSignal(value)) return value; + + const out= create(); + watch(()=> out(value())); + return out; +} +S.action= function(signal, name, ...a){ + if(!isSignal(signal)) + throw new Error(`'${signal}' is not a signal!`); + const s= signal[mark], { actions }= s; + if(!actions || !Reflect.has(actions, name)) + throw new Error(`'${signal}' has no action with name '${name}'!`); + actions[name].apply(s, a); + if(s.skip) return Reflect.deleteProperty(s, "skip"); + s.listeners.forEach(l=> l(s.value)); +}; +S.on= function on(signals, listener, options){ + if(Array.isArray(signals)) return signals.forEach(s=> on(s, listener, options)); + addSignalListener(signals, listener); + if(options && options.signal) + options.signal.addEventListener("abort", ()=> removeSignalListener(signals, listener)); + //TODO cleanup when signal removed (also TODO) +} +S.clear= function(...signals){ + for(const signal of signals){ + signal[mark].listeners.clear(); + Reflect.deleteProperty(signal, mark); + } +}; + +import { typeOf } from './helpers.js'; +export const signals_config= { + isReactiveAtrribute(attr, key){ return isSignal(attr); }, + isTextContent(attributes){ + return typeOf(attributes)==="string" || ( isSignal(attributes) && typeOf(valueOfSignal(attributes))==="string" ); + }, + processReactiveAttribute(_, key, attrS, assignNth){ + addSignalListener(attrS, attr=> assignNth([ key, attr ])); + return attrS(); + }, + reactiveElement(signal, map){ + const mark_start= document.createComment("<> #reactive"); + const mark_end= document.createComment(" #reactive"); + const out= document.createDocumentFragment(); + out.append(mark_start, mark_end); + const toEls= v=> { + if(!mark_start.parentNode || !mark_end.parentNode) + return removeSignalListener(signal, toEls); + let els= map(v); + if(!Array.isArray(els)) + els= [ els ]; + let el_r= mark_start; + while(( el_r= mark_start.nextSibling ) !== mark_end) + el_r.remove(); + mark_start.after(...els); + }; + addSignalListener(signal, toEls); + toEls(signal()); + return out; + } +}; + +function create(value, actions){ + const signal= (...value)=> + value.length ? write(signal, value[0]) : read(signal); + return toSignal(signal, value, actions); +} +const protoSigal= Object.assign(Object.create(null), { + stopPropagation(){ + this.skip= true; + } +}); +function toSignal(signal, value, actions){ + if(typeOf(actions)!=="[object Object]") + actions= {}; + signal[mark]= { + value, actions, + listeners: new Set(), + }; + Object.setPrototypeOf(signal[mark], protoSigal); + return signal; +} + +const stack_watch= []; +export function watch(context){ + const contextReWatch= function(){ + stack_watch.push(contextReWatch); + context(); + stack_watch.pop(); + }; + stack_watch.push(contextReWatch); + context(); + stack_watch.pop(); +}; +function currentContext(){ + return stack_watch[stack_watch.length - 1]; +} +function read(signal){ + if(!signal[mark]) return; + const { value, listeners }= signal[mark]; + const context= currentContext(); + if(context) listeners.add(context); + return value; +} +function write(signal, value){ + if(!signal[mark]) return; + const s= signal[mark]; + if(s.value===value) return; + s.value= value; + s.listeners.forEach(fn=> fn(value)) + return value; +} + +function valueOfSignal(signal){ + return signal[mark].value; +} +function addSignalListener(signal, listener){ + return signal[mark].listeners.add(listener); +} +function removeSignalListener(signal, listener){ + return signal[mark].listeners.delete(listener); +} diff --git a/src/signals.d.ts b/src/signals.d.ts new file mode 100644 index 0000000..f63ea87 --- /dev/null +++ b/src/signals.d.ts @@ -0,0 +1,15 @@ +export type Signal= (set?: V)=> V & A; +type Action= (this: { value: V }, ...a: any[])=> typeof S._ | void; +type Actions= Record>; +interface S { + _: Symbol + >(value: V, actions?: A): Signal; + action>, A extends (S extends Signal ? A : never), N extends keyof A>( + signal: S, + name: N, + ...params: A[N] extends (...args: infer P)=> any ? P : never + ): void; + clear(...signals: Signal): void; + on(signal: Signal, onchange: (a: T)=> void, options?: AddEventListenerOptions): void +} +export const S: S; diff --git a/src/signals.js b/src/signals.js index db4c181..a516b0f 100644 --- a/src/signals.js +++ b/src/signals.js @@ -1,153 +1,4 @@ -export const mark= Symbol.for("signal"); - -export function isSignal(candidate){ - try{ return Reflect.has(candidate, mark); } - catch(e){ return false; } -} -import { typeOf } from './helpers.js'; +export { S, isSignal, watch } from "./signals-lib.js"; +import { signals_config } from "./signals-lib.js"; import { registerReactivity } from "./signals-common.js"; -registerReactivity({ - isReactiveAtrribute(attr, key){ return isSignal(attr); }, - isTextContent(attributes){ - //TODO FIX el(…, S.reactive(…)) - return typeOf(attributes)!=="[object Object]" || ( isSignal(attributes) && typeOf(valueOfSignal(attributes))!=="[object Object]" ); - }, - process(key, attr, assignNth){ //TODO: unmounted - addSignalListener(attr, attr=> assignNth([ key, attr ])); - return attr(); - }, - on: addSignalListener, - off: removeSignalListener, - reactiveElement(signal, map){ - const mark= document.createComment("reactive"); - const out= document.createDocumentFragment(); - out.append(mark); - let cache; - const toEls= v=> { - let els= map(v); - if(!Array.isArray(els)) - els= [ els ]; - if(cache) cache.forEach(el=> el.remove()); - cache= els; - mark.before(...els); - }; - addSignalListener(signal, toEls); - toEls(signal()); - return out; - } -}); - -export function S(value){ - if(typeof value!=="function") - return create(value); - if(isSignal(value)) return value; - - const out= create(); - watch(()=> out(value())); - return out; -} -S.reactive= reactive; -function reactive(data){ - if(isSignal(data)) - return data; - if(typeof data!=="object" || data===null) - return create(data); - - let type; - if(Array.isArray(data)){ - type= "array"; - data= data.map(v=> reactive(v)); - } else if(data.toString()!=="[object Object]"){ - return create(data); - } else { - type= "object"; - data= Object.fromEntries( - Object.entries(data) - .map(([ key, value ])=> [ key, reactive(value) ]) - ); - } - const signal= (...value)=> - value.length ? write(signal, reactive(value[0])) : read(signal[mark]); - return createWrapObject(type, toSignal(signal, data)); -}; -function toSignal(signal, value){ - signal[mark]= { - value, - listeners: new Set() - }; - return signal; -} - -const stack= []; -export function watch(context){ - stack.push(function contextReWatch(){ - stack.push(contextReWatch); - context(); - stack.pop(); - }); - context(); - stack.pop(); -}; - -function currentContext(){ - return stack[stack.length - 1]; -} -function create(value){ - if(isSignal(value)) return value; - const signal= (...value)=> - value.length ? write(signal, value[0]) : read(signal[mark]); - return toSignal(signal, value); -} -function createWrapObject(type, signal){ - return new Proxy(signal, { - set(_, p, newValue){ - const s= signal[mark]; - if(p in s.value){ - const v= s.value[p]; - if(isSignal(v)) return v(newValue); - return (s.value[p]= newValue); - } - const v= reactive(newValue); - s.value[p]= v; - s.listeners.forEach(fn=> fn(s.value)); - return v; - }, - deleteProperty(_, p){ - const s= signal[mark]; - Reflect.deleteProperty(s.value, p); - s.listeners.forEach(fn=> fn(s.value)); - }, - get(_, p){ - if(mark===p) return signal[mark]; - if("array"!==type || !(p in Array.prototype) || p==="length") - return Reflect.get(signal[mark].value, p); - return (...a)=> { - const s= signal[mark]; - const result= Array.prototype[p].call(s.value, ...a); - //TODO optimize! - s.value.forEach((v, i)=> Reflect.set(s.value, i, reactive(v))); - s.listeners.forEach(fn=> fn(s.value)); - return result; - }; - } - }); -} -function read({ value, listeners }){ - const context= currentContext(); - if(context) listeners.add(context); - return value; -} -function write(signal, value){ - signal[mark].value= value; - signal[mark].listeners.forEach(fn=> fn(value)) - return value; -} -function valueOfSignal(signal){ - return signal[mark].value; -} -export function addSignalListener(signal, listener){ - return signal[mark].listeners.add(listener); -} -export function removeSignalListener(signal, listener){ - return signal[mark].listeners.delete(listener); -} +registerReactivity(signals_config); diff --git a/test/components/fullNameComponent.js b/test/components/fullNameComponent.js new file mode 100644 index 0000000..712d7d3 --- /dev/null +++ b/test/components/fullNameComponent.js @@ -0,0 +1,28 @@ +import { style, el, on, S } from '../exports.js'; +const className= style.host(fullNameComponent).css` + :host form{ + display: flex; + flex-flow: column nowrap; + } +`; +export function fullNameComponent(){ + const labels= [ "Name", "Surname" ]; + const name= labels.map(_=> S("")); + const full_name= S(()=> + name.map(l=> l()).filter(Boolean).join(" ") || "-"); + + return el("div", { className }).append( + el("h2", "Simple form:"), + el("form", { onsubmit: ev=> ev.preventDefault() }).append( + ...name.map((v, i)=> + el("label", labels[i]).append( + el("input", { type: "text", name: labels[i], value: v() }, on("change", ev=> v(ev.target.value))) + )) + ), + el("p").append( + el("strong", "Full name"), + el("#text", ": "), + el("#text", full_name) + ) + ); +} diff --git a/test/components/todosComponent.js b/test/components/todosComponent.js new file mode 100644 index 0000000..93c587b --- /dev/null +++ b/test/components/todosComponent.js @@ -0,0 +1,75 @@ +import { style, el, on, S } from '../exports.js'; +const className= style.host(todosComponent).css` + :host{ + display: flex; + flex-flow: column nowrap; + } + :host input{ + margin-inline-start: .5em; + } + :host button{ + margin-inline-start: 1em; + } +`; +/** @param {{ todos: string[] }} */ +export function todosComponent({ todos= [] }= {}){ + const todosS= S(todos.map(v=> S(v)), { + /** @param {string} v */ + add(v){ this.value.push(S(v)); }, + /** @param {number} i */ + remove(i){ this.value.splice(i, 1); } + }); + console.log(todosS); //TODO + const name= "todoName"; + const onsubmitAdd= on("submit", event=> { + const value= event.target.elements[name].value; + if(!value) return; + + event.preventDefault(); + S.action(todosS, "add", value); + event.target.elements[name].value= ""; + }); + const onremove= on("remove", event=> + S.action(todosS, "remove", event.detail)); + + const ul_todos= el("ul").append( + el("<>", todosS, + ts=> ts.map((t, i)=> el(todoComponent, { textContent: t, value: i, className }, onremove)) + )); + return el("div", { className }).append( + el("div").append( + el("h2", "Todos:"), + el("h3", "List of todos:"), + el("<>", todosS, ts=> !ts.length + ? el("p", "No todos yet") + : ul_todos) + ), + el("form", null, onsubmitAdd).append( + el("h3", "Add a todo:"), + el("label", "New todo: ").append( + el("input", { name, type: "text", required: true }), + ), + el("button", "+") + ) + ) +} +/** + * @type {ddeFires<[ "click" ]>} + * @param {{ + * textContent: string | ddeSignal + * value: number + * }} + * */ +function todoComponent({ textContent, value }){ + const ref= S(); + const onclick= on("click", event=> { + const value= Number(event.target.value); + event.preventDefault(); + event.stopPropagation(); + ref().dispatchEvent(new CustomEvent("remove", { detail: value })); + }); + return el("li", null, ref).append( + el("#text", textContent), + el("button", { type: "button", value, textContent: "-" }, onclick) + ); +} diff --git a/test/exports.js b/test/exports.js new file mode 100644 index 0000000..f937eca --- /dev/null +++ b/test/exports.js @@ -0,0 +1,30 @@ +import { namespace, el, on, registerReactivity } from "../index.js"; +import { S } from "../src/signals.js"; +// import { empty, namespace, on, dispatch } from "../index.js"; +// import "../dist/dde-with-signals.js"; +// Object.assign(globalThis, dde); +// import { el, on, off, S } from "../dist/esm-with-signals.js"; +const style= createStyle(); +Object.assign(globalThis, { S, el, namespace, on, registerReactivity, style }); +export { S, el, on, registerReactivity, style }; + +function createStyle(){ + const element= el("style"); + const store= new WeakSet(); + let host; + return { + element, + host(k, h= k.name){ + if(store.has(k)) return { css: ()=> {} }; + store.add(k); + host= h; + return this; + }, + css(...args){ + const textContent= String.raw(...args).replaceAll(":host", "."+host); + const className= host; + element.appendChild(el("#text", { textContent })); + return className; + } + }; +} diff --git a/test/index.js b/test/index.js index fbe8b5c..9b31650 100644 --- a/test/index.js +++ b/test/index.js @@ -1,81 +1,9 @@ -import { el, on, off } from "../index.js"; -import { S } from "../src/signals.js"; -//import { empty, namespace, on, dispatch } from "../index.js"; -Object.assign(globalThis, { S, el, on, off }); - -const style= createStyle(); -const app= el(todosComponent); +import { style, el } from './exports.js'; document.head.append(style.element); -document.body.append(app); - -function todosComponent({ todos= [] }= {}){ - const className= "basicTodoForm"; - style.css` - .${className}{ - display: flex; - flex-flow: column nowrap; - } - .${className} input{ - margin-inline-start: .5em; - } - `; - todos= S.reactive(todos); - globalThis.__todos__= todos; //TODO - const name= "todoName"; - const onsubmit= on("submit", event=> { - const value= event.target.elements[name].value; - if(!value) return; - - event.preventDefault(); - todos.push(value) - event.target.elements[name].value= ""; - }); - const onremove= on("click", event=> { - const value= Number(event.target.value); - if(Number.isNaN(value)) return; - event.preventDefault(); - todos.splice(value, 1); - }); - - return el("div", { className }).append( - el("div").append( - el("h1", "Todos:"), - el("<>", todos, ts=> !ts.length - ? el("p", "No todos yet") - : ts.map((t, i)=> el(todoComponent, { textContent: t, value: i, className }, onremove))) - ), - el("form", null, onsubmit).append( - el("h2", "Add:"), - el("label", "New todo: ").append( - el("input", { name, type: "text", required: true }), - ), - el("button", "+") - ) - ) -} -function todoComponent({ textContent, className, value }){ - style.key(todoComponent).css` - .${className} button{ - margin-inline-start: 1em; - } - `; - return el("p").append( - el("#text", textContent), - el("button", { type: "button", value, textContent: "-" }) - ); -} -function createStyle(){ - const element= el("style"); - const store= new WeakSet(); - return { - element, - key(k){ - if(store.has(k)) return { css: ()=> {} }; - store.add(k); - return this; - }, - css(...args){ - element.appendChild(el("#text", { textContent: String.raw(...args) })); - } - }; -} +import { fullNameComponent } from './components/fullNameComponent.js'; +import { todosComponent } from './components/todosComponent.js'; +document.body.append( + el("h1", "Experiments:"), + el(fullNameComponent), + el(todosComponent), +);