xote 4.0.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -16
- package/dist/xote.cjs +1 -1
- package/dist/xote.mjs +451 -432
- package/dist/xote.umd.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
# xote
|
|
1
|
+
# xote
|
|
2
2
|

|
|
3
3
|

|
|
4
4
|

|
|
5
5
|
|
|
6
|
-
Xote is a lightweight
|
|
6
|
+
Xote is a lightweight UI library for ReScript that combines fine-grained reactivity with a minimal component system. Built on [rescript-signals](https://github.com/pedrobslisboa/rescript-signals), it provides declarative components, JSX support, and signal-based routing for building reactive web applications.
|
|
7
7
|
|
|
8
8
|
## Features
|
|
9
9
|
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
- Signal-based router: SPA navigation with pattern matching and dynamic parameters
|
|
10
|
+
- **Reactive Components**: Declarative UI building with JSX support and direct DOM updates
|
|
11
|
+
- **Signal-based Reactivity**: Powered by [rescript-signals](https://github.com/pedrobslisboa/rescript-signals) for automatic dependency tracking
|
|
12
|
+
- **Fine-grained Updates**: Direct DOM manipulation without virtual DOM diffing
|
|
13
|
+
- **Signal-based Router**: SPA navigation with pattern matching and dynamic parameters
|
|
14
|
+
- **Lightweight**: Minimal runtime footprint (~18kb minified)
|
|
15
|
+
- **Type-safe**: Full ReScript type safety throughout
|
|
17
16
|
|
|
18
17
|
## Getting Started
|
|
19
18
|
|
|
@@ -35,9 +34,17 @@ Then, add it to your ReScript project’s dependencies in `rescript.json`:
|
|
|
35
34
|
}
|
|
36
35
|
```
|
|
37
36
|
|
|
38
|
-
##
|
|
37
|
+
## What Makes Xote Unique?
|
|
39
38
|
|
|
40
|
-
Xote
|
|
39
|
+
While Xote uses **rescript-signals** for reactive primitives (Signal, Computed, Effect), it adds:
|
|
40
|
+
|
|
41
|
+
- **Component System**: A minimal but powerful component model with JSX support
|
|
42
|
+
- **Direct DOM Updates**: Fine-grained reactivity that updates DOM elements directly, no virtual DOM
|
|
43
|
+
- **Signal-based Router**: Client-side routing with pattern matching and reactive location state
|
|
44
|
+
- **Reactive Attributes**: Support for static, signal-based, and computed attributes on elements
|
|
45
|
+
- **Automatic Cleanup**: Effect disposal and memory management built into the component lifecycle
|
|
46
|
+
|
|
47
|
+
Xote focuses on clarity, control, and performance. The goal is to offer precise, fine-grained updates and predictable behavior with minimal abstractions.
|
|
41
48
|
|
|
42
49
|
### Quick Example
|
|
43
50
|
|
|
@@ -73,11 +80,18 @@ Component.mountById(<App />, "app")
|
|
|
73
80
|
|
|
74
81
|
## Core Concepts
|
|
75
82
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
- **
|
|
79
|
-
- **
|
|
80
|
-
- **
|
|
83
|
+
### Reactive Primitives (from rescript-signals)
|
|
84
|
+
|
|
85
|
+
- **Signal**: Reactive state container - `Signal.make(value)`
|
|
86
|
+
- **Computed**: Derived reactive value that updates automatically - `Computed.make(() => ...)`
|
|
87
|
+
- **Effect**: Side-effect functions that re-run when dependencies change - `Effect.run(() => ...)`
|
|
88
|
+
|
|
89
|
+
All reactive primitives feature automatic dependency tracking - no manual subscriptions needed.
|
|
90
|
+
|
|
91
|
+
### Xote Features
|
|
92
|
+
|
|
93
|
+
- **Component**: Declarative UI builder with JSX syntax and function-based APIs
|
|
94
|
+
- **Router**: Signal-based navigation for SPAs with pattern matching and dynamic routes
|
|
81
95
|
|
|
82
96
|
### Component Features
|
|
83
97
|
|
package/dist/xote.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let w={contents:0};function j(){return w.contents=w.contents+1|0,w.contents}function te(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function ne(e){if(e!=null)return te(e)}function L(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function V(e,t){return e!==void 0?L(e):t}let F=(function(e,t){for(var n in e)t(n)});function C(e,t){if(e===t)return!0;let n=typeof e;if(n==="string"||n==="number"||n==="bigint"||n==="boolean"||n==="undefined"||e===null)return!1;let r=typeof t;if(n==="function"||r==="function")throw{RE_EXN_ID:"Invalid_argument",_1:"equal: functional value",Error:new Error};if(r==="number"||r==="bigint"||r==="undefined"||t===null)return!1;let l=e.TAG,o=t.TAG;if(l!==o)return!1;let i=e.length|0,u=t.length|0;if(i===u)if(Array.isArray(e)){let c=0;for(;;){let s=c;if(s===i)return!0;if(!C(e[s],t[s]))return!1;c=s+1|0}}else{if(e instanceof Date&&t instanceof Date)return!(e>t||e<t);{let c={contents:!0},s=f=>{if(!Object.prototype.hasOwnProperty.call(t,f)){c.contents=!1;return}},h=f=>{if(!Object.prototype.hasOwnProperty.call(e,f)||!C(t[f],e[f])){c.contents=!1;return}};return F(e,s),c.contents&&F(t,h),c.contents}}else return!1}let p=new Map,E=new Map,M=new Map,d={contents:void 0},O=new Set,N={contents:!1},S={contents:!1};function P(e){if(E.get(e)===void 0){E.set(e,new Set);return}}function re(e,t){P(t);let n=d.contents,r=p.get(e);if(n===void 0||r===void 0||n!==e||r.deps.has(t))return;r.deps.add(t);let l=E.get(t);if(l!==void 0){l.add(e);return}}function z(e){let t=M.get(e);if(t===void 0)return;M.delete(e);let n=p.get(t);if(n!==void 0){y(n),p.delete(t);return}}function y(e){e.deps.forEach(t=>{let n=E.get(t);if(n!==void 0)return n.delete(e.id),n.size===0&&!S.contents?z(t):void 0}),e.deps.clear()}function D(e){if(typeof e.kind=="object"){let r={contents:0};return e.deps.forEach(l=>{let o=E.get(l);if(o!==void 0){o.forEach(i=>{if(i===e.id)return;let u=p.get(i);if(u===void 0)return;if(typeof u.kind=="object"&&u.level>r.contents){r.contents=u.level;return}});return}}),r.contents+1|0}let n={contents:0};return e.deps.forEach(r=>{let l=E.get(r);if(l!==void 0){l.forEach(o=>{let i=p.get(o);if(i!==void 0&&i.level>n.contents){n.contents=i.level;return}});return}}),n.contents+1e3|0}function le(){for(;O.size>0;){let e=Array.from(O.values());O.clear(),e.sort((t,n)=>{let r=p.get(t),l=p.get(n);return r!==void 0?l!==void 0?r.level-l.level|0:-1:l!==void 0?1:0}),e.forEach(t=>{let n=p.get(t);if(n===void 0)return;S.contents=!0,y(n);let r=d.contents;d.contents=t;try{n.run(),S.contents=!1}catch(l){throw d.contents=r,S.contents=!1,l}d.contents=r,n.level=D(n)})}}function ue(e){P(e);let t=E.get(e);if(t!==void 0){if(t.forEach(n=>{O.add(n)}),N.contents)return;N.contents=!0,le(),N.contents=!1;return}}function q(e,t,n){let r=j();return P(r),{id:r,value:{contents:e},version:{contents:0},equals:V(n,C),name:t}}function oe(e){let t=d.contents;return t!==void 0&&re(t,e.id),e.value.contents}function ie(e){return e.value.contents}function I(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,ue(e.id)}function ce(e,t){I(e,t(e.value.contents))}let ae,se;const de=Object.freeze(Object.defineProperty({__proto__:null,Id:ae,Scheduler:se,get:oe,make:q,peek:ie,set:I,update:ce},Symbol.toStringTag,{value:"Module"}));function X(e,t,n){return{id:e,kind:t,run:n,deps:new Set,level:0}}function fe(e){let t=j(),n={contents:void 0},l=X(t,"Effect",()=>{let u=n.contents;u!==void 0&&u(),n.contents=e()});p.set(t,l),S.contents=!0,y(l);let o=d.contents;d.contents=t;try{l.run(),S.contents=!1}catch(u){throw d.contents=o,S.contents=!1,u}return d.contents=o,l.level=D(l),{dispose:()=>{let u=p.get(t);if(u===void 0)return;let c=n.contents;c!==void 0&&c(),y(u),p.delete(t)}}}let pe,_e,he;const me=Object.freeze(Object.defineProperty({__proto__:null,Id:pe,Observer:_e,Scheduler:he,run:fe},Symbol.toStringTag,{value:"Module"}));function Se(e){let t=q(void 0,void 0,void 0),n=j(),r=()=>{let i=e();I(t,i)},l=X(n,{NAME:"Computed",VAL:t.id},r);p.set(n,l),S.contents=!0,y(l);let o=d.contents;d.contents=n;try{l.run(),S.contents=!1}catch(i){throw d.contents=o,S.contents=!1,i}return d.contents=o,l.level=D(l),M.set(t.id,n),t}function ge(e){z(e.id)}let Ee,ve,be,Te;const ye=Object.freeze(Object.defineProperty({__proto__:null,Id:Ee,Observer:be,Scheduler:Te,Signal:ve,dispose:ge,make:Se},Symbol.toStringTag,{value:"Module"}));let a=de,m=ye,g=me;function Ae(e,t){let n=e.length,r=new Array(n),l=0;for(let o=0;o<n;++o){let i=e[o],u=t(i);u!==void 0&&(r[l]=L(u),l=l+1|0)}return r.length=l,r}function Oe(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}function W(e){return Ae(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function H(e,t){let n=t.split("/").filter(o=>o!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((o,i)=>{let u=n[i];return o.TAG==="Static"?u===o._0:(r[o._0]=u,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function G(e,t){return H(W(e),t)}const ke=Object.freeze(Object.defineProperty({__proto__:null,match:G,matchPath:H,parsePattern:W},Symbol.toStringTag,{value:"Module"}));function U(e,t){return[e,{TAG:"Static",_0:t}]}function we(e,t){return[e,{TAG:"SignalValue",_0:t}]}function Ne(e,t){return[e,{TAG:"Compute",_0:t}]}function Ce(e){return{TAG:"Text",_0:e}}function Me(e){return{TAG:"SignalText",_0:m.make(e)}}function $e(e){return{TAG:"Fragment",_0:e}}function R(e){return{TAG:"SignalFragment",_0:e}}function je(e,t){return{TAG:"SignalFragment",_0:m.make(()=>a.get(e).map(t))}}function _(e,t,n,r,l){let o=t!==void 0?t:[].map(c=>c),i=n!==void 0?n:[].map(c=>c),u=r!==void 0?r:[].map(c=>c);return{TAG:"Element",tag:e,attrs:o,events:i,children:u}}function Pe(e,t,n,r){return _("div",e,t,n)}function De(e,t,n,r){return _("span",e,t,n)}function Ie(e,t,n,r){return _("button",e,t,n)}function Ge(e,t,n){return _("input",e,t,void 0)}function Re(e,t,n,r){return _("h1",e,t,n)}function xe(e,t,n,r){return _("h2",e,t,n)}function Be(e,t,n,r){return _("h3",e,t,n)}function Fe(e,t,n,r){return _("p",e,t,n)}function Le(e,t,n,r){return _("ul",e,t,n)}function Ve(e,t,n,r){return _("li",e,t,n)}function J(e,t,n,r){return _("a",e,t,n)}function b(e,t){let n=V(ne(e.__xote_disposers),[]);e.__xote_disposers=n.concat([t])}function x(e){let t=e.__xote_disposers;t!=null&&(t.forEach(r=>r.dispose()),e.__xote_disposers=[]),Array.from(e.childNodes||[]).forEach(x)}function T(e){switch(e.TAG){case"Element":let t=document.createElement(e.tag);return e.attrs.forEach(s=>{let h=s[1],f=s[0];switch(h.TAG){case"Static":t.setAttribute(f,h._0);return;case"SignalValue":let A=h._0;t.setAttribute(f,a.peek(A));let Y=g.run(()=>{let k=a.get(A);t.setAttribute(f,k)});return b(t,Y);case"Compute":let Z=h._0,B=m.make(()=>Z());t.setAttribute(f,a.peek(B));let ee=g.run(()=>{let k=a.get(B);t.setAttribute(f,k)});return b(t,ee)}}),e.events.forEach(s=>{t.addEventListener(s[0],s[1])}),e.children.forEach(s=>{let h=T(s);t.appendChild(h)}),t;case"Text":return document.createTextNode(e._0);case"SignalText":let n=e._0,r=document.createTextNode(a.peek(n)),l=g.run(()=>{let s=a.get(n);r.textContent=s});return b(r,l),r;case"Fragment":let o=document.createDocumentFragment();return e._0.forEach(s=>{let h=T(s);o.appendChild(h)}),o;case"SignalFragment":let i=e._0,u=document.createElement("div");u.setAttribute("data-signal-fragment","true"),u.setAttribute("style","display: contents");let c=g.run(()=>{let s=a.get(i);Array.from(u.childNodes||[]).forEach(x),u.innerHTML="",s.forEach(f=>{let A=T(f);u.appendChild(A)})});return b(u,c),u}}function K(e,t){let n=T(e);t.appendChild(n)}function ze(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return K(e,n)}const qe=Object.freeze(Object.defineProperty({__proto__:null,a:J,addDisposer:b,attr:U,button:Ie,computedAttr:Ne,disposeElement:x,div:Pe,element:_,fragment:$e,h1:Re,h2:xe,h3:Be,input:Ge,li:Ve,list:je,mount:K,mountById:ze,p:Fe,render:T,signalAttr:we,signalFragment:R,span:De,text:Ce,textSignal:Me,ul:Le},Symbol.toStringTag,{value:"Module"}));let v=a.make({pathname:"/",search:"",hash:""},void 0,void 0);function $(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Xe(){a.set(v,$());let e=t=>a.set(v,$());window.addEventListener("popstate",e)}function Q(e,t,n,r){let l=t!==void 0?t:"",o=n!==void 0?n:"",i={pathname:e,search:l,hash:o},u=e+l+o,c={};window.history.pushState(c,"",u),a.set(v,i)}function We(e,t,n,r){let l=t!==void 0?t:"",o=n!==void 0?n:"",i={pathname:e,search:l,hash:o},u=e+l+o,c={};window.history.replaceState(c,"",u),a.set(v,i)}function He(e,t){return R(m.make(()=>{let n=a.get(v),r=G(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]}))}function Ue(e){return R(m.make(()=>{let t=a.get(v),n=Oe(e,r=>{let l=G(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]}))}function Je(e,t,n,r){let l=t!==void 0?t:[],o=n!==void 0?n:[],i=u=>{u.preventDefault(),Q(e,void 0,void 0)};return J(l.concat([U("href",e)]),[["click",i]],o)}let Ke,Qe;const Ye=Object.freeze(Object.defineProperty({__proto__:null,Component:Ke,Route:Qe,getCurrentLocation:$,init:Xe,link:Je,location:v,push:Q,replace:We,route:He,routes:Ue},Symbol.toStringTag,{value:"Module"}));let Ze=a.Id,et=a.Scheduler,tt=a.make,nt=a.get,rt=a.peek,lt=a.set,ut=a.update,ot={Id:Ze,Scheduler:et,make:tt,get:nt,peek:rt,set:lt,update:ut},it=m.Id,ct=m.Signal,at=m.Observer,st=m.Scheduler,dt=m.make,ft=m.dispose,pt={Id:it,Signal:ct,Observer:at,Scheduler:st,make:dt,dispose:ft},_t=g.Id,ht=g.Observer,mt=g.Scheduler,St=g.run,gt={Id:_t,Observer:ht,Scheduler:mt,run:St},Et=qe,vt=ke,bt=Ye;exports.Component=Et;exports.Computed=pt;exports.Effect=gt;exports.Route=vt;exports.Router=bt;exports.Signal=ot;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let $={contents:0};function j(){return $.contents=$.contents+1|0,$.contents}function re(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function ue(e){if(e!=null)return re(e)}function F(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function I(e,t){return e!==void 0?F(e):t}function le(e,t,n){return e.reduce(n,t)}function ie(e,t){let n=e.length,r=new Array(n),u=0;for(let l=0;l<n;++l){let c=e[l],i=t(c);i!==void 0&&(r[u]=F(i),u=u+1|0)}return r.length=u,r}function oe(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let u=t(e[r]);if(u!==void 0)return u;n=r+1|0}}let s=new Map,y=new Map,w=new Map,a={contents:void 0},b=new Set,S={contents:!1},m={contents:!1};function P(e){if(y.get(e)===void 0){y.set(e,new Set);return}}function ce(e,t){let n=y.get(e);if(n!==void 0){n.forEach(t);return}}function ae(e,t){let n=y.get(e);if(n!==void 0){n.add(t);return}}function de(e,t){let n=y.get(e);if(n!==void 0){n.delete(t);return}}function se(e){return Array.from(I(y.get(e),new Set).values())}function L(e,t){let n=a.contents;a.contents=e;try{let r=t();return a.contents=n,r}catch(r){throw a.contents=n,r}}function fe(e){let t=a.contents;a.contents=void 0;try{let n=e();return a.contents=t,n}catch(n){throw a.contents=t,n}}function pe(e){let t=a.contents;return t!==void 0?t===e:!1}function he(e){if(!S.contents){S.contents=!0;try{e(),S.contents=!1;return}catch(t){throw S.contents=!1,t}}}function me(e,t){P(t);let n=pe(e),r=s.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),ae(t,e)}function T(e){e.deps.forEach(t=>de(t,e.id)),e.deps.clear()}function _e(e){let t=w.get(e);if(t===void 0)return;w.delete(e);let n=s.get(t);if(n!==void 0){T(n),s.delete(t);return}}function V(e){return le(e,0,(t,n)=>n>t?n:t)}function Se(e){let t=[];return e.deps.forEach(n=>ce(n,r=>{if(r===e.id)return;let u=s.get(r);if(u===void 0)return;if(typeof u.kind=="object"){t.push(u.level);return}})),V(t)+1|0}function ge(e){let t=[];return e.deps.forEach(n=>{let r=w.get(n);if(r===void 0||r===e.id)return;let u=s.get(r);if(u!==void 0){t.push(u.level);return}}),V(t)+1|0}function C(e){return typeof e.kind=="object"?ge(e):Se(e)}function Ee(e,t){let n=s.get(e),r=s.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let l=typeof n.kind=="object"?0:1,i=typeof r.kind=="object"?0:1,d=l-i|0;return d!==0?d:n.level-r.level|0}function ve(e){m.contents=!0,T(e),L(e.id,()=>{e.run(),m.contents=!1}),e.level=C(e)}function B(){for(;b.size>0;){let e=Array.from(b.values());b.clear(),e.sort(Ee),e.forEach(t=>{let n=s.get(t);if(n!==void 0)return ve(n)})}}function z(e){if(P(e),se(e).forEach(t=>{let n=s.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,z(r.VAL));b.add(t)}),b.size>0)return he(B)}function W(e){let t=w.get(e);if(t===void 0)return;let n=s.get(t);if(n!==void 0&&n.dirty){m.contents=!0,T(n),L(t,()=>{n.run(),n.dirty=!1,m.contents=!1}),n.level=C(n);return}}function be(e){let t=S.contents;S.contents=!0;try{let n=e();return t||(S.contents=!1,b.size>0&&B()),n}catch(n){throw t||(S.contents=!1),n}}let ye=fe,Te=P;function X(e,t,n){let r=j();return Te(r),{id:r,value:{contents:e},version:{contents:0},equals:I(n,(u,l)=>u===l),name:t}}function ke(e){W(e.id);let t=a.contents;return t!==void 0&&me(t,e.id),e.value.contents}function Ae(e){return W(e.id),e.value.contents}function q(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,z(e.id)}function we(e,t){q(e,t(e.value.contents))}let Oe,Ce,Ne=be,$e=ye;const Me=Object.freeze(Object.defineProperty({__proto__:null,Id:Oe,Scheduler:Ce,batch:Ne,get:ke,make:X,peek:Ae,set:q,untrack:$e,update:we},Symbol.toStringTag,{value:"Module"}));function H(e,t,n){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0}}function je(e){let t=j(),n={contents:void 0},u=H(t,"Effect",()=>{let i=n.contents;i!==void 0&&i(),n.contents=e()});s.set(t,u),m.contents=!0,T(u);let l=a.contents;a.contents=t;try{u.run(),m.contents=!1}catch(i){throw a.contents=l,m.contents=!1,i}return a.contents=l,u.level=C(u),{dispose:()=>{let i=s.get(t);if(i===void 0)return;let d=n.contents;d!==void 0&&d(),T(i),s.delete(t)}}}let Ie,Pe,xe;const Ge=Object.freeze(Object.defineProperty({__proto__:null,Id:Ie,Observer:Pe,Scheduler:xe,run:je},Symbol.toStringTag,{value:"Module"}));function Re(e){let t=X(void 0,void 0,void 0),n=j(),r=()=>{let c=e();t.value.contents=c},u=H(n,{NAME:"Computed",VAL:t.id},r);s.set(n,u),m.contents=!0,T(u);let l=a.contents;a.contents=n;try{u.run(),u.dirty=!1,m.contents=!1}catch(c){throw a.contents=l,m.contents=!1,c}return a.contents=l,u.level=C(u),w.set(t.id,n),t}function De(e){_e(e.id)}let Fe,Le,Ve,Be;const ze=Object.freeze(Object.defineProperty({__proto__:null,Id:Fe,Observer:Ve,Scheduler:Be,Signal:Le,dispose:De,make:Re},Symbol.toStringTag,{value:"Module"}));let o=Me,h=ze,g=Ge;function U(e){return ie(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function J(e,t){let n=t.split("/").filter(l=>l!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((l,c)=>{let i=n[c];return l.TAG==="Static"?i===l._0:(r[l._0]=i,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function x(e,t){return J(U(e),t)}const We=Object.freeze(Object.defineProperty({__proto__:null,match:x,matchPath:J,parsePattern:U},Symbol.toStringTag,{value:"Module"}));function K(e,t){return[e,{TAG:"Static",_0:t}]}function Xe(e,t){return[e,{TAG:"SignalValue",_0:t}]}function qe(e,t){return[e,{TAG:"Compute",_0:t}]}function He(e){return{TAG:"Text",_0:e}}function Ue(e){return{TAG:"SignalText",_0:h.make(e)}}function Je(e){return{TAG:"Fragment",_0:e}}function G(e){return{TAG:"SignalFragment",_0:e}}function Ke(e,t){return{TAG:"SignalFragment",_0:h.make(()=>o.get(e).map(t))}}function p(e,t,n,r,u){let l=t!==void 0?t:[].map(d=>d),c=n!==void 0?n:[].map(d=>d),i=r!==void 0?r:[].map(d=>d);return{TAG:"Element",tag:e,attrs:l,events:c,children:i}}function Qe(e,t,n,r){return p("div",e,t,n)}function Ye(e,t,n,r){return p("span",e,t,n)}function Ze(e,t,n,r){return p("button",e,t,n)}function et(e,t,n){return p("input",e,t,void 0)}function tt(e,t,n,r){return p("h1",e,t,n)}function nt(e,t,n,r){return p("h2",e,t,n)}function rt(e,t,n,r){return p("h3",e,t,n)}function ut(e,t,n,r){return p("p",e,t,n)}function lt(e,t,n,r){return p("ul",e,t,n)}function it(e,t,n,r){return p("li",e,t,n)}function Q(e,t,n,r){return p("a",e,t,n)}function k(e,t){let n=I(ue(e.__xote_disposers),[]);e.__xote_disposers=n.concat([t])}function R(e){let t=e.__xote_disposers;t!=null&&(t.forEach(r=>r.dispose()),e.__xote_disposers=[]),Array.from(e.childNodes||[]).forEach(R)}function A(e){switch(e.TAG){case"Element":let t=document.createElement(e.tag);return e.attrs.forEach(f=>{let _=f[1],E=f[0];switch(_.TAG){case"Static":t.setAttribute(E,_._0);return;case"SignalValue":let O=_._0;t.setAttribute(E,o.peek(O));let ee=g.run(()=>{let N=o.get(O);t.setAttribute(E,N)});return k(t,ee);case"Compute":let te=_._0,D=h.make(()=>te());t.setAttribute(E,o.peek(D));let ne=g.run(()=>{let N=o.get(D);t.setAttribute(E,N)});return k(t,ne)}}),e.events.forEach(f=>{t.addEventListener(f[0],f[1])}),e.children.forEach(f=>{let _=A(f);t.appendChild(_)}),t;case"Text":return document.createTextNode(e._0);case"SignalText":let n=e._0,r=document.createTextNode(o.peek(n)),u=g.run(()=>{let f=o.get(n);r.textContent=f});return k(r,u),r;case"Fragment":let l=document.createDocumentFragment();return e._0.forEach(f=>{let _=A(f);l.appendChild(_)}),l;case"SignalFragment":let c=e._0,i=document.createElement("div");i.setAttribute("data-signal-fragment","true"),i.setAttribute("style","display: contents");let d=g.run(()=>{let f=o.get(c);Array.from(i.childNodes||[]).forEach(R),i.innerHTML="",f.forEach(E=>{let O=A(E);i.appendChild(O)})});return k(i,d),i}}function Y(e,t){let n=A(e);t.appendChild(n)}function ot(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return Y(e,n)}const ct=Object.freeze(Object.defineProperty({__proto__:null,a:Q,addDisposer:k,attr:K,button:Ze,computedAttr:qe,disposeElement:R,div:Qe,element:p,fragment:Je,h1:tt,h2:nt,h3:rt,input:et,li:it,list:Ke,mount:Y,mountById:ot,p:ut,render:A,signalAttr:Xe,signalFragment:G,span:Ye,text:He,textSignal:Ue,ul:lt},Symbol.toStringTag,{value:"Module"}));let v=o.make({pathname:"/",search:"",hash:""},void 0,void 0);function M(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function at(){o.set(v,M());let e=t=>o.set(v,M());window.addEventListener("popstate",e)}function Z(e,t,n,r){let u=t!==void 0?t:"",l=n!==void 0?n:"",c={pathname:e,search:u,hash:l},i=e+u+l,d={};window.history.pushState(d,"",i),o.set(v,c)}function dt(e,t,n,r){let u=t!==void 0?t:"",l=n!==void 0?n:"",c={pathname:e,search:u,hash:l},i=e+u+l,d={};window.history.replaceState(d,"",i),o.set(v,c)}function st(e,t){return G(h.make(()=>{let n=o.get(v),r=x(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]}))}function ft(e){return G(h.make(()=>{let t=o.get(v),n=oe(e,r=>{let u=x(r.pattern,t.pathname);if(typeof u=="object")return r.render(u._0)});return n!==void 0?[n]:[]}))}function pt(e,t,n,r){let u=t!==void 0?t:[],l=n!==void 0?n:[],c=i=>{i.preventDefault(),Z(e,void 0,void 0)};return Q(u.concat([K("href",e)]),[["click",c]],l)}let ht,mt;const _t=Object.freeze(Object.defineProperty({__proto__:null,Component:ht,Route:mt,getCurrentLocation:M,init:at,link:pt,location:v,push:Z,replace:dt,route:st,routes:ft},Symbol.toStringTag,{value:"Module"}));let St=o.Id,gt=o.Scheduler,Et=o.make,vt=o.get,bt=o.peek,yt=o.set,Tt=o.update,kt=o.batch,At=o.untrack,wt={Id:St,Scheduler:gt,make:Et,get:vt,peek:bt,set:yt,update:Tt,batch:kt,untrack:At},Ot=h.Id,Ct=h.Signal,Nt=h.Observer,$t=h.Scheduler,Mt=h.make,jt=h.dispose,It={Id:Ot,Signal:Ct,Observer:Nt,Scheduler:$t,make:Mt,dispose:jt},Pt=g.Id,xt=g.Observer,Gt=g.Scheduler,Rt=g.run,Dt={Id:Pt,Observer:xt,Scheduler:Gt,run:Rt},Ft=ct,Lt=We,Vt=_t;exports.Component=Ft;exports.Computed=It;exports.Effect=Dt;exports.Route=Lt;exports.Router=Vt;exports.Signal=wt;
|
package/dist/xote.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
let
|
|
1
|
+
let $ = {
|
|
2
2
|
contents: 0
|
|
3
3
|
};
|
|
4
4
|
function j() {
|
|
5
|
-
return
|
|
5
|
+
return $.contents = $.contents + 1 | 0, $.contents;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function re(e) {
|
|
8
8
|
return e === void 0 ? {
|
|
9
9
|
BS_PRIVATE_NESTED_SOME_NONE: 0
|
|
10
10
|
} : e !== null && e.BS_PRIVATE_NESTED_SOME_NONE !== void 0 ? {
|
|
11
11
|
BS_PRIVATE_NESTED_SOME_NONE: e.BS_PRIVATE_NESTED_SOME_NONE + 1 | 0
|
|
12
12
|
} : e;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function ue(e) {
|
|
15
15
|
if (e != null)
|
|
16
|
-
return
|
|
16
|
+
return re(e);
|
|
17
17
|
}
|
|
18
18
|
function L(e) {
|
|
19
19
|
if (e === null || e.BS_PRIVATE_NESTED_SOME_NONE === void 0)
|
|
@@ -24,186 +24,219 @@ function L(e) {
|
|
|
24
24
|
BS_PRIVATE_NESTED_SOME_NONE: t - 1 | 0
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function I(e, t) {
|
|
28
28
|
return e !== void 0 ? L(e) : t;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let o = e.length | 0, u = t.length | 0;
|
|
53
|
-
if (o === u)
|
|
54
|
-
if (Array.isArray(e)) {
|
|
55
|
-
let c = 0;
|
|
56
|
-
for (; ; ) {
|
|
57
|
-
let s = c;
|
|
58
|
-
if (s === o)
|
|
59
|
-
return !0;
|
|
60
|
-
if (!C(e[s], t[s]))
|
|
61
|
-
return !1;
|
|
62
|
-
c = s + 1 | 0;
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
if (e instanceof Date && t instanceof Date)
|
|
66
|
-
return !(e > t || e < t);
|
|
67
|
-
{
|
|
68
|
-
let c = {
|
|
69
|
-
contents: !0
|
|
70
|
-
}, s = (f) => {
|
|
71
|
-
if (!Object.prototype.hasOwnProperty.call(t, f)) {
|
|
72
|
-
c.contents = !1;
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}, h = (f) => {
|
|
76
|
-
if (!Object.prototype.hasOwnProperty.call(e, f) || !C(t[f], e[f])) {
|
|
77
|
-
c.contents = !1;
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
return F(e, s), c.contents && F(t, h), c.contents;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
else
|
|
85
|
-
return !1;
|
|
30
|
+
function le(e, t, n) {
|
|
31
|
+
return e.reduce(n, t);
|
|
32
|
+
}
|
|
33
|
+
function ie(e, t) {
|
|
34
|
+
let n = e.length, r = new Array(n), u = 0;
|
|
35
|
+
for (let l = 0; l < n; ++l) {
|
|
36
|
+
let c = e[l], i = t(c);
|
|
37
|
+
i !== void 0 && (r[u] = L(i), u = u + 1 | 0);
|
|
38
|
+
}
|
|
39
|
+
return r.length = u, r;
|
|
40
|
+
}
|
|
41
|
+
function oe(e, t) {
|
|
42
|
+
let n = 0;
|
|
43
|
+
for (; ; ) {
|
|
44
|
+
let r = n;
|
|
45
|
+
if (r === e.length)
|
|
46
|
+
return;
|
|
47
|
+
let u = t(e[r]);
|
|
48
|
+
if (u !== void 0)
|
|
49
|
+
return u;
|
|
50
|
+
n = r + 1 | 0;
|
|
51
|
+
}
|
|
86
52
|
}
|
|
87
|
-
let
|
|
53
|
+
let s = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map(), a = {
|
|
88
54
|
contents: void 0
|
|
89
|
-
},
|
|
55
|
+
}, b = /* @__PURE__ */ new Set(), S = {
|
|
90
56
|
contents: !1
|
|
91
|
-
},
|
|
57
|
+
}, m = {
|
|
92
58
|
contents: !1
|
|
93
59
|
};
|
|
94
60
|
function P(e) {
|
|
95
|
-
if (
|
|
96
|
-
|
|
61
|
+
if (y.get(e) === void 0) {
|
|
62
|
+
y.set(e, /* @__PURE__ */ new Set());
|
|
97
63
|
return;
|
|
98
64
|
}
|
|
99
65
|
}
|
|
100
|
-
function
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
66
|
+
function ce(e, t) {
|
|
67
|
+
let n = y.get(e);
|
|
68
|
+
if (n !== void 0) {
|
|
69
|
+
n.forEach(t);
|
|
104
70
|
return;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function ae(e, t) {
|
|
74
|
+
let n = y.get(e);
|
|
75
|
+
if (n !== void 0) {
|
|
76
|
+
n.add(t);
|
|
109
77
|
return;
|
|
110
78
|
}
|
|
111
79
|
}
|
|
112
|
-
function
|
|
113
|
-
let
|
|
80
|
+
function de(e, t) {
|
|
81
|
+
let n = y.get(e);
|
|
82
|
+
if (n !== void 0) {
|
|
83
|
+
n.delete(t);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function se(e) {
|
|
88
|
+
return Array.from(I(y.get(e), /* @__PURE__ */ new Set()).values());
|
|
89
|
+
}
|
|
90
|
+
function R(e, t) {
|
|
91
|
+
let n = a.contents;
|
|
92
|
+
a.contents = e;
|
|
93
|
+
try {
|
|
94
|
+
let r = t();
|
|
95
|
+
return a.contents = n, r;
|
|
96
|
+
} catch (r) {
|
|
97
|
+
throw a.contents = n, r;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function fe(e) {
|
|
101
|
+
let t = a.contents;
|
|
102
|
+
a.contents = void 0;
|
|
103
|
+
try {
|
|
104
|
+
let n = e();
|
|
105
|
+
return a.contents = t, n;
|
|
106
|
+
} catch (n) {
|
|
107
|
+
throw a.contents = t, n;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function pe(e) {
|
|
111
|
+
let t = a.contents;
|
|
112
|
+
return t !== void 0 ? t === e : !1;
|
|
113
|
+
}
|
|
114
|
+
function he(e) {
|
|
115
|
+
if (!S.contents) {
|
|
116
|
+
S.contents = !0;
|
|
117
|
+
try {
|
|
118
|
+
e(), S.contents = !1;
|
|
119
|
+
return;
|
|
120
|
+
} catch (t) {
|
|
121
|
+
throw S.contents = !1, t;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function me(e, t) {
|
|
126
|
+
P(t);
|
|
127
|
+
let n = pe(e), r = s.get(e);
|
|
128
|
+
if (n && r !== void 0 && !r.deps.has(t))
|
|
129
|
+
return r.deps.add(t), ae(t, e);
|
|
130
|
+
}
|
|
131
|
+
function T(e) {
|
|
132
|
+
e.deps.forEach((t) => de(t, e.id)), e.deps.clear();
|
|
133
|
+
}
|
|
134
|
+
function _e(e) {
|
|
135
|
+
let t = w.get(e);
|
|
114
136
|
if (t === void 0)
|
|
115
137
|
return;
|
|
116
|
-
|
|
117
|
-
let n =
|
|
138
|
+
w.delete(e);
|
|
139
|
+
let n = s.get(t);
|
|
118
140
|
if (n !== void 0) {
|
|
119
|
-
|
|
141
|
+
T(n), s.delete(t);
|
|
120
142
|
return;
|
|
121
143
|
}
|
|
122
144
|
}
|
|
123
|
-
function
|
|
124
|
-
e
|
|
125
|
-
let n = E.get(t);
|
|
126
|
-
if (n !== void 0)
|
|
127
|
-
return n.delete(e.id), n.size === 0 && !S.contents ? z(t) : void 0;
|
|
128
|
-
}), e.deps.clear();
|
|
145
|
+
function V(e) {
|
|
146
|
+
return le(e, 0, (t, n) => n > t ? n : t);
|
|
129
147
|
}
|
|
130
|
-
function
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return;
|
|
141
|
-
let u = p.get(o);
|
|
142
|
-
if (u === void 0)
|
|
143
|
-
return;
|
|
144
|
-
if (typeof u.kind == "object" && u.level > r.contents) {
|
|
145
|
-
r.contents = u.level;
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
}), r.contents + 1 | 0;
|
|
152
|
-
}
|
|
153
|
-
let n = {
|
|
154
|
-
contents: 0
|
|
155
|
-
};
|
|
156
|
-
return e.deps.forEach((r) => {
|
|
157
|
-
let l = E.get(r);
|
|
158
|
-
if (l !== void 0) {
|
|
159
|
-
l.forEach((i) => {
|
|
160
|
-
let o = p.get(i);
|
|
161
|
-
if (o !== void 0 && o.level > n.contents) {
|
|
162
|
-
n.contents = o.level;
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
});
|
|
148
|
+
function Se(e) {
|
|
149
|
+
let t = [];
|
|
150
|
+
return e.deps.forEach((n) => ce(n, (r) => {
|
|
151
|
+
if (r === e.id)
|
|
152
|
+
return;
|
|
153
|
+
let u = s.get(r);
|
|
154
|
+
if (u === void 0)
|
|
155
|
+
return;
|
|
156
|
+
if (typeof u.kind == "object") {
|
|
157
|
+
t.push(u.level);
|
|
166
158
|
return;
|
|
167
159
|
}
|
|
168
|
-
}),
|
|
169
|
-
}
|
|
170
|
-
function
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
return
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
160
|
+
})), V(t) + 1 | 0;
|
|
161
|
+
}
|
|
162
|
+
function ge(e) {
|
|
163
|
+
let t = [];
|
|
164
|
+
return e.deps.forEach((n) => {
|
|
165
|
+
let r = w.get(n);
|
|
166
|
+
if (r === void 0 || r === e.id)
|
|
167
|
+
return;
|
|
168
|
+
let u = s.get(r);
|
|
169
|
+
if (u !== void 0) {
|
|
170
|
+
t.push(u.level);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
}), V(t) + 1 | 0;
|
|
174
|
+
}
|
|
175
|
+
function C(e) {
|
|
176
|
+
return typeof e.kind == "object" ? ge(e) : Se(e);
|
|
177
|
+
}
|
|
178
|
+
function Ee(e, t) {
|
|
179
|
+
let n = s.get(e), r = s.get(t);
|
|
180
|
+
if (n === void 0)
|
|
181
|
+
return r !== void 0 ? 1 : 0;
|
|
182
|
+
if (r === void 0)
|
|
183
|
+
return -1;
|
|
184
|
+
let l = typeof n.kind == "object" ? 0 : 1, i = typeof r.kind == "object" ? 0 : 1, d = l - i | 0;
|
|
185
|
+
return d !== 0 ? d : n.level - r.level | 0;
|
|
186
|
+
}
|
|
187
|
+
function ve(e) {
|
|
188
|
+
m.contents = !0, T(e), R(e.id, () => {
|
|
189
|
+
e.run(), m.contents = !1;
|
|
190
|
+
}), e.level = C(e);
|
|
191
|
+
}
|
|
192
|
+
function B() {
|
|
193
|
+
for (; b.size > 0; ) {
|
|
194
|
+
let e = Array.from(b.values());
|
|
195
|
+
b.clear(), e.sort(Ee), e.forEach((t) => {
|
|
196
|
+
let n = s.get(t);
|
|
197
|
+
if (n !== void 0)
|
|
198
|
+
return ve(n);
|
|
189
199
|
});
|
|
190
200
|
}
|
|
191
201
|
}
|
|
192
|
-
function
|
|
193
|
-
P(e)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
if (t.forEach((n) => {
|
|
197
|
-
O.add(n);
|
|
198
|
-
}), N.contents)
|
|
202
|
+
function z(e) {
|
|
203
|
+
if (P(e), se(e).forEach((t) => {
|
|
204
|
+
let n = s.get(t);
|
|
205
|
+
if (n === void 0)
|
|
199
206
|
return;
|
|
200
|
-
|
|
207
|
+
let r = n.kind;
|
|
208
|
+
if (typeof r == "object")
|
|
209
|
+
return n.dirty ? void 0 : (n.dirty = !0, z(r.VAL));
|
|
210
|
+
b.add(t);
|
|
211
|
+
}), b.size > 0)
|
|
212
|
+
return he(B);
|
|
213
|
+
}
|
|
214
|
+
function W(e) {
|
|
215
|
+
let t = w.get(e);
|
|
216
|
+
if (t === void 0)
|
|
217
|
+
return;
|
|
218
|
+
let n = s.get(t);
|
|
219
|
+
if (n !== void 0 && n.dirty) {
|
|
220
|
+
m.contents = !0, T(n), R(t, () => {
|
|
221
|
+
n.run(), n.dirty = !1, m.contents = !1;
|
|
222
|
+
}), n.level = C(n);
|
|
201
223
|
return;
|
|
202
224
|
}
|
|
203
225
|
}
|
|
204
|
-
function
|
|
226
|
+
function be(e) {
|
|
227
|
+
let t = S.contents;
|
|
228
|
+
S.contents = !0;
|
|
229
|
+
try {
|
|
230
|
+
let n = e();
|
|
231
|
+
return t || (S.contents = !1, b.size > 0 && B()), n;
|
|
232
|
+
} catch (n) {
|
|
233
|
+
throw t || (S.contents = !1), n;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
let ye = fe, Te = P;
|
|
237
|
+
function X(e, t, n) {
|
|
205
238
|
let r = j();
|
|
206
|
-
return
|
|
239
|
+
return Te(r), {
|
|
207
240
|
id: r,
|
|
208
241
|
value: {
|
|
209
242
|
contents: e
|
|
@@ -211,18 +244,19 @@ function q(e, t, n) {
|
|
|
211
244
|
version: {
|
|
212
245
|
contents: 0
|
|
213
246
|
},
|
|
214
|
-
equals:
|
|
247
|
+
equals: I(n, (u, l) => u === l),
|
|
215
248
|
name: t
|
|
216
249
|
};
|
|
217
250
|
}
|
|
218
|
-
function
|
|
219
|
-
|
|
220
|
-
|
|
251
|
+
function ke(e) {
|
|
252
|
+
W(e.id);
|
|
253
|
+
let t = a.contents;
|
|
254
|
+
return t !== void 0 && me(t, e.id), e.value.contents;
|
|
221
255
|
}
|
|
222
|
-
function
|
|
223
|
-
return e.value.contents;
|
|
256
|
+
function Ae(e) {
|
|
257
|
+
return W(e.id), e.value.contents;
|
|
224
258
|
}
|
|
225
|
-
function
|
|
259
|
+
function q(e, t) {
|
|
226
260
|
let n;
|
|
227
261
|
try {
|
|
228
262
|
n = !e.equals(e.value.contents, t);
|
|
@@ -230,118 +264,101 @@ function I(e, t) {
|
|
|
230
264
|
n = !0;
|
|
231
265
|
}
|
|
232
266
|
if (n)
|
|
233
|
-
return e.value.contents = t, e.version.contents = e.version.contents + 1 | 0,
|
|
267
|
+
return e.value.contents = t, e.version.contents = e.version.contents + 1 | 0, z(e.id);
|
|
234
268
|
}
|
|
235
|
-
function
|
|
236
|
-
|
|
269
|
+
function we(e, t) {
|
|
270
|
+
q(e, t(e.value.contents));
|
|
237
271
|
}
|
|
238
|
-
let
|
|
239
|
-
const
|
|
272
|
+
let Oe, Ce, Ne = be, $e = ye;
|
|
273
|
+
const Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
240
274
|
__proto__: null,
|
|
241
|
-
Id:
|
|
242
|
-
Scheduler:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
275
|
+
Id: Oe,
|
|
276
|
+
Scheduler: Ce,
|
|
277
|
+
batch: Ne,
|
|
278
|
+
get: ke,
|
|
279
|
+
make: X,
|
|
280
|
+
peek: Ae,
|
|
281
|
+
set: q,
|
|
282
|
+
untrack: $e,
|
|
283
|
+
update: we
|
|
248
284
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
249
|
-
function
|
|
285
|
+
function H(e, t, n) {
|
|
250
286
|
return {
|
|
251
287
|
id: e,
|
|
252
288
|
kind: t,
|
|
253
289
|
run: n,
|
|
254
290
|
deps: /* @__PURE__ */ new Set(),
|
|
255
|
-
level: 0
|
|
291
|
+
level: 0,
|
|
292
|
+
dirty: !0
|
|
256
293
|
};
|
|
257
294
|
}
|
|
258
|
-
function
|
|
295
|
+
function je(e) {
|
|
259
296
|
let t = j(), n = {
|
|
260
297
|
contents: void 0
|
|
261
|
-
},
|
|
262
|
-
let
|
|
263
|
-
|
|
298
|
+
}, u = H(t, "Effect", () => {
|
|
299
|
+
let i = n.contents;
|
|
300
|
+
i !== void 0 && i(), n.contents = e();
|
|
264
301
|
});
|
|
265
|
-
|
|
266
|
-
let
|
|
267
|
-
|
|
302
|
+
s.set(t, u), m.contents = !0, T(u);
|
|
303
|
+
let l = a.contents;
|
|
304
|
+
a.contents = t;
|
|
268
305
|
try {
|
|
269
|
-
|
|
270
|
-
} catch (
|
|
271
|
-
throw
|
|
306
|
+
u.run(), m.contents = !1;
|
|
307
|
+
} catch (i) {
|
|
308
|
+
throw a.contents = l, m.contents = !1, i;
|
|
272
309
|
}
|
|
273
|
-
return
|
|
310
|
+
return a.contents = l, u.level = C(u), {
|
|
274
311
|
dispose: () => {
|
|
275
|
-
let
|
|
276
|
-
if (
|
|
312
|
+
let i = s.get(t);
|
|
313
|
+
if (i === void 0)
|
|
277
314
|
return;
|
|
278
|
-
let
|
|
279
|
-
|
|
315
|
+
let d = n.contents;
|
|
316
|
+
d !== void 0 && d(), T(i), s.delete(t);
|
|
280
317
|
}
|
|
281
318
|
};
|
|
282
319
|
}
|
|
283
|
-
let
|
|
284
|
-
const
|
|
320
|
+
let Ie, Pe, xe;
|
|
321
|
+
const Ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
285
322
|
__proto__: null,
|
|
286
|
-
Id:
|
|
287
|
-
Observer:
|
|
288
|
-
Scheduler:
|
|
289
|
-
run:
|
|
323
|
+
Id: Ie,
|
|
324
|
+
Observer: Pe,
|
|
325
|
+
Scheduler: xe,
|
|
326
|
+
run: je
|
|
290
327
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
291
|
-
function
|
|
292
|
-
let t =
|
|
293
|
-
let
|
|
294
|
-
|
|
295
|
-
},
|
|
328
|
+
function De(e) {
|
|
329
|
+
let t = X(void 0, void 0, void 0), n = j(), r = () => {
|
|
330
|
+
let c = e();
|
|
331
|
+
t.value.contents = c;
|
|
332
|
+
}, u = H(n, {
|
|
296
333
|
NAME: "Computed",
|
|
297
334
|
VAL: t.id
|
|
298
335
|
}, r);
|
|
299
|
-
|
|
300
|
-
let
|
|
301
|
-
|
|
336
|
+
s.set(n, u), m.contents = !0, T(u);
|
|
337
|
+
let l = a.contents;
|
|
338
|
+
a.contents = n;
|
|
302
339
|
try {
|
|
303
|
-
|
|
304
|
-
} catch (
|
|
305
|
-
throw
|
|
340
|
+
u.run(), u.dirty = !1, m.contents = !1;
|
|
341
|
+
} catch (c) {
|
|
342
|
+
throw a.contents = l, m.contents = !1, c;
|
|
306
343
|
}
|
|
307
|
-
return
|
|
344
|
+
return a.contents = l, u.level = C(u), w.set(t.id, n), t;
|
|
308
345
|
}
|
|
309
|
-
function
|
|
310
|
-
|
|
346
|
+
function Fe(e) {
|
|
347
|
+
_e(e.id);
|
|
311
348
|
}
|
|
312
|
-
let
|
|
313
|
-
const
|
|
349
|
+
let Le, Re, Ve, Be;
|
|
350
|
+
const ze = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
314
351
|
__proto__: null,
|
|
315
|
-
Id:
|
|
316
|
-
Observer:
|
|
317
|
-
Scheduler:
|
|
318
|
-
Signal:
|
|
319
|
-
dispose:
|
|
320
|
-
make:
|
|
352
|
+
Id: Le,
|
|
353
|
+
Observer: Ve,
|
|
354
|
+
Scheduler: Be,
|
|
355
|
+
Signal: Re,
|
|
356
|
+
dispose: Fe,
|
|
357
|
+
make: De
|
|
321
358
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
322
|
-
let
|
|
323
|
-
function
|
|
324
|
-
|
|
325
|
-
for (let i = 0; i < n; ++i) {
|
|
326
|
-
let o = e[i], u = t(o);
|
|
327
|
-
u !== void 0 && (r[l] = L(u), l = l + 1 | 0);
|
|
328
|
-
}
|
|
329
|
-
return r.length = l, r;
|
|
330
|
-
}
|
|
331
|
-
function Oe(e, t) {
|
|
332
|
-
let n = 0;
|
|
333
|
-
for (; ; ) {
|
|
334
|
-
let r = n;
|
|
335
|
-
if (r === e.length)
|
|
336
|
-
return;
|
|
337
|
-
let l = t(e[r]);
|
|
338
|
-
if (l !== void 0)
|
|
339
|
-
return l;
|
|
340
|
-
n = r + 1 | 0;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
function W(e) {
|
|
344
|
-
return Ae(e.split("/"), (t) => {
|
|
359
|
+
let o = Me, h = ze, g = Ge;
|
|
360
|
+
function U(e) {
|
|
361
|
+
return ie(e.split("/"), (t) => {
|
|
345
362
|
if (t !== "")
|
|
346
363
|
return t.startsWith(":") ? {
|
|
347
364
|
TAG: "Param",
|
|
@@ -352,29 +369,29 @@ function W(e) {
|
|
|
352
369
|
};
|
|
353
370
|
});
|
|
354
371
|
}
|
|
355
|
-
function
|
|
356
|
-
let n = t.split("/").filter((
|
|
372
|
+
function J(e, t) {
|
|
373
|
+
let n = t.split("/").filter((l) => l !== "");
|
|
357
374
|
if (e.length !== n.length)
|
|
358
375
|
return "NoMatch";
|
|
359
376
|
let r = {};
|
|
360
|
-
return e.every((
|
|
361
|
-
let
|
|
362
|
-
return
|
|
377
|
+
return e.every((l, c) => {
|
|
378
|
+
let i = n[c];
|
|
379
|
+
return l.TAG === "Static" ? i === l._0 : (r[l._0] = i, !0);
|
|
363
380
|
}) ? {
|
|
364
381
|
TAG: "Match",
|
|
365
382
|
_0: r
|
|
366
383
|
} : "NoMatch";
|
|
367
384
|
}
|
|
368
|
-
function
|
|
369
|
-
return
|
|
385
|
+
function x(e, t) {
|
|
386
|
+
return J(U(e), t);
|
|
370
387
|
}
|
|
371
|
-
const
|
|
388
|
+
const We = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
372
389
|
__proto__: null,
|
|
373
|
-
match:
|
|
374
|
-
matchPath:
|
|
375
|
-
parsePattern:
|
|
390
|
+
match: x,
|
|
391
|
+
matchPath: J,
|
|
392
|
+
parsePattern: U
|
|
376
393
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
377
|
-
function
|
|
394
|
+
function K(e, t) {
|
|
378
395
|
return [
|
|
379
396
|
e,
|
|
380
397
|
{
|
|
@@ -383,7 +400,7 @@ function U(e, t) {
|
|
|
383
400
|
}
|
|
384
401
|
];
|
|
385
402
|
}
|
|
386
|
-
function
|
|
403
|
+
function Xe(e, t) {
|
|
387
404
|
return [
|
|
388
405
|
e,
|
|
389
406
|
{
|
|
@@ -392,7 +409,7 @@ function we(e, t) {
|
|
|
392
409
|
}
|
|
393
410
|
];
|
|
394
411
|
}
|
|
395
|
-
function
|
|
412
|
+
function qe(e, t) {
|
|
396
413
|
return [
|
|
397
414
|
e,
|
|
398
415
|
{
|
|
@@ -401,285 +418,287 @@ function Ne(e, t) {
|
|
|
401
418
|
}
|
|
402
419
|
];
|
|
403
420
|
}
|
|
404
|
-
function
|
|
421
|
+
function He(e) {
|
|
405
422
|
return {
|
|
406
423
|
TAG: "Text",
|
|
407
424
|
_0: e
|
|
408
425
|
};
|
|
409
426
|
}
|
|
410
|
-
function
|
|
427
|
+
function Ue(e) {
|
|
411
428
|
return {
|
|
412
429
|
TAG: "SignalText",
|
|
413
|
-
_0:
|
|
430
|
+
_0: h.make(e)
|
|
414
431
|
};
|
|
415
432
|
}
|
|
416
|
-
function
|
|
433
|
+
function Je(e) {
|
|
417
434
|
return {
|
|
418
435
|
TAG: "Fragment",
|
|
419
436
|
_0: e
|
|
420
437
|
};
|
|
421
438
|
}
|
|
422
|
-
function
|
|
439
|
+
function G(e) {
|
|
423
440
|
return {
|
|
424
441
|
TAG: "SignalFragment",
|
|
425
442
|
_0: e
|
|
426
443
|
};
|
|
427
444
|
}
|
|
428
|
-
function
|
|
445
|
+
function Ke(e, t) {
|
|
429
446
|
return {
|
|
430
447
|
TAG: "SignalFragment",
|
|
431
|
-
_0:
|
|
448
|
+
_0: h.make(() => o.get(e).map(t))
|
|
432
449
|
};
|
|
433
450
|
}
|
|
434
|
-
function
|
|
435
|
-
let
|
|
451
|
+
function p(e, t, n, r, u) {
|
|
452
|
+
let l = t !== void 0 ? t : [].map((d) => d), c = n !== void 0 ? n : [].map((d) => d), i = r !== void 0 ? r : [].map((d) => d);
|
|
436
453
|
return {
|
|
437
454
|
TAG: "Element",
|
|
438
455
|
tag: e,
|
|
439
|
-
attrs:
|
|
440
|
-
events:
|
|
441
|
-
children:
|
|
456
|
+
attrs: l,
|
|
457
|
+
events: c,
|
|
458
|
+
children: i
|
|
442
459
|
};
|
|
443
460
|
}
|
|
444
|
-
function
|
|
445
|
-
return
|
|
461
|
+
function Qe(e, t, n, r) {
|
|
462
|
+
return p("div", e, t, n);
|
|
446
463
|
}
|
|
447
|
-
function
|
|
448
|
-
return
|
|
464
|
+
function Ye(e, t, n, r) {
|
|
465
|
+
return p("span", e, t, n);
|
|
449
466
|
}
|
|
450
|
-
function
|
|
451
|
-
return
|
|
467
|
+
function Ze(e, t, n, r) {
|
|
468
|
+
return p("button", e, t, n);
|
|
452
469
|
}
|
|
453
|
-
function
|
|
454
|
-
return
|
|
470
|
+
function et(e, t, n) {
|
|
471
|
+
return p("input", e, t, void 0);
|
|
455
472
|
}
|
|
456
|
-
function
|
|
457
|
-
return
|
|
473
|
+
function tt(e, t, n, r) {
|
|
474
|
+
return p("h1", e, t, n);
|
|
458
475
|
}
|
|
459
|
-
function
|
|
460
|
-
return
|
|
476
|
+
function nt(e, t, n, r) {
|
|
477
|
+
return p("h2", e, t, n);
|
|
461
478
|
}
|
|
462
|
-
function
|
|
463
|
-
return
|
|
479
|
+
function rt(e, t, n, r) {
|
|
480
|
+
return p("h3", e, t, n);
|
|
464
481
|
}
|
|
465
|
-
function
|
|
466
|
-
return
|
|
482
|
+
function ut(e, t, n, r) {
|
|
483
|
+
return p("p", e, t, n);
|
|
467
484
|
}
|
|
468
|
-
function
|
|
469
|
-
return
|
|
485
|
+
function lt(e, t, n, r) {
|
|
486
|
+
return p("ul", e, t, n);
|
|
470
487
|
}
|
|
471
|
-
function
|
|
472
|
-
return
|
|
488
|
+
function it(e, t, n, r) {
|
|
489
|
+
return p("li", e, t, n);
|
|
473
490
|
}
|
|
474
|
-
function
|
|
475
|
-
return
|
|
491
|
+
function Q(e, t, n, r) {
|
|
492
|
+
return p("a", e, t, n);
|
|
476
493
|
}
|
|
477
|
-
function
|
|
478
|
-
let n =
|
|
494
|
+
function k(e, t) {
|
|
495
|
+
let n = I(ue(e.__xote_disposers), []);
|
|
479
496
|
e.__xote_disposers = n.concat([t]);
|
|
480
497
|
}
|
|
481
|
-
function
|
|
498
|
+
function D(e) {
|
|
482
499
|
let t = e.__xote_disposers;
|
|
483
|
-
t != null && (t.forEach((r) => r.dispose()), e.__xote_disposers = []), Array.from(e.childNodes || []).forEach(
|
|
500
|
+
t != null && (t.forEach((r) => r.dispose()), e.__xote_disposers = []), Array.from(e.childNodes || []).forEach(D);
|
|
484
501
|
}
|
|
485
|
-
function
|
|
502
|
+
function A(e) {
|
|
486
503
|
switch (e.TAG) {
|
|
487
504
|
case "Element":
|
|
488
505
|
let t = document.createElement(e.tag);
|
|
489
|
-
return e.attrs.forEach((
|
|
490
|
-
let
|
|
491
|
-
switch (
|
|
506
|
+
return e.attrs.forEach((f) => {
|
|
507
|
+
let _ = f[1], E = f[0];
|
|
508
|
+
switch (_.TAG) {
|
|
492
509
|
case "Static":
|
|
493
|
-
t.setAttribute(
|
|
510
|
+
t.setAttribute(E, _._0);
|
|
494
511
|
return;
|
|
495
512
|
case "SignalValue":
|
|
496
|
-
let
|
|
497
|
-
t.setAttribute(
|
|
498
|
-
let
|
|
499
|
-
let
|
|
500
|
-
t.setAttribute(
|
|
513
|
+
let O = _._0;
|
|
514
|
+
t.setAttribute(E, o.peek(O));
|
|
515
|
+
let ee = g.run(() => {
|
|
516
|
+
let N = o.get(O);
|
|
517
|
+
t.setAttribute(E, N);
|
|
501
518
|
});
|
|
502
|
-
return
|
|
519
|
+
return k(t, ee);
|
|
503
520
|
case "Compute":
|
|
504
|
-
let
|
|
505
|
-
t.setAttribute(
|
|
506
|
-
let
|
|
507
|
-
let
|
|
508
|
-
t.setAttribute(
|
|
521
|
+
let te = _._0, F = h.make(() => te());
|
|
522
|
+
t.setAttribute(E, o.peek(F));
|
|
523
|
+
let ne = g.run(() => {
|
|
524
|
+
let N = o.get(F);
|
|
525
|
+
t.setAttribute(E, N);
|
|
509
526
|
});
|
|
510
|
-
return
|
|
527
|
+
return k(t, ne);
|
|
511
528
|
}
|
|
512
|
-
}), e.events.forEach((
|
|
513
|
-
t.addEventListener(
|
|
514
|
-
}), e.children.forEach((
|
|
515
|
-
let
|
|
516
|
-
t.appendChild(
|
|
529
|
+
}), e.events.forEach((f) => {
|
|
530
|
+
t.addEventListener(f[0], f[1]);
|
|
531
|
+
}), e.children.forEach((f) => {
|
|
532
|
+
let _ = A(f);
|
|
533
|
+
t.appendChild(_);
|
|
517
534
|
}), t;
|
|
518
535
|
case "Text":
|
|
519
536
|
return document.createTextNode(e._0);
|
|
520
537
|
case "SignalText":
|
|
521
|
-
let n = e._0, r = document.createTextNode(
|
|
522
|
-
let
|
|
523
|
-
r.textContent =
|
|
538
|
+
let n = e._0, r = document.createTextNode(o.peek(n)), u = g.run(() => {
|
|
539
|
+
let f = o.get(n);
|
|
540
|
+
r.textContent = f;
|
|
524
541
|
});
|
|
525
|
-
return
|
|
542
|
+
return k(r, u), r;
|
|
526
543
|
case "Fragment":
|
|
527
|
-
let
|
|
528
|
-
return e._0.forEach((
|
|
529
|
-
let
|
|
530
|
-
|
|
531
|
-
}),
|
|
544
|
+
let l = document.createDocumentFragment();
|
|
545
|
+
return e._0.forEach((f) => {
|
|
546
|
+
let _ = A(f);
|
|
547
|
+
l.appendChild(_);
|
|
548
|
+
}), l;
|
|
532
549
|
case "SignalFragment":
|
|
533
|
-
let
|
|
534
|
-
|
|
535
|
-
let
|
|
536
|
-
let
|
|
537
|
-
Array.from(
|
|
538
|
-
let
|
|
539
|
-
|
|
550
|
+
let c = e._0, i = document.createElement("div");
|
|
551
|
+
i.setAttribute("data-signal-fragment", "true"), i.setAttribute("style", "display: contents");
|
|
552
|
+
let d = g.run(() => {
|
|
553
|
+
let f = o.get(c);
|
|
554
|
+
Array.from(i.childNodes || []).forEach(D), i.innerHTML = "", f.forEach((E) => {
|
|
555
|
+
let O = A(E);
|
|
556
|
+
i.appendChild(O);
|
|
540
557
|
});
|
|
541
558
|
});
|
|
542
|
-
return
|
|
559
|
+
return k(i, d), i;
|
|
543
560
|
}
|
|
544
561
|
}
|
|
545
|
-
function
|
|
546
|
-
let n =
|
|
562
|
+
function Y(e, t) {
|
|
563
|
+
let n = A(e);
|
|
547
564
|
t.appendChild(n);
|
|
548
565
|
}
|
|
549
|
-
function
|
|
566
|
+
function ot(e, t) {
|
|
550
567
|
let n = document.getElementById(t);
|
|
551
568
|
if (n == null) {
|
|
552
569
|
console.error("Container element not found: " + t);
|
|
553
570
|
return;
|
|
554
571
|
} else
|
|
555
|
-
return
|
|
572
|
+
return Y(e, n);
|
|
556
573
|
}
|
|
557
|
-
const
|
|
574
|
+
const ct = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
558
575
|
__proto__: null,
|
|
559
|
-
a:
|
|
560
|
-
addDisposer:
|
|
561
|
-
attr:
|
|
562
|
-
button:
|
|
563
|
-
computedAttr:
|
|
564
|
-
disposeElement:
|
|
565
|
-
div:
|
|
566
|
-
element:
|
|
567
|
-
fragment:
|
|
568
|
-
h1:
|
|
569
|
-
h2:
|
|
570
|
-
h3:
|
|
571
|
-
input:
|
|
572
|
-
li:
|
|
573
|
-
list:
|
|
574
|
-
mount:
|
|
575
|
-
mountById:
|
|
576
|
-
p:
|
|
577
|
-
render:
|
|
578
|
-
signalAttr:
|
|
579
|
-
signalFragment:
|
|
580
|
-
span:
|
|
581
|
-
text:
|
|
582
|
-
textSignal:
|
|
583
|
-
ul:
|
|
576
|
+
a: Q,
|
|
577
|
+
addDisposer: k,
|
|
578
|
+
attr: K,
|
|
579
|
+
button: Ze,
|
|
580
|
+
computedAttr: qe,
|
|
581
|
+
disposeElement: D,
|
|
582
|
+
div: Qe,
|
|
583
|
+
element: p,
|
|
584
|
+
fragment: Je,
|
|
585
|
+
h1: tt,
|
|
586
|
+
h2: nt,
|
|
587
|
+
h3: rt,
|
|
588
|
+
input: et,
|
|
589
|
+
li: it,
|
|
590
|
+
list: Ke,
|
|
591
|
+
mount: Y,
|
|
592
|
+
mountById: ot,
|
|
593
|
+
p: ut,
|
|
594
|
+
render: A,
|
|
595
|
+
signalAttr: Xe,
|
|
596
|
+
signalFragment: G,
|
|
597
|
+
span: Ye,
|
|
598
|
+
text: He,
|
|
599
|
+
textSignal: Ue,
|
|
600
|
+
ul: lt
|
|
584
601
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
585
|
-
let v =
|
|
602
|
+
let v = o.make({
|
|
586
603
|
pathname: "/",
|
|
587
604
|
search: "",
|
|
588
605
|
hash: ""
|
|
589
606
|
}, void 0, void 0);
|
|
590
|
-
function
|
|
607
|
+
function M() {
|
|
591
608
|
return {
|
|
592
609
|
pathname: window.location.pathname,
|
|
593
610
|
search: window.location.search,
|
|
594
611
|
hash: window.location.hash
|
|
595
612
|
};
|
|
596
613
|
}
|
|
597
|
-
function
|
|
598
|
-
|
|
599
|
-
let e = (t) =>
|
|
614
|
+
function at() {
|
|
615
|
+
o.set(v, M());
|
|
616
|
+
let e = (t) => o.set(v, M());
|
|
600
617
|
window.addEventListener("popstate", e);
|
|
601
618
|
}
|
|
602
|
-
function
|
|
603
|
-
let
|
|
619
|
+
function Z(e, t, n, r) {
|
|
620
|
+
let u = t !== void 0 ? t : "", l = n !== void 0 ? n : "", c = {
|
|
604
621
|
pathname: e,
|
|
605
|
-
search:
|
|
606
|
-
hash:
|
|
607
|
-
},
|
|
608
|
-
window.history.pushState(
|
|
622
|
+
search: u,
|
|
623
|
+
hash: l
|
|
624
|
+
}, i = e + u + l, d = {};
|
|
625
|
+
window.history.pushState(d, "", i), o.set(v, c);
|
|
609
626
|
}
|
|
610
|
-
function
|
|
611
|
-
let
|
|
627
|
+
function dt(e, t, n, r) {
|
|
628
|
+
let u = t !== void 0 ? t : "", l = n !== void 0 ? n : "", c = {
|
|
612
629
|
pathname: e,
|
|
613
|
-
search:
|
|
614
|
-
hash:
|
|
615
|
-
},
|
|
616
|
-
window.history.replaceState(
|
|
617
|
-
}
|
|
618
|
-
function
|
|
619
|
-
return
|
|
620
|
-
let n =
|
|
630
|
+
search: u,
|
|
631
|
+
hash: l
|
|
632
|
+
}, i = e + u + l, d = {};
|
|
633
|
+
window.history.replaceState(d, "", i), o.set(v, c);
|
|
634
|
+
}
|
|
635
|
+
function st(e, t) {
|
|
636
|
+
return G(h.make(() => {
|
|
637
|
+
let n = o.get(v), r = x(e, n.pathname);
|
|
621
638
|
return typeof r != "object" ? [] : [t(r._0)];
|
|
622
639
|
}));
|
|
623
640
|
}
|
|
624
|
-
function
|
|
625
|
-
return
|
|
626
|
-
let t =
|
|
627
|
-
let
|
|
628
|
-
if (typeof
|
|
629
|
-
return r.render(
|
|
641
|
+
function ft(e) {
|
|
642
|
+
return G(h.make(() => {
|
|
643
|
+
let t = o.get(v), n = oe(e, (r) => {
|
|
644
|
+
let u = x(r.pattern, t.pathname);
|
|
645
|
+
if (typeof u == "object")
|
|
646
|
+
return r.render(u._0);
|
|
630
647
|
});
|
|
631
648
|
return n !== void 0 ? [n] : [];
|
|
632
649
|
}));
|
|
633
650
|
}
|
|
634
|
-
function
|
|
635
|
-
let
|
|
636
|
-
|
|
651
|
+
function pt(e, t, n, r) {
|
|
652
|
+
let u = t !== void 0 ? t : [], l = n !== void 0 ? n : [], c = (i) => {
|
|
653
|
+
i.preventDefault(), Z(e, void 0, void 0);
|
|
637
654
|
};
|
|
638
|
-
return
|
|
655
|
+
return Q(u.concat([K("href", e)]), [[
|
|
639
656
|
"click",
|
|
640
|
-
|
|
641
|
-
]],
|
|
657
|
+
c
|
|
658
|
+
]], l);
|
|
642
659
|
}
|
|
643
|
-
let
|
|
644
|
-
const
|
|
660
|
+
let ht, mt;
|
|
661
|
+
const _t = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
645
662
|
__proto__: null,
|
|
646
|
-
Component:
|
|
647
|
-
Route:
|
|
648
|
-
getCurrentLocation:
|
|
649
|
-
init:
|
|
650
|
-
link:
|
|
663
|
+
Component: ht,
|
|
664
|
+
Route: mt,
|
|
665
|
+
getCurrentLocation: M,
|
|
666
|
+
init: at,
|
|
667
|
+
link: pt,
|
|
651
668
|
location: v,
|
|
652
|
-
push:
|
|
653
|
-
replace:
|
|
654
|
-
route:
|
|
655
|
-
routes:
|
|
669
|
+
push: Z,
|
|
670
|
+
replace: dt,
|
|
671
|
+
route: st,
|
|
672
|
+
routes: ft
|
|
656
673
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
657
|
-
let
|
|
658
|
-
Id:
|
|
659
|
-
Scheduler:
|
|
660
|
-
make:
|
|
661
|
-
get:
|
|
662
|
-
peek:
|
|
663
|
-
set:
|
|
664
|
-
update:
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
674
|
+
let St = o.Id, gt = o.Scheduler, Et = o.make, vt = o.get, bt = o.peek, yt = o.set, Tt = o.update, kt = o.batch, At = o.untrack, Gt = {
|
|
675
|
+
Id: St,
|
|
676
|
+
Scheduler: gt,
|
|
677
|
+
make: Et,
|
|
678
|
+
get: vt,
|
|
679
|
+
peek: bt,
|
|
680
|
+
set: yt,
|
|
681
|
+
update: Tt,
|
|
682
|
+
batch: kt,
|
|
683
|
+
untrack: At
|
|
684
|
+
}, wt = h.Id, Ot = h.Signal, Ct = h.Observer, Nt = h.Scheduler, $t = h.make, Mt = h.dispose, Dt = {
|
|
685
|
+
Id: wt,
|
|
686
|
+
Signal: Ot,
|
|
687
|
+
Observer: Ct,
|
|
688
|
+
Scheduler: Nt,
|
|
689
|
+
make: $t,
|
|
690
|
+
dispose: Mt
|
|
691
|
+
}, jt = g.Id, It = g.Observer, Pt = g.Scheduler, xt = g.run, Ft = {
|
|
692
|
+
Id: jt,
|
|
693
|
+
Observer: It,
|
|
694
|
+
Scheduler: Pt,
|
|
695
|
+
run: xt
|
|
696
|
+
}, Lt = ct, Rt = We, Vt = _t;
|
|
678
697
|
export {
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
698
|
+
Lt as Component,
|
|
699
|
+
Dt as Computed,
|
|
700
|
+
Ft as Effect,
|
|
701
|
+
Rt as Route,
|
|
702
|
+
Vt as Router,
|
|
703
|
+
Gt as Signal
|
|
685
704
|
};
|
package/dist/xote.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(_=typeof globalThis<"u"?globalThis:_||self,v(_.xote={}))})(this,(function(_){"use strict";let v={contents:0};function N(){return v.contents=v.contents+1|0,v.contents}function Z(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function ee(e){if(e!=null)return Z(e)}function F(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function L(e,t){return e!==void 0?F(e):t}let V=(function(e,t){for(var n in e)t(n)});function C(e,t){if(e===t)return!0;let n=typeof e;if(n==="string"||n==="number"||n==="bigint"||n==="boolean"||n==="undefined"||e===null)return!1;let r=typeof t;if(n==="function"||r==="function")throw{RE_EXN_ID:"Invalid_argument",_1:"equal: functional value",Error:new Error};if(r==="number"||r==="bigint"||r==="undefined"||t===null)return!1;let l=e.TAG,i=t.TAG;if(l!==i)return!1;let o=e.length|0,u=t.length|0;if(o===u)if(Array.isArray(e)){let c=0;for(;;){let s=c;if(s===o)return!0;if(!C(e[s],t[s]))return!1;c=s+1|0}}else{if(e instanceof Date&&t instanceof Date)return!(e>t||e<t);{let c={contents:!0},s=f=>{if(!Object.prototype.hasOwnProperty.call(t,f)){c.contents=!1;return}},S=f=>{if(!Object.prototype.hasOwnProperty.call(e,f)||!C(t[f],e[f])){c.contents=!1;return}};return V(e,s),c.contents&&V(t,S),c.contents}}else return!1}let p=new Map,b=new Map,$=new Map,d={contents:void 0},k=new Set,M={contents:!1},g={contents:!1};function j(e){if(b.get(e)===void 0){b.set(e,new Set);return}}function te(e,t){j(t);let n=d.contents,r=p.get(e);if(n===void 0||r===void 0||n!==e||r.deps.has(t))return;r.deps.add(t);let l=b.get(t);if(l!==void 0){l.add(e);return}}function z(e){let t=$.get(e);if(t===void 0)return;$.delete(e);let n=p.get(t);if(n!==void 0){y(n),p.delete(t);return}}function y(e){e.deps.forEach(t=>{let n=b.get(t);if(n!==void 0)return n.delete(e.id),n.size===0&&!g.contents?z(t):void 0}),e.deps.clear()}function I(e){if(typeof e.kind=="object"){let r={contents:0};return e.deps.forEach(l=>{let i=b.get(l);if(i!==void 0){i.forEach(o=>{if(o===e.id)return;let u=p.get(o);if(u===void 0)return;if(typeof u.kind=="object"&&u.level>r.contents){r.contents=u.level;return}});return}}),r.contents+1|0}let n={contents:0};return e.deps.forEach(r=>{let l=b.get(r);if(l!==void 0){l.forEach(i=>{let o=p.get(i);if(o!==void 0&&o.level>n.contents){n.contents=o.level;return}});return}}),n.contents+1e3|0}function ne(){for(;k.size>0;){let e=Array.from(k.values());k.clear(),e.sort((t,n)=>{let r=p.get(t),l=p.get(n);return r!==void 0?l!==void 0?r.level-l.level|0:-1:l!==void 0?1:0}),e.forEach(t=>{let n=p.get(t);if(n===void 0)return;g.contents=!0,y(n);let r=d.contents;d.contents=t;try{n.run(),g.contents=!1}catch(l){throw d.contents=r,g.contents=!1,l}d.contents=r,n.level=I(n)})}}function re(e){j(e);let t=b.get(e);if(t!==void 0){if(t.forEach(n=>{k.add(n)}),M.contents)return;M.contents=!0,ne(),M.contents=!1;return}}function q(e,t,n){let r=N();return j(r),{id:r,value:{contents:e},version:{contents:0},equals:L(n,C),name:t}}function le(e){let t=d.contents;return t!==void 0&&te(t,e.id),e.value.contents}function ue(e){return e.value.contents}function P(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,re(e.id)}function ie(e,t){P(e,t(e.value.contents))}const oe=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Scheduler:void 0,get:le,make:q,peek:ue,set:P,update:ie},Symbol.toStringTag,{value:"Module"}));function X(e,t,n){return{id:e,kind:t,run:n,deps:new Set,level:0}}function ce(e){let t=N(),n={contents:void 0},l=X(t,"Effect",()=>{let u=n.contents;u!==void 0&&u(),n.contents=e()});p.set(t,l),g.contents=!0,y(l);let i=d.contents;d.contents=t;try{l.run(),g.contents=!1}catch(u){throw d.contents=i,g.contents=!1,u}return d.contents=i,l.level=I(l),{dispose:()=>{let u=p.get(t);if(u===void 0)return;let c=n.contents;c!==void 0&&c(),y(u),p.delete(t)}}}const ae=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,run:ce},Symbol.toStringTag,{value:"Module"}));function se(e){let t=q(void 0,void 0,void 0),n=N(),r=()=>{let o=e();P(t,o)},l=X(n,{NAME:"Computed",VAL:t.id},r);p.set(n,l),g.contents=!0,y(l);let i=d.contents;d.contents=n;try{l.run(),g.contents=!1}catch(o){throw d.contents=i,g.contents=!1,o}return d.contents=i,l.level=I(l),$.set(t.id,n),t}function de(e){z(e.id)}const fe=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,Signal:void 0,dispose:de,make:se},Symbol.toStringTag,{value:"Module"}));let a=oe,m=fe,E=ae;function pe(e,t){let n=e.length,r=new Array(n),l=0;for(let i=0;i<n;++i){let o=e[i],u=t(o);u!==void 0&&(r[l]=F(u),l=l+1|0)}return r.length=l,r}function he(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let l=t(e[r]);if(l!==void 0)return l;n=r+1|0}}function W(e){return pe(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function H(e,t){let n=t.split("/").filter(i=>i!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((i,o)=>{let u=n[o];return i.TAG==="Static"?u===i._0:(r[i._0]=u,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function D(e,t){return H(W(e),t)}const _e=Object.freeze(Object.defineProperty({__proto__:null,match:D,matchPath:H,parsePattern:W},Symbol.toStringTag,{value:"Module"}));function U(e,t){return[e,{TAG:"Static",_0:t}]}function me(e,t){return[e,{TAG:"SignalValue",_0:t}]}function Se(e,t){return[e,{TAG:"Compute",_0:t}]}function ge(e){return{TAG:"Text",_0:e}}function Ee(e){return{TAG:"SignalText",_0:m.make(e)}}function ve(e){return{TAG:"Fragment",_0:e}}function G(e){return{TAG:"SignalFragment",_0:e}}function be(e,t){return{TAG:"SignalFragment",_0:m.make(()=>a.get(e).map(t))}}function h(e,t,n,r,l){let i=t!==void 0?t:[].map(c=>c),o=n!==void 0?n:[].map(c=>c),u=r!==void 0?r:[].map(c=>c);return{TAG:"Element",tag:e,attrs:i,events:o,children:u}}function Te(e,t,n,r){return h("div",e,t,n)}function ye(e,t,n,r){return h("span",e,t,n)}function Ae(e,t,n,r){return h("button",e,t,n)}function Oe(e,t,n){return h("input",e,t,void 0)}function ke(e,t,n,r){return h("h1",e,t,n)}function we(e,t,n,r){return h("h2",e,t,n)}function Ne(e,t,n,r){return h("h3",e,t,n)}function Ce(e,t,n,r){return h("p",e,t,n)}function $e(e,t,n,r){return h("ul",e,t,n)}function Me(e,t,n,r){return h("li",e,t,n)}function J(e,t,n,r){return h("a",e,t,n)}function A(e,t){let n=L(ee(e.__xote_disposers),[]);e.__xote_disposers=n.concat([t])}function R(e){let t=e.__xote_disposers;t!=null&&(t.forEach(r=>r.dispose()),e.__xote_disposers=[]),Array.from(e.childNodes||[]).forEach(R)}function O(e){switch(e.TAG){case"Element":let t=document.createElement(e.tag);return e.attrs.forEach(s=>{let S=s[1],f=s[0];switch(S.TAG){case"Static":t.setAttribute(f,S._0);return;case"SignalValue":let w=S._0;t.setAttribute(f,a.peek(w));let at=E.run(()=>{let B=a.get(w);t.setAttribute(f,B)});return A(t,at);case"Compute":let st=S._0,Y=m.make(()=>st());t.setAttribute(f,a.peek(Y));let dt=E.run(()=>{let B=a.get(Y);t.setAttribute(f,B)});return A(t,dt)}}),e.events.forEach(s=>{t.addEventListener(s[0],s[1])}),e.children.forEach(s=>{let S=O(s);t.appendChild(S)}),t;case"Text":return document.createTextNode(e._0);case"SignalText":let n=e._0,r=document.createTextNode(a.peek(n)),l=E.run(()=>{let s=a.get(n);r.textContent=s});return A(r,l),r;case"Fragment":let i=document.createDocumentFragment();return e._0.forEach(s=>{let S=O(s);i.appendChild(S)}),i;case"SignalFragment":let o=e._0,u=document.createElement("div");u.setAttribute("data-signal-fragment","true"),u.setAttribute("style","display: contents");let c=E.run(()=>{let s=a.get(o);Array.from(u.childNodes||[]).forEach(R),u.innerHTML="",s.forEach(f=>{let w=O(f);u.appendChild(w)})});return A(u,c),u}}function K(e,t){let n=O(e);t.appendChild(n)}function je(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return K(e,n)}const Ie=Object.freeze(Object.defineProperty({__proto__:null,a:J,addDisposer:A,attr:U,button:Ae,computedAttr:Se,disposeElement:R,div:Te,element:h,fragment:ve,h1:ke,h2:we,h3:Ne,input:Oe,li:Me,list:be,mount:K,mountById:je,p:Ce,render:O,signalAttr:me,signalFragment:G,span:ye,text:ge,textSignal:Ee,ul:$e},Symbol.toStringTag,{value:"Module"}));let T=a.make({pathname:"/",search:"",hash:""},void 0,void 0);function x(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Pe(){a.set(T,x());let e=t=>a.set(T,x());window.addEventListener("popstate",e)}function Q(e,t,n,r){let l=t!==void 0?t:"",i=n!==void 0?n:"",o={pathname:e,search:l,hash:i},u=e+l+i,c={};window.history.pushState(c,"",u),a.set(T,o)}function De(e,t,n,r){let l=t!==void 0?t:"",i=n!==void 0?n:"",o={pathname:e,search:l,hash:i},u=e+l+i,c={};window.history.replaceState(c,"",u),a.set(T,o)}function Ge(e,t){return G(m.make(()=>{let n=a.get(T),r=D(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]}))}function Re(e){return G(m.make(()=>{let t=a.get(T),n=he(e,r=>{let l=D(r.pattern,t.pathname);if(typeof l=="object")return r.render(l._0)});return n!==void 0?[n]:[]}))}function xe(e,t,n,r){let l=t!==void 0?t:[],i=n!==void 0?n:[],o=u=>{u.preventDefault(),Q(e,void 0,void 0)};return J(l.concat([U("href",e)]),[["click",o]],i)}const Be=Object.freeze(Object.defineProperty({__proto__:null,Component:void 0,Route:void 0,getCurrentLocation:x,init:Pe,link:xe,location:T,push:Q,replace:De,route:Ge,routes:Re},Symbol.toStringTag,{value:"Module"}));let Fe=a.Id,Le=a.Scheduler,Ve=a.make,ze=a.get,qe=a.peek,Xe=a.set,We=a.update,He={Id:Fe,Scheduler:Le,make:Ve,get:ze,peek:qe,set:Xe,update:We},Ue=m.Id,Je=m.Signal,Ke=m.Observer,Qe=m.Scheduler,Ye=m.make,Ze=m.dispose,et={Id:Ue,Signal:Je,Observer:Ke,Scheduler:Qe,make:Ye,dispose:Ze},tt=E.Id,nt=E.Observer,rt=E.Scheduler,lt=E.run,ut={Id:tt,Observer:nt,Scheduler:rt,run:lt},it=Ie,ot=_e,ct=Be;_.Component=it,_.Computed=et,_.Effect=ut,_.Route=ot,_.Router=ct,_.Signal=He,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(h,b){typeof exports=="object"&&typeof module<"u"?b(exports):typeof define=="function"&&define.amd?define(["exports"],b):(h=typeof globalThis<"u"?globalThis:h||self,b(h.xote={}))})(this,(function(h){"use strict";let b={contents:0};function M(){return b.contents=b.contents+1|0,b.contents}function te(e){return e===void 0?{BS_PRIVATE_NESTED_SOME_NONE:0}:e!==null&&e.BS_PRIVATE_NESTED_SOME_NONE!==void 0?{BS_PRIVATE_NESTED_SOME_NONE:e.BS_PRIVATE_NESTED_SOME_NONE+1|0}:e}function ne(e){if(e!=null)return te(e)}function F(e){if(e===null||e.BS_PRIVATE_NESTED_SOME_NONE===void 0)return e;let t=e.BS_PRIVATE_NESTED_SOME_NONE;if(t!==0)return{BS_PRIVATE_NESTED_SOME_NONE:t-1|0}}function I(e,t){return e!==void 0?F(e):t}function re(e,t,n){return e.reduce(n,t)}function ue(e,t){let n=e.length,r=new Array(n),u=0;for(let l=0;l<n;++l){let c=e[l],i=t(c);i!==void 0&&(r[u]=F(i),u=u+1|0)}return r.length=u,r}function le(e,t){let n=0;for(;;){let r=n;if(r===e.length)return;let u=t(e[r]);if(u!==void 0)return u;n=r+1|0}}let f=new Map,T=new Map,O=new Map,a={contents:void 0},k=new Set,g={contents:!1},_={contents:!1};function j(e){if(T.get(e)===void 0){T.set(e,new Set);return}}function ie(e,t){let n=T.get(e);if(n!==void 0){n.forEach(t);return}}function oe(e,t){let n=T.get(e);if(n!==void 0){n.add(t);return}}function ce(e,t){let n=T.get(e);if(n!==void 0){n.delete(t);return}}function ae(e){return Array.from(I(T.get(e),new Set).values())}function L(e,t){let n=a.contents;a.contents=e;try{let r=t();return a.contents=n,r}catch(r){throw a.contents=n,r}}function de(e){let t=a.contents;a.contents=void 0;try{let n=e();return a.contents=t,n}catch(n){throw a.contents=t,n}}function fe(e){let t=a.contents;return t!==void 0?t===e:!1}function se(e){if(!g.contents){g.contents=!0;try{e(),g.contents=!1;return}catch(t){throw g.contents=!1,t}}}function pe(e,t){j(t);let n=fe(e),r=f.get(e);if(n&&r!==void 0&&!r.deps.has(t))return r.deps.add(t),oe(t,e)}function A(e){e.deps.forEach(t=>ce(t,e.id)),e.deps.clear()}function he(e){let t=O.get(e);if(t===void 0)return;O.delete(e);let n=f.get(t);if(n!==void 0){A(n),f.delete(t);return}}function V(e){return re(e,0,(t,n)=>n>t?n:t)}function me(e){let t=[];return e.deps.forEach(n=>ie(n,r=>{if(r===e.id)return;let u=f.get(r);if(u===void 0)return;if(typeof u.kind=="object"){t.push(u.level);return}})),V(t)+1|0}function _e(e){let t=[];return e.deps.forEach(n=>{let r=O.get(n);if(r===void 0||r===e.id)return;let u=f.get(r);if(u!==void 0){t.push(u.level);return}}),V(t)+1|0}function C(e){return typeof e.kind=="object"?_e(e):me(e)}function Se(e,t){let n=f.get(e),r=f.get(t);if(n===void 0)return r!==void 0?1:0;if(r===void 0)return-1;let l=typeof n.kind=="object"?0:1,i=typeof r.kind=="object"?0:1,d=l-i|0;return d!==0?d:n.level-r.level|0}function ge(e){_.contents=!0,A(e),L(e.id,()=>{e.run(),_.contents=!1}),e.level=C(e)}function B(){for(;k.size>0;){let e=Array.from(k.values());k.clear(),e.sort(Se),e.forEach(t=>{let n=f.get(t);if(n!==void 0)return ge(n)})}}function z(e){if(j(e),ae(e).forEach(t=>{let n=f.get(t);if(n===void 0)return;let r=n.kind;if(typeof r=="object")return n.dirty?void 0:(n.dirty=!0,z(r.VAL));k.add(t)}),k.size>0)return se(B)}function W(e){let t=O.get(e);if(t===void 0)return;let n=f.get(t);if(n!==void 0&&n.dirty){_.contents=!0,A(n),L(t,()=>{n.run(),n.dirty=!1,_.contents=!1}),n.level=C(n);return}}function Ee(e){let t=g.contents;g.contents=!0;try{let n=e();return t||(g.contents=!1,k.size>0&&B()),n}catch(n){throw t||(g.contents=!1),n}}let be=de,ve=j;function X(e,t,n){let r=M();return ve(r),{id:r,value:{contents:e},version:{contents:0},equals:I(n,(u,l)=>u===l),name:t}}function ye(e){W(e.id);let t=a.contents;return t!==void 0&&pe(t,e.id),e.value.contents}function Te(e){return W(e.id),e.value.contents}function q(e,t){let n;try{n=!e.equals(e.value.contents,t)}catch{n=!0}if(n)return e.value.contents=t,e.version.contents=e.version.contents+1|0,z(e.id)}function ke(e,t){q(e,t(e.value.contents))}const Ae=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Scheduler:void 0,batch:Ee,get:ye,make:X,peek:Te,set:q,untrack:be,update:ke},Symbol.toStringTag,{value:"Module"}));function H(e,t,n){return{id:e,kind:t,run:n,deps:new Set,level:0,dirty:!0}}function Oe(e){let t=M(),n={contents:void 0},u=H(t,"Effect",()=>{let i=n.contents;i!==void 0&&i(),n.contents=e()});f.set(t,u),_.contents=!0,A(u);let l=a.contents;a.contents=t;try{u.run(),_.contents=!1}catch(i){throw a.contents=l,_.contents=!1,i}return a.contents=l,u.level=C(u),{dispose:()=>{let i=f.get(t);if(i===void 0)return;let d=n.contents;d!==void 0&&d(),A(i),f.delete(t)}}}const we=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,run:Oe},Symbol.toStringTag,{value:"Module"}));function $e(e){let t=X(void 0,void 0,void 0),n=M(),r=()=>{let c=e();t.value.contents=c},u=H(n,{NAME:"Computed",VAL:t.id},r);f.set(n,u),_.contents=!0,A(u);let l=a.contents;a.contents=n;try{u.run(),u.dirty=!1,_.contents=!1}catch(c){throw a.contents=l,_.contents=!1,c}return a.contents=l,u.level=C(u),O.set(t.id,n),t}function Ce(e){he(e.id)}const Ne=Object.freeze(Object.defineProperty({__proto__:null,Id:void 0,Observer:void 0,Scheduler:void 0,Signal:void 0,dispose:Ce,make:$e},Symbol.toStringTag,{value:"Module"}));let o=Ae,m=Ne,E=we;function U(e){return ue(e.split("/"),t=>{if(t!=="")return t.startsWith(":")?{TAG:"Param",_0:t.slice(1)}:{TAG:"Static",_0:t}})}function J(e,t){let n=t.split("/").filter(l=>l!=="");if(e.length!==n.length)return"NoMatch";let r={};return e.every((l,c)=>{let i=n[c];return l.TAG==="Static"?i===l._0:(r[l._0]=i,!0)})?{TAG:"Match",_0:r}:"NoMatch"}function P(e,t){return J(U(e),t)}const Me=Object.freeze(Object.defineProperty({__proto__:null,match:P,matchPath:J,parsePattern:U},Symbol.toStringTag,{value:"Module"}));function K(e,t){return[e,{TAG:"Static",_0:t}]}function Ie(e,t){return[e,{TAG:"SignalValue",_0:t}]}function je(e,t){return[e,{TAG:"Compute",_0:t}]}function Pe(e){return{TAG:"Text",_0:e}}function Re(e){return{TAG:"SignalText",_0:m.make(e)}}function Ge(e){return{TAG:"Fragment",_0:e}}function R(e){return{TAG:"SignalFragment",_0:e}}function De(e,t){return{TAG:"SignalFragment",_0:m.make(()=>o.get(e).map(t))}}function p(e,t,n,r,u){let l=t!==void 0?t:[].map(d=>d),c=n!==void 0?n:[].map(d=>d),i=r!==void 0?r:[].map(d=>d);return{TAG:"Element",tag:e,attrs:l,events:c,children:i}}function xe(e,t,n,r){return p("div",e,t,n)}function Fe(e,t,n,r){return p("span",e,t,n)}function Le(e,t,n,r){return p("button",e,t,n)}function Ve(e,t,n){return p("input",e,t,void 0)}function Be(e,t,n,r){return p("h1",e,t,n)}function ze(e,t,n,r){return p("h2",e,t,n)}function We(e,t,n,r){return p("h3",e,t,n)}function Xe(e,t,n,r){return p("p",e,t,n)}function qe(e,t,n,r){return p("ul",e,t,n)}function He(e,t,n,r){return p("li",e,t,n)}function Q(e,t,n,r){return p("a",e,t,n)}function w(e,t){let n=I(ne(e.__xote_disposers),[]);e.__xote_disposers=n.concat([t])}function G(e){let t=e.__xote_disposers;t!=null&&(t.forEach(r=>r.dispose()),e.__xote_disposers=[]),Array.from(e.childNodes||[]).forEach(G)}function $(e){switch(e.TAG){case"Element":let t=document.createElement(e.tag);return e.attrs.forEach(s=>{let S=s[1],y=s[0];switch(S.TAG){case"Static":t.setAttribute(y,S._0);return;case"SignalValue":let N=S._0;t.setAttribute(y,o.peek(N));let wt=E.run(()=>{let x=o.get(N);t.setAttribute(y,x)});return w(t,wt);case"Compute":let $t=S._0,ee=m.make(()=>$t());t.setAttribute(y,o.peek(ee));let Ct=E.run(()=>{let x=o.get(ee);t.setAttribute(y,x)});return w(t,Ct)}}),e.events.forEach(s=>{t.addEventListener(s[0],s[1])}),e.children.forEach(s=>{let S=$(s);t.appendChild(S)}),t;case"Text":return document.createTextNode(e._0);case"SignalText":let n=e._0,r=document.createTextNode(o.peek(n)),u=E.run(()=>{let s=o.get(n);r.textContent=s});return w(r,u),r;case"Fragment":let l=document.createDocumentFragment();return e._0.forEach(s=>{let S=$(s);l.appendChild(S)}),l;case"SignalFragment":let c=e._0,i=document.createElement("div");i.setAttribute("data-signal-fragment","true"),i.setAttribute("style","display: contents");let d=E.run(()=>{let s=o.get(c);Array.from(i.childNodes||[]).forEach(G),i.innerHTML="",s.forEach(y=>{let N=$(y);i.appendChild(N)})});return w(i,d),i}}function Y(e,t){let n=$(e);t.appendChild(n)}function Ue(e,t){let n=document.getElementById(t);if(n==null){console.error("Container element not found: "+t);return}else return Y(e,n)}const Je=Object.freeze(Object.defineProperty({__proto__:null,a:Q,addDisposer:w,attr:K,button:Le,computedAttr:je,disposeElement:G,div:xe,element:p,fragment:Ge,h1:Be,h2:ze,h3:We,input:Ve,li:He,list:De,mount:Y,mountById:Ue,p:Xe,render:$,signalAttr:Ie,signalFragment:R,span:Fe,text:Pe,textSignal:Re,ul:qe},Symbol.toStringTag,{value:"Module"}));let v=o.make({pathname:"/",search:"",hash:""},void 0,void 0);function D(){return{pathname:window.location.pathname,search:window.location.search,hash:window.location.hash}}function Ke(){o.set(v,D());let e=t=>o.set(v,D());window.addEventListener("popstate",e)}function Z(e,t,n,r){let u=t!==void 0?t:"",l=n!==void 0?n:"",c={pathname:e,search:u,hash:l},i=e+u+l,d={};window.history.pushState(d,"",i),o.set(v,c)}function Qe(e,t,n,r){let u=t!==void 0?t:"",l=n!==void 0?n:"",c={pathname:e,search:u,hash:l},i=e+u+l,d={};window.history.replaceState(d,"",i),o.set(v,c)}function Ye(e,t){return R(m.make(()=>{let n=o.get(v),r=P(e,n.pathname);return typeof r!="object"?[]:[t(r._0)]}))}function Ze(e){return R(m.make(()=>{let t=o.get(v),n=le(e,r=>{let u=P(r.pattern,t.pathname);if(typeof u=="object")return r.render(u._0)});return n!==void 0?[n]:[]}))}function et(e,t,n,r){let u=t!==void 0?t:[],l=n!==void 0?n:[],c=i=>{i.preventDefault(),Z(e,void 0,void 0)};return Q(u.concat([K("href",e)]),[["click",c]],l)}const tt=Object.freeze(Object.defineProperty({__proto__:null,Component:void 0,Route:void 0,getCurrentLocation:D,init:Ke,link:et,location:v,push:Z,replace:Qe,route:Ye,routes:Ze},Symbol.toStringTag,{value:"Module"}));let nt=o.Id,rt=o.Scheduler,ut=o.make,lt=o.get,it=o.peek,ot=o.set,ct=o.update,at=o.batch,dt=o.untrack,ft={Id:nt,Scheduler:rt,make:ut,get:lt,peek:it,set:ot,update:ct,batch:at,untrack:dt},st=m.Id,pt=m.Signal,ht=m.Observer,mt=m.Scheduler,_t=m.make,St=m.dispose,gt={Id:st,Signal:pt,Observer:ht,Scheduler:mt,make:_t,dispose:St},Et=E.Id,bt=E.Observer,vt=E.Scheduler,yt=E.run,Tt={Id:Et,Observer:bt,Scheduler:vt,run:yt},kt=Je,At=Me,Ot=tt;h.Component=kt,h.Computed=gt,h.Effect=Tt,h.Route=At,h.Router=Ot,h.Signal=ft,Object.defineProperty(h,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xote",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "https://github.com/brnrdog/xote"
|
|
6
6
|
},
|
|
@@ -77,6 +77,6 @@
|
|
|
77
77
|
"vite": "^7.1.12"
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
|
-
"rescript-signals": "^1.0
|
|
80
|
+
"rescript-signals": "^1.2.0"
|
|
81
81
|
}
|
|
82
82
|
}
|