@lume/variable
Advanced tools
Comparing version 0.6.1 to 0.7.0
@@ -1,11 +0,2 @@ | ||
if (!('LUME' in window)) { | ||
__LUME__ = window.__LUME__ || {} | ||
Object.defineProperty(window, 'LUME', { | ||
get() { return __LUME__ }, | ||
set(val) { Object.assign(__LUME__, val) }, | ||
}); | ||
} | ||
LUME=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"c",(function(){return o})),n.d(e,"j",(function(){return s})),n.d(e,"g",(function(){return l})),n.d(e,"d",(function(){return a})),n.d(e,"e",(function(){return f})),n.d(e,"f",(function(){return p})),n.d(e,"b",(function(){return d})),n.d(e,"h",(function(){return h})),n.d(e,"i",(function(){return g}));class r{constructor(){this.m=new WeakMap}set(t,e){this.m.set(t,e),this.m.set(e,t)}get(t){return this.m.get(t)}has(t){return this.m.has(t)}}function o(t){const e=t.toString().split("\n");return e.shift(),e.pop(),e.join("\n")}const c={enumerable:!0,configurable:!0};function s(t,e,n,r=!1){n=i(r?a(t,e):Object.getOwnPropertyDescriptor(t,e),n),Object.defineProperty(t,e,n)}function u(t,e){let n,r;const o=Object.getOwnPropertyDescriptors(t);for(const t in e)n=e[t],r=o[t],e[t]=i(r,n);Object.defineProperties(t,e)}function i(t,e){if(("get"in e||"set"in e)&&("value"in e||"writable"in e))throw new TypeError("cannot specify both accessors and a value or writable attribute");return t&&("get"in e||"set"in e?(delete t.value,delete t.writable):("value"in e||"writable"in e)&&(delete t.get,delete t.set)),{...c,...t,...e}}function l(t,e,n=!0){let r,o=!1;return r=1===arguments.length?t:n?a(t,e):Object.getOwnPropertyDescriptor(t,e),r&&(r.get||r.set)&&(o=!0),o}function a(t,e){let n,r=t;for(;r;){if(n=Object.getOwnPropertyDescriptor(r,e),n)return n.owner=r,n;r=r.__proto__}}function f(t){let e=t,n=[];for(;e;)n=n.concat(Object.getOwnPropertyNames(e)),e=e.__proto__;return n=Array.from(new Set(n)),n}function p(t,e){let n=t.__proto__;do{if(e===n)return!0;n=n.__proto__}while(n);return!1}function d(t,e,n){const r=Object.getOwnPropertyNames(t);let o=r.length;for(;o--;){const c=r[o],s=Object.getOwnPropertyDescriptor(t,c);n&&n(s),Object.defineProperty(e,c,s)}}function h(t,{defaultClassDescriptor:{writable:e,enumerable:n,configurable:r}}){const o=Object.getOwnPropertyDescriptors(t);let c;for(const t in o)c=o[t],("value"in c||"writable"in c)&&(c.writable=e),c.enumerable=n,c.configurable=r;u(t,o)}function g(t,{defaultClassDescriptor:{writable:e,enumerable:n,configurable:r}},o){const c=Object.getOwnPropertyDescriptors(t);let s;for(const t in c)o&&o.includes(t)?delete c[t]:(s=c[t],("value"in s||"writable"in s)&&(s.writable=e),s.enumerable=n,s.configurable=r);u(t,c)}},function(module,__webpack_exports__,__webpack_require__){"use strict";var _utils_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(0),_unused_webpack_default_export=newless,supportsSpread=isSyntaxSupported("Object(...[{}])"),supportsClass=isSyntaxSupported("class Test {}"),supportsNewTarget=isSyntaxSupported("new.target"),TRUE_CONSTRUCTOR=Symbol?Symbol("trueConstructor"):"__newlessTrueConstructor__",setPrototype=Object.setPrototypeOf||function(t,e){t.__proto__=e},construct=Reflect&&Reflect.construct||function(){if(supportsClass)return Function("constructor, args, target",`\n 'use strict';\n\n if (arguments.length === 3 && typeof target !== 'function')\n throw new TypeError(target + ' is not a constructor');\n\n target = target || constructor;\n\n // extend target so the right prototype is constructed (or nearly the\n // right one; ideally we'd do instantiator.prototype = target.prototype,\n // but a class's prototype property is not writable)\n class instantiator extends target {};\n // but ensure the *logic* is 'constructor' for ES2015-compliant engines\n Object.setPrototypeOf(instantiator, constructor);\n // ...and for Safari 9\n instantiator.prototype.constructor = constructor;\n\n // The spread operator is *dramatically faster, so use it if we can:\n // http://jsperf.com/new-via-spread-vs-dynamic-function/4\n ${supportsSpread?"\n\n var value = new instantiator(...([].slice.call(args)));\n\n ":"\n\n // otherwise, create a dynamic function in order to use 'new'\n // Note using 'function.bind' would be simpler, but is much slower:\n // http://jsperf.com/new-operator-with-dynamic-function-vs-bind\n var argList = '';\n for (var i = 0, len = args.length; i < len; i++) {\n if (i > 0) argList += ',';\n argList += 'args[' + i + ']';\n }\n var constructCall = Function('constructor, args',\n 'return new constructor( ' + argList + ' );'\n );\n var value = constructCall(constructor, args);\n\n args = Array.prototype.slice.call(args);\n args = [null].concat(args);\n var value = new constructor.bind.apply(constructor, args);\n\n "}\n\n // fix up the prototype so it matches the intended one, not one who's\n // prototype is the intended one :P\n Object.setPrototypeOf(value, target.prototype);\n return value;\n `);var t=function(){};return function(e,n,r){if(3===arguments.length&&"function"!=typeof r)throw new TypeError(r+" is not a constructor");t.prototype=(r||e).prototype;var o=new t,c=e.apply(o,n);return"object"==typeof c&&c?(c.__proto__=(r||e).prototype,c):o}}(),SKIP_PROPERTIES=["arguments","caller","length","name","prototype"];function copyProperties(t,e){if(Object.getOwnPropertyNames&&Object.defineProperty){var n=Object.getOwnPropertyNames(t);Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(t)));for(var r=n.length-1;r>=0;r--)-1===SKIP_PROPERTIES.indexOf(n[r])&&Object.defineProperty(e,n[r],Object.getOwnPropertyDescriptor(t,n[r]))}else for(var o in t)e[o]=t[o]}function newless(constructor){var name=constructor.name,usesClassSyntax="class"===constructor.toString().substr(0,5),requiresNew=!!usesClassSyntax||null,newlessConstructor=(()=>function(){if(!requiresNew&&this instanceof newlessConstructor){if(!1===requiresNew){const t=constructor.apply(this,arguments);return"object"==typeof t&&t||this}try{requiresNew=!1;const t=constructor.apply(this,arguments);return"object"==typeof t&&t||this}catch(t){if(!(t instanceof TypeError&&(/class constructor/i.test(t.message)||/use the 'new' operator/i.test(t.message))))throw/Illegal constructor/i.test(t.message)&&Object.create(constructor.prototype)instanceof Node&&console.error(`The following error can happen if a Custom Element is called\nwith 'new' before being defined. The constructor was ${constructor.name}: `,constructor),t;requiresNew=!0}}var newTarget,hasNewTarget=!1;supportsNewTarget&&(eval("newTarget = new.target"),newTarget&&(hasNewTarget=!0)),supportsNewTarget&&hasNewTarget||(newTarget=this instanceof newlessConstructor?this.constructor:constructor);const returnValue=construct(constructor,arguments,newTarget);return this instanceof newlessConstructor&&setPrototype(this,returnValue),returnValue})();if(name){const t=Object(_utils_js__WEBPACK_IMPORTED_MODULE_0__.c)(newlessConstructor);newlessConstructor=Function("constructor, construct, setPrototype, requiresNew, supportsNewTarget",`\n var newlessConstructor = function ${name}() { ${t} };\n return newlessConstructor\n `)(constructor,construct,setPrototype,requiresNew,supportsNewTarget)}return constructor.length&&Object(_utils_js__WEBPACK_IMPORTED_MODULE_0__.j)(newlessConstructor,"length",{value:constructor.length}),newlessConstructor.prototype=Object.create(constructor.prototype),newlessConstructor.prototype.constructor=newlessConstructor,constructor.prototype.constructor=constructor,newlessConstructor[TRUE_CONSTRUCTOR]=constructor,copyProperties(constructor,newlessConstructor),setPrototype(newlessConstructor,constructor),newlessConstructor}function isSyntaxSupported(t,e=!0){try{return!!Function("",(e?"'use strict';":"")+t)}catch(t){return!1}}},function(t,e,n){"use strict";(function(t){function r(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t?t:Function("return this")()}n.d(e,"a",(function(){return r}))}).call(this,n(3))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.r(e),n.d(e,"variable",(function(){return Ue})),n.d(e,"autorun",(function(){return ze})),n.d(e,"reactive",(function(){return Xe})),n.d(e,"_trackReactiveProperty",(function(){return Ke})),n.d(e,"reactify",(function(){return Qe})),n.d(e,"untrack",(function(){return tn})),n.d(e,"circular",(function(){return en})),n.d(e,"version",(function(){return nn}));var r={};n.r(r),n.d(r,"$RAW",(function(){return _t})),n.d(r,"ErrorBoundary",(function(){return Qt})),n.d(r,"For",(function(){return Xt})),n.d(r,"Index",(function(){return Kt})),n.d(r,"Match",(function(){return Jt})),n.d(r,"Show",(function(){return Gt})),n.d(r,"Suspense",(function(){return ee})),n.d(r,"SuspenseList",(function(){return te})),n.d(r,"Switch",(function(){return Ht})),n.d(r,"awaitSuspense",(function(){return ne})),n.d(r,"batch",(function(){return q})),n.d(r,"cancelCallback",(function(){return h})),n.d(r,"children",(function(){return et})),n.d(r,"createComponent",(function(){return $t})),n.d(r,"createComputed",(function(){return F})),n.d(r,"createContext",(function(){return Z})),n.d(r,"createDeferred",(function(){return V})),n.d(r,"createEffect",(function(){return W})),n.d(r,"createMemo",(function(){return L})),n.d(r,"createMutable",(function(){return Dt})),n.d(r,"createRenderEffect",(function(){return I})),n.d(r,"createResource",(function(){return rt})),n.d(r,"createRoot",(function(){return D})),n.d(r,"createSelector",(function(){return $})),n.d(r,"createSignal",(function(){return M})),n.d(r,"createState",(function(){return Et})),n.d(r,"equalFn",(function(){return w})),n.d(r,"getListener",(function(){return G})),n.d(r,"getOwner",(function(){return H})),n.d(r,"indexArray",(function(){return Vt})),n.d(r,"lazy",(function(){return zt})),n.d(r,"mapArray",(function(){return Lt})),n.d(r,"mergeProps",(function(){return Bt})),n.d(r,"on",(function(){return U})),n.d(r,"onCleanup",(function(){return X})),n.d(r,"onError",(function(){return K})),n.d(r,"onMount",(function(){return z})),n.d(r,"produce",(function(){return It})),n.d(r,"reconcile",(function(){return Mt})),n.d(r,"requestCallback",(function(){return d})),n.d(r,"runWithOwner",(function(){return J})),n.d(r,"serializeGraph",(function(){return Q})),n.d(r,"sharedConfig",(function(){return b})),n.d(r,"splitProps",(function(){return Ut})),n.d(r,"untrack",(function(){return B})),n.d(r,"unwrap",(function(){return St})),n.d(r,"useContext",(function(){return tt})),n.d(r,"useTransition",(function(){return Y}));let o=1,c=!1,s=!1,u=[],i=null,l=null,a=0,f=null,p=null;function d(t,e){f||function(){if(window&&window.MessageChannel){const t=new MessageChannel,e=t.port2;f=()=>e.postMessage(null),t.port1.onmessage=()=>{if(null!==p){const t=performance.now();a=t+5;const n=!0;try{p(n,t)?e.postMessage(null):p=null}catch(t){throw e.postMessage(null),t}}}}else{let t;f=()=>{t||(t=p,setTimeout(()=>{const e=performance.now();a=e+5;const n=t(!0,e);t=null,n&&f()},0))}}if(navigator&&navigator.scheduling&&navigator.scheduling.isInputPending){const t=navigator.scheduling;l=()=>{const e=performance.now();return e>=a&&(!!t.isInputPending()||e>=300)}}else l=()=>performance.now()>=a}();let n=performance.now(),r=1073741823;e&&e.timeout&&(r=e.timeout);const i={id:o++,fn:t,startTime:n,expirationTime:n+r};return function(t,e){t.splice(function(){let n=0,r=t.length-1;for(;n<=r;){let o=r+n>>1,c=e.expirationTime-t[o].expirationTime;if(c>0)n=o+1;else{if(!(c<0))return o;r=o-1}}return n}(),0,e)}(u,i),c||s||(c=!0,p=g,f()),i}function h(t){t.fn=null}function g(t,e){c=!1,s=!0;try{return function(t,e){let n=e;i=u[0]||null;for(;null!==i&&(!(i.expirationTime>n)||t&&!l());){const t=i.fn;if(null!==t){i.fn=null;const e=i.expirationTime<=n;t(e),n=performance.now(),i===u[0]&&u.shift()}else u.shift();i=u[0]||null}return null!==i}(t,e)}finally{i=null,s=!1}}const b={};function y(t){b.context=t}const w=(t,e)=>t===e;let _=null,v=ft;const O={},P={owned:null,cleanups:null,context:null,owner:null},m=Symbol("lazy"),[j,S]=M(!1,!0);var T=null,A=null;let k,x=null,C=null,E=null,N=null,R=0;function D(t,e){e&&(T=e);const n=A,r=T,o=0===t.length?P:{owned:null,cleanups:null,context:null,owner:r,attached:!!e};let c;T=o,A=null;try{at(()=>c=t(()=>gt(o)),!0)}finally{A=n,T=r}return c}function M(t,e,n){const r={value:t,observers:null,observerSlots:null,pending:O,comparator:e?"function"==typeof e?e:w:void 0};return[ot.bind(r),ct.bind(r)]}function F(t,e){st(it(t,e,!0))}function I(t,e){st(it(t,e,!1))}function W(t,e){v=pt;const n=it(t,e,!1),r=k&&yt(T,k.id);r&&(n.suspense=r),n.user=!0,E&&E.push(n)}function L(t,e,n){const r=it(t,e,!0);return r.pending=O,r.observers=null,r.observerSlots=null,r.state=0,r.comparator=n?"function"==typeof n?n:w:void 0,st(r),ot.bind(r)}function V(t,e){let n,r=e?e.timeoutMs:void 0;const[o,c]=M(),s=it(()=>(n&&n.fn||(n=d(()=>c(s.value),void 0!==r?{timeout:r}:void 0)),t()),void 0,!0);return st(s),c(s.value),o}function $(t,e=w){let n=new Map;const r=it(r=>{const o=t();for(const t of n.keys())if(e(t,o)||void 0!==r&&e(t,r)){const e=n.get(t);e.state=1,e.pure?C.push(e):E.push(e)}return o},void 0,!0);return st(r),t=>(A&&(n.set(t,A),X(()=>n.delete(t))),e(t,r.value))}function q(t){if(x)return t();const e=x=[],n=t();return x=null,at(()=>{for(let t=0;t<e.length;t+=1){const n=e[t];if(n.pending!==O){const t=n.pending;n.pending=O,ct.call(n,t)}}},!1),n}function Y(){return[j,t=>{k&&(N||(N={sources:new Set,effects:[],promises:new Set,disposed:new Set,running:!0}),N.running=!0),q(t)}]}function B(t){let e,n=A;return A=null,e=t(),A=n,e}function U(...t){const e=t.pop();let n,r,o=!0;return t.length<2?(n=t[0],o=!1):n=t,t=>{let c;if(o){c=[],r||(r=[]);for(let t=0;t<n.length;t++)c.push(n[t]())}else c=n();const s=B(()=>e(c,r,t));return r=c,s}}function z(t){W(()=>B(t))}function X(t){return null===T||(null===T.cleanups?T.cleanups=[t]:T.cleanups.push(t)),t}function K(t){_||(_=Symbol("error")),null===T||(null===T.context?T.context={[_]:[t]}:T.context[_]?T.context[_].push(t):T.context[_]=[t])}function G(){return A}function H(){return T}function J(t,e){const n=T;T=t;try{return e()}finally{T=n}}function Q(t){return{}}function Z(t){const e=Symbol("context");return{id:e,Provider:wt(e),defaultValue:t}}function tt(t){return yt(T,t.id)||t.defaultValue}function et(t){const e=L(t);return L(()=>function t(e){if("function"==typeof e&&!e.length)return t(e());if(Array.isArray(e)){const n=[];for(let r=0;r<e.length;r++){let o=t(e[r]);Array.isArray(o)?n.push.apply(n,o):n.push(o)}return n}return e}(e()))}function nt(){return k||(k=Z({}))}function rt(t,e,n){const r=new Set,[o,c]=M(n,!0),[s,u]=M(),[i,l]=M(!1,!0);let a=null,f=null,p=null,d=null,h=!1,g="function"==typeof t;function y(t,e,n){return f===t&&(a=n,f=null,N&&t&&h?(N.promises.delete(t),h=!1,at(()=>{N.running=!0,N.promises.size||(E.push.apply(E,N.effects),N.effects=[]),w(e)},!1)):w(e)),e}function w(t){q(()=>{c(t),l(!1);for(let t of r.keys())t.decrement();r.clear()})}function _(){const t=k&&yt(T,k.id),e=o();if(a)throw a;return A&&!A.user&&t&&F(()=>{s(),f&&(t.resolved&&N?N.promises.add(f):r.has(t)||(t.increment(),r.add(t)))}),e}function v(){a=null;let n=g?t():t;if(h=N&&N.running,null==n||!1===n)return void y(f,B(o));const r=p||e(n,o);p=null,"object"==typeof r&&"then"in r?(f=r,q(()=>{l(!0),u()}),r.then(t=>y(r,t),t=>y(r,t,t))):y(f,r)}return b.context&&(d=`${b.context.id}${b.context.count++}`,b.context.loadResource?p=b.context.loadResource(d):b.resources&&d&&d in b.resources&&(p=b.resources[d],delete b.resources[d])),Object.defineProperty(_,"loading",{get:()=>i()}),g?F(v):v(),[_,{refetch:v,mutate:c}]}function ot(){if(this.state&&this.sources){const t=C;C=null,1===this.state?st(this):dt(this),C=t}if(A){const t=this.observers?this.observers.length:0;A.sources?(A.sources.push(this),A.sourceSlots.push(t)):(A.sources=[this],A.sourceSlots=[t]),this.observers?(this.observers.push(A),this.observerSlots.push(A.sources.length-1)):(this.observers=[A],this.observerSlots=[A.sources.length-1])}return N&&N.running&&N.sources.has(this)?this.tValue:this.value}function ct(t,e){if(this.comparator)if(N&&N.running&&N.sources.has(this)){if(this.comparator(this.tValue,t))return t}else if(this.comparator(this.value,t))return t;return x?(this.pending===O&&x.push(this),this.pending=t,t):(N?((N.running||!e&&N.sources.has(this))&&(N.sources.add(this),this.tValue=t),N.running||(this.value=t)):this.value=t,!this.observers||C&&!this.observers.length||at(()=>{for(let t=0;t<this.observers.length;t+=1){const e=this.observers[t];N&&N.running&&N.disposed.has(e)||(e.observers&&2!==e.state&&ht(e),e.state=1,e.pure?C.push(e):E.push(e))}if(C.length>1e6)throw C=[],new Error("Potential Infinite Loop Detected.")},!1),t)}function st(t){if(!t.fn)return;gt(t);const e=T,n=A,r=R;A=T=t,ut(t,t.value,r),N&&!N.running&&N.sources.has(t)&&(N.running=!0,ut(t,t.tValue,r),N.running=!1),A=n,T=e}function ut(t,e,n){let r;try{r=t.fn(e)}catch(t){bt(t)}(!t.updatedAt||t.updatedAt<=n)&&(t.observers&&t.observers.length?ct.call(t,r,!0):N&&N.running&&t.pure?(N.sources.add(t),t.tValue=r):t.value=r,t.updatedAt=n)}function it(t,e,n){const r={fn:t,state:1,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:T,context:null,pure:n};return null===T||T!==P&&(N&&N.running&&T.pure?T.tOwned?T.tOwned.push(r):T.tOwned=[r]:T.owned?T.owned.push(r):T.owned=[r]),r}function lt(t){let e,n=1===t.state&&t;if(t.suspense&&B(t.suspense.inFallback))return t.suspense.effects.push(t);const r=N&&N.running;for(;(t.fn||r&&t.attached)&&(t=t.owner);){if(r&&N.disposed.has(t))return;2===t.state?e=t:1===t.state&&(n=t,e=void 0)}if(e){const o=C;if(C=null,dt(e),C=o,!n||1!==n.state)return;if(r)for(t=n;(t.fn||t.attached)&&(t=t.owner);)if(N.disposed.has(t))return}n&&st(n)}function at(t,e){if(C)return t();let n=!1;e||(C=[]),E?n=!0:E=[],R++;try{t()}catch(t){bt(t)}finally{!function(t){C&&(ft(C),C=null);if(t)return;if(N&&N.running){if(N.promises.size)return N.running=!1,N.effects.push.apply(N.effects,E),E=null,void S(!0);const t=N.sources;N=null,q(()=>{t.forEach(t=>{if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)gt(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned}),S(!1)})}E.length?q(()=>{v(E),E=null}):E=null}(n)}}function ft(t){for(let e=0;e<t.length;e++)lt(t[e])}function pt(t){let e,n=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[n++]=r:lt(r)}const r=t.length;for(e=0;e<n;e++)lt(t[e]);for(e=r;e<t.length;e++)lt(t[e])}function dt(t){t.state=0;for(let e=0;e<t.sources.length;e+=1){const n=t.sources[e];n.sources&&(1===n.state?lt(n):2===n.state&&dt(n))}}function ht(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=2,n.observers&&ht(n))}}function gt(t){let e;if(t.sources)for(;t.sources.length;){const e=t.sources.pop(),n=t.sourceSlots.pop(),r=e.observers;if(r&&r.length){const t=r.pop(),o=e.observerSlots.pop();n<r.length&&(t.sourceSlots[o]=n,r[n]=t,e.observerSlots[n]=o)}}if(N&&N.running&&t.pure){if(t.tOwned){for(e=0;e<t.tOwned.length;e++)gt(t.tOwned[e]);delete t.tOwned}!function t(e,n){n||(e.state=0,N.disposed.add(e));if(e.owned)for(let n=0;n<e.owned.length;n++)t(e.owned[n])}(t,!0)}else if(t.owned){for(e=0;e<t.owned.length;e++)gt(t.owned[e]);t.owned=null}if(t.cleanups){for(e=0;e<t.cleanups.length;e++)t.cleanups[e]();t.cleanups=null}t.state=0,t.context=null}function bt(t){const e=_&&yt(T,_);if(!e)throw t;e.forEach(e=>e(t))}function yt(t,e){return t&&(t.context&&t.context[e]||t.owner&&yt(t.owner,e))}function wt(t){return function(e){return L(()=>(T.context={[t]:e.value},et(()=>e.children)))}}const _t=Symbol("state-raw"),vt=Symbol("state-node"),Ot=Symbol("state-proxy"),Pt=Symbol("state-name");function mt(t,e){let n=t[Ot];if(!n){Object.defineProperty(t,Ot,{value:n=new Proxy(t,kt)});let e=Object.keys(t),r=Object.getOwnPropertyDescriptors(t);for(let o=0,c=e.length;o<c;o++){const c=e[o];if(r[c].get){const e=r[c].get.bind(n);Object.defineProperty(t,c,{get:e})}}}return n}function jt(t){return null!=t&&"object"==typeof t&&(!t.__proto__||t.__proto__===Object.prototype||Array.isArray(t))}function St(t){let e,n,r,o;if(e=null!=t&&t[_t])return e;if(!jt(t))return t;if(Array.isArray(t)){Object.isFrozen(t)&&(t=t.slice(0));for(let e=0,o=t.length;e<o;e++)r=t[e],(n=St(r))!==r&&(t[e]=n)}else{Object.isFrozen(t)&&(t=Object.assign({},t));let e=Object.keys(t),c=Object.getOwnPropertyDescriptors(t);for(let s=0,u=e.length;s<u;s++)o=e[s],c[o].get||(r=t[o],(n=St(r))!==r&&(t[o]=n))}return t}function Tt(t){let e=t[vt];return e||Object.defineProperty(t,vt,{value:e={}}),e}function At(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);return!n||n.get||e===Ot||e===vt||e===Pt||(delete n.value,delete n.writable,n.get=()=>t[Ot][e]),n}const kt={get(t,e,n){if(e===_t)return t;if(e===Ot)return n;const r=t[e];if(e===vt||"__proto__"===e)return r;const o=jt(r);if(A&&("function"!=typeof r||t.hasOwnProperty(e))){let n,c;o&&(n=Tt(r))&&(c=n._||(n._=M()),c[0]()),n=Tt(t),c=n[e]||(n[e]=M()),c[0]()}return o?mt(r):r},set:()=>!0,deleteProperty:()=>!0,getOwnPropertyDescriptor:At};function xt(t,e,n){if(t[e]===n)return;const r=Array.isArray(t)||!(e in t);void 0===n?delete t[e]:t[e]=n;let o,c=Tt(t);(o=c[e])&&o[1](n),r&&(o=c._)&&o[1]()}function Ct(t,e,n=[]){let r,o=t;if(e.length>1){r=e.shift();const c=typeof r,s=Array.isArray(t);if(Array.isArray(r)){for(let o=0;o<r.length;o++)Ct(t,[r[o]].concat(e),[r[o]].concat(n));return}if(s&&"function"===c){for(let o=0;o<t.length;o++)r(t[o],o)&&Ct(t,[o].concat(e),[o].concat(n));return}if(s&&"object"===c){const{from:o=0,to:c=t.length-1,by:s=1}=r;for(let r=o;r<=c;r+=s)Ct(t,[r].concat(e),[r].concat(n));return}if(e.length>1)return void Ct(t[r],e,[r].concat(n));o=t[r],n=[r].concat(n)}let c=e[0];"function"==typeof c&&(c=c(o,n),c===o)||void 0===r&&null==c||(c=St(c),void 0===r||jt(o)&&jt(c)&&!Array.isArray(c)?function(t,e){const n=Object.keys(e);for(let r=0;r<n.length;r+=1){const o=n[r];xt(t,o,e[o])}}(o,c):xt(t,r,c))}function Et(t,e){const n=St(t||{});return[mt(n),function(...t){q(()=>Ct(n,t))}]}const Nt={get(t,e,n){if(e===_t)return t;if(e===Ot)return n;const r=t[e];if(e===vt||"__proto__"===e)return r;const o=jt(r);if(A&&("function"!=typeof r||t.hasOwnProperty(e))){let n,c;o&&(n=Tt(r))&&(c=n._||(n._=M()),c[0]()),n=Tt(t),c=n[e]||(n[e]=M()),c[0]()}return o?Rt(r):r},set:(t,e,n)=>(xt(t,e,St(n)),!0),deleteProperty:(t,e)=>(xt(t,e,void 0),!0),getOwnPropertyDescriptor:At};function Rt(t,e){let n=t[Ot];if(!n){Object.defineProperty(t,Ot,{value:n=new Proxy(t,Nt)});let e=Object.keys(t),r=Object.getOwnPropertyDescriptors(t);for(let o=0,c=e.length;o<c;o++){const c=e[o];if(r[c].get){const e=r[c].get.bind(n);Object.defineProperty(t,c,{get:e})}if(r[c].set){const e=r[c].set,o=t=>q(()=>e.call(n,t));Object.defineProperty(t,c,{set:o})}}}return n}function Dt(t,e){return Rt(St(t||{}))}function Mt(t,e={}){const{merge:n,key:r="id"}=e,o=St(t);return t=>jt(t)&&jt(o)?(function t(e,n,r,o,c){let s=n[r];if(e===s)return;if(!jt(e)||!jt(s)||c&&e[c]!==s[c])return void(e!==s&&xt(n,r,e));if(Array.isArray(e)){if(e.length&&s.length&&(!o||c&&null!=e[0][c])){let n,r,u,i,l,a,f,p;for(u=0,i=Math.min(s.length,e.length);u<i&&(s[u]===e[u]||c&&s[u][c]===e[u][c]);u++)t(e[u],s,u,o,c);const d=new Array(e.length),h=new Map;for(i=s.length-1,l=e.length-1;i>=u&&l>=u&&(s[i]===e[l]||c&&s[i][c]===e[l][c]);i--,l--)d[l]=s[i];if(u>l||u>i){for(r=u;r<=l;r++)xt(s,r,e[r]);for(;r<e.length;r++)xt(s,r,d[r]),t(e[r],s,r,o,c);return void(s.length>e.length&&xt(s,"length",e.length))}for(f=new Array(l+1),r=l;r>=u;r--)a=e[r],p=c?a[c]:a,n=h.get(p),f[r]=void 0===n?-1:n,h.set(p,r);for(n=u;n<=i;n++)a=s[n],p=c?a[c]:a,r=h.get(p),void 0!==r&&-1!==r&&(d[r]=s[n],r=f[r],h.set(p,r));for(r=u;r<e.length;r++)r in d?(xt(s,r,d[r]),t(e[r],s,r,o,c)):xt(s,r,e[r])}else for(let n=0,r=e.length;n<r;n++)t(e[n],s,n,o,c);return void(s.length>e.length&&xt(s,"length",e.length))}const u=Object.keys(e);for(let n=0,r=u.length;n<r;n++)t(e[u[n]],s,u[n],o,c);const i=Object.keys(s);for(let t=0,n=i.length;t<n;t++)void 0===e[i[t]]&&xt(s,i[t],void 0)}(o,{state:t},"state",n,r),t):o}const Ft={get(t,e){if(e===_t)return t;const n=t[e];return jt(n)?new Proxy(n,Ft):n},set:(t,e,n)=>(xt(t,e,St(n)),!0),deleteProperty:(t,e)=>(xt(t,e,void 0),!0)};function It(t){return e=>(jt(e)&&t(new Proxy(e,Ft)),e)}const Wt=Symbol("fallback");function Lt(t,e,n={}){let r=[],o=[],c=[],s=0,u=e.length>1?[]:null,i=T;return X(()=>{for(let t=0,e=c.length;t<e;t++)c[t]()}),()=>{let l,a,f=t()||[];return B(()=>{let t,e,d,h,g,b,y,w,_,v=f.length;if(0===v){if(0!==s){for(l=0;l<s;l++)c[l]();c=[],r=[],o=[],s=0,u&&(u=[])}n.fallback&&(r=[Wt],o[0]=D(t=>(c[0]=t,n.fallback()),i),s=1)}else if(0===s){for(a=0;a<v;a++)r[a]=f[a],o[a]=D(p,i);s=v}else{for(d=new Array(v),h=new Array(v),u&&(g=new Array(v)),b=0,y=Math.min(s,v);b<y&&r[b]===f[b];b++);for(y=s-1,w=v-1;y>=b&&w>=b&&r[y]===f[w];y--,w--)d[w]=o[y],h[w]=c[y],u&&(g[w]=u[y]);for(t=new Map,e=new Array(w+1),a=w;a>=b;a--)_=f[a],l=t.get(_),e[a]=void 0===l?-1:l,t.set(_,a);for(l=b;l<=y;l++)_=r[l],a=t.get(_),void 0!==a&&-1!==a?(d[a]=o[l],h[a]=c[l],u&&(g[a]=u[l]),a=e[a],t.set(_,a)):c[l]();for(a=b;a<v;a++)a in d?(o[a]=d[a],c[a]=h[a],u&&(u[a]=g[a],u[a](a))):o[a]=D(p,i);s=o.length=v,r=f.slice(0)}return o});function p(t){if(c[a]=t,u){const[t,n]=M(a,!0);return u[a]=n,e(f[a],t)}return e(f[a])}}}function Vt(t,e,n={}){let r,o=[],c=[],s=[],u=[],i=0,l=T;return X(()=>{for(let t=0,e=s.length;t<e;t++)s[t]()}),()=>{const a=t()||[];return B(()=>{if(0===a.length){if(0!==i){for(r=0;r<i;r++)s[r]();s=[],o=[],c=[],i=0,u=[]}return n.fallback&&(o=[Wt],c[0]=D(t=>(s[0]=t,n.fallback()),l),i=1),c}for(o[0]===Wt&&(s[0](),s=[],o=[],c=[],i=0),r=0;r<a.length;r++)r<o.length&&o[r]!==a[r]?u[r](a[r]):r>=o.length&&(c[r]=D(f,l));for(;r<o.length;r++)s[r]();return i=c.length=u.length=s.length=a.length,o=a.slice(0),c});function f(t){s[r]=t;const[n,o]=M(a[r]);return u[r]=o,e(n,r)}}}function $t(t,e){if(b.context){const n=b.context;y({...b.context,id:`${b.context.id}${b.context.count++}.`,count:0});const r=B(()=>t(e));return y(n),r}return B(()=>t(e))}function qt(){return!0}const Yt={get:(t,e)=>t.get(e),has:(t,e)=>t.has(e),set:qt,deleteProperty:qt,getOwnPropertyDescriptor:(t,e)=>({configurable:!0,enumerable:!0,get:()=>t.get(e),set:qt,deleteProperty:qt}),ownKeys:t=>t.keys()};function Bt(...t){return new Proxy({get(e){for(let n=t.length-1;n>=0;n--){const r=t[n][e];if(void 0!==r)return r}},has(e){for(let n=t.length-1;n>=0;n--)if(e in t[n])return!0;return!1},keys(){const e=[];for(let n=0;n<t.length;n++)e.push(...Object.keys(t[n]));return[...new Set(e)]}},Yt)}function Ut(t,...e){const n=new Set(e.flat()),r=Object.getOwnPropertyDescriptors(t),o=e.map(t=>{const e={};for(let n=0;n<t.length;n++){const o=t[n];r[o]&&Object.defineProperty(e,o,r[o])}return e});return o.push(new Proxy({get:e=>n.has(e)?void 0:t[e],has:e=>!n.has(e)&&e in t,keys:()=>Object.keys(t).filter(t=>!n.has(t))},Yt)),o}function zt(t){let e;return n=>{const r=b.context;let o,c;if(r&&b.resources){r.count++;const[n,c]=M();(e||(e=t())).then(t=>{y(r),c(t.default),y(void 0)}),o=n}else{const[n]=rt(m,()=>(e||(e=t())).then(t=>t.default));o=n}return L(()=>(c=o())&&B(()=>{if(!r)return c(n);const t=b.context;y(r);const e=c(n);return y(t),e}))}}function Xt(t){const e="fallback"in t&&{fallback:()=>t.fallback};return L(Lt(()=>t.each,t.children,e||void 0))}function Kt(t){const e="fallback"in t&&{fallback:()=>t.fallback};return L(Vt(()=>t.each,t.children,e||void 0))}function Gt(t){let e=!1;const n=L(()=>t.when,void 0,(t,n)=>e?t===n:!t==!n);return L(()=>{const r=n();if(r){const n=t.children;return(e="function"==typeof n&&n.length>0)?B(()=>n(r)):n}return t.fallback})}function Ht(t){let e=!1;const n=et(()=>t.children),r=L(()=>{let t=n();Array.isArray(t)||(t=[t]);for(let e=0;e<t.length;e++){const n=t[e].when;if(n)return[e,n,t[e]]}return[-1]},void 0,(t,n)=>t&&t[0]===n[0]&&(e?t[1]===n[1]:!t[1]==!n[1])&&t[2]===n[2]);return L(()=>{const[n,o,c]=r();if(n<0)return t.fallback;const s=c.children;return(e="function"==typeof s&&s.length>0)?B(()=>s(o)):s})}function Jt(t){return t}function Qt(t){const[e,n]=M();let r;return K(n),L(()=>{if(null!=(r=e())){const e=t.fallback;return"function"==typeof e&&e.length?B(()=>e(r)):e}return t.children})}const Zt=Z();function te(t){let e,n,r,o=0;const c=tt(Zt);if(c){const[t,o]=M(!1,!0);e=o,[n,r]=c.register(t)}const s=[],u=$t(Zt.Provider,{value:{register:t=>{const[e,n]=M(!1,!0),[r,c]=M(!1,!0);return s[o++]={inFallback:t,showContent:n,showFallback:c},[e,r]}},get children(){return t.children}});return F(()=>{const o=t.revealOrder,c=t.tail,u=!n||n(),i=!r||r(),l="backwards"===o;if("together"===o){const t=s.every(t=>!t.inFallback());return e&&e(!t),void s.forEach(e=>{e.showContent(t&&u),e.showFallback(i)})}let a=!1;for(let t=0,n=s.length;t<n;t++){const r=l?n-t-1:t,o=s[r].inFallback();if(a||o){const t=!a;t&&e&&e(!0),!c||t&&"collapsed"===c?s[r].showFallback(i):s[r].showFallback(!1),a=!0,s[r].showContent(t)}else s[r].showContent(u),s[r].showFallback(i)}!a&&e&&e(!1)}),u}function ee(t){let e,n,r=0;const[o,c]=M(!1),s=nt(),u={increment:()=>{1==++r&&c(!0)},decrement:()=>{0==--r&&c(!1)},inFallback:o,effects:[],resolved:!1},i=tt(Zt);return i&&([e,n]=i.register(u.inFallback)),$t(s.Provider,{value:u,get children(){const r=B(()=>t.children);return L(()=>{const o=u.inFallback(),c=!e||e(),s=!n||n();return!o&&c?(u.resolved=!0,i=u.effects,N&&(N.running=!0),E.push.apply(E,i),i.length=0,r):s?t.fallback:void 0;var i})}})}function ne(){}var re=n(0);const oe=["subclass","extends",...Object.getOwnPropertyNames(new Function)],ce=new WeakMap,se=new WeakMap,ue=new re.a,ie=new WeakMap,le=new WeakMap,ae=new WeakMap,fe=new WeakMap,pe=new WeakMap,de={mode:"es5",nativeNaming:!1,prototypeWritable:!1,defaultClassDescriptor:{writable:!0,enumerable:!1,configurable:!0},setClassDescriptors:!0};class he extends Error{}class ge extends Error{}function be(t,e){let n=t.cachedPublicAccesses.get(e);return n||(je(t,e)?t.cachedPublicAccesses.set(e,n=we(e).publicToPrivate.get(e)):me(t,e)?t.cachedPublicAccesses.set(e,n=ue.get(e)):t.cachedPublicAccesses.set(e,n=e),n)}function ye(t,e){let n=t.cachedProtectedAccesses.get(e);if(n)return n;if(Pe(t,e))t.cachedProtectedAccesses.set(e,n=ue.get(e)||_e(e));else if(je(t,e)){const r=we(e).publicToPrivate.get(e);t.cachedProtectedAccesses.set(e,n=ue.get(r)||_e(r))}else me(t,e)&&t.cachedProtectedAccesses.set(e,n=e);if(!n)throw new ge("invalid access of protected member");return n}function we(t){return ie.get(t)}function _e(t){const e=function(t){let e=null,n=t.__proto__;for(;n;){if(e=ce.get(n),e)return e;n=n.__proto__}return e}(t),n=Object.create(e);return ue.set(t,n),n}function ve(t,e){let n=t.cachedPrivateAccesses.get(e);if(n)return n;if(Pe(t,e))t.cachedPrivateAccesses.set(e,n=t.publicToPrivate.get(e)||Oe(t,e));else if(me(t,e)){const r=ue.get(e);t.cachedPrivateAccesses.set(e,n=t.publicToPrivate.get(r)||Oe(t,r))}else je(t,e)&&t.cachedPrivateAccesses.set(e,n=e);if(!n)throw new ge("invalid access of private member");return n}function Oe(t,e){const n=Object.create(t.privatePrototype);return t.publicToPrivate.set(e,n),ie.set(n,t),n}function Pe(t,e,n=!0){if(!n)return Object(re.f)(e,t.publicPrototype);for(const n of Array.from(le.get(t.classBrand)))if(Object(re.f)(e,n))return!0;return!1}function me(t,e,n=!0){if(!n)return Object(re.f)(e,t.protectedPrototype);for(const n of Array.from(ae.get(t.classBrand)))if(Object(re.f)(e,n))return!0;return!1}function je(t,e,n=!0){if(!n)return Object(re.f)(e,t.privatePrototype);for(const n of Array.from(fe.get(t.classBrand)))if(Object(re.f)(e,n))return!0;return!1}function Se(t,e,n){const{parentPublicPrototype:r,parentProtectedPrototype:o,parentPrivatePrototype:c}=e;if(Pe(e,n,!1))return Te(n,r,t);if(me(e,n,!1))return Te(n,o,t);if(je(e,n,!1))return Te(n,c,t);throw new he("invalid super access")}function Te(t,e,n){let r=n.get(t);if(!r){n.set(t,r=Object.create(e));const o=Object(re.e)(e);let c=o.length;for(;c--;){const n=o[c];Object(re.j)(r,n,{get:function(){let r=void 0;const o=Object(re.d)(e,n);if(o&&Object(re.g)(o)){const e=o.get;e&&(r=e.call(t))}else r=e[n];return r&&r.call&&"function"==typeof r&&(r=r.bind(t)),r},set:function(r){const o=Object(re.d)(e,n);if(o&&Object(re.g)(o)){const e=o.set;e&&(r=e.call(t,r))}else t[n]=r}},!0)}}return r}var Ae;!function(t){(t=t?{...de,...t}:de).defaultClassDescriptor={...de.defaultClassDescriptor,...t.defaultClassDescriptor};const{mode:e,prototypeWritable:n,setClassDescriptors:r,nativeNaming:o}=t;function c(...t){let e=!1;if("function"==typeof this&&(e=!0),t.length<=3){let n="",r=null,o=null;"string"==typeof t[0]?n=t[0]:"function"!=typeof t[0]&&"object"!=typeof t[0]||(r=t[0],o=t[1]),"function"!=typeof t[1]&&"object"!=typeof t[1]||(r=t[1],o=t[2]);const c=e?s.call(this,n,r,o):s(n,r,o);return c.extends=function(t,e,c){return e=e||r,c=c||o,s.call(t,n,e,c)},c}throw new TypeError("invalid args")}return c;function s(s,u,i){let l=this;if("string"!=typeof s)throw new TypeError("\n You must specify a string for the 'className' argument.\n ");let a=null;if(u&&"object"==typeof u)a=u;else if(!l&&(!u||"function"!=typeof u&&"object"!=typeof u)){let t;return o&&s?t=new Function(`return function ${s}() {}`)():(t=function(){},s&&Object(re.j)(t,"name",{value:s})),t.prototype={__proto__:Object.prototype,constructor:t},Object(re.j)(t,"subclass",{value:c,writable:!0,enumerable:!1,configurable:!1}),t}const f=i?void 0:new re.a;i&&(pe.get(i)||pe.set(i,new re.a));const p={className:s,get publicToPrivate(){return f||pe.get(i)},classBrand:i=i||{brand:"lexical"},cachedPublicAccesses:new WeakMap,cachedProtectedAccesses:new WeakMap,cachedPrivateAccesses:new WeakMap},d=new WeakMap,h=Se.bind(null,d,p),g=be.bind(null,p),b=ye.bind(null,p),y=ve.bind(null,p);if(g.prototype={},b.prototype={},y.prototype={},g.Public=g,g.Protected=b,g.Private=y,g.Super=h,b.Public=g,b.Protected=b,b.Private=y,b.Super=h,a=a||u&&u(g,b,y,h),a&&"object"!=typeof a&&"function"!=typeof a)throw new TypeError("\n The return value of a class definer function, if any, should be\n an object, or a class constructor.\n ");let w,_=null;"function"==typeof a&&(_=a,a=a.prototype,l=_.prototype.__proto__.constructor),a&&(w=a.static,delete a.static,"function"==typeof a.public&&(a.public=a.public(b,y)),"function"==typeof a.protected&&(a.protected=a.protected(g,y)),"function"==typeof a.private&&(a.private=a.private(g,b))),l=l||Object;const v=l.prototype,O=a&&a.public||a||Object.create(v);O.__proto__!==v&&(O.__proto__=v);const P=function(t){let e,n=t;for(;n&&!e;)e=ce.get(n),n=n.__proto__;return e||{}}(v),m=a&&a.protected||Object.create(P);m.__proto__!==P&&(m.__proto__=P),ce.set(O,m);const j=function(t){let e,n=t;for(;n&&!e;)e=se.get(n),n=n.__proto__;return e||{}}(v),S=a&&a.private||Object.create(j);if(S.__proto__!==j&&(S.__proto__=j),se.set(O,S),le.get(i)||le.set(i,new Set),ae.get(i)||ae.set(i,new Set),fe.get(i)||fe.set(i,new Set),le.get(i).add(O),ae.get(i).add(m),fe.get(i).add(S),p.publicPrototype=O,p.privatePrototype=S,p.protectedPrototype=m,p.parentPublicPrototype=v,p.parentProtectedPrototype=P,p.parentPrivatePrototype=j,Object(re.b)(g.prototype,O),Object(re.b)(b.prototype,m),Object(re.b)(y.prototype,S),a&&(delete a.public,delete a.protected,delete a.private,a!==O&&Object(re.b)(a,O)),_)return w&&Object(re.b)(w,_),_;const T=O.hasOwnProperty("constructor")?O.constructor:null;let A=null,k=null;if("es5"!==e)throw new TypeError("\n The lowclass \"mode\" option can only be 'es5' for now.\n ");if(A=function(){let t=null,e=null;return e=T||l,e!==Object&&(t=e.apply(this,arguments)),!t||"object"!=typeof t&&"function"!=typeof t?this:t},k=O,s)if(o){const t=Object(re.c)(A),e=A.prototype;A=new Function(" userConstructor, ParentClass ",`\n return function ${s}() { ${t} }\n `)(T,l),A.prototype=e}else Object(re.j)(A,"name",{value:s});return T&&T.length&&Object(re.j)(A,"length",{value:T.length}),A.__proto__=l,w&&Object(re.b)(w,A),Object(re.j)(A,"subclass",{value:c,writable:!0,enumerable:!1,configurable:!1}),A.prototype=k,A.prototype.constructor=A,r&&(Object(re.i)(A,t,oe),Object(re.j)(A,"prototype",{writable:n}),Object(re.h)(A.prototype,t),Object(re.h)(m,t),Object(re.h)(S,t)),p.constructor=A,A}}();!function(t){t.PROXIES_ON_INSTANCE_AND_PROTOTYPE="PROXIES_ON_INSTANCE_AND_PROTOTYPE",t.PROXIES_ON_PROTOTYPE="PROXIES_ON_PROTOTYPE",t.PROXY_AFTER_INSTANCE_AND_PROTOTYPE="PROXY_AFTER_INSTANCE_AND_PROTOTYPE"}(Ae||(Ae={}));ke={method:Ae.PROXIES_ON_INSTANCE_AND_PROTOTYPE};var ke;let xe=[];const Ce=new WeakMap,Ee=t=>{let e=Ce.get(t);return e||Ce.set(t,e=[]),e},Ne={has:!1,value:void 0};let Re=!1,De=null;n(1);var Me,Fe=n(2);const Ie=Object(Fe.a)(),We=null!==(Me=Ie.SOLID)&&void 0!==Me?Me:Ie.SOLID=r,{createSignal:Le,createEffect:Ve,createRoot:$e,untrack:qe}=We;function Ye(){return this()}function Be(t){return this(t)}function Ue(t){const[e,n]=Le(t),r=t=>void 0===t?e():(n(t),t),o=Ye.bind(r),c=Be.bind(r);return r.get=o,r.set=c,r[0]=o,r[1]=c,r[Symbol.iterator]=function*(){yield r[0],yield r[1]},r}function ze(t){let e;return $e(n=>{e=n,Ve(t)}),e}function Xe(t,e,n){const r=1===arguments.length&&"kind"in t;if(r){const e=t;return"class"===e.kind?{...e,finisher:Ge}:{...e,finisher(t){var n,r;return Ke(t,e.key),null!==(r=null===(n=e.finisher)||void 0===n?void 0:n.call(e,t))&&void 0!==r?r:t}}}if(1===arguments.length&&"function"==typeof t){return Ge(t)}const o=t.constructor;Ke(o,e)}function Ke(t,e){t.reactiveProperties&&t.hasOwnProperty("reactiveProperties")||(t.reactiveProperties=[]),t.reactiveProperties.includes(e)||t.reactiveProperties.push(e)}function Ge(t){var e;return t.hasOwnProperty("__isReactive__")?t:((e=class extends t{constructor(...e){super(...e),Qe(this,t)}}).__isReactive__=!0,e)}function He(t,e){const n="v_"+e;let r,o,c,s=Object(re.d)(t,e);if(s)if(r=s.get,o=s.set,r||o){if(!r||!o)return void console.warn('The `@reactive` decorator was used on an accessor named "'+e+'" which had a getter or a setter, but not both. Reactivity on accessors works only when accessors have both get and set. In this case the decorator does not do anything.');delete s.get,delete s.set}else{if(c=s.value,!s.writable)return void console.warn("The `@reactive` decorator was used on a property named "+e+" that is not writable. Reactivity is not enabled for non-writable properties.");delete s.value,delete s.writable}s={configurable:!0,enumerable:!0,...s,get:r?function(){return Je(this,n,c)(),r.call(this)}:function(){return Je(this,n,c)()},set:o?function(t){o.call(this,t);Je(this,n)(t),this.__propsSetAtLeastOnce__||(this.__propsSetAtLeastOnce__=new Set),this.__propsSetAtLeastOnce__.add(e)}:function(t){Je(this,n)(t),this.__propsSetAtLeastOnce__||(this.__propsSetAtLeastOnce__=new Set),this.__propsSetAtLeastOnce__.add(e)}},t.__reactifiedProps__||(t.__reactifiedProps__=new Set),t.__reactifiedProps__.add(e),Object.defineProperty(t,e,s)}function Je(t,e,n){let r=t[e];return r||(t[e]=r=Ue(n),r)}function Qe(t,e){if(function(t){return"function"==typeof t}(e)){const n=e.reactiveProperties;Array.isArray(n)&&Ze(t,n)}else{Ze(t,e)}return t}function Ze(t,e){var n;for(const r of e){if(null===(n=t.__reactifiedProps__)||void 0===n?void 0:n.has(r))continue;const e=t[r];He(t,r),t[r]=e}}const tn=qe;function en(t,e,n,r){let o=!0;const c=ze(()=>{const e=t();o&&!(o=!1)?r(e):o=!0}),s=ze(()=>{const t=n();o&&!(o=!1)?e(t):o=!0});return function(){c(),s()}}const nn="0.6.1"}]); | ||
//# sourceMappingURL=global.js.map | ||
(()=>{var __webpack_modules__={722:(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__)=>{"use strict";var _utils_js__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(895),__WEBPACK_DEFAULT_EXPORT__=null,supportsSpread=isSyntaxSupported("Object(...[{}])"),supportsClass=isSyntaxSupported("class Test {}"),supportsNewTarget=isSyntaxSupported("new.target"),TRUE_CONSTRUCTOR=Symbol?Symbol("trueConstructor"):"__newlessTrueConstructor__",setPrototype=Object.setPrototypeOf||function(e,t){e.__proto__=t},construct=Reflect&&Reflect.construct||function(){if(supportsClass)return Function("constructor, args, target",`\n 'use strict';\n\n if (arguments.length === 3 && typeof target !== 'function')\n throw new TypeError(target + ' is not a constructor');\n\n target = target || constructor;\n\n // extend target so the right prototype is constructed (or nearly the\n // right one; ideally we'd do instantiator.prototype = target.prototype,\n // but a class's prototype property is not writable)\n class instantiator extends target {};\n // but ensure the *logic* is 'constructor' for ES2015-compliant engines\n Object.setPrototypeOf(instantiator, constructor);\n // ...and for Safari 9\n instantiator.prototype.constructor = constructor;\n\n // The spread operator is *dramatically faster, so use it if we can:\n // http://jsperf.com/new-via-spread-vs-dynamic-function/4\n ${supportsSpread?"\n\n var value = new instantiator(...([].slice.call(args)));\n\n ":"\n\n // otherwise, create a dynamic function in order to use 'new'\n // Note using 'function.bind' would be simpler, but is much slower:\n // http://jsperf.com/new-operator-with-dynamic-function-vs-bind\n var argList = '';\n for (var i = 0, len = args.length; i < len; i++) {\n if (i > 0) argList += ',';\n argList += 'args[' + i + ']';\n }\n var constructCall = Function('constructor, args',\n 'return new constructor( ' + argList + ' );'\n );\n var value = constructCall(constructor, args);\n\n args = Array.prototype.slice.call(args);\n args = [null].concat(args);\n var value = new constructor.bind.apply(constructor, args);\n\n "}\n\n // fix up the prototype so it matches the intended one, not one who's\n // prototype is the intended one :P\n Object.setPrototypeOf(value, target.prototype);\n return value;\n `);var e=function(){};return function(t,r,n){if(3===arguments.length&&"function"!=typeof n)throw new TypeError(n+" is not a constructor");e.prototype=(n||t).prototype;var o=new e,s=t.apply(o,r);return"object"==typeof s&&s?(s.__proto__=(n||t).prototype,s):o}}(),SKIP_PROPERTIES=null;function copyProperties(e,t){if(Object.getOwnPropertyNames&&Object.defineProperty){var r=Object.getOwnPropertyNames(e);Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(e)));for(var n=r.length-1;n>=0;n--)-1===SKIP_PROPERTIES.indexOf(r[n])&&Object.defineProperty(t,r[n],Object.getOwnPropertyDescriptor(e,r[n]))}else for(var o in e)t[o]=e[o]}function newless(constructor){var name=constructor.name,usesClassSyntax="class"===constructor.toString().substr(0,5),requiresNew=!!usesClassSyntax||null,newlessConstructor=(()=>function(){if(!requiresNew&&this instanceof newlessConstructor){if(!1===requiresNew){const e=constructor.apply(this,arguments);return"object"==typeof e&&e||this}try{requiresNew=!1;const e=constructor.apply(this,arguments);return"object"==typeof e&&e||this}catch(e){if(!(e instanceof TypeError&&(/class constructor/i.test(e.message)||/use the 'new' operator/i.test(e.message))))throw e instanceof Error&&/Illegal constructor/i.test(e.message)&&Object.create(constructor.prototype)instanceof Node&&console.error(`The following error can happen if a Custom Element is called\nwith 'new' before being defined. The constructor was ${constructor.name}: `,constructor),e;requiresNew=!0}}var newTarget,hasNewTarget=!1;supportsNewTarget&&(eval("newTarget = new.target"),newTarget&&(hasNewTarget=!0)),supportsNewTarget&&hasNewTarget||(newTarget=this instanceof newlessConstructor?this.constructor:constructor);const returnValue=construct(constructor,arguments,newTarget);return this instanceof newlessConstructor&&setPrototype(this,returnValue),returnValue})();if(name){const e=getFunctionBody(newlessConstructor);newlessConstructor=Function("constructor, construct, setPrototype, requiresNew, supportsNewTarget",`\n var newlessConstructor = function ${name}() { ${e} };\n return newlessConstructor\n `)(constructor,construct,setPrototype,requiresNew,supportsNewTarget)}return constructor.length&&setDescriptor(newlessConstructor,"length",{value:constructor.length}),newlessConstructor.prototype=Object.create(constructor.prototype),newlessConstructor.prototype.constructor=newlessConstructor,constructor.prototype.constructor=constructor,newlessConstructor[TRUE_CONSTRUCTOR]=constructor,copyProperties(constructor,newlessConstructor),setPrototype(newlessConstructor,constructor),newlessConstructor}function isSyntaxSupported(e,t=!0){try{return!!Function("",(t?"'use strict';":"")+e)}catch(e){return!1}}},895:(e,t,r)=>{"use strict";r.d(t,{Ie:()=>n,Sh:()=>o,q$:()=>c,uh:()=>a,ld:()=>l,yA:()=>p,nk:()=>f,Gm:()=>_,Md:()=>d,U8:()=>h});class n{constructor(){this.m=new WeakMap}set(e,t){this.m.set(e,t),this.m.set(t,e)}get(e){return this.m.get(e)}has(e){return this.m.has(e)}}function o(e){const t=e.toString().split("\n");return t.shift(),t.pop(),t.join("\n")}const s={enumerable:!0,configurable:!0};function c(e,t,r,n=!1){r=i(n?l(e,t):Object.getOwnPropertyDescriptor(e,t),r),Object.defineProperty(e,t,r)}function u(e,t){let r,n;const o=Object.getOwnPropertyDescriptors(e);for(const e in t)r=t[e],n=o[e],t[e]=i(n,r);Object.defineProperties(e,t)}function i(e,t){if(("get"in t||"set"in t)&&("value"in t||"writable"in t))throw new TypeError("cannot specify both accessors and a value or writable attribute");return e&&("get"in t||"set"in t?(delete e.value,delete e.writable):("value"in t||"writable"in t)&&(delete e.get,delete e.set)),{...s,...e,...t}}function a(e,t,r=!0){let n,o=!1;return n=1===arguments.length?e:r?l(e,t):Object.getOwnPropertyDescriptor(e,t),n&&(n.get||n.set)&&(o=!0),o}function l(e,t){let r,n=e;for(;n;){if(r=Object.getOwnPropertyDescriptor(n,t),r)return r.owner=n,r;n=n.__proto__}}function p(e){let t=e,r=[];for(;t;)r=r.concat(Object.getOwnPropertyNames(t)),t=t.__proto__;return r=Array.from(new Set(r)),r}function f(e,t){let r=e.__proto__;do{if(t===r)return!0;r=r.__proto__}while(r);return!1}function _(e,t,r){const n=Object.getOwnPropertyNames(e);let o=n.length;for(;o--;){const s=n[o],c=Object.getOwnPropertyDescriptor(e,s);r&&r(c),Object.defineProperty(t,s,c)}}function d(e,{defaultClassDescriptor:{writable:t,enumerable:r,configurable:n}}){const o=Object.getOwnPropertyDescriptors(e);let s;for(const e in o)s=o[e],("value"in s||"writable"in s)&&(s.writable=t),s.enumerable=r,s.configurable=n;u(e,o)}function h(e,{defaultClassDescriptor:{writable:t,enumerable:r,configurable:n}},o){const s=Object.getOwnPropertyDescriptors(e);let c;for(const e in s)o&&o.includes(e)?delete s[e]:(c=s[e],("value"in c||"writable"in c)&&(c.writable=t),c.enumerable=r,c.configurable=n);u(e,s)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{_trackReactiveProperty:()=>le,autorun:()=>ie,circular:()=>be,reactify:()=>de,reactive:()=>ae,untrack:()=>we,variable:()=>ue,version:()=>ge});var e=__webpack_require__(895);const t=["subclass","extends",...Object.getOwnPropertyNames(new Function)],r=new WeakMap,n=new WeakMap,o=new e.Ie,s=new WeakMap,c=new WeakMap,u=new WeakMap,i=new WeakMap,a=new WeakMap,l={mode:"es5",nativeNaming:!1,prototypeWritable:!1,defaultClassDescriptor:{writable:!0,enumerable:!1,configurable:!0},setClassDescriptors:!0};class p extends Error{}class f extends Error{}function _(e,t){let r=e.cachedPublicAccesses.get(t);return r||(P(e,t)?e.cachedPublicAccesses.set(t,r=h(t).publicToPrivate.get(t)):v(e,t)?e.cachedPublicAccesses.set(t,r=o.get(t)):e.cachedPublicAccesses.set(t,r=t),r)}function d(e,t){let r=e.cachedProtectedAccesses.get(t);if(r)return r;if(y(e,t))e.cachedProtectedAccesses.set(t,r=o.get(t)||w(t));else if(P(e,t)){const n=h(t).publicToPrivate.get(t);e.cachedProtectedAccesses.set(t,r=o.get(n)||w(n))}else v(e,t)&&e.cachedProtectedAccesses.set(t,r=t);if(!r)throw new f("invalid access of protected member");return r}function h(e){return s.get(e)}function w(e){const t=function(e){let t=null,n=e.__proto__;for(;n;){if(t=r.get(n),t)return t;n=n.__proto__}return t}(e),n=Object.create(t);return o.set(e,n),n}function b(e,t){let r=e.cachedPrivateAccesses.get(t);if(r)return r;if(y(e,t))e.cachedPrivateAccesses.set(t,r=e.publicToPrivate.get(t)||g(e,t));else if(v(e,t)){const n=o.get(t);e.cachedPrivateAccesses.set(t,r=e.publicToPrivate.get(n)||g(e,n))}else P(e,t)&&e.cachedPrivateAccesses.set(t,r=t);if(!r)throw new f("invalid access of private member");return r}function g(e,t){const r=Object.create(e.privatePrototype);return e.publicToPrivate.set(t,r),s.set(r,e),r}function y(t,r,n=!0){if(!n)return(0,e.nk)(r,t.publicPrototype);for(const n of Array.from(c.get(t.classBrand)))if((0,e.nk)(r,n))return!0;return!1}function v(t,r,n=!0){if(!n)return(0,e.nk)(r,t.protectedPrototype);for(const n of Array.from(u.get(t.classBrand)))if((0,e.nk)(r,n))return!0;return!1}function P(t,r,n=!0){if(!n)return(0,e.nk)(r,t.privatePrototype);for(const n of Array.from(i.get(t.classBrand)))if((0,e.nk)(r,n))return!0;return!1}function O(e,t,r){const{parentPublicPrototype:n,parentProtectedPrototype:o,parentPrivatePrototype:s}=t;if(y(t,r,!1))return m(r,n,e);if(v(t,r,!1))return m(r,o,e);if(P(t,r,!1))return m(r,s,e);throw new p("invalid super access")}function m(t,r,n){let o=n.get(t);if(!o){n.set(t,o=Object.create(r));const s=(0,e.yA)(r);let c=s.length;for(;c--;){const n=s[c];(0,e.q$)(o,n,{get:function(){let o;const s=(0,e.ld)(r,n);if(s&&(0,e.uh)(s)){const e=s.get;e&&(o=e.call(t))}else o=r[n];return o&&o.call&&"function"==typeof o&&(o=o.bind(t)),o},set:function(o){const s=(0,e.ld)(r,n);if(s&&(0,e.uh)(s)){const e=s.set;e&&(o=e.call(t,o))}else t[n]=o}},!0)}}return o}var S;!function(o){(o=o?{...l,...o}:l).defaultClassDescriptor={...l.defaultClassDescriptor,...o.defaultClassDescriptor};const{mode:s,prototypeWritable:p,setClassDescriptors:f,nativeNaming:h}=o;function w(...e){let t=!1;if("function"==typeof this&&(t=!0),e.length<=3){let r="",n=null,o=null;"string"==typeof e[0]?r=e[0]:"function"!=typeof e[0]&&"object"!=typeof e[0]||(n=e[0],o=e[1]),"function"!=typeof e[1]&&"object"!=typeof e[1]||(n=e[1],o=e[2]);const s=t?g.call(this,r,n,o):g(r,n,o);return s.extends=function(e,t,s){return t=t||n,s=s||o,g.call(e,r,t,s)},s}throw new TypeError("invalid args")}return w;function g(l,g,y){let v=this;if("string"!=typeof l)throw new TypeError("\n You must specify a string for the 'className' argument.\n ");let P=null;if(g&&"object"==typeof g)P=g;else if(!v&&(!g||"function"!=typeof g&&"object"!=typeof g)){let t;return h&&l?t=new Function(`return function ${l}() {}`)():(t=function(){},l&&(0,e.q$)(t,"name",{value:l})),t.prototype={__proto__:Object.prototype,constructor:t},(0,e.q$)(t,"subclass",{value:w,writable:!0,enumerable:!1,configurable:!1}),t}const m=y?void 0:new e.Ie;y&&(a.get(y)||a.set(y,new e.Ie));const S={className:l,get publicToPrivate(){return m||a.get(y)},classBrand:y=y||{brand:"lexical"},cachedPublicAccesses:new WeakMap,cachedProtectedAccesses:new WeakMap,cachedPrivateAccesses:new WeakMap},T=new WeakMap,k=O.bind(null,T,S),j=_.bind(null,S),A=d.bind(null,S),E=b.bind(null,S);if(j.prototype={},A.prototype={},E.prototype={},j.Public=j,j.Protected=A,j.Private=E,j.Super=k,A.Public=j,A.Protected=A,A.Private=E,A.Super=k,P=P||g&&g(j,A,E,k),P&&"object"!=typeof P&&"function"!=typeof P)throw new TypeError("\n The return value of a class definer function, if any, should be\n an object, or a class constructor.\n ");let N,C=null;"function"==typeof P&&(C=P,P=P.prototype,v=C.prototype.__proto__.constructor),P&&(N=P.static,delete P.static,"function"==typeof P.public&&(P.public=P.public(A,E)),"function"==typeof P.protected&&(P.protected=P.protected(j,E)),"function"==typeof P.private&&(P.private=P.private(j,A))),v=v||Object;const x=v.prototype,q=P&&P.public||P||Object.create(x);q.__proto__!==x&&(q.__proto__=x);const R=function(e){let t,n=e;for(;n&&!t;)t=r.get(n),n=n.__proto__;return t||{}}(x),M=P&&P.protected||Object.create(R);M.__proto__!==R&&(M.__proto__=R),r.set(q,M);const D=function(e){let t,r=e;for(;r&&!t;)t=n.get(r),r=r.__proto__;return t||{}}(x),I=P&&P.private||Object.create(D);if(I.__proto__!==D&&(I.__proto__=D),n.set(q,I),c.get(y)||c.set(y,new Set),u.get(y)||u.set(y,new Set),i.get(y)||i.set(y,new Set),c.get(y).add(q),u.get(y).add(M),i.get(y).add(I),S.publicPrototype=q,S.privatePrototype=I,S.protectedPrototype=M,S.parentPublicPrototype=x,S.parentProtectedPrototype=R,S.parentPrivatePrototype=D,(0,e.Gm)(j.prototype,q),(0,e.Gm)(A.prototype,M),(0,e.Gm)(E.prototype,I),P&&(delete P.public,delete P.protected,delete P.private,P!==q&&(0,e.Gm)(P,q)),C)return N&&(0,e.Gm)(N,C),C;const W=q.hasOwnProperty("constructor")?q.constructor:null;let L=null,$=null;if("es5"!==s)throw new TypeError("\n The lowclass \"mode\" option can only be 'es5' for now.\n ");if(L=function(){let e=null,t=null;return t=W||v,t!==Object&&(e=t.apply(this,arguments)),!e||"object"!=typeof e&&"function"!=typeof e?this:e},$=q,l)if(h){const t=(0,e.Sh)(L),r=L.prototype;L=new Function(" userConstructor, ParentClass ",`\n return function ${l}() { ${t} }\n `)(W,v),L.prototype=r}else(0,e.q$)(L,"name",{value:l});return W&&W.length&&(0,e.q$)(L,"length",{value:W.length}),L.__proto__=v,N&&(0,e.Gm)(N,L),(0,e.q$)(L,"subclass",{value:w,writable:!0,enumerable:!1,configurable:!1}),L.prototype=$,L.prototype.constructor=L,f&&((0,e.U8)(L,o,t),(0,e.q$)(L,"prototype",{writable:p}),(0,e.Md)(L.prototype,o),(0,e.Md)(M,o),(0,e.Md)(I,o)),S.constructor=L,L}}(),function(e){e.PROXIES_ON_INSTANCE_AND_PROTOTYPE="PROXIES_ON_INSTANCE_AND_PROTOTYPE",e.PROXIES_ON_PROTOTYPE="PROXIES_ON_PROTOTYPE",e.PROXY_AFTER_INSTANCE_AND_PROTOTYPE="PROXY_AFTER_INSTANCE_AND_PROTOTYPE"}(S||(S={})),S.PROXIES_ON_INSTANCE_AND_PROTOTYPE;new WeakMap;__webpack_require__(722);const T=(Symbol("solid-proxy"),Symbol("solid-dev-component"),{equals:(e,t)=>e===t});let k=H;const j={},A={owned:null,cleanups:null,context:null,owner:null},[E,N]=W(!1);var C=null;let x=null,q=null,R=null,M=null,D=null,I=0;function W(e,t){t=t?Object.assign({},T,t):T;const r={value:e,observers:null,observerSlots:null,pending:j,comparator:t.equals||void 0};return[U.bind(r),e=>("function"==typeof e&&(e=x&&x.running&&x.sources.has(r)?e(r.pending!==j?r.pending:r.tValue):e(r.pending!==j?r.pending:r.value)),Y(r,e))]}function L(e,t,r){r=r?Object.assign({},T,r):T;const n=G(e,t,!0,0);return n.pending=j,n.observers=null,n.observerSlots=null,n.comparator=r.equals||void 0,X(n),U.bind(n)}function $(e){if(R)return e();let t;const r=R=[];try{t=e()}finally{R=null}return z((()=>{for(let e=0;e<r.length;e+=1){const t=r[e];if(t.pending!==j){const e=t.pending;t.pending=j,Y(t,e)}}}),!1),t}function F(e){let t,r=q;return q=null,t=e(),q=r,t}function V(e){const t=L(e);return L((()=>ne(t())))}function U(){const e=x&&x.running;if(this.sources&&(!e&&this.state||e&&this.tState)){const t=M;M=null,!e&&1===this.state||e&&1===this.tState?X(this):Q(this),M=t}if(q){const e=this.observers?this.observers.length:0;q.sources?(q.sources.push(this),q.sourceSlots.push(e)):(q.sources=[this],q.sourceSlots=[e]),this.observers?(this.observers.push(q),this.observerSlots.push(q.sources.length-1)):(this.observers=[q],this.observerSlots=[q.sources.length-1])}return e&&x.sources.has(this)?this.tValue:this.value}function Y(e,t,r){if(e.comparator)if(x&&x.running&&x.sources.has(e)){if(e.comparator(e.tValue,t))return t}else if(e.comparator(e.value,t))return t;if(R)return e.pending===j&&R.push(e),e.pending=t,t;let n=!1;return x?(n=x.running,(n||!r&&x.sources.has(e))&&(x.sources.add(e),e.tValue=t),n||(e.value=t)):e.value=t,e.observers&&e.observers.length&&z((()=>{for(let t=0;t<e.observers.length;t+=1){const r=e.observers[t];n&&x.disposed.has(r)||(r.pure?M.push(r):D.push(r),r.observers&&(n&&!r.tState||!n&&!r.state)&&Z(r),n?r.tState=1:r.state=1)}if(M.length>1e6)throw M=[],new Error}),!1),t}function X(e){if(!e.fn)return;ee(e);const t=C,r=q,n=I;q=C=e,B(e,x&&x.running&&x.sources.has(e)?e.tValue:e.value,n),x&&!x.running&&x.sources.has(e)&&queueMicrotask((()=>{z((()=>{x&&(x.running=!0),B(e,e.tValue,n)}),!1)})),q=r,C=t}function B(e,t,r){let n;try{n=e.fn(t)}catch(e){re(e)}(!e.updatedAt||e.updatedAt<=r)&&(e.observers&&e.observers.length?Y(e,n,!0):x&&x.running&&e.pure?(x.sources.add(e),e.tValue=n):e.value=n,e.updatedAt=r)}function G(e,t,r,n=1,o){const s={fn:e,state:n,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:C,context:null,pure:r};return x&&x.running&&(s.state=0,s.tState=n),null===C||C!==A&&(x&&x.running&&C.pure?C.tOwned?C.tOwned.push(s):C.tOwned=[s]:C.owned?C.owned.push(s):C.owned=[s]),s}function K(e){const t=x&&x.running;if(!t&&1!==e.state)return e.state=0;if(t&&1!==e.tState)return e.tState=0;if(e.suspense&&F(e.suspense.inFallback))return e.suspense.effects.push(e);const r=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<I);){if(t&&x.disposed.has(e))return;(!t&&e.state||t&&e.tState)&&r.push(e)}for(let n=r.length-1;n>=0;n--){if(e=r[n],t){let t=e,o=r[n+1];for(;(t=t.owner)&&t!==o;)if(x.disposed.has(t))return}if(!t&&1===e.state||t&&1===e.tState)X(e);else if(!t&&2===e.state||t&&2===e.tState){const t=M;M=null,Q(e,r[0]),M=t}}}function z(e,t){if(M)return e();let r=!1;t||(M=[]),D?r=!0:D=[],I++;try{return e()}catch(e){re(e)}finally{!function(e){if(M&&(H(M),M=null),e)return;let t;if(x&&x.running){if(x.promises.size||x.queue.size)return x.running=!1,x.effects.push.apply(x.effects,D),D=null,void N(!0);const e=x.sources;t=x.resolve,D.forEach((e=>{"tState"in e&&(e.state=e.tState),delete e.tState})),x=null,$((()=>{e.forEach((e=>{if(e.value=e.tValue,e.owned)for(let t=0,r=e.owned.length;t<r;t++)ee(e.owned[t]);e.tOwned&&(e.owned=e.tOwned),delete e.tValue,delete e.tOwned,e.tState=0})),N(!1)}))}D.length?$((()=>{k(D),D=null})):D=null,t&&t()}(r)}}function H(e){for(let t=0;t<e.length;t++)K(e[t])}function J(e){let t,r=0;for(t=0;t<e.length;t++){const n=e[t];n.user?e[r++]=n:K(n)}const n=e.length;for(t=0;t<r;t++)K(e[t]);for(t=n;t<e.length;t++)K(e[t])}function Q(e,t){e.state=0;const r=x&&x.running;for(let n=0;n<e.sources.length;n+=1){const o=e.sources[n];o.sources&&(!r&&1===o.state||r&&1===o.tState?o!==t&&K(o):(!r&&2===o.state||r&&2===o.tState)&&Q(o,t))}}function Z(e){const t=x&&x.running;for(let r=0;r<e.observers.length;r+=1){const n=e.observers[r];(!t&&!n.state||t&&!n.tState)&&(t?n.tState=2:n.state=2,n.pure?M.push(n):D.push(n),n.observers&&Z(n))}}function ee(e){let t;if(e.sources)for(;e.sources.length;){const t=e.sources.pop(),r=e.sourceSlots.pop(),n=t.observers;if(n&&n.length){const e=n.pop(),o=t.observerSlots.pop();r<n.length&&(e.sourceSlots[o]=r,n[r]=e,t.observerSlots[r]=o)}}if(x&&x.running&&e.pure){if(e.tOwned){for(t=0;t<e.tOwned.length;t++)ee(e.tOwned[t]);delete e.tOwned}te(e,!0)}else if(e.owned){for(t=0;t<e.owned.length;t++)ee(e.owned[t]);e.owned=null}if(e.cleanups){for(t=0;t<e.cleanups.length;t++)e.cleanups[t]();e.cleanups=null}x&&x.running?e.tState=0:e.state=0,e.context=null}function te(e,t){if(t||(e.tState=0,x.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)te(e.owned[t])}function re(e){const t=null;if(!t)throw e;t.forEach((t=>t(e)))}function ne(e){if("function"==typeof e&&!e.length)return ne(e());if(Array.isArray(e)){const t=[];for(let r=0;r<e.length;r++){const n=ne(e[r]);Array.isArray(n)?t.push.apply(t,n):t.push(n)}return t}return e}function oe(e){return function(t){let r;return X(G((()=>r=F((()=>(C.context={[e]:t.value},V((()=>t.children)))))),n,!0,1)),r;var n}}function se(){return this()}function ce(e){return this(e)}function ue(e){const[t,r]=W(e,{equals:!1}),n=e=>void 0===e?t():(r((()=>e)),e),o=se.bind(n),s=ce.bind(n);return n.get=o,n.set=s,n[0]=o,n[1]=s,n[Symbol.iterator]=function*(){yield n[0],yield n[1]},n}function ie(e){let t;return function(e,t){t&&(C=t);const r=q,n=C,o=0===e.length?A:{owned:null,cleanups:null,context:null,owner:n};C=o,q=null;try{z((()=>e((()=>ee(o)))),!0)}finally{q=r,C=n}}((r=>{t=r,function(e,t,r){k=J;const n=G(e,t,!1,1);n.user=!0,D?D.push(n):queueMicrotask((()=>X(n)))}(e)})),t}function ae(e,t,r){const n=1===arguments.length&&"kind"in e;if(n){const t=e;return"class"===t.kind?{...t,finisher:pe}:{...t,finisher(e){var r,n;return le(e,t.key),null!==(n=null===(r=t.finisher)||void 0===r?void 0:r.call(t,e))&&void 0!==n?n:e}}}if(1===arguments.length&&"function"==typeof e)return pe(e);const o=e.constructor;le(o,t)}function le(e,t){e.reactiveProperties&&e.hasOwnProperty("reactiveProperties")||(e.reactiveProperties=[]),e.reactiveProperties.includes(t)||e.reactiveProperties.push(t)}function pe(e){var t;return e.hasOwnProperty("__isReactive__")?e:((t=class extends e{constructor(...t){super(...t),de(this,e)}}).__isReactive__=!0,t)}function fe(t,r){const n="v_"+r;let o,s,c,u=(0,e.ld)(t,r);if(u)if(o=u.get,s=u.set,o||s){if(!o||!s)return void console.warn('The `@reactive` decorator was used on an accessor named "'+r+'" which had a getter or a setter, but not both. Reactivity on accessors works only when accessors have both get and set. In this case the decorator does not do anything.');delete u.get,delete u.set}else{if(c=u.value,!u.writable)return void console.warn("The `@reactive` decorator was used on a property named "+r+" that is not writable. Reactivity is not enabled for non-writable properties.");delete u.value,delete u.writable}u={configurable:!0,enumerable:!0,...u,get:o?function(){return _e(this,n,c)(),o.call(this)}:function(){return _e(this,n,c)()},set:s?function(e){s.call(this,e),_e(this,n)(e),this.__propsSetAtLeastOnce__||(this.__propsSetAtLeastOnce__=new Set),this.__propsSetAtLeastOnce__.add(r)}:function(e){_e(this,n)(e),this.__propsSetAtLeastOnce__||(this.__propsSetAtLeastOnce__=new Set),this.__propsSetAtLeastOnce__.add(r)}},t.__reactifiedProps__||(t.__reactifiedProps__=new Set),t.__reactifiedProps__.add(r),Object.defineProperty(t,r,u)}function _e(e,t,r){let n=e[t];return n||(e[t]=n=ue(r),n)}function de(e,t){if(function(e){return"function"==typeof e}(t)){const r=t.reactiveProperties;Array.isArray(r)&&he(e,r)}else he(e,t);return e}function he(e,t){var r;for(const n of t){if(null===(r=e.__reactifiedProps__)||void 0===r?void 0:r.has(n))continue;const t=e[n];fe(e,n),e[n]=t}}Symbol("fallback"),function(e){const t=Symbol("context");oe(t)}();const we=F;function be(e,t,r,n){let o=!0;const s=ie((()=>{const t=e();o&&!(o=!1)?n(t):o=!0})),c=ie((()=>{const e=r();o&&!(o=!1)?t(e):o=!0}));return function(){s(),c()}}const ge="0.7.0"})();var __webpack_export_target__=LUME="undefined"==typeof LUME?{}:LUME;for(var i in __webpack_exports__)__webpack_export_target__[i]=__webpack_exports__[i];__webpack_exports__.__esModule&&Object.defineProperty(__webpack_export_target__,"__esModule",{value:!0})})(); | ||
//# sourceMappingURL=global.js.map |
@@ -1,3 +0,3 @@ | ||
declare const html: import("lit-dom-expressions").HTMLTag; | ||
export { html }; | ||
declare const _default: import("lit-dom-expressions").HTMLTag; | ||
export default _default; | ||
//# sourceMappingURL=html.d.ts.map |
@@ -1,15 +0,3 @@ | ||
var _a; | ||
import _html from 'solid-js/html/dist/html.js'; | ||
import { getGlobal } from './getGlobal.js'; | ||
const global = getGlobal(); | ||
if (global.SOLID_HTML) { | ||
console.warn(` | ||
Duplicates of a LUME library or dependency detected, conflict avoided. | ||
Having duplicates means things may not work as expected if different | ||
parts of the application are using different instances of something | ||
that should be a singleton. | ||
`); | ||
} | ||
const html = ((_a = global.SOLID_HTML) !== null && _a !== void 0 ? _a : (global.SOLID_HTML = _html)); | ||
export { html }; | ||
import html from 'solid-js/html/dist/html.js'; | ||
export default html; | ||
//# sourceMappingURL=html.js.map |
@@ -1,2 +0,2 @@ | ||
import * as SOLID from 'solid-js'; | ||
import { untrack as _untrack } from 'solid-js'; | ||
export interface VariableGetter<T> { | ||
@@ -31,6 +31,6 @@ (): T; | ||
export declare function reactify<C extends AnyClass>(obj: InstanceType<C>, ctor: C): typeof obj; | ||
export declare const untrack: typeof SOLID.untrack; | ||
export declare const untrack: typeof _untrack; | ||
export declare function circular<Type>(first: VariableGetter<Type>, setFirst: (v: Type) => void, second: VariableGetter<Type>, setSecond: (v: Type) => void): StopFunction; | ||
export declare const version = "0.6.1"; | ||
export declare const version = "0.7.0"; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,8 +0,3 @@ | ||
var _a; | ||
import * as SOLID from 'solid-js'; | ||
import { getInheritedDescriptor } from 'lowclass'; | ||
import { getGlobal } from './getGlobal.js'; | ||
const global = getGlobal(); | ||
const Solid = (_a = global.SOLID) !== null && _a !== void 0 ? _a : (global.SOLID = SOLID); | ||
const { createSignal, createEffect, createRoot, untrack: _untrack } = Solid; | ||
import { createSignal, createEffect, createRoot, untrack as _untrack } from 'solid-js'; | ||
function readVariable() { | ||
@@ -15,9 +10,9 @@ return this(); | ||
export function variable(value) { | ||
const [get, set] = createSignal(value); | ||
const variable = (value) => { | ||
const [get, set] = createSignal(value, { equals: false }); | ||
const variable = ((value) => { | ||
if (typeof value === 'undefined') | ||
return get(); | ||
set(value); | ||
set(() => value); | ||
return value; | ||
}; | ||
}); | ||
const getter = readVariable.bind(variable); | ||
@@ -206,3 +201,3 @@ const setter = writeVariable.bind(variable); | ||
} | ||
export const version = '0.6.1'; | ||
export const version = '0.7.0'; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@lume/variable", | ||
"version": "0.6.1", | ||
"version": "0.7.0", | ||
"description": "Create reactive variables and react their changes.", | ||
@@ -31,12 +31,11 @@ "author": "Joe Pea <joe@trusktr.io>", | ||
}, | ||
"COMMENT dependencies": "dom-expressions shouldn't be a direct dependency, but needs to be for now due to https://github.com/ryansolid/dom-expressions/issues/25", | ||
"dependencies": { | ||
"dom-expressions": "^0.24.0", | ||
"lit-dom-expressions": "^0.24.0", | ||
"lit-dom-expressions": "^0.31.0", | ||
"lowclass": "^4.9.4", | ||
"solid-js": "^0.24.4" | ||
"solid-js": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@lume/cli": "^0.3.0", | ||
"prettier": "^1.19.1" | ||
"@lume/cli": "^0.6.3", | ||
"prettier": "^2.0.0", | ||
"typescript": "4.4.3" | ||
}, | ||
@@ -43,0 +42,0 @@ "repository": { |
277
README.md
@@ -26,4 +26,4 @@ # @lume/variable | ||
The function (sometimes referred to as "an autorun" or "a computation") passed | ||
into autorun automatically re-runs every second due to `count` being | ||
The function passed into `autorun` (sometimes referred to as "an autorun" or "a | ||
computation") automatically re-runs every second due to `count` being | ||
incremented every second. | ||
@@ -34,7 +34,7 @@ | ||
This works because the `autorun` registers any reactive variables used inside | ||
the function as "dependencies", then any time a dependency in an autorun changes, | ||
the autorun re-runs the fun. | ||
Any reactive variables used inside an autorun function are registered (or | ||
"tracked") as "dependencies" by `autorun`, then any time those dependencies | ||
change, the autorun re-runs. | ||
This is called "dependency-tracking reactivity". | ||
We call this "dependency-tracking reactivity". | ||
@@ -46,3 +46,3 @@ An autorun with multiple variables accessed inside of it will re-run any time | ||
autorun(() => { | ||
// Log the variables every time any of them change. | ||
// Log these variables every time any of them change. | ||
console.log(firstName(), lastName(), age(), hairColor()) | ||
@@ -66,6 +66,7 @@ }) | ||
We can stop an `autorun` from re-running, if we need to, by calling its | ||
returned stop function (note, this is not necessary if we or the JS engine no | ||
longer have references to any of the `autorun`'s dependencies, and in that case | ||
everything will be garbage collected and will no longer re-run): | ||
If we wish to stop an `autorun` from re-running, we can call its returned stop | ||
function (note, this is not necessary if we or the JS engine no longer have | ||
references to any of the reactive variables that are dependencies of the | ||
`autorun`, and in that case everything will be garbage collected and will no | ||
longer re-run): | ||
@@ -90,16 +91,35 @@ ```js | ||
Learn how dependency-tracking reactivity makes your code cleaner and more | ||
concise compared to another more common pattern. | ||
<details><summary>Click to expand.</summary> | ||
<br /> | ||
Reactive computations (autoruns) are nice because it doesn't matter how we | ||
group variables (dependencies). What matters is we write what we care about | ||
(expressions using our variables) and don't have to think much about how to | ||
wire things up. | ||
group our variables (dependencies) within computations. What matters is we | ||
write what we care about (expressions using our variables) without having | ||
to think about how to wire reactivity up. | ||
For example, an event pattern, in contrast, can be more verbose and less | ||
convenient. Here's the same thing with some sort of event pattern: | ||
With an event-based pattern, in contrast, our code would be more verbose and less | ||
convenient. | ||
Looking back at our simple autorun for logging several variables, | ||
```js | ||
autorun(() => { | ||
// Log these variables every time any of them change. | ||
console.log(firstName(), lastName(), age(), hairColor()) | ||
}) | ||
``` | ||
we will see that writing the same thing with some sort of event pattern is more verbose: | ||
```js | ||
function log() { | ||
// Log the variables every time any of them change. | ||
// Log these variables every time any of them change. | ||
console.log(firstName.value, lastName.value, age.value, hairColor.value) | ||
} | ||
// We need to also register an event handler for each value we care to react to: | ||
firstName.on('change', log) | ||
@@ -111,11 +131,13 @@ lastName.on('change', log) | ||
It isn't as clean. With an event pattern we had to figure how to share the | ||
function to wire it up to each event emitter. | ||
With this hypothetical event pattern, we had to share our logging function with | ||
each event emitter in order to wire up the reactivity, having us write more | ||
code. Using `autorun` was simpler and less verbose. | ||
Let's say we want to add one more item to the console.log statement. Here is | ||
how it would be with an autorun: | ||
Now let's say we want to add one more item to the `console.log` statement. | ||
Here is what that looks like with an autorun: | ||
```js | ||
autorun(() => { | ||
// Log the variables every time any of them change. | ||
// Log these variables every time any of them change. | ||
console.log(firstName(), lastName(), age(), hairColor(), favoriteFood()) | ||
@@ -125,7 +147,7 @@ }) | ||
In contrast, here's how it would be with an event pattern: | ||
With an event emitter pattern, there is more to do: | ||
```js | ||
function log() { | ||
// Log the variables every time any of them change. | ||
// Log these variables every time any of them change. | ||
console.log(firstName.value, lastName.value, age.value, hairColor.value, favoriteFood.value) | ||
@@ -138,9 +160,10 @@ } | ||
hairColor.on('change', log) | ||
favoriteFood.on('change', log) // Don't forget to add this line too! | ||
favoriteFood.on('change', log) // <-------- Don't forget to add this line too! | ||
``` | ||
We can see the event pattern is more error prone (we can forget to register the | ||
event handler). | ||
Not only is the event pattern more verbose, but it is more error prone because | ||
we can forget to register the event handler: we had to modify the code in two | ||
places in order to add logging of the `favoriteFood` value. | ||
Here's where it gets interesting. | ||
Here's where it gets interesting! | ||
@@ -153,3 +176,3 @@ Reactive computations allow us to decouple the reactivity implementation from | ||
First, let's try a tried-and-true event pattern: | ||
First, let's use a familiar event pattern to show the less-than-ideal scenario first: | ||
@@ -159,10 +182,10 @@ ```js | ||
class EventEmitter { | ||
addEventHandler() { | ||
/*...imagination...*/ | ||
addEventHandler(eventName, fn) { | ||
/*...use imagination here...*/ | ||
} | ||
removeEventHandler() { | ||
/*...imagination...*/ | ||
removeEventHandler(eventName, fn) { | ||
/*...use imagination here...*/ | ||
} | ||
emit() { | ||
/*...imagination...*/ | ||
emit(eventName, data) { | ||
/*...use imagination here...*/ | ||
} | ||
@@ -172,3 +195,5 @@ } | ||
Now let's use it to make a class whose poperties we can observe the changes of. | ||
Now let's use `EventEmitter` to make a class whose poperties we can observe the | ||
changes of. In the following class, we'll make getter/setter pairs so that any | ||
time a setter is used to set a value, it will emit a "change" event. | ||
@@ -178,3 +203,3 @@ ```js | ||
// We have to extend from EventEmitter (or we could compose it, but the amount | ||
// We need to extend from EventEmitter (or compose it inside the class, but the amount | ||
// of code would be similar). | ||
@@ -188,3 +213,3 @@ class Martian extends EventEmitter { | ||
this._firstName = v | ||
this.emit('change', 'firstName') | ||
this.emit('change', 'firstName') // Emit any time the property is set. | ||
} | ||
@@ -232,3 +257,3 @@ | ||
Now let's react to changes in three of the five properties of a `Martian`: | ||
The following shows how we would react to changes in three of the five properties of a `Martian`: | ||
@@ -238,3 +263,3 @@ ```js | ||
if (['firstName', 'hairColor', 'favoriteFood'].includes(property)) { | ||
// Log the three variables every time any of the three change. | ||
// Log these three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
@@ -245,5 +270,6 @@ } | ||
It works, but we can do better. | ||
It works, but we can still make this better while still using the same event | ||
pattern. | ||
Let's say we want to make it more performant: instead of all event handlers | ||
Let's say we want to make it more efficient: instead of all event handlers | ||
being subscribed to a single `change` event (because Martians probably have | ||
@@ -264,3 +290,3 @@ lots and lots of properties) and filtering for the properties we care to | ||
this._firstName = v | ||
this.emit('change:firstName') | ||
this.emit('change:firstName') // Emit a specific event for the firstName property. | ||
} | ||
@@ -274,3 +300,3 @@ | ||
this._lastName = v | ||
this.emit('change:lastName') | ||
this.emit('change:lastName') // Similar for the lastName property. | ||
} | ||
@@ -284,3 +310,3 @@ | ||
this._age = v | ||
this.emit('change:age') | ||
this.emit('change:age') // And so on. | ||
} | ||
@@ -306,7 +332,11 @@ | ||
} | ||
``` | ||
We can now avoid the overhead of the array filtering we previously had with the `.includes` check: | ||
```js | ||
const martian = new Martian() | ||
const onChange = () => { | ||
// Log the three variables every time any of the three change. | ||
// Log these three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
@@ -324,6 +354,7 @@ } | ||
We can still do better! | ||
We can still do better with the event pattern! (Spoiler: it won't get as clean | ||
as with `autorun` below, which we'll get to next.) | ||
We can come up with an automatic event-wiring mechanism. It may be something | ||
like the following: | ||
We can come up with an automatic event-wiring mechanism. It could look | ||
something like the following: | ||
@@ -333,4 +364,4 @@ ```js | ||
// Imagine `WithEventProps` wires up events for the specified properties. | ||
// Imagine `WithEventProps` wires up events for any properties specified in a | ||
// static `eventProps` field: | ||
const Martian = WithEventProps( | ||
@@ -348,6 +379,8 @@ class Martian extends EventEmitter { | ||
// Listen to events as before: | ||
const martian = new Martian() | ||
const onChange = () => { | ||
// Log the three variables every time any of the three change. | ||
// Log these three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
@@ -361,6 +394,8 @@ } | ||
That is a lot shorter already, but we can still do better! | ||
That is a lot shorter already, but we can still do better! (It still won't be | ||
as simple as with dependency-tracking reactivity, which is coming up.) | ||
We can make it more | ||
[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) using decorators: | ||
We can make the event pattern more | ||
[DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) ("Don't Repeat | ||
Yourself") using decorators to allow us to be less repetitive: | ||
@@ -370,4 +405,3 @@ ```js | ||
// Imagine `emits` wires up an event for each decorated property. | ||
// Imagine this `@emits` decorator wires up an event for each decorated property. | ||
@emits | ||
@@ -382,6 +416,8 @@ class Martian extends EventEmitter { | ||
// Listen to events as before: | ||
const martian = new Martian() | ||
const onChange = () => { | ||
// Log the three variables every time any of the three change. | ||
// Log these three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
@@ -396,7 +432,8 @@ } | ||
This is better than before because now we didn't have to repeat the property | ||
names twice. Instead we labeled them all with a decorator. | ||
names twice, reducing the chance of errors from mismatched names. Instead we | ||
labeled them all with a decorator. | ||
--- | ||
We can still do better! | ||
We can still do better! 🤯 | ||
@@ -406,4 +443,5 @@ With LUME's reactive variables we can further decouple a class's implementation from | ||
We can re-write the previous non-decorator example so that our class does not | ||
need to extend from a particular base class to have reactivity: | ||
We can re-write the previous non-decorator example (and still not using | ||
decorators) so that our class does not need to extend from a particular base | ||
class to inherit a reactivity implementation: | ||
@@ -413,2 +451,4 @@ ```js | ||
// This class does not extend from any base class. Instead, reactive variables | ||
// are defined inside the class. | ||
class Martian { | ||
@@ -425,3 +465,3 @@ firstName = variable('') | ||
autorun(() => { | ||
// Log the three variables every time any of the three change. | ||
// Log these three variables every time any of the three change. | ||
console.log(martian.firstName(), martian.hairColor(), martian.favoriteFood()) | ||
@@ -432,6 +472,6 @@ }) | ||
This is better than before because the reactivity is not an inherent part of | ||
our particular class. We can use the reactivity in our `Matrian` class, or in | ||
any other class, without having class inheritance requirements, and other | ||
developers do not have to make subclasses of our classes just to have | ||
reactivity. | ||
our class hierarchy, instead being a feature of the reactive variables. We can | ||
use this form of reactivity in our `Matrian` class or in any other class | ||
without having class inheritance requirements, and other developers do not have | ||
to make subclasses of our classes just to have reactivity. | ||
@@ -444,3 +484,3 @@ Plus, we did not need to subscribe an event listener to specific | ||
...We can still do better!... | ||
...We can still do better! 🤯... | ||
@@ -452,2 +492,3 @@ Using LUME's decorators, the experience is as good as it gets: | ||
// Now we mark the class and properties as reactive with the `@reactive` decorator. | ||
@reactive | ||
@@ -460,2 +501,5 @@ class Martian { | ||
@reactive favoriteFood = '' | ||
// This property is not reactive, as it is not marked with `@reactive`. | ||
cryogenesis = false | ||
} | ||
@@ -466,4 +510,6 @@ | ||
autorun(() => { | ||
// Log the three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
// Log these four variables every time any of the first three change. Note | ||
// that this will not automatically rerun when cryogenesis changes because cryogenesis | ||
// is not reactive. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood, martian.cryogenesis) | ||
}) | ||
@@ -473,67 +519,62 @@ ``` | ||
This is better than before because now we can use the properties like regular | ||
properties instead of having to call them to read their values (like we had to | ||
in the previous example). We can write `this.age` instead of `this.age()` for | ||
reading a value, and `this.age = 10` instead of `this.age(10)` for writing a | ||
value. | ||
properties instead of having to call them as functions to read their values | ||
like we had to in the prior example. We can write `this.age` instead of | ||
`this.age()` for reading a value, and `this.age = 10` instead of `this.age(10)` | ||
for writing a value. | ||
It can not get better than this. Well, it actually can, see the API section | ||
(coming soon). | ||
Dependency-tracking reactivity makes things nice and concise. | ||
(And actually, things could possibly get simpler if JavaScript (EcmasScript) | ||
were to adopt dependency-tracking reactive computing into the language itself, | ||
but I'll leave that as an exercise for our imagination.) | ||
</details> | ||
<details><summary>Ok I couldn't help it. A built-in language feature might look like follows. (Click to open.)</summary> | ||
## API | ||
Perhaps using built-in decorators and an `autorun` keyword: | ||
### `const myVar = variable(value)` | ||
```js | ||
class Martian { | ||
@reactive firstName = '' | ||
@reactive lastName = '' | ||
@reactive age = 0 | ||
@reactive hairColor = '' | ||
@reactive favoriteFood = '' | ||
} | ||
Creates a reactive variable with an initial `value`. The return value is a function that | ||
const martian = new Martian() | ||
- when called with no argument, returns the reactive variable's value, f.e. `myVar()`. | ||
- when called with an argument, sets the reactive variable's value, f.e. `myVar(newValue)`. | ||
autorun { | ||
// Log the three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
} | ||
```js | ||
const foo = variable(false) | ||
const bar = variable(123) | ||
``` | ||
Or maybe without decorators, only keywords: | ||
### `const stop = autorun(fn)` | ||
```js | ||
class Martian { | ||
reactive firstName = '' | ||
reactive lastName = '' | ||
reactive age = 0 | ||
reactive hairColor = '' | ||
reactive favoriteFood = '' | ||
} | ||
Takes a function `fn` and immediately runs it, while tracking any reactive | ||
variables that were used inside of it as dependencies. Any time those variables | ||
change, `fn` is executed again. Each time `fn` re-runs, dependencies are | ||
re-tracked, which means that conditional branching within `fn` can change which | ||
dependencies will re-run `fn` next time. | ||
const martian = new Martian() | ||
`autorun` returns a `stop` function that when called causes `fn` never to be | ||
automatically executed again. This is useful when you no longer care about some | ||
variables. | ||
autorun { | ||
// Log the three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
} | ||
```js | ||
autorun(() => { | ||
if (foo()) doSomethingWith(bar()) | ||
}) | ||
``` | ||
Maybe even we get options to make an autorun synchronous or deferred. If the | ||
previous example was synchronous, then the next one defers re-running to the | ||
next microtask (so that we get a single batched re-run instead of one per | ||
variable change, which has better performance at the cost of making the code | ||
harder to understand or allowing race conditions): | ||
### `@reactive` | ||
A decorator that makes properties in a class reactive. Besides decorating | ||
properties with the decorator, also be sure to decorate the class that shall | ||
have reactive variable with the same decorator as well. | ||
```js | ||
defer autorun { | ||
// Log the three variables every time any of the three change. | ||
console.log(martian.firstName, martian.hairColor, martian.favoriteFood) | ||
@reactive | ||
class Car { | ||
@reactive engineOn = false | ||
@reactive sound = 'vroom' | ||
} | ||
const car = new Car() | ||
autorun(() => { | ||
// Any time the car turns on, it makes a sound. | ||
if (car.engineOn) console.log(car.sound) | ||
}) | ||
``` | ||
</details> |
@@ -1,29 +0,6 @@ | ||
// This import should live in @lume/element, but doing that causes Solid to exist | ||
// more than once in node_modules, which causes duplicate-module issues. So | ||
// because we know @lume/element depends on @lume/variable, we stuck this here | ||
// to avoid the duplicate-module issues. | ||
// @ts-ignore | ||
import _html from 'solid-js/html/dist/html.js' | ||
import type __html from 'solid-js/html' | ||
// @ts-expect-error TODO fix missing types upstream | ||
import html from 'solid-js/html/dist/html.js' | ||
import {getGlobal} from './getGlobal.js' | ||
import type HTMLTag from 'solid-js/html' | ||
const global = getGlobal() as any | ||
if (global.SOLID_HTML) { | ||
// TODO Add a link to a documentation page with more details. | ||
console.warn(` | ||
Duplicates of a LUME library or dependency detected, conflict avoided. | ||
Having duplicates means things may not work as expected if different | ||
parts of the application are using different instances of something | ||
that should be a singleton. | ||
`) | ||
} | ||
// Another strategy to avoid duplicate modules is to store the improted libs on | ||
// a global var. If there are any duplicate modules, they will use the lib that | ||
// is stored on the global var instead of using a lib that is encpsulated in | ||
// (and unique to) their ES Module imports. | ||
const html = (global.SOLID_HTML ?? (global.SOLID_HTML = _html)) as typeof __html | ||
export {html} | ||
export default html as typeof HTMLTag |
@@ -1,9 +0,4 @@ | ||
import * as SOLID from 'solid-js' | ||
import {getInheritedDescriptor} from 'lowclass' | ||
import {getGlobal} from './getGlobal.js' | ||
import {createSignal, createEffect, createRoot, untrack as _untrack} from 'solid-js' | ||
const global = getGlobal() as any | ||
const Solid: typeof SOLID = global.SOLID ?? (global.SOLID = SOLID) | ||
const {createSignal, createEffect, createRoot, untrack: _untrack} = Solid | ||
export interface VariableGetter<T> { | ||
@@ -53,9 +48,9 @@ (): T | ||
export function variable<T>(value: T) { | ||
const [get, set] = createSignal<T>(value) | ||
const [get, set] = createSignal<T>(value, {equals: false}) | ||
const variable: Variable<T> = (value?: T) => { | ||
const variable = ((value?: T) => { | ||
if (typeof value === 'undefined') return get() | ||
set(value) | ||
set(() => value) | ||
return value | ||
} | ||
}) as Variable<T> | ||
@@ -73,3 +68,3 @@ // WTF TypeScript, why do I need `any` here. | ||
variable[1] = setter | ||
variable[Symbol.iterator] = function*() { | ||
variable[Symbol.iterator] = function* () { | ||
yield variable[0] | ||
@@ -227,3 +222,3 @@ yield variable[1] | ||
get: originalGet | ||
? function(this: any): unknown { | ||
? function (this: any): unknown { | ||
// track reactivity, but get the value from the original getter | ||
@@ -240,3 +235,3 @@ | ||
} | ||
: function(this: any): unknown { | ||
: function (this: any): unknown { | ||
const v = __getReactiveVar(this, vName, initialValue) | ||
@@ -246,3 +241,3 @@ return v() | ||
set: originalSet | ||
? function(this: any, newValue: unknown) { | ||
? function (this: any, newValue: unknown) { | ||
originalSet!.call(this, newValue) | ||
@@ -261,3 +256,3 @@ | ||
} | ||
: function(this: any, newValue: unknown) { | ||
: function (this: any, newValue: unknown) { | ||
const v = __getReactiveVar(this, vName) | ||
@@ -386,2 +381,2 @@ v(newValue) | ||
export const version = '0.6.1' | ||
export const version = '0.7.0' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
545
231085
3
20
647
+ Addedcsstype@3.1.3(transitive)
+ Addedlit-dom-expressions@0.31.13(transitive)
+ Addedseroval@1.1.1(transitive)
+ Addedseroval-plugins@1.1.1(transitive)
+ Addedsolid-js@1.9.3(transitive)
- Removeddom-expressions@^0.24.0
- Removedbabel-plugin-transform-rename-import@2.3.0(transitive)
- Removeddom-expressions@0.24.7(transitive)
- Removedlit-dom-expressions@0.24.7(transitive)
- Removedsolid-js@0.24.16(transitive)
Updatedlit-dom-expressions@^0.31.0
Updatedsolid-js@^1.0.0