@ryupold/vode 1.3.5 → 1.4.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.
@@ -8,6 +8,8 @@ on:
8
8
 
9
9
  permissions:
10
10
  id-token: write # Required for OIDC
11
+ packages: write
12
+ attestations: write
11
13
  contents: read
12
14
 
13
15
  jobs:
@@ -22,9 +24,9 @@ jobs:
22
24
  - run: npm ci
23
25
  - run: bun run release
24
26
  - run: |
25
- (npm publish --access public 2> /dev/null) | grep "📦 @ryupold/vode@" > version.txt || echo "...failed to publish"
27
+ ((npm publish --provenance --access public 2> /dev/null) | grep "@ryupold/vode@" > version.txt) || echo "...done"
26
28
  NEWVERSION=$(cat version.txt)
27
- if [[ $NEWVERSION == *"vode"* ]]; then
29
+ if [[ $NEWVERSION == *"npm error 409 Conflict"* || $NEWVERSION == *"@ryupold/vode@"* ]]; then
28
30
  echo "...success: $NEWVERSION"
29
31
  else
30
32
  echo "...failed to publish"
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ![vode-logo](./logo.webp)
1
+ # ![vode-logo](https://raw.githubusercontent.com/ryupold/vode/refs/heads/main/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)
@@ -8,7 +8,8 @@
8
8
 
9
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 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.
11
+ It brings a primitive building block to the table that gives flexibility in composition and makes refactoring easy.
12
+ The use cases can be single page applications or isolated components with complex state.
12
13
 
13
14
  ## Usage
14
15
 
@@ -131,7 +132,9 @@ app<State>(appNode, state,
131
132
  );
132
133
  ```
133
134
 
134
- ## vode
135
+ ## `[V,{},d,e]`
136
+
137
+ Lets describe UI as data structures that map 1:1 to DOM elements.
135
138
 
136
139
  A `vode` is a representation of a virtual DOM node, which is a tree structure of HTML elements. It is written as tuple:
137
140
 
@@ -172,7 +175,8 @@ Imagine this HTML:
172
175
  </div>
173
176
 
174
177
  <div class="content">
175
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. <a href="?post=vode">vode</a>. <a href="#">#css</a>
178
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit.
179
+ <a href="?post=vode">vode</a>. <a href="#">#css</a>
176
180
  <a href="#">#responsive</a>
177
181
  <br />
178
182
  <time datetime="2025-09-24">10:09 PM - 24 Sep 2025</time>
@@ -181,9 +185,9 @@ Imagine this HTML:
181
185
  </div>
182
186
  ```
183
187
 
184
- expressed as **"vode"** it would look like this:
188
+ expressed as *vode* it would look like this:
185
189
 
186
- ```javascript
190
+ ```typescript
187
191
  [DIV, { class: 'card' },
188
192
  [DIV, { class: 'card-image' },
189
193
  [FIGURE, { class: 'image is-4by3' },
@@ -219,17 +223,18 @@ expressed as **"vode"** it would look like this:
219
223
  ]
220
224
  ```
221
225
 
222
- Viewed alone it does not provide an obvious benefit (apart from looking better imho),
226
+ Viewed in isolation, it does not provide an obvious benefit (apart from looking better imho),
223
227
  but as the result of a function of state, it can become very useful to express conditional UI this way.
224
228
 
225
- ### Component
229
+ ### component
230
+
226
231
  ```typescript
227
232
  type Component<S> = (s: S) => ChildVode<S>;
228
233
  ```
229
234
 
230
- A `Component<State>` is a function that takes a state object and returns a `Vode<State>`.
235
+ A `Component<State>` is a function that takes a state object and returns a `Vode<State>` or `string`.
231
236
  It is used to render the UI based on the current state.
232
- A new **vode** must be created on each render, otherwise it would be skipped which could lead to unexpected results. If you seek to improve render performance have a look at the [`memo`](#memoization) function.
237
+ A new *vode* must be created on each render, otherwise it would be skipped which could lead to unexpected results. If you seek to improve render performance, have a look at the [`memo`](#memoization) function.
233
238
 
234
239
  ```typescript
235
240
  // A full vode has a tag, properties, and children. props and children are optional.
@@ -295,7 +300,7 @@ const CompBar = (s) => [DIV, { class: "container" },
295
300
  return { loading: false };
296
301
  },
297
302
 
298
- // events can be attached condionally
303
+ // events can be attached conditionally
299
304
  ondblclick : s.counter > 20 && (s, evt) => {
300
305
  return { counter: s.counter * 2 };
301
306
  },
@@ -335,16 +340,32 @@ const patch = app(
335
340
  );
336
341
  ```
337
342
 
338
- It will analyse the current structure of the given `containerNode` and adjust its structure in the first render.
343
+ It will analyze the current structure of the given `ContainerNode` and adjust its structure in the first render.
339
344
  When render-patches are applied to the `patch` function or via yield/return of events,
340
- the `containerNode` is updated to match the vode structure 1:1.
345
+ the `ContainerNode` is updated to match the vode structure 1:1.
346
+
347
+ #### defuse
348
+
349
+ To release resources associated with the vode app instance, you can call the `defuse` function on the `ContainerNode` that was passed to `app`.
350
+
351
+ ```typescript
352
+ import { app, defuse } from '@ryupold/vode';
353
+ const containerNode = document.getElementById('ANY-ELEMENT');
354
+ const state = { /* ... */ };
355
+ app(containerNode, state, s => /* ... */ );
356
+ //... later ...
357
+ // when you want to clean up the vode app instance
358
+ defuse(containerNode);
359
+ ```
360
+
361
+ The DOM elements created by the vode app will remain in the `ContainerNode`, but all event listeners and references to the state object will be removed, allowing for proper garbage collection.
341
362
 
342
363
  ### state & patch
343
364
  The state object you pass to [`app`](#app) can be updated directly or via `patch`.
344
365
  During the call to `app`, the state object is bound to the vode app instance and becomes a singleton from its perspective.
345
366
  Also a `patch` function is added to the state object; it is the same function that is also returned by `app`.
346
367
  A re-render happens when a patch object is supplied to the `patch` function or via event.
347
- When an object is passed to `patch`, its properties are incrementally deep merged onto the state object.
368
+ When an object is passed to `patch`, its properties are recursively deep merged onto the state object.
348
369
 
349
370
  ```js
350
371
  const s = {
@@ -397,7 +418,7 @@ const ComponentEwww = (s) => {
397
418
  if(!s.isLoading)
398
419
  s.patch(() => startLoading());
399
420
 
400
- return [DIV, s.loading ? [PROGRESS] : s.title];
421
+ return [DIV, s.isLoading ? [PROGRESS] : s.title];
401
422
  }
402
423
 
403
424
  // ✨ experimental view transitions support ✨
@@ -426,7 +447,7 @@ const CompMemoList = (s) =>
426
447
 
427
448
  // expensive component to render
428
449
  memo(
429
- // this array is shallow compared to the previous render
450
+ // dependency array is shallow compared (using === operator) to the previous renders' memo dependencies
430
451
  [s.title, s.body],
431
452
  // this is the component function that will be
432
453
  // called only when the array changes
@@ -453,17 +474,19 @@ const CompMemoProps = (s) => [DIV,
453
474
  ];
454
475
  ```
455
476
 
477
+ ### defuse
478
+
456
479
  ### helper functions
457
480
 
458
- The library provides some helper functions to help with certain situations.
481
+ The library provides some helper functions for common tasks.
459
482
 
460
483
  ```typescript
461
484
  import { tag, props, children, mergeClass, hydrate } from '@ryupold/vode';
462
485
 
463
486
  // Merge class props intelligently
464
- mergeClass('foo', ['baz', 'bar']); // -> 'foo bar baz'
487
+ mergeClass('foo', ['baz', 'bar']); // -> 'foo baz bar'
465
488
  mergeClass(['foo'], { bar: true, baz: false }); // -> 'foo bar'
466
- mergeClass({zig: true, zag: false}, 'foo', ['baz', 'bar']); // -> 'zig foo bar baz'
489
+ mergeClass({zig: true, zag: false}, 'foo', ['baz', 'bar']); // -> 'zig foo baz bar'
467
490
 
468
491
  const myVode = [DIV, { class: 'foo' }, [SPAN, 'hello'], [STRONG, 'world']];
469
492
 
@@ -651,7 +674,7 @@ console.log(appNode._vode.stats);
651
674
 
652
675
  The library is optimized for small to medium sized applications. In my own tests it could easily handle sites with tens of thousands of elements. Smart usage of `memo` can help to optimize performance further. You can find a comparison of the performance with other libraries [here](https://krausest.github.io/js-framework-benchmark/current.html).
653
676
 
654
- This being said, the library does not focus on performance. It is designed to feel nice while coding, by providing a primitive that is simple to bent & form. I want the mental model to be easy to grasp and the API surface to be small so that a developer can focus on building a web application instead of learning the framework and get to a flow state as quick as possible.
677
+ This being said, the library does not focus on performance. It is designed to feel nice while coding, by providing a primitive that is simple to bend & form. I want the mental model to be easy to grasp and the API surface to be small so that a developer can focus on building a web application instead of learning the framework and get to a flow state as quick as possible.
655
678
 
656
679
  ## Thanks
657
680
 
package/dist/vode.js CHANGED
@@ -231,6 +231,7 @@ var V = (() => {
231
231
  childrenStart: () => childrenStart,
232
232
  createPatch: () => createPatch,
233
233
  createState: () => createState,
234
+ defuse: () => defuse,
234
235
  globals: () => globals,
235
236
  hydrate: () => hydrate,
236
237
  memo: () => memo,
@@ -303,7 +304,10 @@ var V = (() => {
303
304
  } else {
304
305
  _vode.qSync = mergeState(_vode.qSync || {}, _vode.qAsync, false);
305
306
  _vode.qAsync = null;
306
- globals.currentViewTransition?.skipTransition();
307
+ try {
308
+ globals.currentViewTransition?.skipTransition();
309
+ } catch {
310
+ }
307
311
  _vode.stats.syncRenderPatchCount++;
308
312
  _vode.renderSync();
309
313
  }
@@ -391,6 +395,36 @@ var V = (() => {
391
395
  }
392
396
  return _vode.patch;
393
397
  }
398
+ function defuse(container) {
399
+ if (container?._vode) {
400
+ let clearEvents2 = function(av) {
401
+ if (!av?.node) return;
402
+ const p = props(av);
403
+ if (p) {
404
+ for (const key in p) {
405
+ if (key[0] === "o" && key[1] === "n") {
406
+ av.node[key] = null;
407
+ }
408
+ }
409
+ }
410
+ const kids = children(av);
411
+ if (kids) {
412
+ for (let child2 of kids) {
413
+ clearEvents2(child2);
414
+ }
415
+ }
416
+ };
417
+ var clearEvents = clearEvents2;
418
+ const v = container._vode;
419
+ delete container["_vode"];
420
+ Object.defineProperty(v.state, "patch", { value: void 0 });
421
+ Object.defineProperty(v, "renderSync", { value: () => {
422
+ } });
423
+ Object.defineProperty(v, "renderAsync", { value: () => {
424
+ } });
425
+ clearEvents2(v.vode);
426
+ }
427
+ }
394
428
  function hydrate(element, prepareForRender) {
395
429
  if (element?.nodeType === Node.TEXT_NODE) {
396
430
  if (element.nodeValue?.trim() !== "")
package/dist/vode.min.js CHANGED
@@ -1 +1 @@
1
- "use strict";var V=(()=>{var N=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var G=(e,n)=>{for(var a in n)N(e,a,{get:n[a],enumerable:!0})},K=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of j(n))!U.call(e,t)&&t!==a&&N(e,t,{get:()=>n[t],enumerable:!(s=H(n,t))||s.enumerable});return e};var B=e=>K(N({},"__esModule",{value:!0}),e);var Kn={};G(Kn,{A:()=>Z,ABBR:()=>tt,ADDRESS:()=>et,ANIMATE:()=>no,ANIMATEMOTION:()=>so,ANIMATETRANSFORM:()=>ao,ANNOTATION:()=>ln,ANNOTATION_XML:()=>Sn,AREA:()=>ot,ARTICLE:()=>nt,ASIDE:()=>st,AUDIO:()=>at,B:()=>rt,BASE:()=>ct,BDI:()=>it,BDO:()=>pt,BLOCKQUOTE:()=>lt,BODY:()=>St,BR:()=>ft,BUTTON:()=>Tt,CANVAS:()=>ut,CAPTION:()=>dt,CIRCLE:()=>ro,CITE:()=>yt,CLIPPATH:()=>co,CODE:()=>gt,COL:()=>xt,COLGROUP:()=>ht,DATA:()=>mt,DATALIST:()=>Et,DD:()=>bt,DEFS:()=>io,DEL:()=>Pt,DESC:()=>po,DETAILS:()=>At,DFN:()=>Ct,DIALOG:()=>Mt,DIV:()=>Nt,DL:()=>Rt,DT:()=>Ot,DelegateStateContext:()=>v,ELLIPSE:()=>lo,EM:()=>Dt,EMBED:()=>Lt,FEBLEND:()=>So,FECOLORMATRIX:()=>fo,FECOMPONENTTRANSFER:()=>To,FECOMPOSITE:()=>uo,FECONVOLVEMATRIX:()=>yo,FEDIFFUSELIGHTING:()=>go,FEDISPLACEMENTMAP:()=>xo,FEDISTANTLIGHT:()=>ho,FEDROPSHADOW:()=>mo,FEFLOOD:()=>Eo,FEFUNCA:()=>bo,FEFUNCB:()=>Po,FEFUNCG:()=>Ao,FEFUNCR:()=>Co,FEGAUSSIANBLUR:()=>Mo,FEIMAGE:()=>No,FEMERGE:()=>Ro,FEMERGENODE:()=>Oo,FEMORPHOLOGY:()=>Do,FEOFFSET:()=>Lo,FEPOINTLIGHT:()=>vo,FESPECULARLIGHTING:()=>Io,FESPOTLIGHT:()=>Fo,FETILE:()=>Vo,FETURBULENCE:()=>ko,FIELDSET:()=>vt,FIGCAPTION:()=>It,FIGURE:()=>Ft,FILTER:()=>Ho,FOOTER:()=>Vt,FOREIGNOBJECT:()=>jo,FORM:()=>kt,G:()=>Uo,H1:()=>Ht,H2:()=>jt,H3:()=>Ut,H4:()=>Gt,H5:()=>Kt,H6:()=>Bt,HEAD:()=>qt,HEADER:()=>_t,HGROUP:()=>wt,HR:()=>Xt,HTML:()=>$t,I:()=>Yt,IFRAME:()=>Wt,IMAGE:()=>Go,IMG:()=>Jt,INPUT:()=>Qt,INS:()=>zt,KBD:()=>Zt,KeyStateContext:()=>L,LABEL:()=>te,LEGEND:()=>ee,LI:()=>oe,LINE:()=>Ko,LINEARGRADIENT:()=>Bo,LINK:()=>ne,MACTION:()=>fn,MAIN:()=>se,MAP:()=>ae,MARK:()=>re,MARKER:()=>qo,MASK:()=>_o,MATH:()=>Tn,MENU:()=>ce,MERROR:()=>un,META:()=>ie,METADATA:()=>wo,METER:()=>pe,MFRAC:()=>dn,MI:()=>yn,MMULTISCRIPTS:()=>gn,MN:()=>xn,MO:()=>hn,MOVER:()=>mn,MPADDED:()=>En,MPATH:()=>Xo,MPHANTOM:()=>bn,MPRESCRIPTS:()=>Pn,MROOT:()=>An,MROW:()=>Cn,MS:()=>Mn,MSPACE:()=>Nn,MSQRT:()=>Rn,MSTYLE:()=>On,MSUB:()=>Dn,MSUBSUP:()=>Ln,MSUP:()=>vn,MTABLE:()=>In,MTD:()=>Fn,MTEXT:()=>Vn,MTR:()=>kn,MUNDER:()=>Hn,MUNDEROVER:()=>jn,NAV:()=>le,NOSCRIPT:()=>Se,OBJECT:()=>fe,OL:()=>Te,OPTGROUP:()=>ue,OPTION:()=>de,OUTPUT:()=>ye,P:()=>ge,PATH:()=>$o,PATTERN:()=>Yo,PICTURE:()=>xe,POLYGON:()=>Wo,POLYLINE:()=>Jo,PRE:()=>he,PROGRESS:()=>me,Q:()=>Ee,RADIALGRADIENT:()=>Qo,RECT:()=>zo,RP:()=>be,RT:()=>Pe,RUBY:()=>Ae,S:()=>Ce,SAMP:()=>Me,SCRIPT:()=>Ne,SEARCH:()=>Re,SECTION:()=>Oe,SELECT:()=>De,SEMANTICS:()=>Un,SET:()=>Zo,SLOT:()=>Le,SMALL:()=>ve,SOURCE:()=>Ie,SPAN:()=>Fe,STOP:()=>tn,STRONG:()=>Ve,STYLE:()=>ke,SUB:()=>He,SUMMARY:()=>je,SUP:()=>Ue,SVG:()=>en,SWITCH:()=>on,SYMBOL:()=>nn,TABLE:()=>Ge,TBODY:()=>Ke,TD:()=>Be,TEMPLATE:()=>qe,TEXT:()=>sn,TEXTAREA:()=>_e,TEXTPATH:()=>an,TFOOT:()=>we,TH:()=>Xe,THEAD:()=>$e,TIME:()=>Ye,TITLE:()=>We,TR:()=>Je,TRACK:()=>Qe,TSPAN:()=>rn,U:()=>ze,UL:()=>Ze,USE:()=>cn,VAR:()=>to,VIDEO:()=>eo,VIEW:()=>pn,WBR:()=>oo,app:()=>_,child:()=>J,childCount:()=>W,children:()=>C,childrenStart:()=>M,createPatch:()=>$,createState:()=>X,globals:()=>m,hydrate:()=>D,memo:()=>w,mergeClass:()=>Gn,props:()=>E,tag:()=>Y,vode:()=>q});var m={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function q(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function _(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=m.requestAnimationFrame,t.asyncRenderer=m.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(c,T)=>{if(!(!c||typeof c!="function"&&typeof c!="object"))if(t.stats.patchCount++,c?.next){let l=c;t.stats.liveEffectCount++;try{let h=await l.next();for(;h.done===!1;){t.stats.liveEffectCount++;try{t.patch(h.value,T),h=await l.next()}finally{t.stats.liveEffectCount--}}t.patch(h.value,T)}finally{t.stats.liveEffectCount--}}else if(c.then){t.stats.liveEffectCount++;try{let l=await c;t.patch(l,T)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(c))if(c.length>0)for(let l of c)t.patch(l,!document.hidden&&!!t.asyncRenderer);else t.qSync=x(t.qSync||{},t.qAsync,!1),t.qAsync=null,m.currentViewTransition?.skipTransition(),t.stats.syncRenderPatchCount++,t.renderSync();else typeof c=="function"?t.patch(c(t.state),T):T?(t.stats.asyncRenderPatchCount++,t.qAsync=x(t.qAsync||{},c,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=x(t.qSync||{},c,!1),t.renderSync())}});function o(c){let T=Date.now(),l=a(t.state);t.vode=P(t.state,t.patch,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),c||(t.stats.lastSyncRenderTime=Date.now()-T,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let r=o.bind(null,!1),i=o.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=x(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(r))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await m.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let c=Date.now();try{t.state=x(t.state,t.qAsync,!0),t.qAsync=null,m.currentViewTransition=t.asyncRenderer(i),await m.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-c,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.patch=n.patch,t.state=n;let y=e;y._vode=t,t.vode=P(n,t.patch,e.parentElement,Array.from(e.parentElement.children).indexOf(e),D(e,!0),a(n));for(let c of s)t.patch(c);return t.patch}function D(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&D(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function w(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function X(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function $(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function E(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function C(e){let n=M(e);return n>0?e.slice(n):null}function W(e){let n=M(e);return n<0?0:e.length-n}function J(e,n){let a=M(e);if(a>0)return e[n+a]}function M(e){return E(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function x(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=x({},t,a):typeof o=="object"?x(e[s],t,a):e[s]=x({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=x({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function P(e,n,a,s,t,o,r){o=R(e,o,t);let i=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&i)return t;let y=t?.nodeType===Node.TEXT_NODE,c=y?t:t?.node;if(i){c?.onUnmount&&n(c.onUnmount(c)),c?.remove();return}let T=!i&&z(o),l=!i&&Q(o),h=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!T&&!l&&!h&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(h&&T?o=o.wholeText:h&&l&&(o=[...o]),y&&T)return c.nodeValue!==o&&(c.nodeValue=o),t;if(T&&(!c||!y)){let S=document.createTextNode(o);return c?(c.onUnmount&&n(c.onUnmount(c)),c.replaceWith(S)):a.childNodes[s]?a.insertBefore(S,a.childNodes[s]):a.appendChild(S),S}if(l&&(!c||y||t[0]!==o[0])){let S=o;1 in S&&(S[1]=R(e,S[1],void 0));let b=E(o);r=b?.xmlns||r;let f=r?document.createElementNS(r,o[0]):document.createElement(o[0]);o.node=f,O(e,n,f,void 0,b),c?(c.onUnmount&&n(c.onUnmount(c)),c.replaceWith(f)):a.childNodes[s]?a.insertBefore(f,a.childNodes[s]):a.appendChild(f);let g=C(o);if(g)for(let u=0;u<g.length;u++){let p=g[u],d=P(e,n,f,u,void 0,p,r);o[b?u+2:u+1]=d}return f.onMount&&n(f.onMount(f)),o}if(!y&&l&&t[0]===o[0]){o.node=c;let S=o,b=t,f=!1;if(S[1]?.__memo){let p=S[1];if(S[1]=R(e,S[1],b[1]),p!==S[1]){let d=E(o);O(e,n,c,E(t),d),f=!!d}}else{let p=E(o);O(e,n,c,E(t),p),f=!!p}let g=C(o),u=C(t);if(g)for(let p=0;p<g.length;p++){let d=g[p],k=u&&u[p],I=P(e,n,c,p,k,d,r);I&&(o[f?p+2:p+1]=I)}if(u){let p=g?g.length:0;for(let d=u.length-1;d>=p;d--)P(e,n,c,d,u[d],void 0,r)}return o}}function Q(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function z(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let i=0;i<s.length;i++)if(s[i]!==t[i]){r=!1;break}if(r)return a}let o=F(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function F(e,n){return typeof e=="function"?F(e(n),n):e}function O(e,n,a,s,t){if(!(!t&&!s)){if(s)for(let o in s){let r=s[o],i=t?.[o];r!==i&&(t?t[o]=A(e,n,a,o,r,i):A(e,n,a,o,r,void 0))}if(t&&s){for(let o in t)if(!(o in s)){let r=t[o];t[o]=A(e,n,a,o,void 0,r)}}else if(t)for(let o in t){let r=t[o];t[o]=A(e,n,a,o,void 0,r)}}}function A(e,n,a,s,t,o){if(s==="style")if(!o)a.style.cssText="";else if(typeof o=="string")t!==o&&(a.style.cssText=o);else if(t&&typeof t=="object")for(let r in{...t,...o})!t||o[r]!==t[r]?a.style[r]=o[r]:t[r]&&!o[r]&&(a.style[r]=void 0);else for(let r in o)a.style[r]=o[r];else if(s==="class")o?a.setAttribute("class",V(o)):a.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(o){let r=null;if(typeof o=="function"){let i=o;r=y=>n(i(e,y))}else typeof o=="object"&&(r=()=>n(o));a[s]=r}else a[s]=null;else o!=null&&o!==!1?a.setAttribute(s,o):a.removeAttribute(s);return o}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var Z="a",tt="abbr",et="address",ot="area",nt="article",st="aside",at="audio",rt="b",ct="base",it="bdi",pt="bdo",lt="blockquote",St="body",ft="br",Tt="button",ut="canvas",dt="caption",yt="cite",gt="code",xt="col",ht="colgroup",mt="data",Et="datalist",bt="dd",Pt="del",At="details",Ct="dfn",Mt="dialog",Nt="div",Rt="dl",Ot="dt",Dt="em",Lt="embed",vt="fieldset",It="figcaption",Ft="figure",Vt="footer",kt="form",Ht="h1",jt="h2",Ut="h3",Gt="h4",Kt="h5",Bt="h6",qt="head",_t="header",wt="hgroup",Xt="hr",$t="html",Yt="i",Wt="iframe",Jt="img",Qt="input",zt="ins",Zt="kbd",te="label",ee="legend",oe="li",ne="link",se="main",ae="map",re="mark",ce="menu",ie="meta",pe="meter",le="nav",Se="noscript",fe="object",Te="ol",ue="optgroup",de="option",ye="output",ge="p",xe="picture",he="pre",me="progress",Ee="q",be="rp",Pe="rt",Ae="ruby",Ce="s",Me="samp",Ne="script",Re="search",Oe="section",De="select",Le="slot",ve="small",Ie="source",Fe="span",Ve="strong",ke="style",He="sub",je="summary",Ue="sup",Ge="table",Ke="tbody",Be="td",qe="template",_e="textarea",we="tfoot",Xe="th",$e="thead",Ye="time",We="title",Je="tr",Qe="track",ze="u",Ze="ul",to="var",eo="video",oo="wbr",no="animate",so="animateMotion",ao="animateTransform",ro="circle",co="clipPath",io="defs",po="desc",lo="ellipse",So="feBlend",fo="feColorMatrix",To="feComponentTransfer",uo="feComposite",yo="feConvolveMatrix",go="feDiffuseLighting",xo="feDisplacementMap",ho="feDistantLight",mo="feDropShadow",Eo="feFlood",bo="feFuncA",Po="feFuncB",Ao="feFuncG",Co="feFuncR",Mo="feGaussianBlur",No="feImage",Ro="feMerge",Oo="feMergeNode",Do="feMorphology",Lo="feOffset",vo="fePointLight",Io="feSpecularLighting",Fo="feSpotLight",Vo="feTile",ko="feTurbulence",Ho="filter",jo="foreignObject",Uo="g",Go="image",Ko="line",Bo="linearGradient",qo="marker",_o="mask",wo="metadata",Xo="mpath",$o="path",Yo="pattern",Wo="polygon",Jo="polyline",Qo="radialGradient",zo="rect",Zo="set",tn="stop",en="svg",on="switch",nn="symbol",sn="text",an="textPath",rn="tspan",cn="use",pn="view",ln="annotation",Sn="annotation-xml",fn="maction",Tn="math",un="merror",dn="mfrac",yn="mi",gn="mmultiscripts",xn="mn",hn="mo",mn="mover",En="mpadded",bn="mphantom",Pn="mprescripts",An="mroot",Cn="mrow",Mn="ms",Nn="mspace",Rn="msqrt",On="mstyle",Dn="msub",Ln="msubsup",vn="msup",In="mtable",Fn="mtd",Vn="mtext",kn="mtr",Hn="munder",jn="munderover",Un="semantics";function Gn(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),i=new Set([...o,...r]);n=Array.from(i).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var L=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},v=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return B(Kn);})();
1
+ "use strict";var V=(()=>{var N=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var G=(e,n)=>{for(var a in n)N(e,a,{get:n[a],enumerable:!0})},K=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of H(n))!U.call(e,t)&&t!==a&&N(e,t,{get:()=>n[t],enumerable:!(s=j(n,t))||s.enumerable});return e};var B=e=>K(N({},"__esModule",{value:!0}),e);var Bn={};G(Bn,{A:()=>tt,ABBR:()=>et,ADDRESS:()=>ot,ANIMATE:()=>so,ANIMATEMOTION:()=>ao,ANIMATETRANSFORM:()=>ro,ANNOTATION:()=>Sn,ANNOTATION_XML:()=>fn,AREA:()=>nt,ARTICLE:()=>st,ASIDE:()=>at,AUDIO:()=>rt,B:()=>ct,BASE:()=>it,BDI:()=>pt,BDO:()=>lt,BLOCKQUOTE:()=>St,BODY:()=>ft,BR:()=>dt,BUTTON:()=>Tt,CANVAS:()=>ut,CAPTION:()=>yt,CIRCLE:()=>co,CITE:()=>gt,CLIPPATH:()=>io,CODE:()=>xt,COL:()=>ht,COLGROUP:()=>mt,DATA:()=>Et,DATALIST:()=>bt,DD:()=>Pt,DEFS:()=>po,DEL:()=>At,DESC:()=>lo,DETAILS:()=>Ct,DFN:()=>Mt,DIALOG:()=>Nt,DIV:()=>Rt,DL:()=>Ot,DT:()=>Dt,DelegateStateContext:()=>L,ELLIPSE:()=>So,EM:()=>vt,EMBED:()=>Lt,FEBLEND:()=>fo,FECOLORMATRIX:()=>To,FECOMPONENTTRANSFER:()=>uo,FECOMPOSITE:()=>yo,FECONVOLVEMATRIX:()=>go,FEDIFFUSELIGHTING:()=>xo,FEDISPLACEMENTMAP:()=>ho,FEDISTANTLIGHT:()=>mo,FEDROPSHADOW:()=>Eo,FEFLOOD:()=>bo,FEFUNCA:()=>Po,FEFUNCB:()=>Ao,FEFUNCG:()=>Co,FEFUNCR:()=>Mo,FEGAUSSIANBLUR:()=>No,FEIMAGE:()=>Ro,FEMERGE:()=>Oo,FEMERGENODE:()=>Do,FEMORPHOLOGY:()=>vo,FEOFFSET:()=>Lo,FEPOINTLIGHT:()=>Io,FESPECULARLIGHTING:()=>Fo,FESPOTLIGHT:()=>Vo,FETILE:()=>ko,FETURBULENCE:()=>jo,FIELDSET:()=>It,FIGCAPTION:()=>Ft,FIGURE:()=>Vt,FILTER:()=>Ho,FOOTER:()=>kt,FOREIGNOBJECT:()=>Uo,FORM:()=>jt,G:()=>Go,H1:()=>Ht,H2:()=>Ut,H3:()=>Gt,H4:()=>Kt,H5:()=>Bt,H6:()=>_t,HEAD:()=>qt,HEADER:()=>wt,HGROUP:()=>Xt,HR:()=>$t,HTML:()=>Yt,I:()=>Wt,IFRAME:()=>Jt,IMAGE:()=>Ko,IMG:()=>Qt,INPUT:()=>zt,INS:()=>Zt,KBD:()=>te,KeyStateContext:()=>v,LABEL:()=>ee,LEGEND:()=>oe,LI:()=>ne,LINE:()=>Bo,LINEARGRADIENT:()=>_o,LINK:()=>se,MACTION:()=>dn,MAIN:()=>ae,MAP:()=>re,MARK:()=>ce,MARKER:()=>qo,MASK:()=>wo,MATH:()=>Tn,MENU:()=>ie,MERROR:()=>un,META:()=>pe,METADATA:()=>Xo,METER:()=>le,MFRAC:()=>yn,MI:()=>gn,MMULTISCRIPTS:()=>xn,MN:()=>hn,MO:()=>mn,MOVER:()=>En,MPADDED:()=>bn,MPATH:()=>$o,MPHANTOM:()=>Pn,MPRESCRIPTS:()=>An,MROOT:()=>Cn,MROW:()=>Mn,MS:()=>Nn,MSPACE:()=>Rn,MSQRT:()=>On,MSTYLE:()=>Dn,MSUB:()=>vn,MSUBSUP:()=>Ln,MSUP:()=>In,MTABLE:()=>Fn,MTD:()=>Vn,MTEXT:()=>kn,MTR:()=>jn,MUNDER:()=>Hn,MUNDEROVER:()=>Un,NAV:()=>Se,NOSCRIPT:()=>fe,OBJECT:()=>de,OL:()=>Te,OPTGROUP:()=>ue,OPTION:()=>ye,OUTPUT:()=>ge,P:()=>xe,PATH:()=>Yo,PATTERN:()=>Wo,PICTURE:()=>he,POLYGON:()=>Jo,POLYLINE:()=>Qo,PRE:()=>me,PROGRESS:()=>Ee,Q:()=>be,RADIALGRADIENT:()=>zo,RECT:()=>Zo,RP:()=>Pe,RT:()=>Ae,RUBY:()=>Ce,S:()=>Me,SAMP:()=>Ne,SCRIPT:()=>Re,SEARCH:()=>Oe,SECTION:()=>De,SELECT:()=>ve,SEMANTICS:()=>Gn,SET:()=>tn,SLOT:()=>Le,SMALL:()=>Ie,SOURCE:()=>Fe,SPAN:()=>Ve,STOP:()=>en,STRONG:()=>ke,STYLE:()=>je,SUB:()=>He,SUMMARY:()=>Ue,SUP:()=>Ge,SVG:()=>on,SWITCH:()=>nn,SYMBOL:()=>sn,TABLE:()=>Ke,TBODY:()=>Be,TD:()=>_e,TEMPLATE:()=>qe,TEXT:()=>an,TEXTAREA:()=>we,TEXTPATH:()=>rn,TFOOT:()=>Xe,TH:()=>$e,THEAD:()=>Ye,TIME:()=>We,TITLE:()=>Je,TR:()=>Qe,TRACK:()=>ze,TSPAN:()=>cn,U:()=>Ze,UL:()=>to,USE:()=>pn,VAR:()=>eo,VIDEO:()=>oo,VIEW:()=>ln,WBR:()=>no,app:()=>q,child:()=>Q,childCount:()=>J,children:()=>P,childrenStart:()=>M,createPatch:()=>Y,createState:()=>$,defuse:()=>w,globals:()=>E,hydrate:()=>D,memo:()=>X,mergeClass:()=>Kn,props:()=>m,tag:()=>W,vode:()=>_});var E={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function _(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function q(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=E.requestAnimationFrame,t.asyncRenderer=E.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(c,d)=>{if(!(!c||typeof c!="function"&&typeof c!="object"))if(t.stats.patchCount++,c?.next){let l=c;t.stats.liveEffectCount++;try{let h=await l.next();for(;h.done===!1;){t.stats.liveEffectCount++;try{t.patch(h.value,d),h=await l.next()}finally{t.stats.liveEffectCount--}}t.patch(h.value,d)}finally{t.stats.liveEffectCount--}}else if(c.then){t.stats.liveEffectCount++;try{let l=await c;t.patch(l,d)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(c))if(c.length>0)for(let l of c)t.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=x(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{E.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof c=="function"?t.patch(c(t.state),d):d?(t.stats.asyncRenderPatchCount++,t.qAsync=x(t.qAsync||{},c,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=x(t.qSync||{},c,!1),t.renderSync())}});function o(c){let d=Date.now(),l=a(t.state);t.vode=A(t.state,t.patch,e.parentElement,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),c||(t.stats.lastSyncRenderTime=Date.now()-d,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let r=o.bind(null,!1),i=o.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=x(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(r))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await E.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let c=Date.now();try{t.state=x(t.state,t.qAsync,!0),t.qAsync=null,E.currentViewTransition=t.asyncRenderer(i),await E.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-c,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.patch=n.patch,t.state=n;let y=e;y._vode=t,t.vode=A(n,t.patch,e.parentElement,Array.from(e.parentElement.children).indexOf(e),D(e,!0),a(n));for(let c of s)t.patch(c);return t.patch}function w(e){if(e?._vode){let a=function(t){if(!t?.node)return;let o=m(t);if(o)for(let i in o)i[0]==="o"&&i[1]==="n"&&(t.node[i]=null);let r=P(t);if(r)for(let i of r)a(i)};var n=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function D(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&D(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function X(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function $(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function Y(e){return e}function W(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function m(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function P(e){let n=M(e);return n>0?e.slice(n):null}function J(e){let n=M(e);return n<0?0:e.length-n}function Q(e,n){let a=M(e);if(a>0)return e[n+a]}function M(e){return m(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function x(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=x({},t,a):typeof o=="object"?x(e[s],t,a):e[s]=x({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=x({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function A(e,n,a,s,t,o,r){o=R(e,o,t);let i=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&i)return t;let y=t?.nodeType===Node.TEXT_NODE,c=y?t:t?.node;if(i){c?.onUnmount&&n(c.onUnmount(c)),c?.remove();return}let d=!i&&Z(o),l=!i&&z(o),h=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!d&&!l&&!h&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(h&&d?o=o.wholeText:h&&l&&(o=[...o]),y&&d)return c.nodeValue!==o&&(c.nodeValue=o),t;if(d&&(!c||!y)){let S=document.createTextNode(o);return c?(c.onUnmount&&n(c.onUnmount(c)),c.replaceWith(S)):a.childNodes[s]?a.insertBefore(S,a.childNodes[s]):a.appendChild(S),S}if(l&&(!c||y||t[0]!==o[0])){let S=o;1 in S&&(S[1]=R(e,S[1],void 0));let b=m(o);r=b?.xmlns||r;let f=r?document.createElementNS(r,o[0]):document.createElement(o[0]);o.node=f,O(e,n,f,void 0,b),c?(c.onUnmount&&n(c.onUnmount(c)),c.replaceWith(f)):a.childNodes[s]?a.insertBefore(f,a.childNodes[s]):a.appendChild(f);let g=P(o);if(g)for(let T=0;T<g.length;T++){let p=g[T],u=A(e,n,f,T,void 0,p,r);o[b?T+2:T+1]=u}return f.onMount&&n(f.onMount(f)),o}if(!y&&l&&t[0]===o[0]){o.node=c;let S=o,b=t,f=!1;if(S[1]?.__memo){let p=S[1];if(S[1]=R(e,S[1],b[1]),p!==S[1]){let u=m(o);O(e,n,c,m(t),u),f=!!u}}else{let p=m(o);O(e,n,c,m(t),p),f=!!p}let g=P(o),T=P(t);if(g)for(let p=0;p<g.length;p++){let u=g[p],k=T&&T[p],I=A(e,n,c,p,k,u,r);I&&(o[f?p+2:p+1]=I)}if(T){let p=g?g.length:0;for(let u=T.length-1;u>=p;u--)A(e,n,c,u,T[u],void 0,r)}return o}}function z(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function Z(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let i=0;i<s.length;i++)if(s[i]!==t[i]){r=!1;break}if(r)return a}let o=F(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function F(e,n){return typeof e=="function"?F(e(n),n):e}function O(e,n,a,s,t){if(!(!t&&!s)){if(s)for(let o in s){let r=s[o],i=t?.[o];r!==i&&(t?t[o]=C(e,n,a,o,r,i):C(e,n,a,o,r,void 0))}if(t&&s){for(let o in t)if(!(o in s)){let r=t[o];t[o]=C(e,n,a,o,void 0,r)}}else if(t)for(let o in t){let r=t[o];t[o]=C(e,n,a,o,void 0,r)}}}function C(e,n,a,s,t,o){if(s==="style")if(!o)a.style.cssText="";else if(typeof o=="string")t!==o&&(a.style.cssText=o);else if(t&&typeof t=="object")for(let r in{...t,...o})!t||o[r]!==t[r]?a.style[r]=o[r]:t[r]&&!o[r]&&(a.style[r]=void 0);else for(let r in o)a.style[r]=o[r];else if(s==="class")o?a.setAttribute("class",V(o)):a.removeAttribute("class");else if(s[0]==="o"&&s[1]==="n")if(o){let r=null;if(typeof o=="function"){let i=o;r=y=>n(i(e,y))}else typeof o=="object"&&(r=()=>n(o));a[s]=r}else a[s]=null;else o!=null&&o!==!1?a.setAttribute(s,o):a.removeAttribute(s);return o}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var tt="a",et="abbr",ot="address",nt="area",st="article",at="aside",rt="audio",ct="b",it="base",pt="bdi",lt="bdo",St="blockquote",ft="body",dt="br",Tt="button",ut="canvas",yt="caption",gt="cite",xt="code",ht="col",mt="colgroup",Et="data",bt="datalist",Pt="dd",At="del",Ct="details",Mt="dfn",Nt="dialog",Rt="div",Ot="dl",Dt="dt",vt="em",Lt="embed",It="fieldset",Ft="figcaption",Vt="figure",kt="footer",jt="form",Ht="h1",Ut="h2",Gt="h3",Kt="h4",Bt="h5",_t="h6",qt="head",wt="header",Xt="hgroup",$t="hr",Yt="html",Wt="i",Jt="iframe",Qt="img",zt="input",Zt="ins",te="kbd",ee="label",oe="legend",ne="li",se="link",ae="main",re="map",ce="mark",ie="menu",pe="meta",le="meter",Se="nav",fe="noscript",de="object",Te="ol",ue="optgroup",ye="option",ge="output",xe="p",he="picture",me="pre",Ee="progress",be="q",Pe="rp",Ae="rt",Ce="ruby",Me="s",Ne="samp",Re="script",Oe="search",De="section",ve="select",Le="slot",Ie="small",Fe="source",Ve="span",ke="strong",je="style",He="sub",Ue="summary",Ge="sup",Ke="table",Be="tbody",_e="td",qe="template",we="textarea",Xe="tfoot",$e="th",Ye="thead",We="time",Je="title",Qe="tr",ze="track",Ze="u",to="ul",eo="var",oo="video",no="wbr",so="animate",ao="animateMotion",ro="animateTransform",co="circle",io="clipPath",po="defs",lo="desc",So="ellipse",fo="feBlend",To="feColorMatrix",uo="feComponentTransfer",yo="feComposite",go="feConvolveMatrix",xo="feDiffuseLighting",ho="feDisplacementMap",mo="feDistantLight",Eo="feDropShadow",bo="feFlood",Po="feFuncA",Ao="feFuncB",Co="feFuncG",Mo="feFuncR",No="feGaussianBlur",Ro="feImage",Oo="feMerge",Do="feMergeNode",vo="feMorphology",Lo="feOffset",Io="fePointLight",Fo="feSpecularLighting",Vo="feSpotLight",ko="feTile",jo="feTurbulence",Ho="filter",Uo="foreignObject",Go="g",Ko="image",Bo="line",_o="linearGradient",qo="marker",wo="mask",Xo="metadata",$o="mpath",Yo="path",Wo="pattern",Jo="polygon",Qo="polyline",zo="radialGradient",Zo="rect",tn="set",en="stop",on="svg",nn="switch",sn="symbol",an="text",rn="textPath",cn="tspan",pn="use",ln="view",Sn="annotation",fn="annotation-xml",dn="maction",Tn="math",un="merror",yn="mfrac",gn="mi",xn="mmultiscripts",hn="mn",mn="mo",En="mover",bn="mpadded",Pn="mphantom",An="mprescripts",Cn="mroot",Mn="mrow",Nn="ms",Rn="mspace",On="msqrt",Dn="mstyle",vn="msub",Ln="msubsup",In="msup",Fn="mtable",Vn="mtd",kn="mtext",jn="mtr",Hn="munder",Un="munderover",Gn="semantics";function Kn(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),i=new Set([...o,...r]);n=Array.from(i).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var v=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},L=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return B(Bn);})();
package/dist/vode.min.mjs CHANGED
@@ -1 +1 @@
1
- var R={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(z)=>z(),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function u(z,E,...J){if(!z)throw Error("first argument to vode() must be a tag name or a vode");if(Array.isArray(z))return z;else if(E)return[z,E,...J];else return[z,...J]}function V(z,E,J,...G){if(!z?.parentElement)throw Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!E||typeof E!=="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.syncRenderer=R.requestAnimationFrame,q.asyncRenderer=R.startViewTransition,q.qSync=null,q.qAsync=null,q.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},Object.defineProperty(E,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(U,j)=>{if(!U||typeof U!=="function"&&typeof U!=="object")return;if(q.stats.patchCount++,U?.next){let $=U;q.stats.liveEffectCount++;try{let T=await $.next();while(T.done===!1){q.stats.liveEffectCount++;try{q.patch(T.value,j),T=await $.next()}finally{q.stats.liveEffectCount--}}q.patch(T.value,j)}finally{q.stats.liveEffectCount--}}else if(U.then){q.stats.liveEffectCount++;try{let $=await U;q.patch($,j)}finally{q.stats.liveEffectCount--}}else if(Array.isArray(U))if(U.length>0)for(let $ of U)q.patch($,!document.hidden&&!!q.asyncRenderer);else q.qSync=M(q.qSync||{},q.qAsync,!1),q.qAsync=null,R.currentViewTransition?.skipTransition(),q.stats.syncRenderPatchCount++,q.renderSync();else if(typeof U==="function")q.patch(U(q.state),j);else if(j)q.stats.asyncRenderPatchCount++,q.qAsync=M(q.qAsync||{},U,!1),await q.renderAsync();else q.stats.syncRenderPatchCount++,q.qSync=M(q.qSync||{},U,!1),q.renderSync()}});function B(U){let j=Date.now(),$=J(q.state);if(q.vode=K(q.state,q.patch,z.parentElement,0,q.vode,$),z.tagName.toUpperCase()!==$[0].toUpperCase())z=q.vode.node,z._vode=q;if(!U){if(q.stats.lastSyncRenderTime=Date.now()-j,q.stats.syncRenderCount++,q.isRendering=!1,q.qSync)q.renderSync()}}let Q=B.bind(null,!1),X=B.bind(null,!0);Object.defineProperty(q,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{if(q.isRendering||!q.qSync)return;q.isRendering=!0,q.state=M(q.state,q.qSync,!0),q.qSync=null,q.syncRenderer(Q)}}),Object.defineProperty(q,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(q.isAnimating||!q.qAsync)return;if(await R.currentViewTransition?.updateCallbackDone,q.isAnimating||!q.qAsync||document.hidden)return;q.isAnimating=!0;let U=Date.now();try{q.state=M(q.state,q.qAsync,!0),q.qAsync=null,R.currentViewTransition=q.asyncRenderer(X),await R.currentViewTransition?.updateCallbackDone}finally{q.stats.lastAsyncRenderTime=Date.now()-U,q.stats.asyncRenderCount++,q.isAnimating=!1}if(q.qAsync)q.renderAsync()}}),q.patch=E.patch,q.state=E;let O=z;O._vode=q,q.vode=K(E,q.patch,z.parentElement,Array.from(z.parentElement.children).indexOf(z),x(z,!0),J(E));for(let U of G)q.patch(U);return q.patch}function x(z,E){if(z?.nodeType===Node.TEXT_NODE){if(z.nodeValue?.trim()!=="")return E?z:z.nodeValue;return}else if(z.nodeType===Node.COMMENT_NODE)return;else if(z.nodeType===Node.ELEMENT_NODE){let G=[z.tagName.toLowerCase()];if(E)G.node=z;if(z?.hasAttributes()){let q={},B=z.attributes;for(let Q of B)q[Q.name]=Q.value;G.push(q)}if(z.hasChildNodes()){let q=[];for(let B of z.childNodes){let Q=B&&x(B,E);if(Q)G.push(Q);else if(B&&E)q.push(B)}for(let B of q)B.remove()}return G}else return}function v(z,E){if(!z||!Array.isArray(z))throw Error("first argument to memo() must be an array of values to compare");if(typeof E!=="function")throw Error("second argument to memo() must be a function that returns a vode or props object");return E.__memo=z,E}function w(z){if(!z||typeof z!=="object")throw Error("createState() must be called with a state object");return z}function c(z){return z}function i(z){return z?Array.isArray(z)?z[0]:typeof z==="string"||z.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function D(z){if(Array.isArray(z)&&z.length>1&&z[1]&&!Array.isArray(z[1])){if(typeof z[1]==="object"&&z[1].nodeType!==Node.TEXT_NODE)return z[1]}return}function f(z){let E=b(z);if(E>0)return z.slice(E);return null}function p(z){let E=b(z);if(E<0)return 0;return z.length-E}function r(z,E){let J=b(z);if(J>0)return z[E+J];else return}function b(z){return D(z)?z.length>2?2:-1:Array.isArray(z)&&z.length>1?1:-1}function M(z,E,J){if(!E)return z;for(let G in E){let q=E[G];if(q&&typeof q==="object"){let B=z[G];if(B)if(Array.isArray(q))z[G]=[...q];else if(q instanceof Date&&B!==q)z[G]=new Date(q);else if(Array.isArray(B))z[G]=M({},q,J);else if(typeof B==="object")M(z[G],q,J);else z[G]=M({},q,J);else if(Array.isArray(q))z[G]=[...q];else if(q instanceof Date)z[G]=new Date(q);else z[G]=M({},q,J)}else if(q===void 0&&J)delete z[G];else z[G]=q}return z}function K(z,E,J,G,q,B,Q){B=C(z,B,q);let X=!B||typeof B==="number"||typeof B==="boolean";if(B===q||!q&&X)return q;let O=q?.nodeType===Node.TEXT_NODE,U=O?q:q?.node;if(X){U?.onUnmount&&E(U.onUnmount(U)),U?.remove();return}let j=!X&&y(B),$=!X&&g(B),T=!!B&&typeof B!=="string"&&!!(B?.node||B?.nodeType===Node.TEXT_NODE);if(!j&&!$&&!T&&!q)throw Error("Invalid vode: "+typeof B+" "+JSON.stringify(B));else if(T&&j)B=B.wholeText;else if(T&&$)B=[...B];if(O&&j){if(U.nodeValue!==B)U.nodeValue=B;return q}if(j&&(!U||!O)){let L=document.createTextNode(B);if(U)U.onUnmount&&E(U.onUnmount(U)),U.replaceWith(L);else if(J.childNodes[G])J.insertBefore(L,J.childNodes[G]);else J.appendChild(L);return L}if($&&(!U||O||q[0]!==B[0])){let L=B;if(1 in L)L[1]=C(z,L[1],void 0);let I=D(B);Q=I?.xmlns||Q;let W=Q?document.createElementNS(Q,B[0]):document.createElement(B[0]);if(B.node=W,S(z,E,W,void 0,I),U)U.onUnmount&&E(U.onUnmount(U)),U.replaceWith(W);else if(J.childNodes[G])J.insertBefore(W,J.childNodes[G]);else J.appendChild(W);let F=f(B);if(F)for(let H=0;H<F.length;H++){let Z=F[H],Y=K(z,E,W,H,void 0,Z,Q);B[I?H+2:H+1]=Y}return W.onMount&&E(W.onMount(W)),B}if(!O&&$&&q[0]===B[0]){B.node=U;let L=B,I=q,W=!1;if(L[1]?.__memo){let Z=L[1];if(L[1]=C(z,L[1],I[1]),Z!==L[1]){let Y=D(B);S(z,E,U,D(q),Y),W=!!Y}}else{let Z=D(B);S(z,E,U,D(q),Z),W=!!Z}let F=f(B),H=f(q);if(F)for(let Z=0;Z<F.length;Z++){let Y=F[Z],_=H&&H[Z],N=K(z,E,U,Z,_,Y,Q);if(N)B[W?Z+2:Z+1]=N}if(H){let Z=F?F.length:0;for(let Y=H.length-1;Y>=Z;Y--)K(z,E,U,Y,H[Y],void 0,Q)}return B}return}function g(z){return Array.isArray(z)&&z.length>0&&typeof z[0]==="string"}function y(z){return typeof z==="string"||z?.nodeType===Node.TEXT_NODE}function C(z,E,J){if(typeof E!=="function")return E;let G=E?.__memo,q=J?.__memo;if(Array.isArray(G)&&Array.isArray(q)&&G.length===q.length){let Q=!0;for(let X=0;X<G.length;X++)if(G[X]!==q[X]){Q=!1;break}if(Q)return J}let B=k(E,z);if(typeof B==="object")B.__memo=E?.__memo;return B}function k(z,E){if(typeof z==="function")return k(z(E),E);else return z}function S(z,E,J,G,q){if(!q&&!G)return;if(G)for(let B in G){let Q=G[B],X=q?.[B];if(Q!==X)if(q)q[B]=A(z,E,J,B,Q,X);else A(z,E,J,B,Q,void 0)}if(q&&G){for(let B in q)if(!(B in G)){let Q=q[B];q[B]=A(z,E,J,B,void 0,Q)}}else if(q)for(let B in q){let Q=q[B];q[B]=A(z,E,J,B,void 0,Q)}}function A(z,E,J,G,q,B){if(G==="style")if(!B)J.style.cssText="";else if(typeof B==="string"){if(q!==B)J.style.cssText=B}else if(q&&typeof q==="object"){for(let Q in{...q,...B})if(!q||B[Q]!==q[Q])J.style[Q]=B[Q];else if(q[Q]&&!B[Q])J.style[Q]=void 0}else for(let Q in B)J.style[Q]=B[Q];else if(G==="class")if(B)J.setAttribute("class",P(B));else J.removeAttribute("class");else if(G[0]==="o"&&G[1]==="n")if(B){let Q=null;if(typeof B==="function"){let X=B;Q=(O)=>E(X(z,O))}else if(typeof B==="object")Q=()=>E(B);J[G]=Q}else J[G]=null;else if(B!==null&&B!==void 0&&B!==!1)J.setAttribute(G,B);else J.removeAttribute(G);return B}function P(z){if(typeof z==="string")return z;else if(Array.isArray(z))return z.map(P).join(" ");else if(typeof z==="object")return Object.keys(z).filter((E)=>z[E]).join(" ");else return""}var s="a",n="abbr",d="address",t="area",a="article",o="aside",e="audio",qq="b",zq="base",Bq="bdi",Eq="bdo",Gq="blockquote",Jq="body",Qq="br",Uq="button",Xq="canvas",Zq="caption",$q="cite",Lq="code",Wq="col",jq="colgroup",Hq="data",Yq="datalist",Oq="dd",Fq="del",Mq="details",Tq="dfn",Rq="dialog",Dq="div",Iq="dl",Kq="dt",Aq="em",fq="embed",Cq="fieldset",Sq="figcaption",bq="figure",Nq="footer",xq="form",kq="h1",Pq="h2",_q="h3",gq="h4",yq="h5",hq="h6",mq="head",uq="header",Vq="hgroup",vq="hr",wq="html",cq="i",iq="iframe",pq="img",rq="input",lq="ins",sq="kbd",nq="label",dq="legend",tq="li",aq="link",oq="main",eq="map",qz="mark",zz="menu",Bz="meta",Ez="meter",Gz="nav",Jz="noscript",Qz="object",Uz="ol",Xz="optgroup",Zz="option",$z="output",Lz="p",Wz="picture",jz="pre",Hz="progress",Yz="q",Oz="rp",Fz="rt",Mz="ruby",Tz="s",Rz="samp",Dz="script",Iz="search",Kz="section",Az="select",fz="slot",Cz="small",Sz="source",bz="span",Nz="strong",xz="style",kz="sub",Pz="summary",_z="sup",gz="table",yz="tbody",hz="td",mz="template",uz="textarea",Vz="tfoot",vz="th",wz="thead",cz="time",iz="title",pz="tr",rz="track",lz="u",sz="ul",nz="var",dz="video",tz="wbr",az="animate",oz="animateMotion",ez="animateTransform",qB="circle",zB="clipPath",BB="defs",EB="desc",GB="ellipse",JB="feBlend",QB="feColorMatrix",UB="feComponentTransfer",XB="feComposite",ZB="feConvolveMatrix",$B="feDiffuseLighting",LB="feDisplacementMap",WB="feDistantLight",jB="feDropShadow",HB="feFlood",YB="feFuncA",OB="feFuncB",FB="feFuncG",MB="feFuncR",TB="feGaussianBlur",RB="feImage",DB="feMerge",IB="feMergeNode",KB="feMorphology",AB="feOffset",fB="fePointLight",CB="feSpecularLighting",SB="feSpotLight",bB="feTile",NB="feTurbulence",xB="filter",kB="foreignObject",PB="g",_B="image",gB="line",yB="linearGradient",hB="marker",mB="mask",uB="metadata",VB="mpath",vB="path",wB="pattern",cB="polygon",iB="polyline",pB="radialGradient",rB="rect",lB="set",sB="stop",nB="svg",dB="switch",tB="symbol",aB="text",oB="textPath",eB="tspan",qE="use",zE="view",BE="annotation",EE="annotation-xml",GE="maction",JE="math",QE="merror",UE="mfrac",XE="mi",ZE="mmultiscripts",$E="mn",LE="mo",WE="mover",jE="mpadded",HE="mphantom",YE="mprescripts",OE="mroot",FE="mrow",ME="ms",TE="mspace",RE="msqrt",DE="mstyle",IE="msub",KE="msubsup",AE="msup",fE="mtable",CE="mtd",SE="mtext",bE="mtr",NE="munder",xE="munderover",kE="semantics";function _E(...z){if(!z||z.length===0)return null;if(z.length===1)return z[0];let E=z[0];for(let J=1;J<z.length;J++){let G=E,q=z[J];if(!G)E=q;else if(!q)continue;else if(typeof G==="string"&&typeof q==="string"){let B=G.split(" "),Q=q.split(" "),X=new Set([...B,...Q]);E=Array.from(X).join(" ").trim()}else if(typeof G==="string"&&Array.isArray(q)){let B=new Set([...q,...G.split(" ")]);E=Array.from(B).join(" ").trim()}else if(Array.isArray(G)&&typeof q==="string"){let B=new Set([...G,...q.split(" ")]);E=Array.from(B).join(" ").trim()}else if(Array.isArray(G)&&Array.isArray(q)){let B=new Set([...G,...q]);E=Array.from(B).join(" ").trim()}else if(typeof G==="string"&&typeof q==="object")E={[G]:!0,...q};else if(typeof G==="object"&&typeof q==="string")E={...G,[q]:!0};else if(typeof G==="object"&&typeof q==="object")E={...G,...q};else if(typeof G==="object"&&Array.isArray(q)){let B={...G};for(let Q of q)B[Q]=!0;E=B}else if(Array.isArray(G)&&typeof q==="object"){let B={};for(let Q of G)B[Q]=!0;for(let Q of Object.keys(q))B[Q]=q[Q];E=B}else throw Error(`cannot merge classes of ${G} (${typeof G}) and ${q} (${typeof q})`)}return E}class h{state;path;keys;constructor(z,E){this.state=z;this.path=E;this.keys=E.split(".")}get(){let z=this.keys,E=this.state?this.state[z[0]]:void 0;for(let J=1;J<z.length&&!!E;J++)E=E[z[J]];return E}put(z){this.putDeep(z,this.state)}patch(z){if(Array.isArray(z)){let E=[];for(let J of z)E.push(this.createPatch(J));this.state.patch(E)}else this.state.patch(this.createPatch(z))}createPatch(z){let E={};return this.putDeep(z,E),E}putDeep(z,E){let J=this.keys;if(J.length>1){let G=0,q=E[J[G]];if(typeof q!=="object"||q===null)E[J[G]]=q={};for(G=1;G<J.length-1;G++){let B=q;if(q=q[J[G]],typeof q!=="object"||q===null)B[J[G]]=q={}}q[J[G]]=z}else if(typeof E[J[0]]==="object"&&typeof z==="object")Object.assign(E[J[0]],z);else E[J[0]]=z}}class m{state;get;put;patch;constructor(z,E,J,G){this.state=z;this.get=E;this.put=J;this.patch=G}}export{u as vode,i as tag,D as props,_E as mergeClass,v as memo,x as hydrate,R as globals,w as createState,c as createPatch,b as childrenStart,f as children,p as childCount,r as child,V as app,tz as WBR,zE as VIEW,dz as VIDEO,nz as VAR,qE as USE,sz as UL,lz as U,eB as TSPAN,rz as TRACK,pz as TR,iz as TITLE,cz as TIME,wz as THEAD,vz as TH,Vz as TFOOT,oB as TEXTPATH,uz as TEXTAREA,aB as TEXT,mz as TEMPLATE,hz as TD,yz as TBODY,gz as TABLE,tB as SYMBOL,dB as SWITCH,nB as SVG,_z as SUP,Pz as SUMMARY,kz as SUB,xz as STYLE,Nz as STRONG,sB as STOP,bz as SPAN,Sz as SOURCE,Cz as SMALL,fz as SLOT,lB as SET,kE as SEMANTICS,Az as SELECT,Kz as SECTION,Iz as SEARCH,Dz as SCRIPT,Rz as SAMP,Tz as S,Mz as RUBY,Fz as RT,Oz as RP,rB as RECT,pB as RADIALGRADIENT,Yz as Q,Hz as PROGRESS,jz as PRE,iB as POLYLINE,cB as POLYGON,Wz as PICTURE,wB as PATTERN,vB as PATH,Lz as P,$z as OUTPUT,Zz as OPTION,Xz as OPTGROUP,Uz as OL,Qz as OBJECT,Jz as NOSCRIPT,Gz as NAV,xE as MUNDEROVER,NE as MUNDER,bE as MTR,SE as MTEXT,CE as MTD,fE as MTABLE,AE as MSUP,KE as MSUBSUP,IE as MSUB,DE as MSTYLE,RE as MSQRT,TE as MSPACE,ME as MS,FE as MROW,OE as MROOT,YE as MPRESCRIPTS,HE as MPHANTOM,VB as MPATH,jE as MPADDED,WE as MOVER,LE as MO,$E as MN,ZE as MMULTISCRIPTS,XE as MI,UE as MFRAC,Ez as METER,uB as METADATA,Bz as META,QE as MERROR,zz as MENU,JE as MATH,mB as MASK,hB as MARKER,qz as MARK,eq as MAP,oq as MAIN,GE as MACTION,aq as LINK,yB as LINEARGRADIENT,gB as LINE,tq as LI,dq as LEGEND,nq as LABEL,h as KeyStateContext,sq as KBD,lq as INS,rq as INPUT,pq as IMG,_B as IMAGE,iq as IFRAME,cq as I,wq as HTML,vq as HR,Vq as HGROUP,uq as HEADER,mq as HEAD,hq as H6,yq as H5,gq as H4,_q as H3,Pq as H2,kq as H1,PB as G,xq as FORM,kB as FOREIGNOBJECT,Nq as FOOTER,xB as FILTER,bq as FIGURE,Sq as FIGCAPTION,Cq as FIELDSET,NB as FETURBULENCE,bB as FETILE,SB as FESPOTLIGHT,CB as FESPECULARLIGHTING,fB as FEPOINTLIGHT,AB as FEOFFSET,KB as FEMORPHOLOGY,IB as FEMERGENODE,DB as FEMERGE,RB as FEIMAGE,TB as FEGAUSSIANBLUR,MB as FEFUNCR,FB as FEFUNCG,OB as FEFUNCB,YB as FEFUNCA,HB as FEFLOOD,jB as FEDROPSHADOW,WB as FEDISTANTLIGHT,LB as FEDISPLACEMENTMAP,$B as FEDIFFUSELIGHTING,ZB as FECONVOLVEMATRIX,XB as FECOMPOSITE,UB as FECOMPONENTTRANSFER,QB as FECOLORMATRIX,JB as FEBLEND,fq as EMBED,Aq as EM,GB as ELLIPSE,m as DelegateStateContext,Kq as DT,Iq as DL,Dq as DIV,Rq as DIALOG,Tq as DFN,Mq as DETAILS,EB as DESC,Fq as DEL,BB as DEFS,Oq as DD,Yq as DATALIST,Hq as DATA,jq as COLGROUP,Wq as COL,Lq as CODE,zB as CLIPPATH,$q as CITE,qB as CIRCLE,Zq as CAPTION,Xq as CANVAS,Uq as BUTTON,Qq as BR,Jq as BODY,Gq as BLOCKQUOTE,Eq as BDO,Bq as BDI,zq as BASE,qq as B,e as AUDIO,o as ASIDE,a as ARTICLE,t as AREA,EE as ANNOTATION_XML,BE as ANNOTATION,ez as ANIMATETRANSFORM,oz as ANIMATEMOTION,az as ANIMATE,d as ADDRESS,n as ABBR,s as A};
1
+ var D={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(z)=>z(),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function u(z,G,...Q){if(!z)throw Error("first argument to vode() must be a tag name or a vode");if(Array.isArray(z))return z;else if(G)return[z,G,...Q];else return[z,...Q]}function V(z,G,Q,...J){if(!z?.parentElement)throw Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!G||typeof G!=="object")throw Error("second argument to app() must be a state object");if(typeof Q!=="function")throw Error("third argument to app() must be a function that returns a vode");let q={};q.syncRenderer=D.requestAnimationFrame,q.asyncRenderer=D.startViewTransition,q.qSync=null,q.qAsync=null,q.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},Object.defineProperty(G,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(X,j)=>{if(!X||typeof X!=="function"&&typeof X!=="object")return;if(q.stats.patchCount++,X?.next){let E=X;q.stats.liveEffectCount++;try{let T=await E.next();while(T.done===!1){q.stats.liveEffectCount++;try{q.patch(T.value,j),T=await E.next()}finally{q.stats.liveEffectCount--}}q.patch(T.value,j)}finally{q.stats.liveEffectCount--}}else if(X.then){q.stats.liveEffectCount++;try{let E=await X;q.patch(E,j)}finally{q.stats.liveEffectCount--}}else if(Array.isArray(X))if(X.length>0)for(let E of X)q.patch(E,!document.hidden&&!!q.asyncRenderer);else{q.qSync=M(q.qSync||{},q.qAsync,!1),q.qAsync=null;try{D.currentViewTransition?.skipTransition()}catch{}q.stats.syncRenderPatchCount++,q.renderSync()}else if(typeof X==="function")q.patch(X(q.state),j);else if(j)q.stats.asyncRenderPatchCount++,q.qAsync=M(q.qAsync||{},X,!1),await q.renderAsync();else q.stats.syncRenderPatchCount++,q.qSync=M(q.qSync||{},X,!1),q.renderSync()}});function B(X){let j=Date.now(),E=Q(q.state);if(q.vode=K(q.state,q.patch,z.parentElement,0,q.vode,E),z.tagName.toUpperCase()!==E[0].toUpperCase())z=q.vode.node,z._vode=q;if(!X){if(q.stats.lastSyncRenderTime=Date.now()-j,q.stats.syncRenderCount++,q.isRendering=!1,q.qSync)q.renderSync()}}let U=B.bind(null,!1),Z=B.bind(null,!0);Object.defineProperty(q,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{if(q.isRendering||!q.qSync)return;q.isRendering=!0,q.state=M(q.state,q.qSync,!0),q.qSync=null,q.syncRenderer(U)}}),Object.defineProperty(q,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(q.isAnimating||!q.qAsync)return;if(await D.currentViewTransition?.updateCallbackDone,q.isAnimating||!q.qAsync||document.hidden)return;q.isAnimating=!0;let X=Date.now();try{q.state=M(q.state,q.qAsync,!0),q.qAsync=null,D.currentViewTransition=q.asyncRenderer(Z),await D.currentViewTransition?.updateCallbackDone}finally{q.stats.lastAsyncRenderTime=Date.now()-X,q.stats.asyncRenderCount++,q.isAnimating=!1}if(q.qAsync)q.renderAsync()}}),q.patch=G.patch,q.state=G;let O=z;O._vode=q,q.vode=K(G,q.patch,z.parentElement,Array.from(z.parentElement.children).indexOf(z),x(z,!0),Q(G));for(let X of J)q.patch(X);return q.patch}function v(z){if(z?._vode){let G=function(J){if(!J?.node)return;let q=R(J);if(q){for(let U in q)if(U[0]==="o"&&U[1]==="n")J.node[U]=null}let B=f(J);if(B)for(let U of B)G(U)},Q=z._vode;delete z._vode,Object.defineProperty(Q.state,"patch",{value:void 0}),Object.defineProperty(Q,"renderSync",{value:()=>{}}),Object.defineProperty(Q,"renderAsync",{value:()=>{}}),G(Q.vode)}}function x(z,G){if(z?.nodeType===Node.TEXT_NODE){if(z.nodeValue?.trim()!=="")return G?z:z.nodeValue;return}else if(z.nodeType===Node.COMMENT_NODE)return;else if(z.nodeType===Node.ELEMENT_NODE){let J=[z.tagName.toLowerCase()];if(G)J.node=z;if(z?.hasAttributes()){let q={},B=z.attributes;for(let U of B)q[U.name]=U.value;J.push(q)}if(z.hasChildNodes()){let q=[];for(let B of z.childNodes){let U=B&&x(B,G);if(U)J.push(U);else if(B&&G)q.push(B)}for(let B of q)B.remove()}return J}else return}function w(z,G){if(!z||!Array.isArray(z))throw Error("first argument to memo() must be an array of values to compare");if(typeof G!=="function")throw Error("second argument to memo() must be a function that returns a vode or props object");return G.__memo=z,G}function c(z){if(!z||typeof z!=="object")throw Error("createState() must be called with a state object");return z}function p(z){return z}function i(z){return z?Array.isArray(z)?z[0]:typeof z==="string"||z.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function R(z){if(Array.isArray(z)&&z.length>1&&z[1]&&!Array.isArray(z[1])){if(typeof z[1]==="object"&&z[1].nodeType!==Node.TEXT_NODE)return z[1]}return}function f(z){let G=b(z);if(G>0)return z.slice(G);return null}function r(z){let G=b(z);if(G<0)return 0;return z.length-G}function l(z,G){let Q=b(z);if(Q>0)return z[G+Q];else return}function b(z){return R(z)?z.length>2?2:-1:Array.isArray(z)&&z.length>1?1:-1}function M(z,G,Q){if(!G)return z;for(let J in G){let q=G[J];if(q&&typeof q==="object"){let B=z[J];if(B)if(Array.isArray(q))z[J]=[...q];else if(q instanceof Date&&B!==q)z[J]=new Date(q);else if(Array.isArray(B))z[J]=M({},q,Q);else if(typeof B==="object")M(z[J],q,Q);else z[J]=M({},q,Q);else if(Array.isArray(q))z[J]=[...q];else if(q instanceof Date)z[J]=new Date(q);else z[J]=M({},q,Q)}else if(q===void 0&&Q)delete z[J];else z[J]=q}return z}function K(z,G,Q,J,q,B,U){B=C(z,B,q);let Z=!B||typeof B==="number"||typeof B==="boolean";if(B===q||!q&&Z)return q;let O=q?.nodeType===Node.TEXT_NODE,X=O?q:q?.node;if(Z){X?.onUnmount&&G(X.onUnmount(X)),X?.remove();return}let j=!Z&&y(B),E=!Z&&g(B),T=!!B&&typeof B!=="string"&&!!(B?.node||B?.nodeType===Node.TEXT_NODE);if(!j&&!E&&!T&&!q)throw Error("Invalid vode: "+typeof B+" "+JSON.stringify(B));else if(T&&j)B=B.wholeText;else if(T&&E)B=[...B];if(O&&j){if(X.nodeValue!==B)X.nodeValue=B;return q}if(j&&(!X||!O)){let L=document.createTextNode(B);if(X)X.onUnmount&&G(X.onUnmount(X)),X.replaceWith(L);else if(Q.childNodes[J])Q.insertBefore(L,Q.childNodes[J]);else Q.appendChild(L);return L}if(E&&(!X||O||q[0]!==B[0])){let L=B;if(1 in L)L[1]=C(z,L[1],void 0);let I=R(B);U=I?.xmlns||U;let W=U?document.createElementNS(U,B[0]):document.createElement(B[0]);if(B.node=W,S(z,G,W,void 0,I),X)X.onUnmount&&G(X.onUnmount(X)),X.replaceWith(W);else if(Q.childNodes[J])Q.insertBefore(W,Q.childNodes[J]);else Q.appendChild(W);let F=f(B);if(F)for(let H=0;H<F.length;H++){let $=F[H],Y=K(z,G,W,H,void 0,$,U);B[I?H+2:H+1]=Y}return W.onMount&&G(W.onMount(W)),B}if(!O&&E&&q[0]===B[0]){B.node=X;let L=B,I=q,W=!1;if(L[1]?.__memo){let $=L[1];if(L[1]=C(z,L[1],I[1]),$!==L[1]){let Y=R(B);S(z,G,X,R(q),Y),W=!!Y}}else{let $=R(B);S(z,G,X,R(q),$),W=!!$}let F=f(B),H=f(q);if(F)for(let $=0;$<F.length;$++){let Y=F[$],_=H&&H[$],N=K(z,G,X,$,_,Y,U);if(N)B[W?$+2:$+1]=N}if(H){let $=F?F.length:0;for(let Y=H.length-1;Y>=$;Y--)K(z,G,X,Y,H[Y],void 0,U)}return B}return}function g(z){return Array.isArray(z)&&z.length>0&&typeof z[0]==="string"}function y(z){return typeof z==="string"||z?.nodeType===Node.TEXT_NODE}function C(z,G,Q){if(typeof G!=="function")return G;let J=G?.__memo,q=Q?.__memo;if(Array.isArray(J)&&Array.isArray(q)&&J.length===q.length){let U=!0;for(let Z=0;Z<J.length;Z++)if(J[Z]!==q[Z]){U=!1;break}if(U)return Q}let B=k(G,z);if(typeof B==="object")B.__memo=G?.__memo;return B}function k(z,G){if(typeof z==="function")return k(z(G),G);else return z}function S(z,G,Q,J,q){if(!q&&!J)return;if(J)for(let B in J){let U=J[B],Z=q?.[B];if(U!==Z)if(q)q[B]=A(z,G,Q,B,U,Z);else A(z,G,Q,B,U,void 0)}if(q&&J){for(let B in q)if(!(B in J)){let U=q[B];q[B]=A(z,G,Q,B,void 0,U)}}else if(q)for(let B in q){let U=q[B];q[B]=A(z,G,Q,B,void 0,U)}}function A(z,G,Q,J,q,B){if(J==="style")if(!B)Q.style.cssText="";else if(typeof B==="string"){if(q!==B)Q.style.cssText=B}else if(q&&typeof q==="object"){for(let U in{...q,...B})if(!q||B[U]!==q[U])Q.style[U]=B[U];else if(q[U]&&!B[U])Q.style[U]=void 0}else for(let U in B)Q.style[U]=B[U];else if(J==="class")if(B)Q.setAttribute("class",P(B));else Q.removeAttribute("class");else if(J[0]==="o"&&J[1]==="n")if(B){let U=null;if(typeof B==="function"){let Z=B;U=(O)=>G(Z(z,O))}else if(typeof B==="object")U=()=>G(B);Q[J]=U}else Q[J]=null;else if(B!==null&&B!==void 0&&B!==!1)Q.setAttribute(J,B);else Q.removeAttribute(J);return B}function P(z){if(typeof z==="string")return z;else if(Array.isArray(z))return z.map(P).join(" ");else if(typeof z==="object")return Object.keys(z).filter((G)=>z[G]).join(" ");else return""}var n="a",d="abbr",t="address",a="area",o="article",e="aside",qq="audio",zq="b",Bq="base",Gq="bdi",Jq="bdo",Qq="blockquote",Uq="body",Xq="br",Zq="button",$q="canvas",Eq="caption",Lq="cite",Wq="code",jq="col",Hq="colgroup",Yq="data",Oq="datalist",Fq="dd",Mq="del",Tq="details",Rq="dfn",Dq="dialog",Iq="div",Kq="dl",Aq="dt",fq="em",Cq="embed",Sq="fieldset",bq="figcaption",Nq="figure",xq="footer",kq="form",Pq="h1",_q="h2",gq="h3",yq="h4",hq="h5",mq="h6",uq="head",Vq="header",vq="hgroup",wq="hr",cq="html",pq="i",iq="iframe",rq="img",lq="input",sq="ins",nq="kbd",dq="label",tq="legend",aq="li",oq="link",eq="main",qz="map",zz="mark",Bz="menu",Gz="meta",Jz="meter",Qz="nav",Uz="noscript",Xz="object",Zz="ol",$z="optgroup",Ez="option",Lz="output",Wz="p",jz="picture",Hz="pre",Yz="progress",Oz="q",Fz="rp",Mz="rt",Tz="ruby",Rz="s",Dz="samp",Iz="script",Kz="search",Az="section",fz="select",Cz="slot",Sz="small",bz="source",Nz="span",xz="strong",kz="style",Pz="sub",_z="summary",gz="sup",yz="table",hz="tbody",mz="td",uz="template",Vz="textarea",vz="tfoot",wz="th",cz="thead",pz="time",iz="title",rz="tr",lz="track",sz="u",nz="ul",dz="var",tz="video",az="wbr",oz="animate",ez="animateMotion",qB="animateTransform",zB="circle",BB="clipPath",GB="defs",JB="desc",QB="ellipse",UB="feBlend",XB="feColorMatrix",ZB="feComponentTransfer",$B="feComposite",EB="feConvolveMatrix",LB="feDiffuseLighting",WB="feDisplacementMap",jB="feDistantLight",HB="feDropShadow",YB="feFlood",OB="feFuncA",FB="feFuncB",MB="feFuncG",TB="feFuncR",RB="feGaussianBlur",DB="feImage",IB="feMerge",KB="feMergeNode",AB="feMorphology",fB="feOffset",CB="fePointLight",SB="feSpecularLighting",bB="feSpotLight",NB="feTile",xB="feTurbulence",kB="filter",PB="foreignObject",_B="g",gB="image",yB="line",hB="linearGradient",mB="marker",uB="mask",VB="metadata",vB="mpath",wB="path",cB="pattern",pB="polygon",iB="polyline",rB="radialGradient",lB="rect",sB="set",nB="stop",dB="svg",tB="switch",aB="symbol",oB="text",eB="textPath",qG="tspan",zG="use",BG="view",GG="annotation",JG="annotation-xml",QG="maction",UG="math",XG="merror",ZG="mfrac",$G="mi",EG="mmultiscripts",LG="mn",WG="mo",jG="mover",HG="mpadded",YG="mphantom",OG="mprescripts",FG="mroot",MG="mrow",TG="ms",RG="mspace",DG="msqrt",IG="mstyle",KG="msub",AG="msubsup",fG="msup",CG="mtable",SG="mtd",bG="mtext",NG="mtr",xG="munder",kG="munderover",PG="semantics";function gG(...z){if(!z||z.length===0)return null;if(z.length===1)return z[0];let G=z[0];for(let Q=1;Q<z.length;Q++){let J=G,q=z[Q];if(!J)G=q;else if(!q)continue;else if(typeof J==="string"&&typeof q==="string"){let B=J.split(" "),U=q.split(" "),Z=new Set([...B,...U]);G=Array.from(Z).join(" ").trim()}else if(typeof J==="string"&&Array.isArray(q)){let B=new Set([...q,...J.split(" ")]);G=Array.from(B).join(" ").trim()}else if(Array.isArray(J)&&typeof q==="string"){let B=new Set([...J,...q.split(" ")]);G=Array.from(B).join(" ").trim()}else if(Array.isArray(J)&&Array.isArray(q)){let B=new Set([...J,...q]);G=Array.from(B).join(" ").trim()}else if(typeof J==="string"&&typeof q==="object")G={[J]:!0,...q};else if(typeof J==="object"&&typeof q==="string")G={...J,[q]:!0};else if(typeof J==="object"&&typeof q==="object")G={...J,...q};else if(typeof J==="object"&&Array.isArray(q)){let B={...J};for(let U of q)B[U]=!0;G=B}else if(Array.isArray(J)&&typeof q==="object"){let B={};for(let U of J)B[U]=!0;for(let U of Object.keys(q))B[U]=q[U];G=B}else throw Error(`cannot merge classes of ${J} (${typeof J}) and ${q} (${typeof q})`)}return G}class h{state;path;keys;constructor(z,G){this.state=z;this.path=G;this.keys=G.split(".")}get(){let z=this.keys,G=this.state?this.state[z[0]]:void 0;for(let Q=1;Q<z.length&&!!G;Q++)G=G[z[Q]];return G}put(z){this.putDeep(z,this.state)}patch(z){if(Array.isArray(z)){let G=[];for(let Q of z)G.push(this.createPatch(Q));this.state.patch(G)}else this.state.patch(this.createPatch(z))}createPatch(z){let G={};return this.putDeep(z,G),G}putDeep(z,G){let Q=this.keys;if(Q.length>1){let J=0,q=G[Q[J]];if(typeof q!=="object"||q===null)G[Q[J]]=q={};for(J=1;J<Q.length-1;J++){let B=q;if(q=q[Q[J]],typeof q!=="object"||q===null)B[Q[J]]=q={}}q[Q[J]]=z}else if(typeof G[Q[0]]==="object"&&typeof z==="object")Object.assign(G[Q[0]],z);else G[Q[0]]=z}}class m{state;get;put;patch;constructor(z,G,Q,J){this.state=z;this.get=G;this.put=Q;this.patch=J}}export{u as vode,i as tag,R as props,gG as mergeClass,w as memo,x as hydrate,D as globals,v as defuse,c as createState,p as createPatch,b as childrenStart,f as children,r as childCount,l as child,V as app,az as WBR,BG as VIEW,tz as VIDEO,dz as VAR,zG as USE,nz as UL,sz as U,qG as TSPAN,lz as TRACK,rz as TR,iz as TITLE,pz as TIME,cz as THEAD,wz as TH,vz as TFOOT,eB as TEXTPATH,Vz as TEXTAREA,oB as TEXT,uz as TEMPLATE,mz as TD,hz as TBODY,yz as TABLE,aB as SYMBOL,tB as SWITCH,dB as SVG,gz as SUP,_z as SUMMARY,Pz as SUB,kz as STYLE,xz as STRONG,nB as STOP,Nz as SPAN,bz as SOURCE,Sz as SMALL,Cz as SLOT,sB as SET,PG as SEMANTICS,fz as SELECT,Az as SECTION,Kz as SEARCH,Iz as SCRIPT,Dz as SAMP,Rz as S,Tz as RUBY,Mz as RT,Fz as RP,lB as RECT,rB as RADIALGRADIENT,Oz as Q,Yz as PROGRESS,Hz as PRE,iB as POLYLINE,pB as POLYGON,jz as PICTURE,cB as PATTERN,wB as PATH,Wz as P,Lz as OUTPUT,Ez as OPTION,$z as OPTGROUP,Zz as OL,Xz as OBJECT,Uz as NOSCRIPT,Qz as NAV,kG as MUNDEROVER,xG as MUNDER,NG as MTR,bG as MTEXT,SG as MTD,CG as MTABLE,fG as MSUP,AG as MSUBSUP,KG as MSUB,IG as MSTYLE,DG as MSQRT,RG as MSPACE,TG as MS,MG as MROW,FG as MROOT,OG as MPRESCRIPTS,YG as MPHANTOM,vB as MPATH,HG as MPADDED,jG as MOVER,WG as MO,LG as MN,EG as MMULTISCRIPTS,$G as MI,ZG as MFRAC,Jz as METER,VB as METADATA,Gz as META,XG as MERROR,Bz as MENU,UG as MATH,uB as MASK,mB as MARKER,zz as MARK,qz as MAP,eq as MAIN,QG as MACTION,oq as LINK,hB as LINEARGRADIENT,yB as LINE,aq as LI,tq as LEGEND,dq as LABEL,h as KeyStateContext,nq as KBD,sq as INS,lq as INPUT,rq as IMG,gB as IMAGE,iq as IFRAME,pq as I,cq as HTML,wq as HR,vq as HGROUP,Vq as HEADER,uq as HEAD,mq as H6,hq as H5,yq as H4,gq as H3,_q as H2,Pq as H1,_B as G,kq as FORM,PB as FOREIGNOBJECT,xq as FOOTER,kB as FILTER,Nq as FIGURE,bq as FIGCAPTION,Sq as FIELDSET,xB as FETURBULENCE,NB as FETILE,bB as FESPOTLIGHT,SB as FESPECULARLIGHTING,CB as FEPOINTLIGHT,fB as FEOFFSET,AB as FEMORPHOLOGY,KB as FEMERGENODE,IB as FEMERGE,DB as FEIMAGE,RB as FEGAUSSIANBLUR,TB as FEFUNCR,MB as FEFUNCG,FB as FEFUNCB,OB as FEFUNCA,YB as FEFLOOD,HB as FEDROPSHADOW,jB as FEDISTANTLIGHT,WB as FEDISPLACEMENTMAP,LB as FEDIFFUSELIGHTING,EB as FECONVOLVEMATRIX,$B as FECOMPOSITE,ZB as FECOMPONENTTRANSFER,XB as FECOLORMATRIX,UB as FEBLEND,Cq as EMBED,fq as EM,QB as ELLIPSE,m as DelegateStateContext,Aq as DT,Kq as DL,Iq as DIV,Dq as DIALOG,Rq as DFN,Tq as DETAILS,JB as DESC,Mq as DEL,GB as DEFS,Fq as DD,Oq as DATALIST,Yq as DATA,Hq as COLGROUP,jq as COL,Wq as CODE,BB as CLIPPATH,Lq as CITE,zB as CIRCLE,Eq as CAPTION,$q as CANVAS,Zq as BUTTON,Xq as BR,Uq as BODY,Qq as BLOCKQUOTE,Jq as BDO,Gq as BDI,Bq as BASE,zq as B,qq as AUDIO,e as ASIDE,o as ARTICLE,a as AREA,JG as ANNOTATION_XML,GG as ANNOTATION,qB as ANIMATETRANSFORM,ez as ANIMATEMOTION,oz as ANIMATE,t as ADDRESS,d as ABBR,n as A};
package/dist/vode.mjs CHANGED
@@ -69,7 +69,9 @@ function app(container, state, dom, ...initialPatches) {
69
69
  } else {
70
70
  _vode.qSync = mergeState(_vode.qSync || {}, _vode.qAsync, false);
71
71
  _vode.qAsync = null;
72
- globals.currentViewTransition?.skipTransition();
72
+ try {
73
+ globals.currentViewTransition?.skipTransition();
74
+ } catch {}
73
75
  _vode.stats.syncRenderPatchCount++;
74
76
  _vode.renderSync();
75
77
  }
@@ -155,6 +157,34 @@ function app(container, state, dom, ...initialPatches) {
155
157
  }
156
158
  return _vode.patch;
157
159
  }
160
+ function defuse(container) {
161
+ if (container?._vode) {
162
+ let clearEvents = function(av) {
163
+ if (!av?.node)
164
+ return;
165
+ const p = props(av);
166
+ if (p) {
167
+ for (const key in p) {
168
+ if (key[0] === "o" && key[1] === "n") {
169
+ av.node[key] = null;
170
+ }
171
+ }
172
+ }
173
+ const kids = children(av);
174
+ if (kids) {
175
+ for (let child of kids) {
176
+ clearEvents(child);
177
+ }
178
+ }
179
+ };
180
+ const v = container._vode;
181
+ delete container["_vode"];
182
+ Object.defineProperty(v.state, "patch", { value: undefined });
183
+ Object.defineProperty(v, "renderSync", { value: () => {} });
184
+ Object.defineProperty(v, "renderAsync", { value: () => {} });
185
+ clearEvents(v.vode);
186
+ }
187
+ }
158
188
  function hydrate(element, prepareForRender) {
159
189
  if (element?.nodeType === Node.TEXT_NODE) {
160
190
  if (element.nodeValue?.trim() !== "")
@@ -849,6 +879,7 @@ export {
849
879
  memo,
850
880
  hydrate,
851
881
  globals,
882
+ defuse,
852
883
  createState,
853
884
  createPatch,
854
885
  childrenStart,
package/package.json CHANGED
@@ -1,17 +1,20 @@
1
1
  {
2
2
  "name": "@ryupold/vode",
3
- "version": "1.3.5",
3
+ "version": "1.4.0",
4
4
  "description": "a minimalist web framework",
5
5
  "author": "Michael Scherbakow (ryupold)",
6
6
  "license": "MIT",
7
7
  "icon": "icon.webp",
8
8
  "keywords": [
9
+ "minimal",
9
10
  "web",
10
11
  "frontend",
11
- "state",
12
- "minimal",
13
12
  "framework",
14
- "typescript"
13
+ "library",
14
+ "state",
15
+ "simple",
16
+ "flow",
17
+ "lightweight"
15
18
  ],
16
19
  "repository": {
17
20
  "type": "git",
package/src/vode.ts CHANGED
@@ -34,7 +34,7 @@ export type Props<S> = Partial<
34
34
  > & {
35
35
  [_: string]: unknown,
36
36
  class?: ClassProp,
37
- style?: StyleProp | string,
37
+ style?: StyleProp,
38
38
  /** called after the element was attached */
39
39
  onMount?: MountFunction<S>,
40
40
  /** called before the element is detached */
@@ -52,9 +52,9 @@ export type ClassProp =
52
52
  | string[] // ["class1", "class2"]
53
53
  | Record<string, boolean | undefined | null>; // { class1: true, class2: false }
54
54
 
55
- export type StyleProp = Record<number, never> & {
56
- [K in keyof CSSStyleDeclaration]?: CSSStyleDeclaration[K] | null
57
- };
55
+ export type StyleProp =
56
+ | (Record<number, never> & { [K in keyof CSSStyleDeclaration]?: CSSStyleDeclaration[K] | null })
57
+ | string;
58
58
 
59
59
  export type EventsMap =
60
60
  & { [K in keyof HTMLElementEventMap as `on${K}`]: HTMLElementEventMap[K] }
@@ -180,7 +180,7 @@ export function app<S = PatchableState>(container: Element, state: Omit<S, "patc
180
180
  } else { //when [] is patched: 1. skip current animation 2. merge all queued async patches into synced queue
181
181
  _vode.qSync = mergeState(_vode.qSync || {}, _vode.qAsync, false);
182
182
  _vode.qAsync = null;
183
- globals.currentViewTransition?.skipTransition();
183
+ try { globals.currentViewTransition?.skipTransition(); } catch { }
184
184
  _vode.stats.syncRenderPatchCount++;
185
185
  _vode.renderSync();
186
186
  }
@@ -281,6 +281,41 @@ export function app<S = PatchableState>(container: Element, state: Omit<S, "patc
281
281
  return _vode.patch;
282
282
  }
283
283
 
284
+ /** unregister vode app from container and free resources
285
+ * removes all event listeners registered by vode
286
+ * removes patch function from state object
287
+ * leaves the DOM as is
288
+ */
289
+ export function defuse(container: ContainerNode<any>) {
290
+ if (container?._vode) {
291
+ function clearEvents(av: AttachedVode<PatchableState>) {
292
+ if (!av?.node) return;
293
+
294
+ const p = props(av);
295
+ if (p) {
296
+ for (const key in p) {
297
+ if (key[0] === 'o' && key[1] === 'n') {
298
+ (<any>av.node)[key] = null;
299
+ }
300
+ }
301
+ }
302
+ const kids = children(av);
303
+ if (kids) {
304
+ for (let child of kids) {
305
+ clearEvents(child as AttachedVode<PatchableState>);
306
+ }
307
+ }
308
+ }
309
+
310
+ const v = container._vode;
311
+ delete (<any>container)["_vode"];
312
+ Object.defineProperty(v.state, "patch", { value: undefined });
313
+ Object.defineProperty(v, "renderSync", { value: () => { } });
314
+ Object.defineProperty(v, "renderAsync", { value: () => { } });
315
+ clearEvents(v.vode);
316
+ }
317
+ }
318
+
284
319
  /** return vode representation of given DOM node */
285
320
  export function hydrate<S = PatchableState>(element: Element | Text, prepareForRender?: boolean): Vode<S> | string | AttachedVode<S> | undefined {
286
321
  if ((element as Text)?.nodeType === Node.TEXT_NODE) {