Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uhtml

Package Overview
Dependencies
Maintainers
1
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uhtml - npm Package Compare versions

Comparing version 4.3.2 to 4.3.3

cjs/render/shared.js

15

cjs/init.js

@@ -902,5 +902,5 @@ 'use strict';

*/
var keyed$1 = (where, what) => {
var render = (where, what, check) => {
const info = known.get(where) || set(known, where, cache$1(empty));
const hole = typeof what === 'function' ? what() : what;
const hole = (check && typeof what === 'function') ? what() : what;
const { n } = info;

@@ -913,2 +913,13 @@ const node = hole instanceof Hole ? unroll(info, hole) : hole;

/** @typedef {import("../rabbit.js").Hole} Hole */
/**
* Render with smart updates within a generic container.
* @template T
* @param {T} where the DOM node where to render content
* @param {(() => Hole) | Hole} what the hole to render
* @returns
*/
var keyed$1 = (where, what) => render(where, what, true);
/*! (c) Andrea Giammarchi - MIT */

@@ -915,0 +926,0 @@

17

cjs/render/keyed.js
'use strict';
const { Hole, unroll } = require('../rabbit.js');
const { cache } = require('../literals.js');
const { empty, set } = require('../utils.js');
const render = (require('./shared.js'));
/** @type {WeakMap<Element | DocumentFragment, import("../literals.js").Cache>} */
const known = new WeakMap;
/** @typedef {import("../rabbit.js").Hole} Hole */

@@ -16,10 +13,2 @@ /**

*/
module.exports = (where, what) => {
const info = known.get(where) || set(known, where, cache(empty));
const hole = typeof what === 'function' ? what() : what;
const { n } = info;
const node = hole instanceof Hole ? unroll(info, hole) : hole;
if (n !== node)
where.replaceChildren((info.n = node));
return where;
};
module.exports = (where, what) => render(where, what, true);
'use strict';
const { create, drop } = require('gc-hook');
const render = (require('./keyed.js'));
const render = (require('./shared.js'));
/** @typedef {import("../rabbit.js").Hole} Hole */
/** @type {WeakMap<Element | DocumentFragment, Function>} */

@@ -18,5 +20,7 @@ const effects = new WeakMap;

* Render with smart updates within a generic container.
* If the `what` is a function, it automatically create
* an effect for the render function.
* @template T
* @param {T} where the DOM node where to render content
* @param {() => Hole} what the hole to render
* @param {(() => Hole) | Hole} what the hole to render
* @returns {T}

@@ -32,3 +36,3 @@ */

const wr = new WeakRef(where);
dispose = effect(() => { render(wr.deref(), what) });
dispose = effect(() => { render(wr.deref(), what(), false) });
effects.set(where, dispose);

@@ -39,5 +43,5 @@ return create(dispose, onGC, { return: where });

effects.delete(where);
return render(where, what);
return render(where, what, false);
}
};
};

@@ -901,5 +901,5 @@

*/
var keyed$1 = (where, what) => {
var render = (where, what, check) => {
const info = known.get(where) || set(known, where, cache$1(empty));
const hole = typeof what === 'function' ? what() : what;
const hole = (check && typeof what === 'function') ? what() : what;
const { n } = info;

@@ -912,2 +912,13 @@ const node = hole instanceof Hole ? unroll(info, hole) : hole;

/** @typedef {import("../rabbit.js").Hole} Hole */
/**
* Render with smart updates within a generic container.
* @template T
* @param {T} where the DOM node where to render content
* @param {(() => Hole) | Hole} what the hole to render
* @returns
*/
var keyed$1 = (where, what) => render(where, what, true);
/*! (c) Andrea Giammarchi - MIT */

@@ -914,0 +925,0 @@

@@ -1,7 +0,4 @@

import { Hole, unroll } from '../rabbit.js';
import { cache } from '../literals.js';
import { empty, set } from '../utils.js';
import render from './shared.js';
/** @type {WeakMap<Element | DocumentFragment, import("../literals.js").Cache>} */
const known = new WeakMap;
/** @typedef {import("../rabbit.js").Hole} Hole */

@@ -15,10 +12,2 @@ /**

*/
export default (where, what) => {
const info = known.get(where) || set(known, where, cache(empty));
const hole = typeof what === 'function' ? what() : what;
const { n } = info;
const node = hole instanceof Hole ? unroll(info, hole) : hole;
if (n !== node)
where.replaceChildren((info.n = node));
return where;
};
export default (where, what) => render(where, what, true);
import { create, drop } from 'gc-hook';
import render from './keyed.js';
import render from './shared.js';
/** @typedef {import("../rabbit.js").Hole} Hole */
/** @type {WeakMap<Element | DocumentFragment, Function>} */

@@ -17,5 +19,7 @@ const effects = new WeakMap;

* Render with smart updates within a generic container.
* If the `what` is a function, it automatically create
* an effect for the render function.
* @template T
* @param {T} where the DOM node where to render content
* @param {() => Hole} what the hole to render
* @param {(() => Hole) | Hole} what the hole to render
* @returns {T}

@@ -31,3 +35,3 @@ */

const wr = new WeakRef(where);
dispose = effect(() => { render(wr.deref(), what) });
dispose = effect(() => { render(wr.deref(), what(), false) });
effects.set(where, dispose);

@@ -38,5 +42,5 @@ return create(dispose, onGC, { return: where });

effects.delete(where);
return render(where, what);
return render(where, what, false);
}
};
};
var e=e=>function(t){const{constructor:n}=e.createDocumentFragment(),{isArray:r}=Array,{getPrototypeOf:s,getOwnPropertyDescriptor:l}=Object,o=[],i=()=>e.createRange(),c=(e,t,n)=>(e.set(t,n),n),a=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),u=e=>({s:e,t:null,n:null,d:o}),{setPrototypeOf:h}=Object;let d;const f=({firstChild:e,lastChild:t},n)=>((e,t,n)=>(d||(d=i()),n?d.setStartAfter(e):d.setStartBefore(e),d.setEndAfter(t),d.deleteContents(),e))(e,t,n);let p=!1;const g=(e,t)=>p&&11===e.nodeType?1/t<0?t?f(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e;class m extends((e=>{function t(e){return h(e,new.target.prototype)}return t.prototype=e.prototype,t})(n)){#e;#t;constructor(e){const t=[...e.childNodes];super(e),this.#e=t,this.#t=t.length,p=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}get parentNode(){return this.#e[0].parentNode}remove(){f(this,!1)}replaceWith(e){f(this,!0).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.replaceChildren(...this.#e),this}}const v=(e,t)=>t.reduceRight(x,e),x=(e,t)=>e.childNodes[t];var w=e=>(t,n)=>{const{c:r,e:s,l:l}=e(t,n),i=r.cloneNode(!0);let c,a,u=s.length,h=u?s.slice(0):o;for(;u--;){const{t:e,p:t,u:r,n:l}=s[u],d=t===a?c:c=v(i,a=t),f=8===e?r():r;h[u]={v:f(d,n[u],l,o),u:f,t:d,n:l}}return((e,t)=>({n:e,d:t}))(1===l?i.firstChild||c:new m(i),h)};const b=/^(?:plaintext|script|style|textarea|title|xmp)$/i,$=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,y=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,C=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,N=/[\x01\x02]/g;const A=(e,t,n)=>e.setAttribute(t,n),W=(e,t)=>e.removeAttribute(t),k=()=>z;let O;const M=(e,t,n)=>{n=n.slice(1),O||(O=new WeakMap);const s=O.get(e)||c(O,e,{});let l=s[n];return l&&l[0]&&e.removeEventListener(n,...l),l=r(t)?t:[t,!1],s[n]=l,l[0]&&e.addEventListener(n,...l),t};function E(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":null==t?(this.n=e).data="":this.n=t.valueOf(),n.replaceWith(this.n)}return t}const S=()=>E.bind({n:null}),T=(e,t,n)=>e[n]=t,B=(e,t,n)=>T(e,t,n.slice(1)),j=(e,t,n)=>null==t?(W(e,n),t):T(e,t,n),F=(e,t)=>("function"==typeof t?t(e):t.current=e,t),L=(e,t,n)=>(null==t?W(e,n):A(e,n,t),t),P=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),z=(e,t,n,r)=>((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;c<o||a<i;)if(o===c){const t=i<l?a?r(n[a-1],-0).nextSibling:r(n[i-a],0):s;for(;a<i;)e.insertBefore(r(n[a++],1),t)}else if(i===a)for(;c<o;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[a])c++,a++;else if(t[o-1]===n[i-1])o--,i--;else if(t[c]===n[i-1]&&n[a]===t[o-1]){const s=r(t[--o],-1).nextSibling;e.insertBefore(r(n[a++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[o]=n[i]}else{if(!u){u=new Map;let e=a;for(;e<i;)u.set(n[e],e++)}if(u.has(t[c])){const s=u.get(t[c]);if(a<s&&s<i){let l=c,h=1;for(;++l<o&&l<i&&u.get(t[l])===s+h;)h++;if(h>s-a){const l=r(t[c],0);for(;a<s;)e.insertBefore(r(n[a++],1),l)}else e.replaceChild(r(n[a++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n})(e.parentNode,r,t.length?t:o,g,e),D=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?W(e,s):A(e,s,r)}return t}],["class",(e,t)=>j(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",F],["style",(e,t)=>null==t?j(e,t,"style"):T(e.style,t,"cssText")]]),H=(e,t,n)=>{switch(t[0]){case".":return B;case"?":return P;case"@":return M;default:return n||"ownerSVGElement"in e?"ref"===t?F:L:D.get(t)||(t in e?t.startsWith("on")?T:((e,t)=>{let n;do{n=l(e,t)}while(!n&&(e=s(e)));return n})(e,t)?.set?j:L:L)}},R=(e,t)=>(e.textContent=null==t?"":t,t);let Z,G,V=e.createElement("template");var _=(t,n)=>{if(n)return Z||(Z=e.createElementNS("http://www.w3.org/2000/svg","svg"),G=i(),G.selectNodeContents(Z)),G.createContextualFragment(t);V.innerHTML=t;const{content:r}=V;return V=V.cloneNode(!1),r};const q=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},I=(t,n,s)=>{const l=_(((e,t,n)=>{let r=0;return e.join("").trim().replace(y,((e,t,r,s)=>`<${t}${r.replace(C,"=$2$1").trimEnd()}${s?n||$.test(t)?" /":`></${t}`:""}>`)).replace(N,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,K,s),s),{length:i}=t;let u=!1,h=o;if(i>1){const t=e.createTreeWalker(l,129),o=[];let c=0,d=`${K}${c++}`;for(h=[];c<i;){const e=t.nextNode();if(8===e.nodeType){if(e.data===d){let t=r(n[c-1])?k:S;t===S?o.push(e):u=!0,h.push(a(8,q(e),t)),d=`${K}${c++}`}}else{let t;for(;e.hasAttribute(d);){t||(t=q(e));const n=e.getAttribute(d);h.push(a(2,t,H(e,n,s),n)),W(e,d),d=`${K}${c++}`}b.test(e.localName)&&e.textContent.trim()===`\x3c!--${d}--\x3e`&&(h.push(a(3,t||q(e),R)),d=`${K}${c++}`)}}for(c=0;c<o.length;c++)o[c].replaceWith(e.createTextNode(""))}const d=l.childNodes.length;return c(J,t,((e,t,n)=>({c:e,e:t,l:n}))(l,h,1===d&&u?0:d))},J=new WeakMap,K="isµ";var Q=e=>(t,n)=>J.get(t)||I(t,n,e);const U=w(Q(!1)),X=w(Q(!0)),Y=(e,{s:t,t:n,v:r})=>{r.length&&e.s===o&&(e.s=[]);const s=ee(e,r);if(e.t!==n){const{n:s,d:l}=(t?X:U)(n,r);e.t=n,e.n=s,e.d=l}else{const{d:t}=e;for(let e=0;e<s;e++){const n=r[e],s=t[e],{v:l}=s;if(n!==l){const{u:e,t:t,n:r}=s;s.v=e(t,n,r,l)}}}return e.n},ee=({s:e},t)=>{const{length:n}=t;for(let s=0;s<n;s++){const n=t[s];n instanceof te?t[s]=Y(e[s]||(e[s]=u(o)),n):r(n)?ee(e[s]||(e[s]=u([])),n):e[s]=null}return n<e.length&&e.splice(n),n};class te{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const ne=e=>(t,...n)=>new te(e,t,n),re=ne(!1),se=ne(!0),le=new WeakMap;
/*! (c) Andrea Giammarchi - MIT */
const oe=new WeakMap,ie=e=>(t,n)=>{const r=oe.get(t)||c(oe,t,new Map);return r.get(n)||c(r,n,function(t,...n){return Y(this,new te(e,t,n))}.bind(u(o)))},ce=ie(!1),ae=ie(!0);return t.Hole=te,t.attr=D,t.html=re,t.htmlFor=ce,t.render=(e,t)=>{const n=le.get(e)||c(le,e,u(o)),r="function"==typeof t?t():t,{n:s}=n,l=r instanceof te?Y(n,r):r;return s!==l&&e.replaceChildren(n.n=l),e},t.svg=se,t.svgFor=ae,t}({});export{e as default};
const oe=new WeakMap,ie=e=>(t,n)=>{const r=oe.get(t)||c(oe,t,new Map);return r.get(n)||c(r,n,function(t,...n){return Y(this,new te(e,t,n))}.bind(u(o)))},ce=ie(!1),ae=ie(!0);return t.Hole=te,t.attr=D,t.html=re,t.htmlFor=ce,t.render=(e,t)=>((e,t,n)=>{const r=le.get(e)||c(le,e,u(o)),s=n&&"function"==typeof t?t():t,{n:l}=r,i=s instanceof te?Y(r,s):s;return l!==i&&e.replaceChildren(r.n=i),e})(e,t,!0),t.svg=se,t.svgFor=ae,t}({});export{e as default};
const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,s=[],r=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),o=(e,t,n,s="")=>({t:e,p:t,u:n,n:s}),i=e=>({s:e,t:null,n:null,d:s}),{setPrototypeOf:c}=Object;let a;const u=({firstChild:e,lastChild:t},n)=>((e,t,n)=>(a||(a=r()),n?a.setStartAfter(e):a.setStartBefore(e),a.setEndAfter(t),a.deleteContents(),e))(e,t,n);let h=!1;const d=(e,t)=>h&&11===e.nodeType?1/t<0?t?u(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e;class f extends((e=>{function t(e){return c(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e;#t;constructor(e){const t=[...e.childNodes];super(e),this.#e=t,this.#t=t.length,h=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}get parentNode(){return this.#e[0].parentNode}remove(){u(this,!1)}replaceWith(e){u(this,!0).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.replaceChildren(...this.#e),this}}const p=(e,t)=>t.reduceRight(g,e),g=(e,t)=>e.childNodes[t];var m=e=>(t,n)=>{const{c:r,e:l,l:o}=e(t,n),i=r.cloneNode(!0);let c,a,u=l.length,h=u?l.slice(0):s;for(;u--;){const{t:e,p:t,u:r,n:o}=l[u],d=t===a?c:c=p(i,a=t),f=8===e?r():r;h[u]={v:f(d,n[u],o,s),u:f,t:d,n:o}}return((e,t)=>({n:e,d:t}))(1===o?i.firstChild||c:new f(i),h)};const x=/^(?:plaintext|script|style|textarea|title|xmp)$/i,v=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,w=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,b=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,$=/[\x01\x02]/g;const y=(e,t,n)=>e.setAttribute(t,n),C=(e,t)=>e.removeAttribute(t),N=()=>L;let A;const W=(t,n,s)=>{s=s.slice(1),A||(A=new WeakMap);const r=A.get(t)||l(A,t,{});let o=r[s];return o&&o[0]&&t.removeEventListener(s,...o),o=e(n)?n:[n,!1],r[s]=o,o[0]&&t.addEventListener(s,...o),n};function k(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":null==t?(this.n=e).data="":this.n=t.valueOf(),n.replaceWith(this.n)}return t}const O=()=>k.bind({n:null}),M=(e,t,n)=>e[n]=t,E=(e,t,n)=>M(e,t,n.slice(1)),S=(e,t,n)=>null==t?(C(e,n),t):M(e,t,n),T=(e,t)=>("function"==typeof t?t(e):t.current=e,t),B=(e,t,n)=>(null==t?C(e,n):y(e,n,t),t),j=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),L=(e,t,n,r)=>((e,t,n,s,r)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;c<o||a<i;)if(o===c){const t=i<l?a?s(n[a-1],-0).nextSibling:s(n[i-a],0):r;for(;a<i;)e.insertBefore(s(n[a++],1),t)}else if(i===a)for(;c<o;)u&&u.has(t[c])||e.removeChild(s(t[c],-1)),c++;else if(t[c]===n[a])c++,a++;else if(t[o-1]===n[i-1])o--,i--;else if(t[c]===n[i-1]&&n[a]===t[o-1]){const r=s(t[--o],-1).nextSibling;e.insertBefore(s(n[a++],1),s(t[c++],-1).nextSibling),e.insertBefore(s(n[--i],1),r),t[o]=n[i]}else{if(!u){u=new Map;let e=a;for(;e<i;)u.set(n[e],e++)}if(u.has(t[c])){const r=u.get(t[c]);if(a<r&&r<i){let l=c,h=1;for(;++l<o&&l<i&&u.get(t[l])===r+h;)h++;if(h>r-a){const l=s(t[c],0);for(;a<r;)e.insertBefore(s(n[a++],1),l)}else e.replaceChild(s(n[a++],1),s(t[c++],-1))}else c++}else e.removeChild(s(t[c++],-1))}return n})(e.parentNode,r,t.length?t:s,d,e),P=new Map([["aria",(e,t)=>{for(const n in t){const s=t[n],r="role"===n?n:`aria-${n}`;null==s?C(e,r):y(e,r,s)}return t}],["class",(e,t)=>S(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",T],["style",(e,t)=>null==t?S(e,t,"style"):M(e.style,t,"cssText")]]),z=(e,s,r)=>{switch(s[0]){case".":return E;case"?":return j;case"@":return W;default:return r||"ownerSVGElement"in e?"ref"===s?T:B:P.get(s)||(s in e?s.startsWith("on")?M:((e,s)=>{let r;do{r=n(e,s)}while(!r&&(e=t(e)));return r})(e,s)?.set?S:B:B)}},D=(e,t)=>(e.textContent=null==t?"":t,t);let F,R,Z=document.createElement("template");var G=(e,t)=>{if(t)return F||(F=document.createElementNS("http://www.w3.org/2000/svg","svg"),R=r(),R.selectNodeContents(F)),R.createContextualFragment(e);Z.innerHTML=e;const{content:n}=Z;return Z=Z.cloneNode(!1),n};const H=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},V=(t,n,r)=>{const i=G(((e,t,n)=>{let s=0;return e.join("").trim().replace(w,((e,t,s,r)=>`<${t}${s.replace(b,"=$2$1").trimEnd()}${r?n||v.test(t)?" /":`></${t}`:""}>`)).replace($,(e=>""===e?`\x3c!--${t+s++}--\x3e`:t+s++))})(t,q,r),r),{length:c}=t;let a=!1,u=s;if(c>1){const t=document.createTreeWalker(i,129),s=[];let l=0,h=`${q}${l++}`;for(u=[];l<c;){const i=t.nextNode();if(8===i.nodeType){if(i.data===h){let t=e(n[l-1])?N:O;t===O?s.push(i):a=!0,u.push(o(8,H(i),t)),h=`${q}${l++}`}}else{let e;for(;i.hasAttribute(h);){e||(e=H(i));const t=i.getAttribute(h);u.push(o(2,e,z(i,t,r),t)),C(i,h),h=`${q}${l++}`}x.test(i.localName)&&i.textContent.trim()===`\x3c!--${h}--\x3e`&&(u.push(o(3,e||H(i),D)),h=`${q}${l++}`)}}for(l=0;l<s.length;l++)s[l].replaceWith(document.createTextNode(""))}const h=i.childNodes.length;return l(_,t,((e,t,n)=>({c:e,e:t,l:n}))(i,u,1===h&&a?0:h))},_=new WeakMap,q="isµ";var I=e=>(t,n)=>_.get(t)||V(t,n,e);const J=m(I(!1)),K=m(I(!0)),Q=(e,{s:t,t:n,v:r})=>{r.length&&e.s===s&&(e.s=[]);const l=U(e,r);if(e.t!==n){const{n:s,d:l}=(t?K:J)(n,r);e.t=n,e.n=s,e.d=l}else{const{d:t}=e;for(let e=0;e<l;e++){const n=r[e],s=t[e],{v:l}=s;if(n!==l){const{u:e,t:t,n:r}=s;s.v=e(t,n,r,l)}}}return e.n},U=({s:t},n)=>{const{length:r}=n;for(let l=0;l<r;l++){const r=n[l];r instanceof X?n[l]=Q(t[l]||(t[l]=i(s)),r):e(r)?U(t[l]||(t[l]=i([])),r):t[l]=null}return r<t.length&&t.splice(r),r};class X{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const Y=e=>(t,...n)=>new X(e,t,n),ee=Y(!1),te=Y(!0),ne=new WeakMap;var se=(e,t)=>{const n=ne.get(e)||l(ne,e,i(s)),r="function"==typeof t?t():t,{n:o}=n,c=r instanceof X?Q(n,r):r;return o!==c&&e.replaceChildren(n.n=c),e};
/*! (c) Andrea Giammarchi - MIT */const re=new WeakMap,le=e=>(t,n)=>{const r=re.get(t)||l(re,t,new Map);return r.get(n)||l(r,n,function(t,...n){return Q(this,new X(e,t,n))}.bind(i(s)))},oe=le(!1),ie=le(!0);export{X as Hole,P as attr,ee as html,oe as htmlFor,se as render,te as svg,ie as svgFor};
/*! (c) Andrea Giammarchi - MIT */const Y=e=>(t,...n)=>new X(e,t,n),ee=Y(!1),te=Y(!0),ne=new WeakMap;var se=(e,t)=>((e,t,n)=>{const r=ne.get(e)||l(ne,e,i(s)),o=n&&"function"==typeof t?t():t,{n:c}=r,a=o instanceof X?Q(r,o):o;return c!==a&&e.replaceChildren(r.n=a),e})(e,t,!0)
/*! (c) Andrea Giammarchi - MIT */;const re=new WeakMap,le=e=>(t,n)=>{const r=re.get(t)||l(re,t,new Map);return r.get(n)||l(r,n,function(t,...n){return Q(this,new X(e,t,n))}.bind(i(s)))},oe=le(!1),ie=le(!0);export{X as Hole,P as attr,ee as html,oe as htmlFor,se as render,te as svg,ie as svgFor};
{
"name": "uhtml",
"version": "4.3.2",
"version": "4.3.3",
"description": "A micro HTML/SVG render",

@@ -5,0 +5,0 @@ "main": "./cjs/index.js",

function t(){throw new Error("Cycle detected")}const e=Symbol.for("preact-signals");function n(){if(h>1)return void h--;let t,e=!1;for(;void 0!==s;){let n=s;for(s=void 0,l++;void 0!==n;){const i=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&p(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=i}}if(l=0,h--,e)throw t}function i(t){if(h>0)return t();h++;try{return t()}finally{n()}}let o,s,r=0;function c(t){if(r>0)return t();const e=o;o=void 0,r++;try{return t()}finally{r--,o=e}}let h=0,l=0,f=0;function u(t){if(void 0===o)return;let e=t.n;return void 0===e||e.t!==o?(e={i:0,S:t,p:o.s,n:void 0,t:o,e:void 0,x:void 0,r:e},void 0!==o.s&&(o.s.n=e),o.s=e,t.n=e,32&o.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=o.s,e.n=void 0,o.s.n=e,o.s=e),e):void 0}function a(t){this.v=t,this.i=0,this.n=void 0,this.t=void 0}function d(t){return new a(t)}function p(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function v(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function y(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t}t.s=e}function g(t){a.call(this,void 0),this.x=t,this.s=void 0,this.g=f-1,this.f=4}function w(t){return new g(t)}function x(t){const e=t.u;if(t.u=void 0,"function"==typeof e){h++;const i=o;o=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,m(t),e}finally{o=i,n()}}}function m(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,x(t)}function b(t){if(o!==this)throw new Error("Out-of-order effect");y(this),o=t,this.f&=-2,8&this.f&&m(this),n()}function S(t){this.x=t,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function N(t){const e=new S(t);try{e.c()}catch(t){throw e.d(),t}return e.d.bind(e)}a.prototype.brand=e,a.prototype.h=function(){return!0},a.prototype.S=function(t){this.t!==t&&void 0===t.e&&(t.x=this.t,void 0!==this.t&&(this.t.e=t),this.t=t)},a.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n)}},a.prototype.subscribe=function(t){const e=this;return N((function(){const n=e.value,i=32&this.f;this.f&=-33;try{t(n)}finally{this.f|=i}}))},a.prototype.valueOf=function(){return this.value},a.prototype.toString=function(){return this.value+""},a.prototype.toJSON=function(){return this.value},a.prototype.peek=function(){return this.v},Object.defineProperty(a.prototype,"value",{get(){const t=u(this);return void 0!==t&&(t.i=this.i),this.v},set(e){if(o instanceof g&&function(){throw new Error("Computed cannot have side-effects")}(),e!==this.v){l>100&&t(),this.v=e,this.i++,f++,h++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{n()}}}}),(g.prototype=new a).h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===f)return!0;if(this.g=f,this.f|=1,this.i>0&&!p(this))return this.f&=-2,!0;const t=o;try{v(this),o=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return o=t,y(this),this.f&=-2,!0},g.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t)}a.prototype.S.call(this,t)},g.prototype.U=function(t){if(void 0!==this.t&&(a.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t)}},g.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N()}},g.prototype.peek=function(){if(this.h()||t(),16&this.f)throw this.v;return this.v},Object.defineProperty(g.prototype,"value",{get(){1&this.f&&t();const e=u(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),S.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.u=t)}finally{t()}},S.prototype.S=function(){1&this.f&&t(),this.f|=1,this.f&=-9,x(this),v(this),h++;const e=o;return o=this,b.bind(this,e)},S.prototype.N=function(){2&this.f||(this.f|=2,this.o=s,s=this)},S.prototype.d=function(){this.f|=8,1&this.f||m(this)};const{isArray:$}=Array,{getPrototypeOf:C,getOwnPropertyDescriptor:k}=Object,O=[],W=()=>document.createRange(),A=(t,e,n)=>(t.set(e,n),n),E=(t,e,n,i)=>({v:t,u:e,t:n,n:i}),M=(t,e,n,i="")=>({t:t,p:e,u:n,n:i}),j=t=>({s:t,t:null,n:null,d:O}),{setPrototypeOf:P}=Object;let T;const U=({firstChild:t,lastChild:e},n)=>((t,e,n)=>(T||(T=W()),n?T.setStartAfter(t):T.setStartBefore(t),T.setEndAfter(e),T.deleteContents(),t))(t,e,n);let B=!1;const R=(t,e)=>B&&11===t.nodeType?1/e<0?e?U(t,!0):t.lastChild:e?t.valueOf():t.firstChild:t;class z extends((t=>{function e(t){return P(t,new.target.prototype)}return e.prototype=t.prototype,e})(DocumentFragment)){#t;#e;constructor(t){const e=[...t.childNodes];super(t),this.#t=e,this.#e=e.length,B=!0}get firstChild(){return this.#t[0]}get lastChild(){return this.#t.at(-1)}get parentNode(){return this.#t[0].parentNode}remove(){U(this,!1)}replaceWith(t){U(this,!0).replaceWith(t)}valueOf(){return this.childNodes.length!==this.#e&&this.replaceChildren(...this.#t),this}}const F=(t,e)=>e.reduceRight(L,t),L=(t,e)=>t.childNodes[e];var D=t=>(e,n)=>{const{c:i,e:o,l:s}=t(e,n),r=i.cloneNode(!0);let c,h,l=o.length,f=l?o.slice(0):O;for(;l--;){const{t:t,p:e,u:i,n:s}=o[l],u=e===h?c:c=F(r,h=e),a=8===t?i():i;f[l]=E(a(u,n[l],s,O),a,u,s)}return((t,e)=>({n:t,d:e}))(1===s?r.firstChild||c:new z(r),f)};const H=/^(?:plaintext|script|style|textarea|title|xmp)$/i,Z=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,G=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,J=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,V=/[\x01\x02]/g;const _=(t,e,n)=>t.setAttribute(e,n),q=(t,e)=>t.removeAttribute(e),I=()=>rt;let K;const Q=(t,e,n)=>{n=n.slice(1),K||(K=new WeakMap);const i=K.get(t)||A(K,t,{});let o=i[n];return o&&o[0]&&t.removeEventListener(n,...o),o=$(e)?e:[e,!1],i[n]=o,o[0]&&t.addEventListener(n,...o),e};function X(t,e){const n=this.n||(this.n=t);switch(typeof e){case"string":case"number":case"boolean":n!==t&&n.replaceWith(this.n=t),this.n.data=e;break;case"object":case"undefined":null==e?(this.n=t).data="":this.n=e.valueOf(),n.replaceWith(this.n)}return e}const Y=()=>X.bind({n:null}),tt=(t,e,n)=>t[n]=e,et=(t,e,n)=>tt(t,e,n.slice(1)),nt=(t,e,n)=>null==e?(q(t,n),e):tt(t,e,n),it=(t,e)=>("function"==typeof e?e(t):e.current=t,e),ot=(t,e,n)=>(null==e?q(t,n):_(t,n,e),e),st=(t,e,n)=>(t.toggleAttribute(n.slice(1),e),e),rt=(t,e,n,i)=>((t,e,n,i,o)=>{const s=n.length;let r=e.length,c=s,h=0,l=0,f=null;for(;h<r||l<c;)if(r===h){const e=c<s?l?i(n[l-1],-0).nextSibling:i(n[c-l],0):o;for(;l<c;)t.insertBefore(i(n[l++],1),e)}else if(c===l)for(;h<r;)f&&f.has(e[h])||t.removeChild(i(e[h],-1)),h++;else if(e[h]===n[l])h++,l++;else if(e[r-1]===n[c-1])r--,c--;else if(e[h]===n[c-1]&&n[l]===e[r-1]){const o=i(e[--r],-1).nextSibling;t.insertBefore(i(n[l++],1),i(e[h++],-1).nextSibling),t.insertBefore(i(n[--c],1),o),e[r]=n[c]}else{if(!f){f=new Map;let t=l;for(;t<c;)f.set(n[t],t++)}if(f.has(e[h])){const o=f.get(e[h]);if(l<o&&o<c){let s=h,u=1;for(;++s<r&&s<c&&f.get(e[s])===o+u;)u++;if(u>o-l){const s=i(e[h],0);for(;l<o;)t.insertBefore(i(n[l++],1),s)}else t.replaceChild(i(n[l++],1),i(e[h++],-1))}else h++}else t.removeChild(i(e[h++],-1))}return n})(t.parentNode,i,e.length?e:O,R,t),ct=new Map([["aria",(t,e)=>{for(const n in e){const i=e[n],o="role"===n?n:`aria-${n}`;null==i?q(t,o):_(t,o,i)}return e}],["class",(t,e)=>nt(t,e,null==e?"class":"className")],["data",(t,e)=>{const{dataset:n}=t;for(const t in e)null==e[t]?delete n[t]:n[t]=e[t];return e}],["ref",it],["style",(t,e)=>null==e?nt(t,e,"style"):tt(t.style,e,"cssText")]]),ht=(t,e,n)=>{switch(e[0]){case".":return et;case"?":return st;case"@":return Q;default:return n||"ownerSVGElement"in t?"ref"===e?it:ot:ct.get(e)||(e in t?e.startsWith("on")?tt:((t,e)=>{let n;do{n=k(t,e)}while(!n&&(t=C(t)));return n})(t,e)?.set?nt:ot:ot)}},lt=(t,e)=>(t.textContent=null==e?"":e,e);let ft,ut,at=document.createElement("template");var dt=(t,e)=>{if(e)return ft||(ft=document.createElementNS("http://www.w3.org/2000/svg","svg"),ut=W(),ut.selectNodeContents(ft)),ut.createContextualFragment(t);at.innerHTML=t;const{content:n}=at;return at=at.cloneNode(!1),n};const pt=t=>{const e=[];let n;for(;n=t.parentNode;)e.push(e.indexOf.call(n.childNodes,t)),t=n;return e},vt=(t,e,n)=>{const i=dt(((t,e,n)=>{let i=0;return t.join("").trim().replace(G,((t,e,i,o)=>`<${e}${i.replace(J,"=$2$1").trimEnd()}${o?n||Z.test(e)?" /":`></${e}`:""}>`)).replace(V,(t=>""===t?`\x3c!--${e+i++}--\x3e`:e+i++))})(t,gt,n),n),{length:o}=t;let s=!1,r=O;if(o>1){const t=document.createTreeWalker(i,129),c=[];let h=0,l=`${gt}${h++}`;for(r=[];h<o;){const i=t.nextNode();if(8===i.nodeType){if(i.data===l){let t=$(e[h-1])?I:Y;t===Y?c.push(i):s=!0,r.push(M(8,pt(i),t)),l=`${gt}${h++}`}}else{let t;for(;i.hasAttribute(l);){t||(t=pt(i));const e=i.getAttribute(l);r.push(M(2,t,ht(i,e,n),e)),q(i,l),l=`${gt}${h++}`}H.test(i.localName)&&i.textContent.trim()===`\x3c!--${l}--\x3e`&&(r.push(M(3,t||pt(i),lt)),l=`${gt}${h++}`)}}for(h=0;h<c.length;h++)c[h].replaceWith(document.createTextNode(""))}const c=i.childNodes.length;return A(yt,t,((t,e,n)=>({c:t,e:e,l:n}))(i,r,1===c&&s?0:c))},yt=new WeakMap,gt="isµ";var wt=t=>(e,n)=>yt.get(e)||vt(e,n,t);const xt=D(wt(!1)),mt=D(wt(!0)),bt=(t,{s:e,t:n,v:i})=>{i.length&&t.s===O&&(t.s=[]);const o=St(t,i);if(t.t!==n){const{n:o,d:s}=(e?mt:xt)(n,i);t.t=n,t.n=o,t.d=s}else{const{d:e}=t;for(let t=0;t<o;t++){const n=i[t],o=e[t],{v:s}=o;if(n!==s){const{u:t,t:e,n:i}=o;o.v=t(e,n,i,s)}}}return t.n},St=({s:t},e)=>{const{length:n}=e;for(let i=0;i<n;i++){const n=e[i];n instanceof Nt?e[i]=bt(t[i]||(t[i]=j(O)),n):$(n)?St(t[i]||(t[i]=j([])),n):t[i]=null}return n<t.length&&t.splice(n),n};class Nt{constructor(t,e,n){this.s=t,this.t=e,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const $t=t=>(e,...n)=>new Nt(t,e,n),Ct=$t(!1),kt=$t(!0),Ot=new WeakMap;var Wt=(t,e)=>{const n=Ot.get(t)||A(Ot,t,j(O)),i="function"==typeof e?e():e,{n:o}=n,s=i instanceof Nt?bt(n,i):i;return o!==s&&t.replaceChildren(n.n=s),t};
/*! (c) Andrea Giammarchi - MIT */const At=new WeakMap,Et=t=>(e,n)=>{const i=At.get(e)||A(At,e,new Map);return i.get(n)||A(i,n,function(e,...n){return bt(this,new Nt(t,e,n))}.bind(j(O)))},Mt=Et(!1),jt=Et(!0),Pt=new FinalizationRegistry((([t,e,n])=>{n&&console.debug(`Held value ${String(e)} not relevant anymore`),t(e)})),Tt=Object.create(null),Ut=new WeakMap,Bt=t=>t();const Rt=(zt=N,(t,e)=>{let n=Ut.get(t);var i;if(n&&(i=n,Pt.unregister(i),n()),"function"==typeof e){const i=new WeakRef(t);return n=zt((()=>{Wt(i.deref(),e)})),Ut.set(t,n),((t,e,{debug:n,return:i,token:o=t}=Tt)=>{const s=i||new Proxy(t,Tt),r=[s,[e,t,!!n]];return!1!==o&&r.push(o),Pt.register(...r),s})(n,Bt,{return:t})}return Ut.delete(t),Wt(t,e)});var zt;export{Nt as Hole,a as Signal,ct as attr,i as batch,w as computed,N as effect,Ct as html,Mt as htmlFor,Rt as render,d as signal,kt as svg,jt as svgFor,c as untracked};
/*! (c) Andrea Giammarchi - MIT */const $t=t=>(e,...n)=>new Nt(t,e,n),Ct=$t(!1),kt=$t(!0),Ot=new WeakMap;var Wt=(t,e,n)=>{const i=Ot.get(t)||A(Ot,t,j(O)),o=n&&"function"==typeof e?e():e,{n:s}=i,r=o instanceof Nt?bt(i,o):o;return s!==r&&t.replaceChildren(i.n=r),t};
/*! (c) Andrea Giammarchi - MIT */const At=new WeakMap,Et=t=>(e,n)=>{const i=At.get(e)||A(At,e,new Map);return i.get(n)||A(i,n,function(e,...n){return bt(this,new Nt(t,e,n))}.bind(j(O)))},Mt=Et(!1),jt=Et(!0),Pt=new FinalizationRegistry((([t,e,n])=>{n&&console.debug(`Held value ${String(e)} not relevant anymore`),t(e)})),Tt=Object.create(null),Ut=new WeakMap,Bt=t=>t();const Rt=(zt=N,(t,e)=>{let n=Ut.get(t);var i;if(n&&(i=n,Pt.unregister(i),n()),"function"==typeof e){const i=new WeakRef(t);return n=zt((()=>{Wt(i.deref(),e(),!1)})),Ut.set(t,n),((t,e,{debug:n,return:i,token:o=t}=Tt)=>{const s=i||new Proxy(t,Tt),r=[s,[e,t,!!n]];return!1!==o&&r.push(o),Pt.register(...r),s})(n,Bt,{return:t})}return Ut.delete(t),Wt(t,e,!1)});var zt;export{Nt as Hole,a as Signal,ct as attr,i as batch,w as computed,N as effect,Ct as html,Mt as htmlFor,Rt as render,d as signal,kt as svg,jt as svgFor,c as untracked};
const{isArray:e}=Array,{getPrototypeOf:t,getOwnPropertyDescriptor:n}=Object,r=[],s=()=>document.createRange(),l=(e,t,n)=>(e.set(t,n),n),o=(e,t,n,r="")=>({t:e,p:t,u:n,n:r}),i=e=>({s:e,t:null,n:null,d:r}),{setPrototypeOf:c}=Object;let a;const u=({firstChild:e,lastChild:t},n)=>((e,t,n)=>(a||(a=s()),n?a.setStartAfter(e):a.setStartBefore(e),a.setEndAfter(t),a.deleteContents(),e))(e,t,n);let h=!1;const d=(e,t)=>h&&11===e.nodeType?1/t<0?t?u(e,!0):e.lastChild:t?e.valueOf():e.firstChild:e;class f extends((e=>{function t(e){return c(e,new.target.prototype)}return t.prototype=e.prototype,t})(DocumentFragment)){#e;#t;constructor(e){const t=[...e.childNodes];super(e),this.#e=t,this.#t=t.length,h=!0}get firstChild(){return this.#e[0]}get lastChild(){return this.#e.at(-1)}get parentNode(){return this.#e[0].parentNode}remove(){u(this,!1)}replaceWith(e){u(this,!0).replaceWith(e)}valueOf(){return this.childNodes.length!==this.#t&&this.replaceChildren(...this.#e),this}}const p=(e,t)=>t.reduceRight(g,e),g=(e,t)=>e.childNodes[t];var m=e=>(t,n)=>{const{c:s,e:l,l:o}=e(t,n),i=s.cloneNode(!0);let c,a,u=l.length,h=u?l.slice(0):r;for(;u--;){const{t:e,p:t,u:s,n:o}=l[u],d=t===a?c:c=p(i,a=t),f=8===e?s():s;h[u]={v:f(d,n[u],o,r),u:f,t:d,n:o}}return((e,t)=>({n:e,d:t}))(1===o?i.firstChild||c:new f(i),h)};const v=/^(?:plaintext|script|style|textarea|title|xmp)$/i,w=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,b=/<([a-zA-Z0-9]+[a-zA-Z0-9:._-]*)([^>]*?)(\/?)>/g,x=/([^\s\\>"'=]+)\s*=\s*(['"]?)\x01/g,y=/[\x01\x02]/g;const $=(e,t,n)=>e.setAttribute(t,n),C=(e,t)=>e.removeAttribute(t),N=()=>P;let W;const k=(t,n,r)=>{r=r.slice(1),W||(W=new WeakMap);const s=W.get(t)||l(W,t,{});let o=s[r];return o&&o[0]&&t.removeEventListener(r,...o),o=e(n)?n:[n,!1],s[r]=o,o[0]&&t.addEventListener(r,...o),n};function A(e,t){const n=this.n||(this.n=e);switch(typeof t){case"string":case"number":case"boolean":n!==e&&n.replaceWith(this.n=e),this.n.data=t;break;case"object":case"undefined":null==t?(this.n=e).data="":this.n=t.valueOf(),n.replaceWith(this.n)}return t}const O=()=>A.bind({n:null}),M=(e,t,n)=>e[n]=t,S=(e,t,n)=>M(e,t,n.slice(1)),E=(e,t,n)=>null==t?(C(e,n),t):M(e,t,n),T=(e,t)=>("function"==typeof t?t(e):t.current=e,t),j=(e,t,n)=>(null==t?C(e,n):$(e,n,t),t),B=(e,t,n)=>(e.toggleAttribute(n.slice(1),t),t),P=(e,t,n,s)=>((e,t,n,r,s)=>{const l=n.length;let o=t.length,i=l,c=0,a=0,u=null;for(;c<o||a<i;)if(o===c){const t=i<l?a?r(n[a-1],-0).nextSibling:r(n[i-a],0):s;for(;a<i;)e.insertBefore(r(n[a++],1),t)}else if(i===a)for(;c<o;)u&&u.has(t[c])||e.removeChild(r(t[c],-1)),c++;else if(t[c]===n[a])c++,a++;else if(t[o-1]===n[i-1])o--,i--;else if(t[c]===n[i-1]&&n[a]===t[o-1]){const s=r(t[--o],-1).nextSibling;e.insertBefore(r(n[a++],1),r(t[c++],-1).nextSibling),e.insertBefore(r(n[--i],1),s),t[o]=n[i]}else{if(!u){u=new Map;let e=a;for(;e<i;)u.set(n[e],e++)}if(u.has(t[c])){const s=u.get(t[c]);if(a<s&&s<i){let l=c,h=1;for(;++l<o&&l<i&&u.get(t[l])===s+h;)h++;if(h>s-a){const l=r(t[c],0);for(;a<s;)e.insertBefore(r(n[a++],1),l)}else e.replaceChild(r(n[a++],1),r(t[c++],-1))}else c++}else e.removeChild(r(t[c++],-1))}return n})(e.parentNode,s,t.length?t:r,d,e),R=new Map([["aria",(e,t)=>{for(const n in t){const r=t[n],s="role"===n?n:`aria-${n}`;null==r?C(e,s):$(e,s,r)}return t}],["class",(e,t)=>E(e,t,null==t?"class":"className")],["data",(e,t)=>{const{dataset:n}=e;for(const e in t)null==t[e]?delete n[e]:n[e]=t[e];return t}],["ref",T],["style",(e,t)=>null==t?E(e,t,"style"):M(e.style,t,"cssText")]]),z=(e,r,s)=>{switch(r[0]){case".":return S;case"?":return B;case"@":return k;default:return s||"ownerSVGElement"in e?"ref"===r?T:j:R.get(r)||(r in e?r.startsWith("on")?M:((e,r)=>{let s;do{s=n(e,r)}while(!s&&(e=t(e)));return s})(e,r)?.set?E:j:j)}},F=(e,t)=>(e.textContent=null==t?"":t,t);let L,D,H=document.createElement("template");var Z=(e,t)=>{if(t)return L||(L=document.createElementNS("http://www.w3.org/2000/svg","svg"),D=s(),D.selectNodeContents(L)),D.createContextualFragment(e);H.innerHTML=e;const{content:n}=H;return H=H.cloneNode(!1),n};const G=e=>{const t=[];let n;for(;n=e.parentNode;)t.push(t.indexOf.call(n.childNodes,e)),e=n;return t},V=(t,n,s)=>{const i=Z(((e,t,n)=>{let r=0;return e.join("").trim().replace(b,((e,t,r,s)=>`<${t}${r.replace(x,"=$2$1").trimEnd()}${s?n||w.test(t)?" /":`></${t}`:""}>`)).replace(y,(e=>""===e?`\x3c!--${t+r++}--\x3e`:t+r++))})(t,q,s),s),{length:c}=t;let a=!1,u=r;if(c>1){const t=document.createTreeWalker(i,129),r=[];let l=0,h=`${q}${l++}`;for(u=[];l<c;){const i=t.nextNode();if(8===i.nodeType){if(i.data===h){let t=e(n[l-1])?N:O;t===O?r.push(i):a=!0,u.push(o(8,G(i),t)),h=`${q}${l++}`}}else{let e;for(;i.hasAttribute(h);){e||(e=G(i));const t=i.getAttribute(h);u.push(o(2,e,z(i,t,s),t)),C(i,h),h=`${q}${l++}`}v.test(i.localName)&&i.textContent.trim()===`\x3c!--${h}--\x3e`&&(u.push(o(3,e||G(i),F)),h=`${q}${l++}`)}}for(l=0;l<r.length;l++)r[l].replaceWith(document.createTextNode(""))}const h=i.childNodes.length;return l(_,t,((e,t,n)=>({c:e,e:t,l:n}))(i,u,1===h&&a?0:h))},_=new WeakMap,q="isµ";var I=e=>(t,n)=>_.get(t)||V(t,n,e);const J=m(I(!1)),K=m(I(!0)),Q=(e,{s:t,t:n,v:s})=>{s.length&&e.s===r&&(e.s=[]);const l=U(e,s);if(e.t!==n){const{n:r,d:l}=(t?K:J)(n,s);e.t=n,e.n=r,e.d=l}else{const{d:t}=e;for(let e=0;e<l;e++){const n=s[e],r=t[e],{v:l}=r;if(n!==l){const{u:e,t:t,n:s}=r;r.v=e(t,n,s,l)}}}return e.n},U=({s:t},n)=>{const{length:s}=n;for(let l=0;l<s;l++){const s=n[l];s instanceof X?n[l]=Q(t[l]||(t[l]=i(r)),s):e(s)?U(t[l]||(t[l]=i([])),s):t[l]=null}return s<t.length&&t.splice(s),s};class X{constructor(e,t,n){this.s=e,this.t=t,this.v=n}}
/*! (c) Andrea Giammarchi - MIT */const Y=e=>(t,...n)=>new X(e,t,n),ee=Y(!1),te=Y(!0),ne=new WeakMap;var re=(e,t)=>{const n=ne.get(e)||l(ne,e,i(r)),s="function"==typeof t?t():t,{n:o}=n,c=s instanceof X?Q(n,s):s;return o!==c&&e.replaceChildren(n.n=c),e};
/*! (c) Andrea Giammarchi - MIT */const se=new WeakMap,le=e=>(t,n)=>{const s=se.get(t)||l(se,t,new Map);return s.get(n)||l(s,n,function(t,...n){return Q(this,new X(e,t,n))}.bind(i(r)))},oe=le(!1),ie=le(!0),ce=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),ae=Object.create(null),ue=new WeakMap,he=e=>e();var de=e=>(t,n)=>{let r=ue.get(t);var s;if(r&&(s=r,ce.unregister(s),r()),"function"==typeof n){const s=new WeakRef(t);return r=e((()=>{re(s.deref(),n)})),ue.set(t,r),((e,t,{debug:n,return:r,token:s=e}=ae)=>{const l=r||new Proxy(e,ae),o=[l,[t,e,!!n]];return!1!==s&&o.push(s),ce.register(...o),l})(r,he,{return:t})}return ue.delete(t),re(t,n)};export{X as Hole,R as attr,ee as html,oe as htmlFor,de as reactive,te as svg,ie as svgFor};
/*! (c) Andrea Giammarchi - MIT */const Y=e=>(t,...n)=>new X(e,t,n),ee=Y(!1),te=Y(!0),ne=new WeakMap;var re=(e,t,n)=>{const s=ne.get(e)||l(ne,e,i(r)),o=n&&"function"==typeof t?t():t,{n:c}=s,a=o instanceof X?Q(s,o):o;return c!==a&&e.replaceChildren(s.n=a),e};
/*! (c) Andrea Giammarchi - MIT */const se=new WeakMap,le=e=>(t,n)=>{const s=se.get(t)||l(se,t,new Map);return s.get(n)||l(s,n,function(t,...n){return Q(this,new X(e,t,n))}.bind(i(r)))},oe=le(!1),ie=le(!0),ce=new FinalizationRegistry((([e,t,n])=>{n&&console.debug(`Held value ${String(t)} not relevant anymore`),e(t)})),ae=Object.create(null),ue=new WeakMap,he=e=>e();var de=e=>(t,n)=>{let r=ue.get(t);var s;if(r&&(s=r,ce.unregister(s),r()),"function"==typeof n){const s=new WeakRef(t);return r=e((()=>{re(s.deref(),n(),!1)})),ue.set(t,r),((e,t,{debug:n,return:r,token:s=e}=ae)=>{const l=r||new Proxy(e,ae),o=[l,[t,e,!!n]];return!1!==s&&o.push(s),ce.register(...o),l})(r,he,{return:t})}return ue.delete(t),re(t,n,!1)};export{X as Hole,R as attr,ee as html,oe as htmlFor,de as reactive,te as svg,ie as svgFor};

@@ -5,3 +5,3 @@ export function cloned(node: any): any;

export function asElement({ [nodeType]: type }: {
"__@nodeType@25480": any;
"__@nodeType@25498": any;
}): boolean;

@@ -8,0 +8,0 @@ export function changeParentNode(node: any, parent: any): any;

export * from "@preact/signals-core";
import { Hole } from '../reactive.js';
export const render: <T>(where: T, what: () => Hole) => T;
export const render: <T>(where: T, what: Hole | (() => Hole)) => T;
import { html } from '../reactive.js';

@@ -5,0 +5,0 @@ import { svg } from '../reactive.js';

declare function _default<T>(where: T, what: (() => Hole) | Hole): T;
export default _default;
import { Hole } from '../rabbit.js';
export type Hole = import("../rabbit.js").Hole;

@@ -1,2 +0,3 @@

declare function _default(effect: any): <T>(where: T, what: () => Hole) => T;
declare function _default(effect: any): <T>(where: T, what: (() => Hole) | Hole) => T;
export default _default;
export type Hole = import("../rabbit.js").Hole;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc