@ryupold/vode 1.6.4 → 1.6.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/README.md +5 -2
- package/babel.config.json +6 -0
- package/dist/vode.amd.min.js +18 -0
- package/dist/vode.es5.min.js +19 -0
- package/dist/vode.js +12 -4
- package/dist/vode.min.js +1 -1
- package/dist/vode.min.mjs +1 -1
- package/dist/vode.mjs +12 -4
- package/package.json +8 -2
- package/src/vode.ts +14 -4
package/README.md
CHANGED
|
@@ -496,7 +496,7 @@ Or just don't make errors happen in the first place :)
|
|
|
496
496
|
The library provides some helper functions for common tasks.
|
|
497
497
|
|
|
498
498
|
```typescript
|
|
499
|
-
import { tag, props, children, mergeClass, hydrate } from '@ryupold/vode';
|
|
499
|
+
import { tag, props, children, mergeClass, hydrate, vode } from '@ryupold/vode';
|
|
500
500
|
|
|
501
501
|
// Merge class props intelligently
|
|
502
502
|
mergeClass('foo', ['baz', 'bar']); // -> 'foo baz bar'
|
|
@@ -507,7 +507,10 @@ mergeClass({zig: true, zag: false}, 'foo', ['baz', 'bar']); // -> 'zig foo baz
|
|
|
507
507
|
mergeStyle({ color: 'red' }, 'font-weight: bold;'); // -> 'color: red; font-weight: bold;'
|
|
508
508
|
mergeStyle('color: white; background-color: blue;', { marginTop: '10px', color: 'green' }); // -> 'background-color: blue; margin-top: 10px; color: green;'
|
|
509
509
|
|
|
510
|
-
|
|
510
|
+
// create a vode
|
|
511
|
+
const myVode: Vode = [DIV, { class: 'foo' }, [SPAN, 'hello'], [STRONG, 'world']];
|
|
512
|
+
const alsoMyVode1: Vode = vode(DIV, { class: 'foo' }, [SPAN, 'hello'], [STRONG, 'world']);
|
|
513
|
+
const alsoMyVode2: Vode = vode([DIV, { class: 'foo' }, [SPAN, 'hello'], [STRONG, 'world']]);
|
|
511
514
|
|
|
512
515
|
// access parts of a vode
|
|
513
516
|
tag(myVode); // 'div'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.LINE=exports.LI=exports.LEGEND=exports.LABEL=exports.KeyStateContext=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.DelegateStateContext=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.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=exports.LINK=exports.LINEARGRADIENT=void 0,exports.WBR=exports.VIEW=exports.VIDEO=void 0,exports.app=app,exports.child=child,exports.childCount=childCount,exports.children=children,exports.childrenStart=childrenStart,exports.createPatch=createPatch,exports.createState=createState,exports.defuse=defuse,exports.globals=void 0,exports.hydrate=hydrate,exports.memo=memo,exports.mergeClass=mergeClass,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 _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 _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 _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 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 _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){var d;function e(b){var d=Date.now(),e=c(f.state);f.vode=render(f.state,a.parentElement,0,0,f.vode,e),a.tagName.toUpperCase()!==e[0].toUpperCase()&&(a=f.vode.node,a._vode=f),b||(f.stats.lastSyncRenderTime=Date.now()-d,f.stats.syncRenderCount++,f.isRendering=!1,f.qSync&&f.renderSync())}if(!(null!==(d=a)&&void 0!==d&&d.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 f={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}},g=b;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,h,i,j,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(f.stats.patchCount++,!(null!==a&&void 0!==a&&a.next)){c.n=12;break}return d=a,f.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 f.stats.liveEffectCount++,c.p=5,g.patch(e.value,b),c.n=6,d.next();case 6:e=c.v;case 7:return c.p=7,f.stats.liveEffectCount--,c.f(7);case 8:c.n=4;break;case 9:g.patch(e.value,b);case 10:return c.p=10,f.stats.liveEffectCount--,c.f(10);case 11:c.n=22;break;case 12:if(!a.then){c.n=17;break}return f.stats.liveEffectCount++,c.p=13,c.n=14,a;case 14:h=c.v,g.patch(h,b);case 15:return c.p=15,f.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){i=_createForOfIteratorHelper(a);try{for(i.s();!(j=i.n()).done;)k=j.value,g.patch(k,!document.hidden&&!!f.asyncRenderer)}catch(a){i.e(a)}finally{i.f()}}else{f.qSync=mergeState(f.qSync||{},f.qAsync,!1),f.qAsync=null;try{null===(l=globals.currentViewTransition)||void 0===l||l.skipTransition()}catch(a){}f.stats.syncRenderPatchCount++,f.renderSync()}c.n=22;break;case 18:if("function"!=typeof a){c.n=19;break}g.patch(a(f.state),b),c.n=22;break;case 19:if(!b){c.n=21;break}return f.stats.asyncRenderPatchCount++,f.qAsync=mergeState(f.qAsync||{},a,!1),c.n=20,f.renderAsync();case 20:c.n=22;break;case 21:f.stats.syncRenderPatchCount++,f.qSync=mergeState(f.qSync||{},a,!1),f.renderSync();case 22:return c.a(2)}},c,null,[[13,,15,16],[5,,7,8],[2,,10,11]])}));return a}()});var h=e.bind(null,!1),i=e.bind(null,!0);Object.defineProperty(f,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:function a(){f.isRendering||!f.qSync||(f.isRendering=!0,f.state=mergeState(f.state,f.qSync,!0),f.qSync=null,f.syncRenderer(h))}}),Object.defineProperty(f,"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(!f.isAnimating&&f.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(!(f.isAnimating||!f.qAsync||document.hidden)){a.n=3;break}return a.a(2);case 3:return f.isAnimating=!0,c=Date.now(),a.p=4,f.state=mergeState(f.state,f.qAsync,!0),f.qAsync=null,globals.currentViewTransition=f.asyncRenderer(i),a.n=5,null===(d=globals.currentViewTransition)||void 0===d?void 0:d.updateCallbackDone;case 5:return a.p=5,f.stats.lastAsyncRenderTime=Date.now()-c,f.stats.asyncRenderCount++,f.isAnimating=!1,a.f(5);case 6:f.qAsync&&f.renderAsync();case 7:return a.a(2)}},a,null,[[4,,5,6]])}));return a}()}),f.state=g;var j=a;j._vode=f;var k=Array.from(a.parentElement.children).indexOf(a);f.vode=render(b,a.parentElement,k,k,hydrate(a,!0),c(b));for(var l=arguments.length,m=Array(3<l?l-3:0),n=3;n<l;n++)m[n-3]=arguments[n];for(var o,p=0,q=m;p<q.length;p++)o=q[p],g.patch(o);return function(a){return g.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 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
|
|
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
|
+
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");function mergeStyle(){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/state-context.ts
|
|
6
|
+
var KeyStateContext=exports.KeyStateContext=/*#__PURE__*/function(){function a(b,c){_classCallCheck(this,a),_defineProperty(this,"keys",void 0),this.state=b,this.path=c,this.keys=c.split(".")}return _createClass(a,[{key:"get",value:function a(){for(var b=this.keys,c=this.state?this.state[b[0]]:void 0,d=1;d<b.length&&!!c;d++)c=c[b[d]];return c}},{key:"put",value:function b(a){this.putDeep(a,this.state)}},{key:"patch",value:function b(a){if(Array.isArray(a)){var c,d=[],e=_createForOfIteratorHelper(a);try{for(e.s();!(c=e.n()).done;){var f=c.value;d.push(this.createPatch(f))}}catch(a){e.e(a)}finally{e.f()}this.state.patch(d)}else this.state.patch(this.createPatch(a))}/**
|
|
7
|
+
* Creates a render-patch for the parent state by setting a nested sub-state value while creating necessary structure.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* const ctx = new KeyStateContext(state, 'user.profile.settings');
|
|
12
|
+
* const patch = ctx.createPatch({ theme: 'light' });
|
|
13
|
+
* // patch is { user: { profile: { settings: { theme: 'light' } } } }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param value
|
|
17
|
+
* @returns {{key-path}:{...: value}} render-patch for the parent state
|
|
18
|
+
*/},{key:"createPatch",value:function b(a){var c={};return this.putDeep(a,c),c}},{key:"putDeep",value:function c(a,b){var d=this.keys;if(1<d.length){var e=0,f=b[d[e]];for(("object"!==_typeof(f)||null===f)&&(b[d[e]]=f={}),e=1;e<d.length-1;e++){var g=f;f=f[d[e]],("object"!==_typeof(f)||null===f)&&(g[d[e]]=f={})}f[d[e]]=a}else"object"===_typeof(b[d[0]])&&"object"===_typeof(a)?Object.assign(b[d[0]],a):b[d[0]]=a}}])}(),DelegateStateContext=exports.DelegateStateContext=/*#__PURE__*/_createClass(function e(a,b,c,d){_classCallCheck(this,e),this.state=a,this.get=b,this.put=c,this.patch=d});
|
|
@@ -0,0 +1,19 @@
|
|
|
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 _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 _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 _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){var e;function f(b){var d=Date.now(),e=c(g.state);g.vode=o(g.state,a.parentElement,0,0,g.vode,e),a.tagName.toUpperCase()!==e[0].toUpperCase()&&(a=g.vode.node,a._vode=g),b||(g.stats.lastSyncRenderTime=Date.now()-d,g.stats.syncRenderCount++,g.isRendering=!1,g.qSync&&g.renderSync())}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 g={syncRenderer:H.requestAnimationFrame,asyncRenderer:H.startViewTransition,qSync:null,qAsync:null,stats:{lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0}},h=b;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,i,j,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(g.stats.patchCount++,!(null!==a&&void 0!==a&&a.next)){c.n=12;break}return d=a,g.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 g.stats.liveEffectCount++,c.p=5,h.patch(e.value,b),c.n=6,d.next();case 6:e=c.v;case 7:return c.p=7,g.stats.liveEffectCount--,c.f(7);case 8:c.n=4;break;case 9:h.patch(e.value,b);case 10:return c.p=10,g.stats.liveEffectCount--,c.f(10);case 11:c.n=22;break;case 12:if(!a.then){c.n=17;break}return g.stats.liveEffectCount++,c.p=13,c.n=14,a;case 14:f=c.v,h.patch(f,b);case 15:return c.p=15,g.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){i=_createForOfIteratorHelper(a);try{for(i.s();!(j=i.n()).done;)k=j.value,h.patch(k,!document.hidden&&!!g.asyncRenderer)}catch(a){i.e(a)}finally{i.f()}}else{g.qSync=n(g.qSync||{},g.qAsync,!1),g.qAsync=null;try{null===(l=H.currentViewTransition)||void 0===l||l.skipTransition()}catch(a){}g.stats.syncRenderPatchCount++,g.renderSync()}c.n=22;break;case 18:if("function"!=typeof a){c.n=19;break}h.patch(a(g.state),b),c.n=22;break;case 19:if(!b){c.n=21;break}return g.stats.asyncRenderPatchCount++,g.qAsync=n(g.qAsync||{},a,!1),c.n=20,g.renderAsync();case 20:c.n=22;break;case 21:g.stats.syncRenderPatchCount++,g.qSync=n(g.qSync||{},a,!1),g.renderSync();case 22:return c.a(2)}},c,null,[[13,,15,16],[5,,7,8],[2,,10,11]])}));return a}()});var i=f.bind(null,!1),j=f.bind(null,!0);Object.defineProperty(g,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:function a(){g.isRendering||!g.qSync||(g.isRendering=!0,g.state=n(g.state,g.qSync,!0),g.qSync=null,g.syncRenderer(i))}}),Object.defineProperty(g,"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(!g.isAnimating&&g.qAsync){a.n=1;break}return a.a(2);case 1:return a.n=2,null===(b=H.currentViewTransition)||void 0===b?void 0:b.updateCallbackDone;case 2:if(!(g.isAnimating||!g.qAsync||document.hidden)){a.n=3;break}return a.a(2);case 3:return g.isAnimating=!0,c=Date.now(),a.p=4,g.state=n(g.state,g.qAsync,!0),g.qAsync=null,H.currentViewTransition=g.asyncRenderer(j),a.n=5,null===(d=H.currentViewTransition)||void 0===d?void 0:d.updateCallbackDone;case 5:return a.p=5,g.stats.lastAsyncRenderTime=Date.now()-c,g.stats.asyncRenderCount++,g.isAnimating=!1,a.f(5);case 6:g.qAsync&&g.renderAsync();case 7:return a.a(2)}},a,null,[[4,,5,6]])}));return a}()}),g.state=h;var k=a;k._vode=g;var l=Array.from(a.parentElement.children).indexOf(a);g.vode=o(b,a.parentElement,l,l,d(a,!0),c(b));for(var m=arguments.length,p=Array(3<m?m-3:0),q=3;q<m;q++)p[q-3]=arguments[q];for(var r,s=0,t=p;s<t.length;s++)r=t[s],h.patch(r);return function(a){return h.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 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
|
|
2
|
+
// src/merge-class.ts
|
|
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=sd.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{sd.style.cssText=""}}// src/state-context.ts
|
|
5
|
+
var z=Object.defineProperty,A=Object.getOwnPropertyDescriptor,B=Object.getOwnPropertyNames,C=Object.prototype.hasOwnProperty,D=function c(a,b){for(var d in b)z(a,d,{get:b[d],enumerable:!0})},E=function e(a,b,c,d){if(b&&"object"===_typeof(b)||"function"==typeof b){var f,g=_createForOfIteratorHelper(B(b));try{var h=function e(){var g=f.value;C.call(a,g)||g===c||z(a,g,{get:function a(){return b[g]},enumerable:!(d=A(b,g))||d.enumerable})};for(g.s();!(f=g.n()).done;)h()}catch(a){g.e(a)}finally{g.f()}}return a},F=function b(a){return E(z({},"__esModule",{value:!0}),a)},G={};// index.ts
|
|
6
|
+
D(G,{A:function a(){return I},ABBR:function a(){return s},ADDRESS:function a(){return J},ANIMATE:function a(){return Lb},ANIMATEMOTION:function a(){return Mb},ANIMATETRANSFORM:function a(){return Nb},ANNOTATION:function a(){return Qc},ANNOTATION_XML:function a(){return Rc},AREA:function a(){return K},ARTICLE:function a(){return L},ASIDE:function a(){return M},AUDIO:function a(){return N},B:function a(){return O},BASE:function a(){return P},BDI:function a(){return Q},BDO:function a(){return R},BLOCKQUOTE:function a(){return S},BODY:function a(){return T},BR:function a(){return U},BUTTON:function a(){return V},CANVAS:function a(){return W},CAPTION:function a(){return X},CIRCLE:function a(){return Ob},CITE:function a(){return Y},CLIPPATH:function a(){return Pb},CODE:function a(){return Z},COL:function a(){return $},COLGROUP:function a(){return _},DATA:function a(){return aa},DATALIST:function a(){return ba},DD:function a(){return ca},DEFS:function a(){return Qb},DEL:function a(){return da},DESC:function a(){return Rb},DETAILS:function a(){return ea},DFN:function a(){return fa},DIALOG:function a(){return ga},DIV:function a(){return ha},DL:function a(){return ia},DT:function a(){return ja},DelegateStateContext:function a(){return ud},ELLIPSE:function a(){return Sb},EM:function a(){return ka},EMBED:function a(){return la},FEBLEND:function a(){return Tb},FECOLORMATRIX:function a(){return Ub},FECOMPONENTTRANSFER:function a(){return Vb},FECOMPOSITE:function a(){return Wb},FECONVOLVEMATRIX:function a(){return Xb},FEDIFFUSELIGHTING:function a(){return Yb},FEDISPLACEMENTMAP:function a(){return Zb},FEDISTANTLIGHT:function a(){return $b},FEDROPSHADOW:function a(){return _b},FEFLOOD:function a(){return ac},FEFUNCA:function a(){return bc},FEFUNCB:function a(){return cc},FEFUNCG:function a(){return dc},FEFUNCR:function a(){return ec},FEGAUSSIANBLUR:function a(){return fc},FEIMAGE:function a(){return gc},FEMERGE:function a(){return hc},FEMERGENODE:function a(){return ic},FEMORPHOLOGY:function a(){return jc},FEOFFSET:function a(){return kc},FEPOINTLIGHT:function a(){return lc},FESPECULARLIGHTING:function a(){return mc},FESPOTLIGHT:function a(){return nc},FETILE:function a(){return oc},FETURBULENCE:function a(){return pc},FIELDSET:function a(){return ma},FIGCAPTION:function a(){return na},FIGURE:function a(){return oa},FILTER:function a(){return qc},FOOTER:function a(){return pa},FOREIGNOBJECT:function a(){return rc},FORM:function a(){return qa},G:function a(){return sc},H1:function a(){return ra},H2:function a(){return sa},H3:function a(){return ta},H4:function a(){return ua},H5:function a(){return va},H6:function a(){return wa},HEAD:function a(){return xa},HEADER:function a(){return ya},HGROUP:function a(){return za},HR:function a(){return Aa},HTML:function a(){return Ba},I:function a(){return Ca},IFRAME:function a(){return Da},IMAGE:function a(){return tc},IMG:function a(){return Ea},INPUT:function a(){return Fa},INS:function a(){return Ga},KBD:function a(){return Ha},KeyStateContext:function a(){return td},LABEL:function a(){return Ia},LEGEND:function a(){return Ja},LI:function a(){return Ka},LINE:function a(){return uc},LINEARGRADIENT:function a(){return vc},LINK:function a(){return La},MACTION:function a(){return Sc},MAIN:function a(){return Ma},MAP:function a(){return Na},MARK:function a(){return Oa},MARKER:function a(){return wc},MASK:function a(){return xc},MATH:function a(){return Tc},MENU:function a(){return Pa},MERROR:function a(){return Uc},META:function a(){return Qa},METADATA:function a(){return yc},METER:function a(){return Ra},MFRAC:function a(){return Vc},MI:function a(){return Wc},MMULTISCRIPTS:function a(){return Xc},MN:function a(){return Yc},MO:function a(){return Zc},MOVER:function a(){return $c},MPADDED:function a(){return _c},MPATH:function a(){return zc},MPHANTOM:function a(){return ad},MPRESCRIPTS:function a(){return bd},MROOT:function a(){return cd},MROW:function a(){return dd},MS:function a(){return ed},MSPACE:function a(){return fd},MSQRT:function a(){return gd},MSTYLE:function a(){return hd},MSUB:function a(){return id},MSUBSUP:function a(){return jd},MSUP:function a(){return kd},MTABLE:function a(){return ld},MTD:function a(){return md},MTEXT:function a(){return nd},MTR:function a(){return od},MUNDER:function a(){return pd},MUNDEROVER:function a(){return qd},NAV:function a(){return Sa},NOSCRIPT:function a(){return Ta},OBJECT:function a(){return Ua},OL:function a(){return Va},OPTGROUP:function a(){return Wa},OPTION:function a(){return Xa},OUTPUT:function a(){return Ya},P:function a(){return Za},PATH:function a(){return Ac},PATTERN:function a(){return Bc},PICTURE:function a(){return $a},POLYGON:function a(){return Cc},POLYLINE:function a(){return Dc},PRE:function a(){return _a},PROGRESS:function a(){return ab},Q:function a(){return bb},RADIALGRADIENT:function a(){return Ec},RECT:function a(){return Fc},RP:function a(){return cb},RT:function a(){return db},RUBY:function a(){return eb},S:function a(){return fb},SAMP:function a(){return gb},SCRIPT:function a(){return hb},SEARCH:function a(){return ib},SECTION:function a(){return jb},SELECT:function a(){return kb},SEMANTICS:function a(){return rd},SET:function a(){return Gc},SLOT:function a(){return lb},SMALL:function a(){return mb},SOURCE:function a(){return nb},SPAN:function a(){return ob},STOP:function a(){return Hc},STRONG:function a(){return pb},STYLE:function a(){return qb},SUB:function a(){return rb},SUMMARY:function a(){return sb},SUP:function a(){return tb},SVG:function a(){return Ic},SWITCH:function a(){return Jc},SYMBOL:function a(){return Kc},TABLE:function a(){return ub},TBODY:function a(){return vb},TD:function a(){return wb},TEMPLATE:function a(){return xb},TEXT:function a(){return Lc},TEXTAREA:function a(){return yb},TEXTPATH:function a(){return Mc},TFOOT:function a(){return zb},TH:function a(){return Ab},THEAD:function a(){return Bb},TIME:function a(){return Cb},TITLE:function a(){return Db},TR:function a(){return Eb},TRACK:function a(){return Fb},TSPAN:function a(){return Nc},U:function a(){return Gb},UL:function a(){return Hb},USE:function a(){return Oc},VAR:function a(){return Ib},VIDEO:function a(){return Jb},VIEW:function a(){return Pc},WBR:function a(){return Kb},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},createPatch:function a(){return g},createState:function a(){return f},defuse:function a(){return c},globals:function a(){return H},hydrate:function a(){return d},memo:function a(){return e},mergeClass:function a(){return x},mergeStyle:function a(){return y},props:function a(){return i},tag:function a(){return h},vode:function b(){return a}});// src/vode.ts
|
|
7
|
+
var H={currentViewTransition:void 0,requestAnimationFrame:!window.requestAnimationFrame?function(a){return a()}:window.requestAnimationFrame.bind(window),startViewTransition:!document.startViewTransition?null:document.startViewTransition.bind(document)},I="a",s="abbr",J="address",K="area",L="article",M="aside",N="audio",O="b",P="base",Q="bdi",R="bdo",S="blockquote",T="body",U="br",V="button",W="canvas",X="caption",Y="cite",Z="code",$="col",_="colgroup",aa="data",ba="datalist",ca="dd",da="del",ea="details",fa="dfn",ga="dialog",ha="div",ia="dl",ja="dt",ka="em",la="embed",ma="fieldset",na="figcaption",oa="figure",pa="footer",qa="form",ra="h1",sa="h2",ta="h3",ua="h4",va="h5",wa="h6",xa="head",ya="header",za="hgroup",Aa="hr",Ba="html",Ca="i",Da="iframe",Ea="img",Fa="input",Ga="ins",Ha="kbd",Ia="label",Ja="legend",Ka="li",La="link",Ma="main",Na="map",Oa="mark",Pa="menu",Qa="meta",Ra="meter",Sa="nav",Ta="noscript",Ua="object",Va="ol",Wa="optgroup",Xa="option",Ya="output",Za="p",$a="picture",_a="pre",ab="progress",bb="q",cb="rp",db="rt",eb="ruby",fb="s",gb="samp",hb="script",ib="search",jb="section",kb="select",lb="slot",mb="small",nb="source",ob="span",pb="strong",qb="style",rb="sub",sb="summary",tb="sup",ub="table",vb="tbody",wb="td",xb="template",yb="textarea",zb="tfoot",Ab="th",Bb="thead",Cb="time",Db="title",Eb="tr",Fb="track",Gb="u",Hb="ul",Ib="var",Jb="video",Kb="wbr",Lb="animate",Mb="animateMotion",Nb="animateTransform",Ob="circle",Pb="clipPath",Qb="defs",Rb="desc",Sb="ellipse",Tb="feBlend",Ub="feColorMatrix",Vb="feComponentTransfer",Wb="feComposite",Xb="feConvolveMatrix",Yb="feDiffuseLighting",Zb="feDisplacementMap",$b="feDistantLight",_b="feDropShadow",ac="feFlood",bc="feFuncA",cc="feFuncB",dc="feFuncG",ec="feFuncR",fc="feGaussianBlur",gc="feImage",hc="feMerge",ic="feMergeNode",jc="feMorphology",kc="feOffset",lc="fePointLight",mc="feSpecularLighting",nc="feSpotLight",oc="feTile",pc="feTurbulence",qc="filter",rc="foreignObject",sc="g",tc="image",uc="line",vc="linearGradient",wc="marker",xc="mask",yc="metadata",zc="mpath",Ac="path",Bc="pattern",Cc="polygon",Dc="polyline",Ec="radialGradient",Fc="rect",Gc="set",Hc="stop",Ic="svg",Jc="switch",Kc="symbol",Lc="text",Mc="textPath",Nc="tspan",Oc="use",Pc="view",Qc="annotation",Rc="annotation-xml",Sc="maction",Tc="math",Uc="merror",Vc="mfrac",Wc="mi",Xc="mmultiscripts",Yc="mn",Zc="mo",$c="mover",_c="mpadded",ad="mphantom",bd="mprescripts",cd="mroot",dd="mrow",ed="ms",fd="mspace",gd="msqrt",hd="mstyle",id="msub",jd="msubsup",kd="msup",ld="mtable",md="mtd",nd="mtext",od="mtr",pd="munder",qd="munderover",rd="semantics",sd=document.createElement("div"),td=/*#__PURE__*/function(){function a(b,c){_classCallCheck(this,a),_defineProperty(this,"keys",void 0),this.state=b,this.path=c,this.keys=c.split(".")}return _createClass(a,[{key:"get",value:function a(){for(var b=this.keys,c=this.state?this.state[b[0]]:void 0,d=1;d<b.length&&!!c;d++)c=c[b[d]];return c}},{key:"put",value:function b(a){this.putDeep(a,this.state)}},{key:"patch",value:function b(a){if(Array.isArray(a)){var c,d=[],e=_createForOfIteratorHelper(a);try{for(e.s();!(c=e.n()).done;){var f=c.value;d.push(this.createPatch(f))}}catch(a){e.e(a)}finally{e.f()}this.state.patch(d)}else this.state.patch(this.createPatch(a))}/**
|
|
8
|
+
* Creates a render-patch for the parent state by setting a nested sub-state value while creating necessary structure.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const ctx = new KeyStateContext(state, 'user.profile.settings');
|
|
13
|
+
* const patch = ctx.createPatch({ theme: 'light' });
|
|
14
|
+
* // patch is { user: { profile: { settings: { theme: 'light' } } } }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param value
|
|
18
|
+
* @returns {{key-path}:{...: value}} render-patch for the parent state
|
|
19
|
+
*/},{key:"createPatch",value:function b(a){var c={};return this.putDeep(a,c),c}},{key:"putDeep",value:function c(a,b){var d=this.keys;if(1<d.length){var e=0,f=b[d[e]];for(("object"!==_typeof(f)||null===f)&&(b[d[e]]=f={}),e=1;e<d.length-1;e++){var g=f;f=f[d[e]],("object"!==_typeof(f)||null===f)&&(g[d[e]]=f={})}f[d[e]]=a}else"object"===_typeof(b[d[0]])&&"object"===_typeof(a)?Object.assign(b[d[0]],a):b[d[0]]=a}}])}(),ud=/*#__PURE__*/_createClass(function e(a,b,c,d){_classCallCheck(this,e),this.state=a,this.get=b,this.put=c,this.patch=d});return F(G)}();
|
package/dist/vode.js
CHANGED
|
@@ -410,10 +410,14 @@ var V = (() => {
|
|
|
410
410
|
}
|
|
411
411
|
av.node["catch"] = null;
|
|
412
412
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
413
|
+
if (av.node._vode) {
|
|
414
|
+
defuse(av.node);
|
|
415
|
+
} else {
|
|
416
|
+
const kids = children(av);
|
|
417
|
+
if (kids) {
|
|
418
|
+
for (let child2 of kids) {
|
|
419
|
+
clearEvents2(child2);
|
|
420
|
+
}
|
|
417
421
|
}
|
|
418
422
|
}
|
|
419
423
|
};
|
|
@@ -426,6 +430,10 @@ var V = (() => {
|
|
|
426
430
|
Object.defineProperty(v, "renderAsync", { value: () => {
|
|
427
431
|
} });
|
|
428
432
|
clearEvents2(v.vode);
|
|
433
|
+
} else {
|
|
434
|
+
for (let child2 of container.children) {
|
|
435
|
+
defuse(child2);
|
|
436
|
+
}
|
|
429
437
|
}
|
|
430
438
|
}
|
|
431
439
|
function hydrate(element, prepareForRender) {
|
package/dist/vode.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var V=(()=>{var D=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var q=(e,n)=>{for(var a in n)D(e,a,{get:n[a],enumerable:!0})},X=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of B(n))!_.call(e,t)&&t!==a&&D(e,t,{get:()=>n[t],enumerable:!(s=K(n,t))||s.enumerable});return e};var $=e=>X(D({},"__esModule",{value:!0}),e);var wo={};q(wo,{A:()=>st,ABBR:()=>at,ADDRESS:()=>rt,ANIMATE:()=>pn,ANIMATEMOTION:()=>ln,ANIMATETRANSFORM:()=>dn,ANNOTATION:()=>To,ANNOTATION_XML:()=>yo,AREA:()=>ct,ARTICLE:()=>it,ASIDE:()=>pt,AUDIO:()=>lt,B:()=>dt,BASE:()=>ft,BDI:()=>St,BDO:()=>ut,BLOCKQUOTE:()=>Tt,BODY:()=>yt,BR:()=>gt,BUTTON:()=>xt,CANVAS:()=>ht,CAPTION:()=>mt,CIRCLE:()=>fn,CITE:()=>Et,CLIPPATH:()=>Sn,CODE:()=>bt,COL:()=>Pt,COLGROUP:()=>At,DATA:()=>Ct,DATALIST:()=>Mt,DD:()=>Nt,DEFS:()=>un,DEL:()=>Rt,DESC:()=>Tn,DETAILS:()=>Ot,DFN:()=>Dt,DIALOG:()=>vt,DIV:()=>Lt,DL:()=>It,DT:()=>Vt,DelegateStateContext:()=>V,ELLIPSE:()=>yn,EM:()=>Ft,EMBED:()=>kt,FEBLEND:()=>gn,FECOLORMATRIX:()=>xn,FECOMPONENTTRANSFER:()=>hn,FECOMPOSITE:()=>mn,FECONVOLVEMATRIX:()=>En,FEDIFFUSELIGHTING:()=>bn,FEDISPLACEMENTMAP:()=>Pn,FEDISTANTLIGHT:()=>An,FEDROPSHADOW:()=>Cn,FEFLOOD:()=>Mn,FEFUNCA:()=>Nn,FEFUNCB:()=>Rn,FEFUNCG:()=>On,FEFUNCR:()=>Dn,FEGAUSSIANBLUR:()=>vn,FEIMAGE:()=>Ln,FEMERGE:()=>In,FEMERGENODE:()=>Vn,FEMORPHOLOGY:()=>Fn,FEOFFSET:()=>kn,FEPOINTLIGHT:()=>jn,FESPECULARLIGHTING:()=>Hn,FESPOTLIGHT:()=>Un,FETILE:()=>Gn,FETURBULENCE:()=>Kn,FIELDSET:()=>jt,FIGCAPTION:()=>Ht,FIGURE:()=>Ut,FILTER:()=>Bn,FOOTER:()=>Gt,FOREIGNOBJECT:()=>_n,FORM:()=>Kt,G:()=>qn,H1:()=>Bt,H2:()=>_t,H3:()=>qt,H4:()=>Xt,H5:()=>$t,H6:()=>wt,HEAD:()=>Yt,HEADER:()=>Wt,HGROUP:()=>Jt,HR:()=>Qt,HTML:()=>zt,I:()=>Zt,IFRAME:()=>te,IMAGE:()=>Xn,IMG:()=>ee,INPUT:()=>ne,INS:()=>oe,KBD:()=>se,KeyStateContext:()=>I,LABEL:()=>ae,LEGEND:()=>re,LI:()=>ce,LINE:()=>$n,LINEARGRADIENT:()=>wn,LINK:()=>ie,MACTION:()=>go,MAIN:()=>pe,MAP:()=>le,MARK:()=>de,MARKER:()=>Yn,MASK:()=>Wn,MATH:()=>xo,MENU:()=>fe,MERROR:()=>ho,META:()=>Se,METADATA:()=>Jn,METER:()=>ue,MFRAC:()=>mo,MI:()=>Eo,MMULTISCRIPTS:()=>bo,MN:()=>Po,MO:()=>Ao,MOVER:()=>Co,MPADDED:()=>Mo,MPATH:()=>Qn,MPHANTOM:()=>No,MPRESCRIPTS:()=>Ro,MROOT:()=>Oo,MROW:()=>Do,MS:()=>vo,MSPACE:()=>Lo,MSQRT:()=>Io,MSTYLE:()=>Vo,MSUB:()=>Fo,MSUBSUP:()=>ko,MSUP:()=>jo,MTABLE:()=>Ho,MTD:()=>Uo,MTEXT:()=>Go,MTR:()=>Ko,MUNDER:()=>Bo,MUNDEROVER:()=>_o,NAV:()=>Te,NOSCRIPT:()=>ye,OBJECT:()=>ge,OL:()=>xe,OPTGROUP:()=>he,OPTION:()=>me,OUTPUT:()=>Ee,P:()=>be,PATH:()=>zn,PATTERN:()=>Zn,PICTURE:()=>Pe,POLYGON:()=>to,POLYLINE:()=>eo,PRE:()=>Ae,PROGRESS:()=>Ce,Q:()=>Me,RADIALGRADIENT:()=>no,RECT:()=>oo,RP:()=>Ne,RT:()=>Re,RUBY:()=>Oe,S:()=>De,SAMP:()=>ve,SCRIPT:()=>Le,SEARCH:()=>Ie,SECTION:()=>Ve,SELECT:()=>Fe,SEMANTICS:()=>qo,SET:()=>so,SLOT:()=>ke,SMALL:()=>je,SOURCE:()=>He,SPAN:()=>Ue,STOP:()=>ao,STRONG:()=>Ge,STYLE:()=>Ke,SUB:()=>Be,SUMMARY:()=>_e,SUP:()=>qe,SVG:()=>ro,SWITCH:()=>co,SYMBOL:()=>io,TABLE:()=>Xe,TBODY:()=>$e,TD:()=>we,TEMPLATE:()=>Ye,TEXT:()=>po,TEXTAREA:()=>We,TEXTPATH:()=>lo,TFOOT:()=>Je,TH:()=>Qe,THEAD:()=>ze,TIME:()=>Ze,TITLE:()=>tn,TR:()=>en,TRACK:()=>nn,TSPAN:()=>fo,U:()=>on,UL:()=>sn,USE:()=>So,VAR:()=>an,VIDEO:()=>rn,VIEW:()=>uo,WBR:()=>cn,app:()=>Y,child:()=>et,childCount:()=>tt,children:()=>M,childrenStart:()=>O,createPatch:()=>z,createState:()=>Q,defuse:()=>W,globals:()=>P,hydrate:()=>R,memo:()=>J,mergeClass:()=>Xo,mergeStyle:()=>$o,props:()=>A,tag:()=>Z,vode:()=>w});var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function w(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function Y(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let o=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{o.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}o.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;o.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)o.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?o.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=o;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(n,e.parentElement,b,b,R(e,!0),a(n));for(let p of s)o.patch(p);return p=>o.patch(p)}function W(e){if(e?._vode){let a=function(t){if(!t?.node)return;let o=A(t);if(o){for(let c in o)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=M(t);if(r)for(let c of r)a(c)};var n=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function R(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&R(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function J(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function Q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function z(e){return e}function Z(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function M(e){let n=O(e);return n>0?e.slice(n):null}function tt(e){let n=O(e);return n<0?0:e.length-n}function et(e,n){let a=O(e);if(a>0)return e[n+a]}function O(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=E({},t,a):typeof o=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,n,a,s,t,o,r){try{o=v(e,o,t);let c=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&ot(o),p=!c&&nt(o),y=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(y&&b?o=o.wholeText:y&&p&&(o=[...o]),f&&b)return i.nodeValue!==o&&(i.nodeValue=o),t;if(b&&(!i||!f)){let l=document.createTextNode(o);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=s;d<n.childNodes.length;d++){let g=n.childNodes[d];if(g){g.before(l,g),S=!0;break}}S||n.appendChild(l)}return l}if(p&&(!i||f||t[0]!==o[0])){let l=o;1 in l&&(l[1]=v(e,l[1],void 0));let S=A(o);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,o[0]):document.createElement(o[0]);if(o.node=d,L(e,d,void 0,S,r??null),S&&"catch"in S&&(o.node.catch=null,o.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=s;T<n.childNodes.length;T++){let u=n.childNodes[T];if(u){u.before(d,u),x=!0;break}}x||n.appendChild(d)}let g=M(o);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r??null);o[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),o}if(!f&&p&&t[0]===o[0]){o.node=i;let l=o,S=t,d=A(o),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=v(e,l[1],S[1]),u!==l[1]&&L(e,i,g,d,r)}else L(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(o.node.catch=null,o.node.removeAttribute("catch"));let x=M(o),T=M(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let U=x[m],G=T&&T[m],F=C(e,i,m,h,G,U,r);o[m+u]=F,F&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return o}}catch(c){let f=A(o)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,n,a,s,R(o?.node||t?.node,!0),i,r)}else throw c}}function nt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function ot(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function v(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let o=k(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function k(e,n){return typeof e=="function"?k(e(n),n):e}function L(e,n,a,s,t){if(!s&&!a)return;let o=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=N(e,n,r,c,f,o):N(e,n,r,c,void 0,o))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}else if(s)for(let r in s){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}function N(e,n,a,s,t,o){if(a==="style")if(!t)n.style.cssText="";else if(typeof t=="string")s!==t&&(n.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(n.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(n.style[r]=f)}}else for(let r in t)n.style[r]=t[r];else if(a==="class")t?n.setAttribute("class",j(t)):n.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));n[a]=r}else n[a]=null;else o||(n[a]=t),t==null||t===!1?n.removeAttribute(a):n.setAttribute(a,t);return t}function j(e){return typeof e=="string"?e:Array.isArray(e)?e.map(j).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var st="a",at="abbr",rt="address",ct="area",it="article",pt="aside",lt="audio",dt="b",ft="base",St="bdi",ut="bdo",Tt="blockquote",yt="body",gt="br",xt="button",ht="canvas",mt="caption",Et="cite",bt="code",Pt="col",At="colgroup",Ct="data",Mt="datalist",Nt="dd",Rt="del",Ot="details",Dt="dfn",vt="dialog",Lt="div",It="dl",Vt="dt",Ft="em",kt="embed",jt="fieldset",Ht="figcaption",Ut="figure",Gt="footer",Kt="form",Bt="h1",_t="h2",qt="h3",Xt="h4",$t="h5",wt="h6",Yt="head",Wt="header",Jt="hgroup",Qt="hr",zt="html",Zt="i",te="iframe",ee="img",ne="input",oe="ins",se="kbd",ae="label",re="legend",ce="li",ie="link",pe="main",le="map",de="mark",fe="menu",Se="meta",ue="meter",Te="nav",ye="noscript",ge="object",xe="ol",he="optgroup",me="option",Ee="output",be="p",Pe="picture",Ae="pre",Ce="progress",Me="q",Ne="rp",Re="rt",Oe="ruby",De="s",ve="samp",Le="script",Ie="search",Ve="section",Fe="select",ke="slot",je="small",He="source",Ue="span",Ge="strong",Ke="style",Be="sub",_e="summary",qe="sup",Xe="table",$e="tbody",we="td",Ye="template",We="textarea",Je="tfoot",Qe="th",ze="thead",Ze="time",tn="title",en="tr",nn="track",on="u",sn="ul",an="var",rn="video",cn="wbr",pn="animate",ln="animateMotion",dn="animateTransform",fn="circle",Sn="clipPath",un="defs",Tn="desc",yn="ellipse",gn="feBlend",xn="feColorMatrix",hn="feComponentTransfer",mn="feComposite",En="feConvolveMatrix",bn="feDiffuseLighting",Pn="feDisplacementMap",An="feDistantLight",Cn="feDropShadow",Mn="feFlood",Nn="feFuncA",Rn="feFuncB",On="feFuncG",Dn="feFuncR",vn="feGaussianBlur",Ln="feImage",In="feMerge",Vn="feMergeNode",Fn="feMorphology",kn="feOffset",jn="fePointLight",Hn="feSpecularLighting",Un="feSpotLight",Gn="feTile",Kn="feTurbulence",Bn="filter",_n="foreignObject",qn="g",Xn="image",$n="line",wn="linearGradient",Yn="marker",Wn="mask",Jn="metadata",Qn="mpath",zn="path",Zn="pattern",to="polygon",eo="polyline",no="radialGradient",oo="rect",so="set",ao="stop",ro="svg",co="switch",io="symbol",po="text",lo="textPath",fo="tspan",So="use",uo="view",To="annotation",yo="annotation-xml",go="maction",xo="math",ho="merror",mo="mfrac",Eo="mi",bo="mmultiscripts",Po="mn",Ao="mo",Co="mover",Mo="mpadded",No="mphantom",Ro="mprescripts",Oo="mroot",Do="mrow",vo="ms",Lo="mspace",Io="msqrt",Vo="mstyle",Fo="msub",ko="msubsup",jo="msup",Ho="mtable",Uo="mtd",Go="mtext",Ko="mtr",Bo="munder",_o="munderover",qo="semantics";function Xo(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),c=new Set([...o,...r]);n=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var H=document.createElement("div");function $o(...e){try{let n=H.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)n[s]=a[s];else typeof a=="string"&&(n.cssText+=";"+a);return n.cssText}finally{H.style.cssText=""}}var I=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},V=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return $(wo);})();
|
|
1
|
+
"use strict";var V=(()=>{var D=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var q=Object.prototype.hasOwnProperty;var X=(e,n)=>{for(var a in n)D(e,a,{get:n[a],enumerable:!0})},$=(e,n,a,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of _(n))!q.call(e,t)&&t!==a&&D(e,t,{get:()=>n[t],enumerable:!(s=B(n,t))||s.enumerable});return e};var w=e=>$(D({},"__esModule",{value:!0}),e);var wo={};X(wo,{A:()=>st,ABBR:()=>at,ADDRESS:()=>rt,ANIMATE:()=>pn,ANIMATEMOTION:()=>ln,ANIMATETRANSFORM:()=>dn,ANNOTATION:()=>To,ANNOTATION_XML:()=>yo,AREA:()=>ct,ARTICLE:()=>it,ASIDE:()=>pt,AUDIO:()=>lt,B:()=>dt,BASE:()=>ft,BDI:()=>St,BDO:()=>ut,BLOCKQUOTE:()=>Tt,BODY:()=>yt,BR:()=>gt,BUTTON:()=>xt,CANVAS:()=>ht,CAPTION:()=>mt,CIRCLE:()=>fn,CITE:()=>Et,CLIPPATH:()=>Sn,CODE:()=>bt,COL:()=>Pt,COLGROUP:()=>At,DATA:()=>Ct,DATALIST:()=>Mt,DD:()=>Nt,DEFS:()=>un,DEL:()=>Rt,DESC:()=>Tn,DETAILS:()=>Ot,DFN:()=>Dt,DIALOG:()=>vt,DIV:()=>Lt,DL:()=>It,DT:()=>Vt,DelegateStateContext:()=>F,ELLIPSE:()=>yn,EM:()=>Ft,EMBED:()=>kt,FEBLEND:()=>gn,FECOLORMATRIX:()=>xn,FECOMPONENTTRANSFER:()=>hn,FECOMPOSITE:()=>mn,FECONVOLVEMATRIX:()=>En,FEDIFFUSELIGHTING:()=>bn,FEDISPLACEMENTMAP:()=>Pn,FEDISTANTLIGHT:()=>An,FEDROPSHADOW:()=>Cn,FEFLOOD:()=>Mn,FEFUNCA:()=>Nn,FEFUNCB:()=>Rn,FEFUNCG:()=>On,FEFUNCR:()=>Dn,FEGAUSSIANBLUR:()=>vn,FEIMAGE:()=>Ln,FEMERGE:()=>In,FEMERGENODE:()=>Vn,FEMORPHOLOGY:()=>Fn,FEOFFSET:()=>kn,FEPOINTLIGHT:()=>jn,FESPECULARLIGHTING:()=>Hn,FESPOTLIGHT:()=>Un,FETILE:()=>Gn,FETURBULENCE:()=>Kn,FIELDSET:()=>jt,FIGCAPTION:()=>Ht,FIGURE:()=>Ut,FILTER:()=>Bn,FOOTER:()=>Gt,FOREIGNOBJECT:()=>_n,FORM:()=>Kt,G:()=>qn,H1:()=>Bt,H2:()=>_t,H3:()=>qt,H4:()=>Xt,H5:()=>$t,H6:()=>wt,HEAD:()=>Yt,HEADER:()=>Wt,HGROUP:()=>Jt,HR:()=>Qt,HTML:()=>zt,I:()=>Zt,IFRAME:()=>te,IMAGE:()=>Xn,IMG:()=>ee,INPUT:()=>ne,INS:()=>oe,KBD:()=>se,KeyStateContext:()=>V,LABEL:()=>ae,LEGEND:()=>re,LI:()=>ce,LINE:()=>$n,LINEARGRADIENT:()=>wn,LINK:()=>ie,MACTION:()=>go,MAIN:()=>pe,MAP:()=>le,MARK:()=>de,MARKER:()=>Yn,MASK:()=>Wn,MATH:()=>xo,MENU:()=>fe,MERROR:()=>ho,META:()=>Se,METADATA:()=>Jn,METER:()=>ue,MFRAC:()=>mo,MI:()=>Eo,MMULTISCRIPTS:()=>bo,MN:()=>Po,MO:()=>Ao,MOVER:()=>Co,MPADDED:()=>Mo,MPATH:()=>Qn,MPHANTOM:()=>No,MPRESCRIPTS:()=>Ro,MROOT:()=>Oo,MROW:()=>Do,MS:()=>vo,MSPACE:()=>Lo,MSQRT:()=>Io,MSTYLE:()=>Vo,MSUB:()=>Fo,MSUBSUP:()=>ko,MSUP:()=>jo,MTABLE:()=>Ho,MTD:()=>Uo,MTEXT:()=>Go,MTR:()=>Ko,MUNDER:()=>Bo,MUNDEROVER:()=>_o,NAV:()=>Te,NOSCRIPT:()=>ye,OBJECT:()=>ge,OL:()=>xe,OPTGROUP:()=>he,OPTION:()=>me,OUTPUT:()=>Ee,P:()=>be,PATH:()=>zn,PATTERN:()=>Zn,PICTURE:()=>Pe,POLYGON:()=>to,POLYLINE:()=>eo,PRE:()=>Ae,PROGRESS:()=>Ce,Q:()=>Me,RADIALGRADIENT:()=>no,RECT:()=>oo,RP:()=>Ne,RT:()=>Re,RUBY:()=>Oe,S:()=>De,SAMP:()=>ve,SCRIPT:()=>Le,SEARCH:()=>Ie,SECTION:()=>Ve,SELECT:()=>Fe,SEMANTICS:()=>qo,SET:()=>so,SLOT:()=>ke,SMALL:()=>je,SOURCE:()=>He,SPAN:()=>Ue,STOP:()=>ao,STRONG:()=>Ge,STYLE:()=>Ke,SUB:()=>Be,SUMMARY:()=>_e,SUP:()=>qe,SVG:()=>ro,SWITCH:()=>co,SYMBOL:()=>io,TABLE:()=>Xe,TBODY:()=>$e,TD:()=>we,TEMPLATE:()=>Ye,TEXT:()=>po,TEXTAREA:()=>We,TEXTPATH:()=>lo,TFOOT:()=>Je,TH:()=>Qe,THEAD:()=>ze,TIME:()=>Ze,TITLE:()=>tn,TR:()=>en,TRACK:()=>nn,TSPAN:()=>fo,U:()=>on,UL:()=>sn,USE:()=>So,VAR:()=>an,VIDEO:()=>rn,VIEW:()=>uo,WBR:()=>cn,app:()=>W,child:()=>et,childCount:()=>tt,children:()=>M,childrenStart:()=>O,createPatch:()=>z,createState:()=>Q,defuse:()=>I,globals:()=>P,hydrate:()=>R,memo:()=>J,mergeClass:()=>Xo,mergeStyle:()=>$o,props:()=>A,tag:()=>Z,vode:()=>Y});var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function Y(e,n,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:n?[e,n,...a]:[e,...a]}function W(e,n,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!n||typeof n!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let o=n;Object.defineProperty(n,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{o.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}o.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;o.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)o.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?o.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=o;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(n,e.parentElement,b,b,R(e,!0),a(n));for(let p of s)o.patch(p);return p=>o.patch(p)}function I(e){if(e?._vode){let a=function(t){if(!t?.node)return;let o=A(t);if(o){for(let r in o)r[0]==="o"&&r[1]==="n"&&(t.node[r]=null);t.node.catch=null}if(t.node._vode)I(t.node);else{let r=M(t);if(r)for(let c of r)a(c)}};var n=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}else for(let a of e.children)I(a)}function R(e,n){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?n?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(n&&(s.node=e),e?.hasAttributes()){let t={},o=e.attributes;for(let r of o)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let o of e.childNodes){let r=o&&R(o,n);r?s.push(r):o&&n&&t.push(o)}for(let o of t)o.remove()}return s}else return}function J(e,n){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof n!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return n.__memo=e,n}function Q(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function z(e){return e}function Z(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function M(e){let n=O(e);return n>0?e.slice(n):null}function tt(e){let n=O(e);return n<0?0:e.length-n}function et(e,n){let a=O(e);if(a>0)return e[n+a]}function O(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,n,a){if(!n)return e;for(let s in n){let t=n[s];if(t&&typeof t=="object"){let o=e[s];o?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&o!==t?e[s]=new Date(t):Array.isArray(o)?e[s]=E({},t,a):typeof o=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,n,a,s,t,o,r){try{o=v(e,o,t);let c=!o||typeof o=="number"||typeof o=="boolean";if(o===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&ot(o),p=!c&&nt(o),y=!!o&&typeof o!="string"&&!!(o?.node||o?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof o+" "+JSON.stringify(o));if(y&&b?o=o.wholeText:y&&p&&(o=[...o]),f&&b)return i.nodeValue!==o&&(i.nodeValue=o),t;if(b&&(!i||!f)){let l=document.createTextNode(o);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=s;d<n.childNodes.length;d++){let g=n.childNodes[d];if(g){g.before(l,g),S=!0;break}}S||n.appendChild(l)}return l}if(p&&(!i||f||t[0]!==o[0])){let l=o;1 in l&&(l[1]=v(e,l[1],void 0));let S=A(o);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,o[0]):document.createElement(o[0]);if(o.node=d,L(e,d,void 0,S,r??null),S&&"catch"in S&&(o.node.catch=null,o.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=s;T<n.childNodes.length;T++){let u=n.childNodes[T];if(u){u.before(d,u),x=!0;break}}x||n.appendChild(d)}let g=M(o);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r??null);o[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),o}if(!f&&p&&t[0]===o[0]){o.node=i;let l=o,S=t,d=A(o),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=v(e,l[1],S[1]),u!==l[1]&&L(e,i,g,d,r)}else L(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(o.node.catch=null,o.node.removeAttribute("catch"));let x=M(o),T=M(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let G=x[m],K=T&&T[m],k=C(e,i,m,h,K,G,r);o[m+u]=k,k&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return o}}catch(c){let f=A(o)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,n,a,s,R(o?.node||t?.node,!0),i,r)}else throw c}}function nt(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function ot(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function v(e,n,a){if(typeof n!="function")return n;let s=n?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let o=j(n,e);return typeof o=="object"&&(o.__memo=n?.__memo),o}function j(e,n){return typeof e=="function"?j(e(n),n):e}function L(e,n,a,s,t){if(!s&&!a)return;let o=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=N(e,n,r,c,f,o):N(e,n,r,c,void 0,o))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}else if(s)for(let r in s){let c=s[r];s[r]=N(e,n,r,void 0,c,o)}}function N(e,n,a,s,t,o){if(a==="style")if(!t)n.style.cssText="";else if(typeof t=="string")s!==t&&(n.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(n.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(n.style[r]=f)}}else for(let r in t)n.style[r]=t[r];else if(a==="class")t?n.setAttribute("class",H(t)):n.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));n[a]=r}else n[a]=null;else o||(n[a]=t),t==null||t===!1?n.removeAttribute(a):n.setAttribute(a,t);return t}function H(e){return typeof e=="string"?e:Array.isArray(e)?e.map(H).join(" "):typeof e=="object"?Object.keys(e).filter(n=>e[n]).join(" "):""}var st="a",at="abbr",rt="address",ct="area",it="article",pt="aside",lt="audio",dt="b",ft="base",St="bdi",ut="bdo",Tt="blockquote",yt="body",gt="br",xt="button",ht="canvas",mt="caption",Et="cite",bt="code",Pt="col",At="colgroup",Ct="data",Mt="datalist",Nt="dd",Rt="del",Ot="details",Dt="dfn",vt="dialog",Lt="div",It="dl",Vt="dt",Ft="em",kt="embed",jt="fieldset",Ht="figcaption",Ut="figure",Gt="footer",Kt="form",Bt="h1",_t="h2",qt="h3",Xt="h4",$t="h5",wt="h6",Yt="head",Wt="header",Jt="hgroup",Qt="hr",zt="html",Zt="i",te="iframe",ee="img",ne="input",oe="ins",se="kbd",ae="label",re="legend",ce="li",ie="link",pe="main",le="map",de="mark",fe="menu",Se="meta",ue="meter",Te="nav",ye="noscript",ge="object",xe="ol",he="optgroup",me="option",Ee="output",be="p",Pe="picture",Ae="pre",Ce="progress",Me="q",Ne="rp",Re="rt",Oe="ruby",De="s",ve="samp",Le="script",Ie="search",Ve="section",Fe="select",ke="slot",je="small",He="source",Ue="span",Ge="strong",Ke="style",Be="sub",_e="summary",qe="sup",Xe="table",$e="tbody",we="td",Ye="template",We="textarea",Je="tfoot",Qe="th",ze="thead",Ze="time",tn="title",en="tr",nn="track",on="u",sn="ul",an="var",rn="video",cn="wbr",pn="animate",ln="animateMotion",dn="animateTransform",fn="circle",Sn="clipPath",un="defs",Tn="desc",yn="ellipse",gn="feBlend",xn="feColorMatrix",hn="feComponentTransfer",mn="feComposite",En="feConvolveMatrix",bn="feDiffuseLighting",Pn="feDisplacementMap",An="feDistantLight",Cn="feDropShadow",Mn="feFlood",Nn="feFuncA",Rn="feFuncB",On="feFuncG",Dn="feFuncR",vn="feGaussianBlur",Ln="feImage",In="feMerge",Vn="feMergeNode",Fn="feMorphology",kn="feOffset",jn="fePointLight",Hn="feSpecularLighting",Un="feSpotLight",Gn="feTile",Kn="feTurbulence",Bn="filter",_n="foreignObject",qn="g",Xn="image",$n="line",wn="linearGradient",Yn="marker",Wn="mask",Jn="metadata",Qn="mpath",zn="path",Zn="pattern",to="polygon",eo="polyline",no="radialGradient",oo="rect",so="set",ao="stop",ro="svg",co="switch",io="symbol",po="text",lo="textPath",fo="tspan",So="use",uo="view",To="annotation",yo="annotation-xml",go="maction",xo="math",ho="merror",mo="mfrac",Eo="mi",bo="mmultiscripts",Po="mn",Ao="mo",Co="mover",Mo="mpadded",No="mphantom",Ro="mprescripts",Oo="mroot",Do="mrow",vo="ms",Lo="mspace",Io="msqrt",Vo="mstyle",Fo="msub",ko="msubsup",jo="msup",Ho="mtable",Uo="mtd",Go="mtext",Ko="mtr",Bo="munder",_o="munderover",qo="semantics";function Xo(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let n=e[0];for(let a=1;a<e.length;a++){let s=n,t=e[a];if(!s)n=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let o=s.split(" "),r=t.split(" "),c=new Set([...o,...r]);n=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let o=new Set([...t,...s.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let o=new Set([...s,...t.split(" ")]);n=Array.from(o).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let o=new Set([...s,...t]);n=Array.from(o).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")n={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")n={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")n={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let o={...s};for(let r of t)o[r]=!0;n=o}else if(Array.isArray(s)&&typeof t=="object"){let o={};for(let r of s)o[r]=!0;for(let r of Object.keys(t))o[r]=t[r];n=o}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return n}var U=document.createElement("div");function $o(...e){try{let n=U.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)n[s]=a[s];else typeof a=="string"&&(n.cssText+=";"+a);return n.cssText}finally{U.style.cssText=""}}var V=class{constructor(n,a){this.state=n;this.path=a;this.keys=a.split(".")}keys;get(){let n=this.keys,a=this.state?this.state[n[0]]:void 0;for(let s=1;s<n.length&&a;s++)a=a[n[s]];return a}put(n){this.putDeep(n,this.state)}patch(n){if(Array.isArray(n)){let a=[];for(let s of n)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(n))}createPatch(n){let a={};return this.putDeep(n,a),a}putDeep(n,a){let s=this.keys;if(s.length>1){let t=0,o=a[s[t]];for((typeof o!="object"||o===null)&&(a[s[t]]=o={}),t=1;t<s.length-1;t++){let r=o;o=o[s[t]],(typeof o!="object"||o===null)&&(r[s[t]]=o={})}o[s[t]]=n}else typeof a[s[0]]=="object"&&typeof n=="object"?Object.assign(a[s[0]],n):a[s[0]]=n}},F=class{constructor(n,a,s,t){this.state=n;this.get=a;this.put=s;this.patch=t}};return w(wo);})();
|
package/dist/vode.min.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function B(e,o,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...a]:[e,...a]}function _(e,o,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let n=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{n.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}n.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;n.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)n.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?n.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=n;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(o,e.parentElement,b,b,D(e,!0),a(o));for(let p of s)n.patch(p);return p=>n.patch(p)}function q(e){if(e?._vode){let a=function(t){if(!t?.node)return;let n=A(t);if(n){for(let c in n)c[0]==="o"&&c[1]==="n"&&(t.node[c]=null);t.node.catch=null}let r=N(t);if(r)for(let c of r)a(c)};var o=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}}function D(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(o&&(s.node=e),e?.hasAttributes()){let t={},n=e.attributes;for(let r of n)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let n of e.childNodes){let r=n&&D(n,o);r?s.push(r):n&&o&&t.push(n)}for(let n of t)n.remove()}return s}else return}function X(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function $(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function w(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function N(e){let o=v(e);return o>0?e.slice(o):null}function W(e){let o=v(e);return o<0?0:e.length-o}function J(e,o){let a=v(e);if(a>0)return e[o+a]}function v(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,o,a){if(!o)return e;for(let s in o){let t=o[s];if(t&&typeof t=="object"){let n=e[s];n?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&n!==t?e[s]=new Date(t):Array.isArray(n)?e[s]=E({},t,a):typeof n=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,o,a,s,t,n,r){try{n=R(e,n,t);let c=!n||typeof n=="number"||typeof n=="boolean";if(n===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&K(n),p=!c&&G(n),y=!!n&&typeof n!="string"&&!!(n?.node||n?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof n+" "+JSON.stringify(n));if(y&&b?n=n.wholeText:y&&p&&(n=[...n]),f&&b)return i.nodeValue!==n&&(i.nodeValue=n),t;if(b&&(!i||!f)){let l=document.createTextNode(n);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=s;d<o.childNodes.length;d++){let g=o.childNodes[d];if(g){g.before(l,g),S=!0;break}}S||o.appendChild(l)}return l}if(p&&(!i||f||t[0]!==n[0])){let l=n;1 in l&&(l[1]=R(e,l[1],void 0));let S=A(n);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,n[0]):document.createElement(n[0]);if(n.node=d,O(e,d,void 0,S,r??null),S&&"catch"in S&&(n.node.catch=null,n.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=s;T<o.childNodes.length;T++){let u=o.childNodes[T];if(u){u.before(d,u),x=!0;break}}x||o.appendChild(d)}let g=N(n);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r??null);n[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),n}if(!f&&p&&t[0]===n[0]){n.node=i;let l=n,S=t,d=A(n),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=R(e,l[1],S[1]),u!==l[1]&&O(e,i,g,d,r)}else O(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(n.node.catch=null,n.node.removeAttribute("catch"));let x=N(n),T=N(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let H=x[m],U=T&&T[m],L=C(e,i,m,h,U,H,r);n[m+u]=L,L&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return n}}catch(c){let f=A(n)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,o,a,s,D(n?.node||t?.node,!0),i,r)}else throw c}}function G(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function K(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,o,a){if(typeof o!="function")return o;let s=o?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let n=I(o,e);return typeof n=="object"&&(n.__memo=o?.__memo),n}function I(e,o){return typeof e=="function"?I(e(o),o):e}function O(e,o,a,s,t){if(!s&&!a)return;let n=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=M(e,o,r,c,f,n):M(e,o,r,c,void 0,n))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}else if(s)for(let r in s){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}function M(e,o,a,s,t,n){if(a==="style")if(!t)o.style.cssText="";else if(typeof t=="string")s!==t&&(o.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(o.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(o.style[r]=f)}}else for(let r in t)o.style[r]=t[r];else if(a==="class")t?o.setAttribute("class",V(t)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));o[a]=r}else o[a]=null;else n||(o[a]=t),t==null||t===!1?o.removeAttribute(a):o.setAttribute(a,t);return t}function V(e){return typeof e=="string"?e:Array.isArray(e)?e.map(V).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var z="a",Z="abbr",tt="address",et="area",nt="article",ot="aside",st="audio",at="b",rt="base",ct="bdi",it="bdo",pt="blockquote",lt="body",dt="br",ft="button",St="canvas",ut="caption",Tt="cite",yt="code",gt="col",xt="colgroup",ht="data",mt="datalist",Et="dd",bt="del",Pt="details",At="dfn",Ct="dialog",Mt="div",Nt="dl",Rt="dt",Ot="em",Dt="embed",vt="fieldset",Lt="figcaption",It="figure",Vt="footer",Ft="form",kt="h1",jt="h2",Ht="h3",Ut="h4",Gt="h5",Kt="h6",Bt="head",_t="header",qt="hgroup",Xt="hr",$t="html",wt="i",Yt="iframe",Wt="img",Jt="input",Qt="ins",zt="kbd",Zt="label",te="legend",ee="li",ne="link",oe="main",se="map",ae="mark",re="menu",ce="meta",ie="meter",pe="nav",le="noscript",de="object",fe="ol",Se="optgroup",ue="option",Te="output",ye="p",ge="picture",xe="pre",he="progress",me="q",Ee="rp",be="rt",Pe="ruby",Ae="s",Ce="samp",Me="script",Ne="search",Re="section",Oe="select",De="slot",ve="small",Le="source",Ie="span",Ve="strong",Fe="style",ke="sub",je="summary",He="sup",Ue="table",Ge="tbody",Ke="td",Be="template",_e="textarea",qe="tfoot",Xe="th",$e="thead",we="time",Ye="title",We="tr",Je="track",Qe="u",ze="ul",Ze="var",tn="video",en="wbr",nn="animate",on="animateMotion",sn="animateTransform",an="circle",rn="clipPath",cn="defs",pn="desc",ln="ellipse",dn="feBlend",fn="feColorMatrix",Sn="feComponentTransfer",un="feComposite",Tn="feConvolveMatrix",yn="feDiffuseLighting",gn="feDisplacementMap",xn="feDistantLight",hn="feDropShadow",mn="feFlood",En="feFuncA",bn="feFuncB",Pn="feFuncG",An="feFuncR",Cn="feGaussianBlur",Mn="feImage",Nn="feMerge",Rn="feMergeNode",On="feMorphology",Dn="feOffset",vn="fePointLight",Ln="feSpecularLighting",In="feSpotLight",Vn="feTile",Fn="feTurbulence",kn="filter",jn="foreignObject",Hn="g",Un="image",Gn="line",Kn="linearGradient",Bn="marker",_n="mask",qn="metadata",Xn="mpath",$n="path",wn="pattern",Yn="polygon",Wn="polyline",Jn="radialGradient",Qn="rect",zn="set",Zn="stop",to="svg",eo="switch",no="symbol",oo="text",so="textPath",ao="tspan",ro="use",co="view",io="annotation",po="annotation-xml",lo="maction",fo="math",So="merror",uo="mfrac",To="mi",yo="mmultiscripts",go="mn",xo="mo",ho="mover",mo="mpadded",Eo="mphantom",bo="mprescripts",Po="mroot",Ao="mrow",Co="ms",Mo="mspace",No="msqrt",Ro="mstyle",Oo="msub",Do="msubsup",vo="msup",Lo="mtable",Io="mtd",Vo="mtext",Fo="mtr",ko="munder",jo="munderover",Ho="semantics";function Go(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let a=1;a<e.length;a++){let s=o,t=e[a];if(!s)o=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let n=s.split(" "),r=t.split(" "),c=new Set([...n,...r]);o=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let n=new Set([...t,...s.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let n=new Set([...s,...t.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let n=new Set([...s,...t]);o=Array.from(n).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")o={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")o={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")o={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let n={...s};for(let r of t)n[r]=!0;o=n}else if(Array.isArray(s)&&typeof t=="object"){let n={};for(let r of s)n[r]=!0;for(let r of Object.keys(t))n[r]=t[r];o=n}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return o}var F=document.createElement("div");function Bo(...e){try{let o=F.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)o[s]=a[s];else typeof a=="string"&&(o.cssText+=";"+a);return o.cssText}finally{F.style.cssText=""}}var k=class{constructor(o,a){this.state=o;this.path=a;this.keys=a.split(".")}keys;get(){let o=this.keys,a=this.state?this.state[o[0]]:void 0;for(let s=1;s<o.length&&a;s++)a=a[o[s]];return a}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let a=[];for(let s of o)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(o))}createPatch(o){let a={};return this.putDeep(o,a),a}putDeep(o,a){let s=this.keys;if(s.length>1){let t=0,n=a[s[t]];for((typeof n!="object"||n===null)&&(a[s[t]]=n={}),t=1;t<s.length-1;t++){let r=n;n=n[s[t]],(typeof n!="object"||n===null)&&(r[s[t]]=n={})}n[s[t]]=o}else typeof a[s[0]]=="object"&&typeof o=="object"?Object.assign(a[s[0]],o):a[s[0]]=o}},j=class{constructor(o,a,s,t){this.state=o;this.get=a;this.put=s;this.patch=t}};export{z as A,Z as ABBR,tt as ADDRESS,nn as ANIMATE,on as ANIMATEMOTION,sn as ANIMATETRANSFORM,io as ANNOTATION,po as ANNOTATION_XML,et as AREA,nt as ARTICLE,ot as ASIDE,st as AUDIO,at as B,rt as BASE,ct as BDI,it as BDO,pt as BLOCKQUOTE,lt as BODY,dt as BR,ft as BUTTON,St as CANVAS,ut as CAPTION,an as CIRCLE,Tt as CITE,rn as CLIPPATH,yt as CODE,gt as COL,xt as COLGROUP,ht as DATA,mt as DATALIST,Et as DD,cn as DEFS,bt as DEL,pn as DESC,Pt as DETAILS,At as DFN,Ct as DIALOG,Mt as DIV,Nt as DL,Rt as DT,j as DelegateStateContext,ln as ELLIPSE,Ot as EM,Dt as EMBED,dn as FEBLEND,fn as FECOLORMATRIX,Sn as FECOMPONENTTRANSFER,un as FECOMPOSITE,Tn as FECONVOLVEMATRIX,yn as FEDIFFUSELIGHTING,gn as FEDISPLACEMENTMAP,xn as FEDISTANTLIGHT,hn as FEDROPSHADOW,mn as FEFLOOD,En as FEFUNCA,bn as FEFUNCB,Pn as FEFUNCG,An as FEFUNCR,Cn as FEGAUSSIANBLUR,Mn as FEIMAGE,Nn as FEMERGE,Rn as FEMERGENODE,On as FEMORPHOLOGY,Dn as FEOFFSET,vn as FEPOINTLIGHT,Ln as FESPECULARLIGHTING,In as FESPOTLIGHT,Vn as FETILE,Fn as FETURBULENCE,vt as FIELDSET,Lt as FIGCAPTION,It as FIGURE,kn as FILTER,Vt as FOOTER,jn as FOREIGNOBJECT,Ft as FORM,Hn as G,kt as H1,jt as H2,Ht as H3,Ut as H4,Gt as H5,Kt as H6,Bt as HEAD,_t as HEADER,qt as HGROUP,Xt as HR,$t as HTML,wt as I,Yt as IFRAME,Un as IMAGE,Wt as IMG,Jt as INPUT,Qt as INS,zt as KBD,k as KeyStateContext,Zt as LABEL,te as LEGEND,ee as LI,Gn as LINE,Kn as LINEARGRADIENT,ne as LINK,lo as MACTION,oe as MAIN,se as MAP,ae as MARK,Bn as MARKER,_n as MASK,fo as MATH,re as MENU,So as MERROR,ce as META,qn as METADATA,ie as METER,uo as MFRAC,To as MI,yo as MMULTISCRIPTS,go as MN,xo as MO,ho as MOVER,mo as MPADDED,Xn as MPATH,Eo as MPHANTOM,bo as MPRESCRIPTS,Po as MROOT,Ao as MROW,Co as MS,Mo as MSPACE,No as MSQRT,Ro as MSTYLE,Oo as MSUB,Do as MSUBSUP,vo as MSUP,Lo as MTABLE,Io as MTD,Vo as MTEXT,Fo as MTR,ko as MUNDER,jo as MUNDEROVER,pe as NAV,le as NOSCRIPT,de as OBJECT,fe as OL,Se as OPTGROUP,ue as OPTION,Te as OUTPUT,ye as P,$n as PATH,wn as PATTERN,ge as PICTURE,Yn as POLYGON,Wn as POLYLINE,xe as PRE,he as PROGRESS,me as Q,Jn as RADIALGRADIENT,Qn as RECT,Ee as RP,be as RT,Pe as RUBY,Ae as S,Ce as SAMP,Me as SCRIPT,Ne as SEARCH,Re as SECTION,Oe as SELECT,Ho as SEMANTICS,zn as SET,De as SLOT,ve as SMALL,Le as SOURCE,Ie as SPAN,Zn as STOP,Ve as STRONG,Fe as STYLE,ke as SUB,je as SUMMARY,He as SUP,to as SVG,eo as SWITCH,no as SYMBOL,Ue as TABLE,Ge as TBODY,Ke as TD,Be as TEMPLATE,oo as TEXT,_e as TEXTAREA,so as TEXTPATH,qe as TFOOT,Xe as TH,$e as THEAD,we as TIME,Ye as TITLE,We as TR,Je as TRACK,ao as TSPAN,Qe as U,ze as UL,ro as USE,Ze as VAR,tn as VIDEO,co as VIEW,en as WBR,_ as app,J as child,W as childCount,N as children,v as childrenStart,w as createPatch,$ as createState,q as defuse,P as globals,D as hydrate,X as memo,Go as mergeClass,Bo as mergeStyle,A as props,Y as tag,B as vode};
|
|
1
|
+
var P={currentViewTransition:void 0,requestAnimationFrame:window.requestAnimationFrame?window.requestAnimationFrame.bind(window):(e=>e()),startViewTransition:document.startViewTransition?document.startViewTransition.bind(document):null};function _(e,o,...a){if(!e)throw new Error("first argument to vode() must be a tag name or a vode");return Array.isArray(e)?e:o?[e,o,...a]:[e,...a]}function q(e,o,a,...s){if(!e?.parentElement)throw new Error("first argument to app() must be a valid HTMLElement inside the <html></html> document");if(!o||typeof o!="object")throw new Error("second argument to app() must be a state object");if(typeof a!="function")throw new Error("third argument to app() must be a function that returns a vode");let t={};t.syncRenderer=P.requestAnimationFrame,t.asyncRenderer=P.startViewTransition,t.qSync=null,t.qAsync=null,t.stats={lastSyncRenderTime:0,lastAsyncRenderTime:0,syncRenderCount:0,asyncRenderCount:0,liveEffectCount:0,patchCount:0,syncRenderPatchCount:0,asyncRenderPatchCount:0};let n=o;Object.defineProperty(o,"patch",{enumerable:!1,configurable:!0,writable:!1,value:async(p,y)=>{if(!(!p||typeof p!="function"&&typeof p!="object"))if(t.stats.patchCount++,p?.next){let l=p;t.stats.liveEffectCount++;try{let S=await l.next();for(;S.done===!1;){t.stats.liveEffectCount++;try{n.patch(S.value,y),S=await l.next()}finally{t.stats.liveEffectCount--}}n.patch(S.value,y)}finally{t.stats.liveEffectCount--}}else if(p.then){t.stats.liveEffectCount++;try{let l=await p;n.patch(l,y)}finally{t.stats.liveEffectCount--}}else if(Array.isArray(p))if(p.length>0)for(let l of p)n.patch(l,!document.hidden&&!!t.asyncRenderer);else{t.qSync=E(t.qSync||{},t.qAsync,!1),t.qAsync=null;try{P.currentViewTransition?.skipTransition()}catch{}t.stats.syncRenderPatchCount++,t.renderSync()}else typeof p=="function"?n.patch(p(t.state),y):y?(t.stats.asyncRenderPatchCount++,t.qAsync=E(t.qAsync||{},p,!1),await t.renderAsync()):(t.stats.syncRenderPatchCount++,t.qSync=E(t.qSync||{},p,!1),t.renderSync())}});function r(p){let y=Date.now(),l=a(t.state);t.vode=C(t.state,e.parentElement,0,0,t.vode,l),e.tagName.toUpperCase()!==l[0].toUpperCase()&&(e=t.vode.node,e._vode=t),p||(t.stats.lastSyncRenderTime=Date.now()-y,t.stats.syncRenderCount++,t.isRendering=!1,t.qSync&&t.renderSync())}let c=r.bind(null,!1),f=r.bind(null,!0);Object.defineProperty(t,"renderSync",{enumerable:!1,configurable:!0,writable:!1,value:()=>{t.isRendering||!t.qSync||(t.isRendering=!0,t.state=E(t.state,t.qSync,!0),t.qSync=null,t.syncRenderer(c))}}),Object.defineProperty(t,"renderAsync",{enumerable:!1,configurable:!0,writable:!1,value:async()=>{if(t.isAnimating||!t.qAsync||(await P.currentViewTransition?.updateCallbackDone,t.isAnimating||!t.qAsync||document.hidden))return;t.isAnimating=!0;let p=Date.now();try{t.state=E(t.state,t.qAsync,!0),t.qAsync=null,P.currentViewTransition=t.asyncRenderer(f),await P.currentViewTransition?.updateCallbackDone}finally{t.stats.lastAsyncRenderTime=Date.now()-p,t.stats.asyncRenderCount++,t.isAnimating=!1}t.qAsync&&t.renderAsync()}}),t.state=n;let i=e;i._vode=t;let b=Array.from(e.parentElement.children).indexOf(e);t.vode=C(o,e.parentElement,b,b,D(e,!0),a(o));for(let p of s)n.patch(p);return p=>n.patch(p)}function I(e){if(e?._vode){let a=function(t){if(!t?.node)return;let n=A(t);if(n){for(let r in n)r[0]==="o"&&r[1]==="n"&&(t.node[r]=null);t.node.catch=null}if(t.node._vode)I(t.node);else{let r=N(t);if(r)for(let c of r)a(c)}};var o=a;let s=e._vode;delete e._vode,Object.defineProperty(s.state,"patch",{value:void 0}),Object.defineProperty(s,"renderSync",{value:()=>{}}),Object.defineProperty(s,"renderAsync",{value:()=>{}}),a(s.vode)}else for(let a of e.children)I(a)}function D(e,o){if(e?.nodeType===Node.TEXT_NODE)return e.nodeValue?.trim()!==""?o?e:e.nodeValue:void 0;if(e.nodeType===Node.COMMENT_NODE)return;if(e.nodeType===Node.ELEMENT_NODE){let s=[e.tagName.toLowerCase()];if(o&&(s.node=e),e?.hasAttributes()){let t={},n=e.attributes;for(let r of n)t[r.name]=r.value;s.push(t)}if(e.hasChildNodes()){let t=[];for(let n of e.childNodes){let r=n&&D(n,o);r?s.push(r):n&&o&&t.push(n)}for(let n of t)n.remove()}return s}else return}function X(e,o){if(!e||!Array.isArray(e))throw new Error("first argument to memo() must be an array of values to compare");if(typeof o!="function")throw new Error("second argument to memo() must be a function that returns a vode or props object");return o.__memo=e,o}function $(e){if(!e||typeof e!="object")throw new Error("createState() must be called with a state object");return e}function w(e){return e}function Y(e){return e?Array.isArray(e)?e[0]:typeof e=="string"||e.nodeType===Node.TEXT_NODE?"#text":void 0:void 0}function A(e){if(Array.isArray(e)&&e.length>1&&e[1]&&!Array.isArray(e[1])&&typeof e[1]=="object"&&e[1].nodeType!==Node.TEXT_NODE)return e[1]}function N(e){let o=v(e);return o>0?e.slice(o):null}function W(e){let o=v(e);return o<0?0:e.length-o}function J(e,o){let a=v(e);if(a>0)return e[o+a]}function v(e){return A(e)?e.length>2?2:-1:Array.isArray(e)&&e.length>1?1:-1}function E(e,o,a){if(!o)return e;for(let s in o){let t=o[s];if(t&&typeof t=="object"){let n=e[s];n?Array.isArray(t)?e[s]=[...t]:t instanceof Date&&n!==t?e[s]=new Date(t):Array.isArray(n)?e[s]=E({},t,a):typeof n=="object"?E(e[s],t,a):e[s]=E({},t,a):Array.isArray(t)?e[s]=[...t]:t instanceof Date?e[s]=new Date(t):e[s]=E({},t,a)}else t===void 0&&a?delete e[s]:e[s]=t}return e}function C(e,o,a,s,t,n,r){try{n=R(e,n,t);let c=!n||typeof n=="number"||typeof n=="boolean";if(n===t||!t&&c)return t;let f=t?.nodeType===Node.TEXT_NODE,i=f?t:t?.node;if(c){i?.onUnmount&&e.patch(i.onUnmount(i)),i?.remove();return}let b=!c&&B(n),p=!c&&K(n),y=!!n&&typeof n!="string"&&!!(n?.node||n?.nodeType===Node.TEXT_NODE);if(!b&&!p&&!y&&!t)throw new Error("Invalid vode: "+typeof n+" "+JSON.stringify(n));if(y&&b?n=n.wholeText:y&&p&&(n=[...n]),f&&b)return i.nodeValue!==n&&(i.nodeValue=n),t;if(b&&(!i||!f)){let l=document.createTextNode(n);if(i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(l);else{let S=!1;for(let d=s;d<o.childNodes.length;d++){let g=o.childNodes[d];if(g){g.before(l,g),S=!0;break}}S||o.appendChild(l)}return l}if(p&&(!i||f||t[0]!==n[0])){let l=n;1 in l&&(l[1]=R(e,l[1],void 0));let S=A(n);S?.xmlns!==void 0&&(r=S.xmlns);let d=r?document.createElementNS(r,n[0]):document.createElement(n[0]);if(n.node=d,O(e,d,void 0,S,r??null),S&&"catch"in S&&(n.node.catch=null,n.node.removeAttribute("catch")),i)i.onUnmount&&e.patch(i.onUnmount(i)),i.replaceWith(d);else{let x=!1;for(let T=s;T<o.childNodes.length;T++){let u=o.childNodes[T];if(u){u.before(d,u),x=!0;break}}x||o.appendChild(d)}let g=N(n);if(g){let x=S?2:1,T=0;for(let u=0;u<g.length;u++){let h=g[u],m=C(e,d,u,T,void 0,h,r??null);n[u+x]=m,m&&T++}}return d.onMount&&e.patch(d.onMount(d)),n}if(!f&&p&&t[0]===n[0]){n.node=i;let l=n,S=t,d=A(n),g=A(t);if(d?.xmlns!==void 0&&(r=d.xmlns),l[1]?.__memo){let u=l[1];l[1]=R(e,l[1],S[1]),u!==l[1]&&O(e,i,g,d,r)}else O(e,i,g,d,r);d?.catch&&g?.catch!==d.catch&&(n.node.catch=null,n.node.removeAttribute("catch"));let x=N(n),T=N(t);if(x){let u=d?2:1,h=0;for(let m=0;m<x.length;m++){let U=x[m],G=T&&T[m],L=C(e,i,m,h,G,U,r);n[m+u]=L,L&&h++}}if(T){let u=x?x.length:0;for(let h=T.length-1;h>=u;h--)C(e,i,h,h,T[h],void 0,r)}return n}}catch(c){let f=A(n)?.catch;if(f){let i=typeof f=="function"?f(e,c):f;return C(e,o,a,s,D(n?.node||t?.node,!0),i,r)}else throw c}}function K(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"}function B(e){return typeof e=="string"||e?.nodeType===Node.TEXT_NODE}function R(e,o,a){if(typeof o!="function")return o;let s=o?.__memo,t=a?.__memo;if(Array.isArray(s)&&Array.isArray(t)&&s.length===t.length){let r=!0;for(let c=0;c<s.length;c++)if(s[c]!==t[c]){r=!1;break}if(r)return a}let n=V(o,e);return typeof n=="object"&&(n.__memo=o?.__memo),n}function V(e,o){return typeof e=="function"?V(e(o),o):e}function O(e,o,a,s,t){if(!s&&!a)return;let n=t!==void 0;if(a)for(let r in a){let c=a[r],f=s?.[r];c!==f&&(s?s[r]=M(e,o,r,c,f,n):M(e,o,r,c,void 0,n))}if(s&&a){for(let r in s)if(!(r in a)){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}else if(s)for(let r in s){let c=s[r];s[r]=M(e,o,r,void 0,c,n)}}function M(e,o,a,s,t,n){if(a==="style")if(!t)o.style.cssText="";else if(typeof t=="string")s!==t&&(o.style.cssText=t);else if(s&&typeof s=="object"){for(let r in s)t[r]||(o.style[r]=null);for(let r in t){let c=s[r],f=t[r];c!==f&&(o.style[r]=f)}}else for(let r in t)o.style[r]=t[r];else if(a==="class")t?o.setAttribute("class",F(t)):o.removeAttribute("class");else if(a[0]==="o"&&a[1]==="n")if(t){let r=null;if(typeof t=="function"){let c=t;r=f=>e.patch(c(e,f))}else typeof t=="object"&&(r=()=>e.patch(t));o[a]=r}else o[a]=null;else n||(o[a]=t),t==null||t===!1?o.removeAttribute(a):o.setAttribute(a,t);return t}function F(e){return typeof e=="string"?e:Array.isArray(e)?e.map(F).join(" "):typeof e=="object"?Object.keys(e).filter(o=>e[o]).join(" "):""}var z="a",Z="abbr",tt="address",et="area",nt="article",ot="aside",st="audio",at="b",rt="base",ct="bdi",it="bdo",pt="blockquote",lt="body",dt="br",ft="button",St="canvas",ut="caption",Tt="cite",yt="code",gt="col",xt="colgroup",ht="data",mt="datalist",Et="dd",bt="del",Pt="details",At="dfn",Ct="dialog",Mt="div",Nt="dl",Rt="dt",Ot="em",Dt="embed",vt="fieldset",Lt="figcaption",It="figure",Vt="footer",Ft="form",kt="h1",jt="h2",Ht="h3",Ut="h4",Gt="h5",Kt="h6",Bt="head",_t="header",qt="hgroup",Xt="hr",$t="html",wt="i",Yt="iframe",Wt="img",Jt="input",Qt="ins",zt="kbd",Zt="label",te="legend",ee="li",ne="link",oe="main",se="map",ae="mark",re="menu",ce="meta",ie="meter",pe="nav",le="noscript",de="object",fe="ol",Se="optgroup",ue="option",Te="output",ye="p",ge="picture",xe="pre",he="progress",me="q",Ee="rp",be="rt",Pe="ruby",Ae="s",Ce="samp",Me="script",Ne="search",Re="section",Oe="select",De="slot",ve="small",Le="source",Ie="span",Ve="strong",Fe="style",ke="sub",je="summary",He="sup",Ue="table",Ge="tbody",Ke="td",Be="template",_e="textarea",qe="tfoot",Xe="th",$e="thead",we="time",Ye="title",We="tr",Je="track",Qe="u",ze="ul",Ze="var",tn="video",en="wbr",nn="animate",on="animateMotion",sn="animateTransform",an="circle",rn="clipPath",cn="defs",pn="desc",ln="ellipse",dn="feBlend",fn="feColorMatrix",Sn="feComponentTransfer",un="feComposite",Tn="feConvolveMatrix",yn="feDiffuseLighting",gn="feDisplacementMap",xn="feDistantLight",hn="feDropShadow",mn="feFlood",En="feFuncA",bn="feFuncB",Pn="feFuncG",An="feFuncR",Cn="feGaussianBlur",Mn="feImage",Nn="feMerge",Rn="feMergeNode",On="feMorphology",Dn="feOffset",vn="fePointLight",Ln="feSpecularLighting",In="feSpotLight",Vn="feTile",Fn="feTurbulence",kn="filter",jn="foreignObject",Hn="g",Un="image",Gn="line",Kn="linearGradient",Bn="marker",_n="mask",qn="metadata",Xn="mpath",$n="path",wn="pattern",Yn="polygon",Wn="polyline",Jn="radialGradient",Qn="rect",zn="set",Zn="stop",to="svg",eo="switch",no="symbol",oo="text",so="textPath",ao="tspan",ro="use",co="view",io="annotation",po="annotation-xml",lo="maction",fo="math",So="merror",uo="mfrac",To="mi",yo="mmultiscripts",go="mn",xo="mo",ho="mover",mo="mpadded",Eo="mphantom",bo="mprescripts",Po="mroot",Ao="mrow",Co="ms",Mo="mspace",No="msqrt",Ro="mstyle",Oo="msub",Do="msubsup",vo="msup",Lo="mtable",Io="mtd",Vo="mtext",Fo="mtr",ko="munder",jo="munderover",Ho="semantics";function Go(...e){if(!e||e.length===0)return null;if(e.length===1)return e[0];let o=e[0];for(let a=1;a<e.length;a++){let s=o,t=e[a];if(!s)o=t;else if(t)if(typeof s=="string"&&typeof t=="string"){let n=s.split(" "),r=t.split(" "),c=new Set([...n,...r]);o=Array.from(c).join(" ").trim()}else if(typeof s=="string"&&Array.isArray(t)){let n=new Set([...t,...s.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&typeof t=="string"){let n=new Set([...s,...t.split(" ")]);o=Array.from(n).join(" ").trim()}else if(Array.isArray(s)&&Array.isArray(t)){let n=new Set([...s,...t]);o=Array.from(n).join(" ").trim()}else if(typeof s=="string"&&typeof t=="object")o={[s]:!0,...t};else if(typeof s=="object"&&typeof t=="string")o={...s,[t]:!0};else if(typeof s=="object"&&typeof t=="object")o={...s,...t};else if(typeof s=="object"&&Array.isArray(t)){let n={...s};for(let r of t)n[r]=!0;o=n}else if(Array.isArray(s)&&typeof t=="object"){let n={};for(let r of s)n[r]=!0;for(let r of Object.keys(t))n[r]=t[r];o=n}else throw new Error(`cannot merge classes of ${s} (${typeof s}) and ${t} (${typeof t})`);else continue}return o}var k=document.createElement("div");function Bo(...e){try{let o=k.style;for(let a of e)if(typeof a=="object"&&a!==null)for(let s in a)o[s]=a[s];else typeof a=="string"&&(o.cssText+=";"+a);return o.cssText}finally{k.style.cssText=""}}var j=class{constructor(o,a){this.state=o;this.path=a;this.keys=a.split(".")}keys;get(){let o=this.keys,a=this.state?this.state[o[0]]:void 0;for(let s=1;s<o.length&&a;s++)a=a[o[s]];return a}put(o){this.putDeep(o,this.state)}patch(o){if(Array.isArray(o)){let a=[];for(let s of o)a.push(this.createPatch(s));this.state.patch(a)}else this.state.patch(this.createPatch(o))}createPatch(o){let a={};return this.putDeep(o,a),a}putDeep(o,a){let s=this.keys;if(s.length>1){let t=0,n=a[s[t]];for((typeof n!="object"||n===null)&&(a[s[t]]=n={}),t=1;t<s.length-1;t++){let r=n;n=n[s[t]],(typeof n!="object"||n===null)&&(r[s[t]]=n={})}n[s[t]]=o}else typeof a[s[0]]=="object"&&typeof o=="object"?Object.assign(a[s[0]],o):a[s[0]]=o}},H=class{constructor(o,a,s,t){this.state=o;this.get=a;this.put=s;this.patch=t}};export{z as A,Z as ABBR,tt as ADDRESS,nn as ANIMATE,on as ANIMATEMOTION,sn as ANIMATETRANSFORM,io as ANNOTATION,po as ANNOTATION_XML,et as AREA,nt as ARTICLE,ot as ASIDE,st as AUDIO,at as B,rt as BASE,ct as BDI,it as BDO,pt as BLOCKQUOTE,lt as BODY,dt as BR,ft as BUTTON,St as CANVAS,ut as CAPTION,an as CIRCLE,Tt as CITE,rn as CLIPPATH,yt as CODE,gt as COL,xt as COLGROUP,ht as DATA,mt as DATALIST,Et as DD,cn as DEFS,bt as DEL,pn as DESC,Pt as DETAILS,At as DFN,Ct as DIALOG,Mt as DIV,Nt as DL,Rt as DT,H as DelegateStateContext,ln as ELLIPSE,Ot as EM,Dt as EMBED,dn as FEBLEND,fn as FECOLORMATRIX,Sn as FECOMPONENTTRANSFER,un as FECOMPOSITE,Tn as FECONVOLVEMATRIX,yn as FEDIFFUSELIGHTING,gn as FEDISPLACEMENTMAP,xn as FEDISTANTLIGHT,hn as FEDROPSHADOW,mn as FEFLOOD,En as FEFUNCA,bn as FEFUNCB,Pn as FEFUNCG,An as FEFUNCR,Cn as FEGAUSSIANBLUR,Mn as FEIMAGE,Nn as FEMERGE,Rn as FEMERGENODE,On as FEMORPHOLOGY,Dn as FEOFFSET,vn as FEPOINTLIGHT,Ln as FESPECULARLIGHTING,In as FESPOTLIGHT,Vn as FETILE,Fn as FETURBULENCE,vt as FIELDSET,Lt as FIGCAPTION,It as FIGURE,kn as FILTER,Vt as FOOTER,jn as FOREIGNOBJECT,Ft as FORM,Hn as G,kt as H1,jt as H2,Ht as H3,Ut as H4,Gt as H5,Kt as H6,Bt as HEAD,_t as HEADER,qt as HGROUP,Xt as HR,$t as HTML,wt as I,Yt as IFRAME,Un as IMAGE,Wt as IMG,Jt as INPUT,Qt as INS,zt as KBD,j as KeyStateContext,Zt as LABEL,te as LEGEND,ee as LI,Gn as LINE,Kn as LINEARGRADIENT,ne as LINK,lo as MACTION,oe as MAIN,se as MAP,ae as MARK,Bn as MARKER,_n as MASK,fo as MATH,re as MENU,So as MERROR,ce as META,qn as METADATA,ie as METER,uo as MFRAC,To as MI,yo as MMULTISCRIPTS,go as MN,xo as MO,ho as MOVER,mo as MPADDED,Xn as MPATH,Eo as MPHANTOM,bo as MPRESCRIPTS,Po as MROOT,Ao as MROW,Co as MS,Mo as MSPACE,No as MSQRT,Ro as MSTYLE,Oo as MSUB,Do as MSUBSUP,vo as MSUP,Lo as MTABLE,Io as MTD,Vo as MTEXT,Fo as MTR,ko as MUNDER,jo as MUNDEROVER,pe as NAV,le as NOSCRIPT,de as OBJECT,fe as OL,Se as OPTGROUP,ue as OPTION,Te as OUTPUT,ye as P,$n as PATH,wn as PATTERN,ge as PICTURE,Yn as POLYGON,Wn as POLYLINE,xe as PRE,he as PROGRESS,me as Q,Jn as RADIALGRADIENT,Qn as RECT,Ee as RP,be as RT,Pe as RUBY,Ae as S,Ce as SAMP,Me as SCRIPT,Ne as SEARCH,Re as SECTION,Oe as SELECT,Ho as SEMANTICS,zn as SET,De as SLOT,ve as SMALL,Le as SOURCE,Ie as SPAN,Zn as STOP,Ve as STRONG,Fe as STYLE,ke as SUB,je as SUMMARY,He as SUP,to as SVG,eo as SWITCH,no as SYMBOL,Ue as TABLE,Ge as TBODY,Ke as TD,Be as TEMPLATE,oo as TEXT,_e as TEXTAREA,so as TEXTPATH,qe as TFOOT,Xe as TH,$e as THEAD,we as TIME,Ye as TITLE,We as TR,Je as TRACK,ao as TSPAN,Qe as U,ze as UL,ro as USE,Ze as VAR,tn as VIDEO,co as VIEW,en as WBR,q as app,J as child,W as childCount,N as children,v as childrenStart,w as createPatch,$ as createState,I as defuse,P as globals,D as hydrate,X as memo,Go as mergeClass,Bo as mergeStyle,A as props,Y as tag,_ as vode};
|
package/dist/vode.mjs
CHANGED
|
@@ -166,10 +166,14 @@ function defuse(container) {
|
|
|
166
166
|
}
|
|
167
167
|
av.node["catch"] = null;
|
|
168
168
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
if (av.node._vode) {
|
|
170
|
+
defuse(av.node);
|
|
171
|
+
} else {
|
|
172
|
+
const kids = children(av);
|
|
173
|
+
if (kids) {
|
|
174
|
+
for (let child2 of kids) {
|
|
175
|
+
clearEvents2(child2);
|
|
176
|
+
}
|
|
173
177
|
}
|
|
174
178
|
}
|
|
175
179
|
};
|
|
@@ -182,6 +186,10 @@ function defuse(container) {
|
|
|
182
186
|
Object.defineProperty(v, "renderAsync", { value: () => {
|
|
183
187
|
} });
|
|
184
188
|
clearEvents2(v.vode);
|
|
189
|
+
} else {
|
|
190
|
+
for (let child2 of container.children) {
|
|
191
|
+
defuse(child2);
|
|
192
|
+
}
|
|
185
193
|
}
|
|
186
194
|
}
|
|
187
195
|
function hydrate(element, prepareForRender) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryupold/vode",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "a minimalist web framework",
|
|
5
5
|
"author": "Michael Scherbakow (ryupold)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,12 +30,18 @@
|
|
|
30
30
|
"build-min": "esbuild index.ts --bundle --format=esm --minify --outfile=dist/vode.min.mjs",
|
|
31
31
|
"build-classic": "esbuild index.ts --outfile=dist/vode.js --bundle --format=iife --global-name=V",
|
|
32
32
|
"build-classic-min": "esbuild index.ts --outfile=dist/vode.min.js --bundle --format=iife --global-name=V --minify",
|
|
33
|
-
"
|
|
33
|
+
"babel": "npx babel dist/vode.mjs --out-file dist/vode.amd.min.js",
|
|
34
|
+
"babel-classic": "npx babel dist/vode.js --out-file dist/vode.es5.min.js",
|
|
35
|
+
"release": "npm run build && npm run build-min && npm run build-classic && npm run build-classic-min && npm run babel && npm run babel-classic",
|
|
34
36
|
"publish": "npm publish --access public",
|
|
35
37
|
"clean": "tsc -b --clean",
|
|
36
38
|
"watch": "tsc -b -w"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
41
|
+
"@babel/cli": "7.28.3",
|
|
42
|
+
"@babel/core": "7.28.5",
|
|
43
|
+
"@babel/preset-env": "7.28.5",
|
|
44
|
+
"babel-preset-minify": "0.5.2",
|
|
39
45
|
"esbuild": "0.27.0",
|
|
40
46
|
"typescript": "5.9.3"
|
|
41
47
|
}
|
package/src/vode.ts
CHANGED
|
@@ -291,6 +291,7 @@ export function app<S extends PatchableState = PatchableState>(
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/** unregister vode app from container and free resources
|
|
294
|
+
* of all vodes inside the container.
|
|
294
295
|
* removes all event listeners registered by vode
|
|
295
296
|
* removes patch function from state object
|
|
296
297
|
* leaves the DOM as is
|
|
@@ -309,10 +310,15 @@ export function defuse(container: ContainerNode<any>) {
|
|
|
309
310
|
}
|
|
310
311
|
(<any>av.node)['catch'] = null;
|
|
311
312
|
}
|
|
312
|
-
|
|
313
|
-
if (
|
|
314
|
-
|
|
315
|
-
|
|
313
|
+
|
|
314
|
+
if ((av.node as ContainerNode)._vode) {
|
|
315
|
+
defuse(av.node as ContainerNode<PatchableState>);
|
|
316
|
+
} else {
|
|
317
|
+
const kids = children(av);
|
|
318
|
+
if (kids) {
|
|
319
|
+
for (let child of kids) {
|
|
320
|
+
clearEvents(child as AttachedVode<PatchableState>);
|
|
321
|
+
}
|
|
316
322
|
}
|
|
317
323
|
}
|
|
318
324
|
}
|
|
@@ -323,6 +329,10 @@ export function defuse(container: ContainerNode<any>) {
|
|
|
323
329
|
Object.defineProperty(v, "renderSync", { value: () => { } });
|
|
324
330
|
Object.defineProperty(v, "renderAsync", { value: () => { } });
|
|
325
331
|
clearEvents(v.vode);
|
|
332
|
+
} else {
|
|
333
|
+
for (let child of container.children) {
|
|
334
|
+
defuse(child as ContainerNode<PatchableState>);
|
|
335
|
+
}
|
|
326
336
|
}
|
|
327
337
|
}
|
|
328
338
|
|