@ryupold/vode 1.1.8 → 1.2.0

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ![vode-logo](./logo.svg)
1
+ # ![vode-logo](./logo.webp)
2
2
 
3
3
  [![TypeScript](https://img.shields.io/badge/TypeScript-100%25-blue?logo=typescript)](https://www.typescriptlang.org/)
4
4
  [![Dependencies](https://img.shields.io/badge/dependencies-0-success)](package.json)
@@ -6,9 +6,9 @@
6
6
  [![NPM Downloads](https://img.shields.io/npm/dm/@ryupold/vode)](https://www.npmjs.com/package/@ryupold/vode)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
8
8
 
9
- A small web framework for a minimalistic development flow. Zero dependencies, no build step except for typescript compilation, and a simple virtual DOM implementation that is easy to understand and use. Autocompletion out of the box due to binding to `lib.dom.d.ts`.
9
+ A compact web framework for minimalist developers. Zero dependencies, no build step except for typescript compilation, and a simple virtual DOM implementation that is easy to understand and use. Autocompletion out of the box thanks to `lib.dom.d.ts`.
10
10
 
11
- It can be used to create single page applications or isolated components with complex state. The usage of arrays gives flexibility in composition and makes refactoring easy.
11
+ It brings a primitive building block to the table that gives flexibility in composition and makes refactoring easy. Usecases can be single page applications or isolated components with complex state.
12
12
 
13
13
  ## Usage
14
14
 
@@ -116,7 +116,7 @@ const state = createState({
116
116
 
117
117
  type State = typeof state;
118
118
 
119
- const appNode = document.getElementById('app');
119
+ const appNode = document.getElementById('app')!;
120
120
 
121
121
  app<State>(appNode, state,
122
122
  (s: State) => [DIV,
@@ -473,6 +473,30 @@ Like the other events they can be patches too.
473
473
  > is actually created/removed which might not always be the case during
474
474
  > rendering, as only a diff of the virtual DOM is applied.
475
475
 
476
+ ### SVG & MathML
477
+ SVG and MathML elements are supported but need the namespace defined in properties.
478
+
479
+ ```typescript
480
+ import { SVG, CIRCLE } from '@ryupold/vode';
481
+
482
+ const CompSVG = (s) =>
483
+ [SVG, { xmlns: 'http://www.w3.org/2000/svg', width: 100, height: 100 },
484
+ [CIRCLE, { cx: 50, cy: 50, r: 40, stroke: 'green', 'stroke-width': 4, fill: 'yellow' }]
485
+ ];
486
+ ```
487
+
488
+ ```typescript
489
+ import { MATH, MSUP, MI, MN } from '@ryupold/vode';
490
+
491
+ const CompMathML = (s) =>
492
+ [MATH, { xmlns: 'http://www.w3.org/1998/Math/MathML' },
493
+ [MSUP,
494
+ [MI, 'x'],
495
+ [MN, '2']
496
+ ]
497
+ ];
498
+ ```
499
+
476
500
  ### advanced usage
477
501
 
478
502
  #### isolated state
package/dist/vode.js CHANGED
@@ -182,6 +182,7 @@ var V = (() => {
182
182
  S: () => S,
183
183
  SAMP: () => SAMP,
184
184
  SCRIPT: () => SCRIPT,
185
+ SEARCH: () => SEARCH,
185
186
  SECTION: () => SECTION,
186
187
  SELECT: () => SELECT,
187
188
  SEMANTICS: () => SEMANTICS,
@@ -217,6 +218,7 @@ var V = (() => {
217
218
  U: () => U,
218
219
  UL: () => UL,
219
220
  USE: () => USE,
221
+ VAR: () => VAR,
220
222
  VIDEO: () => VIDEO,
221
223
  VIEW: () => VIEW,
222
224
  WBR: () => WBR,
@@ -490,7 +492,7 @@ var V = (() => {
490
492
  }
491
493
  return target;
492
494
  }
493
- function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
495
+ function render(state, patch, parent, childIndex, oldVode, newVode, xmlns) {
494
496
  newVode = remember(state, newVode, oldVode);
495
497
  const isNoVode = !newVode || typeof newVode === "number" || typeof newVode === "boolean";
496
498
  if (newVode === oldVode || !oldVode && isNoVode) {
@@ -534,15 +536,15 @@ var V = (() => {
534
536
  return text;
535
537
  }
536
538
  if (isNode && (!oldNode || oldIsText || oldVode[0] !== newVode[0])) {
537
- svg = svg || newVode[0] === "svg";
538
- const newNode = svg ? document.createElementNS("http://www.w3.org/2000/svg", newVode[0]) : document.createElement(newVode[0]);
539
- newVode.node = newNode;
540
539
  const newvode = newVode;
541
540
  if (1 in newvode) {
542
541
  newvode[1] = remember(state, newvode[1], void 0);
543
542
  }
544
543
  const properties = props(newVode);
545
- patchProperties(patch, newNode, void 0, properties, svg);
544
+ xmlns = properties?.xmlns || xmlns;
545
+ const newNode = xmlns ? document.createElementNS(xmlns, newVode[0]) : document.createElement(newVode[0]);
546
+ newVode.node = newNode;
547
+ patchProperties(patch, newNode, void 0, properties);
546
548
  if (oldNode) {
547
549
  oldNode.onUnmount && patch(oldNode.onUnmount(oldNode));
548
550
  oldNode.replaceWith(newNode);
@@ -557,7 +559,7 @@ var V = (() => {
557
559
  if (newChildren) {
558
560
  for (let i = 0; i < newChildren.length; i++) {
559
561
  const child2 = newChildren[i];
560
- const attached = render(state, patch, newNode, i, void 0, child2, svg);
562
+ const attached = render(state, patch, newNode, i, void 0, child2, xmlns);
561
563
  newVode[properties ? i + 2 : i + 1] = attached;
562
564
  }
563
565
  }
@@ -565,7 +567,6 @@ var V = (() => {
565
567
  return newVode;
566
568
  }
567
569
  if (!oldIsText && isNode && oldVode[0] === newVode[0]) {
568
- svg = svg || newVode[0] === "svg";
569
570
  newVode.node = oldNode;
570
571
  const newvode = newVode;
571
572
  const oldvode = oldVode;
@@ -575,12 +576,12 @@ var V = (() => {
575
576
  newvode[1] = remember(state, newvode[1], oldvode[1]);
576
577
  if (prev !== newvode[1]) {
577
578
  const properties = props(newVode);
578
- patchProperties(patch, oldNode, props(oldVode), properties, svg);
579
+ patchProperties(patch, oldNode, props(oldVode), properties);
579
580
  hasProps = !!properties;
580
581
  }
581
582
  } else {
582
583
  const properties = props(newVode);
583
- patchProperties(patch, oldNode, props(oldVode), properties, svg);
584
+ patchProperties(patch, oldNode, props(oldVode), properties);
584
585
  hasProps = !!properties;
585
586
  }
586
587
  const newKids = children(newVode);
@@ -589,7 +590,7 @@ var V = (() => {
589
590
  for (let i = 0; i < newKids.length; i++) {
590
591
  const child2 = newKids[i];
591
592
  const oldChild = oldKids && oldKids[i];
592
- const attached = render(state, patch, oldNode, i, oldChild, child2, svg);
593
+ const attached = render(state, patch, oldNode, i, oldChild, child2, xmlns);
593
594
  if (attached) {
594
595
  newVode[hasProps ? i + 2 : i + 1] = attached;
595
596
  }
@@ -645,15 +646,15 @@ var V = (() => {
645
646
  return c;
646
647
  }
647
648
  }
648
- function patchProperties(patch, node, oldProps, newProps, isSvg) {
649
+ function patchProperties(patch, node, oldProps, newProps) {
649
650
  if (!newProps && !oldProps) return;
650
651
  if (oldProps) {
651
652
  for (const key in oldProps) {
652
653
  const oldValue = oldProps[key];
653
654
  const newValue = newProps?.[key];
654
655
  if (oldValue !== newValue) {
655
- if (newProps) newProps[key] = patchProperty(patch, node, key, oldValue, newValue, isSvg);
656
- else patchProperty(patch, node, key, oldValue, void 0, isSvg);
656
+ if (newProps) newProps[key] = patchProperty(patch, node, key, oldValue, newValue);
657
+ else patchProperty(patch, node, key, oldValue, void 0);
657
658
  }
658
659
  }
659
660
  }
@@ -661,17 +662,17 @@ var V = (() => {
661
662
  for (const key in newProps) {
662
663
  if (!(key in oldProps)) {
663
664
  const newValue = newProps[key];
664
- newProps[key] = patchProperty(patch, node, key, void 0, newValue, isSvg);
665
+ newProps[key] = patchProperty(patch, node, key, void 0, newValue);
665
666
  }
666
667
  }
667
668
  } else if (newProps) {
668
669
  for (const key in newProps) {
669
670
  const newValue = newProps[key];
670
- newProps[key] = patchProperty(patch, node, key, void 0, newValue, isSvg);
671
+ newProps[key] = patchProperty(patch, node, key, void 0, newValue);
671
672
  }
672
673
  }
673
674
  }
674
- function patchProperty(patch, node, key, oldValue, newValue, isSvg) {
675
+ function patchProperty(patch, node, key, oldValue, newValue) {
675
676
  if (key === "style") {
676
677
  if (!newValue) {
677
678
  node.style.cssText = "";
@@ -691,20 +692,10 @@ var V = (() => {
691
692
  }
692
693
  }
693
694
  } else if (key === "class") {
694
- if (isSvg) {
695
- if (newValue) {
696
- const newClass = classString(newValue);
697
- node.classList.value = newClass;
698
- } else {
699
- node.classList.value = "";
700
- }
695
+ if (newValue) {
696
+ node.setAttribute("class", classString(newValue));
701
697
  } else {
702
- if (newValue) {
703
- const newClass = classString(newValue);
704
- node.className = newClass;
705
- } else {
706
- node.className = "";
707
- }
698
+ node.removeAttribute("class");
708
699
  }
709
700
  } else if (key[0] === "o" && key[1] === "n") {
710
701
  if (newValue) {
@@ -829,6 +820,7 @@ var V = (() => {
829
820
  var S = "s";
830
821
  var SAMP = "samp";
831
822
  var SCRIPT = "script";
823
+ var SEARCH = "search";
832
824
  var SECTION = "section";
833
825
  var SELECT = "select";
834
826
  var SLOT = "slot";
@@ -854,6 +846,7 @@ var V = (() => {
854
846
  var TRACK = "track";
855
847
  var U = "u";
856
848
  var UL = "ul";
849
+ var VAR = "var";
857
850
  var VIDEO = "video";
858
851
  var WBR = "wbr";
859
852
  var ANIMATE = "animate";
package/dist/vode.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var V=(()=>{var N=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var G=Object.getOwnPropertyNames;var H=Object.prototype.hasOwnProperty;var k=(t,o)=>{for(var a in o)N(t,a,{get:o[a],enumerable:!0})},U=(t,o,a,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of G(o))!H.call(t,e)&&e!==a&&N(t,e,{get:()=>o[e],enumerable:!(s=F(o,e))||s.enumerable});return t};var V=t=>U(N({},"__esModule",{value:!0}),t);var Hn={};k(Hn,{A:()=>z,ABBR:()=>Z,ADDRESS:()=>w,ANIMATE:()=>we,ANIMATEMOTION:()=>to,ANIMATETRANSFORM:()=>eo,ANNOTATION:()=>sn,ANNOTATION_XML:()=>an,AREA:()=>tt,ARTICLE:()=>et,ASIDE:()=>ot,AUDIO:()=>nt,B:()=>rt,BASE:()=>st,BDI:()=>at,BDO:()=>ct,BLOCKQUOTE:()=>it,BODY:()=>pt,BR:()=>Tt,BUTTON:()=>ft,CANVAS:()=>lt,CAPTION:()=>St,CIRCLE:()=>oo,CITE:()=>dt,CLIPPATH:()=>no,CODE:()=>gt,COL:()=>ut,COLGROUP:()=>xt,DATA:()=>yt,DATALIST:()=>Et,DD:()=>mt,DEFS:()=>ro,DEL:()=>ht,DESC:()=>so,DETAILS:()=>At,DFN:()=>Pt,DIALOG:()=>Ct,DIV:()=>Mt,DL:()=>Nt,DT:()=>Ot,ELLIPSE:()=>ao,EM:()=>bt,EMBED:()=>Rt,FEBLEND:()=>co,FECOLORMATRIX:()=>io,FECOMPONENTTRANSFER:()=>po,FECOMPOSITE:()=>To,FECONVOLVEMATRIX:()=>fo,FEDIFFUSELIGHTING:()=>lo,FEDISPLACEMENTMAP:()=>So,FEDISTANTLIGHT:()=>go,FEDROPSHADOW:()=>uo,FEFLOOD:()=>xo,FEFUNCA:()=>yo,FEFUNCB:()=>Eo,FEFUNCG:()=>mo,FEFUNCR:()=>ho,FEGAUSSIANBLUR:()=>Ao,FEIMAGE:()=>Po,FEMERGE:()=>Co,FEMERGENODE:()=>Mo,FEMORPHOLOGY:()=>No,FEOFFSET:()=>Oo,FEPOINTLIGHT:()=>bo,FESPECULARLIGHTING:()=>Ro,FESPOTLIGHT:()=>Lo,FETILE:()=>Do,FETURBULENCE:()=>Io,FIELDSET:()=>Lt,FIGCAPTION:()=>Dt,FIGURE:()=>It,FILTER:()=>vo,FOOTER:()=>vt,FOREIGNOBJECT:()=>Fo,FORM:()=>Ft,G:()=>Go,H1:()=>Gt,H2:()=>Ht,H3:()=>kt,H4:()=>Ut,H5:()=>Vt,H6:()=>jt,HEAD:()=>Bt,HEADER:()=>_t,HGROUP:()=>Kt,HR:()=>Xt,HTML:()=>qt,I:()=>Yt,IFRAME:()=>Wt,IMAGE:()=>Ho,IMG:()=>$t,INPUT:()=>Jt,INS:()=>Qt,KBD:()=>zt,LABEL:()=>Zt,LEGEND:()=>wt,LI:()=>te,LINE:()=>ko,LINEARGRADIENT:()=>Uo,LINK:()=>ee,MACTION:()=>cn,MAIN:()=>oe,MAP:()=>ne,MARK:()=>re,MARKER:()=>Vo,MASK:()=>jo,MATH:()=>pn,MENU:()=>se,MERROR:()=>Tn,META:()=>ae,METADATA:()=>Bo,METER:()=>ce,MFRAC:()=>fn,MI:()=>ln,MMULTISCRIPTS:()=>Sn,MN:()=>dn,MO:()=>gn,MOVER:()=>un,MPADDED:()=>xn,MPATH:()=>_o,MPHANTOM:()=>yn,MPRESCRIPTS:()=>En,MROOT:()=>mn,MROW:()=>hn,MS:()=>An,MSPACE:()=>Pn,MSQRT:()=>Cn,MSTYLE:()=>Mn,MSUB:()=>Nn,MSUBSUP:()=>On,MSUP:()=>bn,MTABLE:()=>Rn,MTD:()=>Ln,MTEXT:()=>Dn,MTR:()=>In,MUNDER:()=>vn,MUNDEROVER:()=>Fn,NAV:()=>ie,NOSCRIPT:()=>pe,OBJECT:()=>Te,OL:()=>fe,OPTGROUP:()=>le,OPTION:()=>Se,OUTPUT:()=>de,P:()=>ge,PATH:()=>Ko,PATTERN:()=>Xo,PICTURE:()=>ue,POLYGON:()=>qo,POLYLINE:()=>Yo,PRE:()=>xe,PROGRESS:()=>ye,Q:()=>Ee,RADIALGRADIENT:()=>Wo,RECT:()=>$o,RP:()=>me,RT:()=>he,RUBY:()=>Ae,S:()=>Pe,SAMP:()=>Ce,SCRIPT:()=>Me,SECTION:()=>Ne,SELECT:()=>Oe,SEMANTICS:()=>Gn,SET:()=>Jo,SLOT:()=>be,SMALL:()=>Re,SOURCE:()=>Le,SPAN:()=>De,STOP:()=>Qo,STRONG:()=>Ie,STYLE:()=>ve,SUB:()=>Fe,SUMMARY:()=>Ge,SUP:()=>He,SVG:()=>zo,SWITCH:()=>Zo,SYMBOL:()=>wo,TABLE:()=>ke,TBODY:()=>Ue,TD:()=>Ve,TEMPLATE:()=>je,TEXT:()=>tn,TEXTAREA:()=>Be,TEXTPATH:()=>en,TFOOT:()=>_e,TH:()=>Ke,THEAD:()=>Xe,TIME:()=>qe,TITLE:()=>Ye,TR:()=>We,TRACK:()=>$e,TSPAN:()=>on,U:()=>Je,UL:()=>Qe,USE:()=>nn,VIDEO:()=>ze,VIEW:()=>rn,WBR:()=>Ze,app:()=>B,child:()=>$,childCount:()=>W,children:()=>A,childrenStart:()=>C,createPatch:()=>X,createState:()=>K,hydrate:()=>L,memo:()=>_,mergeClass:()=>Y,props:()=>d,tag:()=>q,vode:()=>j});function j(t,o,...a){if(!t)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(t)?t:o?[t,o,...a]:[t,...a]}function B(t,o,a,...s){if(!t?.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 e={};e.stats={lastRenderTime:0,renderCount:0,liveEffectCount:0,patchCount:0,renderPatchCount:0},Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async r=>{if(!(!r||typeof r!="function"&&typeof r!="object"))if(e.stats.patchCount++,r?.next){let i=r;e.stats.liveEffectCount++;try{let l=await i.next();for(;l.done===!1;){e.stats.liveEffectCount++;try{e.patch(l.value),l=await i.next()}finally{e.stats.liveEffectCount--}}e.patch(l.value)}finally{e.stats.liveEffectCount--}}else if(r.then){e.stats.liveEffectCount++;try{let i=await r;e.patch(i)}finally{e.stats.liveEffectCount--}}else Array.isArray(r)?typeof r[0]=="function"?r.length>1?e.patch(r[0](e.state,...r.slice(1))):e.patch(r[0](e.state)):e.stats.patchCount--:typeof r=="function"?e.patch(r(e.state)):(e.stats.renderPatchCount++,e.q=x(e.q||{},r,!1),e.isRendering||e.render())}}),Object.defineProperty(e,"render",{enumerable:!1,configurable:!0,writable:!1,value:()=>requestAnimationFrame(()=>{if(e.isRendering||!e.q)return;e.isRendering=!0;let r=Date.now();try{e.state=x(e.state,e.q,!0),e.q=null;let i=a(e.state);e.vode=P(e.state,e.patch,t.parentElement,0,e.vode,i),t.tagName.toUpperCase()!==i[0].toUpperCase()&&(t=e.vode.node,t._vode=e)}finally{e.isRendering=!1,e.stats.renderCount++,e.stats.lastRenderTime=Date.now()-r,e.q&&e.render()}})}),e.patch=o.patch,e.state=o,e.q=null;let n=t;n._vode=e,e.vode=P(o,e.patch,t.parentElement,Array.from(t.parentElement.children).indexOf(t),L(t,!0),a(o));for(let r of s)e.patch(r);return e.patch}function L(t,o){if(t?.nodeType===Node.TEXT_NODE)return t.nodeValue?.trim()!==""?o?t:t.nodeValue:void 0;if(t.nodeType===Node.COMMENT_NODE)return;if(t.nodeType===Node.ELEMENT_NODE){let s=[t.tagName.toLowerCase()];if(o&&(s.node=t),t?.hasAttributes()){let e={},n=t.attributes;for(let r of n)e[r.name]=r.value;s.push(e)}if(t.hasChildNodes()){let e=[];for(let n of t.childNodes){let r=n&&L(n,o);r?s.push(r):n&&o&&e.push(n)}for(let n of e)n.remove()}return s}else return}function _(t,o){if(!t||!Array.isArray(t))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=t,o}function K(t){if(!t||typeof t!="object")throw new Error("createState() must be called with a state object");return t}function X(t){return t}function q(t){return t?Array.isArray(t)?t[0]:typeof t=="string"||t.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function d(t){if(Array.isArray(t)&&t.length>1&&t[1]&&!Array.isArray(t[1])&&typeof t[1]=="object"&&t[1].nodeType!==Node.TEXT_NODE)return t[1]}function Y(t,o){if(!t)return o;if(!o)return t;if(typeof t=="string"&&typeof o=="string"){let a=t.split(" "),s=o.split(" "),e=new Set([...a,...s]);return Array.from(e).join(" ").trim()}else if(typeof t=="string"&&Array.isArray(o)){let a=new Set([...o,...t.split(" ")]);return Array.from(a).join(" ").trim()}else if(Array.isArray(t)&&typeof o=="string"){let a=new Set([...t,...o.split(" ")]);return Array.from(a).join(" ").trim()}else if(Array.isArray(t)&&Array.isArray(o)){let a=new Set([...t,...o]);return Array.from(a).join(" ").trim()}else{if(typeof t=="string"&&typeof o=="object")return{[t]:!0,...o};if(typeof t=="object"&&typeof o=="string")return{...t,[o]:!0};if(typeof t=="object"&&typeof o=="object")return{...t,...o};if(typeof t=="object"&&Array.isArray(o)){let a={...t};for(let s of o)a[s]=!0;return a}else if(Array.isArray(t)&&typeof o=="object"){let a={};for(let s of t)a[s]=!0;for(let s of Object.keys(o))a[s]=o[s];return a}}throw new Error(`cannot merge classes of ${t} (${typeof t}) and ${o} (${typeof o})`)}function A(t){let o=C(t);return o>0?t.slice(o):null}function W(t){return t.length-C(t)}function $(t,o){return t[o+C(t)]}function C(t){return d(t)?2:1}function x(t,o,a){if(!o)return t;for(let s in o){let e=o[s];if(e&&typeof e=="object"){let n=t[s];n?Array.isArray(e)?t[s]=[...e]:e instanceof Date&&n!==e?t[s]=new Date(e):Array.isArray(n)?t[s]=x({},e,a):typeof n=="object"?x(t[s],e,a):t[s]=x({},e,a):Array.isArray(e)?t[s]=[...e]:e instanceof Date?t[s]=new Date(e):t[s]=x({},e,a)}else e===void 0&&a?delete t[s]:t[s]=e}return t}function P(t,o,a,s,e,n,r){n=O(t,n,e);let i=!n||typeof n=="number"||typeof n=="boolean";if(n===e||!e&&i)return e;let l=e?.nodeType===Node.TEXT_NODE,p=l?e:e?.node;if(i){p?.onUnmount&&o(p.onUnmount(p)),p?.remove();return}let E=!i&&Q(n),m=!i&&J(n),M=!!n&&typeof n!="string"&&!!(n?.node||n?.nodeType===Node.TEXT_NODE);if(!E&&!m&&!M&&!e)throw new Error("Invalid vode: "+typeof n+" "+JSON.stringify(n));if(M&&E?n=n.wholeText:M&&m&&(n=[...n]),l&&E)return p.nodeValue!==n&&(p.nodeValue=n),e;if(E&&(!p||!l)){let T=document.createTextNode(n);return p?(p.onUnmount&&o(p.onUnmount(p)),p.replaceWith(T)):a.childNodes[s]?a.insertBefore(T,a.childNodes[s]):a.appendChild(T),T}if(m&&(!p||l||e[0]!==n[0])){r=r||n[0]==="svg";let T=r?document.createElementNS("http://www.w3.org/2000/svg",n[0]):document.createElement(n[0]);n.node=T;let y=n;1 in y&&(y[1]=O(t,y[1],void 0));let g=d(n);b(o,T,void 0,g,r),p?(p.onUnmount&&o(p.onUnmount(p)),p.replaceWith(T)):a.childNodes[s]?a.insertBefore(T,a.childNodes[s]):a.appendChild(T);let S=A(n);if(S)for(let f=0;f<S.length;f++){let c=S[f],u=P(t,o,T,f,void 0,c,r);n[g?f+2:f+1]=u}return T.onMount&&o(T.onMount(T)),n}if(!l&&m&&e[0]===n[0]){r=r||n[0]==="svg",n.node=p;let T=n,y=e,g=!1;if(T[1]?.__memo){let c=T[1];if(T[1]=O(t,T[1],y[1]),c!==T[1]){let u=d(n);b(o,p,d(e),u,r),g=!!u}}else{let c=d(n);b(o,p,d(e),c,r),g=!!c}let S=A(n),f=A(e);if(S){for(let c=0;c<S.length;c++){let u=S[c],v=f&&f[c],D=P(t,o,p,c,v,u,r);D&&(n[g?c+2:c+1]=D)}for(let c=S.length;f&&c<f.length;c++)f[c]?.node?f[c].node.remove():f[c]?.nodeType===Node.TEXT_NODE&&f[c].remove()}for(let c=S?.length||0;c<f?.length;c++)f[c]?.node?f[c].node.remove():f[c]?.nodeType===Node.TEXT_NODE&&f[c].remove();return n}}function J(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"}function Q(t){return typeof t=="string"||t?.nodeType===Node.TEXT_NODE}function O(t,o,a){if(typeof o!="function")return o;let s=o?.__memo,e=a?.__memo;if(Array.isArray(s)&&Array.isArray(e)&&s.length===e.length){let r=!0;for(let i=0;i<s.length;i++)if(s[i]!==e[i]){r=!1;break}if(r)return a}let n=I(o,t);return typeof n=="object"&&(n.__memo=o?.__memo),n}function I(t,o){return typeof t=="function"?I(t(o),o):t}function b(t,o,a,s,e){if(!(!s&&!a)){if(a)for(let n in a){let r=a[n],i=s?.[n];r!==i&&(s?s[n]=h(t,o,n,r,i,e):h(t,o,n,r,void 0,e))}if(s&&a){for(let n in s)if(!(n in a)){let r=s[n];s[n]=h(t,o,n,void 0,r,e)}}else if(s)for(let n in s){let r=s[n];s[n]=h(t,o,n,void 0,r,e)}}}function h(t,o,a,s,e,n){if(a==="style")if(!e)o.style.cssText="";else if(typeof e=="string")s!==e&&(o.style.cssText=e);else if(s&&typeof s=="object")for(let r in{...s,...e})!s||e[r]!==s[r]?o.style[r]=e[r]:s[r]&&!e[r]&&(o.style[r]=void 0);else for(let r in e)o.style[r]=e[r];else if(a==="class")if(n)if(e){let r=R(e);o.classList.value=r}else o.classList.value="";else if(e){let r=R(e);o.className=r}else o.className="";else if(a[0]==="o"&&a[1]==="n")if(e){let r=null;if(typeof e=="function"){let i=e;r=l=>t([i,l])}else if(Array.isArray(e)){let i=e,l=e[0];i.length>1?r=()=>t([l,...i.slice(1)]):r=p=>t([l,p])}else typeof e=="object"&&(r=()=>t(e));o[a]=r}else o[a]=null;else e!=null&&e!==!1?o.setAttribute(a,e):o.removeAttribute(a);return e}function R(t){return typeof t=="string"?t:Array.isArray(t)?t.map(R).join(" "):typeof t=="object"?Object.keys(t).filter(o=>t[o]).join(" "):""}var z="a",Z="abbr",w="address",tt="area",et="article",ot="aside",nt="audio",rt="b",st="base",at="bdi",ct="bdo",it="blockquote",pt="body",Tt="br",ft="button",lt="canvas",St="caption",dt="cite",gt="code",ut="col",xt="colgroup",yt="data",Et="datalist",mt="dd",ht="del",At="details",Pt="dfn",Ct="dialog",Mt="div",Nt="dl",Ot="dt",bt="em",Rt="embed",Lt="fieldset",Dt="figcaption",It="figure",vt="footer",Ft="form",Gt="h1",Ht="h2",kt="h3",Ut="h4",Vt="h5",jt="h6",Bt="head",_t="header",Kt="hgroup",Xt="hr",qt="html",Yt="i",Wt="iframe",$t="img",Jt="input",Qt="ins",zt="kbd",Zt="label",wt="legend",te="li",ee="link",oe="main",ne="map",re="mark",se="menu",ae="meta",ce="meter",ie="nav",pe="noscript",Te="object",fe="ol",le="optgroup",Se="option",de="output",ge="p",ue="picture",xe="pre",ye="progress",Ee="q",me="rp",he="rt",Ae="ruby",Pe="s",Ce="samp",Me="script",Ne="section",Oe="select",be="slot",Re="small",Le="source",De="span",Ie="strong",ve="style",Fe="sub",Ge="summary",He="sup",ke="table",Ue="tbody",Ve="td",je="template",Be="textarea",_e="tfoot",Ke="th",Xe="thead",qe="time",Ye="title",We="tr",$e="track",Je="u",Qe="ul",ze="video",Ze="wbr",we="animate",to="animateMotion",eo="animateTransform",oo="circle",no="clipPath",ro="defs",so="desc",ao="ellipse",co="feBlend",io="feColorMatrix",po="feComponentTransfer",To="feComposite",fo="feConvolveMatrix",lo="feDiffuseLighting",So="feDisplacementMap",go="feDistantLight",uo="feDropShadow",xo="feFlood",yo="feFuncA",Eo="feFuncB",mo="feFuncG",ho="feFuncR",Ao="feGaussianBlur",Po="feImage",Co="feMerge",Mo="feMergeNode",No="feMorphology",Oo="feOffset",bo="fePointLight",Ro="feSpecularLighting",Lo="feSpotLight",Do="feTile",Io="feTurbulence",vo="filter",Fo="foreignObject",Go="g",Ho="image",ko="line",Uo="linearGradient",Vo="marker",jo="mask",Bo="metadata",_o="mpath",Ko="path",Xo="pattern",qo="polygon",Yo="polyline",Wo="radialGradient",$o="rect",Jo="set",Qo="stop",zo="svg",Zo="switch",wo="symbol",tn="text",en="textPath",on="tspan",nn="use",rn="view",sn="annotation",an="annotation-xml",cn="maction",pn="math",Tn="merror",fn="mfrac",ln="mi",Sn="mmultiscripts",dn="mn",gn="mo",un="mover",xn="mpadded",yn="mphantom",En="mprescripts",mn="mroot",hn="mrow",An="ms",Pn="mspace",Cn="msqrt",Mn="mstyle",Nn="msub",On="msubsup",bn="msup",Rn="mtable",Ln="mtd",Dn="mtext",In="mtr",vn="munder",Fn="munderover",Gn="semantics";return V(Hn);})();
1
+ "use strict";var V=(()=>{var N=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var k=Object.prototype.hasOwnProperty;var U=(t,o)=>{for(var a in o)N(t,a,{get:o[a],enumerable:!0})},G=(t,o,a,n)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of H(o))!k.call(t,e)&&e!==a&&N(t,e,{get:()=>o[e],enumerable:!(n=F(o,e))||n.enumerable});return t};var V=t=>G(N({},"__esModule",{value:!0}),t);var Us={};U(Us,{A:()=>z,ABBR:()=>Z,ADDRESS:()=>w,ANIMATE:()=>eo,ANIMATEMOTION:()=>oo,ANIMATETRANSFORM:()=>so,ANNOTATION:()=>cs,ANNOTATION_XML:()=>is,AREA:()=>tt,ARTICLE:()=>et,ASIDE:()=>ot,AUDIO:()=>st,B:()=>nt,BASE:()=>at,BDI:()=>rt,BDO:()=>ct,BLOCKQUOTE:()=>it,BODY:()=>pt,BR:()=>Tt,BUTTON:()=>ft,CANVAS:()=>lt,CAPTION:()=>St,CIRCLE:()=>no,CITE:()=>gt,CLIPPATH:()=>ao,CODE:()=>dt,COL:()=>ut,COLGROUP:()=>xt,DATA:()=>yt,DATALIST:()=>Et,DD:()=>mt,DEFS:()=>ro,DEL:()=>ht,DESC:()=>co,DETAILS:()=>At,DFN:()=>Pt,DIALOG:()=>Ct,DIV:()=>Mt,DL:()=>Nt,DT:()=>Ot,ELLIPSE:()=>io,EM:()=>Rt,EMBED:()=>bt,FEBLEND:()=>po,FECOLORMATRIX:()=>To,FECOMPONENTTRANSFER:()=>fo,FECOMPOSITE:()=>lo,FECONVOLVEMATRIX:()=>So,FEDIFFUSELIGHTING:()=>go,FEDISPLACEMENTMAP:()=>uo,FEDISTANTLIGHT:()=>xo,FEDROPSHADOW:()=>yo,FEFLOOD:()=>Eo,FEFUNCA:()=>mo,FEFUNCB:()=>ho,FEFUNCG:()=>Ao,FEFUNCR:()=>Po,FEGAUSSIANBLUR:()=>Co,FEIMAGE:()=>Mo,FEMERGE:()=>No,FEMERGENODE:()=>Oo,FEMORPHOLOGY:()=>Ro,FEOFFSET:()=>bo,FEPOINTLIGHT:()=>Lo,FESPECULARLIGHTING:()=>Do,FESPOTLIGHT:()=>Io,FETILE:()=>vo,FETURBULENCE:()=>Fo,FIELDSET:()=>Lt,FIGCAPTION:()=>Dt,FIGURE:()=>It,FILTER:()=>Ho,FOOTER:()=>vt,FOREIGNOBJECT:()=>ko,FORM:()=>Ft,G:()=>Uo,H1:()=>Ht,H2:()=>kt,H3:()=>Ut,H4:()=>Gt,H5:()=>Vt,H6:()=>jt,HEAD:()=>Bt,HEADER:()=>_t,HGROUP:()=>Kt,HR:()=>Xt,HTML:()=>qt,I:()=>Yt,IFRAME:()=>Wt,IMAGE:()=>Go,IMG:()=>$t,INPUT:()=>Jt,INS:()=>Qt,KBD:()=>zt,LABEL:()=>Zt,LEGEND:()=>wt,LI:()=>te,LINE:()=>Vo,LINEARGRADIENT:()=>jo,LINK:()=>ee,MACTION:()=>ps,MAIN:()=>oe,MAP:()=>se,MARK:()=>ne,MARKER:()=>Bo,MASK:()=>_o,MATH:()=>Ts,MENU:()=>ae,MERROR:()=>fs,META:()=>re,METADATA:()=>Ko,METER:()=>ce,MFRAC:()=>ls,MI:()=>Ss,MMULTISCRIPTS:()=>gs,MN:()=>ds,MO:()=>us,MOVER:()=>xs,MPADDED:()=>ys,MPATH:()=>Xo,MPHANTOM:()=>Es,MPRESCRIPTS:()=>ms,MROOT:()=>hs,MROW:()=>As,MS:()=>Ps,MSPACE:()=>Cs,MSQRT:()=>Ms,MSTYLE:()=>Ns,MSUB:()=>Os,MSUBSUP:()=>Rs,MSUP:()=>bs,MTABLE:()=>Ls,MTD:()=>Ds,MTEXT:()=>Is,MTR:()=>vs,MUNDER:()=>Fs,MUNDEROVER:()=>Hs,NAV:()=>ie,NOSCRIPT:()=>pe,OBJECT:()=>Te,OL:()=>fe,OPTGROUP:()=>le,OPTION:()=>Se,OUTPUT:()=>ge,P:()=>de,PATH:()=>qo,PATTERN:()=>Yo,PICTURE:()=>ue,POLYGON:()=>Wo,POLYLINE:()=>$o,PRE:()=>xe,PROGRESS:()=>ye,Q:()=>Ee,RADIALGRADIENT:()=>Jo,RECT:()=>Qo,RP:()=>me,RT:()=>he,RUBY:()=>Ae,S:()=>Pe,SAMP:()=>Ce,SCRIPT:()=>Me,SEARCH:()=>Ne,SECTION:()=>Oe,SELECT:()=>Re,SEMANTICS:()=>ks,SET:()=>zo,SLOT:()=>be,SMALL:()=>Le,SOURCE:()=>De,SPAN:()=>Ie,STOP:()=>Zo,STRONG:()=>ve,STYLE:()=>Fe,SUB:()=>He,SUMMARY:()=>ke,SUP:()=>Ue,SVG:()=>wo,SWITCH:()=>ts,SYMBOL:()=>es,TABLE:()=>Ge,TBODY:()=>Ve,TD:()=>je,TEMPLATE:()=>Be,TEXT:()=>os,TEXTAREA:()=>_e,TEXTPATH:()=>ss,TFOOT:()=>Ke,TH:()=>Xe,THEAD:()=>qe,TIME:()=>Ye,TITLE:()=>We,TR:()=>$e,TRACK:()=>Je,TSPAN:()=>ns,U:()=>Qe,UL:()=>ze,USE:()=>as,VAR:()=>Ze,VIDEO:()=>we,VIEW:()=>rs,WBR:()=>to,app:()=>B,child:()=>$,childCount:()=>W,children:()=>A,childrenStart:()=>C,createPatch:()=>X,createState:()=>K,hydrate:()=>b,memo:()=>_,mergeClass:()=>Y,props:()=>d,tag:()=>q,vode:()=>j});function j(t,o,...a){if(!t)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(t)?t:o?[t,o,...a]:[t,...a]}function B(t,o,a,...n){if(!t?.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 e={};e.stats={lastRenderTime:0,renderCount:0,liveEffectCount:0,patchCount:0,renderPatchCount:0},Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async r=>{if(!(!r||typeof r!="function"&&typeof r!="object"))if(e.stats.patchCount++,r?.next){let i=r;e.stats.liveEffectCount++;try{let S=await i.next();for(;S.done===!1;){e.stats.liveEffectCount++;try{e.patch(S.value),S=await i.next()}finally{e.stats.liveEffectCount--}}e.patch(S.value)}finally{e.stats.liveEffectCount--}}else if(r.then){e.stats.liveEffectCount++;try{let i=await r;e.patch(i)}finally{e.stats.liveEffectCount--}}else Array.isArray(r)?typeof r[0]=="function"?r.length>1?e.patch(r[0](e.state,...r.slice(1))):e.patch(r[0](e.state)):e.stats.patchCount--:typeof r=="function"?e.patch(r(e.state)):(e.stats.renderPatchCount++,e.q=x(e.q||{},r,!1),e.isRendering||e.render())}}),Object.defineProperty(e,"render",{enumerable:!1,configurable:!0,writable:!1,value:()=>requestAnimationFrame(()=>{if(e.isRendering||!e.q)return;e.isRendering=!0;let r=Date.now();try{e.state=x(e.state,e.q,!0),e.q=null;let i=a(e.state);e.vode=P(e.state,e.patch,t.parentElement,0,e.vode,i),t.tagName.toUpperCase()!==i[0].toUpperCase()&&(t=e.vode.node,t._vode=e)}finally{e.isRendering=!1,e.stats.renderCount++,e.stats.lastRenderTime=Date.now()-r,e.q&&e.render()}})}),e.patch=o.patch,e.state=o,e.q=null;let s=t;s._vode=e,e.vode=P(o,e.patch,t.parentElement,Array.from(t.parentElement.children).indexOf(t),b(t,!0),a(o));for(let r of n)e.patch(r);return e.patch}function b(t,o){if(t?.nodeType===Node.TEXT_NODE)return t.nodeValue?.trim()!==""?o?t:t.nodeValue:void 0;if(t.nodeType===Node.COMMENT_NODE)return;if(t.nodeType===Node.ELEMENT_NODE){let n=[t.tagName.toLowerCase()];if(o&&(n.node=t),t?.hasAttributes()){let e={},s=t.attributes;for(let r of s)e[r.name]=r.value;n.push(e)}if(t.hasChildNodes()){let e=[];for(let s of t.childNodes){let r=s&&b(s,o);r?n.push(r):s&&o&&e.push(s)}for(let s of e)s.remove()}return n}else return}function _(t,o){if(!t||!Array.isArray(t))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=t,o}function K(t){if(!t||typeof t!="object")throw new Error("createState() must be called with a state object");return t}function X(t){return t}function q(t){return t?Array.isArray(t)?t[0]:typeof t=="string"||t.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function d(t){if(Array.isArray(t)&&t.length>1&&t[1]&&!Array.isArray(t[1])&&typeof t[1]=="object"&&t[1].nodeType!==Node.TEXT_NODE)return t[1]}function Y(t,o){if(!t)return o;if(!o)return t;if(typeof t=="string"&&typeof o=="string"){let a=t.split(" "),n=o.split(" "),e=new Set([...a,...n]);return Array.from(e).join(" ").trim()}else if(typeof t=="string"&&Array.isArray(o)){let a=new Set([...o,...t.split(" ")]);return Array.from(a).join(" ").trim()}else if(Array.isArray(t)&&typeof o=="string"){let a=new Set([...t,...o.split(" ")]);return Array.from(a).join(" ").trim()}else if(Array.isArray(t)&&Array.isArray(o)){let a=new Set([...t,...o]);return Array.from(a).join(" ").trim()}else{if(typeof t=="string"&&typeof o=="object")return{[t]:!0,...o};if(typeof t=="object"&&typeof o=="string")return{...t,[o]:!0};if(typeof t=="object"&&typeof o=="object")return{...t,...o};if(typeof t=="object"&&Array.isArray(o)){let a={...t};for(let n of o)a[n]=!0;return a}else if(Array.isArray(t)&&typeof o=="object"){let a={};for(let n of t)a[n]=!0;for(let n of Object.keys(o))a[n]=o[n];return a}}throw new Error(`cannot merge classes of ${t} (${typeof t}) and ${o} (${typeof o})`)}function A(t){let o=C(t);return o>0?t.slice(o):null}function W(t){return t.length-C(t)}function $(t,o){return t[o+C(t)]}function C(t){return d(t)?2:1}function x(t,o,a){if(!o)return t;for(let n in o){let e=o[n];if(e&&typeof e=="object"){let s=t[n];s?Array.isArray(e)?t[n]=[...e]:e instanceof Date&&s!==e?t[n]=new Date(e):Array.isArray(s)?t[n]=x({},e,a):typeof s=="object"?x(t[n],e,a):t[n]=x({},e,a):Array.isArray(e)?t[n]=[...e]:e instanceof Date?t[n]=new Date(e):t[n]=x({},e,a)}else e===void 0&&a?delete t[n]:t[n]=e}return t}function P(t,o,a,n,e,s,r){s=O(t,s,e);let i=!s||typeof s=="number"||typeof s=="boolean";if(s===e||!e&&i)return e;let S=e?.nodeType===Node.TEXT_NODE,p=S?e:e?.node;if(i){p?.onUnmount&&o(p.onUnmount(p)),p?.remove();return}let E=!i&&Q(s),m=!i&&J(s),M=!!s&&typeof s!="string"&&!!(s?.node||s?.nodeType===Node.TEXT_NODE);if(!E&&!m&&!M&&!e)throw new Error("Invalid vode: "+typeof s+" "+JSON.stringify(s));if(M&&E?s=s.wholeText:M&&m&&(s=[...s]),S&&E)return p.nodeValue!==s&&(p.nodeValue=s),e;if(E&&(!p||!S)){let f=document.createTextNode(s);return p?(p.onUnmount&&o(p.onUnmount(p)),p.replaceWith(f)):a.childNodes[n]?a.insertBefore(f,a.childNodes[n]):a.appendChild(f),f}if(m&&(!p||S||e[0]!==s[0])){let f=s;1 in f&&(f[1]=O(t,f[1],void 0));let y=d(s);r=y?.xmlns||r;let l=r?document.createElementNS(r,s[0]):document.createElement(s[0]);s.node=l,R(o,l,void 0,y),p?(p.onUnmount&&o(p.onUnmount(p)),p.replaceWith(l)):a.childNodes[n]?a.insertBefore(l,a.childNodes[n]):a.appendChild(l);let g=A(s);if(g)for(let T=0;T<g.length;T++){let c=g[T],u=P(t,o,l,T,void 0,c,r);s[y?T+2:T+1]=u}return l.onMount&&o(l.onMount(l)),s}if(!S&&m&&e[0]===s[0]){s.node=p;let f=s,y=e,l=!1;if(f[1]?.__memo){let c=f[1];if(f[1]=O(t,f[1],y[1]),c!==f[1]){let u=d(s);R(o,p,d(e),u),l=!!u}}else{let c=d(s);R(o,p,d(e),c),l=!!c}let g=A(s),T=A(e);if(g){for(let c=0;c<g.length;c++){let u=g[c],v=T&&T[c],L=P(t,o,p,c,v,u,r);L&&(s[l?c+2:c+1]=L)}for(let c=g.length;T&&c<T.length;c++)T[c]?.node?T[c].node.remove():T[c]?.nodeType===Node.TEXT_NODE&&T[c].remove()}for(let c=g?.length||0;c<T?.length;c++)T[c]?.node?T[c].node.remove():T[c]?.nodeType===Node.TEXT_NODE&&T[c].remove();return s}}function J(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"}function Q(t){return typeof t=="string"||t?.nodeType===Node.TEXT_NODE}function O(t,o,a){if(typeof o!="function")return o;let n=o?.__memo,e=a?.__memo;if(Array.isArray(n)&&Array.isArray(e)&&n.length===e.length){let r=!0;for(let i=0;i<n.length;i++)if(n[i]!==e[i]){r=!1;break}if(r)return a}let s=D(o,t);return typeof s=="object"&&(s.__memo=o?.__memo),s}function D(t,o){return typeof t=="function"?D(t(o),o):t}function R(t,o,a,n){if(!(!n&&!a)){if(a)for(let e in a){let s=a[e],r=n?.[e];s!==r&&(n?n[e]=h(t,o,e,s,r):h(t,o,e,s,void 0))}if(n&&a){for(let e in n)if(!(e in a)){let s=n[e];n[e]=h(t,o,e,void 0,s)}}else if(n)for(let e in n){let s=n[e];n[e]=h(t,o,e,void 0,s)}}}function h(t,o,a,n,e){if(a==="style")if(!e)o.style.cssText="";else if(typeof e=="string")n!==e&&(o.style.cssText=e);else if(n&&typeof n=="object")for(let s in{...n,...e})!n||e[s]!==n[s]?o.style[s]=e[s]:n[s]&&!e[s]&&(o.style[s]=void 0);else for(let s in e)o.style[s]=e[s];else if(a==="class")e?o.setAttribute("class",I(e)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(e){let s=null;if(typeof e=="function"){let r=e;s=i=>t([r,i])}else if(Array.isArray(e)){let r=e,i=e[0];r.length>1?s=()=>t([i,...r.slice(1)]):s=S=>t([i,S])}else typeof e=="object"&&(s=()=>t(e));o[a]=s}else o[a]=null;else e!=null&&e!==!1?o.setAttribute(a,e):o.removeAttribute(a);return e}function I(t){return typeof t=="string"?t:Array.isArray(t)?t.map(I).join(" "):typeof t=="object"?Object.keys(t).filter(o=>t[o]).join(" "):""}var z="a",Z="abbr",w="address",tt="area",et="article",ot="aside",st="audio",nt="b",at="base",rt="bdi",ct="bdo",it="blockquote",pt="body",Tt="br",ft="button",lt="canvas",St="caption",gt="cite",dt="code",ut="col",xt="colgroup",yt="data",Et="datalist",mt="dd",ht="del",At="details",Pt="dfn",Ct="dialog",Mt="div",Nt="dl",Ot="dt",Rt="em",bt="embed",Lt="fieldset",Dt="figcaption",It="figure",vt="footer",Ft="form",Ht="h1",kt="h2",Ut="h3",Gt="h4",Vt="h5",jt="h6",Bt="head",_t="header",Kt="hgroup",Xt="hr",qt="html",Yt="i",Wt="iframe",$t="img",Jt="input",Qt="ins",zt="kbd",Zt="label",wt="legend",te="li",ee="link",oe="main",se="map",ne="mark",ae="menu",re="meta",ce="meter",ie="nav",pe="noscript",Te="object",fe="ol",le="optgroup",Se="option",ge="output",de="p",ue="picture",xe="pre",ye="progress",Ee="q",me="rp",he="rt",Ae="ruby",Pe="s",Ce="samp",Me="script",Ne="search",Oe="section",Re="select",be="slot",Le="small",De="source",Ie="span",ve="strong",Fe="style",He="sub",ke="summary",Ue="sup",Ge="table",Ve="tbody",je="td",Be="template",_e="textarea",Ke="tfoot",Xe="th",qe="thead",Ye="time",We="title",$e="tr",Je="track",Qe="u",ze="ul",Ze="var",we="video",to="wbr",eo="animate",oo="animateMotion",so="animateTransform",no="circle",ao="clipPath",ro="defs",co="desc",io="ellipse",po="feBlend",To="feColorMatrix",fo="feComponentTransfer",lo="feComposite",So="feConvolveMatrix",go="feDiffuseLighting",uo="feDisplacementMap",xo="feDistantLight",yo="feDropShadow",Eo="feFlood",mo="feFuncA",ho="feFuncB",Ao="feFuncG",Po="feFuncR",Co="feGaussianBlur",Mo="feImage",No="feMerge",Oo="feMergeNode",Ro="feMorphology",bo="feOffset",Lo="fePointLight",Do="feSpecularLighting",Io="feSpotLight",vo="feTile",Fo="feTurbulence",Ho="filter",ko="foreignObject",Uo="g",Go="image",Vo="line",jo="linearGradient",Bo="marker",_o="mask",Ko="metadata",Xo="mpath",qo="path",Yo="pattern",Wo="polygon",$o="polyline",Jo="radialGradient",Qo="rect",zo="set",Zo="stop",wo="svg",ts="switch",es="symbol",os="text",ss="textPath",ns="tspan",as="use",rs="view",cs="annotation",is="annotation-xml",ps="maction",Ts="math",fs="merror",ls="mfrac",Ss="mi",gs="mmultiscripts",ds="mn",us="mo",xs="mover",ys="mpadded",Es="mphantom",ms="mprescripts",hs="mroot",As="mrow",Ps="ms",Cs="mspace",Ms="msqrt",Ns="mstyle",Os="msub",Rs="msubsup",bs="msup",Ls="mtable",Ds="mtd",Is="mtext",vs="mtr",Fs="munder",Hs="munderover",ks="semantics";return V(Us);})();
package/dist/vode.min.mjs CHANGED
@@ -1 +1 @@
1
- function P(f,z,...J){if(!f)throw Error("first argument to vode() must be a tag name or a vode");if(Array.isArray(f))return f;else if(z)return[f,z,...J];else return[f,...J]}function g(f,z,J,...G){if(!f?.parentElement)throw Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!z||typeof z!=="object")throw Error("second argument to app() must be a state object");if(typeof J!=="function")throw Error("third argument to app() must be a function that returns a vode");let q={};q.stats={lastRenderTime:0,renderCount:0,liveEffectCount:0,patchCount:0,renderPatchCount:0},Object.defineProperty(z,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(E)=>{if(!E||typeof E!=="function"&&typeof E!=="object")return;if(q.stats.patchCount++,E?.next){let U=E;q.stats.liveEffectCount++;try{let Z=await U.next();while(Z.done===!1){q.stats.liveEffectCount++;try{q.patch(Z.value),Z=await U.next()}finally{q.stats.liveEffectCount--}}q.patch(Z.value)}finally{q.stats.liveEffectCount--}}else if(E.then){q.stats.liveEffectCount++;try{let U=await E;q.patch(U)}finally{q.stats.liveEffectCount--}}else if(Array.isArray(E))if(typeof E[0]==="function")if(E.length>1)q.patch(E[0](q.state,...E.slice(1)));else q.patch(E[0](q.state));else q.stats.patchCount--;else if(typeof E==="function")q.patch(E(q.state));else if(q.stats.renderPatchCount++,q.q=H(q.q||{},E,!1),!q.isRendering)q.render()}}),Object.defineProperty(q,"render",{enumerable:!1,configurable:!0,writable:!1,value:()=>requestAnimationFrame(()=>{if(q.isRendering||!q.q)return;q.isRendering=!0;let E=Date.now();try{q.state=H(q.state,q.q,!0),q.q=null;let U=J(q.state);if(q.vode=D(q.state,q.patch,f.parentElement,0,q.vode,U),f.tagName.toUpperCase()!==U[0].toUpperCase())f=q.vode.node,f._vode=q}finally{if(q.isRendering=!1,q.stats.renderCount++,q.stats.lastRenderTime=Date.now()-E,q.q)q.render()}})}),q.patch=z.patch,q.state=z,q.q=null;let B=f;B._vode=q,q.vode=D(z,q.patch,f.parentElement,Array.from(f.parentElement.children).indexOf(f),k(f,!0),J(z));for(let E of G)q.patch(E);return q.patch}function k(f,z){if(f?.nodeType===Node.TEXT_NODE){if(f.nodeValue?.trim()!=="")return z?f:f.nodeValue;return}else if(f.nodeType===Node.COMMENT_NODE)return;else if(f.nodeType===Node.ELEMENT_NODE){let G=[f.tagName.toLowerCase()];if(z)G.node=f;if(f?.hasAttributes()){let q={},B=f.attributes;for(let E of B)q[E.name]=E.value;G.push(q)}if(f.hasChildNodes()){let q=[];for(let B of f.childNodes){let E=B&&k(B,z);if(E)G.push(E);else if(B&&z)q.push(B)}for(let B of q)B.remove()}return G}else return}function h(f,z){if(!f||!Array.isArray(f))throw Error("first argument to memo() must be an array of values to compare");if(typeof z!=="function")throw Error("second argument to memo() must be a function that returns a vode or props object");return z.__memo=f,z}function u(f){if(!f||typeof f!=="object")throw Error("createState() must be called with a state object");return f}function v(f){return f}function c(f){return f?Array.isArray(f)?f[0]:typeof f==="string"||f.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(f){if(Array.isArray(f)&&f.length>1&&f[1]&&!Array.isArray(f[1])){if(typeof f[1]==="object"&&f[1].nodeType!==Node.TEXT_NODE)return f[1]}return}function i(f,z){if(!f)return z;if(!z)return f;if(typeof f==="string"&&typeof z==="string"){let J=f.split(" "),G=z.split(" "),q=new Set([...J,...G]);return Array.from(q).join(" ").trim()}else if(typeof f==="string"&&Array.isArray(z)){let J=new Set([...z,...f.split(" ")]);return Array.from(J).join(" ").trim()}else if(Array.isArray(f)&&typeof z==="string"){let J=new Set([...f,...z.split(" ")]);return Array.from(J).join(" ").trim()}else if(Array.isArray(f)&&Array.isArray(z)){let J=new Set([...f,...z]);return Array.from(J).join(" ").trim()}else if(typeof f==="string"&&typeof z==="object")return{[f]:!0,...z};else if(typeof f==="object"&&typeof z==="string")return{...f,[z]:!0};else if(typeof f==="object"&&typeof z==="object")return{...f,...z};else if(typeof f==="object"&&Array.isArray(z)){let J={...f};for(let G of z)J[G]=!0;return J}else if(Array.isArray(f)&&typeof z==="object"){let J={};for(let G of f)J[G]=!0;for(let G of Object.keys(z))J[G]=z[G];return J}throw Error(`cannot merge classes of ${f} (${typeof f}) and ${z} (${typeof z})`)}function R(f){let z=x(f);if(z>0)return f.slice(z);return null}function V(f){return f.length-x(f)}function w(f,z){return f[z+x(f)]}function x(f){return A(f)?2:1}function H(f,z,J){if(!z)return f;for(let G in z){let q=z[G];if(q&&typeof q==="object"){let B=f[G];if(B)if(Array.isArray(q))f[G]=[...q];else if(q instanceof Date&&B!==q)f[G]=new Date(q);else if(Array.isArray(B))f[G]=H({},q,J);else if(typeof B==="object")H(f[G],q,J);else f[G]=H({},q,J);else if(Array.isArray(q))f[G]=[...q];else if(q instanceof Date)f[G]=new Date(q);else f[G]=H({},q,J)}else if(q===void 0&&J)delete f[G];else f[G]=q}return f}function D(f,z,J,G,q,B,E){B=I(f,B,q);let U=!B||typeof B==="number"||typeof B==="boolean";if(B===q||!q&&U)return q;let Z=q?.nodeType===Node.TEXT_NODE,W=Z?q:q?.node;if(U){W?.onUnmount&&z(W.onUnmount(W)),W?.remove();return}let O=!U&&m(B),F=!U&&y(B),T=!!B&&typeof B!=="string"&&!!(B?.node||B?.nodeType===Node.TEXT_NODE);if(!O&&!F&&!T&&!q)throw Error("Invalid vode: "+typeof B+" "+JSON.stringify(B));else if(T&&O)B=B.wholeText;else if(T&&F)B=[...B];if(Z&&O){if(W.nodeValue!==B)W.nodeValue=B;return q}if(O&&(!W||!Z)){let X=document.createTextNode(B);if(W)W.onUnmount&&z(W.onUnmount(W)),W.replaceWith(X);else if(J.childNodes[G])J.insertBefore(X,J.childNodes[G]);else J.appendChild(X);return X}if(F&&(!W||Z||q[0]!==B[0])){E=E||B[0]==="svg";let X=E?document.createElementNS("http://www.w3.org/2000/svg",B[0]):document.createElement(B[0]);B.node=X;let C=B;if(1 in C)C[1]=I(f,C[1],void 0);let j=A(B);if(K(z,X,void 0,j,E),W)W.onUnmount&&z(W.onUnmount(W)),W.replaceWith(X);else if(J.childNodes[G])J.insertBefore(X,J.childNodes[G]);else J.appendChild(X);let $=R(B);if($)for(let Y=0;Y<$.length;Y++){let Q=$[Y],L=D(f,z,X,Y,void 0,Q,E);B[j?Y+2:Y+1]=L}return X.onMount&&z(X.onMount(X)),B}if(!Z&&F&&q[0]===B[0]){E=E||B[0]==="svg",B.node=W;let X=B,C=q,j=!1;if(X[1]?.__memo){let Q=X[1];if(X[1]=I(f,X[1],C[1]),Q!==X[1]){let L=A(B);K(z,W,A(q),L,E),j=!!L}}else{let Q=A(B);K(z,W,A(q),Q,E),j=!!Q}let $=R(B),Y=R(q);if($){for(let Q=0;Q<$.length;Q++){let L=$[Q],b=Y&&Y[Q],N=D(f,z,W,Q,b,L,E);if(N)B[j?Q+2:Q+1]=N}for(let Q=$.length;Y&&Q<Y.length;Q++)if(Y[Q]?.node)Y[Q].node.remove();else if(Y[Q]?.nodeType===Node.TEXT_NODE)Y[Q].remove()}for(let Q=$?.length||0;Q<Y?.length;Q++)if(Y[Q]?.node)Y[Q].node.remove();else if(Y[Q]?.nodeType===Node.TEXT_NODE)Y[Q].remove();return B}return}function y(f){return Array.isArray(f)&&f.length>0&&typeof f[0]==="string"}function m(f){return typeof f==="string"||f?.nodeType===Node.TEXT_NODE}function I(f,z,J){if(typeof z!=="function")return z;let G=z?.__memo,q=J?.__memo;if(Array.isArray(G)&&Array.isArray(q)&&G.length===q.length){let E=!0;for(let U=0;U<G.length;U++)if(G[U]!==q[U]){E=!1;break}if(E)return J}let B=_(z,f);if(typeof B==="object")B.__memo=z?.__memo;return B}function _(f,z){if(typeof f==="function")return _(f(z),z);else return f}function K(f,z,J,G,q){if(!G&&!J)return;if(J)for(let B in J){let E=J[B],U=G?.[B];if(E!==U)if(G)G[B]=M(f,z,B,E,U,q);else M(f,z,B,E,void 0,q)}if(G&&J){for(let B in G)if(!(B in J)){let E=G[B];G[B]=M(f,z,B,void 0,E,q)}}else if(G)for(let B in G){let E=G[B];G[B]=M(f,z,B,void 0,E,q)}}function M(f,z,J,G,q,B){if(J==="style")if(!q)z.style.cssText="";else if(typeof q==="string"){if(G!==q)z.style.cssText=q}else if(G&&typeof G==="object"){for(let E in{...G,...q})if(!G||q[E]!==G[E])z.style[E]=q[E];else if(G[E]&&!q[E])z.style[E]=void 0}else for(let E in q)z.style[E]=q[E];else if(J==="class")if(B)if(q){let E=S(q);z.classList.value=E}else z.classList.value="";else if(q){let E=S(q);z.className=E}else z.className="";else if(J[0]==="o"&&J[1]==="n")if(q){let E=null;if(typeof q==="function"){let U=q;E=(Z)=>f([U,Z])}else if(Array.isArray(q)){let U=q,Z=q[0];if(U.length>1)E=()=>f([Z,...U.slice(1)]);else E=(W)=>f([Z,W])}else if(typeof q==="object")E=()=>f(q);z[J]=E}else z[J]=null;else if(q!==null&&q!==void 0&&q!==!1)z.setAttribute(J,q);else z.removeAttribute(J);return q}function S(f){if(typeof f==="string")return f;else if(Array.isArray(f))return f.map(S).join(" ");else if(typeof f==="object")return Object.keys(f).filter((z)=>f[z]).join(" ");else return""}var s="a",r="abbr",l="address",t="area",n="article",a="aside",d="audio",o="b",e="base",ff="bdi",qf="bdo",zf="blockquote",Bf="body",Ef="br",Gf="button",Jf="canvas",Qf="caption",Uf="cite",Wf="code",Xf="col",Yf="colgroup",Zf="data",$f="datalist",jf="dd",Lf="del",Af="details",Hf="dfn",Cf="dialog",Of="div",Ff="dl",Mf="dt",Df="em",Tf="embed",Rf="fieldset",If="figcaption",Kf="figure",Sf="footer",xf="form",Nf="h1",kf="h2",_f="h3",bf="h4",yf="h5",mf="h6",Pf="head",gf="header",hf="hgroup",uf="hr",vf="html",cf="i",Vf="iframe",wf="img",pf="input",sf="ins",rf="kbd",lf="label",tf="legend",nf="li",af="link",df="main",of="map",ef="mark",fq="menu",qq="meta",zq="meter",Bq="nav",Eq="noscript",Gq="object",Jq="ol",Qq="optgroup",Uq="option",Wq="output",Xq="p",Yq="picture",Zq="pre",$q="progress",jq="q",Lq="rp",Aq="rt",Hq="ruby",Cq="s",Oq="samp",Fq="script",Mq="section",Dq="select",Tq="slot",Rq="small",Iq="source",Kq="span",Sq="strong",xq="style",Nq="sub",kq="summary",_q="sup",bq="table",yq="tbody",mq="td",Pq="template",gq="textarea",hq="tfoot",uq="th",vq="thead",cq="time",iq="title",Vq="tr",wq="track",pq="u",sq="ul",rq="video",lq="wbr",tq="animate",nq="animateMotion",aq="animateTransform",dq="circle",oq="clipPath",eq="defs",fz="desc",qz="ellipse",zz="feBlend",Bz="feColorMatrix",Ez="feComponentTransfer",Gz="feComposite",Jz="feConvolveMatrix",Qz="feDiffuseLighting",Uz="feDisplacementMap",Wz="feDistantLight",Xz="feDropShadow",Yz="feFlood",Zz="feFuncA",$z="feFuncB",jz="feFuncG",Lz="feFuncR",Az="feGaussianBlur",Hz="feImage",Cz="feMerge",Oz="feMergeNode",Fz="feMorphology",Mz="feOffset",Dz="fePointLight",Tz="feSpecularLighting",Rz="feSpotLight",Iz="feTile",Kz="feTurbulence",Sz="filter",xz="foreignObject",Nz="g",kz="image",_z="line",bz="linearGradient",yz="marker",mz="mask",Pz="metadata",gz="mpath",hz="path",uz="pattern",vz="polygon",cz="polyline",iz="radialGradient",Vz="rect",wz="set",pz="stop",sz="svg",rz="switch",lz="symbol",tz="text",nz="textPath",az="tspan",dz="use",oz="view",ez="annotation",fB="annotation-xml",qB="maction",zB="math",BB="merror",EB="mfrac",GB="mi",JB="mmultiscripts",QB="mn",UB="mo",WB="mover",XB="mpadded",YB="mphantom",ZB="mprescripts",$B="mroot",jB="mrow",LB="ms",AB="mspace",HB="msqrt",CB="mstyle",OB="msub",FB="msubsup",MB="msup",DB="mtable",TB="mtd",RB="mtext",IB="mtr",KB="munder",SB="munderover",xB="semantics";export{P as vode,c as tag,A as props,i as mergeClass,h as memo,k as hydrate,u as createState,v as createPatch,x as childrenStart,R as children,V as childCount,w as child,g as app,lq as WBR,oz as VIEW,rq as VIDEO,dz as USE,sq as UL,pq as U,az as TSPAN,wq as TRACK,Vq as TR,iq as TITLE,cq as TIME,vq as THEAD,uq as TH,hq as TFOOT,nz as TEXTPATH,gq as TEXTAREA,tz as TEXT,Pq as TEMPLATE,mq as TD,yq as TBODY,bq as TABLE,lz as SYMBOL,rz as SWITCH,sz as SVG,_q as SUP,kq as SUMMARY,Nq as SUB,xq as STYLE,Sq as STRONG,pz as STOP,Kq as SPAN,Iq as SOURCE,Rq as SMALL,Tq as SLOT,wz as SET,xB as SEMANTICS,Dq as SELECT,Mq as SECTION,Fq as SCRIPT,Oq as SAMP,Cq as S,Hq as RUBY,Aq as RT,Lq as RP,Vz as RECT,iz as RADIALGRADIENT,jq as Q,$q as PROGRESS,Zq as PRE,cz as POLYLINE,vz as POLYGON,Yq as PICTURE,uz as PATTERN,hz as PATH,Xq as P,Wq as OUTPUT,Uq as OPTION,Qq as OPTGROUP,Jq as OL,Gq as OBJECT,Eq as NOSCRIPT,Bq as NAV,SB as MUNDEROVER,KB as MUNDER,IB as MTR,RB as MTEXT,TB as MTD,DB as MTABLE,MB as MSUP,FB as MSUBSUP,OB as MSUB,CB as MSTYLE,HB as MSQRT,AB as MSPACE,LB as MS,jB as MROW,$B as MROOT,ZB as MPRESCRIPTS,YB as MPHANTOM,gz as MPATH,XB as MPADDED,WB as MOVER,UB as MO,QB as MN,JB as MMULTISCRIPTS,GB as MI,EB as MFRAC,zq as METER,Pz as METADATA,qq as META,BB as MERROR,fq as MENU,zB as MATH,mz as MASK,yz as MARKER,ef as MARK,of as MAP,df as MAIN,qB as MACTION,af as LINK,bz as LINEARGRADIENT,_z as LINE,nf as LI,tf as LEGEND,lf as LABEL,rf as KBD,sf as INS,pf as INPUT,wf as IMG,kz as IMAGE,Vf as IFRAME,cf as I,vf as HTML,uf as HR,hf as HGROUP,gf as HEADER,Pf as HEAD,mf as H6,yf as H5,bf as H4,_f as H3,kf as H2,Nf as H1,Nz as G,xf as FORM,xz as FOREIGNOBJECT,Sf as FOOTER,Sz as FILTER,Kf as FIGURE,If as FIGCAPTION,Rf as FIELDSET,Kz as FETURBULENCE,Iz as FETILE,Rz as FESPOTLIGHT,Tz as FESPECULARLIGHTING,Dz as FEPOINTLIGHT,Mz as FEOFFSET,Fz as FEMORPHOLOGY,Oz as FEMERGENODE,Cz as FEMERGE,Hz as FEIMAGE,Az as FEGAUSSIANBLUR,Lz as FEFUNCR,jz as FEFUNCG,$z as FEFUNCB,Zz as FEFUNCA,Yz as FEFLOOD,Xz as FEDROPSHADOW,Wz as FEDISTANTLIGHT,Uz as FEDISPLACEMENTMAP,Qz as FEDIFFUSELIGHTING,Jz as FECONVOLVEMATRIX,Gz as FECOMPOSITE,Ez as FECOMPONENTTRANSFER,Bz as FECOLORMATRIX,zz as FEBLEND,Tf as EMBED,Df as EM,qz as ELLIPSE,Mf as DT,Ff as DL,Of as DIV,Cf as DIALOG,Hf as DFN,Af as DETAILS,fz as DESC,Lf as DEL,eq as DEFS,jf as DD,$f as DATALIST,Zf as DATA,Yf as COLGROUP,Xf as COL,Wf as CODE,oq as CLIPPATH,Uf as CITE,dq as CIRCLE,Qf as CAPTION,Jf as CANVAS,Gf as BUTTON,Ef as BR,Bf as BODY,zf as BLOCKQUOTE,qf as BDO,ff as BDI,e as BASE,o as B,d as AUDIO,a as ASIDE,n as ARTICLE,t as AREA,fB as ANNOTATION_XML,ez as ANNOTATION,aq as ANIMATETRANSFORM,nq as ANIMATEMOTION,tq as ANIMATE,l as ADDRESS,r as ABBR,s as A};
1
+ function P(f,z,...G){if(!f)throw Error("first argument to vode() must be a tag name or a vode");if(Array.isArray(f))return f;else if(z)return[f,z,...G];else return[f,...G]}function m(f,z,G,...E){if(!f?.parentElement)throw Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!z||typeof z!=="object")throw Error("second argument to app() must be a state object");if(typeof G!=="function")throw Error("third argument to app() must be a function that returns a vode");let q={};q.stats={lastRenderTime:0,renderCount:0,liveEffectCount:0,patchCount:0,renderPatchCount:0},Object.defineProperty(z,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(J)=>{if(!J||typeof J!=="function"&&typeof J!=="object")return;if(q.stats.patchCount++,J?.next){let U=J;q.stats.liveEffectCount++;try{let $=await U.next();while($.done===!1){q.stats.liveEffectCount++;try{q.patch($.value),$=await U.next()}finally{q.stats.liveEffectCount--}}q.patch($.value)}finally{q.stats.liveEffectCount--}}else if(J.then){q.stats.liveEffectCount++;try{let U=await J;q.patch(U)}finally{q.stats.liveEffectCount--}}else if(Array.isArray(J))if(typeof J[0]==="function")if(J.length>1)q.patch(J[0](q.state,...J.slice(1)));else q.patch(J[0](q.state));else q.stats.patchCount--;else if(typeof J==="function")q.patch(J(q.state));else if(q.stats.renderPatchCount++,q.q=C(q.q||{},J,!1),!q.isRendering)q.render()}}),Object.defineProperty(q,"render",{enumerable:!1,configurable:!0,writable:!1,value:()=>requestAnimationFrame(()=>{if(q.isRendering||!q.q)return;q.isRendering=!0;let J=Date.now();try{q.state=C(q.state,q.q,!0),q.q=null;let U=G(q.state);if(q.vode=D(q.state,q.patch,f.parentElement,0,q.vode,U),f.tagName.toUpperCase()!==U[0].toUpperCase())f=q.vode.node,f._vode=q}finally{if(q.isRendering=!1,q.stats.renderCount++,q.stats.lastRenderTime=Date.now()-J,q.q)q.render()}})}),q.patch=z.patch,q.state=z,q.q=null;let B=f;B._vode=q,q.vode=D(z,q.patch,f.parentElement,Array.from(f.parentElement.children).indexOf(f),x(f,!0),G(z));for(let J of E)q.patch(J);return q.patch}function x(f,z){if(f?.nodeType===Node.TEXT_NODE){if(f.nodeValue?.trim()!=="")return z?f:f.nodeValue;return}else if(f.nodeType===Node.COMMENT_NODE)return;else if(f.nodeType===Node.ELEMENT_NODE){let E=[f.tagName.toLowerCase()];if(z)E.node=f;if(f?.hasAttributes()){let q={},B=f.attributes;for(let J of B)q[J.name]=J.value;E.push(q)}if(f.hasChildNodes()){let q=[];for(let B of f.childNodes){let J=B&&x(B,z);if(J)E.push(J);else if(B&&z)q.push(B)}for(let B of q)B.remove()}return E}else return}function h(f,z){if(!f||!Array.isArray(f))throw Error("first argument to memo() must be an array of values to compare");if(typeof z!=="function")throw Error("second argument to memo() must be a function that returns a vode or props object");return z.__memo=f,z}function u(f){if(!f||typeof f!=="object")throw Error("createState() must be called with a state object");return f}function v(f){return f}function c(f){return f?Array.isArray(f)?f[0]:typeof f==="string"||f.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(f){if(Array.isArray(f)&&f.length>1&&f[1]&&!Array.isArray(f[1])){if(typeof f[1]==="object"&&f[1].nodeType!==Node.TEXT_NODE)return f[1]}return}function i(f,z){if(!f)return z;if(!z)return f;if(typeof f==="string"&&typeof z==="string"){let G=f.split(" "),E=z.split(" "),q=new Set([...G,...E]);return Array.from(q).join(" ").trim()}else if(typeof f==="string"&&Array.isArray(z)){let G=new Set([...z,...f.split(" ")]);return Array.from(G).join(" ").trim()}else if(Array.isArray(f)&&typeof z==="string"){let G=new Set([...f,...z.split(" ")]);return Array.from(G).join(" ").trim()}else if(Array.isArray(f)&&Array.isArray(z)){let G=new Set([...f,...z]);return Array.from(G).join(" ").trim()}else if(typeof f==="string"&&typeof z==="object")return{[f]:!0,...z};else if(typeof f==="object"&&typeof z==="string")return{...f,[z]:!0};else if(typeof f==="object"&&typeof z==="object")return{...f,...z};else if(typeof f==="object"&&Array.isArray(z)){let G={...f};for(let E of z)G[E]=!0;return G}else if(Array.isArray(f)&&typeof z==="object"){let G={};for(let E of f)G[E]=!0;for(let E of Object.keys(z))G[E]=z[E];return G}throw Error(`cannot merge classes of ${f} (${typeof f}) and ${z} (${typeof z})`)}function R(f){let z=K(f);if(z>0)return f.slice(z);return null}function V(f){return f.length-K(f)}function w(f,z){return f[z+K(f)]}function K(f){return A(f)?2:1}function C(f,z,G){if(!z)return f;for(let E in z){let q=z[E];if(q&&typeof q==="object"){let B=f[E];if(B)if(Array.isArray(q))f[E]=[...q];else if(q instanceof Date&&B!==q)f[E]=new Date(q);else if(Array.isArray(B))f[E]=C({},q,G);else if(typeof B==="object")C(f[E],q,G);else f[E]=C({},q,G);else if(Array.isArray(q))f[E]=[...q];else if(q instanceof Date)f[E]=new Date(q);else f[E]=C({},q,G)}else if(q===void 0&&G)delete f[E];else f[E]=q}return f}function D(f,z,G,E,q,B,J){B=I(f,B,q);let U=!B||typeof B==="number"||typeof B==="boolean";if(B===q||!q&&U)return q;let $=q?.nodeType===Node.TEXT_NODE,W=$?q:q?.node;if(U){W?.onUnmount&&z(W.onUnmount(W)),W?.remove();return}let O=!U&&y(B),F=!U&&b(B),T=!!B&&typeof B!=="string"&&!!(B?.node||B?.nodeType===Node.TEXT_NODE);if(!O&&!F&&!T&&!q)throw Error("Invalid vode: "+typeof B+" "+JSON.stringify(B));else if(T&&O)B=B.wholeText;else if(T&&F)B=[...B];if($&&O){if(W.nodeValue!==B)W.nodeValue=B;return q}if(O&&(!W||!$)){let Y=document.createTextNode(B);if(W)W.onUnmount&&z(W.onUnmount(W)),W.replaceWith(Y);else if(G.childNodes[E])G.insertBefore(Y,G.childNodes[E]);else G.appendChild(Y);return Y}if(F&&(!W||$||q[0]!==B[0])){let Y=B;if(1 in Y)Y[1]=I(f,Y[1],void 0);let H=A(B);J=H?.xmlns||J;let Z=J?document.createElementNS(J,B[0]):document.createElement(B[0]);if(B.node=Z,S(z,Z,void 0,H),W)W.onUnmount&&z(W.onUnmount(W)),W.replaceWith(Z);else if(G.childNodes[E])G.insertBefore(Z,G.childNodes[E]);else G.appendChild(Z);let j=R(B);if(j)for(let X=0;X<j.length;X++){let Q=j[X],L=D(f,z,Z,X,void 0,Q,J);B[H?X+2:X+1]=L}return Z.onMount&&z(Z.onMount(Z)),B}if(!$&&F&&q[0]===B[0]){B.node=W;let Y=B,H=q,Z=!1;if(Y[1]?.__memo){let Q=Y[1];if(Y[1]=I(f,Y[1],H[1]),Q!==Y[1]){let L=A(B);S(z,W,A(q),L),Z=!!L}}else{let Q=A(B);S(z,W,A(q),Q),Z=!!Q}let j=R(B),X=R(q);if(j){for(let Q=0;Q<j.length;Q++){let L=j[Q],_=X&&X[Q],N=D(f,z,W,Q,_,L,J);if(N)B[Z?Q+2:Q+1]=N}for(let Q=j.length;X&&Q<X.length;Q++)if(X[Q]?.node)X[Q].node.remove();else if(X[Q]?.nodeType===Node.TEXT_NODE)X[Q].remove()}for(let Q=j?.length||0;Q<X?.length;Q++)if(X[Q]?.node)X[Q].node.remove();else if(X[Q]?.nodeType===Node.TEXT_NODE)X[Q].remove();return B}return}function b(f){return Array.isArray(f)&&f.length>0&&typeof f[0]==="string"}function y(f){return typeof f==="string"||f?.nodeType===Node.TEXT_NODE}function I(f,z,G){if(typeof z!=="function")return z;let E=z?.__memo,q=G?.__memo;if(Array.isArray(E)&&Array.isArray(q)&&E.length===q.length){let J=!0;for(let U=0;U<E.length;U++)if(E[U]!==q[U]){J=!1;break}if(J)return G}let B=g(z,f);if(typeof B==="object")B.__memo=z?.__memo;return B}function g(f,z){if(typeof f==="function")return g(f(z),z);else return f}function S(f,z,G,E){if(!E&&!G)return;if(G)for(let q in G){let B=G[q],J=E?.[q];if(B!==J)if(E)E[q]=M(f,z,q,B,J);else M(f,z,q,B,void 0)}if(E&&G){for(let q in E)if(!(q in G)){let B=E[q];E[q]=M(f,z,q,void 0,B)}}else if(E)for(let q in E){let B=E[q];E[q]=M(f,z,q,void 0,B)}}function M(f,z,G,E,q){if(G==="style")if(!q)z.style.cssText="";else if(typeof q==="string"){if(E!==q)z.style.cssText=q}else if(E&&typeof E==="object"){for(let B in{...E,...q})if(!E||q[B]!==E[B])z.style[B]=q[B];else if(E[B]&&!q[B])z.style[B]=void 0}else for(let B in q)z.style[B]=q[B];else if(G==="class")if(q)z.setAttribute("class",k(q));else z.removeAttribute("class");else if(G[0]==="o"&&G[1]==="n")if(q){let B=null;if(typeof q==="function"){let J=q;B=(U)=>f([J,U])}else if(Array.isArray(q)){let J=q,U=q[0];if(J.length>1)B=()=>f([U,...J.slice(1)]);else B=($)=>f([U,$])}else if(typeof q==="object")B=()=>f(q);z[G]=B}else z[G]=null;else if(q!==null&&q!==void 0&&q!==!1)z.setAttribute(G,q);else z.removeAttribute(G);return q}function k(f){if(typeof f==="string")return f;else if(Array.isArray(f))return f.map(k).join(" ");else if(typeof f==="object")return Object.keys(f).filter((z)=>f[z]).join(" ");else return""}var s="a",r="abbr",l="address",t="area",n="article",a="aside",d="audio",o="b",e="base",ff="bdi",qf="bdo",zf="blockquote",Bf="body",Ef="br",Gf="button",Jf="canvas",Qf="caption",Uf="cite",Wf="code",Xf="col",Yf="colgroup",Zf="data",$f="datalist",jf="dd",Lf="del",Af="details",Cf="dfn",Hf="dialog",Of="div",Ff="dl",Mf="dt",Df="em",Tf="embed",Rf="fieldset",If="figcaption",Sf="figure",Kf="footer",Nf="form",xf="h1",gf="h2",kf="h3",_f="h4",bf="h5",yf="h6",Pf="head",mf="header",hf="hgroup",uf="hr",vf="html",cf="i",Vf="iframe",wf="img",pf="input",sf="ins",rf="kbd",lf="label",tf="legend",nf="li",af="link",df="main",of="map",ef="mark",fq="menu",qq="meta",zq="meter",Bq="nav",Eq="noscript",Gq="object",Jq="ol",Qq="optgroup",Uq="option",Wq="output",Xq="p",Yq="picture",Zq="pre",$q="progress",jq="q",Lq="rp",Aq="rt",Cq="ruby",Hq="s",Oq="samp",Fq="script",Mq="search",Dq="section",Tq="select",Rq="slot",Iq="small",Sq="source",Kq="span",Nq="strong",xq="style",gq="sub",kq="summary",_q="sup",bq="table",yq="tbody",Pq="td",mq="template",hq="textarea",uq="tfoot",vq="th",cq="thead",iq="time",Vq="title",wq="tr",pq="track",sq="u",rq="ul",lq="var",tq="video",nq="wbr",aq="animate",dq="animateMotion",oq="animateTransform",eq="circle",fz="clipPath",qz="defs",zz="desc",Bz="ellipse",Ez="feBlend",Gz="feColorMatrix",Jz="feComponentTransfer",Qz="feComposite",Uz="feConvolveMatrix",Wz="feDiffuseLighting",Xz="feDisplacementMap",Yz="feDistantLight",Zz="feDropShadow",$z="feFlood",jz="feFuncA",Lz="feFuncB",Az="feFuncG",Cz="feFuncR",Hz="feGaussianBlur",Oz="feImage",Fz="feMerge",Mz="feMergeNode",Dz="feMorphology",Tz="feOffset",Rz="fePointLight",Iz="feSpecularLighting",Sz="feSpotLight",Kz="feTile",Nz="feTurbulence",xz="filter",gz="foreignObject",kz="g",_z="image",bz="line",yz="linearGradient",Pz="marker",mz="mask",hz="metadata",uz="mpath",vz="path",cz="pattern",iz="polygon",Vz="polyline",wz="radialGradient",pz="rect",sz="set",rz="stop",lz="svg",tz="switch",nz="symbol",az="text",dz="textPath",oz="tspan",ez="use",fB="view",qB="annotation",zB="annotation-xml",BB="maction",EB="math",GB="merror",JB="mfrac",QB="mi",UB="mmultiscripts",WB="mn",XB="mo",YB="mover",ZB="mpadded",$B="mphantom",jB="mprescripts",LB="mroot",AB="mrow",CB="ms",HB="mspace",OB="msqrt",FB="mstyle",MB="msub",DB="msubsup",TB="msup",RB="mtable",IB="mtd",SB="mtext",KB="mtr",NB="munder",xB="munderover",gB="semantics";export{P as vode,c as tag,A as props,i as mergeClass,h as memo,x as hydrate,u as createState,v as createPatch,K as childrenStart,R as children,V as childCount,w as child,m as app,nq as WBR,fB as VIEW,tq as VIDEO,lq as VAR,ez as USE,rq as UL,sq as U,oz as TSPAN,pq as TRACK,wq as TR,Vq as TITLE,iq as TIME,cq as THEAD,vq as TH,uq as TFOOT,dz as TEXTPATH,hq as TEXTAREA,az as TEXT,mq as TEMPLATE,Pq as TD,yq as TBODY,bq as TABLE,nz as SYMBOL,tz as SWITCH,lz as SVG,_q as SUP,kq as SUMMARY,gq as SUB,xq as STYLE,Nq as STRONG,rz as STOP,Kq as SPAN,Sq as SOURCE,Iq as SMALL,Rq as SLOT,sz as SET,gB as SEMANTICS,Tq as SELECT,Dq as SECTION,Mq as SEARCH,Fq as SCRIPT,Oq as SAMP,Hq as S,Cq as RUBY,Aq as RT,Lq as RP,pz as RECT,wz as RADIALGRADIENT,jq as Q,$q as PROGRESS,Zq as PRE,Vz as POLYLINE,iz as POLYGON,Yq as PICTURE,cz as PATTERN,vz as PATH,Xq as P,Wq as OUTPUT,Uq as OPTION,Qq as OPTGROUP,Jq as OL,Gq as OBJECT,Eq as NOSCRIPT,Bq as NAV,xB as MUNDEROVER,NB as MUNDER,KB as MTR,SB as MTEXT,IB as MTD,RB as MTABLE,TB as MSUP,DB as MSUBSUP,MB as MSUB,FB as MSTYLE,OB as MSQRT,HB as MSPACE,CB as MS,AB as MROW,LB as MROOT,jB as MPRESCRIPTS,$B as MPHANTOM,uz as MPATH,ZB as MPADDED,YB as MOVER,XB as MO,WB as MN,UB as MMULTISCRIPTS,QB as MI,JB as MFRAC,zq as METER,hz as METADATA,qq as META,GB as MERROR,fq as MENU,EB as MATH,mz as MASK,Pz as MARKER,ef as MARK,of as MAP,df as MAIN,BB as MACTION,af as LINK,yz as LINEARGRADIENT,bz as LINE,nf as LI,tf as LEGEND,lf as LABEL,rf as KBD,sf as INS,pf as INPUT,wf as IMG,_z as IMAGE,Vf as IFRAME,cf as I,vf as HTML,uf as HR,hf as HGROUP,mf as HEADER,Pf as HEAD,yf as H6,bf as H5,_f as H4,kf as H3,gf as H2,xf as H1,kz as G,Nf as FORM,gz as FOREIGNOBJECT,Kf as FOOTER,xz as FILTER,Sf as FIGURE,If as FIGCAPTION,Rf as FIELDSET,Nz as FETURBULENCE,Kz as FETILE,Sz as FESPOTLIGHT,Iz as FESPECULARLIGHTING,Rz as FEPOINTLIGHT,Tz as FEOFFSET,Dz as FEMORPHOLOGY,Mz as FEMERGENODE,Fz as FEMERGE,Oz as FEIMAGE,Hz as FEGAUSSIANBLUR,Cz as FEFUNCR,Az as FEFUNCG,Lz as FEFUNCB,jz as FEFUNCA,$z as FEFLOOD,Zz as FEDROPSHADOW,Yz as FEDISTANTLIGHT,Xz as FEDISPLACEMENTMAP,Wz as FEDIFFUSELIGHTING,Uz as FECONVOLVEMATRIX,Qz as FECOMPOSITE,Jz as FECOMPONENTTRANSFER,Gz as FECOLORMATRIX,Ez as FEBLEND,Tf as EMBED,Df as EM,Bz as ELLIPSE,Mf as DT,Ff as DL,Of as DIV,Hf as DIALOG,Cf as DFN,Af as DETAILS,zz as DESC,Lf as DEL,qz as DEFS,jf as DD,$f as DATALIST,Zf as DATA,Yf as COLGROUP,Xf as COL,Wf as CODE,fz as CLIPPATH,Uf as CITE,eq as CIRCLE,Qf as CAPTION,Jf as CANVAS,Gf as BUTTON,Ef as BR,Bf as BODY,zf as BLOCKQUOTE,qf as BDO,ff as BDI,e as BASE,o as B,d as AUDIO,a as ASIDE,n as ARTICLE,t as AREA,zB as ANNOTATION_XML,qB as ANNOTATION,oq as ANIMATETRANSFORM,dq as ANIMATEMOTION,aq as ANIMATE,l as ADDRESS,r as ABBR,s as A};
package/dist/vode.mjs CHANGED
@@ -269,7 +269,7 @@ function mergeState(target, source, allowDeletion) {
269
269
  }
270
270
  return target;
271
271
  }
272
- function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
272
+ function render(state, patch, parent, childIndex, oldVode, newVode, xmlns) {
273
273
  newVode = remember(state, newVode, oldVode);
274
274
  const isNoVode = !newVode || typeof newVode === "number" || typeof newVode === "boolean";
275
275
  if (newVode === oldVode || !oldVode && isNoVode) {
@@ -313,15 +313,15 @@ function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
313
313
  return text;
314
314
  }
315
315
  if (isNode && (!oldNode || oldIsText || oldVode[0] !== newVode[0])) {
316
- svg = svg || newVode[0] === "svg";
317
- const newNode = svg ? document.createElementNS("http://www.w3.org/2000/svg", newVode[0]) : document.createElement(newVode[0]);
318
- newVode.node = newNode;
319
316
  const newvode = newVode;
320
317
  if (1 in newvode) {
321
318
  newvode[1] = remember(state, newvode[1], undefined);
322
319
  }
323
320
  const properties = props(newVode);
324
- patchProperties(patch, newNode, undefined, properties, svg);
321
+ xmlns = properties?.xmlns || xmlns;
322
+ const newNode = xmlns ? document.createElementNS(xmlns, newVode[0]) : document.createElement(newVode[0]);
323
+ newVode.node = newNode;
324
+ patchProperties(patch, newNode, undefined, properties);
325
325
  if (oldNode) {
326
326
  oldNode.onUnmount && patch(oldNode.onUnmount(oldNode));
327
327
  oldNode.replaceWith(newNode);
@@ -336,7 +336,7 @@ function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
336
336
  if (newChildren) {
337
337
  for (let i = 0;i < newChildren.length; i++) {
338
338
  const child2 = newChildren[i];
339
- const attached = render(state, patch, newNode, i, undefined, child2, svg);
339
+ const attached = render(state, patch, newNode, i, undefined, child2, xmlns);
340
340
  newVode[properties ? i + 2 : i + 1] = attached;
341
341
  }
342
342
  }
@@ -344,7 +344,6 @@ function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
344
344
  return newVode;
345
345
  }
346
346
  if (!oldIsText && isNode && oldVode[0] === newVode[0]) {
347
- svg = svg || newVode[0] === "svg";
348
347
  newVode.node = oldNode;
349
348
  const newvode = newVode;
350
349
  const oldvode = oldVode;
@@ -354,12 +353,12 @@ function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
354
353
  newvode[1] = remember(state, newvode[1], oldvode[1]);
355
354
  if (prev !== newvode[1]) {
356
355
  const properties = props(newVode);
357
- patchProperties(patch, oldNode, props(oldVode), properties, svg);
356
+ patchProperties(patch, oldNode, props(oldVode), properties);
358
357
  hasProps = !!properties;
359
358
  }
360
359
  } else {
361
360
  const properties = props(newVode);
362
- patchProperties(patch, oldNode, props(oldVode), properties, svg);
361
+ patchProperties(patch, oldNode, props(oldVode), properties);
363
362
  hasProps = !!properties;
364
363
  }
365
364
  const newKids = children(newVode);
@@ -368,7 +367,7 @@ function render(state, patch, parent, childIndex, oldVode, newVode, svg) {
368
367
  for (let i = 0;i < newKids.length; i++) {
369
368
  const child2 = newKids[i];
370
369
  const oldChild = oldKids && oldKids[i];
371
- const attached = render(state, patch, oldNode, i, oldChild, child2, svg);
370
+ const attached = render(state, patch, oldNode, i, oldChild, child2, xmlns);
372
371
  if (attached) {
373
372
  newVode[hasProps ? i + 2 : i + 1] = attached;
374
373
  }
@@ -425,7 +424,7 @@ function unwrap(c, s) {
425
424
  return c;
426
425
  }
427
426
  }
428
- function patchProperties(patch, node, oldProps, newProps, isSvg) {
427
+ function patchProperties(patch, node, oldProps, newProps) {
429
428
  if (!newProps && !oldProps)
430
429
  return;
431
430
  if (oldProps) {
@@ -434,9 +433,9 @@ function patchProperties(patch, node, oldProps, newProps, isSvg) {
434
433
  const newValue = newProps?.[key];
435
434
  if (oldValue !== newValue) {
436
435
  if (newProps)
437
- newProps[key] = patchProperty(patch, node, key, oldValue, newValue, isSvg);
436
+ newProps[key] = patchProperty(patch, node, key, oldValue, newValue);
438
437
  else
439
- patchProperty(patch, node, key, oldValue, undefined, isSvg);
438
+ patchProperty(patch, node, key, oldValue, undefined);
440
439
  }
441
440
  }
442
441
  }
@@ -444,17 +443,17 @@ function patchProperties(patch, node, oldProps, newProps, isSvg) {
444
443
  for (const key in newProps) {
445
444
  if (!(key in oldProps)) {
446
445
  const newValue = newProps[key];
447
- newProps[key] = patchProperty(patch, node, key, undefined, newValue, isSvg);
446
+ newProps[key] = patchProperty(patch, node, key, undefined, newValue);
448
447
  }
449
448
  }
450
449
  } else if (newProps) {
451
450
  for (const key in newProps) {
452
451
  const newValue = newProps[key];
453
- newProps[key] = patchProperty(patch, node, key, undefined, newValue, isSvg);
452
+ newProps[key] = patchProperty(patch, node, key, undefined, newValue);
454
453
  }
455
454
  }
456
455
  }
457
- function patchProperty(patch, node, key, oldValue, newValue, isSvg) {
456
+ function patchProperty(patch, node, key, oldValue, newValue) {
458
457
  if (key === "style") {
459
458
  if (!newValue) {
460
459
  node.style.cssText = "";
@@ -475,20 +474,10 @@ function patchProperty(patch, node, key, oldValue, newValue, isSvg) {
475
474
  }
476
475
  }
477
476
  } else if (key === "class") {
478
- if (isSvg) {
479
- if (newValue) {
480
- const newClass = classString(newValue);
481
- node.classList.value = newClass;
482
- } else {
483
- node.classList.value = "";
484
- }
477
+ if (newValue) {
478
+ node.setAttribute("class", classString(newValue));
485
479
  } else {
486
- if (newValue) {
487
- const newClass = classString(newValue);
488
- node.className = newClass;
489
- } else {
490
- node.className = "";
491
- }
480
+ node.removeAttribute("class");
492
481
  }
493
482
  } else if (key[0] === "o" && key[1] === "n") {
494
483
  if (newValue) {
@@ -612,6 +601,7 @@ var RUBY = "ruby";
612
601
  var S = "s";
613
602
  var SAMP = "samp";
614
603
  var SCRIPT = "script";
604
+ var SEARCH = "search";
615
605
  var SECTION = "section";
616
606
  var SELECT = "select";
617
607
  var SLOT = "slot";
@@ -637,6 +627,7 @@ var TR = "tr";
637
627
  var TRACK = "track";
638
628
  var U = "u";
639
629
  var UL = "ul";
630
+ var VAR = "var";
640
631
  var VIDEO = "video";
641
632
  var WBR = "wbr";
642
633
  var ANIMATE = "animate";
@@ -745,6 +736,7 @@ export {
745
736
  WBR,
746
737
  VIEW,
747
738
  VIDEO,
739
+ VAR,
748
740
  USE,
749
741
  UL,
750
742
  U,
@@ -780,6 +772,7 @@ export {
780
772
  SEMANTICS,
781
773
  SELECT,
782
774
  SECTION,
775
+ SEARCH,
783
776
  SCRIPT,
784
777
  SAMP,
785
778
  S,
package/icon.webp ADDED
Binary file
package/logo.webp ADDED
Binary file
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@ryupold/vode",
3
- "version": "1.1.8",
4
- "description": "Small web framework for minimal websites",
3
+ "version": "1.2.0",
4
+ "description": "a minimalist web framework",
5
5
  "author": "Michael Scherbakow (ryupold)",
6
6
  "license": "MIT",
7
+ "icon": "icon.webp",
7
8
  "keywords": [
8
9
  "web",
9
10
  "frontend",
package/src/vode-tags.ts CHANGED
@@ -1,207 +1,208 @@
1
1
  import { Tag } from "./vode.js";
2
2
 
3
- //=== HTML ========================================================================================
4
- export const A: Tag = "a";
5
- export const ABBR: Tag = "abbr";
6
- export const ADDRESS: Tag = "address";
7
- export const AREA: Tag = "area";
8
- export const ARTICLE: Tag = "article";
9
- export const ASIDE: Tag = "aside";
10
- export const AUDIO: Tag = "audio";
11
- export const B: Tag = "b";
12
- export const BASE: Tag = "base";
13
- export const BDI: Tag = "bdi";
14
- export const BDO: Tag = "bdo";
15
- export const BLOCKQUOTE: Tag = "blockquote";
16
- export const BODY: Tag = "body";
17
- export const BR: Tag = "br";
18
- export const BUTTON: Tag = "button";
19
- export const CANVAS: Tag = "canvas";
20
- export const CAPTION: Tag = "caption";
21
- export const CITE: Tag = "cite";
22
- export const CODE: Tag = "code";
23
- export const COL: Tag = "col";
24
- export const COLGROUP: Tag = "colgroup";
25
- export const DATA: Tag = "data";
26
- export const DATALIST: Tag = "datalist";
27
- export const DD: Tag = "dd";
28
- export const DEL: Tag = "del";
29
- export const DETAILS: Tag = "details";
30
- export const DFN: Tag = "dfn";
31
- export const DIALOG: Tag = "dialog";
32
- export const DIV: Tag = "div";
33
- export const DL: Tag = "dl";
34
- export const DT: Tag = "dt";
35
- export const EM: Tag = "em";
36
- export const EMBED: Tag = "embed";
37
- export const FIELDSET: Tag = "fieldset";
38
- export const FIGCAPTION: Tag = "figcaption";
39
- export const FIGURE: Tag = "figure";
40
- export const FOOTER: Tag = "footer";
41
- export const FORM: Tag = "form";
42
- export const H1: Tag = "h1";
43
- export const H2: Tag = "h2";
44
- export const H3: Tag = "h3";
45
- export const H4: Tag = "h4";
46
- export const H5: Tag = "h5";
47
- export const H6: Tag = "h6";
48
- export const HEAD: Tag = "head";
49
- export const HEADER: Tag = "header";
50
- export const HGROUP: Tag = "hgroup";
51
- export const HR: Tag = "hr";
52
- export const HTML: Tag = "html";
53
- export const I: Tag = "i";
54
- export const IFRAME: Tag = "iframe";
55
- export const IMG: Tag = "img";
56
- export const INPUT: Tag = "input";
57
- export const INS: Tag = "ins";
58
- export const KBD: Tag = "kbd";
59
- export const LABEL: Tag = "label";
60
- export const LEGEND: Tag = "legend";
61
- export const LI: Tag = "li";
62
- export const LINK: Tag = "link";
63
- export const MAIN: Tag = "main";
64
- export const MAP: Tag = "map";
65
- export const MARK: Tag = "mark";
66
- export const MENU: Tag = "menu";
67
- export const META: Tag = "meta";
68
- export const METER: Tag = "meter";
69
- export const NAV: Tag = "nav";
70
- export const NOSCRIPT: Tag = "noscript";
71
- export const OBJECT: Tag = "object";
72
- export const OL: Tag = "ol";
73
- export const OPTGROUP: Tag = "optgroup";
74
- export const OPTION: Tag = "option";
75
- export const OUTPUT: Tag = "output";
76
- export const P: Tag = "p";
77
- export const PICTURE: Tag = "picture";
78
- export const PRE: Tag = "pre";
79
- export const PROGRESS: Tag = "progress";
80
- export const Q: Tag = "q";
81
- export const RP: Tag = "rp";
82
- export const RT: Tag = "rt";
83
- export const RUBY: Tag = "ruby";
84
- export const S: Tag = "s";
85
- export const SAMP: Tag = "samp";
86
- export const SCRIPT: Tag = "script";
87
- export const SECTION: Tag = "section";
88
- export const SELECT: Tag = "select";
89
- export const SLOT: Tag = "slot";
90
- export const SMALL: Tag = "small";
91
- export const SOURCE: Tag = "source";
92
- export const SPAN: Tag = "span";
93
- export const STRONG: Tag = "strong";
94
- export const STYLE: Tag = "style";
95
- export const SUB: Tag = "sub";
96
- export const SUMMARY: Tag = "summary";
97
- export const SUP: Tag = "sup";
98
- export const TABLE: Tag = "table";
99
- export const TBODY: Tag = "tbody";
100
- export const TD: Tag = "td";
101
- export const TEMPLATE: Tag = "template";
102
- export const TEXTAREA: Tag = "textarea";
103
- export const TFOOT: Tag = "tfoot";
104
- export const TH: Tag = "th";
105
- export const THEAD: Tag = "thead";
106
- export const TIME: Tag = "time";
107
- export const TITLE: Tag = "title";
108
- export const TR: Tag = "tr";
109
- export const TRACK: Tag = "track";
110
- export const U: Tag = "u";
111
- export const UL: Tag = "ul";
112
- export const VIDEO: Tag = "video";
113
- export const WBR: Tag = "wbr";
3
+ //=== HTML ====================================================
4
+ export const A: Tag = "a" as const;
5
+ export const ABBR: Tag = "abbr" as const;
6
+ export const ADDRESS: Tag = "address" as const;
7
+ export const AREA: Tag = "area" as const;
8
+ export const ARTICLE: Tag = "article" as const;
9
+ export const ASIDE: Tag = "aside" as const;
10
+ export const AUDIO: Tag = "audio" as const;
11
+ export const B: Tag = "b" as const;
12
+ export const BASE: Tag = "base" as const;
13
+ export const BDI: Tag = "bdi" as const;
14
+ export const BDO: Tag = "bdo" as const;
15
+ export const BLOCKQUOTE: Tag = "blockquote" as const;
16
+ export const BODY: Tag = "body" as const;
17
+ export const BR: Tag = "br" as const;
18
+ export const BUTTON: Tag = "button" as const;
19
+ export const CANVAS: Tag = "canvas" as const;
20
+ export const CAPTION: Tag = "caption" as const;
21
+ export const CITE: Tag = "cite" as const;
22
+ export const CODE: Tag = "code" as const;
23
+ export const COL: Tag = "col" as const;
24
+ export const COLGROUP: Tag = "colgroup" as const;
25
+ export const DATA: Tag = "data" as const;
26
+ export const DATALIST: Tag = "datalist" as const;
27
+ export const DD: Tag = "dd" as const;
28
+ export const DEL: Tag = "del" as const;
29
+ export const DETAILS: Tag = "details" as const;
30
+ export const DFN: Tag = "dfn" as const;
31
+ export const DIALOG: Tag = "dialog" as const;
32
+ export const DIV: Tag = "div" as const;
33
+ export const DL: Tag = "dl" as const;
34
+ export const DT: Tag = "dt" as const;
35
+ export const EM: Tag = "em" as const;
36
+ export const EMBED: Tag = "embed" as const;
37
+ export const FIELDSET: Tag = "fieldset" as const;
38
+ export const FIGCAPTION: Tag = "figcaption" as const;
39
+ export const FIGURE: Tag = "figure" as const;
40
+ export const FOOTER: Tag = "footer" as const;
41
+ export const FORM: Tag = "form" as const;
42
+ export const H1: Tag = "h1" as const;
43
+ export const H2: Tag = "h2" as const;
44
+ export const H3: Tag = "h3" as const;
45
+ export const H4: Tag = "h4" as const;
46
+ export const H5: Tag = "h5" as const;
47
+ export const H6: Tag = "h6" as const;
48
+ export const HEAD: Tag = "head" as const;
49
+ export const HEADER: Tag = "header" as const;
50
+ export const HGROUP: Tag = "hgroup" as const;
51
+ export const HR: Tag = "hr" as const;
52
+ export const HTML: Tag = "html" as const;
53
+ export const I: Tag = "i" as const;
54
+ export const IFRAME: Tag = "iframe" as const;
55
+ export const IMG: Tag = "img" as const;
56
+ export const INPUT: Tag = "input" as const;
57
+ export const INS: Tag = "ins" as const;
58
+ export const KBD: Tag = "kbd" as const;
59
+ export const LABEL: Tag = "label" as const;
60
+ export const LEGEND: Tag = "legend" as const;
61
+ export const LI: Tag = "li" as const;
62
+ export const LINK: Tag = "link" as const;
63
+ export const MAIN: Tag = "main" as const;
64
+ export const MAP: Tag = "map" as const;
65
+ export const MARK: Tag = "mark" as const;
66
+ export const MENU: Tag = "menu" as const;
67
+ export const META: Tag = "meta" as const;
68
+ export const METER: Tag = "meter" as const;
69
+ export const NAV: Tag = "nav" as const;
70
+ export const NOSCRIPT: Tag = "noscript" as const;
71
+ export const OBJECT: Tag = "object" as const;
72
+ export const OL: Tag = "ol" as const;
73
+ export const OPTGROUP: Tag = "optgroup" as const;
74
+ export const OPTION: Tag = "option" as const;
75
+ export const OUTPUT: Tag = "output" as const;
76
+ export const P: Tag = "p" as const;
77
+ export const PICTURE: Tag = "picture" as const;
78
+ export const PRE: Tag = "pre" as const;
79
+ export const PROGRESS: Tag = "progress" as const;
80
+ export const Q: Tag = "q" as const;
81
+ export const RP: Tag = "rp" as const;
82
+ export const RT: Tag = "rt" as const;
83
+ export const RUBY: Tag = "ruby" as const;
84
+ export const S: Tag = "s" as const;
85
+ export const SAMP: Tag = "samp" as const;
86
+ export const SCRIPT: Tag = "script" as const;
87
+ export const SEARCH: Tag = "search" as const;
88
+ export const SECTION: Tag = "section" as const;
89
+ export const SELECT: Tag = "select" as const;
90
+ export const SLOT: Tag = "slot" as const;
91
+ export const SMALL: Tag = "small" as const;
92
+ export const SOURCE: Tag = "source" as const;
93
+ export const SPAN: Tag = "span" as const;
94
+ export const STRONG: Tag = "strong" as const;
95
+ export const STYLE: Tag = "style" as const;
96
+ export const SUB: Tag = "sub" as const;
97
+ export const SUMMARY: Tag = "summary" as const;
98
+ export const SUP: Tag = "sup" as const;
99
+ export const TABLE: Tag = "table" as const;
100
+ export const TBODY: Tag = "tbody" as const;
101
+ export const TD: Tag = "td" as const;
102
+ export const TEMPLATE: Tag = "template" as const;
103
+ export const TEXTAREA: Tag = "textarea" as const;
104
+ export const TFOOT: Tag = "tfoot" as const;
105
+ export const TH: Tag = "th" as const;
106
+ export const THEAD: Tag = "thead" as const;
107
+ export const TIME: Tag = "time" as const;
108
+ export const TITLE: Tag = "title" as const;
109
+ export const TR: Tag = "tr" as const;
110
+ export const TRACK: Tag = "track" as const;
111
+ export const U: Tag = "u" as const;
112
+ export const UL: Tag = "ul" as const;
113
+ export const VAR: Tag = "var" as const;
114
+ export const VIDEO: Tag = "video" as const;
115
+ export const WBR: Tag = "wbr" as const;
114
116
 
115
- //=== SVG =========================================================================================
116
- export const ANIMATE: Tag = "animate";
117
- export const ANIMATEMOTION: Tag = "animateMotion";
118
- export const ANIMATETRANSFORM: Tag = "animateTransform";
119
- export const CIRCLE: Tag = "circle";
120
- export const CLIPPATH: Tag = "clipPath";
121
- export const DEFS: Tag = "defs";
122
- export const DESC: Tag = "desc";
123
- export const ELLIPSE: Tag = "ellipse";
124
- export const FEBLEND: Tag = "feBlend";
125
- export const FECOLORMATRIX: Tag = "feColorMatrix";
126
- export const FECOMPONENTTRANSFER: Tag = "feComponentTransfer";
127
- export const FECOMPOSITE: Tag = "feComposite";
128
- export const FECONVOLVEMATRIX: Tag = "feConvolveMatrix";
129
- export const FEDIFFUSELIGHTING: Tag = "feDiffuseLighting";
130
- export const FEDISPLACEMENTMAP: Tag = "feDisplacementMap";
131
- export const FEDISTANTLIGHT: Tag = "feDistantLight";
132
- export const FEDROPSHADOW: Tag = "feDropShadow";
133
- export const FEFLOOD: Tag = "feFlood";
134
- export const FEFUNCA: Tag = "feFuncA";
135
- export const FEFUNCB: Tag = "feFuncB";
136
- export const FEFUNCG: Tag = "feFuncG";
137
- export const FEFUNCR: Tag = "feFuncR";
138
- export const FEGAUSSIANBLUR: Tag = "feGaussianBlur";
139
- export const FEIMAGE: Tag = "feImage";
140
- export const FEMERGE: Tag = "feMerge";
141
- export const FEMERGENODE: Tag = "feMergeNode";
142
- export const FEMORPHOLOGY: Tag = "feMorphology";
143
- export const FEOFFSET: Tag = "feOffset";
144
- export const FEPOINTLIGHT: Tag = "fePointLight";
145
- export const FESPECULARLIGHTING: Tag = "feSpecularLighting";
146
- export const FESPOTLIGHT: Tag = "feSpotLight";
147
- export const FETILE: Tag = "feTile";
148
- export const FETURBULENCE: Tag = "feTurbulence";
149
- export const FILTER: Tag = "filter";
150
- export const FOREIGNOBJECT: Tag = "foreignObject";
151
- export const G: Tag = "g";
152
- export const IMAGE: Tag = "image";
153
- export const LINE: Tag = "line";
154
- export const LINEARGRADIENT: Tag = "linearGradient";
155
- export const MARKER: Tag = "marker";
156
- export const MASK: Tag = "mask";
157
- export const METADATA: Tag = "metadata";
158
- export const MPATH: Tag = "mpath";
159
- export const PATH: Tag = "path";
160
- export const PATTERN: Tag = "pattern";
161
- export const POLYGON: Tag = "polygon";
162
- export const POLYLINE: Tag = "polyline";
163
- export const RADIALGRADIENT: Tag = "radialGradient";
164
- export const RECT: Tag = "rect";
165
- export const SET: Tag = "set";
166
- export const STOP: Tag = "stop";
167
- export const SVG: Tag = "svg";
168
- export const SWITCH: Tag = "switch";
169
- export const SYMBOL: Tag = "symbol";
170
- export const TEXT: Tag = "text";
171
- export const TEXTPATH: Tag = "textPath";
172
- export const TSPAN: Tag = "tspan";
173
- export const USE: Tag = "use";
174
- export const VIEW: Tag = "view";
117
+ //=== SVG =====================================================
118
+ export const ANIMATE: Tag = "animate" as const;
119
+ export const ANIMATEMOTION: Tag = "animateMotion" as const;
120
+ export const ANIMATETRANSFORM: Tag = "animateTransform" as const;
121
+ export const CIRCLE: Tag = "circle" as const;
122
+ export const CLIPPATH: Tag = "clipPath" as const;
123
+ export const DEFS: Tag = "defs" as const;
124
+ export const DESC: Tag = "desc" as const;
125
+ export const ELLIPSE: Tag = "ellipse" as const;
126
+ export const FEBLEND: Tag = "feBlend" as const;
127
+ export const FECOLORMATRIX: Tag = "feColorMatrix" as const;
128
+ export const FECOMPONENTTRANSFER: Tag = "feComponentTransfer" as const;
129
+ export const FECOMPOSITE: Tag = "feComposite" as const;
130
+ export const FECONVOLVEMATRIX: Tag = "feConvolveMatrix" as const;
131
+ export const FEDIFFUSELIGHTING: Tag = "feDiffuseLighting" as const;
132
+ export const FEDISPLACEMENTMAP: Tag = "feDisplacementMap" as const;
133
+ export const FEDISTANTLIGHT: Tag = "feDistantLight" as const;
134
+ export const FEDROPSHADOW: Tag = "feDropShadow" as const;
135
+ export const FEFLOOD: Tag = "feFlood" as const;
136
+ export const FEFUNCA: Tag = "feFuncA" as const;
137
+ export const FEFUNCB: Tag = "feFuncB" as const;
138
+ export const FEFUNCG: Tag = "feFuncG" as const;
139
+ export const FEFUNCR: Tag = "feFuncR" as const;
140
+ export const FEGAUSSIANBLUR: Tag = "feGaussianBlur" as const;
141
+ export const FEIMAGE: Tag = "feImage" as const;
142
+ export const FEMERGE: Tag = "feMerge" as const;
143
+ export const FEMERGENODE: Tag = "feMergeNode" as const;
144
+ export const FEMORPHOLOGY: Tag = "feMorphology" as const;
145
+ export const FEOFFSET: Tag = "feOffset" as const;
146
+ export const FEPOINTLIGHT: Tag = "fePointLight" as const;
147
+ export const FESPECULARLIGHTING: Tag = "feSpecularLighting" as const;
148
+ export const FESPOTLIGHT: Tag = "feSpotLight" as const;
149
+ export const FETILE: Tag = "feTile" as const;
150
+ export const FETURBULENCE: Tag = "feTurbulence" as const;
151
+ export const FILTER: Tag = "filter" as const;
152
+ export const FOREIGNOBJECT: Tag = "foreignObject" as const;
153
+ export const G: Tag = "g" as const;
154
+ export const IMAGE: Tag = "image" as const;
155
+ export const LINE: Tag = "line" as const;
156
+ export const LINEARGRADIENT: Tag = "linearGradient" as const;
157
+ export const MARKER: Tag = "marker" as const;
158
+ export const MASK: Tag = "mask" as const;
159
+ export const METADATA: Tag = "metadata" as const;
160
+ export const MPATH: Tag = "mpath" as const;
161
+ export const PATH: Tag = "path" as const;
162
+ export const PATTERN: Tag = "pattern" as const;
163
+ export const POLYGON: Tag = "polygon" as const;
164
+ export const POLYLINE: Tag = "polyline" as const;
165
+ export const RADIALGRADIENT: Tag = "radialGradient" as const;
166
+ export const RECT: Tag = "rect" as const;
167
+ export const SET: Tag = "set" as const;
168
+ export const STOP: Tag = "stop" as const;
169
+ export const SVG: Tag = "svg" as const;
170
+ export const SWITCH: Tag = "switch" as const;
171
+ export const SYMBOL: Tag = "symbol" as const;
172
+ export const TEXT: Tag = "text" as const;
173
+ export const TEXTPATH: Tag = "textPath" as const;
174
+ export const TSPAN: Tag = "tspan" as const;
175
+ export const USE: Tag = "use" as const;
176
+ export const VIEW: Tag = "view" as const;
175
177
 
176
- //=== MathML ======================================================================================
177
-
178
- export const ANNOTATION: Tag = "annotation";
179
- export const ANNOTATION_XML: Tag = "annotation-xml";
180
- export const MACTION: Tag = "maction";
181
- export const MATH: Tag = "math";
182
- export const MERROR: Tag = "merror";
183
- export const MFRAC: Tag = "mfrac";
184
- export const MI: Tag = "mi";
185
- export const MMULTISCRIPTS: Tag = "mmultiscripts";
186
- export const MN: Tag = "mn";
187
- export const MO: Tag = "mo";
188
- export const MOVER: Tag = "mover";
189
- export const MPADDED: Tag = "mpadded";
190
- export const MPHANTOM: Tag = "mphantom";
191
- export const MPRESCRIPTS: Tag = "mprescripts";
192
- export const MROOT: Tag = "mroot";
193
- export const MROW: Tag = "mrow";
194
- export const MS: Tag = "ms";
195
- export const MSPACE: Tag = "mspace";
196
- export const MSQRT: Tag = "msqrt";
197
- export const MSTYLE: Tag = "mstyle";
198
- export const MSUB: Tag = "msub";
199
- export const MSUBSUP: Tag = "msubsup";
200
- export const MSUP: Tag = "msup";
201
- export const MTABLE: Tag = "mtable";
202
- export const MTD: Tag = "mtd";
203
- export const MTEXT: Tag = "mtext";
204
- export const MTR: Tag = "mtr";
205
- export const MUNDER: Tag = "munder";
206
- export const MUNDEROVER: Tag = "munderover";
207
- export const SEMANTICS: Tag = "semantics";
178
+ //=== MathML ==================================================
179
+ export const ANNOTATION: Tag = "annotation" as const;
180
+ export const ANNOTATION_XML: Tag = "annotation-xml" as const;
181
+ export const MACTION: Tag = "maction" as const;
182
+ export const MATH: Tag = "math" as const;
183
+ export const MERROR: Tag = "merror" as const;
184
+ export const MFRAC: Tag = "mfrac" as const;
185
+ export const MI: Tag = "mi" as const;
186
+ export const MMULTISCRIPTS: Tag = "mmultiscripts" as const;
187
+ export const MN: Tag = "mn" as const;
188
+ export const MO: Tag = "mo" as const;
189
+ export const MOVER: Tag = "mover" as const;
190
+ export const MPADDED: Tag = "mpadded" as const;
191
+ export const MPHANTOM: Tag = "mphantom" as const;
192
+ export const MPRESCRIPTS: Tag = "mprescripts" as const;
193
+ export const MROOT: Tag = "mroot" as const;
194
+ export const MROW: Tag = "mrow" as const;
195
+ export const MS: Tag = "ms" as const;
196
+ export const MSPACE: Tag = "mspace" as const;
197
+ export const MSQRT: Tag = "msqrt" as const;
198
+ export const MSTYLE: Tag = "mstyle" as const;
199
+ export const MSUB: Tag = "msub" as const;
200
+ export const MSUBSUP: Tag = "msubsup" as const;
201
+ export const MSUP: Tag = "msup" as const;
202
+ export const MTABLE: Tag = "mtable" as const;
203
+ export const MTD: Tag = "mtd" as const;
204
+ export const MTEXT: Tag = "mtext" as const;
205
+ export const MTR: Tag = "mtr" as const;
206
+ export const MUNDER: Tag = "munder" as const;
207
+ export const MUNDEROVER: Tag = "munderover" as const;
208
+ export const SEMANTICS: Tag = "semantics" as const;
package/src/vode.ts CHANGED
@@ -265,17 +265,17 @@ export function hydrate<S = unknown>(element: Element | Text, prepareForRender?:
265
265
  * `compare` of the previous render. otherwise skips the render step (not calling `componentOrProps`)*/
266
266
  export function memo<S>(compare: any[], componentOrProps: Component<S> | ((s: S) => Props<S>)): typeof componentOrProps extends ((s: S) => Props<S>) ? ((s: S) => Props<S>) : Component<S> {
267
267
  if (!compare || !Array.isArray(compare)) throw new Error("first argument to memo() must be an array of values to compare");
268
- if(typeof componentOrProps !== "function") throw new Error("second argument to memo() must be a function that returns a vode or props object");
268
+ if (typeof componentOrProps !== "function") throw new Error("second argument to memo() must be a function that returns a vode or props object");
269
269
 
270
270
  (<any>componentOrProps).__memo = compare;
271
271
  return componentOrProps as typeof componentOrProps extends ((s: S) => Props<S>) ? ((s: S) => Props<S>) : Component<S>;
272
272
  }
273
273
 
274
274
  /** create a state object used as state for `app()`. it is updated with `PatchableState.patch()` using `merge()` */
275
- export function createState<S extends object | unknown>(state: S): PatchableState<S> {
275
+ export function createState<S extends object | unknown>(state: S): PatchableState<S> {
276
276
  if (!state || typeof state !== "object") throw new Error("createState() must be called with a state object");
277
277
 
278
- return state as PatchableState<S>;
278
+ return state as PatchableState<S>;
279
279
  }
280
280
 
281
281
  /** type safe way to create a patch. useful for type inference and autocompletion. */
@@ -414,7 +414,7 @@ function mergeState(target: any, source: any, allowDeletion: boolean) {
414
414
  return target;
415
415
  };
416
416
 
417
- function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: number, oldVode: AttachedVode<S> | undefined, newVode: ChildVode<S>, svg?: boolean): AttachedVode<S> | undefined {
417
+ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: number, oldVode: AttachedVode<S> | undefined, newVode: ChildVode<S>, xmlns?: string): AttachedVode<S> | undefined {
418
418
  // unwrap component if it is memoized
419
419
  newVode = remember(state, newVode, oldVode) as ChildVode<S>;
420
420
 
@@ -473,20 +473,21 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
473
473
  // falsy|text|element(A) -> element(B)
474
474
  if (
475
475
  (isNode && (!oldNode || oldIsText || (<Vode<S>>oldVode)[0] !== (<Vode<S>>newVode)[0]))
476
- ) {
477
- svg = svg || (<Vode<S>>newVode)[0] === "svg";
478
- const newNode: ChildNode = svg
479
- ? document.createElementNS("http://www.w3.org/2000/svg", (<Vode<S>>newVode)[0])
480
- : document.createElement((<Vode<S>>newVode)[0]);
481
- (<AttachedVode<S>>newVode).node = newNode;
482
-
476
+ ) {
483
477
  const newvode = <Vode<S>>newVode;
484
478
  if (1 in newvode) {
485
479
  newvode[1] = remember(state, newvode[1], undefined) as Vode<S>;
486
480
  }
487
-
481
+
488
482
  const properties = props(newVode);
489
- patchProperties(patch, newNode, undefined, properties, svg);
483
+
484
+ xmlns = properties?.xmlns as string || xmlns;
485
+ const newNode: ChildNode = xmlns
486
+ ? document.createElementNS(xmlns, (<Vode<S>>newVode)[0])
487
+ : document.createElement((<Vode<S>>newVode)[0]);
488
+ (<AttachedVode<S>>newVode).node = newNode;
489
+
490
+ patchProperties(patch, newNode, undefined, properties);
490
491
 
491
492
  if (oldNode) {
492
493
  (<any>oldNode).onUnmount && patch((<any>oldNode).onUnmount(oldNode));
@@ -503,7 +504,7 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
503
504
  if (newChildren) {
504
505
  for (let i = 0; i < newChildren.length; i++) {
505
506
  const child = newChildren[i];
506
- const attached = render(state, patch, newNode as Element, i, undefined, child, svg);
507
+ const attached = render(state, patch, newNode as Element, i, undefined, child, xmlns);
507
508
  (<Vode<S>>newVode!)[properties ? i + 2 : i + 1] = <Vode<S>>attached;
508
509
  }
509
510
  }
@@ -514,7 +515,6 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
514
515
 
515
516
  //element(A) -> element(A)
516
517
  if (!oldIsText && isNode && (<Vode<S>>oldVode)[0] === (<Vode<S>>newVode)[0]) {
517
- svg = svg || (<Vode<S>>newVode)[0] === "svg";
518
518
  (<AttachedVode<S>>newVode).node = oldNode;
519
519
 
520
520
  const newvode = <Vode<S>>newVode;
@@ -526,13 +526,13 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
526
526
  newvode[1] = remember(state, newvode[1], oldvode[1]) as Vode<S>;
527
527
  if (prev !== newvode[1]) {
528
528
  const properties = props(newVode);
529
- patchProperties(patch, oldNode!, props(oldVode), properties, svg);
529
+ patchProperties(patch, oldNode!, props(oldVode), properties);
530
530
  hasProps = !!properties;
531
531
  }
532
532
  }
533
533
  else {
534
534
  const properties = props(newVode);
535
- patchProperties(patch, oldNode!, props(oldVode), properties, svg);
535
+ patchProperties(patch, oldNode!, props(oldVode), properties);
536
536
  hasProps = !!properties;
537
537
  }
538
538
 
@@ -543,7 +543,7 @@ function render<S>(state: S, patch: Dispatch<S>, parent: Element, childIndex: nu
543
543
  const child = newKids[i];
544
544
  const oldChild = oldKids && oldKids[i];
545
545
 
546
- const attached = render(state, patch, oldNode as Element, i, oldChild, child, svg);
546
+ const attached = render(state, patch, oldNode as Element, i, oldChild, child, xmlns);
547
547
  if (attached) {
548
548
  (<Vode<S>>newVode)[hasProps ? i + 2 : i + 1] = <Vode<S>>attached;
549
549
  }
@@ -611,7 +611,7 @@ function unwrap<S>(c: Component<S> | ChildVode<S>, s: S): ChildVode<S> {
611
611
  }
612
612
  }
613
613
 
614
- function patchProperties<S>(patch: Dispatch<S>, node: ChildNode, oldProps?: Props<S>, newProps?: Props<S>, isSvg?: boolean) {
614
+ function patchProperties<S>(patch: Dispatch<S>, node: ChildNode, oldProps?: Props<S>, newProps?: Props<S>) {
615
615
  if (!newProps && !oldProps) return;
616
616
 
617
617
  // match existing properties
@@ -621,8 +621,8 @@ function patchProperties<S>(patch: Dispatch<S>, node: ChildNode, oldProps?: Prop
621
621
  const newValue = newProps?.[key as keyof Props<S>] as PropertyValue<S>;
622
622
 
623
623
  if (oldValue !== newValue) {
624
- if (newProps) newProps[key as keyof Props<S>] = patchProperty(patch, node, key, oldValue, newValue, isSvg);
625
- else patchProperty(patch, node, key, oldValue, undefined, isSvg);
624
+ if (newProps) newProps[key as keyof Props<S>] = patchProperty(patch, node, key, oldValue, newValue);
625
+ else patchProperty(patch, node, key, oldValue, undefined);
626
626
  }
627
627
  }
628
628
  }
@@ -632,7 +632,7 @@ function patchProperties<S>(patch: Dispatch<S>, node: ChildNode, oldProps?: Prop
632
632
  for (const key in newProps) {
633
633
  if (!(key in oldProps)) {
634
634
  const newValue = newProps[key as keyof Props<S>] as PropertyValue<S>;
635
- newProps[key as keyof Props<S>] = patchProperty(patch, <Element>node, key, undefined, newValue, isSvg);
635
+ newProps[key as keyof Props<S>] = patchProperty(patch, <Element>node, key, undefined, newValue);
636
636
  }
637
637
  }
638
638
  }
@@ -640,12 +640,12 @@ function patchProperties<S>(patch: Dispatch<S>, node: ChildNode, oldProps?: Prop
640
640
  else if (newProps) {
641
641
  for (const key in newProps) {
642
642
  const newValue = newProps[key as keyof Props<S>] as PropertyValue<S>;
643
- newProps[key as keyof Props<S>] = patchProperty(patch, <Element>node, key, undefined, newValue, isSvg);
643
+ newProps[key as keyof Props<S>] = patchProperty(patch, <Element>node, key, undefined, newValue);
644
644
  }
645
645
  }
646
646
  }
647
647
 
648
- function patchProperty<S>(patch: Dispatch<S>, node: ChildNode, key: string | keyof ElementEventMap, oldValue?: PropertyValue<S>, newValue?: PropertyValue<S>, isSvg?: boolean) {
648
+ function patchProperty<S>(patch: Dispatch<S>, node: ChildNode, key: string | keyof ElementEventMap, oldValue?: PropertyValue<S>, newValue?: PropertyValue<S>) {
649
649
  if (key === "style") {
650
650
  if (!newValue) {
651
651
  (node as HTMLElement).style.cssText = "";
@@ -666,20 +666,10 @@ function patchProperty<S>(patch: Dispatch<S>, node: ChildNode, key: string | key
666
666
  }
667
667
  }
668
668
  } else if (key === "class") {
669
- if (isSvg) {
670
- if (newValue) {
671
- const newClass = classString(newValue as ClassProp);
672
- (<SVGSVGElement>node).classList.value = newClass;
673
- } else {
674
- (<SVGSVGElement>node).classList.value = '';
675
- }
669
+ if (newValue) {
670
+ (<HTMLElement>node).setAttribute("class", classString(newValue as ClassProp));
676
671
  } else {
677
- if (newValue) {
678
- const newClass = classString(newValue as ClassProp);
679
- (<HTMLElement>node).className = newClass;
680
- } else {
681
- (<HTMLElement>node).className = '';
682
- }
672
+ (<HTMLElement>node).removeAttribute("class");
683
673
  }
684
674
  } else if (key[0] === "o" && key[1] === "n") {
685
675
  if (newValue) {
@@ -721,5 +711,5 @@ function classString(classProp: ClassProp): string {
721
711
  else if (typeof classProp === "object")
722
712
  return Object.keys(classProp!).filter(k => classProp![k]).join(" ");
723
713
  else
724
- return "";
714
+ return '';
725
715
  }
package/icon.svg DELETED
@@ -1,33 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10">
2
- <style>
3
- text {
4
- font-weight: 600;
5
- font-family: "Courier New", Courier, monospace;
6
- fill: #2d3748;
7
- dominant-baseline: central;
8
- text-anchor: middle;
9
- text-rendering: geometricPrecision;
10
- stroke: #d2c8b7;
11
- paint-order: stroke;
12
- stroke-width: 1%;
13
- }
14
-
15
- .tag {
16
- font-size: 60%;
17
- }
18
-
19
- .braces {
20
- font-size: 75%;
21
- font-weight: 600;
22
- }
23
- </style>
24
-
25
- <!-- Opening bracket -->
26
- <text x="7%" y="48%" class="braces">[</text>
27
-
28
- <!-- V -->
29
- <text x="50%" y="55%" class="tag">V</text>
30
-
31
- <!-- Closing bracket -->
32
- <text x="93%" y="48%" class="braces">]</text>
33
- </svg>
package/logo.svg DELETED
@@ -1,57 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 35">
2
- <style>
3
- text {
4
- font-weight: 600;
5
- font-family: "Courier New", Courier, monospace;
6
- fill: #2d3748;
7
- stroke: #d2c8b7;
8
- dominant-baseline: central;
9
- text-anchor: middle;
10
- text-rendering: geometricPrecision;
11
- paint-order: stroke;
12
- stroke-width: 1%;
13
- }
14
-
15
- .tag {
16
- font-size: 200%;
17
- }
18
-
19
- .props {
20
- font-size: 135%;
21
- }
22
-
23
- .child {
24
- font-size: 150%;
25
- }
26
-
27
- .braces {
28
- font-size: 250%;
29
- }
30
-
31
- .comma-text {
32
- font-size: 80%;
33
- }
34
- </style>
35
-
36
- <!-- Opening bracket -->
37
- <text x="3%" y="47%" class="braces">[</text>
38
-
39
- <!-- V -->
40
- <text x="18%" y="53%" class="tag">V</text>
41
- <text x="24%" y="65%" class="comma-text">,</text>
42
-
43
- <!-- {} -->
44
- <text x="36%" y="51%" class="props">{</text>
45
- <text x="47%" y="51%" class="props">}</text>
46
- <text x="51.5%" y="65%" class="comma-text">,</text>
47
-
48
- <!-- d -->
49
- <text x="64%" y="58%" class="child">d</text>
50
- <text x="75%" y="65%" class="comma-text">,</text>
51
-
52
- <!-- e -->
53
- <text x="86.5%" y="58%" class="child">e</text>
54
-
55
- <!-- Closing bracket -->
56
- <text x="97%" y="47%" class="braces">]</text>
57
- </svg>