@ryupold/vode 1.6.2 → 1.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vode.js +4 -4
- package/dist/vode.min.js +1 -1
- package/dist/vode.min.mjs +1 -1
- package/dist/vode.mjs +4 -4
- package/package.json +1 -1
- package/src/vode.ts +4 -4
package/dist/vode.js
CHANGED
|
@@ -575,8 +575,8 @@ var V = (() => {
|
|
|
575
575
|
oldNode.replaceWith(text);
|
|
576
576
|
} else {
|
|
577
577
|
let inserted = false;
|
|
578
|
-
for (let i =
|
|
579
|
-
const nextSibling = parent.childNodes[
|
|
578
|
+
for (let i = indexInParent; i < parent.childNodes.length; i++) {
|
|
579
|
+
const nextSibling = parent.childNodes[i];
|
|
580
580
|
if (nextSibling) {
|
|
581
581
|
nextSibling.before(text, nextSibling);
|
|
582
582
|
inserted = true;
|
|
@@ -608,8 +608,8 @@ var V = (() => {
|
|
|
608
608
|
oldNode.replaceWith(newNode);
|
|
609
609
|
} else {
|
|
610
610
|
let inserted = false;
|
|
611
|
-
for (let i =
|
|
612
|
-
const nextSibling = parent.childNodes[
|
|
611
|
+
for (let i = indexInParent; i < parent.childNodes.length; i++) {
|
|
612
|
+
const nextSibling = parent.childNodes[i];
|
|
613
613
|
if (nextSibling) {
|
|
614
614
|
nextSibling.before(newNode, nextSibling);
|
|
615
615
|
inserted = true;
|
package/dist/vode.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var V=(()=>{var D=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var q=(e,n)=>{for(var a in n)D(e,a,{get:n[a],enumerable:!0})},X=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of B(n))!_.call(e,t)&&t!==a&&D(e,t,{get:()=>n[t],enumerable:!(s=K(n,t))||s.enumerable});return e};var $=e=>X(D({},"__esModule",{value:!0}),e);var wo={};q(wo,{A:()=>st,ABBR:()=>at,ADDRESS:()=>rt,ANIMATE:()=>pn,ANIMATEMOTION:()=>ln,ANIMATETRANSFORM:()=>dn,ANNOTATION:()=>To,ANNOTATION_XML:()=>yo,AREA:()=>ct,ARTICLE:()=>it,ASIDE:()=>pt,AUDIO:()=>lt,B:()=>dt,BASE:()=>ft,BDI:()=>St,BDO:()=>ut,BLOCKQUOTE:()=>Tt,BODY:()=>yt,BR:()=>gt,BUTTON:()=>xt,CANVAS:()=>ht,CAPTION:()=>mt,CIRCLE:()=>fn,CITE:()=>Et,CLIPPATH:()=>Sn,CODE:()=>bt,COL:()=>Pt,COLGROUP:()=>At,DATA:()=>Ct,DATALIST:()=>Mt,DD:()=>Nt,DEFS:()=>un,DEL:()=>Rt,DESC:()=>Tn,DETAILS:()=>Ot,DFN:()=>Dt,DIALOG:()=>vt,DIV:()=>Lt,DL:()=>It,DT:()=>Vt,DelegateStateContext:()=>V,ELLIPSE:()=>yn,EM:()=>Ft,EMBED:()=>kt,FEBLEND:()=>gn,FECOLORMATRIX:()=>xn,FECOMPONENTTRANSFER:()=>hn,FECOMPOSITE:()=>mn,FECONVOLVEMATRIX:()=>En,FEDIFFUSELIGHTING:()=>bn,FEDISPLACEMENTMAP:()=>Pn,FEDISTANTLIGHT:()=>An,FEDROPSHADOW:()=>Cn,FEFLOOD:()=>Mn,FEFUNCA:()=>Nn,FEFUNCB:()=>Rn,FEFUNCG:()=>On,FEFUNCR:()=>Dn,FEGAUSSIANBLUR:()=>vn,FEIMAGE:()=>Ln,FEMERGE:()=>In,FEMERGENODE:()=>Vn,FEMORPHOLOGY:()=>Fn,FEOFFSET:()=>kn,FEPOINTLIGHT:()=>jn,FESPECULARLIGHTING:()=>Hn,FESPOTLIGHT:()=>Un,FETILE:()=>Gn,FETURBULENCE:()=>Kn,FIELDSET:()=>jt,FIGCAPTION:()=>Ht,FIGURE:()=>Ut,FILTER:()=>Bn,FOOTER:()=>Gt,FOREIGNOBJECT:()=>_n,FORM:()=>Kt,G:()=>qn,H1:()=>Bt,H2:()=>_t,H3:()=>qt,H4:()=>Xt,H5:()=>$t,H6:()=>wt,HEAD:()=>Yt,HEADER:()=>Wt,HGROUP:()=>Jt,HR:()=>Qt,HTML:()=>zt,I:()=>Zt,IFRAME:()=>te,IMAGE:()=>Xn,IMG:()=>ee,INPUT:()=>ne,INS:()=>oe,KBD:()=>se,KeyStateContext:()=>I,LABEL:()=>ae,LEGEND:()=>re,LI:()=>ce,LINE:()=>$n,LINEARGRADIENT:()=>wn,LINK:()=>ie,MACTION:()=>go,MAIN:()=>pe,MAP:()=>le,MARK:()=>de,MARKER:()=>Yn,MASK:()=>Wn,MATH:()=>xo,MENU:()=>fe,MERROR:()=>ho,META:()=>Se,METADATA:()=>Jn,METER:()=>ue,MFRAC:()=>mo,MI:()=>Eo,MMULTISCRIPTS:()=>bo,MN:()=>Po,MO:()=>Ao,MOVER:()=>Co,MPADDED:()=>Mo,MPATH:()=>Qn,MPHANTOM:()=>No,MPRESCRIPTS:()=>Ro,MROOT:()=>Oo,MROW:()=>Do,MS:()=>vo,MSPACE:()=>Lo,MSQRT:()=>Io,MSTYLE:()=>Vo,MSUB:()=>Fo,MSUBSUP:()=>ko,MSUP:()=>jo,MTABLE:()=>Ho,MTD:()=>Uo,MTEXT:()=>Go,MTR:()=>Ko,MUNDER:()=>Bo,MUNDEROVER:()=>_o,NAV:()=>Te,NOSCRIPT:()=>ye,OBJECT:()=>ge,OL:()=>xe,OPTGROUP:()=>he,OPTION:()=>me,OUTPUT:()=>Ee,P:()=>be,PATH:()=>zn,PATTERN:()=>Zn,PICTURE:()=>Pe,POLYGON:()=>to,POLYLINE:()=>eo,PRE:()=>Ae,PROGRESS:()=>Ce,Q:()=>Me,RADIALGRADIENT:()=>no,RECT:()=>oo,RP:()=>Ne,RT:()=>Re,RUBY:()=>Oe,S:()=>De,SAMP:()=>ve,SCRIPT:()=>Le,SEARCH:()=>Ie,SECTION:()=>Ve,SELECT:()=>Fe,SEMANTICS:()=>qo,SET:()=>so,SLOT:()=>ke,SMALL:()=>je,SOURCE:()=>He,SPAN:()=>Ue,STOP:()=>ao,STRONG:()=>Ge,STYLE:()=>Ke,SUB:()=>Be,SUMMARY:()=>_e,SUP:()=>qe,SVG:()=>ro,SWITCH:()=>co,SYMBOL:()=>io,TABLE:()=>Xe,TBODY:()=>$e,TD:()=>we,TEMPLATE:()=>Ye,TEXT:()=>po,TEXTAREA:()=>We,TEXTPATH:()=>lo,TFOOT:()=>Je,TH:()=>Qe,THEAD:()=>ze,TIME:()=>Ze,TITLE:()=>tn,TR:()=>en,TRACK:()=>nn,TSPAN:()=>fo,U:()=>on,UL:()=>sn,USE:()=>So,VAR:()=>an,VIDEO:()=>rn,VIEW:()=>uo,WBR:()=>cn,app:()=>Y,child:()=>et,childCount:()=>tt,children:()=>M,childrenStart:()=>O,createPatch:()=>z,createState:()=>Q,defuse:()=>W,globals:()=>P,hydrate:()=>R,memo:()=>J,mergeClass:()=>Xo,mergeStyle:()=>$o,props:()=>A,tag:()=>Z,vode:()=>w});var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function w(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function Y(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let o=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{o.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}o.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;o.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)o.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?o.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=o;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(n,e.parentElement,b,b,R(e,!0),a(n));for(let p of s)o.patch(p);return p=>o.patch(p)}function W(e){if(e?._vode){let a=function(t){if(!t?.node)return;let o=A(t);if(o){for(let c in o)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=M(t);if(r)for(let c of r)a(c)};var n=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function R(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&R(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function J(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function Q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function z(e){return e}function Z(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function M(e){let n=O(e);return n>0?e.slice(n):null}function tt(e){let n=O(e);return n<0?0:e.length-n}function et(e,n){let a=O(e);if(a>0)return e[n+a]}function O(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=E({},t,a):typeof o=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,n,a,s,t,o,r){try{o=v(e,o,t);let c=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&ot(o),p=!c&&nt(o),y=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(y&&b?o=o.wholeText:y&&p&&(o=[...o]),f&&b)return i.nodeValue!==o&&(i.nodeValue=o),t;if(b&&(!i||!f)){let l=document.createTextNode(o);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=0;d<n.childNodes.length;d++){let g=n.childNodes[s+d];if(g){g.before(l,g),S=!0;break}}S||n.appendChild(l)}return l}if(p&&(!i||f||t[0]!==o[0])){let l=o;1 in l&&(l[1]=v(e,l[1],void 0));let S=A(o);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,o[0]):document.createElement(o[0]);if(o.node=d,L(e,d,void 0,S,r),S&&"catch"in S&&(o.node.catch=null,o.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=0;T<n.childNodes.length;T++){let u=n.childNodes[s+T];if(u){u.before(d,u),x=!0;break}}x||n.appendChild(d)}let g=M(o);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r);o[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),o}if(!f&&p&&t[0]===o[0]){o.node=i;let l=o,S=t,d=A(o),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=v(e,l[1],S[1]),u!==l[1]&&L(e,i,g,d,r)}else L(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(o.node.catch=null,o.node.removeAttribute("catch"));let x=M(o),T=M(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let U=x[m],G=T&&T[m],F=C(e,i,m,h,G,U,r);o[m+u]=F,F&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return o}}catch(c){let f=A(o)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,n,a,s,R(o?.node||t?.node,!0),i,r)}else throw c}}function nt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function ot(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function v(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let o=k(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function k(e,n){return typeof e=="function"?k(e(n),n):e}function L(e,n,a,s,t){if(!s&&!a)return;let o=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=N(e,n,r,c,f,o):N(e,n,r,c,void 0,o))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}else if(s)for(let r in s){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}function N(e,n,a,s,t,o){if(a==="style")if(!t)n.style.cssText="";else if(typeof t=="string")s!==t&&(n.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(n.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(n.style[r]=f)}}else for(let r in t)n.style[r]=t[r];else if(a==="class")t?n.setAttribute("class",j(t)):n.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));n[a]=r}else n[a]=null;else o||(n[a]=t),t==null||t===!1?n.removeAttribute(a):n.setAttribute(a,t);return t}function j(e){return typeof e=="string"?e:Array.isArray(e)?e.map(j).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var st="a",at="abbr",rt="address",ct="area",it="article",pt="aside",lt="audio",dt="b",ft="base",St="bdi",ut="bdo",Tt="blockquote",yt="body",gt="br",xt="button",ht="canvas",mt="caption",Et="cite",bt="code",Pt="col",At="colgroup",Ct="data",Mt="datalist",Nt="dd",Rt="del",Ot="details",Dt="dfn",vt="dialog",Lt="div",It="dl",Vt="dt",Ft="em",kt="embed",jt="fieldset",Ht="figcaption",Ut="figure",Gt="footer",Kt="form",Bt="h1",_t="h2",qt="h3",Xt="h4",$t="h5",wt="h6",Yt="head",Wt="header",Jt="hgroup",Qt="hr",zt="html",Zt="i",te="iframe",ee="img",ne="input",oe="ins",se="kbd",ae="label",re="legend",ce="li",ie="link",pe="main",le="map",de="mark",fe="menu",Se="meta",ue="meter",Te="nav",ye="noscript",ge="object",xe="ol",he="optgroup",me="option",Ee="output",be="p",Pe="picture",Ae="pre",Ce="progress",Me="q",Ne="rp",Re="rt",Oe="ruby",De="s",ve="samp",Le="script",Ie="search",Ve="section",Fe="select",ke="slot",je="small",He="source",Ue="span",Ge="strong",Ke="style",Be="sub",_e="summary",qe="sup",Xe="table",$e="tbody",we="td",Ye="template",We="textarea",Je="tfoot",Qe="th",ze="thead",Ze="time",tn="title",en="tr",nn="track",on="u",sn="ul",an="var",rn="video",cn="wbr",pn="animate",ln="animateMotion",dn="animateTransform",fn="circle",Sn="clipPath",un="defs",Tn="desc",yn="ellipse",gn="feBlend",xn="feColorMatrix",hn="feComponentTransfer",mn="feComposite",En="feConvolveMatrix",bn="feDiffuseLighting",Pn="feDisplacementMap",An="feDistantLight",Cn="feDropShadow",Mn="feFlood",Nn="feFuncA",Rn="feFuncB",On="feFuncG",Dn="feFuncR",vn="feGaussianBlur",Ln="feImage",In="feMerge",Vn="feMergeNode",Fn="feMorphology",kn="feOffset",jn="fePointLight",Hn="feSpecularLighting",Un="feSpotLight",Gn="feTile",Kn="feTurbulence",Bn="filter",_n="foreignObject",qn="g",Xn="image",$n="line",wn="linearGradient",Yn="marker",Wn="mask",Jn="metadata",Qn="mpath",zn="path",Zn="pattern",to="polygon",eo="polyline",no="radialGradient",oo="rect",so="set",ao="stop",ro="svg",co="switch",io="symbol",po="text",lo="textPath",fo="tspan",So="use",uo="view",To="annotation",yo="annotation-xml",go="maction",xo="math",ho="merror",mo="mfrac",Eo="mi",bo="mmultiscripts",Po="mn",Ao="mo",Co="mover",Mo="mpadded",No="mphantom",Ro="mprescripts",Oo="mroot",Do="mrow",vo="ms",Lo="mspace",Io="msqrt",Vo="mstyle",Fo="msub",ko="msubsup",jo="msup",Ho="mtable",Uo="mtd",Go="mtext",Ko="mtr",Bo="munder",_o="munderover",qo="semantics";function Xo(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),c=new Set([...o,...r]);n=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var H=document.createElement("div");function $o(...e){try{let n=H.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)n[s]=a[s];else typeof a=="string"&&(n.cssText+=";"+a);return n.cssText}finally{H.style.cssText=""}}var I=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},V=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return $(wo);})();
|
|
1
|
+
"use strict";var V=(()=>{var D=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var q=(e,n)=>{for(var a in n)D(e,a,{get:n[a],enumerable:!0})},X=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of B(n))!_.call(e,t)&&t!==a&&D(e,t,{get:()=>n[t],enumerable:!(s=K(n,t))||s.enumerable});return e};var $=e=>X(D({},"__esModule",{value:!0}),e);var wo={};q(wo,{A:()=>st,ABBR:()=>at,ADDRESS:()=>rt,ANIMATE:()=>pn,ANIMATEMOTION:()=>ln,ANIMATETRANSFORM:()=>dn,ANNOTATION:()=>To,ANNOTATION_XML:()=>yo,AREA:()=>ct,ARTICLE:()=>it,ASIDE:()=>pt,AUDIO:()=>lt,B:()=>dt,BASE:()=>ft,BDI:()=>St,BDO:()=>ut,BLOCKQUOTE:()=>Tt,BODY:()=>yt,BR:()=>gt,BUTTON:()=>xt,CANVAS:()=>ht,CAPTION:()=>mt,CIRCLE:()=>fn,CITE:()=>Et,CLIPPATH:()=>Sn,CODE:()=>bt,COL:()=>Pt,COLGROUP:()=>At,DATA:()=>Ct,DATALIST:()=>Mt,DD:()=>Nt,DEFS:()=>un,DEL:()=>Rt,DESC:()=>Tn,DETAILS:()=>Ot,DFN:()=>Dt,DIALOG:()=>vt,DIV:()=>Lt,DL:()=>It,DT:()=>Vt,DelegateStateContext:()=>V,ELLIPSE:()=>yn,EM:()=>Ft,EMBED:()=>kt,FEBLEND:()=>gn,FECOLORMATRIX:()=>xn,FECOMPONENTTRANSFER:()=>hn,FECOMPOSITE:()=>mn,FECONVOLVEMATRIX:()=>En,FEDIFFUSELIGHTING:()=>bn,FEDISPLACEMENTMAP:()=>Pn,FEDISTANTLIGHT:()=>An,FEDROPSHADOW:()=>Cn,FEFLOOD:()=>Mn,FEFUNCA:()=>Nn,FEFUNCB:()=>Rn,FEFUNCG:()=>On,FEFUNCR:()=>Dn,FEGAUSSIANBLUR:()=>vn,FEIMAGE:()=>Ln,FEMERGE:()=>In,FEMERGENODE:()=>Vn,FEMORPHOLOGY:()=>Fn,FEOFFSET:()=>kn,FEPOINTLIGHT:()=>jn,FESPECULARLIGHTING:()=>Hn,FESPOTLIGHT:()=>Un,FETILE:()=>Gn,FETURBULENCE:()=>Kn,FIELDSET:()=>jt,FIGCAPTION:()=>Ht,FIGURE:()=>Ut,FILTER:()=>Bn,FOOTER:()=>Gt,FOREIGNOBJECT:()=>_n,FORM:()=>Kt,G:()=>qn,H1:()=>Bt,H2:()=>_t,H3:()=>qt,H4:()=>Xt,H5:()=>$t,H6:()=>wt,HEAD:()=>Yt,HEADER:()=>Wt,HGROUP:()=>Jt,HR:()=>Qt,HTML:()=>zt,I:()=>Zt,IFRAME:()=>te,IMAGE:()=>Xn,IMG:()=>ee,INPUT:()=>ne,INS:()=>oe,KBD:()=>se,KeyStateContext:()=>I,LABEL:()=>ae,LEGEND:()=>re,LI:()=>ce,LINE:()=>$n,LINEARGRADIENT:()=>wn,LINK:()=>ie,MACTION:()=>go,MAIN:()=>pe,MAP:()=>le,MARK:()=>de,MARKER:()=>Yn,MASK:()=>Wn,MATH:()=>xo,MENU:()=>fe,MERROR:()=>ho,META:()=>Se,METADATA:()=>Jn,METER:()=>ue,MFRAC:()=>mo,MI:()=>Eo,MMULTISCRIPTS:()=>bo,MN:()=>Po,MO:()=>Ao,MOVER:()=>Co,MPADDED:()=>Mo,MPATH:()=>Qn,MPHANTOM:()=>No,MPRESCRIPTS:()=>Ro,MROOT:()=>Oo,MROW:()=>Do,MS:()=>vo,MSPACE:()=>Lo,MSQRT:()=>Io,MSTYLE:()=>Vo,MSUB:()=>Fo,MSUBSUP:()=>ko,MSUP:()=>jo,MTABLE:()=>Ho,MTD:()=>Uo,MTEXT:()=>Go,MTR:()=>Ko,MUNDER:()=>Bo,MUNDEROVER:()=>_o,NAV:()=>Te,NOSCRIPT:()=>ye,OBJECT:()=>ge,OL:()=>xe,OPTGROUP:()=>he,OPTION:()=>me,OUTPUT:()=>Ee,P:()=>be,PATH:()=>zn,PATTERN:()=>Zn,PICTURE:()=>Pe,POLYGON:()=>to,POLYLINE:()=>eo,PRE:()=>Ae,PROGRESS:()=>Ce,Q:()=>Me,RADIALGRADIENT:()=>no,RECT:()=>oo,RP:()=>Ne,RT:()=>Re,RUBY:()=>Oe,S:()=>De,SAMP:()=>ve,SCRIPT:()=>Le,SEARCH:()=>Ie,SECTION:()=>Ve,SELECT:()=>Fe,SEMANTICS:()=>qo,SET:()=>so,SLOT:()=>ke,SMALL:()=>je,SOURCE:()=>He,SPAN:()=>Ue,STOP:()=>ao,STRONG:()=>Ge,STYLE:()=>Ke,SUB:()=>Be,SUMMARY:()=>_e,SUP:()=>qe,SVG:()=>ro,SWITCH:()=>co,SYMBOL:()=>io,TABLE:()=>Xe,TBODY:()=>$e,TD:()=>we,TEMPLATE:()=>Ye,TEXT:()=>po,TEXTAREA:()=>We,TEXTPATH:()=>lo,TFOOT:()=>Je,TH:()=>Qe,THEAD:()=>ze,TIME:()=>Ze,TITLE:()=>tn,TR:()=>en,TRACK:()=>nn,TSPAN:()=>fo,U:()=>on,UL:()=>sn,USE:()=>So,VAR:()=>an,VIDEO:()=>rn,VIEW:()=>uo,WBR:()=>cn,app:()=>Y,child:()=>et,childCount:()=>tt,children:()=>M,childrenStart:()=>O,createPatch:()=>z,createState:()=>Q,defuse:()=>W,globals:()=>P,hydrate:()=>R,memo:()=>J,mergeClass:()=>Xo,mergeStyle:()=>$o,props:()=>A,tag:()=>Z,vode:()=>w});var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function w(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function Y(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let o=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{o.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}o.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;o.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)o.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?o.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=o;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(n,e.parentElement,b,b,R(e,!0),a(n));for(let p of s)o.patch(p);return p=>o.patch(p)}function W(e){if(e?._vode){let a=function(t){if(!t?.node)return;let o=A(t);if(o){for(let c in o)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=M(t);if(r)for(let c of r)a(c)};var n=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function R(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&R(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function J(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function Q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function z(e){return e}function Z(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function M(e){let n=O(e);return n>0?e.slice(n):null}function tt(e){let n=O(e);return n<0?0:e.length-n}function et(e,n){let a=O(e);if(a>0)return e[n+a]}function O(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=E({},t,a):typeof o=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,n,a,s,t,o,r){try{o=v(e,o,t);let c=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&ot(o),p=!c&&nt(o),y=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(y&&b?o=o.wholeText:y&&p&&(o=[...o]),f&&b)return i.nodeValue!==o&&(i.nodeValue=o),t;if(b&&(!i||!f)){let l=document.createTextNode(o);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=s;d<n.childNodes.length;d++){let g=n.childNodes[d];if(g){g.before(l,g),S=!0;break}}S||n.appendChild(l)}return l}if(p&&(!i||f||t[0]!==o[0])){let l=o;1 in l&&(l[1]=v(e,l[1],void 0));let S=A(o);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,o[0]):document.createElement(o[0]);if(o.node=d,L(e,d,void 0,S,r),S&&"catch"in S&&(o.node.catch=null,o.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=s;T<n.childNodes.length;T++){let u=n.childNodes[T];if(u){u.before(d,u),x=!0;break}}x||n.appendChild(d)}let g=M(o);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r);o[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),o}if(!f&&p&&t[0]===o[0]){o.node=i;let l=o,S=t,d=A(o),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=v(e,l[1],S[1]),u!==l[1]&&L(e,i,g,d,r)}else L(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(o.node.catch=null,o.node.removeAttribute("catch"));let x=M(o),T=M(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let U=x[m],G=T&&T[m],F=C(e,i,m,h,G,U,r);o[m+u]=F,F&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return o}}catch(c){let f=A(o)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,n,a,s,R(o?.node||t?.node,!0),i,r)}else throw c}}function nt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function ot(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function v(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let o=k(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function k(e,n){return typeof e=="function"?k(e(n),n):e}function L(e,n,a,s,t){if(!s&&!a)return;let o=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=N(e,n,r,c,f,o):N(e,n,r,c,void 0,o))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}else if(s)for(let r in s){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}function N(e,n,a,s,t,o){if(a==="style")if(!t)n.style.cssText="";else if(typeof t=="string")s!==t&&(n.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(n.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(n.style[r]=f)}}else for(let r in t)n.style[r]=t[r];else if(a==="class")t?n.setAttribute("class",j(t)):n.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));n[a]=r}else n[a]=null;else o||(n[a]=t),t==null||t===!1?n.removeAttribute(a):n.setAttribute(a,t);return t}function j(e){return typeof e=="string"?e:Array.isArray(e)?e.map(j).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var st="a",at="abbr",rt="address",ct="area",it="article",pt="aside",lt="audio",dt="b",ft="base",St="bdi",ut="bdo",Tt="blockquote",yt="body",gt="br",xt="button",ht="canvas",mt="caption",Et="cite",bt="code",Pt="col",At="colgroup",Ct="data",Mt="datalist",Nt="dd",Rt="del",Ot="details",Dt="dfn",vt="dialog",Lt="div",It="dl",Vt="dt",Ft="em",kt="embed",jt="fieldset",Ht="figcaption",Ut="figure",Gt="footer",Kt="form",Bt="h1",_t="h2",qt="h3",Xt="h4",$t="h5",wt="h6",Yt="head",Wt="header",Jt="hgroup",Qt="hr",zt="html",Zt="i",te="iframe",ee="img",ne="input",oe="ins",se="kbd",ae="label",re="legend",ce="li",ie="link",pe="main",le="map",de="mark",fe="menu",Se="meta",ue="meter",Te="nav",ye="noscript",ge="object",xe="ol",he="optgroup",me="option",Ee="output",be="p",Pe="picture",Ae="pre",Ce="progress",Me="q",Ne="rp",Re="rt",Oe="ruby",De="s",ve="samp",Le="script",Ie="search",Ve="section",Fe="select",ke="slot",je="small",He="source",Ue="span",Ge="strong",Ke="style",Be="sub",_e="summary",qe="sup",Xe="table",$e="tbody",we="td",Ye="template",We="textarea",Je="tfoot",Qe="th",ze="thead",Ze="time",tn="title",en="tr",nn="track",on="u",sn="ul",an="var",rn="video",cn="wbr",pn="animate",ln="animateMotion",dn="animateTransform",fn="circle",Sn="clipPath",un="defs",Tn="desc",yn="ellipse",gn="feBlend",xn="feColorMatrix",hn="feComponentTransfer",mn="feComposite",En="feConvolveMatrix",bn="feDiffuseLighting",Pn="feDisplacementMap",An="feDistantLight",Cn="feDropShadow",Mn="feFlood",Nn="feFuncA",Rn="feFuncB",On="feFuncG",Dn="feFuncR",vn="feGaussianBlur",Ln="feImage",In="feMerge",Vn="feMergeNode",Fn="feMorphology",kn="feOffset",jn="fePointLight",Hn="feSpecularLighting",Un="feSpotLight",Gn="feTile",Kn="feTurbulence",Bn="filter",_n="foreignObject",qn="g",Xn="image",$n="line",wn="linearGradient",Yn="marker",Wn="mask",Jn="metadata",Qn="mpath",zn="path",Zn="pattern",to="polygon",eo="polyline",no="radialGradient",oo="rect",so="set",ao="stop",ro="svg",co="switch",io="symbol",po="text",lo="textPath",fo="tspan",So="use",uo="view",To="annotation",yo="annotation-xml",go="maction",xo="math",ho="merror",mo="mfrac",Eo="mi",bo="mmultiscripts",Po="mn",Ao="mo",Co="mover",Mo="mpadded",No="mphantom",Ro="mprescripts",Oo="mroot",Do="mrow",vo="ms",Lo="mspace",Io="msqrt",Vo="mstyle",Fo="msub",ko="msubsup",jo="msup",Ho="mtable",Uo="mtd",Go="mtext",Ko="mtr",Bo="munder",_o="munderover",qo="semantics";function Xo(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),c=new Set([...o,...r]);n=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var H=document.createElement("div");function $o(...e){try{let n=H.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)n[s]=a[s];else typeof a=="string"&&(n.cssText+=";"+a);return n.cssText}finally{H.style.cssText=""}}var I=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},V=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return $(wo);})();
|
package/dist/vode.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function B(e,o,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...a]:[e,...a]}function _(e,o,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let n=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{n.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}n.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;n.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)n.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?n.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=n;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(o,e.parentElement,b,b,D(e,!0),a(o));for(let p of s)n.patch(p);return p=>n.patch(p)}function q(e){if(e?._vode){let a=function(t){if(!t?.node)return;let n=A(t);if(n){for(let c in n)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=N(t);if(r)for(let c of r)a(c)};var o=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function D(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(o&&(s.node=e),e?.hasAttributes()){let t={},n=e.attributes;for(let r of n)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let n of e.childNodes){let r=n&&D(n,o);r?s.push(r):n&&o&&t.push(n)}for(let n of t)n.remove()}return s}else return}function X(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function $(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function w(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function N(e){let o=v(e);return o>0?e.slice(o):null}function W(e){let o=v(e);return o<0?0:e.length-o}function J(e,o){let a=v(e);if(a>0)return e[o+a]}function v(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,o,a){if(!o)return e;for(let s in o){let t=o[s];if(t&&typeof t=="object"){let n=e[s];n?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&n!==t?e[s]=new Date(t):Array.isArray(n)?e[s]=E({},t,a):typeof n=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,o,a,s,t,n,r){try{n=R(e,n,t);let c=!n||typeof n=="number"||typeof n=="boolean";if(n===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&K(n),p=!c&&G(n),y=!!n&&typeof n!="string"&&!!(n?.node||n?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof n+" "+JSON.stringify(n));if(y&&b?n=n.wholeText:y&&p&&(n=[...n]),f&&b)return i.nodeValue!==n&&(i.nodeValue=n),t;if(b&&(!i||!f)){let l=document.createTextNode(n);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=0;d<o.childNodes.length;d++){let g=o.childNodes[s+d];if(g){g.before(l,g),S=!0;break}}S||o.appendChild(l)}return l}if(p&&(!i||f||t[0]!==n[0])){let l=n;1 in l&&(l[1]=R(e,l[1],void 0));let S=A(n);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,n[0]):document.createElement(n[0]);if(n.node=d,O(e,d,void 0,S,r),S&&"catch"in S&&(n.node.catch=null,n.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=0;T<o.childNodes.length;T++){let u=o.childNodes[s+T];if(u){u.before(d,u),x=!0;break}}x||o.appendChild(d)}let g=N(n);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r);n[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),n}if(!f&&p&&t[0]===n[0]){n.node=i;let l=n,S=t,d=A(n),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=R(e,l[1],S[1]),u!==l[1]&&O(e,i,g,d,r)}else O(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(n.node.catch=null,n.node.removeAttribute("catch"));let x=N(n),T=N(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let H=x[m],U=T&&T[m],L=C(e,i,m,h,U,H,r);n[m+u]=L,L&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return n}}catch(c){let f=A(n)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,o,a,s,D(n?.node||t?.node,!0),i,r)}else throw c}}function G(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function K(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,o,a){if(typeof o!="function")return o;let s=o?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let n=I(o,e);return typeof n=="object"&&(n.__memo=o?.__memo),n}function I(e,o){return typeof e=="function"?I(e(o),o):e}function O(e,o,a,s,t){if(!s&&!a)return;let n=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=M(e,o,r,c,f,n):M(e,o,r,c,void 0,n))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}else if(s)for(let r in s){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}function M(e,o,a,s,t,n){if(a==="style")if(!t)o.style.cssText="";else if(typeof t=="string")s!==t&&(o.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(o.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(o.style[r]=f)}}else for(let r in t)o.style[r]=t[r];else if(a==="class")t?o.setAttribute("class",V(t)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));o[a]=r}else o[a]=null;else n||(o[a]=t),t==null||t===!1?o.removeAttribute(a):o.setAttribute(a,t);return t}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var z="a",Z="abbr",tt="address",et="area",nt="article",ot="aside",st="audio",at="b",rt="base",ct="bdi",it="bdo",pt="blockquote",lt="body",dt="br",ft="button",St="canvas",ut="caption",Tt="cite",yt="code",gt="col",xt="colgroup",ht="data",mt="datalist",Et="dd",bt="del",Pt="details",At="dfn",Ct="dialog",Mt="div",Nt="dl",Rt="dt",Ot="em",Dt="embed",vt="fieldset",Lt="figcaption",It="figure",Vt="footer",Ft="form",kt="h1",jt="h2",Ht="h3",Ut="h4",Gt="h5",Kt="h6",Bt="head",_t="header",qt="hgroup",Xt="hr",$t="html",wt="i",Yt="iframe",Wt="img",Jt="input",Qt="ins",zt="kbd",Zt="label",te="legend",ee="li",ne="link",oe="main",se="map",ae="mark",re="menu",ce="meta",ie="meter",pe="nav",le="noscript",de="object",fe="ol",Se="optgroup",ue="option",Te="output",ye="p",ge="picture",xe="pre",he="progress",me="q",Ee="rp",be="rt",Pe="ruby",Ae="s",Ce="samp",Me="script",Ne="search",Re="section",Oe="select",De="slot",ve="small",Le="source",Ie="span",Ve="strong",Fe="style",ke="sub",je="summary",He="sup",Ue="table",Ge="tbody",Ke="td",Be="template",_e="textarea",qe="tfoot",Xe="th",$e="thead",we="time",Ye="title",We="tr",Je="track",Qe="u",ze="ul",Ze="var",tn="video",en="wbr",nn="animate",on="animateMotion",sn="animateTransform",an="circle",rn="clipPath",cn="defs",pn="desc",ln="ellipse",dn="feBlend",fn="feColorMatrix",Sn="feComponentTransfer",un="feComposite",Tn="feConvolveMatrix",yn="feDiffuseLighting",gn="feDisplacementMap",xn="feDistantLight",hn="feDropShadow",mn="feFlood",En="feFuncA",bn="feFuncB",Pn="feFuncG",An="feFuncR",Cn="feGaussianBlur",Mn="feImage",Nn="feMerge",Rn="feMergeNode",On="feMorphology",Dn="feOffset",vn="fePointLight",Ln="feSpecularLighting",In="feSpotLight",Vn="feTile",Fn="feTurbulence",kn="filter",jn="foreignObject",Hn="g",Un="image",Gn="line",Kn="linearGradient",Bn="marker",_n="mask",qn="metadata",Xn="mpath",$n="path",wn="pattern",Yn="polygon",Wn="polyline",Jn="radialGradient",Qn="rect",zn="set",Zn="stop",to="svg",eo="switch",no="symbol",oo="text",so="textPath",ao="tspan",ro="use",co="view",io="annotation",po="annotation-xml",lo="maction",fo="math",So="merror",uo="mfrac",To="mi",yo="mmultiscripts",go="mn",xo="mo",ho="mover",mo="mpadded",Eo="mphantom",bo="mprescripts",Po="mroot",Ao="mrow",Co="ms",Mo="mspace",No="msqrt",Ro="mstyle",Oo="msub",Do="msubsup",vo="msup",Lo="mtable",Io="mtd",Vo="mtext",Fo="mtr",ko="munder",jo="munderover",Ho="semantics";function Go(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let a=1;a<e.length;a++){let s=o,t=e[a];if(!s)o=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let n=s.split(" "),r=t.split(" "),c=new Set([...n,...r]);o=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let n=new Set([...t,...s.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let n=new Set([...s,...t.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let n=new Set([...s,...t]);o=Array.from(n).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")o={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")o={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")o={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let n={...s};for(let r of t)n[r]=!0;o=n}else if(Array.isArray(s)&&typeof t=="object"){let n={};for(let r of s)n[r]=!0;for(let r of Object.keys(t))n[r]=t[r];o=n}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return o}var F=document.createElement("div");function Bo(...e){try{let o=F.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)o[s]=a[s];else typeof a=="string"&&(o.cssText+=";"+a);return o.cssText}finally{F.style.cssText=""}}var k=class{constructor(o,a){this.state=o;this.path=a;this.keys=a.split(".")}keys;get(){let o=this.keys,a=this.state?this.state[o[0]]:void 0;for(let s=1;s<o.length&&a;s++)a=a[o[s]];return a}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let a=[];for(let s of o)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(o))}createPatch(o){let a={};return this.putDeep(o,a),a}putDeep(o,a){let s=this.keys;if(s.length>1){let t=0,n=a[s[t]];for((typeof n!="object"||n===null)&&(a[s[t]]=n={}),t=1;t<s.length-1;t++){let r=n;n=n[s[t]],(typeof n!="object"||n===null)&&(r[s[t]]=n={})}n[s[t]]=o}else typeof a[s[0]]=="object"&&typeof o=="object"?Object.assign(a[s[0]],o):a[s[0]]=o}},j=class{constructor(o,a,s,t){this.state=o;this.get=a;this.put=s;this.patch=t}};export{z as A,Z as ABBR,tt as ADDRESS,nn as ANIMATE,on as ANIMATEMOTION,sn as ANIMATETRANSFORM,io as ANNOTATION,po as ANNOTATION_XML,et as AREA,nt as ARTICLE,ot as ASIDE,st as AUDIO,at as B,rt as BASE,ct as BDI,it as BDO,pt as BLOCKQUOTE,lt as BODY,dt as BR,ft as BUTTON,St as CANVAS,ut as CAPTION,an as CIRCLE,Tt as CITE,rn as CLIPPATH,yt as CODE,gt as COL,xt as COLGROUP,ht as DATA,mt as DATALIST,Et as DD,cn as DEFS,bt as DEL,pn as DESC,Pt as DETAILS,At as DFN,Ct as DIALOG,Mt as DIV,Nt as DL,Rt as DT,j as DelegateStateContext,ln as ELLIPSE,Ot as EM,Dt as EMBED,dn as FEBLEND,fn as FECOLORMATRIX,Sn as FECOMPONENTTRANSFER,un as FECOMPOSITE,Tn as FECONVOLVEMATRIX,yn as FEDIFFUSELIGHTING,gn as FEDISPLACEMENTMAP,xn as FEDISTANTLIGHT,hn as FEDROPSHADOW,mn as FEFLOOD,En as FEFUNCA,bn as FEFUNCB,Pn as FEFUNCG,An as FEFUNCR,Cn as FEGAUSSIANBLUR,Mn as FEIMAGE,Nn as FEMERGE,Rn as FEMERGENODE,On as FEMORPHOLOGY,Dn as FEOFFSET,vn as FEPOINTLIGHT,Ln as FESPECULARLIGHTING,In as FESPOTLIGHT,Vn as FETILE,Fn as FETURBULENCE,vt as FIELDSET,Lt as FIGCAPTION,It as FIGURE,kn as FILTER,Vt as FOOTER,jn as FOREIGNOBJECT,Ft as FORM,Hn as G,kt as H1,jt as H2,Ht as H3,Ut as H4,Gt as H5,Kt as H6,Bt as HEAD,_t as HEADER,qt as HGROUP,Xt as HR,$t as HTML,wt as I,Yt as IFRAME,Un as IMAGE,Wt as IMG,Jt as INPUT,Qt as INS,zt as KBD,k as KeyStateContext,Zt as LABEL,te as LEGEND,ee as LI,Gn as LINE,Kn as LINEARGRADIENT,ne as LINK,lo as MACTION,oe as MAIN,se as MAP,ae as MARK,Bn as MARKER,_n as MASK,fo as MATH,re as MENU,So as MERROR,ce as META,qn as METADATA,ie as METER,uo as MFRAC,To as MI,yo as MMULTISCRIPTS,go as MN,xo as MO,ho as MOVER,mo as MPADDED,Xn as MPATH,Eo as MPHANTOM,bo as MPRESCRIPTS,Po as MROOT,Ao as MROW,Co as MS,Mo as MSPACE,No as MSQRT,Ro as MSTYLE,Oo as MSUB,Do as MSUBSUP,vo as MSUP,Lo as MTABLE,Io as MTD,Vo as MTEXT,Fo as MTR,ko as MUNDER,jo as MUNDEROVER,pe as NAV,le as NOSCRIPT,de as OBJECT,fe as OL,Se as OPTGROUP,ue as OPTION,Te as OUTPUT,ye as P,$n as PATH,wn as PATTERN,ge as PICTURE,Yn as POLYGON,Wn as POLYLINE,xe as PRE,he as PROGRESS,me as Q,Jn as RADIALGRADIENT,Qn as RECT,Ee as RP,be as RT,Pe as RUBY,Ae as S,Ce as SAMP,Me as SCRIPT,Ne as SEARCH,Re as SECTION,Oe as SELECT,Ho as SEMANTICS,zn as SET,De as SLOT,ve as SMALL,Le as SOURCE,Ie as SPAN,Zn as STOP,Ve as STRONG,Fe as STYLE,ke as SUB,je as SUMMARY,He as SUP,to as SVG,eo as SWITCH,no as SYMBOL,Ue as TABLE,Ge as TBODY,Ke as TD,Be as TEMPLATE,oo as TEXT,_e as TEXTAREA,so as TEXTPATH,qe as TFOOT,Xe as TH,$e as THEAD,we as TIME,Ye as TITLE,We as TR,Je as TRACK,ao as TSPAN,Qe as U,ze as UL,ro as USE,Ze as VAR,tn as VIDEO,co as VIEW,en as WBR,_ as app,J as child,W as childCount,N as children,v as childrenStart,w as createPatch,$ as createState,q as defuse,P as globals,D as hydrate,X as memo,Go as mergeClass,Bo as mergeStyle,A as props,Y as tag,B as vode};
|
|
1
|
+
var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function B(e,o,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...a]:[e,...a]}function _(e,o,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let n=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{n.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}n.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;n.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)n.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?n.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=n;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(o,e.parentElement,b,b,D(e,!0),a(o));for(let p of s)n.patch(p);return p=>n.patch(p)}function q(e){if(e?._vode){let a=function(t){if(!t?.node)return;let n=A(t);if(n){for(let c in n)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=N(t);if(r)for(let c of r)a(c)};var o=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function D(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(o&&(s.node=e),e?.hasAttributes()){let t={},n=e.attributes;for(let r of n)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let n of e.childNodes){let r=n&&D(n,o);r?s.push(r):n&&o&&t.push(n)}for(let n of t)n.remove()}return s}else return}function X(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function $(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function w(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function N(e){let o=v(e);return o>0?e.slice(o):null}function W(e){let o=v(e);return o<0?0:e.length-o}function J(e,o){let a=v(e);if(a>0)return e[o+a]}function v(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,o,a){if(!o)return e;for(let s in o){let t=o[s];if(t&&typeof t=="object"){let n=e[s];n?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&n!==t?e[s]=new Date(t):Array.isArray(n)?e[s]=E({},t,a):typeof n=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,o,a,s,t,n,r){try{n=R(e,n,t);let c=!n||typeof n=="number"||typeof n=="boolean";if(n===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&K(n),p=!c&&G(n),y=!!n&&typeof n!="string"&&!!(n?.node||n?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof n+" "+JSON.stringify(n));if(y&&b?n=n.wholeText:y&&p&&(n=[...n]),f&&b)return i.nodeValue!==n&&(i.nodeValue=n),t;if(b&&(!i||!f)){let l=document.createTextNode(n);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=s;d<o.childNodes.length;d++){let g=o.childNodes[d];if(g){g.before(l,g),S=!0;break}}S||o.appendChild(l)}return l}if(p&&(!i||f||t[0]!==n[0])){let l=n;1 in l&&(l[1]=R(e,l[1],void 0));let S=A(n);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,n[0]):document.createElement(n[0]);if(n.node=d,O(e,d,void 0,S,r),S&&"catch"in S&&(n.node.catch=null,n.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=s;T<o.childNodes.length;T++){let u=o.childNodes[T];if(u){u.before(d,u),x=!0;break}}x||o.appendChild(d)}let g=N(n);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r);n[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),n}if(!f&&p&&t[0]===n[0]){n.node=i;let l=n,S=t,d=A(n),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=R(e,l[1],S[1]),u!==l[1]&&O(e,i,g,d,r)}else O(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(n.node.catch=null,n.node.removeAttribute("catch"));let x=N(n),T=N(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let H=x[m],U=T&&T[m],L=C(e,i,m,h,U,H,r);n[m+u]=L,L&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return n}}catch(c){let f=A(n)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,o,a,s,D(n?.node||t?.node,!0),i,r)}else throw c}}function G(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function K(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,o,a){if(typeof o!="function")return o;let s=o?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let n=I(o,e);return typeof n=="object"&&(n.__memo=o?.__memo),n}function I(e,o){return typeof e=="function"?I(e(o),o):e}function O(e,o,a,s,t){if(!s&&!a)return;let n=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=M(e,o,r,c,f,n):M(e,o,r,c,void 0,n))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}else if(s)for(let r in s){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}function M(e,o,a,s,t,n){if(a==="style")if(!t)o.style.cssText="";else if(typeof t=="string")s!==t&&(o.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(o.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(o.style[r]=f)}}else for(let r in t)o.style[r]=t[r];else if(a==="class")t?o.setAttribute("class",V(t)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));o[a]=r}else o[a]=null;else n||(o[a]=t),t==null||t===!1?o.removeAttribute(a):o.setAttribute(a,t);return t}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var z="a",Z="abbr",tt="address",et="area",nt="article",ot="aside",st="audio",at="b",rt="base",ct="bdi",it="bdo",pt="blockquote",lt="body",dt="br",ft="button",St="canvas",ut="caption",Tt="cite",yt="code",gt="col",xt="colgroup",ht="data",mt="datalist",Et="dd",bt="del",Pt="details",At="dfn",Ct="dialog",Mt="div",Nt="dl",Rt="dt",Ot="em",Dt="embed",vt="fieldset",Lt="figcaption",It="figure",Vt="footer",Ft="form",kt="h1",jt="h2",Ht="h3",Ut="h4",Gt="h5",Kt="h6",Bt="head",_t="header",qt="hgroup",Xt="hr",$t="html",wt="i",Yt="iframe",Wt="img",Jt="input",Qt="ins",zt="kbd",Zt="label",te="legend",ee="li",ne="link",oe="main",se="map",ae="mark",re="menu",ce="meta",ie="meter",pe="nav",le="noscript",de="object",fe="ol",Se="optgroup",ue="option",Te="output",ye="p",ge="picture",xe="pre",he="progress",me="q",Ee="rp",be="rt",Pe="ruby",Ae="s",Ce="samp",Me="script",Ne="search",Re="section",Oe="select",De="slot",ve="small",Le="source",Ie="span",Ve="strong",Fe="style",ke="sub",je="summary",He="sup",Ue="table",Ge="tbody",Ke="td",Be="template",_e="textarea",qe="tfoot",Xe="th",$e="thead",we="time",Ye="title",We="tr",Je="track",Qe="u",ze="ul",Ze="var",tn="video",en="wbr",nn="animate",on="animateMotion",sn="animateTransform",an="circle",rn="clipPath",cn="defs",pn="desc",ln="ellipse",dn="feBlend",fn="feColorMatrix",Sn="feComponentTransfer",un="feComposite",Tn="feConvolveMatrix",yn="feDiffuseLighting",gn="feDisplacementMap",xn="feDistantLight",hn="feDropShadow",mn="feFlood",En="feFuncA",bn="feFuncB",Pn="feFuncG",An="feFuncR",Cn="feGaussianBlur",Mn="feImage",Nn="feMerge",Rn="feMergeNode",On="feMorphology",Dn="feOffset",vn="fePointLight",Ln="feSpecularLighting",In="feSpotLight",Vn="feTile",Fn="feTurbulence",kn="filter",jn="foreignObject",Hn="g",Un="image",Gn="line",Kn="linearGradient",Bn="marker",_n="mask",qn="metadata",Xn="mpath",$n="path",wn="pattern",Yn="polygon",Wn="polyline",Jn="radialGradient",Qn="rect",zn="set",Zn="stop",to="svg",eo="switch",no="symbol",oo="text",so="textPath",ao="tspan",ro="use",co="view",io="annotation",po="annotation-xml",lo="maction",fo="math",So="merror",uo="mfrac",To="mi",yo="mmultiscripts",go="mn",xo="mo",ho="mover",mo="mpadded",Eo="mphantom",bo="mprescripts",Po="mroot",Ao="mrow",Co="ms",Mo="mspace",No="msqrt",Ro="mstyle",Oo="msub",Do="msubsup",vo="msup",Lo="mtable",Io="mtd",Vo="mtext",Fo="mtr",ko="munder",jo="munderover",Ho="semantics";function Go(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let a=1;a<e.length;a++){let s=o,t=e[a];if(!s)o=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let n=s.split(" "),r=t.split(" "),c=new Set([...n,...r]);o=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let n=new Set([...t,...s.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let n=new Set([...s,...t.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let n=new Set([...s,...t]);o=Array.from(n).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")o={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")o={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")o={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let n={...s};for(let r of t)n[r]=!0;o=n}else if(Array.isArray(s)&&typeof t=="object"){let n={};for(let r of s)n[r]=!0;for(let r of Object.keys(t))n[r]=t[r];o=n}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return o}var F=document.createElement("div");function Bo(...e){try{let o=F.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)o[s]=a[s];else typeof a=="string"&&(o.cssText+=";"+a);return o.cssText}finally{F.style.cssText=""}}var k=class{constructor(o,a){this.state=o;this.path=a;this.keys=a.split(".")}keys;get(){let o=this.keys,a=this.state?this.state[o[0]]:void 0;for(let s=1;s<o.length&&a;s++)a=a[o[s]];return a}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let a=[];for(let s of o)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(o))}createPatch(o){let a={};return this.putDeep(o,a),a}putDeep(o,a){let s=this.keys;if(s.length>1){let t=0,n=a[s[t]];for((typeof n!="object"||n===null)&&(a[s[t]]=n={}),t=1;t<s.length-1;t++){let r=n;n=n[s[t]],(typeof n!="object"||n===null)&&(r[s[t]]=n={})}n[s[t]]=o}else typeof a[s[0]]=="object"&&typeof o=="object"?Object.assign(a[s[0]],o):a[s[0]]=o}},j=class{constructor(o,a,s,t){this.state=o;this.get=a;this.put=s;this.patch=t}};export{z as A,Z as ABBR,tt as ADDRESS,nn as ANIMATE,on as ANIMATEMOTION,sn as ANIMATETRANSFORM,io as ANNOTATION,po as ANNOTATION_XML,et as AREA,nt as ARTICLE,ot as ASIDE,st as AUDIO,at as B,rt as BASE,ct as BDI,it as BDO,pt as BLOCKQUOTE,lt as BODY,dt as BR,ft as BUTTON,St as CANVAS,ut as CAPTION,an as CIRCLE,Tt as CITE,rn as CLIPPATH,yt as CODE,gt as COL,xt as COLGROUP,ht as DATA,mt as DATALIST,Et as DD,cn as DEFS,bt as DEL,pn as DESC,Pt as DETAILS,At as DFN,Ct as DIALOG,Mt as DIV,Nt as DL,Rt as DT,j as DelegateStateContext,ln as ELLIPSE,Ot as EM,Dt as EMBED,dn as FEBLEND,fn as FECOLORMATRIX,Sn as FECOMPONENTTRANSFER,un as FECOMPOSITE,Tn as FECONVOLVEMATRIX,yn as FEDIFFUSELIGHTING,gn as FEDISPLACEMENTMAP,xn as FEDISTANTLIGHT,hn as FEDROPSHADOW,mn as FEFLOOD,En as FEFUNCA,bn as FEFUNCB,Pn as FEFUNCG,An as FEFUNCR,Cn as FEGAUSSIANBLUR,Mn as FEIMAGE,Nn as FEMERGE,Rn as FEMERGENODE,On as FEMORPHOLOGY,Dn as FEOFFSET,vn as FEPOINTLIGHT,Ln as FESPECULARLIGHTING,In as FESPOTLIGHT,Vn as FETILE,Fn as FETURBULENCE,vt as FIELDSET,Lt as FIGCAPTION,It as FIGURE,kn as FILTER,Vt as FOOTER,jn as FOREIGNOBJECT,Ft as FORM,Hn as G,kt as H1,jt as H2,Ht as H3,Ut as H4,Gt as H5,Kt as H6,Bt as HEAD,_t as HEADER,qt as HGROUP,Xt as HR,$t as HTML,wt as I,Yt as IFRAME,Un as IMAGE,Wt as IMG,Jt as INPUT,Qt as INS,zt as KBD,k as KeyStateContext,Zt as LABEL,te as LEGEND,ee as LI,Gn as LINE,Kn as LINEARGRADIENT,ne as LINK,lo as MACTION,oe as MAIN,se as MAP,ae as MARK,Bn as MARKER,_n as MASK,fo as MATH,re as MENU,So as MERROR,ce as META,qn as METADATA,ie as METER,uo as MFRAC,To as MI,yo as MMULTISCRIPTS,go as MN,xo as MO,ho as MOVER,mo as MPADDED,Xn as MPATH,Eo as MPHANTOM,bo as MPRESCRIPTS,Po as MROOT,Ao as MROW,Co as MS,Mo as MSPACE,No as MSQRT,Ro as MSTYLE,Oo as MSUB,Do as MSUBSUP,vo as MSUP,Lo as MTABLE,Io as MTD,Vo as MTEXT,Fo as MTR,ko as MUNDER,jo as MUNDEROVER,pe as NAV,le as NOSCRIPT,de as OBJECT,fe as OL,Se as OPTGROUP,ue as OPTION,Te as OUTPUT,ye as P,$n as PATH,wn as PATTERN,ge as PICTURE,Yn as POLYGON,Wn as POLYLINE,xe as PRE,he as PROGRESS,me as Q,Jn as RADIALGRADIENT,Qn as RECT,Ee as RP,be as RT,Pe as RUBY,Ae as S,Ce as SAMP,Me as SCRIPT,Ne as SEARCH,Re as SECTION,Oe as SELECT,Ho as SEMANTICS,zn as SET,De as SLOT,ve as SMALL,Le as SOURCE,Ie as SPAN,Zn as STOP,Ve as STRONG,Fe as STYLE,ke as SUB,je as SUMMARY,He as SUP,to as SVG,eo as SWITCH,no as SYMBOL,Ue as TABLE,Ge as TBODY,Ke as TD,Be as TEMPLATE,oo as TEXT,_e as TEXTAREA,so as TEXTPATH,qe as TFOOT,Xe as TH,$e as THEAD,we as TIME,Ye as TITLE,We as TR,Je as TRACK,ao as TSPAN,Qe as U,ze as UL,ro as USE,Ze as VAR,tn as VIDEO,co as VIEW,en as WBR,_ as app,J as child,W as childCount,N as children,v as childrenStart,w as createPatch,$ as createState,q as defuse,P as globals,D as hydrate,X as memo,Go as mergeClass,Bo as mergeStyle,A as props,Y as tag,B as vode};
|
package/dist/vode.mjs
CHANGED
|
@@ -331,8 +331,8 @@ function render(state, parent, childIndex, indexInParent, oldVode, newVode, xmln
|
|
|
331
331
|
oldNode.replaceWith(text);
|
|
332
332
|
} else {
|
|
333
333
|
let inserted = false;
|
|
334
|
-
for (let i =
|
|
335
|
-
const nextSibling = parent.childNodes[
|
|
334
|
+
for (let i = indexInParent; i < parent.childNodes.length; i++) {
|
|
335
|
+
const nextSibling = parent.childNodes[i];
|
|
336
336
|
if (nextSibling) {
|
|
337
337
|
nextSibling.before(text, nextSibling);
|
|
338
338
|
inserted = true;
|
|
@@ -364,8 +364,8 @@ function render(state, parent, childIndex, indexInParent, oldVode, newVode, xmln
|
|
|
364
364
|
oldNode.replaceWith(newNode);
|
|
365
365
|
} else {
|
|
366
366
|
let inserted = false;
|
|
367
|
-
for (let i =
|
|
368
|
-
const nextSibling = parent.childNodes[
|
|
367
|
+
for (let i = indexInParent; i < parent.childNodes.length; i++) {
|
|
368
|
+
const nextSibling = parent.childNodes[i];
|
|
369
369
|
if (nextSibling) {
|
|
370
370
|
nextSibling.before(newNode, nextSibling);
|
|
371
371
|
inserted = true;
|
package/package.json
CHANGED
package/src/vode.ts
CHANGED
|
@@ -522,8 +522,8 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
|
|
|
522
522
|
oldNode.replaceWith(text);
|
|
523
523
|
} else {
|
|
524
524
|
let inserted = false;
|
|
525
|
-
for (let i =
|
|
526
|
-
const nextSibling = parent.childNodes[
|
|
525
|
+
for (let i = indexInParent; i < parent.childNodes.length; i++) {
|
|
526
|
+
const nextSibling = parent.childNodes[i];
|
|
527
527
|
if (nextSibling) {
|
|
528
528
|
nextSibling.before(text, nextSibling);
|
|
529
529
|
inserted = true;
|
|
@@ -567,8 +567,8 @@ function render<S extends PatchableState>(state: S, parent: Element, childIndex:
|
|
|
567
567
|
oldNode.replaceWith(newNode);
|
|
568
568
|
} else {
|
|
569
569
|
let inserted = false;
|
|
570
|
-
for (let i =
|
|
571
|
-
const nextSibling = parent.childNodes[
|
|
570
|
+
for (let i = indexInParent; i < parent.childNodes.length; i++) {
|
|
571
|
+
const nextSibling = parent.childNodes[i];
|
|
572
572
|
if (nextSibling) {
|
|
573
573
|
nextSibling.before(newNode, nextSibling);
|
|
574
574
|
inserted = true;
|