@ryupold/vode 1.8.4 → 1.8.6
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/.github/workflows/publish.yml +13 -0
- package/.github/workflows/tests.yml +17 -0
- package/README.md +55 -5
- package/dist/vode.cjs.min.js +2 -2
- package/dist/vode.d.ts +5 -0
- package/dist/vode.es5.min.js +4 -4
- package/dist/vode.js +100 -20
- package/dist/vode.min.js +1 -1
- package/dist/vode.min.mjs +1 -1
- package/dist/vode.mjs +100 -20
- package/package.json +4 -3
- package/src/merge-style.ts +4 -1
- package/src/vode.ts +110 -26
- package/test/helper.ts +168 -0
- package/test/index.ts +82 -0
- package/test/mocks.ts +111 -0
- package/test/tests-app.ts +226 -0
- package/test/tests-children.ts +69 -0
- package/test/tests-createPatch.ts +28 -0
- package/test/tests-createState.ts +43 -0
- package/test/tests-defuse.ts +74 -0
- package/test/tests-hydrate.ts +68 -0
- package/test/tests-memo.ts +119 -0
- package/test/tests-mergeClass.ts +63 -0
- package/test/tests-mergeProps.ts +43 -0
- package/test/tests-mergeStyle.ts +39 -0
- package/test/tests-mount-unmount.ts +1140 -0
- package/test/tests-props.ts +34 -0
- package/test/tests-state-context.ts +106 -0
- package/test/tests-tag.ts +33 -0
- package/test/tests-vode.ts +27 -0
- package/tsconfig.test.json +18 -0
|
@@ -14,9 +14,20 @@ permissions:
|
|
|
14
14
|
contents: read
|
|
15
15
|
|
|
16
16
|
jobs:
|
|
17
|
+
run-tests:
|
|
18
|
+
name: Check Unit Tests
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-node@v6
|
|
23
|
+
with:
|
|
24
|
+
registry-url: "https://registry.npmjs.org"
|
|
25
|
+
- run: npm ci
|
|
26
|
+
- run: npm run test
|
|
17
27
|
|
|
18
28
|
build-and-publish-to-npm:
|
|
19
29
|
name: Build and Publish to NPM
|
|
30
|
+
needs: run-tests
|
|
20
31
|
runs-on: ubuntu-latest
|
|
21
32
|
steps:
|
|
22
33
|
- uses: actions/checkout@v4
|
|
@@ -43,6 +54,7 @@ jobs:
|
|
|
43
54
|
|
|
44
55
|
build-and-publish-to-github:
|
|
45
56
|
name: Build and Publish to Github
|
|
57
|
+
needs: run-tests
|
|
46
58
|
runs-on: ubuntu-latest
|
|
47
59
|
steps:
|
|
48
60
|
- uses: actions/checkout@v4
|
|
@@ -68,6 +80,7 @@ jobs:
|
|
|
68
80
|
|
|
69
81
|
build-and-publish-to-chimps:
|
|
70
82
|
name: Build and Publish to Chimps
|
|
83
|
+
needs: run-tests
|
|
71
84
|
runs-on: ubuntu-latest
|
|
72
85
|
steps:
|
|
73
86
|
- uses: actions/checkout@v4
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
name: Unit Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
run-tests:
|
|
9
|
+
name: Check Unit Tests
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
- uses: actions/setup-node@v6
|
|
14
|
+
with:
|
|
15
|
+
registry-url: "https://registry.npmjs.org"
|
|
16
|
+
- run: npm ci
|
|
17
|
+
- run: npm run test
|
package/README.md
CHANGED
|
@@ -347,7 +347,7 @@ const CompBar = (s) => [DIV, { class: "container" },
|
|
|
347
347
|
class: { bar: s.pointing }
|
|
348
348
|
}, "Click me!"],
|
|
349
349
|
|
|
350
|
-
// components can be used as child-vodes, they are called
|
|
350
|
+
// components can be used as child-vodes, they are called lazily on render
|
|
351
351
|
CompFoo,
|
|
352
352
|
// or this way
|
|
353
353
|
CompFoo(s),
|
|
@@ -539,14 +539,63 @@ children(myVode); // [[SPAN, 'hello'], [STRONG, 'world']]
|
|
|
539
539
|
const asVode = hydrate(document.getElementById('my-element'));
|
|
540
540
|
```
|
|
541
541
|
|
|
542
|
+
#### onMount & onUnmount
|
|
543
|
+
|
|
542
544
|
Additionally to the standard HTML attributes, you can define 2 special event attributes:
|
|
543
545
|
`onMount(State, Element)` and `onUnmount(State, Element)` in the vode props.
|
|
544
546
|
These are called when the element is created or removed during rendering.
|
|
545
547
|
They receive the `State` as the first argument and the DOM element as the second argument.
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
548
|
+
|
|
549
|
+
```typescript
|
|
550
|
+
const container = document.createElement(DIV);
|
|
551
|
+
const state = createState({
|
|
552
|
+
startTime: 0,
|
|
553
|
+
inputReady: false,
|
|
554
|
+
showInput: true,
|
|
555
|
+
showTimer: true
|
|
556
|
+
});
|
|
557
|
+
type State = typeof state;
|
|
558
|
+
|
|
559
|
+
const patch = app<State>(container, state, (s) =>
|
|
560
|
+
[DIV,
|
|
561
|
+
s.showInput && [INPUT, {
|
|
562
|
+
type: 'text',
|
|
563
|
+
placeholder: 'Auto-focused on mount',
|
|
564
|
+
onMount: (s: State, ele: HTMLElement) => {
|
|
565
|
+
console.log('Input mounted');
|
|
566
|
+
(ele as HTMLInputElement).focus();
|
|
567
|
+
return { inputReady: true };
|
|
568
|
+
},
|
|
569
|
+
onUnmount: (s: State, ele: HTMLElement) => {
|
|
570
|
+
console.log('Input removed');
|
|
571
|
+
return { inputReady: false };
|
|
572
|
+
}
|
|
573
|
+
}],
|
|
574
|
+
|
|
575
|
+
s.showTimer && [P, {
|
|
576
|
+
onMount: (s: State, ele: HTMLElement) => {
|
|
577
|
+
console.log('Timer started');
|
|
578
|
+
s.patch({ startTime: Date.now() });
|
|
579
|
+
},
|
|
580
|
+
onUnmount: (s: State, ele: HTMLElement) => {
|
|
581
|
+
console.log('Timer stopped after', Date.now() - s.startTime, 'ms');
|
|
582
|
+
}
|
|
583
|
+
}, 'Mount/unmount lifecycle demo']
|
|
584
|
+
]
|
|
585
|
+
);
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
// OUTPUT:
|
|
589
|
+
|
|
590
|
+
// 1. Input mounted
|
|
591
|
+
// 2. Timer started
|
|
592
|
+
patch({ showInput: false });
|
|
593
|
+
// 3. Input removed
|
|
594
|
+
patch({ showTimer: false });
|
|
595
|
+
// 4. Timer stopped after XY ms
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
Like the other events (onclick, onmouseenter, etc.), these can also be attached conditionally and will be added or removed on the fly during rendering. Returning a patch object from these events will patch the same way as with events.
|
|
550
599
|
|
|
551
600
|
### SVG & MathML
|
|
552
601
|
SVG and MathML elements are supported but need the namespace defined in properties.
|
|
@@ -577,6 +626,7 @@ const CompMathML = (s) =>
|
|
|
577
626
|
#### state context
|
|
578
627
|
|
|
579
628
|
The state context utilities can help creating shareable type safe components.
|
|
629
|
+
These do not need to know the 'full' state of the app, but only the part they are interested in. This can be especially useful for differently deep nested components that need access to the same part of the state.
|
|
580
630
|
|
|
581
631
|
```typescript
|
|
582
632
|
import { app, context, createState, SubContext, Vode, DIV, FORM, H1, OPTION, P, SELECT } from "@ryupold/vode";
|
package/dist/vode.cjs.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LINK=exports.LINEARGRADIENT=exports.LINE=exports.LI=exports.LEGEND=exports.LABEL=exports.KBD=exports.INS=exports.INPUT=exports.IMG=exports.IMAGE=exports.IFRAME=exports.I=exports.HTML=exports.HR=exports.HGROUP=exports.HEADER=exports.HEAD=exports.H6=exports.H5=exports.H4=exports.H3=exports.H2=exports.H1=exports.G=exports.FORM=exports.FOREIGNOBJECT=exports.FOOTER=exports.FILTER=exports.FIGURE=exports.FIGCAPTION=exports.FIELDSET=exports.FETURBULENCE=exports.FETILE=exports.FESPOTLIGHT=exports.FESPECULARLIGHTING=exports.FEPOINTLIGHT=exports.FEOFFSET=exports.FEMORPHOLOGY=exports.FEMERGENODE=exports.FEMERGE=exports.FEIMAGE=exports.FEGAUSSIANBLUR=exports.FEFUNCR=exports.FEFUNCG=exports.FEFUNCB=exports.FEFUNCA=exports.FEFLOOD=exports.FEDROPSHADOW=exports.FEDISTANTLIGHT=exports.FEDISPLACEMENTMAP=exports.FEDIFFUSELIGHTING=exports.FECONVOLVEMATRIX=exports.FECOMPOSITE=exports.FECOMPONENTTRANSFER=exports.FECOLORMATRIX=exports.FEBLEND=exports.EMBED=exports.EM=exports.ELLIPSE=exports.DT=exports.DL=exports.DIV=exports.DIALOG=exports.DFN=exports.DETAILS=exports.DESC=exports.DEL=exports.DEFS=exports.DD=exports.DATALIST=exports.DATA=exports.COLGROUP=exports.COL=exports.CODE=exports.CLIPPATH=exports.CITE=exports.CIRCLE=exports.CAPTION=exports.CANVAS=exports.BUTTON=exports.BR=exports.BODY=exports.BLOCKQUOTE=exports.BDO=exports.BDI=exports.BASE=exports.B=exports.AUDIO=exports.ASIDE=exports.ARTICLE=exports.AREA=exports.ANNOTATION_XML=exports.ANNOTATION=exports.ANIMATETRANSFORM=exports.ANIMATEMOTION=exports.ANIMATE=exports.ADDRESS=exports.ABBR=exports.A=void 0,exports.VIEW=exports.VIDEO=exports.VAR=exports.USE=exports.UL=exports.U=exports.TSPAN=exports.TRACK=exports.TR=exports.TITLE=exports.TIME=exports.THEAD=exports.TH=exports.TFOOT=exports.TEXTPATH=exports.TEXTAREA=exports.TEXT=exports.TEMPLATE=exports.TD=exports.TBODY=exports.TABLE=exports.SYMBOL=exports.SWITCH=exports.SVG=exports.SUP=exports.SUMMARY=exports.SUB=exports.STYLE=exports.STRONG=exports.STOP=exports.SPAN=exports.SOURCE=exports.SMALL=exports.SLOT=exports.SET=exports.SEMANTICS=exports.SELECT=exports.SECTION=exports.SEARCH=exports.SCRIPT=exports.SAMP=exports.S=exports.RUBY=exports.RT=exports.RP=exports.RECT=exports.RADIALGRADIENT=exports.Q=exports.PROGRESS=exports.PRE=exports.POLYLINE=exports.POLYGON=exports.PICTURE=exports.PATTERN=exports.PATH=exports.P=exports.OUTPUT=exports.OPTION=exports.OPTGROUP=exports.OL=exports.OBJECT=exports.NOSCRIPT=exports.NAV=exports.MUNDEROVER=exports.MUNDER=exports.MTR=exports.MTEXT=exports.MTD=exports.MTABLE=exports.MSUP=exports.MSUBSUP=exports.MSUB=exports.MSTYLE=exports.MSQRT=exports.MSPACE=exports.MS=exports.MROW=exports.MROOT=exports.MPRESCRIPTS=exports.MPHANTOM=exports.MPATH=exports.MPADDED=exports.MOVER=exports.MO=exports.MN=exports.MMULTISCRIPTS=exports.MI=exports.MFRAC=exports.METER=exports.METADATA=exports.META=exports.MERROR=exports.MENU=exports.MATH=exports.MASK=exports.MARKER=exports.MARK=exports.MAP=exports.MAIN=exports.MACTION=void 0,exports.WBR=void 0,exports.app=app,exports.child=child,exports.childCount=childCount,exports.children=children,exports.childrenStart=childrenStart,exports.context=context,exports.createPatch=createPatch,exports.createState=createState,exports.defuse=defuse,exports.globals=void 0,exports.hydrate=hydrate,exports.memo=memo,exports.mergeClass=mergeClass,exports.mergeProps=mergeProps,exports.mergeStyle=mergeStyle,exports.props=props,exports.tag=tag,exports.vode=vode;function _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _regenerator(){function b(a,b,f,g){var h=b&&b.prototype instanceof d?b:d,c=Object.create(h.prototype);return _regeneratorDefine2(c,"_invoke",function(a,b,g){function h(a,b){for(q=a,s=b,e=0;!w&&t&&!c&&e<v.length;e++){var c,f=v[e],g=p.p,h=f[2];3<a?(c=h===b)&&(s=f[(q=f[4])?5:(q=3,3)],f[4]=f[5]=j):f[0]<=g&&((c=2>a&&g<f[1])?(q=0,p.v=b,p.n=f[1]):g<h&&(c=3>a||f[0]>b||b>h)&&(f[4]=a,f[5]=b,p.n=h,q=0))}if(c||1<a)return m;throw w=!0,b}var k,q,s,t=0,v=g||[],w=!1,p={p:0,n:0,v:j,a:h,f:h.bind(j,4),d:function c(a,b){return k=a,q=0,s=j,p.n=b,m}};return function(c,d,f){if(1<t)throw TypeError("Generator is already running");for(w&&1===d&&h(d,f),q=d,s=f;(e=2>q?j:s)||!w;){k||(q?3>q?(1<q&&(p.n=-1),h(q,s)):p.n=s:p.v=s);try{if(t=2,k){if(q||(c="next"),e=k[c]){if(!(e=e.call(k,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,2>q&&(q=0)}else 1===q&&(e=k["return"])&&e.call(k),2>q&&(s=TypeError("The iterator does not provide a '"+c+"' method"),q=1);k=j}else if((e=(w=0>p.n)?s:a.call(b,p))!==m)break}catch(a){k=j,q=1,s=a}finally{t=1}}return{value:e,done:w}}}(a,f,g),!0),c}function d(){}function g(){}function h(){}function i(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,h):(a.__proto__=h,_regeneratorDefine2(a,l,"GeneratorFunction")),a.prototype=Object.create(c),a}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var j,e,f="function"==typeof Symbol?Symbol:{},k=f.iterator||"@@iterator",l=f.toStringTag||"@@toStringTag",m={};e=Object.getPrototypeOf;var a=[][k]?e(e([][k]())):(_regeneratorDefine2(e={},k,function(){return this}),e),c=h.prototype=d.prototype=Object.create(a);return g.prototype=h,_regeneratorDefine2(c,"constructor",h),_regeneratorDefine2(h,"constructor",g),g.displayName="GeneratorFunction",_regeneratorDefine2(h,l,"GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,l,"Generator"),_regeneratorDefine2(c,k,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function a(){return{w:b,m:i}})()}function _regeneratorDefine2(a,b,c,d){var f=Object.defineProperty;try{f({},"",{})}catch(a){f=0}_regeneratorDefine2=function e(a,b,c,d){function g(b,c){_regeneratorDefine2(a,b,function(a){return this._invoke(b,c,a)})}b?f?f(a,b,{value:c,enumerable:!d,configurable:!d,writable:!d}):a[b]=c:(g("next",0),g("throw",1),g("return",2))},_regeneratorDefine2(a,b,c,d)}function _createForOfIteratorHelper(b,c){var d="undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(!d){if(Array.isArray(b)||(d=_unsupportedIterableToArray(b))||c&&b&&"number"==typeof b.length){d&&(b=d);var e=0,f=function a(){};return{s:f,n:function a(){return e>=b.length?{done:!0}:{done:!1,value:b[e++]}},e:function b(a){throw a},f:f}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g,h=!0,i=!1;return{s:function a(){d=d.call(b)},n:function a(){var b=d.next();return h=b.done,b},e:function b(a){i=!0,g=a},f:function a(){try{h||null==d["return"]||d["return"]()}finally{if(i)throw g}}}}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}// src/vode.ts
|
|
2
|
-
var globals=exports.globals={currentViewTransition:void 0,requestAnimationFrame:!window.requestAnimationFrame?function(a){return a()}:window.requestAnimationFrame.bind(window),startViewTransition:!document.startViewTransition?null:document.startViewTransition.bind(document)};function vode(a,b){if(!a)throw new Error("first argument to vode() must be a tag name or a vode");for(var c=arguments.length,d=Array(2<c?c-2:0),e=2;e<c;e++)d[e-2]=arguments[e];return Array.isArray(a)?a:b?[a,b].concat(d):[a].concat(d)}function app(a,b,c){function d(b){var d=Date.now(),e=c(i.state);i.vode=render(i.state,a.parentElement,0,0,i.vode,e),a.tagName.toUpperCase()!==e[0].toUpperCase()&&(a=i.vode.node,a._vode=i),b||(i.stats.lastSyncRenderTime=Date.now()-d,i.stats.syncRenderCount++,i.isRendering=!1,i.qSync&&i.renderSync())}for(var e,f=arguments.length,g=Array(3<f?f-3:0),h=3;h<f;h++)g[h-3]=arguments[h];if(!(null!==(e=a)&&void 0!==e&&e.parentElement))throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!b||"object"!==_typeof(b))throw new Error("second argument to app() must be a state object");if("function"!=typeof c)throw new Error("third argument to app() must be a function that returns a vode");var i={syncRenderer:globals.requestAnimationFrame,asyncRenderer:globals.startViewTransition,qSync:null,qAsync:null,stats:{lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0}},j=b;"patch"in b&&"function"==typeof b.patch&&Array.isArray(b.patch.initialPatches)&&(g=[].concat(_toConsumableArray(b.patch.initialPatches),_toConsumableArray(g))),Object.defineProperty(b,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function c(a,b){var d,e,f,g,h,k,l;return _regenerator().w(function(c){for(;1;)switch(c.p=c.n){case 0:if(a&&("function"==typeof a||"object"===_typeof(a))){c.n=1;break}return c.a(2);case 1:if(i.stats.patchCount++,!(null!==a&&void 0!==a&&a.next)){c.n=12;break}return d=a,i.stats.liveEffectCount++,c.p=2,c.n=3,d.next();case 3:e=c.v;case 4:if(!1!==e.done){c.n=9;break}return i.stats.liveEffectCount++,c.p=5,j.patch(e.value,b),c.n=6,d.next();case 6:e=c.v;case 7:return c.p=7,i.stats.liveEffectCount--,c.f(7);case 8:c.n=4;break;case 9:j.patch(e.value,b);case 10:return c.p=10,i.stats.liveEffectCount--,c.f(10);case 11:c.n=22;break;case 12:if(!a.then){c.n=17;break}return i.stats.liveEffectCount++,c.p=13,c.n=14,a;case 14:f=c.v,j.patch(f,b);case 15:return c.p=15,i.stats.liveEffectCount--,c.f(15);case 16:c.n=22;break;case 17:if(!Array.isArray(a)){c.n=18;break}if(0<a.length){g=_createForOfIteratorHelper(a);try{for(g.s();!(h=g.n()).done;)k=h.value,j.patch(k,!document.hidden&&!!i.asyncRenderer)}catch(a){g.e(a)}finally{g.f()}}else{i.qSync=mergeState(i.qSync||{},i.qAsync,!1),i.qAsync=null;try{null===(l=globals.currentViewTransition)||void 0===l||l.skipTransition()}catch(a){}i.stats.syncRenderPatchCount++,i.renderSync()}c.n=22;break;case 18:if("function"!=typeof a){c.n=19;break}j.patch(a(i.state),b),c.n=22;break;case 19:if(!b){c.n=21;break}return i.stats.asyncRenderPatchCount++,i.qAsync=mergeState(i.qAsync||{},a,!1),c.n=20,i.renderAsync();case 20:c.n=22;break;case 21:i.stats.syncRenderPatchCount++,i.qSync=mergeState(i.qSync||{},a,!1),i.renderSync();case 22:return c.a(2)}},c,null,[[13,,15,16],[5,,7,8],[2,,10,11]])}));return a}()});var k=d.bind(null,!1),l=d.bind(null,!0);Object.defineProperty(i,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:function a(){i.isRendering||!i.qSync||(i.isRendering=!0,i.state=mergeState(i.state,i.qSync,!0),i.qSync=null,i.syncRenderer(k))}}),Object.defineProperty(i,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function a(){var b,c,d;return _regenerator().w(function(a){for(;1;)switch(a.p=a.n){case 0:if(!i.isAnimating&&i.qAsync){a.n=1;break}return a.a(2);case 1:return a.n=2,null===(b=globals.currentViewTransition)||void 0===b?void 0:b.updateCallbackDone;case 2:if(!(i.isAnimating||!i.qAsync||document.hidden)){a.n=3;break}return a.a(2);case 3:return i.isAnimating=!0,c=Date.now(),a.p=4,i.state=mergeState(i.state,i.qAsync,!0),i.qAsync=null,globals.currentViewTransition=i.asyncRenderer(l),a.n=5,null===(d=globals.currentViewTransition)||void 0===d?void 0:d.updateCallbackDone;case 5:return a.p=5,i.stats.lastAsyncRenderTime=Date.now()-c,i.stats.asyncRenderCount++,i.isAnimating=!1,a.f(5);case 6:i.qAsync&&i.renderAsync();case 7:return a.a(2)}},a,null,[[4,,5,6]])}));return a}()}),i.state=j;var m=a;m._vode=i;var n=Array.from(a.parentElement.children).indexOf(a);i.vode=render(b,a.parentElement,n,n,hydrate(a,!0),c(b));var o,p=_createForOfIteratorHelper(g);try{for(p.s();!(o=p.n()).done;){var q=o.value;j.patch(q)}}catch(a){p.e(a)}finally{p.f()}return function(a){return j.patch(a)}}function defuse(a){if(null!==a&&void 0!==a&&a._vode){var b=function c(a){if(null!==a&&void 0!==a&&a.node){var d=props(a);if(d){for(var e in d)"o"===e[0]&&"n"===e[1]&&(a.node[e]=null);a.node["catch"]=null}if(a.node._vode)defuse(a.node);else{var f=children(a);if(f){var g,h=_createForOfIteratorHelper(f);try{for(h.s();!(g=h.n()).done;){var i=g.value;b(i)}}catch(a){h.e(a)}finally{h.f()}}}}},c=b,d=a._vode;delete a._vode,Object.defineProperty(d.state,"patch",{value:void 0}),Object.defineProperty(d,"renderSync",{value:function a(){}}),Object.defineProperty(d,"renderAsync",{value:function a(){}}),b(d.vode)}else{var e,f=_createForOfIteratorHelper(a.children);try{for(f.s();!(e=f.n()).done;){var g=e.value;defuse(g)}}catch(a){f.e(a)}finally{f.f()}}}function hydrate(b,c){if((null===b||void 0===b?void 0:b.nodeType)===Node.TEXT_NODE){var d;return""===(null===(d=b.nodeValue)||void 0===d?void 0:d.trim())?void 0:c?b:b.nodeValue}if(b.nodeType!==Node.COMMENT_NODE&&b.nodeType===Node.ELEMENT_NODE){var e=b.tagName.toLowerCase(),f=[e];if(c&&(f.node=b),null!==b&&void 0!==b&&b.hasAttributes()){var g,h={},i=b.attributes,j=_createForOfIteratorHelper(i);try{for(j.s();!(g=j.n()).done;){var k=g.value;h[k.name]=k.value}}catch(a){j.e(a)}finally{j.f()}f.push(h)}if(b.hasChildNodes()){var l,m=[],n=_createForOfIteratorHelper(b.childNodes);try{for(n.s();!(l=n.n()).done;){var o=l.value,p=o&&hydrate(o,c);p?f.push(p):o&&c&&m.push(o)}}catch(a){n.e(a)}finally{n.f()}for(var q,r=0,s=m;r<s.length;r++)q=s[r],q.remove()}return f}}function memo(a,b){if(!a||!Array.isArray(a))throw new Error("first argument to memo() must be an array of values to compare");if("function"!=typeof b)throw new Error("second argument to memo() must be a function that returns a vode or props object");return b.__memo=a,b}function createState(a){if(!a||"object"!==_typeof(a))throw new Error("createState() must be called with a state object");return"patch"in a||Object.defineProperty(a,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function c(b){var d=a;Array.isArray(d.patch.initialPatches)||(d.patch.initialPatches=[]),d.patch.initialPatches.push(b)}}),a}function createPatch(a){return a}function tag(a){return!a?void 0:Array.isArray(a)?a[0]:"string"==typeof a||a.nodeType===Node.TEXT_NODE?"#text":void 0}function props(a){return Array.isArray(a)&&1<a.length&&a[1]&&!Array.isArray(a[1])&&"object"===_typeof(a[1])&&a[1].nodeType!==Node.TEXT_NODE?a[1]:void 0}function children(a){var b=childrenStart(a);return 0<b?a.slice(b):null}function childCount(a){var b=childrenStart(a);return 0>b?0:a.length-b}function child(a,b){var c=childrenStart(a);return 0<c?a[b+c]:void 0}function childrenStart(a){return props(a)?2<a.length?2:-1:Array.isArray(a)&&1<a.length?1:-1}function mergeState(a,b,c){if(!b)return a;for(var d in b){var e=b[d];if(e&&"object"===_typeof(e)){var f=a[d];f?Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date&&f!==e?a[d]=new Date(e):Array.isArray(f)?a[d]=mergeState({},e,c):"object"===_typeof(f)?mergeState(a[d],e,c):a[d]=mergeState({},e,c):Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date?a[d]=new Date(e):a[d]=mergeState({},e,c)}else void 0===e&&c?delete a[d]:a[d]=e}return a}function render(a,b,c,d,e,f,g){try{var h,j;f=remember(a,f,e);var k=!f||"number"==typeof f||"boolean"==typeof f;if(f===e||!e&&k)return e;var l=(null===e||void 0===e?void 0:e.nodeType)===Node.TEXT_NODE,m=l?e:null===e||void 0===e?void 0:e.node;if(k)return(null===m||void 0===m?void 0:m.onUnmount)&&a.patch(m.onUnmount(m)),void(null===m||void 0===m||m.remove());var n=!k&&isTextVode(f),o=!k&&isNaturalVode(f),p=!!f&&"string"!=typeof f&&!!(null!==(h=f)&&void 0!==h&&h.node||(null===(j=f)||void 0===j?void 0:j.nodeType)===Node.TEXT_NODE);if(!n&&!o&&!p&&!e)throw new Error("Invalid vode: "+_typeof(f)+" "+JSON.stringify(f));else p&&n?f=f.wholeText:p&&o&&(f=_toConsumableArray(f));if(l&&n)return m.nodeValue!==f&&(m.nodeValue=f),e;if(n&&(!m||!l)){var q=document.createTextNode(f);if(m)m.onUnmount&&a.patch(m.onUnmount(m)),m.replaceWith(q);else{for(var r,s=!1,t=d;t<b.childNodes.length;t++)if(r=b.childNodes[t],r){r.before(q,r),s=!0;break}s||b.appendChild(q)}return q}if(o&&(!m||l||e[0]!==f[0])){var u=f;1 in u&&(u[1]=remember(a,u[1],void 0));var v=props(f);void 0!==(null===v||void 0===v?void 0:v.xmlns)&&(g=v.xmlns);var w=g?document.createElementNS(g,f[0]):document.createElement(f[0]);if(f.node=w,patchProperties(a,w,void 0,v,null!==g&&void 0!==g?g:null),!!v&&"catch"in v&&(f.node["catch"]=null,f.node.removeAttribute("catch")),m)m.onUnmount&&a.patch(m.onUnmount(m)),m.replaceWith(w);else{for(var x,y=!1,z=d;z<b.childNodes.length;z++)if(x=b.childNodes[z],x){x.before(w,x),y=!0;break}y||b.appendChild(w)}var A=children(f);if(A)for(var B=v?2:1,C=0,D=0;D<A.length;D++){var E=A[D],F=render(a,w,D,C,void 0,E,null!==g&&void 0!==g?g:null);f[D+B]=F,F&&C++}return w.onMount&&a.patch(w.onMount(w)),f}if(!l&&o&&e[0]===f[0]){var G;f.node=m;var H=f,I=e,J=props(f),K=props(e);if(void 0!==(null===J||void 0===J?void 0:J.xmlns)&&(g=J.xmlns),null!==(G=H[1])&&void 0!==G&&G.__memo){var L=H[1];H[1]=remember(a,H[1],I[1]),L!==H[1]&&patchProperties(a,m,K,J,g)}else patchProperties(a,m,K,J,g);!(null!==J&&void 0!==J&&J["catch"])||(null===K||void 0===K?void 0:K["catch"])===J["catch"]||(f.node["catch"]=null,f.node.removeAttribute("catch"));var M=children(f),N=children(e);if(M)for(var O=J?2:1,P=0,Q=0;Q<M.length;Q++){var R=M[Q],S=N&&N[Q],T=render(a,m,Q,P,S,R,g);f[Q+O]=T,T&&P++}if(N)for(var U=M?M.length:0,V=N.length-1;V>=U;V--)render(a,m,V,V,N[V],void 0,g);return f}}catch(h){var W,X=null===(W=props(f))||void 0===W?void 0:W["catch"];if(X){var Y,Z="function"==typeof X?X(a,h):X;return render(a,b,c,d,hydrate((null===(Y=f)||void 0===Y?void 0:Y.node)||(null===e||void 0===e?void 0:e.node),!0),Z,g)}throw h}}function isNaturalVode(a){return Array.isArray(a)&&0<a.length&&"string"==typeof a[0]}function isTextVode(a){return"string"==typeof a||(null===a||void 0===a?void 0:a.nodeType)===Node.TEXT_NODE}function remember(a,b,c){if("function"!=typeof b)return b;var d=null===b||void 0===b?void 0:b.__memo,e=null===c||void 0===c?void 0:c.__memo;if(Array.isArray(d)&&Array.isArray(e)&&d.length===e.length){for(var f=!0,g=0;g<d.length;g++)if(d[g]!==e[g]){f=!1;break}if(f)return c}var h=unwrap(b,a);return"object"===_typeof(h)&&(h.__memo=null===b||void 0===b?void 0:b.__memo),h}function unwrap(a,b){return"function"==typeof a?unwrap(a(b),b):a}function patchProperties(a,b,c,d,e){if(d||c){var f=void 0!==e;if(c)for(var g in c){var h=c[g],i=null===d||void 0===d?void 0:d[g];h!==i&&(d?d[g]=patchProperty(a,b,g,h,i,f):patchProperty(a,b,g,h,void 0,f))}if(d&&c){for(var j in d)if(!(j in c)){var k=d[j];d[j]=patchProperty(a,b,j,void 0,k,f)}}else if(d)for(var l in d){var m=d[l];d[l]=patchProperty(a,b,l,void 0,m,f)}}}function patchProperty(a,b,c,d,e,f){if("style"===c){if(!e)b.style.cssText="";else if("string"==typeof e)d!==e&&(b.style.cssText=e);else if(d&&"object"===_typeof(d)){for(var g in d){var h=e[g];h||(b.style[g]=null)}for(var i in e){var j=d[i],l=e[i];j!==l&&(b.style[i]=l)}}else for(var m in e)b.style[m]=e[m];}else if("class"===c)e?b.setAttribute("class",classString(e)):b.removeAttribute("class");else if(!("o"===c[0]&&"n"===c[1]))f||(b[c]=e),void 0===e||null===e||!1===e?b.removeAttribute(c):b.setAttribute(c,e);else if(e){var n=null;if("function"==typeof e){var o=e;n=function c(b){return a.patch(o(a,b))}}else"object"===_typeof(e)&&(n=function b(){return a.patch(e)});b[c]=n}else b[c]=null;return e}function classString(a){return"string"==typeof a?a:Array.isArray(a)?a.map(classString).join(" "):"object"===_typeof(a)?Object.keys(a).filter(function(b){return a[b]}).join(" "):""}// src/vode-tags.ts
|
|
2
|
+
var globals=exports.globals={currentViewTransition:void 0,requestAnimationFrame:"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(a){return a()},startViewTransition:"undefined"!=typeof document&&"function"==typeof document.startViewTransition?document.startViewTransition.bind(document):null};function vode(a,b){if(!a)throw new Error("first argument to vode() must be a tag name or a vode");for(var c=arguments.length,d=Array(2<c?c-2:0),e=2;e<c;e++)d[e-2]=arguments[e];return Array.isArray(a)?a:"object"===_typeof(b)?[a,b].concat(d):[a].concat(d)}function app(a,b,c){function d(b){var d=Date.now(),e=c(i.state);i.vode=render(i.state,a.parentElement,0,0,i.vode,e,null,i.unmounts,0),a.tagName.toUpperCase()!==e[0].toUpperCase()&&(a=i.vode.node,a._vode=i),b||(i.stats.lastSyncRenderTime=Date.now()-d,i.stats.syncRenderCount++,i.isRendering=!1,i.qSync&&i.renderSync())}for(var e,f=arguments.length,g=Array(3<f?f-3:0),h=3;h<f;h++)g[h-3]=arguments[h];if(!(null!==(e=a)&&void 0!==e&&e.parentElement))throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!b||"object"!==_typeof(b))throw new Error("second argument to app() must be a state object");if("function"!=typeof c)throw new Error("third argument to app() must be a function that returns a vode");var i={syncRenderer:globals.requestAnimationFrame,asyncRenderer:globals.startViewTransition,qSync:null,qAsync:null,stats:{lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},unmounts:[]},j=b;"patch"in b&&"function"==typeof b.patch&&Array.isArray(b.patch.initialPatches)&&(g=[].concat(_toConsumableArray(b.patch.initialPatches),_toConsumableArray(g))),Object.defineProperty(b,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function c(a,b){var d,e,f,g,h,k,l;return _regenerator().w(function(c){for(;1;)switch(c.p=c.n){case 0:if(a&&("function"==typeof a||"object"===_typeof(a))){c.n=1;break}return c.a(2);case 1:if(i.stats.patchCount++,!(null!==a&&void 0!==a&&a.next)){c.n=12;break}return d=a,i.stats.liveEffectCount++,c.p=2,c.n=3,d.next();case 3:e=c.v;case 4:if(!1!==e.done){c.n=9;break}return i.stats.liveEffectCount++,c.p=5,j.patch(e.value,b),c.n=6,d.next();case 6:e=c.v;case 7:return c.p=7,i.stats.liveEffectCount--,c.f(7);case 8:c.n=4;break;case 9:j.patch(e.value,b);case 10:return c.p=10,i.stats.liveEffectCount--,c.f(10);case 11:c.n=22;break;case 12:if(!a.then){c.n=17;break}return i.stats.liveEffectCount++,c.p=13,c.n=14,a;case 14:f=c.v,j.patch(f,b);case 15:return c.p=15,i.stats.liveEffectCount--,c.f(15);case 16:c.n=22;break;case 17:if(!Array.isArray(a)){c.n=18;break}if(0<a.length){g=_createForOfIteratorHelper(a);try{for(g.s();!(h=g.n()).done;)k=h.value,j.patch(k,!document.hidden&&!!i.asyncRenderer)}catch(a){g.e(a)}finally{g.f()}}else{i.qSync=mergeState(i.qSync||{},i.qAsync,!1),i.qAsync=null;try{null===(l=globals.currentViewTransition)||void 0===l||l.skipTransition()}catch(a){}i.stats.syncRenderPatchCount++,i.renderSync()}c.n=22;break;case 18:if("function"!=typeof a){c.n=19;break}j.patch(a(i.state),b),c.n=22;break;case 19:if(!b){c.n=21;break}return i.stats.asyncRenderPatchCount++,i.qAsync=mergeState(i.qAsync||{},a,!1),c.n=20,i.renderAsync();case 20:c.n=22;break;case 21:i.stats.syncRenderPatchCount++,i.qSync=mergeState(i.qSync||{},a,!1),i.renderSync();case 22:return c.a(2)}},c,null,[[13,,15,16],[5,,7,8],[2,,10,11]])}));return a}()});var k=d.bind(null,!1),l=d.bind(null,!0);Object.defineProperty(i,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:function a(){i.isRendering||!i.qSync||(i.isRendering=!0,i.state=mergeState(i.state,i.qSync,!0),i.qSync=null,i.syncRenderer(k))}}),Object.defineProperty(i,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function a(){var b,c,d;return _regenerator().w(function(a){for(;1;)switch(a.p=a.n){case 0:if(!i.isAnimating&&i.qAsync){a.n=1;break}return a.a(2);case 1:return a.n=2,null===(b=globals.currentViewTransition)||void 0===b?void 0:b.updateCallbackDone;case 2:if(!(i.isAnimating||!i.qAsync||document.hidden)){a.n=3;break}return a.a(2);case 3:return i.isAnimating=!0,c=Date.now(),a.p=4,i.state=mergeState(i.state,i.qAsync,!0),i.qAsync=null,globals.currentViewTransition=i.asyncRenderer(l),a.n=5,null===(d=globals.currentViewTransition)||void 0===d?void 0:d.updateCallbackDone;case 5:return a.p=5,i.stats.lastAsyncRenderTime=Date.now()-c,i.stats.asyncRenderCount++,i.isAnimating=!1,a.f(5);case 6:i.qAsync&&i.renderAsync();case 7:return a.a(2)}},a,null,[[4,,5,6]])}));return a}()}),i.state=j;var m=a;m._vode=i;var n=Array.from(a.parentElement.children).indexOf(a);i.isRendering=!0,i.vode=render(b,a.parentElement,n,n,hydrate(a,!0),c(b),null,i.unmounts,0),i.isRendering=!1,i.qSync&&i.renderSync();var o,p=_createForOfIteratorHelper(g);try{for(p.s();!(o=p.n()).done;){var q=o.value;j.patch(q)}}catch(a){p.e(a)}finally{p.f()}return function(a){return j.patch(a)}}function defuse(a){if(null!==a&&void 0!==a&&a._vode){var b=function c(a){if(null!==a&&void 0!==a&&a.node){var d=props(a);if(d){for(var e in d)"o"===e[0]&&"n"===e[1]&&(a.node[e]=null);a.node["catch"]=null}if(a.node._vode)defuse(a.node);else{var f=children(a);if(f){var g,h=_createForOfIteratorHelper(f);try{for(h.s();!(g=h.n()).done;){var i=g.value;b(i)}}catch(a){h.e(a)}finally{h.f()}}}}},c=b,d=a._vode;delete a._vode,Object.defineProperty(d.state,"patch",{value:void 0}),Object.defineProperty(d,"renderSync",{value:function a(){}}),Object.defineProperty(d,"renderAsync",{value:function a(){}}),b(d.vode)}else{var e,f=_createForOfIteratorHelper(a.children);try{for(f.s();!(e=f.n()).done;){var g=e.value;defuse(g)}}catch(a){f.e(a)}finally{f.f()}}}function hydrate(b,c){if((null===b||void 0===b?void 0:b.nodeType)===Node.TEXT_NODE){var d;return""===(null===(d=b.nodeValue)||void 0===d?void 0:d.trim())?void 0:c?b:b.nodeValue}if(b.nodeType===Node.ELEMENT_NODE){var e=b.tagName.toLowerCase(),f=[e];if(c&&(f.node=b),null!==b&&void 0!==b&&b.hasAttributes()){var g,h={},i=b.attributes,j=_createForOfIteratorHelper(i);try{for(j.s();!(g=j.n()).done;){var k=g.value;h[k.name]=k.value}}catch(a){j.e(a)}finally{j.f()}f.push(h)}if(b.hasChildNodes()){var l,m=[],n=_createForOfIteratorHelper(b.childNodes);try{for(n.s();!(l=n.n()).done;){var o=l.value,p=o&&hydrate(o,c);p?f.push(p):o&&c&&m.push(o)}}catch(a){n.e(a)}finally{n.f()}for(var q,r=0,s=m;r<s.length;r++)q=s[r],q.remove()}return f}}function memo(a,b){if(!a||!Array.isArray(a))throw new Error("first argument to memo() must be an array of values to compare");if("function"!=typeof b)throw new Error("second argument to memo() must be a function that returns a vode or props object");return b.__memo=a,b}function createState(a){if(!a||"object"!==_typeof(a))throw new Error("createState() must be called with a state object");return"patch"in a||Object.defineProperty(a,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function c(b){var d=a;Array.isArray(d.patch.initialPatches)||(d.patch.initialPatches=[]),d.patch.initialPatches.push(b)}}),a}function createPatch(a){return a}function tag(a){return!a?void 0:Array.isArray(a)?a[0]:"string"==typeof a||a.nodeType===Node.TEXT_NODE?"#text":void 0}function props(a){return Array.isArray(a)&&1<a.length&&a[1]&&!Array.isArray(a[1])&&"object"===_typeof(a[1])&&a[1].nodeType!==Node.TEXT_NODE?a[1]:void 0}function children(a){var b=childrenStart(a);return 0<b?a.slice(b):null}function childCount(a){var b=childrenStart(a);return 0>b?0:a.length-b}function child(a,b){var c=childrenStart(a);return 0<c?a[b+c]:void 0}function childrenStart(a){return props(a)?2<a.length?2:-1:Array.isArray(a)&&1<a.length?1:-1}function mergeState(a,b,c){if(!b)return a;for(var d in b){var e=b[d];if(e&&"object"===_typeof(e)){var f=a[d];f?Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date&&f!==e?a[d]=new Date(e):Array.isArray(f)?a[d]=mergeState({},e,c):"object"===_typeof(f)?mergeState(a[d],e,c):a[d]=mergeState({},e,c):Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date?a[d]=new Date(e):a[d]=mergeState({},e,c)}else void 0===e&&c?delete a[d]:a[d]=e}return a}function render(a,b,c,d,e,f,g,h,j){try{var k,l;f=remember(a,f,e);var m=!f||"number"==typeof f||"boolean"==typeof f;if(f===e||!e&&m)return e;var n=(null===e||void 0===e?void 0:e.nodeType)===Node.TEXT_NODE,o=n?e:null===e||void 0===e?void 0:e.node;if(m){if(!n&&"number"==typeof(null===e||void 0===e?void 0:e.unmountCount))for(var p,q=e.unmountStart,r=e.unmountCount,s=r-1;0<=s;s--)p=h[q+s],p&&(a.patch(p(a,o)),h[q+s]=null);return void(null===o||void 0===o||o.remove())}var t=!m&&isTextVode(f),u=!m&&isNaturalVode(f),v=!!f&&"string"!=typeof f&&!!(null!==(k=f)&&void 0!==k&&k.node||(null===(l=f)||void 0===l?void 0:l.nodeType)===Node.TEXT_NODE);if(!t&&!u&&!v&&!e)throw new Error("Invalid vode: "+_typeof(f)+" "+JSON.stringify(f));else v&&t?f=f.wholeText:v&&u&&(f=_toConsumableArray(f));if(n&&t)return o.nodeValue!==f&&(o.nodeValue=f),e;if(t&&(!o||!n)){var w=document.createTextNode(f);if(o){if(!n&&"number"==typeof(null===e||void 0===e?void 0:e.unmountCount))for(var x,y=e.unmountStart,z=e.unmountCount,A=z-1;0<=A;A--)x=h[y+A],x&&(a.patch(x(a,o)),h[y+A]=null);o.replaceWith(w)}else{for(var B,C=!1,D=d;D<b.childNodes.length;D++)if(B=b.childNodes[D],B){B.before(w,B),C=!0;break}C||b.appendChild(w)}return w}if(u&&(!o||n||e[0]!==f[0])){var E=f;1 in E&&(E[1]=remember(a,E[1],void 0));var F=props(f);void 0!==(null===F||void 0===F?void 0:F.xmlns)&&(g=F.xmlns);var G=g?document.createElementNS(g,f[0]):document.createElement(f[0]);if(f.node=G,patchProperties(a,G,void 0,F,null!==g&&void 0!==g?g:null),!!F&&"catch"in F&&(f.node["catch"]=null,f.node.removeAttribute("catch")),o){var H;if(!n&&"number"==typeof(null===e||void 0===e?void 0:e.unmountCount))for(var I,J=e.unmountStart,K=e.unmountCount,L=K-1;0<=L;L--)I=h[J+L],I&&(a.patch(I(a,o)),h[J+L]=null);h[j]=null!==(H=null===F||void 0===F?void 0:F.onUnmount)&&void 0!==H?H:null,o.replaceWith(G)}else{var M;h[j]=null!==(M=null===F||void 0===F?void 0:F.onUnmount)&&void 0!==M?M:null;for(var N,O=!1,P=d;P<b.childNodes.length;P++)if(N=b.childNodes[P],N){N.before(G,N),O=!0;break}O||b.appendChild(G)}var Q=0,R=j+1,S=children(f);if(S)for(var T=F?2:1,U=0,V=0;V<S.length;V++){var W=S[V],X=render(a,G,V,U,void 0,W,null!==g&&void 0!==g?g:null,h,R);if(f[V+T]=X,X){U++;var Y=X.unmountCount||0;Q+=Y,R+=Y}}return G.onMount&&a.patch(G.onMount(G)),f.unmountCount=1+Q,f.unmountStart=j,f}if(!n&&u&&e[0]===f[0]){var Z,$;f.node=o;var _=f,aa=e,ba=props(f),ca=props(e);if(void 0!==(null===ba||void 0===ba?void 0:ba.xmlns)&&(g=ba.xmlns),null!==(Z=_[1])&&void 0!==Z&&Z.__memo){var da=_[1];_[1]=remember(a,_[1],aa[1]),da!==_[1]&&patchProperties(a,o,ca,ba,g)}else patchProperties(a,o,ca,ba,g);!(null!==ba&&void 0!==ba&&ba["catch"])||(null===ca||void 0===ca?void 0:ca["catch"])===ba["catch"]||(f.node["catch"]=null,f.node.removeAttribute("catch")),h[j]=null!==($=null===ba||void 0===ba?void 0:ba.onUnmount)&&void 0!==$?$:null;var ea=0,fa=j+1,ga=children(f),ha=children(e);if(ga)for(var ia=ba?2:1,ja=0,ka=0;ka<ga.length;ka++){var la=ga[ka],ma=ha&&ha[ka],na=render(a,o,ka,ja,ma,la,g,h,fa);if(f[ka+ia]=na,na){ja++;var oa=na.unmountCount||0;ea+=oa,fa+=oa}}if(ha)for(var pa=ga?ga.length:0,qa=ha.length-1;qa>=pa;qa--)render(a,o,qa,qa,ha[qa],void 0,g,h,ha[qa].unmountStart);return f.unmountCount=1+ea,f.unmountStart=j,f}}catch(i){var ra,sa=null===(ra=props(f))||void 0===ra?void 0:ra["catch"];if(sa){var ta,ua="function"==typeof sa?sa(a,i):sa;return render(a,b,c,d,hydrate((null===(ta=f)||void 0===ta?void 0:ta.node)||(null===e||void 0===e?void 0:e.node),!0),ua,g,h,j)}throw i}}function isNaturalVode(a){return Array.isArray(a)&&0<a.length&&"string"==typeof a[0]}function isTextVode(a){return"string"==typeof a||(null===a||void 0===a?void 0:a.nodeType)===Node.TEXT_NODE}function remember(a,b,c){if("function"!=typeof b)return b;var d=null===b||void 0===b?void 0:b.__memo,e=null===c||void 0===c?void 0:c.__memo;if(Array.isArray(d)&&Array.isArray(e)&&d.length===e.length){for(var f=!0,g=0;g<d.length;g++)if(d[g]!==e[g]){f=!1;break}if(f)return c}var h=b(a);if("function"==typeof h&&null!==h&&void 0!==h&&h.__memo){var j=h.__memo;if(Array.isArray(j)&&Array.isArray(e)&&j.length===e.length){for(var k=!0,l=0;l<j.length;l++)if(j[l]!==e[l]){k=!1;break}if(k)return c}var m=h(a);return"object"===_typeof(m)&&(m.__memo=j),m}var n="function"==typeof h?unwrap(h,a):h;return"object"===_typeof(n)&&(n.__memo=(null===h||void 0===h?void 0:h.__memo)||(null===b||void 0===b?void 0:b.__memo)),n}function unwrap(a,b){return"function"==typeof a?unwrap(a(b),b):a}function patchProperties(a,b,c,d,e){if(d||c){var f=void 0!==e;if(c)for(var g in c){var h=c[g],i=null===d||void 0===d?void 0:d[g];h!==i&&(d?d[g]=patchProperty(a,b,g,h,i,f):patchProperty(a,b,g,h,void 0,f))}if(d&&c){for(var j in d)if(!(j in c)){var k=d[j];d[j]=patchProperty(a,b,j,void 0,k,f)}}else if(d)for(var l in d){var m=d[l];d[l]=patchProperty(a,b,l,void 0,m,f)}}}function patchProperty(a,b,c,d,e,f){if("style"===c){if(!e)b.style.cssText="";else if("string"==typeof e)d!==e&&(b.style.cssText=e);else if(d&&"object"===_typeof(d)){for(var g in d){var h=e[g];h||(b.style[g]=null)}for(var i in e){var j=d[i],l=e[i];j!==l&&(b.style[i]=l)}}else for(var m in e)b.style[m]=e[m];}else if("class"===c)e?b.setAttribute("class",classString(e)):b.removeAttribute("class");else if(!("o"===c[0]&&"n"===c[1]))f||(b[c]=e),void 0===e||null===e||!1===e?b.removeAttribute(c):b.setAttribute(c,e);else if(e){var n=null;if("function"==typeof e){var o=e;n=function c(b){return a.patch(o(a,b))}}else"object"===_typeof(e)&&(n=function b(){return a.patch(e)});b[c]=n}else b[c]=null;return e}function classString(a){return"string"==typeof a?a:Array.isArray(a)?a.map(classString).join(" "):"object"===_typeof(a)?Object.keys(a).filter(function(b){return a[b]}).join(" "):""}// src/vode-tags.ts
|
|
3
3
|
var A=exports.A="a",ABBR=exports.ABBR="abbr",ADDRESS=exports.ADDRESS="address",AREA=exports.AREA="area",ARTICLE=exports.ARTICLE="article",ASIDE=exports.ASIDE="aside",AUDIO=exports.AUDIO="audio",B=exports.B="b",BASE=exports.BASE="base",BDI=exports.BDI="bdi",BDO=exports.BDO="bdo",BLOCKQUOTE=exports.BLOCKQUOTE="blockquote",BODY=exports.BODY="body",BR=exports.BR="br",BUTTON=exports.BUTTON="button",CANVAS=exports.CANVAS="canvas",CAPTION=exports.CAPTION="caption",CITE=exports.CITE="cite",CODE=exports.CODE="code",COL=exports.COL="col",COLGROUP=exports.COLGROUP="colgroup",DATA=exports.DATA="data",DATALIST=exports.DATALIST="datalist",DD=exports.DD="dd",DEL=exports.DEL="del",DETAILS=exports.DETAILS="details",DFN=exports.DFN="dfn",DIALOG=exports.DIALOG="dialog",DIV=exports.DIV="div",DL=exports.DL="dl",DT=exports.DT="dt",EM=exports.EM="em",EMBED=exports.EMBED="embed",FIELDSET=exports.FIELDSET="fieldset",FIGCAPTION=exports.FIGCAPTION="figcaption",FIGURE=exports.FIGURE="figure",FOOTER=exports.FOOTER="footer",FORM=exports.FORM="form",H1=exports.H1="h1",H2=exports.H2="h2",H3=exports.H3="h3",H4=exports.H4="h4",H5=exports.H5="h5",H6=exports.H6="h6",HEAD=exports.HEAD="head",HEADER=exports.HEADER="header",HGROUP=exports.HGROUP="hgroup",HR=exports.HR="hr",HTML=exports.HTML="html",I=exports.I="i",IFRAME=exports.IFRAME="iframe",IMG=exports.IMG="img",INPUT=exports.INPUT="input",INS=exports.INS="ins",KBD=exports.KBD="kbd",LABEL=exports.LABEL="label",LEGEND=exports.LEGEND="legend",LI=exports.LI="li",LINK=exports.LINK="link",MAIN=exports.MAIN="main",MAP=exports.MAP="map",MARK=exports.MARK="mark",MENU=exports.MENU="menu",META=exports.META="meta",METER=exports.METER="meter",NAV=exports.NAV="nav",NOSCRIPT=exports.NOSCRIPT="noscript",OBJECT=exports.OBJECT="object",OL=exports.OL="ol",OPTGROUP=exports.OPTGROUP="optgroup",OPTION=exports.OPTION="option",OUTPUT=exports.OUTPUT="output",P=exports.P="p",PICTURE=exports.PICTURE="picture",PRE=exports.PRE="pre",PROGRESS=exports.PROGRESS="progress",Q=exports.Q="q",RP=exports.RP="rp",RT=exports.RT="rt",RUBY=exports.RUBY="ruby",S=exports.S="s",SAMP=exports.SAMP="samp",SCRIPT=exports.SCRIPT="script",SEARCH=exports.SEARCH="search",SECTION=exports.SECTION="section",SELECT=exports.SELECT="select",SLOT=exports.SLOT="slot",SMALL=exports.SMALL="small",SOURCE=exports.SOURCE="source",SPAN=exports.SPAN="span",STRONG=exports.STRONG="strong",STYLE=exports.STYLE="style",SUB=exports.SUB="sub",SUMMARY=exports.SUMMARY="summary",SUP=exports.SUP="sup",TABLE=exports.TABLE="table",TBODY=exports.TBODY="tbody",TD=exports.TD="td",TEMPLATE=exports.TEMPLATE="template",TEXTAREA=exports.TEXTAREA="textarea",TFOOT=exports.TFOOT="tfoot",TH=exports.TH="th",THEAD=exports.THEAD="thead",TIME=exports.TIME="time",TITLE=exports.TITLE="title",TR=exports.TR="tr",TRACK=exports.TRACK="track",U=exports.U="u",UL=exports.UL="ul",VAR=exports.VAR="var",VIDEO=exports.VIDEO="video",WBR=exports.WBR="wbr",ANIMATE=exports.ANIMATE="animate",ANIMATEMOTION=exports.ANIMATEMOTION="animateMotion",ANIMATETRANSFORM=exports.ANIMATETRANSFORM="animateTransform",CIRCLE=exports.CIRCLE="circle",CLIPPATH=exports.CLIPPATH="clipPath",DEFS=exports.DEFS="defs",DESC=exports.DESC="desc",ELLIPSE=exports.ELLIPSE="ellipse",FEBLEND=exports.FEBLEND="feBlend",FECOLORMATRIX=exports.FECOLORMATRIX="feColorMatrix",FECOMPONENTTRANSFER=exports.FECOMPONENTTRANSFER="feComponentTransfer",FECOMPOSITE=exports.FECOMPOSITE="feComposite",FECONVOLVEMATRIX=exports.FECONVOLVEMATRIX="feConvolveMatrix",FEDIFFUSELIGHTING=exports.FEDIFFUSELIGHTING="feDiffuseLighting",FEDISPLACEMENTMAP=exports.FEDISPLACEMENTMAP="feDisplacementMap",FEDISTANTLIGHT=exports.FEDISTANTLIGHT="feDistantLight",FEDROPSHADOW=exports.FEDROPSHADOW="feDropShadow",FEFLOOD=exports.FEFLOOD="feFlood",FEFUNCA=exports.FEFUNCA="feFuncA",FEFUNCB=exports.FEFUNCB="feFuncB",FEFUNCG=exports.FEFUNCG="feFuncG",FEFUNCR=exports.FEFUNCR="feFuncR",FEGAUSSIANBLUR=exports.FEGAUSSIANBLUR="feGaussianBlur",FEIMAGE=exports.FEIMAGE="feImage",FEMERGE=exports.FEMERGE="feMerge",FEMERGENODE=exports.FEMERGENODE="feMergeNode",FEMORPHOLOGY=exports.FEMORPHOLOGY="feMorphology",FEOFFSET=exports.FEOFFSET="feOffset",FEPOINTLIGHT=exports.FEPOINTLIGHT="fePointLight",FESPECULARLIGHTING=exports.FESPECULARLIGHTING="feSpecularLighting",FESPOTLIGHT=exports.FESPOTLIGHT="feSpotLight",FETILE=exports.FETILE="feTile",FETURBULENCE=exports.FETURBULENCE="feTurbulence",FILTER=exports.FILTER="filter",FOREIGNOBJECT=exports.FOREIGNOBJECT="foreignObject",G=exports.G="g",IMAGE=exports.IMAGE="image",LINE=exports.LINE="line",LINEARGRADIENT=exports.LINEARGRADIENT="linearGradient",MARKER=exports.MARKER="marker",MASK=exports.MASK="mask",METADATA=exports.METADATA="metadata",MPATH=exports.MPATH="mpath",PATH=exports.PATH="path",PATTERN=exports.PATTERN="pattern",POLYGON=exports.POLYGON="polygon",POLYLINE=exports.POLYLINE="polyline",RADIALGRADIENT=exports.RADIALGRADIENT="radialGradient",RECT=exports.RECT="rect",SET=exports.SET="set",STOP=exports.STOP="stop",SVG=exports.SVG="svg",SWITCH=exports.SWITCH="switch",SYMBOL=exports.SYMBOL="symbol",TEXT=exports.TEXT="text",TEXTPATH=exports.TEXTPATH="textPath",TSPAN=exports.TSPAN="tspan",USE=exports.USE="use",VIEW=exports.VIEW="view",ANNOTATION=exports.ANNOTATION="annotation",ANNOTATION_XML=exports.ANNOTATION_XML="annotation-xml",MACTION=exports.MACTION="maction",MATH=exports.MATH="math",MERROR=exports.MERROR="merror",MFRAC=exports.MFRAC="mfrac",MI=exports.MI="mi",MMULTISCRIPTS=exports.MMULTISCRIPTS="mmultiscripts",MN=exports.MN="mn",MO=exports.MO="mo",MOVER=exports.MOVER="mover",MPADDED=exports.MPADDED="mpadded",MPHANTOM=exports.MPHANTOM="mphantom",MPRESCRIPTS=exports.MPRESCRIPTS="mprescripts",MROOT=exports.MROOT="mroot",MROW=exports.MROW="mrow",MS=exports.MS="ms",MSPACE=exports.MSPACE="mspace",MSQRT=exports.MSQRT="msqrt",MSTYLE=exports.MSTYLE="mstyle",MSUB=exports.MSUB="msub",MSUBSUP=exports.MSUBSUP="msubsup",MSUP=exports.MSUP="msup",MTABLE=exports.MTABLE="mtable",MTD=exports.MTD="mtd",MTEXT=exports.MTEXT="mtext",MTR=exports.MTR="mtr",MUNDER=exports.MUNDER="munder",MUNDEROVER=exports.MUNDEROVER="munderover",SEMANTICS=exports.SEMANTICS="semantics";// src/merge-class.ts
|
|
4
4
|
function mergeClass(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];if(!d||0===d.length)return null;if(1===d.length)return d[0];for(var f=d[0],g=1;g<d.length;g++){var h=f,i=d[g];if(!h)f=i;else if(!i)continue;else if("string"==typeof h&&"string"==typeof i){var j=h.split(" "),k=i.split(" "),l=/* @__PURE__ */new Set([].concat(_toConsumableArray(j),_toConsumableArray(k)));f=Array.from(l).join(" ").trim()}else if("string"==typeof h&&Array.isArray(i)){var m=/* @__PURE__ */new Set([].concat(_toConsumableArray(i),_toConsumableArray(h.split(" "))));f=Array.from(m).join(" ").trim()}else if(Array.isArray(h)&&"string"==typeof i){var n=/* @__PURE__ */new Set([].concat(_toConsumableArray(h),_toConsumableArray(i.split(" "))));f=Array.from(n).join(" ").trim()}else if(Array.isArray(h)&&Array.isArray(i)){var o=/* @__PURE__ */new Set([].concat(_toConsumableArray(h),_toConsumableArray(i)));f=Array.from(o).join(" ").trim()}else if("string"==typeof h&&"object"===_typeof(i))f=_objectSpread(_defineProperty({},h,!0),i);else if("object"===_typeof(h)&&"string"==typeof i)f=_objectSpread(_objectSpread({},h),{},_defineProperty({},i,!0));else if("object"===_typeof(h)&&"object"===_typeof(i))f=_objectSpread(_objectSpread({},h),i);else if("object"===_typeof(h)&&Array.isArray(i)){var p,q=_objectSpread({},h),r=_createForOfIteratorHelper(i);try{for(r.s();!(p=r.n()).done;){var s=p.value;q[s]=!0}}catch(a){r.e(a)}finally{r.f()}f=q}else if(Array.isArray(h)&&"object"===_typeof(i)){var t,u={},v=_createForOfIteratorHelper(h);try{for(v.s();!(t=v.n()).done;){var w=t.value;u[w]=!0}}catch(a){v.e(a)}finally{v.f()}for(var x,y=0,z=Object.keys(i);y<z.length;y++)x=z[y],u[x]=i[x];f=u}else throw new Error("cannot merge classes of ".concat(h," (").concat(_typeof(h),") and ").concat(i," (").concat(_typeof(i),")"))}return f}// src/merge-style.ts
|
|
5
|
-
var tempDivForStyling=document.createElement("div");
|
|
5
|
+
var tempDivForStyling;function mergeStyle(){tempDivForStyling||(tempDivForStyling=document.createElement("div"));try{for(var a=tempDivForStyling.style,b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];for(var e,f=0,g=c;f<g.length;f++)if(e=g[f],"object"===_typeof(e)&&null!==e)for(var h in e)a[h]=e[h];else"string"==typeof e&&(a.cssText+=";"+e);return a.cssText}finally{tempDivForStyling.style.cssText=""}}// src/merge-props.ts
|
|
6
6
|
function mergeProps(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];if(0!==b.length){if(1===b.length)return b[0]||void 0;for(var d,e,f=0,g=b;f<(void 0).length;f++)if(e=(void 0)[f],"object"===_typeof(e)&&null!==e)for(var h in d||(d={}),e)"style"===h?d.style=mergeStyle(d.style,e.style):"class"===h?d["class"]=mergeClass(d["class"],e["class"]):d[h]=e[h];return d}}// src/state-context.ts
|
|
7
7
|
function context(a){return new ProxyStateContextImpl(a,[])}var ProxyStateContextImpl=/*#__PURE__*/function(){function a(b,c){function d(a,b){if(1<c.length){var d=0,e=b[c[d]];for(("object"!==_typeof(e)||null===e)&&(b[c[d]]=e={}),d=1;d<c.length-1;d++){var f=e;e=e[c[d]],("object"!==_typeof(e)||null===e)&&(f[c[d]]=e={})}e[c[d]]=a}else 1===c.length?"object"===_typeof(b[c[0]])&&"object"===_typeof(a)?Object.assign(b[c[0]],a):b[c[0]]=a:Object.assign(b,a)}function e(a){var b={};return d(a,b),b}function f(){if(0===c.length)return b;for(var a=b?b[c[0]]:void 0,d=1;d<c.length&&!!a;d++)a=a[c[d]];return a}function g(a){d(a,b)}function h(a,c){c?b.patch([e(a)]):b.patch(e(a))}return _classCallCheck(this,a),_defineProperty(this,"state",void 0),_defineProperty(this,"keys",void 0),this.state=b,this.keys=c,new Proxy(this,{get:function i(c,d,e){if("state"===d)return b;if("get"===d)return f;if("put"===d)return g;if("patch"===d)return h;var j=[].concat(_toConsumableArray(c.keys),[d+""]);return new a(c.state,j)}})}return _createClass(a,[{key:"get",value:function a(){}},{key:"put",value:function b(a){}},{key:"patch",value:function b(a){}}])}();
|
package/dist/vode.d.ts
CHANGED
|
@@ -18,8 +18,12 @@ export type TextVode = string & {};
|
|
|
18
18
|
export type NoVode = undefined | null | number | boolean | bigint | void;
|
|
19
19
|
export type AttachedVode<S> = Vode<S> & {
|
|
20
20
|
node: ChildNode;
|
|
21
|
+
unmountCount: number;
|
|
22
|
+
unmountStart: number;
|
|
21
23
|
} | Text & {
|
|
22
24
|
node?: never;
|
|
25
|
+
unmounts?: never;
|
|
26
|
+
unmountStart?: never;
|
|
23
27
|
};
|
|
24
28
|
export type Tag = keyof (HTMLElementTagNameMap & SVGElementTagNameMap & MathMLElementTagNameMap) | (string & {});
|
|
25
29
|
export type Component<S> = (s: S) => ChildVode<S>;
|
|
@@ -86,6 +90,7 @@ export interface ContainerNode<S = PatchableState> extends HTMLElement {
|
|
|
86
90
|
qAsync: {} | undefined | null;
|
|
87
91
|
isRendering: boolean;
|
|
88
92
|
isAnimating: boolean;
|
|
93
|
+
unmounts: (MountFunction<S> | null)[];
|
|
89
94
|
/** stats about the overall patches & last render time */
|
|
90
95
|
stats: {
|
|
91
96
|
patchCount: number;
|
package/dist/vode.es5.min.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";function _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _regenerator(){function b(a,b,f,g){var h=b&&b.prototype instanceof d?b:d,c=Object.create(h.prototype);return _regeneratorDefine2(c,"_invoke",function(a,b,g){function h(a,b){for(q=a,s=b,e=0;!w&&t&&!c&&e<v.length;e++){var c,f=v[e],g=p.p,h=f[2];3<a?(c=h===b)&&(s=f[(q=f[4])?5:(q=3,3)],f[4]=f[5]=j):f[0]<=g&&((c=2>a&&g<f[1])?(q=0,p.v=b,p.n=f[1]):g<h&&(c=3>a||f[0]>b||b>h)&&(f[4]=a,f[5]=b,p.n=h,q=0))}if(c||1<a)return m;throw w=!0,b}var k,q,s,t=0,v=g||[],w=!1,p={p:0,n:0,v:j,a:h,f:h.bind(j,4),d:function c(a,b){return k=a,q=0,s=j,p.n=b,m}};return function(c,d,f){if(1<t)throw TypeError("Generator is already running");for(w&&1===d&&h(d,f),q=d,s=f;(e=2>q?j:s)||!w;){k||(q?3>q?(1<q&&(p.n=-1),h(q,s)):p.n=s:p.v=s);try{if(t=2,k){if(q||(c="next"),e=k[c]){if(!(e=e.call(k,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,2>q&&(q=0)}else 1===q&&(e=k["return"])&&e.call(k),2>q&&(s=TypeError("The iterator does not provide a '"+c+"' method"),q=1);k=j}else if((e=(w=0>p.n)?s:a.call(b,p))!==m)break}catch(a){k=j,q=1,s=a}finally{t=1}}return{value:e,done:w}}}(a,f,g),!0),c}function d(){}function g(){}function h(){}function i(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,h):(a.__proto__=h,_regeneratorDefine2(a,l,"GeneratorFunction")),a.prototype=Object.create(c),a}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var j,e,f="function"==typeof Symbol?Symbol:{},k=f.iterator||"@@iterator",l=f.toStringTag||"@@toStringTag",m={};e=Object.getPrototypeOf;var a=[][k]?e(e([][k]())):(_regeneratorDefine2(e={},k,function(){return this}),e),c=h.prototype=d.prototype=Object.create(a);return g.prototype=h,_regeneratorDefine2(c,"constructor",h),_regeneratorDefine2(h,"constructor",g),g.displayName="GeneratorFunction",_regeneratorDefine2(h,l,"GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,l,"Generator"),_regeneratorDefine2(c,k,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function a(){return{w:b,m:i}})()}function _regeneratorDefine2(a,b,c,d){var f=Object.defineProperty;try{f({},"",{})}catch(a){f=0}_regeneratorDefine2=function e(a,b,c,d){function g(b,c){_regeneratorDefine2(a,b,function(a){return this._invoke(b,c,a)})}b?f?f(a,b,{value:c,enumerable:!d,configurable:!d,writable:!d}):a[b]=c:(g("next",0),g("throw",1),g("return",2))},_regeneratorDefine2(a,b,c,d)}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _createForOfIteratorHelper(b,c){var d="undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(!d){if(Array.isArray(b)||(d=_unsupportedIterableToArray(b))||c&&b&&"number"==typeof b.length){d&&(b=d);var e=0,f=function a(){};return{s:f,n:function a(){return e>=b.length?{done:!0}:{done:!1,value:b[e++]}},e:function b(a){throw a},f:f}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g,h=!0,i=!1;return{s:function a(){d=d.call(b)},n:function a(){var b=d.next();return h=b.done,b},e:function b(a){i=!0,g=a},f:function a(){try{h||null==d["return"]||d["return"]()}finally{if(i)throw g}}}}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}var V=function(){function a(a,b){if(!a)throw new Error("first argument to vode() must be a tag name or a vode");for(var c=arguments.length,d=Array(2<c?c-2:0),e=2;e<c;e++)d[e-2]=arguments[e];return Array.isArray(a)?a:b?[a,b].concat(d):[a].concat(d)}function b(a,b,c){function e(b){var d=Date.now(),e=c(j.state);j.vode=o(j.state,a.parentElement,0,0,j.vode,e),a.tagName.toUpperCase()!==e[0].toUpperCase()&&(a=j.vode.node,a._vode=j),b||(j.stats.lastSyncRenderTime=Date.now()-d,j.stats.syncRenderCount++,j.isRendering=!1,j.qSync&&j.renderSync())}for(var f,g=arguments.length,h=Array(3<g?g-3:0),i=3;i<g;i++)h[i-3]=arguments[i];if(!(null!==(f=a)&&void 0!==f&&f.parentElement))throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!b||"object"!==_typeof(b))throw new Error("second argument to app() must be a state object");if("function"!=typeof c)throw new Error("third argument to app() must be a function that returns a vode");var j={syncRenderer:J.requestAnimationFrame,asyncRenderer:J.startViewTransition,qSync:null,qAsync:null,stats:{lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0}},k=b;"patch"in b&&"function"==typeof b.patch&&Array.isArray(b.patch.initialPatches)&&(h=[].concat(_toConsumableArray(b.patch.initialPatches),_toConsumableArray(h))),Object.defineProperty(b,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function c(a,b){var d,e,f,g,h,i,l;return _regenerator().w(function(c){for(;1;)switch(c.p=c.n){case 0:if(a&&("function"==typeof a||"object"===_typeof(a))){c.n=1;break}return c.a(2);case 1:if(j.stats.patchCount++,!(null!==a&&void 0!==a&&a.next)){c.n=12;break}return d=a,j.stats.liveEffectCount++,c.p=2,c.n=3,d.next();case 3:e=c.v;case 4:if(!1!==e.done){c.n=9;break}return j.stats.liveEffectCount++,c.p=5,k.patch(e.value,b),c.n=6,d.next();case 6:e=c.v;case 7:return c.p=7,j.stats.liveEffectCount--,c.f(7);case 8:c.n=4;break;case 9:k.patch(e.value,b);case 10:return c.p=10,j.stats.liveEffectCount--,c.f(10);case 11:c.n=22;break;case 12:if(!a.then){c.n=17;break}return j.stats.liveEffectCount++,c.p=13,c.n=14,a;case 14:f=c.v,k.patch(f,b);case 15:return c.p=15,j.stats.liveEffectCount--,c.f(15);case 16:c.n=22;break;case 17:if(!Array.isArray(a)){c.n=18;break}if(0<a.length){g=_createForOfIteratorHelper(a);try{for(g.s();!(h=g.n()).done;)i=h.value,k.patch(i,!document.hidden&&!!j.asyncRenderer)}catch(a){g.e(a)}finally{g.f()}}else{j.qSync=n(j.qSync||{},j.qAsync,!1),j.qAsync=null;try{null===(l=J.currentViewTransition)||void 0===l||l.skipTransition()}catch(a){}j.stats.syncRenderPatchCount++,j.renderSync()}c.n=22;break;case 18:if("function"!=typeof a){c.n=19;break}k.patch(a(j.state),b),c.n=22;break;case 19:if(!b){c.n=21;break}return j.stats.asyncRenderPatchCount++,j.qAsync=n(j.qAsync||{},a,!1),c.n=20,j.renderAsync();case 20:c.n=22;break;case 21:j.stats.syncRenderPatchCount++,j.qSync=n(j.qSync||{},a,!1),j.renderSync();case 22:return c.a(2)}},c,null,[[13,,15,16],[5,,7,8],[2,,10,11]])}));return a}()});var l=e.bind(null,!1),m=e.bind(null,!0);Object.defineProperty(j,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:function a(){j.isRendering||!j.qSync||(j.isRendering=!0,j.state=n(j.state,j.qSync,!0),j.qSync=null,j.syncRenderer(l))}}),Object.defineProperty(j,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function a(){var b,c,d;return _regenerator().w(function(a){for(;1;)switch(a.p=a.n){case 0:if(!j.isAnimating&&j.qAsync){a.n=1;break}return a.a(2);case 1:return a.n=2,null===(b=J.currentViewTransition)||void 0===b?void 0:b.updateCallbackDone;case 2:if(!(j.isAnimating||!j.qAsync||document.hidden)){a.n=3;break}return a.a(2);case 3:return j.isAnimating=!0,c=Date.now(),a.p=4,j.state=n(j.state,j.qAsync,!0),j.qAsync=null,J.currentViewTransition=j.asyncRenderer(m),a.n=5,null===(d=J.currentViewTransition)||void 0===d?void 0:d.updateCallbackDone;case 5:return a.p=5,j.stats.lastAsyncRenderTime=Date.now()-c,j.stats.asyncRenderCount++,j.isAnimating=!1,a.f(5);case 6:j.qAsync&&j.renderAsync();case 7:return a.a(2)}},a,null,[[4,,5,6]])}));return a}()}),j.state=k;var p=a;p._vode=j;var q=Array.from(a.parentElement.children).indexOf(a);j.vode=o(b,a.parentElement,q,q,d(a,!0),c(b));var r,s=_createForOfIteratorHelper(h);try{for(s.s();!(r=s.n()).done;){var t=r.value;k.patch(t)}}catch(a){s.e(a)}finally{s.f()}return function(a){return k.patch(a)}}function c(a){if(null!==a&&void 0!==a&&a._vode){var b=function d(a){if(null!==a&&void 0!==a&&a.node){var e=i(a);if(e){for(var f in e)"o"===f[0]&&"n"===f[1]&&(a.node[f]=null);a.node["catch"]=null}if(a.node._vode)c(a.node);else{var g=j(a);if(g){var h,k=_createForOfIteratorHelper(g);try{for(k.s();!(h=k.n()).done;){var l=h.value;b(l)}}catch(a){k.e(a)}finally{k.f()}}}}},d=b,e=a._vode;delete a._vode,Object.defineProperty(e.state,"patch",{value:void 0}),Object.defineProperty(e,"renderSync",{value:function a(){}}),Object.defineProperty(e,"renderAsync",{value:function a(){}}),b(e.vode)}else{var f,g=_createForOfIteratorHelper(a.children);try{for(g.s();!(f=g.n()).done;){var h=f.value;c(h)}}catch(a){g.e(a)}finally{g.f()}}}function d(b,c){if((null===b||void 0===b?void 0:b.nodeType)===Node.TEXT_NODE){var e;return""===(null===(e=b.nodeValue)||void 0===e?void 0:e.trim())?void 0:c?b:b.nodeValue}if(b.nodeType!==Node.COMMENT_NODE&&b.nodeType===Node.ELEMENT_NODE){var f=b.tagName.toLowerCase(),g=[f];if(c&&(g.node=b),null!==b&&void 0!==b&&b.hasAttributes()){var h,i={},j=b.attributes,k=_createForOfIteratorHelper(j);try{for(k.s();!(h=k.n()).done;){var l=h.value;i[l.name]=l.value}}catch(a){k.e(a)}finally{k.f()}g.push(i)}if(b.hasChildNodes()){var m,n=[],o=_createForOfIteratorHelper(b.childNodes);try{for(o.s();!(m=o.n()).done;){var p=m.value,q=p&&d(p,c);q?g.push(q):p&&c&&n.push(p)}}catch(a){o.e(a)}finally{o.f()}for(var r,s=0,t=n;s<t.length;s++)r=t[s],r.remove()}return g}}function e(a,b){if(!a||!Array.isArray(a))throw new Error("first argument to memo() must be an array of values to compare");if("function"!=typeof b)throw new Error("second argument to memo() must be a function that returns a vode or props object");return b.__memo=a,b}function f(a){if(!a||"object"!==_typeof(a))throw new Error("createState() must be called with a state object");return"patch"in a||Object.defineProperty(a,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function c(b){var d=a;Array.isArray(d.patch.initialPatches)||(d.patch.initialPatches=[]),d.patch.initialPatches.push(b)}}),a}function g(a){return a}function h(a){return!a?void 0:Array.isArray(a)?a[0]:"string"==typeof a||a.nodeType===Node.TEXT_NODE?"#text":void 0}function i(a){return Array.isArray(a)&&1<a.length&&a[1]&&!Array.isArray(a[1])&&"object"===_typeof(a[1])&&a[1].nodeType!==Node.TEXT_NODE?a[1]:void 0}function j(a){var b=m(a);return 0<b?a.slice(b):null}function k(a){var b=m(a);return 0>b?0:a.length-b}function l(a,b){var c=m(a);return 0<c?a[b+c]:void 0}function m(a){return i(a)?2<a.length?2:-1:Array.isArray(a)&&1<a.length?1:-1}function n(a,b,c){if(!b)return a;for(var d in b){var e=b[d];if(e&&"object"===_typeof(e)){var f=a[d];f?Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date&&f!==e?a[d]=new Date(e):Array.isArray(f)?a[d]=n({},e,c):"object"===_typeof(f)?n(a[d],e,c):a[d]=n({},e,c):Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date?a[d]=new Date(e):a[d]=n({},e,c)}else void 0===e&&c?delete a[d]:a[d]=e}return a}function o(a,b,c,e,f,g,h){try{var k,l;g=r(a,g,f);var m=!g||"number"==typeof g||"boolean"==typeof g;if(g===f||!f&&m)return f;var n=(null===f||void 0===f?void 0:f.nodeType)===Node.TEXT_NODE,s=n?f:null===f||void 0===f?void 0:f.node;if(m)return(null===s||void 0===s?void 0:s.onUnmount)&&a.patch(s.onUnmount(s)),void(null===s||void 0===s||s.remove());var t=!m&&q(g),v=!m&&p(g),w=!!g&&"string"!=typeof g&&!!(null!==(k=g)&&void 0!==k&&k.node||(null===(l=g)||void 0===l?void 0:l.nodeType)===Node.TEXT_NODE);if(!t&&!v&&!w&&!f)throw new Error("Invalid vode: "+_typeof(g)+" "+JSON.stringify(g));else w&&t?g=g.wholeText:w&&v&&(g=_toConsumableArray(g));if(n&&t)return s.nodeValue!==g&&(s.nodeValue=g),f;if(t&&(!s||!n)){var x=document.createTextNode(g);if(s)s.onUnmount&&a.patch(s.onUnmount(s)),s.replaceWith(x);else{for(var y,z=!1,A=e;A<b.childNodes.length;A++)if(y=b.childNodes[A],y){y.before(x,y),z=!0;break}z||b.appendChild(x)}return x}if(v&&(!s||n||f[0]!==g[0])){var B=g;1 in B&&(B[1]=r(a,B[1],void 0));var C=i(g);void 0!==(null===C||void 0===C?void 0:C.xmlns)&&(h=C.xmlns);var D=h?document.createElementNS(h,g[0]):document.createElement(g[0]);if(g.node=D,u(a,D,void 0,C,null!==h&&void 0!==h?h:null),!!C&&"catch"in C&&(g.node["catch"]=null,g.node.removeAttribute("catch")),s)s.onUnmount&&a.patch(s.onUnmount(s)),s.replaceWith(D);else{for(var E,F=!1,G=e;G<b.childNodes.length;G++)if(E=b.childNodes[G],E){E.before(D,E),F=!0;break}F||b.appendChild(D)}var H=j(g);if(H)for(var I=C?2:1,J=0,K=0;K<H.length;K++){var L=H[K],M=o(a,D,K,J,void 0,L,null!==h&&void 0!==h?h:null);g[K+I]=M,M&&J++}return D.onMount&&a.patch(D.onMount(D)),g}if(!n&&v&&f[0]===g[0]){var N;g.node=s;var O=g,P=f,Q=i(g),R=i(f);if(void 0!==(null===Q||void 0===Q?void 0:Q.xmlns)&&(h=Q.xmlns),null!==(N=O[1])&&void 0!==N&&N.__memo){var S=O[1];O[1]=r(a,O[1],P[1]),S!==O[1]&&u(a,s,R,Q,h)}else u(a,s,R,Q,h);!(null!==Q&&void 0!==Q&&Q["catch"])||(null===R||void 0===R?void 0:R["catch"])===Q["catch"]||(g.node["catch"]=null,g.node.removeAttribute("catch"));var T=j(g),U=j(f);if(T)for(var V=Q?2:1,W=0,X=0;X<T.length;X++){var Y=T[X],Z=U&&U[X],$=o(a,s,X,W,Z,Y,h);g[X+V]=$,$&&W++}if(U)for(var _=T?T.length:0,aa=U.length-1;aa>=_;aa--)o(a,s,aa,aa,U[aa],void 0,h);return g}}catch(j){var ba,ca=null===(ba=i(g))||void 0===ba?void 0:ba["catch"];if(ca){var da,ea="function"==typeof ca?ca(a,j):ca;return o(a,b,c,e,d((null===(da=g)||void 0===da?void 0:da.node)||(null===f||void 0===f?void 0:f.node),!0),ea,h)}throw j}}function p(a){return Array.isArray(a)&&0<a.length&&"string"==typeof a[0]}function q(a){return"string"==typeof a||(null===a||void 0===a?void 0:a.nodeType)===Node.TEXT_NODE}function r(a,b,c){if("function"!=typeof b)return b;var d=null===b||void 0===b?void 0:b.__memo,e=null===c||void 0===c?void 0:c.__memo;if(Array.isArray(d)&&Array.isArray(e)&&d.length===e.length){for(var f=!0,g=0;g<d.length;g++)if(d[g]!==e[g]){f=!1;break}if(f)return c}var h=t(b,a);return"object"===_typeof(h)&&(h.__memo=null===b||void 0===b?void 0:b.__memo),h}function t(a,b){return"function"==typeof a?t(a(b),b):a}function u(a,b,c,d,e){if(d||c){var f=void 0!==e;if(c)for(var g in c){var h=c[g],i=null===d||void 0===d?void 0:d[g];h!==i&&(d?d[g]=v(a,b,g,h,i,f):v(a,b,g,h,void 0,f))}if(d&&c){for(var j in d)if(!(j in c)){var k=d[j];d[j]=v(a,b,j,void 0,k,f)}}else if(d)for(var l in d){var m=d[l];d[l]=v(a,b,l,void 0,m,f)}}}function v(a,b,c,d,e,f){if("style"===c){if(!e)b.style.cssText="";else if("string"==typeof e)d!==e&&(b.style.cssText=e);else if(d&&"object"===_typeof(d)){for(var g in d){var h=e[g];h||(b.style[g]=null)}for(var i in e){var j=d[i],l=e[i];j!==l&&(b.style[i]=l)}}else for(var m in e)b.style[m]=e[m];}else if("class"===c)e?b.setAttribute("class",w(e)):b.removeAttribute("class");else if(!("o"===c[0]&&"n"===c[1]))f||(b[c]=e),void 0===e||null===e||!1===e?b.removeAttribute(c):b.setAttribute(c,e);else if(e){var n=null;if("function"==typeof e){var o=e;n=function c(b){return a.patch(o(a,b))}}else"object"===_typeof(e)&&(n=function b(){return a.patch(e)});b[c]=n}else b[c]=null;return e}function w(a){return"string"==typeof a?a:Array.isArray(a)?a.map(w).join(" "):"object"===_typeof(a)?Object.keys(a).filter(function(b){return a[b]}).join(" "):""}// src/vode-tags.ts
|
|
1
|
+
"use strict";function _classCallCheck(b,a){if(!(b instanceof a))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,_toPropertyKey(c.key),c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function ownKeys(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function _objectSpread(a){for(var b,c=1;c<arguments.length;c++)b=null==arguments[c]?{}:arguments[c],c%2?ownKeys(Object(b),!0).forEach(function(c){_defineProperty(a,c,b[c])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(b)):ownKeys(Object(b)).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))});return a}function _defineProperty(a,b,c){return(b=_toPropertyKey(b))in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function _toPropertyKey(a){var b=_toPrimitive(a,"string");return"symbol"==_typeof(b)?b:b+""}function _toPrimitive(a,b){if("object"!=_typeof(a)||!a)return a;var c=a[Symbol.toPrimitive];if(void 0!==c){var d=c.call(a,b||"default");if("object"!=_typeof(d))return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===b?String:Number)(a)}function _regenerator(){function b(a,b,f,g){var h=b&&b.prototype instanceof d?b:d,c=Object.create(h.prototype);return _regeneratorDefine2(c,"_invoke",function(a,b,g){function h(a,b){for(q=a,s=b,e=0;!w&&t&&!c&&e<v.length;e++){var c,f=v[e],g=p.p,h=f[2];3<a?(c=h===b)&&(s=f[(q=f[4])?5:(q=3,3)],f[4]=f[5]=j):f[0]<=g&&((c=2>a&&g<f[1])?(q=0,p.v=b,p.n=f[1]):g<h&&(c=3>a||f[0]>b||b>h)&&(f[4]=a,f[5]=b,p.n=h,q=0))}if(c||1<a)return m;throw w=!0,b}var k,q,s,t=0,v=g||[],w=!1,p={p:0,n:0,v:j,a:h,f:h.bind(j,4),d:function c(a,b){return k=a,q=0,s=j,p.n=b,m}};return function(c,d,f){if(1<t)throw TypeError("Generator is already running");for(w&&1===d&&h(d,f),q=d,s=f;(e=2>q?j:s)||!w;){k||(q?3>q?(1<q&&(p.n=-1),h(q,s)):p.n=s:p.v=s);try{if(t=2,k){if(q||(c="next"),e=k[c]){if(!(e=e.call(k,s)))throw TypeError("iterator result is not an object");if(!e.done)return e;s=e.value,2>q&&(q=0)}else 1===q&&(e=k["return"])&&e.call(k),2>q&&(s=TypeError("The iterator does not provide a '"+c+"' method"),q=1);k=j}else if((e=(w=0>p.n)?s:a.call(b,p))!==m)break}catch(a){k=j,q=1,s=a}finally{t=1}}return{value:e,done:w}}}(a,f,g),!0),c}function d(){}function g(){}function h(){}function i(a){return Object.setPrototypeOf?Object.setPrototypeOf(a,h):(a.__proto__=h,_regeneratorDefine2(a,l,"GeneratorFunction")),a.prototype=Object.create(c),a}/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var j,e,f="function"==typeof Symbol?Symbol:{},k=f.iterator||"@@iterator",l=f.toStringTag||"@@toStringTag",m={};e=Object.getPrototypeOf;var a=[][k]?e(e([][k]())):(_regeneratorDefine2(e={},k,function(){return this}),e),c=h.prototype=d.prototype=Object.create(a);return g.prototype=h,_regeneratorDefine2(c,"constructor",h),_regeneratorDefine2(h,"constructor",g),g.displayName="GeneratorFunction",_regeneratorDefine2(h,l,"GeneratorFunction"),_regeneratorDefine2(c),_regeneratorDefine2(c,l,"Generator"),_regeneratorDefine2(c,k,function(){return this}),_regeneratorDefine2(c,"toString",function(){return"[object Generator]"}),(_regenerator=function a(){return{w:b,m:i}})()}function _regeneratorDefine2(a,b,c,d){var f=Object.defineProperty;try{f({},"",{})}catch(a){f=0}_regeneratorDefine2=function e(a,b,c,d){function g(b,c){_regeneratorDefine2(a,b,function(a){return this._invoke(b,c,a)})}b?f?f(a,b,{value:c,enumerable:!d,configurable:!d,writable:!d}):a[b]=c:(g("next",0),g("throw",1),g("return",2))},_regeneratorDefine2(a,b,c,d)}function asyncGeneratorStep(b,d,f,e,g,h,a){try{var c=b[h](a),i=c.value}catch(a){return void f(a)}c.done?d(i):Promise.resolve(i).then(e,g)}function _asyncToGenerator(b){return function(){var c=this,d=arguments;return new Promise(function(e,f){function g(a){asyncGeneratorStep(i,e,f,g,h,"next",a)}function h(a){asyncGeneratorStep(i,e,f,g,h,"throw",a)}var i=b.apply(c,d);g(void 0)})}}function _toConsumableArray(a){return _arrayWithoutHoles(a)||_iterableToArray(a)||_unsupportedIterableToArray(a)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(a){if("undefined"!=typeof Symbol&&null!=a[Symbol.iterator]||null!=a["@@iterator"])return Array.from(a)}function _arrayWithoutHoles(a){if(Array.isArray(a))return _arrayLikeToArray(a)}function _createForOfIteratorHelper(b,c){var d="undefined"!=typeof Symbol&&b[Symbol.iterator]||b["@@iterator"];if(!d){if(Array.isArray(b)||(d=_unsupportedIterableToArray(b))||c&&b&&"number"==typeof b.length){d&&(b=d);var e=0,f=function a(){};return{s:f,n:function a(){return e>=b.length?{done:!0}:{done:!1,value:b[e++]}},e:function b(a){throw a},f:f}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var g,h=!0,i=!1;return{s:function a(){d=d.call(b)},n:function a(){var b=d.next();return h=b.done,b},e:function b(a){i=!0,g=a},f:function a(){try{h||null==d["return"]||d["return"]()}finally{if(i)throw g}}}}function _unsupportedIterableToArray(b,c){if(b){if("string"==typeof b)return _arrayLikeToArray(b,c);var a={}.toString.call(b).slice(8,-1);return"Object"===a&&b.constructor&&(a=b.constructor.name),"Map"===a||"Set"===a?Array.from(b):"Arguments"===a||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?_arrayLikeToArray(b,c):void 0}}function _arrayLikeToArray(b,c){(null==c||c>b.length)&&(c=b.length);for(var d=0,f=Array(c);d<c;d++)f[d]=b[d];return f}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}var V=function(){function a(a,b){if(!a)throw new Error("first argument to vode() must be a tag name or a vode");for(var c=arguments.length,d=Array(2<c?c-2:0),e=2;e<c;e++)d[e-2]=arguments[e];return Array.isArray(a)?a:"object"===_typeof(b)?[a,b].concat(d):[a].concat(d)}function b(a,b,c){function e(b){var d=Date.now(),e=c(j.state);j.vode=o(j.state,a.parentElement,0,0,j.vode,e,null,j.unmounts,0),a.tagName.toUpperCase()!==e[0].toUpperCase()&&(a=j.vode.node,a._vode=j),b||(j.stats.lastSyncRenderTime=Date.now()-d,j.stats.syncRenderCount++,j.isRendering=!1,j.qSync&&j.renderSync())}for(var f,g=arguments.length,h=Array(3<g?g-3:0),i=3;i<g;i++)h[i-3]=arguments[i];if(!(null!==(f=a)&&void 0!==f&&f.parentElement))throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!b||"object"!==_typeof(b))throw new Error("second argument to app() must be a state object");if("function"!=typeof c)throw new Error("third argument to app() must be a function that returns a vode");var j={syncRenderer:K.requestAnimationFrame,asyncRenderer:K.startViewTransition,qSync:null,qAsync:null,stats:{lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0},unmounts:[]},k=b;"patch"in b&&"function"==typeof b.patch&&Array.isArray(b.patch.initialPatches)&&(h=[].concat(_toConsumableArray(b.patch.initialPatches),_toConsumableArray(h))),Object.defineProperty(b,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(a,c){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function c(a,b){var d,e,f,g,h,i,l;return _regenerator().w(function(c){for(;1;)switch(c.p=c.n){case 0:if(a&&("function"==typeof a||"object"===_typeof(a))){c.n=1;break}return c.a(2);case 1:if(j.stats.patchCount++,!(null!==a&&void 0!==a&&a.next)){c.n=12;break}return d=a,j.stats.liveEffectCount++,c.p=2,c.n=3,d.next();case 3:e=c.v;case 4:if(!1!==e.done){c.n=9;break}return j.stats.liveEffectCount++,c.p=5,k.patch(e.value,b),c.n=6,d.next();case 6:e=c.v;case 7:return c.p=7,j.stats.liveEffectCount--,c.f(7);case 8:c.n=4;break;case 9:k.patch(e.value,b);case 10:return c.p=10,j.stats.liveEffectCount--,c.f(10);case 11:c.n=22;break;case 12:if(!a.then){c.n=17;break}return j.stats.liveEffectCount++,c.p=13,c.n=14,a;case 14:f=c.v,k.patch(f,b);case 15:return c.p=15,j.stats.liveEffectCount--,c.f(15);case 16:c.n=22;break;case 17:if(!Array.isArray(a)){c.n=18;break}if(0<a.length){g=_createForOfIteratorHelper(a);try{for(g.s();!(h=g.n()).done;)i=h.value,k.patch(i,!document.hidden&&!!j.asyncRenderer)}catch(a){g.e(a)}finally{g.f()}}else{j.qSync=n(j.qSync||{},j.qAsync,!1),j.qAsync=null;try{null===(l=K.currentViewTransition)||void 0===l||l.skipTransition()}catch(a){}j.stats.syncRenderPatchCount++,j.renderSync()}c.n=22;break;case 18:if("function"!=typeof a){c.n=19;break}k.patch(a(j.state),b),c.n=22;break;case 19:if(!b){c.n=21;break}return j.stats.asyncRenderPatchCount++,j.qAsync=n(j.qAsync||{},a,!1),c.n=20,j.renderAsync();case 20:c.n=22;break;case 21:j.stats.syncRenderPatchCount++,j.qSync=n(j.qSync||{},a,!1),j.renderSync();case 22:return c.a(2)}},c,null,[[13,,15,16],[5,,7,8],[2,,10,11]])}));return a}()});var l=e.bind(null,!1),m=e.bind(null,!0);Object.defineProperty(j,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:function a(){j.isRendering||!j.qSync||(j.isRendering=!0,j.state=n(j.state,j.qSync,!0),j.qSync=null,j.syncRenderer(l))}}),Object.defineProperty(j,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:function(){function a(){return b.apply(this,arguments)}var b=_asyncToGenerator(/*#__PURE__*/_regenerator().m(function a(){var b,c,d;return _regenerator().w(function(a){for(;1;)switch(a.p=a.n){case 0:if(!j.isAnimating&&j.qAsync){a.n=1;break}return a.a(2);case 1:return a.n=2,null===(b=K.currentViewTransition)||void 0===b?void 0:b.updateCallbackDone;case 2:if(!(j.isAnimating||!j.qAsync||document.hidden)){a.n=3;break}return a.a(2);case 3:return j.isAnimating=!0,c=Date.now(),a.p=4,j.state=n(j.state,j.qAsync,!0),j.qAsync=null,K.currentViewTransition=j.asyncRenderer(m),a.n=5,null===(d=K.currentViewTransition)||void 0===d?void 0:d.updateCallbackDone;case 5:return a.p=5,j.stats.lastAsyncRenderTime=Date.now()-c,j.stats.asyncRenderCount++,j.isAnimating=!1,a.f(5);case 6:j.qAsync&&j.renderAsync();case 7:return a.a(2)}},a,null,[[4,,5,6]])}));return a}()}),j.state=k;var p=a;p._vode=j;var q=Array.from(a.parentElement.children).indexOf(a);j.isRendering=!0,j.vode=o(b,a.parentElement,q,q,d(a,!0),c(b),null,j.unmounts,0),j.isRendering=!1,j.qSync&&j.renderSync();var r,s=_createForOfIteratorHelper(h);try{for(s.s();!(r=s.n()).done;){var t=r.value;k.patch(t)}}catch(a){s.e(a)}finally{s.f()}return function(a){return k.patch(a)}}function c(a){if(null!==a&&void 0!==a&&a._vode){var b=function d(a){if(null!==a&&void 0!==a&&a.node){var e=i(a);if(e){for(var f in e)"o"===f[0]&&"n"===f[1]&&(a.node[f]=null);a.node["catch"]=null}if(a.node._vode)c(a.node);else{var g=j(a);if(g){var h,k=_createForOfIteratorHelper(g);try{for(k.s();!(h=k.n()).done;){var l=h.value;b(l)}}catch(a){k.e(a)}finally{k.f()}}}}},d=b,e=a._vode;delete a._vode,Object.defineProperty(e.state,"patch",{value:void 0}),Object.defineProperty(e,"renderSync",{value:function a(){}}),Object.defineProperty(e,"renderAsync",{value:function a(){}}),b(e.vode)}else{var f,g=_createForOfIteratorHelper(a.children);try{for(g.s();!(f=g.n()).done;){var h=f.value;c(h)}}catch(a){g.e(a)}finally{g.f()}}}function d(b,c){if((null===b||void 0===b?void 0:b.nodeType)===Node.TEXT_NODE){var e;return""===(null===(e=b.nodeValue)||void 0===e?void 0:e.trim())?void 0:c?b:b.nodeValue}if(b.nodeType===Node.ELEMENT_NODE){var f=b.tagName.toLowerCase(),g=[f];if(c&&(g.node=b),null!==b&&void 0!==b&&b.hasAttributes()){var h,i={},j=b.attributes,k=_createForOfIteratorHelper(j);try{for(k.s();!(h=k.n()).done;){var l=h.value;i[l.name]=l.value}}catch(a){k.e(a)}finally{k.f()}g.push(i)}if(b.hasChildNodes()){var m,n=[],o=_createForOfIteratorHelper(b.childNodes);try{for(o.s();!(m=o.n()).done;){var p=m.value,q=p&&d(p,c);q?g.push(q):p&&c&&n.push(p)}}catch(a){o.e(a)}finally{o.f()}for(var r,s=0,t=n;s<t.length;s++)r=t[s],r.remove()}return g}}function e(a,b){if(!a||!Array.isArray(a))throw new Error("first argument to memo() must be an array of values to compare");if("function"!=typeof b)throw new Error("second argument to memo() must be a function that returns a vode or props object");return b.__memo=a,b}function f(a){if(!a||"object"!==_typeof(a))throw new Error("createState() must be called with a state object");return"patch"in a||Object.defineProperty(a,"patch",{enumerable:!1,configurable:!0,writable:!1,value:function c(b){var d=a;Array.isArray(d.patch.initialPatches)||(d.patch.initialPatches=[]),d.patch.initialPatches.push(b)}}),a}function g(a){return a}function h(a){return!a?void 0:Array.isArray(a)?a[0]:"string"==typeof a||a.nodeType===Node.TEXT_NODE?"#text":void 0}function i(a){return Array.isArray(a)&&1<a.length&&a[1]&&!Array.isArray(a[1])&&"object"===_typeof(a[1])&&a[1].nodeType!==Node.TEXT_NODE?a[1]:void 0}function j(a){var b=m(a);return 0<b?a.slice(b):null}function k(a){var b=m(a);return 0>b?0:a.length-b}function l(a,b){var c=m(a);return 0<c?a[b+c]:void 0}function m(a){return i(a)?2<a.length?2:-1:Array.isArray(a)&&1<a.length?1:-1}function n(a,b,c){if(!b)return a;for(var d in b){var e=b[d];if(e&&"object"===_typeof(e)){var f=a[d];f?Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date&&f!==e?a[d]=new Date(e):Array.isArray(f)?a[d]=n({},e,c):"object"===_typeof(f)?n(a[d],e,c):a[d]=n({},e,c):Array.isArray(e)?a[d]=_toConsumableArray(e):e instanceof Date?a[d]=new Date(e):a[d]=n({},e,c)}else void 0===e&&c?delete a[d]:a[d]=e}return a}function o(a,b,c,e,f,g,h,k,l){try{var m,n;g=r(a,g,f);var s=!g||"number"==typeof g||"boolean"==typeof g;if(g===f||!f&&s)return f;var t=(null===f||void 0===f?void 0:f.nodeType)===Node.TEXT_NODE,v=t?f:null===f||void 0===f?void 0:f.node;if(s){if(!t&&"number"==typeof(null===f||void 0===f?void 0:f.unmountCount))for(var w,x=f.unmountStart,y=f.unmountCount,z=y-1;0<=z;z--)w=k[x+z],w&&(a.patch(w(a,v)),k[x+z]=null);return void(null===v||void 0===v||v.remove())}var A=!s&&q(g),B=!s&&p(g),C=!!g&&"string"!=typeof g&&!!(null!==(m=g)&&void 0!==m&&m.node||(null===(n=g)||void 0===n?void 0:n.nodeType)===Node.TEXT_NODE);if(!A&&!B&&!C&&!f)throw new Error("Invalid vode: "+_typeof(g)+" "+JSON.stringify(g));else C&&A?g=g.wholeText:C&&B&&(g=_toConsumableArray(g));if(t&&A)return v.nodeValue!==g&&(v.nodeValue=g),f;if(A&&(!v||!t)){var D=document.createTextNode(g);if(v){if(!t&&"number"==typeof(null===f||void 0===f?void 0:f.unmountCount))for(var E,F=f.unmountStart,G=f.unmountCount,H=G-1;0<=H;H--)E=k[F+H],E&&(a.patch(E(a,v)),k[F+H]=null);v.replaceWith(D)}else{for(var I,J=!1,K=e;K<b.childNodes.length;K++)if(I=b.childNodes[K],I){I.before(D,I),J=!0;break}J||b.appendChild(D)}return D}if(B&&(!v||t||f[0]!==g[0])){var L=g;1 in L&&(L[1]=r(a,L[1],void 0));var M=i(g);void 0!==(null===M||void 0===M?void 0:M.xmlns)&&(h=M.xmlns);var N=h?document.createElementNS(h,g[0]):document.createElement(g[0]);if(g.node=N,u(a,N,void 0,M,null!==h&&void 0!==h?h:null),!!M&&"catch"in M&&(g.node["catch"]=null,g.node.removeAttribute("catch")),v){var O;if(!t&&"number"==typeof(null===f||void 0===f?void 0:f.unmountCount))for(var P,Q=f.unmountStart,R=f.unmountCount,S=R-1;0<=S;S--)P=k[Q+S],P&&(a.patch(P(a,v)),k[Q+S]=null);k[l]=null!==(O=null===M||void 0===M?void 0:M.onUnmount)&&void 0!==O?O:null,v.replaceWith(N)}else{var T;k[l]=null!==(T=null===M||void 0===M?void 0:M.onUnmount)&&void 0!==T?T:null;for(var U,V=!1,W=e;W<b.childNodes.length;W++)if(U=b.childNodes[W],U){U.before(N,U),V=!0;break}V||b.appendChild(N)}var X=0,Y=l+1,Z=j(g);if(Z)for(var $=M?2:1,_=0,aa=0;aa<Z.length;aa++){var ba=Z[aa],ca=o(a,N,aa,_,void 0,ba,null!==h&&void 0!==h?h:null,k,Y);if(g[aa+$]=ca,ca){_++;var da=ca.unmountCount||0;X+=da,Y+=da}}return N.onMount&&a.patch(N.onMount(N)),g.unmountCount=1+X,g.unmountStart=l,g}if(!t&&B&&f[0]===g[0]){var ea,fa;g.node=v;var ga=g,ha=f,ia=i(g),ja=i(f);if(void 0!==(null===ia||void 0===ia?void 0:ia.xmlns)&&(h=ia.xmlns),null!==(ea=ga[1])&&void 0!==ea&&ea.__memo){var ka=ga[1];ga[1]=r(a,ga[1],ha[1]),ka!==ga[1]&&u(a,v,ja,ia,h)}else u(a,v,ja,ia,h);!(null!==ia&&void 0!==ia&&ia["catch"])||(null===ja||void 0===ja?void 0:ja["catch"])===ia["catch"]||(g.node["catch"]=null,g.node.removeAttribute("catch")),k[l]=null!==(fa=null===ia||void 0===ia?void 0:ia.onUnmount)&&void 0!==fa?fa:null;var la=0,ma=l+1,na=j(g),oa=j(f);if(na)for(var pa=ia?2:1,qa=0,ra=0;ra<na.length;ra++){var sa=na[ra],ta=oa&&oa[ra],ua=o(a,v,ra,qa,ta,sa,h,k,ma);if(g[ra+pa]=ua,ua){qa++;var va=ua.unmountCount||0;la+=va,ma+=va}}if(oa)for(var wa=na?na.length:0,xa=oa.length-1;xa>=wa;xa--)o(a,v,xa,xa,oa[xa],void 0,h,k,oa[xa].unmountStart);return g.unmountCount=1+la,g.unmountStart=l,g}}catch(j){var ya,za=null===(ya=i(g))||void 0===ya?void 0:ya["catch"];if(za){var Aa,Ba="function"==typeof za?za(a,j):za;return o(a,b,c,e,d((null===(Aa=g)||void 0===Aa?void 0:Aa.node)||(null===f||void 0===f?void 0:f.node),!0),Ba,h,k,l)}throw j}}function p(a){return Array.isArray(a)&&0<a.length&&"string"==typeof a[0]}function q(a){return"string"==typeof a||(null===a||void 0===a?void 0:a.nodeType)===Node.TEXT_NODE}function r(a,b,c){if("function"!=typeof b)return b;var d=null===b||void 0===b?void 0:b.__memo,e=null===c||void 0===c?void 0:c.__memo;if(Array.isArray(d)&&Array.isArray(e)&&d.length===e.length){for(var f=!0,g=0;g<d.length;g++)if(d[g]!==e[g]){f=!1;break}if(f)return c}var h=b(a);if("function"==typeof h&&null!==h&&void 0!==h&&h.__memo){var j=h.__memo;if(Array.isArray(j)&&Array.isArray(e)&&j.length===e.length){for(var k=!0,l=0;l<j.length;l++)if(j[l]!==e[l]){k=!1;break}if(k)return c}var m=h(a);return"object"===_typeof(m)&&(m.__memo=j),m}var n="function"==typeof h?t(h,a):h;return"object"===_typeof(n)&&(n.__memo=(null===h||void 0===h?void 0:h.__memo)||(null===b||void 0===b?void 0:b.__memo)),n}function t(a,b){return"function"==typeof a?t(a(b),b):a}function u(a,b,c,d,e){if(d||c){var f=void 0!==e;if(c)for(var g in c){var h=c[g],i=null===d||void 0===d?void 0:d[g];h!==i&&(d?d[g]=v(a,b,g,h,i,f):v(a,b,g,h,void 0,f))}if(d&&c){for(var j in d)if(!(j in c)){var k=d[j];d[j]=v(a,b,j,void 0,k,f)}}else if(d)for(var l in d){var m=d[l];d[l]=v(a,b,l,void 0,m,f)}}}function v(a,b,c,d,e,f){if("style"===c){if(!e)b.style.cssText="";else if("string"==typeof e)d!==e&&(b.style.cssText=e);else if(d&&"object"===_typeof(d)){for(var g in d){var h=e[g];h||(b.style[g]=null)}for(var i in e){var j=d[i],l=e[i];j!==l&&(b.style[i]=l)}}else for(var m in e)b.style[m]=e[m];}else if("class"===c)e?b.setAttribute("class",w(e)):b.removeAttribute("class");else if(!("o"===c[0]&&"n"===c[1]))f||(b[c]=e),void 0===e||null===e||!1===e?b.removeAttribute(c):b.setAttribute(c,e);else if(e){var n=null;if("function"==typeof e){var o=e;n=function c(b){return a.patch(o(a,b))}}else"object"===_typeof(e)&&(n=function b(){return a.patch(e)});b[c]=n}else b[c]=null;return e}function w(a){return"string"==typeof a?a:Array.isArray(a)?a.map(w).join(" "):"object"===_typeof(a)?Object.keys(a).filter(function(b){return a[b]}).join(" "):""}// src/vode-tags.ts
|
|
2
2
|
// src/merge-class.ts
|
|
3
3
|
function x(){for(var c=arguments.length,d=Array(c),e=0;e<c;e++)d[e]=arguments[e];if(!d||0===d.length)return null;if(1===d.length)return d[0];for(var f=d[0],g=1;g<d.length;g++){var h=f,i=d[g];if(!h)f=i;else if(!i)continue;else if("string"==typeof h&&"string"==typeof i){var j=h.split(" "),k=i.split(" "),l=/* @__PURE__ */new Set([].concat(_toConsumableArray(j),_toConsumableArray(k)));f=Array.from(l).join(" ").trim()}else if("string"==typeof h&&Array.isArray(i)){var m=/* @__PURE__ */new Set([].concat(_toConsumableArray(i),_toConsumableArray(h.split(" "))));f=Array.from(m).join(" ").trim()}else if(Array.isArray(h)&&"string"==typeof i){var n=/* @__PURE__ */new Set([].concat(_toConsumableArray(h),_toConsumableArray(i.split(" "))));f=Array.from(n).join(" ").trim()}else if(Array.isArray(h)&&Array.isArray(i)){var o=/* @__PURE__ */new Set([].concat(_toConsumableArray(h),_toConsumableArray(i)));f=Array.from(o).join(" ").trim()}else if("string"==typeof h&&"object"===_typeof(i))f=_objectSpread(_defineProperty({},h,!0),i);else if("object"===_typeof(h)&&"string"==typeof i)f=_objectSpread(_objectSpread({},h),{},_defineProperty({},i,!0));else if("object"===_typeof(h)&&"object"===_typeof(i))f=_objectSpread(_objectSpread({},h),i);else if("object"===_typeof(h)&&Array.isArray(i)){var p,q=_objectSpread({},h),r=_createForOfIteratorHelper(i);try{for(r.s();!(p=r.n()).done;){var s=p.value;q[s]=!0}}catch(a){r.e(a)}finally{r.f()}f=q}else if(Array.isArray(h)&&"object"===_typeof(i)){var t,u={},v=_createForOfIteratorHelper(h);try{for(v.s();!(t=v.n()).done;){var w=t.value;u[w]=!0}}catch(a){v.e(a)}finally{v.f()}for(var x,y=0,z=Object.keys(i);y<z.length;y++)x=z[y],u[x]=i[x];f=u}else throw new Error("cannot merge classes of ".concat(h," (").concat(_typeof(h),") and ").concat(i," (").concat(_typeof(i),")"))}return f}// src/merge-style.ts
|
|
4
|
-
function y(){try{for(var a=
|
|
4
|
+
function y(){J||(J=document.createElement("div"));try{for(var a=J.style,b=arguments.length,c=Array(b),d=0;d<b;d++)c[d]=arguments[d];for(var e,f=0,g=c;f<g.length;f++)if(e=g[f],"object"===_typeof(e)&&null!==e)for(var h in e)a[h]=e[h];else"string"==typeof e&&(a.cssText+=";"+e);return a.cssText}finally{J.style.cssText=""}}// src/merge-props.ts
|
|
5
5
|
function z(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];if(0!==b.length){if(1===b.length)return b[0]||void 0;for(var d,e,f=0,g=b;f<(void 0).length;f++)if(e=(void 0)[f],"object"===_typeof(e)&&null!==e)for(var h in d||(d={}),e)"style"===h?d.style=y(d.style,e.style):"class"===h?d["class"]=x(d["class"],e["class"]):d[h]=e[h];return d}}// src/state-context.ts
|
|
6
6
|
function A(a){return new vd(a,[])}var B=Object.defineProperty,C=Object.getOwnPropertyDescriptor,D=Object.getOwnPropertyNames,E=Object.prototype.hasOwnProperty,F=function c(a,b){for(var d in b)B(a,d,{get:b[d],enumerable:!0})},G=function e(a,b,c,d){if(b&&"object"===_typeof(b)||"function"==typeof b){var f,g=_createForOfIteratorHelper(D(b));try{var h=function e(){var g=f.value;E.call(a,g)||g===c||B(a,g,{get:function a(){return b[g]},enumerable:!(d=C(b,g))||d.enumerable})};for(g.s();!(f=g.n()).done;)h()}catch(a){g.e(a)}finally{g.f()}}return a},H=function b(a){return G(B({},"__esModule",{value:!0}),a)},I={};// index.ts
|
|
7
|
-
F(I,{A:function a(){return
|
|
8
|
-
var J={currentViewTransition:void 0,requestAnimationFrame
|
|
7
|
+
F(I,{A:function a(){return L},ABBR:function a(){return s},ADDRESS:function a(){return M},ANIMATE:function a(){return Ob},ANIMATEMOTION:function a(){return Pb},ANIMATETRANSFORM:function a(){return Qb},ANNOTATION:function a(){return Tc},ANNOTATION_XML:function a(){return Uc},AREA:function a(){return N},ARTICLE:function a(){return O},ASIDE:function a(){return P},AUDIO:function a(){return Q},B:function a(){return R},BASE:function a(){return S},BDI:function a(){return T},BDO:function a(){return U},BLOCKQUOTE:function a(){return V},BODY:function a(){return W},BR:function a(){return X},BUTTON:function a(){return Y},CANVAS:function a(){return Z},CAPTION:function a(){return $},CIRCLE:function a(){return Rb},CITE:function a(){return _},CLIPPATH:function a(){return Sb},CODE:function a(){return aa},COL:function a(){return ba},COLGROUP:function a(){return ca},DATA:function a(){return da},DATALIST:function a(){return ea},DD:function a(){return fa},DEFS:function a(){return Tb},DEL:function a(){return ga},DESC:function a(){return Ub},DETAILS:function a(){return ha},DFN:function a(){return ia},DIALOG:function a(){return ja},DIV:function a(){return ka},DL:function a(){return la},DT:function a(){return ma},ELLIPSE:function a(){return Vb},EM:function a(){return na},EMBED:function a(){return oa},FEBLEND:function a(){return Wb},FECOLORMATRIX:function a(){return Xb},FECOMPONENTTRANSFER:function a(){return Yb},FECOMPOSITE:function a(){return Zb},FECONVOLVEMATRIX:function a(){return $b},FEDIFFUSELIGHTING:function a(){return _b},FEDISPLACEMENTMAP:function a(){return ac},FEDISTANTLIGHT:function a(){return bc},FEDROPSHADOW:function a(){return cc},FEFLOOD:function a(){return dc},FEFUNCA:function a(){return ec},FEFUNCB:function a(){return fc},FEFUNCG:function a(){return gc},FEFUNCR:function a(){return hc},FEGAUSSIANBLUR:function a(){return ic},FEIMAGE:function a(){return jc},FEMERGE:function a(){return kc},FEMERGENODE:function a(){return lc},FEMORPHOLOGY:function a(){return mc},FEOFFSET:function a(){return nc},FEPOINTLIGHT:function a(){return oc},FESPECULARLIGHTING:function a(){return pc},FESPOTLIGHT:function a(){return qc},FETILE:function a(){return rc},FETURBULENCE:function a(){return sc},FIELDSET:function a(){return pa},FIGCAPTION:function a(){return qa},FIGURE:function a(){return ra},FILTER:function a(){return tc},FOOTER:function a(){return sa},FOREIGNOBJECT:function a(){return uc},FORM:function a(){return ta},G:function a(){return vc},H1:function a(){return ua},H2:function a(){return va},H3:function a(){return wa},H4:function a(){return xa},H5:function a(){return ya},H6:function a(){return za},HEAD:function a(){return Aa},HEADER:function a(){return Ba},HGROUP:function a(){return Ca},HR:function a(){return Da},HTML:function a(){return Ea},I:function a(){return Fa},IFRAME:function a(){return Ga},IMAGE:function a(){return wc},IMG:function a(){return Ha},INPUT:function a(){return Ia},INS:function a(){return Ja},KBD:function a(){return Ka},LABEL:function a(){return La},LEGEND:function a(){return Ma},LI:function a(){return Na},LINE:function a(){return xc},LINEARGRADIENT:function a(){return yc},LINK:function a(){return Oa},MACTION:function a(){return Vc},MAIN:function a(){return Pa},MAP:function a(){return Qa},MARK:function a(){return Ra},MARKER:function a(){return zc},MASK:function a(){return Ac},MATH:function a(){return Wc},MENU:function a(){return Sa},MERROR:function a(){return Xc},META:function a(){return Ta},METADATA:function a(){return Bc},METER:function a(){return Ua},MFRAC:function a(){return Yc},MI:function a(){return Zc},MMULTISCRIPTS:function a(){return $c},MN:function a(){return _c},MO:function a(){return ad},MOVER:function a(){return bd},MPADDED:function a(){return cd},MPATH:function a(){return Cc},MPHANTOM:function a(){return dd},MPRESCRIPTS:function a(){return ed},MROOT:function a(){return fd},MROW:function a(){return gd},MS:function a(){return hd},MSPACE:function a(){return id},MSQRT:function a(){return jd},MSTYLE:function a(){return kd},MSUB:function a(){return ld},MSUBSUP:function a(){return md},MSUP:function a(){return nd},MTABLE:function a(){return od},MTD:function a(){return pd},MTEXT:function a(){return qd},MTR:function a(){return rd},MUNDER:function a(){return sd},MUNDEROVER:function a(){return td},NAV:function a(){return Va},NOSCRIPT:function a(){return Wa},OBJECT:function a(){return Xa},OL:function a(){return Ya},OPTGROUP:function a(){return Za},OPTION:function a(){return $a},OUTPUT:function a(){return _a},P:function a(){return ab},PATH:function a(){return Dc},PATTERN:function a(){return Ec},PICTURE:function a(){return bb},POLYGON:function a(){return Fc},POLYLINE:function a(){return Gc},PRE:function a(){return cb},PROGRESS:function a(){return db},Q:function a(){return eb},RADIALGRADIENT:function a(){return Hc},RECT:function a(){return Ic},RP:function a(){return fb},RT:function a(){return gb},RUBY:function a(){return hb},S:function a(){return ib},SAMP:function a(){return jb},SCRIPT:function a(){return kb},SEARCH:function a(){return lb},SECTION:function a(){return mb},SELECT:function a(){return nb},SEMANTICS:function a(){return ud},SET:function a(){return Jc},SLOT:function a(){return ob},SMALL:function a(){return pb},SOURCE:function a(){return qb},SPAN:function a(){return rb},STOP:function a(){return Kc},STRONG:function a(){return sb},STYLE:function a(){return tb},SUB:function a(){return ub},SUMMARY:function a(){return vb},SUP:function a(){return wb},SVG:function a(){return Lc},SWITCH:function a(){return Mc},SYMBOL:function a(){return Nc},TABLE:function a(){return xb},TBODY:function a(){return yb},TD:function a(){return zb},TEMPLATE:function a(){return Ab},TEXT:function a(){return Oc},TEXTAREA:function a(){return Bb},TEXTPATH:function a(){return Pc},TFOOT:function a(){return Cb},TH:function a(){return Db},THEAD:function a(){return Eb},TIME:function a(){return Fb},TITLE:function a(){return Gb},TR:function a(){return Hb},TRACK:function a(){return Ib},TSPAN:function a(){return Qc},U:function a(){return Jb},UL:function a(){return Kb},USE:function a(){return Rc},VAR:function a(){return Lb},VIDEO:function a(){return Mb},VIEW:function a(){return Sc},WBR:function a(){return Nb},app:function a(){return b},child:function a(){return l},childCount:function a(){return k},children:function a(){return j},childrenStart:function a(){return m},context:function a(){return A},createPatch:function a(){return g},createState:function a(){return f},defuse:function a(){return c},globals:function a(){return K},hydrate:function a(){return d},memo:function a(){return e},mergeClass:function a(){return x},mergeProps:function a(){return z},mergeStyle:function a(){return y},props:function a(){return i},tag:function a(){return h},vode:function b(){return a}});// src/vode.ts
|
|
8
|
+
var J,K={currentViewTransition:void 0,requestAnimationFrame:"undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(a){return a()},startViewTransition:"undefined"!=typeof document&&"function"==typeof document.startViewTransition?document.startViewTransition.bind(document):null},L="a",s="abbr",M="address",N="area",O="article",P="aside",Q="audio",R="b",S="base",T="bdi",U="bdo",V="blockquote",W="body",X="br",Y="button",Z="canvas",$="caption",_="cite",aa="code",ba="col",ca="colgroup",da="data",ea="datalist",fa="dd",ga="del",ha="details",ia="dfn",ja="dialog",ka="div",la="dl",ma="dt",na="em",oa="embed",pa="fieldset",qa="figcaption",ra="figure",sa="footer",ta="form",ua="h1",va="h2",wa="h3",xa="h4",ya="h5",za="h6",Aa="head",Ba="header",Ca="hgroup",Da="hr",Ea="html",Fa="i",Ga="iframe",Ha="img",Ia="input",Ja="ins",Ka="kbd",La="label",Ma="legend",Na="li",Oa="link",Pa="main",Qa="map",Ra="mark",Sa="menu",Ta="meta",Ua="meter",Va="nav",Wa="noscript",Xa="object",Ya="ol",Za="optgroup",$a="option",_a="output",ab="p",bb="picture",cb="pre",db="progress",eb="q",fb="rp",gb="rt",hb="ruby",ib="s",jb="samp",kb="script",lb="search",mb="section",nb="select",ob="slot",pb="small",qb="source",rb="span",sb="strong",tb="style",ub="sub",vb="summary",wb="sup",xb="table",yb="tbody",zb="td",Ab="template",Bb="textarea",Cb="tfoot",Db="th",Eb="thead",Fb="time",Gb="title",Hb="tr",Ib="track",Jb="u",Kb="ul",Lb="var",Mb="video",Nb="wbr",Ob="animate",Pb="animateMotion",Qb="animateTransform",Rb="circle",Sb="clipPath",Tb="defs",Ub="desc",Vb="ellipse",Wb="feBlend",Xb="feColorMatrix",Yb="feComponentTransfer",Zb="feComposite",$b="feConvolveMatrix",_b="feDiffuseLighting",ac="feDisplacementMap",bc="feDistantLight",cc="feDropShadow",dc="feFlood",ec="feFuncA",fc="feFuncB",gc="feFuncG",hc="feFuncR",ic="feGaussianBlur",jc="feImage",kc="feMerge",lc="feMergeNode",mc="feMorphology",nc="feOffset",oc="fePointLight",pc="feSpecularLighting",qc="feSpotLight",rc="feTile",sc="feTurbulence",tc="filter",uc="foreignObject",vc="g",wc="image",xc="line",yc="linearGradient",zc="marker",Ac="mask",Bc="metadata",Cc="mpath",Dc="path",Ec="pattern",Fc="polygon",Gc="polyline",Hc="radialGradient",Ic="rect",Jc="set",Kc="stop",Lc="svg",Mc="switch",Nc="symbol",Oc="text",Pc="textPath",Qc="tspan",Rc="use",Sc="view",Tc="annotation",Uc="annotation-xml",Vc="maction",Wc="math",Xc="merror",Yc="mfrac",Zc="mi",$c="mmultiscripts",_c="mn",ad="mo",bd="mover",cd="mpadded",dd="mphantom",ed="mprescripts",fd="mroot",gd="mrow",hd="ms",id="mspace",jd="msqrt",kd="mstyle",ld="msub",md="msubsup",nd="msup",od="mtable",pd="mtd",qd="mtext",rd="mtr",sd="munder",td="munderover",ud="semantics",vd=/*#__PURE__*/function(){function a(b,c){function d(a,b){if(1<c.length){var d=0,e=b[c[d]];for(("object"!==_typeof(e)||null===e)&&(b[c[d]]=e={}),d=1;d<c.length-1;d++){var f=e;e=e[c[d]],("object"!==_typeof(e)||null===e)&&(f[c[d]]=e={})}e[c[d]]=a}else 1===c.length?"object"===_typeof(b[c[0]])&&"object"===_typeof(a)?Object.assign(b[c[0]],a):b[c[0]]=a:Object.assign(b,a)}function e(a){var b={};return d(a,b),b}function f(){if(0===c.length)return b;for(var a=b?b[c[0]]:void 0,d=1;d<c.length&&!!a;d++)a=a[c[d]];return a}function g(a){d(a,b)}function h(a,c){c?b.patch([e(a)]):b.patch(e(a))}return _classCallCheck(this,a),_defineProperty(this,"state",void 0),_defineProperty(this,"keys",void 0),this.state=b,this.keys=c,new Proxy(this,{get:function i(c,d,e){if("state"===d)return b;if("get"===d)return f;if("put"===d)return g;if("patch"===d)return h;var j=[].concat(_toConsumableArray(c.keys),[d+""]);return new a(c.state,j)}})}return _createClass(a,[{key:"get",value:function a(){}},{key:"put",value:function b(a){}},{key:"patch",value:function b(a){}}])}();return H(I)}();
|