@krate/runtime 0.4.0-beta.2 → 0.4.0-beta.4

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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export { createSignal, createEffect, createMemo, onCleanup, onMount, forwardRef, useRef, disposeAll } from './signal.js';
1
+ export { createSignal, createCSSChoice, createCSSToggle, createCSSFlags, createCSSGroup, createCSSRange, createCSSStack, createEffect, createMemo, onCleanup, onMount, forwardRef, useRef, disposeAll } from './signal.js';
2
+ export type { CSSARIAOptions, CSSVars, CSSPrimitiveOptions, CSSStackActions } from './signal.js';
2
3
  export { h, mount, hydrate, insert, clearNodes, disposeNode } from './dom.js';
3
4
  export { Fragment, jsx, jsxs } from './jsx-runtime.js';
4
5
  export { initRouter, reinitRouter } from './router.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { createSignal, createEffect, createMemo, onCleanup, onMount, forwardRef, useRef, disposeAll } from './signal.js';
1
+ export { createSignal, createCSSChoice, createCSSToggle, createCSSFlags, createCSSGroup, createCSSRange, createCSSStack, createEffect, createMemo, onCleanup, onMount, forwardRef, useRef, disposeAll } from './signal.js';
2
2
  export { h, mount, hydrate, insert, clearNodes, disposeNode } from './dom.js';
3
3
  export { Fragment, jsx, jsxs } from './jsx-runtime.js';
4
4
  export { initRouter, reinitRouter } from './router.js';
@@ -26,6 +26,18 @@ declare global {
26
26
  interface ElementChildrenAttribute {
27
27
  children: {};
28
28
  }
29
+ /**
30
+ * Attributes accepted by every JSX element (intrinsic and component).
31
+ * `showIf` (and its alias `visibleIf`) conditionally render the element:
32
+ * `<X showIf={expr}>` is sugar for `{expr && <X>}`, compiled at build time.
33
+ * Both are compiler-erased and never reach emitted HTML or component props.
34
+ */
35
+ interface IntrinsicAttributes {
36
+ /** Conditionally render this element (sugar for `{expr && <el/>}`). */
37
+ showIf?: unknown;
38
+ /** Alias of `showIf`. */
39
+ visibleIf?: unknown;
40
+ }
29
41
  type Booleanish = boolean | 'true' | 'false';
30
42
  type CSSProperties = Record<string, string | number>;
31
43
  interface AriaAttributes {
@@ -182,7 +194,7 @@ declare global {
182
194
  onVolumeChange?: EventHandler<Event>;
183
195
  onWaiting?: EventHandler<Event>;
184
196
  }
185
- interface DOMAttributes {
197
+ interface DOMAttributes extends IntrinsicAttributes {
186
198
  children?: unknown[] | unknown;
187
199
  key?: string | number;
188
200
  /** Assigns the mounted DOM element. Pass a mutable holder (`ref={myRef}`), a callback (`ref={el => ...}`), or an element. */
@@ -631,7 +643,7 @@ declare global {
631
643
  width?: number | string;
632
644
  disablePictureInPicture?: boolean;
633
645
  }
634
- interface SVGAttributes extends AriaAttributes {
646
+ interface SVGAttributes extends AriaAttributes, IntrinsicAttributes {
635
647
  children?: unknown[] | unknown;
636
648
  key?: string | number;
637
649
  ref?: ((el: globalThis.Element) => void) | {
@@ -1,2 +1,2 @@
1
- var __krate_exports=(()=>{var D=Object.defineProperty,je=Object.defineProperties,Be=Object.getOwnPropertyDescriptor,Ke=Object.getOwnPropertyDescriptors,Ue=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols;var ye=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var ge=(e,t,n)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ee=(e,t)=>{for(var n in t||(t={}))ye.call(t,n)&&ge(e,n,t[n]);if(me)for(var n of me(t))We.call(t,n)&&ge(e,n,t[n]);return e},Te=(e,t)=>je(e,Ke(t));var Fe=(e,t)=>{for(var n in t)D(e,n,{get:t[n],enumerable:!0})},$e=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Ue(t))!ye.call(e,c)&&c!==n&&D(e,c,{get:()=>t[c],enumerable:!(r=Be(t,c))||r.enumerable});return e};var ze=e=>$e(D({},"__esModule",{value:!0}),e);var pt={};Fe(pt,{clearNodes:()=>xe,conditional:()=>at,createEffect:()=>w,createMemo:()=>Ze,createResource:()=>ct,createSignal:()=>C,disposeAll:()=>Xe,disposeNode:()=>x,forwardRef:()=>tt,h:()=>rt,hydrate:()=>st,initRouter:()=>Re,insert:()=>ot,mount:()=>it,onCleanup:()=>X,onMount:()=>Ge,reconcile:()=>lt,reconcileTrees:()=>Z,reinitRouter:()=>dt,useRef:()=>et});var L=[],be=[],W=!1,H=new Set,F=[],$=[],I=!1;function ve(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function z(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function Xe(){for(let e of H)z(e);H.clear();for(let e of F)try{e()}catch(t){}F.length=0,$.length=0,I=!1}function C(e){let t=e,n=new Set;return[()=>{let f=L[L.length-1];return f&&!f.disposed&&(n.add(f),f.sources.add(n)),t},f=>{let u=typeof f=="function"?f(t):f;if(u!==t){t=u;let y=Array.from(n);for(let h of y){if(h.disposed){n.delete(h);continue}if(h.running){h.rerun=!0;continue}h.queued||(h.queued=!0,$.push(h))}Ye()}}]}function Ye(){I||(I=!0,queueMicrotask(Qe))}function Qe(){I=!1;let e=$.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,V(t),t.rerun&&!t.disposed&&(t.rerun=!1,V(t)))}function V(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,L.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{L.pop(),e.running=!1}}function w(e){let t=ve(e);return H.add(t),V(t),()=>{z(t),H.delete(t)}}function X(e){let t=L[L.length-1];t?t.cleanups.push(e):F.push(e)}function Ge(e){be.push(e),W||(W=!0,queueMicrotask(Je))}function Je(){W=!1;let e=be.splice(0);for(let t of e)t()}function Ze(e){let[t,n]=C(void 0),r=ve(()=>{let f=e();n(f)});H.add(r),V(r);let c=L[L.length-1];return c&&c.cleanups.push(()=>{r.disposed||(z(r),H.delete(r))}),t}function et(e){return{current:e}}function tt(e){return t=>e(t,t.ref||(()=>{}))}var Y=new WeakMap;function Se(e,t){let n=Y.get(e);n||(n=[],Y.set(e,n)),n.push(t)}function x(e){let t=Y.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)x(e.childNodes[n])}function nt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function xe(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let c=r.nextSibling;x(r),n.removeChild(r),r=c}}function ot(e,t,n){let r=nt(n);r?(xe(n,r),Q(e,t,r)):Q(e,t,null)}function Q(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)Q(e,r,n)}}function Ne(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),c=`__krate_${r}`,f=e[c];f&&e.removeEventListener(r,f),e.addEventListener(r,n),e[c]=n}else t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function Ae(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)Ae(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),Se(n,w(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function rt(e,t,...n){if(typeof e=="function")return e(Te(Ee({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[c,f]of Object.entries(t))typeof f=="function"&&!c.startsWith("on")?Se(r,w(()=>Ne(r,c,f()))):Ne(r,c,f);for(let c of n)Ae(r,c);return r}function ke(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function it(e,t){let n=ke(t),r=!1;w(()=>{r||(r=!0,n.appendChild(e()))})}function st(e,t){let n=ke(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&x(r)}function ct(e,t){let[n,r]=C(void 0),[c,f]=C(!0),[u,y]=C(void 0),[h,m]=C("unresolved"),[v,d]=C(0),l,g=()=>typeof e=="function"?e():e,T=async()=>{l&&l.abort(),l=new AbortController;let A=l,q=g();m(v()>0?"refreshing":"loading"),f(!0),y(void 0);try{let k=await t(q,{signal:A.signal});A.signal.aborted||(r(()=>k),m("ready"))}catch(k){(k==null?void 0:k.name)!=="AbortError"&&!A.signal.aborted&&(y(k),m("error"))}finally{A.signal.aborted||f(!1)}};w(()=>{typeof e=="function"&&e.length===0&&e(),v(),T(),X(()=>{l&&(l.abort(),l=void 0)})});let E=function(){return n()};return Object.defineProperties(E,{loading:{get:()=>c()},error:{get:()=>u()},state:{get:()=>h()}}),[E,{mutate:A=>{r(A)},refetch:()=>{d(A=>A+1)}}]}function lt(e,t,n,r,c,f){let u=[],y=t.nextSibling;for(;y&&y!==n;)u.push(y),y=y.nextSibling;if(f){let h=new Map;for(let d of u){let l=d.__k;l!=null&&h.set(l,d)}let m=[],v=new Set;for(let d=0;d<r.length;d++){let l=r[d],g=f(l);v.add(g);let T=c(l,d);T.__k=g,m.push(T)}for(let[d,l]of h)!v.has(d)&&l.parentNode===e&&(x(l),e.removeChild(l));for(let d=0;d<m.length;d++){let l=m[d],g=d===0?t:m[d-1];l!==g.nextSibling&&e.insertBefore(l,g.nextSibling)}}else{let h=Math.max(u.length,r.length);for(let m=0;m<h;m++)if(m<r.length){let v=c(r[m],m);m<u.length?u[m]!==v&&(x(u[m]),e.replaceChild(v,u[m])):e.insertBefore(v,n)}else m<u.length&&u[m].parentNode===e&&(x(u[m]),e.removeChild(u[m]))}}function at(e,t,n,r,c,f){let u=null;w(()=>{let h=r()?c():f?f():null;u?h?(x(u),e.replaceChild(h,u)):(x(u),e.removeChild(u)):h&&e.insertBefore(h,n),u=h})}function P(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function we(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let c=t.attributes[r].name,f=t.attributes[r].value;n.add(c),e.getAttribute(c)!==f&&e.setAttribute(c,f)}for(let r=0;r<e.attributes.length;r++){let c=e.attributes[r].name;n.has(c)||e.removeAttribute(c)}}function G(e,t){let n=document.importNode(t,!0);return e.parentNode&&(x(e),e.parentNode.replaceChild(n,e)),n}function Le(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function J(e,t){if(!Le(e,t))return G(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?G(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return P(n)!==P(r)?G(n,r):(we(n,r),Ce(n,r),n)}function Ce(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let d=!0;for(let l=0;l<r.length;l++)if(P(n[l])!==P(r[l])){d=!1;break}if(d){for(let l=0;l<r.length;l++)J(n[l],r[l]);return}}let c=new Map,f=[];n.forEach((d,l)=>{let g=P(d);g!=null?c.has(g)||c.set(g,l):f.push(l)});let u=new Set,y=0,h=null,m=0,v=()=>{for(;m<f.length&&u.has(f[m]);)m++;return m<f.length?f[m]:-1};for(let d of r){let l=P(d),g;if(l!=null&&c.has(l)){let T=c.get(l);c.delete(l),u.add(T);let E=n[T];T<y?e.insertBefore(E,h):y=T,g=J(E,d)}else if(l==null){let T=v();if(T>=0&&Le(n[T],d)){u.add(T);let E=n[T];E.parentNode===e&&E.nextSibling!==h&&e.insertBefore(E,h),g=J(E,d)}else g=document.importNode(d,!0),e.insertBefore(g,h)}else g=document.importNode(d,!0),e.insertBefore(g,h);h=g.nextSibling}n.forEach((d,l)=>{!u.has(l)&&d.parentNode===e&&(x(d),e.removeChild(d))})}function Z(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let c=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(c,n);return}we(n,r),Ce(n,r)}var ee=!1,_,j=null,M=new Map,ft=30,O=new Map,ut=50,Me=/\/chunks\/runtime\.[^/]+\.js$/;function Re(){if(typeof document=="undefined"||ee)return;ee=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,c=null,f=new Map,u=null;function y(o){for(let i of e.split(", ")){let s=o.querySelector(i.trim());if(s)return s}return o.body}function h(o){if(o.hasAttribute("data-krate-external"))return!1;let i=o.getAttribute("href");return!(!i||i.startsWith("#")||i.startsWith("javascript:")||o.origin!==location.origin||o.target==="_blank")}function m(o){M.has(o)||fetch(o,{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>{if(i){if(M.size>=ft){let s=M.keys().next().value;s!==void 0&&M.delete(s)}M.set(o,i)}}).catch(()=>{})}function v(){document.addEventListener("mouseover",g),document.addEventListener("focusin",g),typeof IntersectionObserver!="undefined"&&(u=new IntersectionObserver(o=>{for(let i of o)if(i.isIntersecting){let s=i.target,a=s.getAttribute("href");if(a&&h(s)){let p=new URL(a,location.origin).href;m(p)}u.unobserve(i.target)}},{rootMargin:"200px"}),d())}function d(){u&&document.querySelectorAll("a[data-prefetch]").forEach(o=>{u.observe(o)})}function l(){document.removeEventListener("mouseover",g),document.removeEventListener("focusin",g);for(let o of f.values())clearTimeout(o);f.clear(),u&&(u.disconnect(),u=null)}function g(o){let i=o.target.closest("a[data-prefetch]");if(!i||!h(i))return;let s=i.getAttribute("href");if(!s)return;let a=new URL(s,location.origin).href;if(M.has(a))return;let p=f.get(i);p&&clearTimeout(p);let b=setTimeout(()=>{f.delete(i),m(a)},n);f.set(i,b)}function T(o){let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT),s=i.nextNode();for(;s;){let a=s;for(let p of Object.keys(a))p.indexOf("__krate_")===0&&delete a[p];s=i.nextNode()}}let E=null;function te(){let o=y(document),i=document.querySelector("template[data-krate-loading]");i&&i.content&&o&&(E=i.content.cloneNode(!0),document.body.appendChild(E)),o&&(o.style.transition=`opacity ${t}ms ease`,o.style.opacity="0")}function A(){E&&E.parentNode&&E.parentNode.removeChild(E),E=null;let o=y(document);o&&(o.style.opacity="1")}function q(o){try{let i=globalThis.__krate_onNavigation;typeof i=="function"&&i(o)}catch(i){}}function k(o,i,s,a={}){let{replace:p=!1,scroll:b=!0,restoreScroll:R=!1}=a,B=new DOMParser().parseFromString(o,"text/html"),fe=y(B),K=y(document);if(!fe||!K){location.href=i;return}let ue=B.querySelector("title");ue&&(document.title=ue.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),T(K),Z(K,fe);let de=B.querySelectorAll('link[rel="stylesheet"]'),pe=new Set;de.forEach(N=>{let S=N.getAttribute("href");S&&pe.add(S)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(N=>{let S=N.getAttribute("href");S&&!pe.has(S)&&N.remove()});let he=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(N=>{he.add(N.href)}),de.forEach(N=>{let S=N.getAttribute("href");if(S&&!he.has(S)){let U=document.createElement("link");U.rel="stylesheet",U.href=S,document.head.appendChild(U)}}),Pe(s,i).then(()=>{try{Oe(),d()}catch(N){try{let S=globalThis.__krate_onHydrationError;typeof S=="function"&&S(N)}catch(S){}location.href=i}}),A();let Ve=location.pathname+location.search;if(p)history.replaceState({},"",i);else{if(!R){if(O.size>=ut){let N=O.keys().next().value;N!==void 0&&O.delete(N)}O.set(Ve,window.scrollY)}history.pushState({},"",i)}ne(i,{restoreScroll:R,scroll:b}),oe(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:i}})),q(i)}function He(o){let i=o.indexOf("#");if(i<0||i===o.length-1)return!1;let s=o.slice(i);try{let a=document.querySelector(s);if(a)return a.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(a){return!1}return!1}function ne(o,i){if(i.restoreScroll){let s=O.get(o);if(s!==void 0){window.scrollTo(0,s);return}}He(o)||i.scroll&&window.scrollTo(0,0)}function oe(){let o=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(i=>{let s=i.getAttribute("href");if(!s){i.removeAttribute("aria-current");return}let a=s;try{a=new URL(s,location.origin).pathname}catch(b){return}a===o||o==="/"&&(a===""||a==="/")||a!=="/"&&a.length>1&&o.startsWith(a)?i.setAttribute("aria-current","page"):i.removeAttribute("aria-current")})}function Pe(o,i){return o.length===0?Promise.resolve():Promise.all(o.map(s=>{let a=s.getAttribute("src");return a?_e(a,i):Promise.resolve()})).then(()=>{})}function _e(o,i){return new Promise(s=>{let a=document.createElement("script"),p=re(o,i);a.src=p,Me.test(p)||a.setAttribute("data-krate-spa",""),a.onload=()=>s(),a.onerror=()=>s(),document.body.appendChild(a)})}function re(o,i){if(/^(https?:)?\/\//.test(o)||o.startsWith("/"))return new URL(o,i).href;let s=i;if(!s.endsWith("/")){let a=s.lastIndexOf("/");s=a>0?s.slice(0,a+1):"/"}return new URL(o,s).href}function Oe(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function qe(o,i){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",i),q(i),document.open(),document.write(o),document.close()}function De(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(r=o,o)).catch(()=>null)}function Ie(){return c!==null?Promise.resolve(c):fetch("/500.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(c=o,o)).catch(()=>null)}function ie(o,i){document.querySelectorAll("script[data-krate-spa]").forEach(p=>p.remove());let s=[],a=new Set;return document.querySelectorAll("script[src]").forEach(p=>{a.add(p.src)}),o.querySelectorAll("script[src]").forEach(p=>{let b=p.getAttribute("src");b&&!a.has(re(b,i))&&s.push(p)}),s}function se(o,i={}){let s=M.get(o);if(s){let b=new DOMParser().parseFromString(s,"text/html");k(s,o,ie(b,o),i);return}te(),_&&_.abort(),_=new AbortController;let a=_.signal;fetch(o,{headers:{Accept:"text/html"},signal:a}).then(p=>p.ok?p.text().then(b=>{let ae=new DOMParser().parseFromString(b,"text/html");k(b,o,ie(ae,o),i)}):(p.status>=500?Ie():De()).then(R=>{R?qe(R,o):location.href=o})).catch(p=>{(p==null?void 0:p.name)!=="AbortError"&&(A(),location.href=o)}).finally(()=>{_&&!a.aborted&&(_=void 0)})}let ce=o=>{if(o.defaultPrevented||o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;let i=o.target.closest("a[data-krate-link]");if(!i||!h(i))return;o.preventDefault();let s=i.getAttribute("href");if(!s)return;let a=new URL(s,location.origin).href,p=i.hasAttribute("data-krate-replace"),b=i.getAttribute("data-krate-scroll")!=="false";if(s===location.pathname+location.search+location.hash){p&&history.replaceState({},"",s),ne(a,{scroll:b});return}se(a,{replace:p,scroll:b})},le=()=>{se(location.href,{restoreScroll:!0})};document.addEventListener("click",ce),window.addEventListener("popstate",le),v(),oe(),document.querySelectorAll("script[src]").forEach(o=>{Me.test(o.src)||o.setAttribute("data-krate-spa","")}),j=()=>{document.removeEventListener("click",ce),window.removeEventListener("popstate",le),l()}}function dt(){j&&(j(),j=null),ee=!1,Re()}return ze(pt);})();
1
+ var __krate_exports=(()=>{var q=Object.defineProperty,Ve=Object.defineProperties,je=Object.getOwnPropertyDescriptor,Be=Object.getOwnPropertyDescriptors,Ue=Object.getOwnPropertyNames,me=Object.getOwnPropertySymbols;var Te=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable;var ge=(e,t,n)=>t in e?q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ye=(e,t)=>{for(var n in t||(t={}))Te.call(t,n)&&ge(e,n,t[n]);if(me)for(var n of me(t))We.call(t,n)&&ge(e,n,t[n]);return e},be=(e,t)=>Ve(e,Be(t));var Fe=(e,t)=>{for(var n in t)q(e,n,{get:t[n],enumerable:!0})},$e=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ue(t))!Te.call(e,s)&&s!==n&&q(e,s,{get:()=>t[s],enumerable:!(r=je(t,s))||r.enumerable});return e};var ze=e=>$e(q({},"__esModule",{value:!0}),e);var bt={};Fe(bt,{clearNodes:()=>Ne,conditional:()=>mt,createCSSChoice:()=>Ye,createCSSFlags:()=>Qe,createCSSGroup:()=>Je,createCSSRange:()=>Ze,createCSSStack:()=>et,createCSSToggle:()=>Ge,createEffect:()=>w,createMemo:()=>it,createResource:()=>pt,createSignal:()=>N,disposeAll:()=>Xe,disposeNode:()=>A,forwardRef:()=>ct,h:()=>ft,hydrate:()=>dt,initRouter:()=>Re,insert:()=>at,mount:()=>ut,onCleanup:()=>X,onMount:()=>ot,reconcile:()=>ht,reconcileTrees:()=>Z,reinitRouter:()=>yt,useRef:()=>st});var L=[],Se=[],W=!1,_=new Set,F=[],$=[],I=!1;function Ee(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function z(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function Xe(){for(let e of _)z(e);_.clear();for(let e of F)try{e()}catch(t){}F.length=0,$.length=0,I=!1}function Ye(e,t){return N(e)}function Ge(e,t){return N(e)}function Qe(e,t){let n={};for(let s of e){let[l]=N(!1);n[s]=l}return[n,(s,l)=>{}]}function Je(e,t){return N(e)}function Ze(e,t){return N(e)}function et(e,t){let n=()=>e[0];return[{top:n,peek:n},{push:r=>{},pop:()=>{},clear:()=>{}}]}function N(e){let t=e,n=new Set;return[()=>{let l=L[L.length-1];return l&&!l.disposed&&(n.add(l),l.sources.add(n)),t},l=>{let u=typeof l=="function"?l(t):l;if(u!==t){t=u;let T=Array.from(n);for(let h of T){if(h.disposed){n.delete(h);continue}if(h.running){h.rerun=!0;continue}h.queued||(h.queued=!0,$.push(h))}tt()}}]}function tt(){I||(I=!0,queueMicrotask(nt))}function nt(){I=!1;let e=$.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,D(t),t.rerun&&!t.disposed&&(t.rerun=!1,D(t)))}function D(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,L.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{L.pop(),e.running=!1}}function w(e){let t=Ee(e);return _.add(t),D(t),()=>{z(t),_.delete(t)}}function X(e){let t=L[L.length-1];t?t.cleanups.push(e):F.push(e)}function ot(e){Se.push(e),W||(W=!0,queueMicrotask(rt))}function rt(){W=!1;let e=Se.splice(0);for(let t of e)t()}function it(e){let[t,n]=N(void 0),r=Ee(()=>{let l=e();n(l)});_.add(r),D(r);let s=L[L.length-1];return s&&s.cleanups.push(()=>{r.disposed||(z(r),_.delete(r))}),t}function st(e){return{current:e}}function ct(e){return t=>e(t,t.ref||(()=>{}))}var Y=new WeakMap;function xe(e,t){let n=Y.get(e);n||(n=[],Y.set(e,n)),n.push(t)}function A(e){let t=Y.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)A(e.childNodes[n])}function lt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Ne(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let s=r.nextSibling;A(r),n.removeChild(r),r=s}}function at(e,t,n){let r=lt(n);r?(Ne(n,r),G(e,t,r)):G(e,t,null)}function G(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)G(e,r,n)}}function ve(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),s=`__krate_${r}`,l=e[s];l&&e.removeEventListener(r,l),e.addEventListener(r,n),e[s]=n}else t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function Ae(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)Ae(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),xe(n,w(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function ft(e,t,...n){if(typeof e=="function")return e(be(ye({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[s,l]of Object.entries(t))typeof l=="function"&&!s.startsWith("on")?xe(r,w(()=>ve(r,s,l()))):ve(r,s,l);for(let s of n)Ae(r,s);return r}function ke(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function ut(e,t){let n=ke(t),r=!1;w(()=>{r||(r=!0,n.appendChild(e()))})}function dt(e,t){let n=ke(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&A(r)}function pt(e,t){let[n,r]=N(void 0),[s,l]=N(!0),[u,T]=N(void 0),[h,m]=N("unresolved"),[E,d]=N(0),a,g=()=>typeof e=="function"?e():e,b=async()=>{a&&a.abort(),a=new AbortController;let k=a,K=g();m(E()>0?"refreshing":"loading"),l(!0),T(void 0);try{let C=await t(K,{signal:k.signal});k.signal.aborted||(r(()=>C),m("ready"))}catch(C){(C==null?void 0:C.name)!=="AbortError"&&!k.signal.aborted&&(T(C),m("error"))}finally{k.signal.aborted||l(!1)}};w(()=>{typeof e=="function"&&e.length===0&&e(),E(),b(),X(()=>{a&&(a.abort(),a=void 0)})});let y=function(){return n()};return Object.defineProperties(y,{loading:{get:()=>s()},error:{get:()=>u()},state:{get:()=>h()}}),[y,{mutate:k=>{r(k)},refetch:()=>{d(k=>k+1)}}]}function ht(e,t,n,r,s,l){let u=[],T=t.nextSibling;for(;T&&T!==n;)u.push(T),T=T.nextSibling;if(l){let h=new Map;for(let d of u){let a=d.__k;a!=null&&h.set(a,d)}let m=[],E=new Set;for(let d=0;d<r.length;d++){let a=r[d],g=l(a);E.add(g);let b=s(a,d);b.__k=g,m.push(b)}for(let[d,a]of h)!E.has(d)&&a.parentNode===e&&(A(a),e.removeChild(a));for(let d=0;d<m.length;d++){let a=m[d],g=d===0?t:m[d-1];a!==g.nextSibling&&e.insertBefore(a,g.nextSibling)}}else{let h=Math.max(u.length,r.length);for(let m=0;m<h;m++)if(m<r.length){let E=s(r[m],m);m<u.length?u[m]!==E&&(A(u[m]),e.replaceChild(E,u[m])):e.insertBefore(E,n)}else m<u.length&&u[m].parentNode===e&&(A(u[m]),e.removeChild(u[m]))}}function mt(e,t,n,r,s,l){let u=null;w(()=>{let h=r()?s():l?l():null;u?h?(A(u),e.replaceChild(h,u)):(A(u),e.removeChild(u)):h&&e.insertBefore(h,n),u=h})}function P(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function Ce(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let s=t.attributes[r].name,l=t.attributes[r].value;n.add(s),e.getAttribute(s)!==l&&e.setAttribute(s,l)}for(let r=0;r<e.attributes.length;r++){let s=e.attributes[r].name;n.has(s)||e.removeAttribute(s)}}function Q(e,t){let n=document.importNode(t,!0);return e.parentNode&&(A(e),e.parentNode.replaceChild(n,e)),n}function we(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function J(e,t){if(!we(e,t))return Q(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?Q(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return P(n)!==P(r)?Q(n,r):(Ce(n,r),Le(n,r),n)}function Le(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let d=!0;for(let a=0;a<r.length;a++)if(P(n[a])!==P(r[a])){d=!1;break}if(d){for(let a=0;a<r.length;a++)J(n[a],r[a]);return}}let s=new Map,l=[];n.forEach((d,a)=>{let g=P(d);g!=null?s.has(g)||s.set(g,a):l.push(a)});let u=new Set,T=0,h=null,m=0,E=()=>{for(;m<l.length&&u.has(l[m]);)m++;return m<l.length?l[m]:-1};for(let d of r){let a=P(d),g;if(a!=null&&s.has(a)){let b=s.get(a);s.delete(a),u.add(b);let y=n[b];b<T?e.insertBefore(y,h):T=b,g=J(y,d)}else if(a==null){let b=E();if(b>=0&&we(n[b],d)){u.add(b);let y=n[b];y.parentNode===e&&y.nextSibling!==h&&e.insertBefore(y,h),g=J(y,d)}else g=document.importNode(d,!0),e.insertBefore(g,h)}else g=document.importNode(d,!0),e.insertBefore(g,h);h=g.nextSibling}n.forEach((d,a)=>{!u.has(a)&&d.parentNode===e&&(A(d),e.removeChild(d))})}function Z(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let s=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(s,n);return}Ce(n,r),Le(n,r)}var ee=!1,H,V=null,M=new Map,gt=30,O=new Map,Tt=50,Me=/\/chunks\/runtime\.[^/]+\.js$/;function Re(){if(typeof document=="undefined"||ee)return;ee=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,s=null,l=new Map,u=null;function T(o){for(let i of e.split(", ")){let c=o.querySelector(i.trim());if(c)return c}return o.body}function h(o){if(o.hasAttribute("data-krate-external"))return!1;let i=o.getAttribute("href");return!(!i||i.startsWith("#")||i.startsWith("javascript:")||o.origin!==location.origin||o.target==="_blank")}function m(o){M.has(o)||fetch(o,{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>{if(i){if(M.size>=gt){let c=M.keys().next().value;c!==void 0&&M.delete(c)}M.set(o,i)}}).catch(()=>{})}function E(){document.addEventListener("mouseover",g),document.addEventListener("focusin",g),typeof IntersectionObserver!="undefined"&&(u=new IntersectionObserver(o=>{for(let i of o)if(i.isIntersecting){let c=i.target,f=c.getAttribute("href");if(f&&h(c)){let p=new URL(f,location.origin).href;m(p)}u.unobserve(i.target)}},{rootMargin:"200px"}),d())}function d(){u&&document.querySelectorAll("a[data-prefetch]").forEach(o=>{u.observe(o)})}function a(){document.removeEventListener("mouseover",g),document.removeEventListener("focusin",g);for(let o of l.values())clearTimeout(o);l.clear(),u&&(u.disconnect(),u=null)}function g(o){let i=o.target.closest("a[data-prefetch]");if(!i||!h(i))return;let c=i.getAttribute("href");if(!c)return;let f=new URL(c,location.origin).href;if(M.has(f))return;let p=l.get(i);p&&clearTimeout(p);let S=setTimeout(()=>{l.delete(i),m(f)},n);l.set(i,S)}function b(o){let i=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT),c=i.nextNode();for(;c;){let f=c;for(let p of Object.keys(f))p.indexOf("__krate_")===0&&delete f[p];c=i.nextNode()}}let y=null;function te(){let o=T(document),i=document.querySelector("template[data-krate-loading]");i&&i.content&&o&&(y=i.content.cloneNode(!0),document.body.appendChild(y)),o&&(o.style.transition=`opacity ${t}ms ease`,o.style.opacity="0")}function k(){y&&y.parentNode&&y.parentNode.removeChild(y),y=null;let o=T(document);o&&(o.style.opacity="1")}function K(o){try{let i=globalThis.__krate_onNavigation;typeof i=="function"&&i(o)}catch(i){}}function C(o,i,c,f={}){let{replace:p=!1,scroll:S=!0,restoreScroll:R=!1}=f,j=new DOMParser().parseFromString(o,"text/html"),fe=T(j),B=T(document);if(!fe||!B){location.href=i;return}let ue=j.querySelector("title");ue&&(document.title=ue.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),b(B),Z(B,fe);let de=j.querySelectorAll('link[rel="stylesheet"]'),pe=new Set;de.forEach(v=>{let x=v.getAttribute("href");x&&pe.add(x)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(v=>{let x=v.getAttribute("href");x&&!pe.has(x)&&v.remove()});let he=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(v=>{he.add(v.href)}),de.forEach(v=>{let x=v.getAttribute("href");if(x&&!he.has(x)){let U=document.createElement("link");U.rel="stylesheet",U.href=x,document.head.appendChild(U)}}),Pe(c,i).then(()=>{try{Oe(),d()}catch(v){try{let x=globalThis.__krate_onHydrationError;typeof x=="function"&&x(v)}catch(x){}location.href=i}}),k();let De=location.pathname+location.search;if(p)history.replaceState({},"",i);else{if(!R){if(O.size>=Tt){let v=O.keys().next().value;v!==void 0&&O.delete(v)}O.set(De,window.scrollY)}history.pushState({},"",i)}ne(i,{restoreScroll:R,scroll:S}),oe(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:i}})),K(i)}function _e(o){let i=o.indexOf("#");if(i<0||i===o.length-1)return!1;let c=o.slice(i);try{let f=document.querySelector(c);if(f)return f.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(f){return!1}return!1}function ne(o,i){if(i.restoreScroll){let c=O.get(o);if(c!==void 0){window.scrollTo(0,c);return}}_e(o)||i.scroll&&window.scrollTo(0,0)}function oe(){let o=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(i=>{let c=i.getAttribute("href");if(!c){i.removeAttribute("aria-current");return}let f=c;try{f=new URL(c,location.origin).pathname}catch(S){return}f===o||o==="/"&&(f===""||f==="/")||f!=="/"&&f.length>1&&o.startsWith(f)?i.setAttribute("aria-current","page"):i.removeAttribute("aria-current")})}function Pe(o,i){return o.length===0?Promise.resolve():Promise.all(o.map(c=>{let f=c.getAttribute("src");return f?He(f,i):Promise.resolve()})).then(()=>{})}function He(o,i){return new Promise(c=>{let f=document.createElement("script"),p=re(o,i);f.src=p,Me.test(p)||f.setAttribute("data-krate-spa",""),f.onload=()=>c(),f.onerror=()=>c(),document.body.appendChild(f)})}function re(o,i){if(/^(https?:)?\/\//.test(o)||o.startsWith("/"))return new URL(o,i).href;let c=i;if(!c.endsWith("/")){let f=c.lastIndexOf("/");c=f>0?c.slice(0,f+1):"/"}return new URL(o,c).href}function Oe(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function Ke(o,i){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",i),K(i),document.open(),document.write(o),document.close()}function qe(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(r=o,o)).catch(()=>null)}function Ie(){return s!==null?Promise.resolve(s):fetch("/500.html",{headers:{Accept:"text/html"}}).then(o=>o.ok?o.text():null).then(o=>(s=o,o)).catch(()=>null)}function ie(o,i){document.querySelectorAll("script[data-krate-spa]").forEach(p=>p.remove());let c=[],f=new Set;return document.querySelectorAll("script[src]").forEach(p=>{f.add(p.src)}),o.querySelectorAll("script[src]").forEach(p=>{let S=p.getAttribute("src");S&&!f.has(re(S,i))&&c.push(p)}),c}function se(o,i={}){let c=M.get(o);if(c){let S=new DOMParser().parseFromString(c,"text/html");C(c,o,ie(S,o),i);return}te(),H&&H.abort(),H=new AbortController;let f=H.signal;fetch(o,{headers:{Accept:"text/html"},signal:f}).then(p=>p.ok?p.text().then(S=>{let ae=new DOMParser().parseFromString(S,"text/html");C(S,o,ie(ae,o),i)}):(p.status>=500?Ie():qe()).then(R=>{R?Ke(R,o):location.href=o})).catch(p=>{(p==null?void 0:p.name)!=="AbortError"&&(k(),location.href=o)}).finally(()=>{H&&!f.aborted&&(H=void 0)})}let ce=o=>{if(o.defaultPrevented||o.button!==0||o.metaKey||o.ctrlKey||o.shiftKey||o.altKey)return;let i=o.target.closest("a[data-krate-link]");if(!i||!h(i))return;o.preventDefault();let c=i.getAttribute("href");if(!c)return;let f=new URL(c,location.origin).href,p=i.hasAttribute("data-krate-replace"),S=i.getAttribute("data-krate-scroll")!=="false";if(c===location.pathname+location.search+location.hash){p&&history.replaceState({},"",c),ne(f,{scroll:S});return}se(f,{replace:p,scroll:S})},le=()=>{se(location.href,{restoreScroll:!0})};document.addEventListener("click",ce),window.addEventListener("popstate",le),E(),oe(),document.querySelectorAll("script[src]").forEach(o=>{Me.test(o.src)||o.setAttribute("data-krate-spa","")}),V=()=>{document.removeEventListener("click",ce),window.removeEventListener("popstate",le),a()}}function yt(){V&&(V(),V=null),ee=!1,Re()}return ze(bt);})();
2
2
  for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
@@ -1,2 +1,2 @@
1
- var __krate_exports=(()=>{var B=Object.defineProperty,Ke=Object.defineProperties,je=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyDescriptors,Xe=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var Te=(e,t,n)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,He=(e,t)=>{for(var n in t||(t={}))W.call(t,n)&&Te(e,n,t[n]);if(_)for(var n of _(t))ve.call(t,n)&&Te(e,n,t[n]);return e},Ee=(e,t)=>Ke(e,We(t));var Ae=(e,t)=>{var n={};for(var r in e)W.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_)for(var r of _(e))t.indexOf(r)<0&&ve.call(e,r)&&(n[r]=e[r]);return n};var Ge=(e,t)=>{for(var n in t)B(e,n,{get:t[n],enumerable:!0})},Je=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xe(t))!W.call(e,o)&&o!==n&&B(e,o,{get:()=>t[o],enumerable:!(r=je(t,o))||r.enumerable});return e};var Ye=e=>Je(B({},"__esModule",{value:!0}),e);var ht={};Ge(ht,{Fragment:()=>ct,clearNodes:()=>Se,conditional:()=>bt,createEffect:()=>S,createMemo:()=>nt,createResource:()=>lt,createSignal:()=>w,disposeAll:()=>$e,disposeNode:()=>L,forwardRef:()=>it,h:()=>V,hydrate:()=>ut,initRouter:()=>De,insert:()=>ot,jsx:()=>Ce,jsxs:()=>dt,mount:()=>at,onCleanup:()=>$,onMount:()=>et,reconcile:()=>gt,reconcileTrees:()=>ne,reinitRouter:()=>pt,useRef:()=>rt});var k=[],Me=[],X=!1,P=new Set,G=[],J=[],q=!1;function Le(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function Y(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function $e(){for(let e of P)Y(e);P.clear();for(let e of G)try{e()}catch(t){}G.length=0,J.length=0,q=!1}function w(e){let t=e,n=new Set;return[()=>{let u=k[k.length-1];return u&&!u.disposed&&(n.add(u),u.sources.add(n)),t},u=>{let d=typeof u=="function"?u(t):u;if(d!==t){t=d;let h=Array.from(n);for(let f of h){if(f.disposed){n.delete(f);continue}if(f.running){f.rerun=!0;continue}f.queued||(f.queued=!0,J.push(f))}Qe()}}]}function Qe(){q||(q=!0,queueMicrotask(Ze))}function Ze(){q=!1;let e=J.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,F(t),t.rerun&&!t.disposed&&(t.rerun=!1,F(t)))}function F(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,k.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{k.pop(),e.running=!1}}function S(e){let t=Le(e);return P.add(t),F(t),()=>{Y(t),P.delete(t)}}function $(e){let t=k[k.length-1];t?t.cleanups.push(e):G.push(e)}function et(e){Me.push(e),X||(X=!0,queueMicrotask(tt))}function tt(){X=!1;let e=Me.splice(0);for(let t of e)t()}function nt(e){let[t,n]=w(void 0),r=Le(()=>{let u=e();n(u)});P.add(r),F(r);let o=k[k.length-1];return o&&o.cleanups.push(()=>{r.disposed||(Y(r),P.delete(r))}),t}function rt(e){return{current:e}}function it(e){return t=>e(t,t.ref||(()=>{}))}var Q=new WeakMap;function xe(e,t){let n=Q.get(e);n||(n=[],Q.set(e,n)),n.push(t)}function L(e){let t=Q.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)L(e.childNodes[n])}function st(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Se(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let o=r.nextSibling;L(r),n.removeChild(r),r=o}}function ot(e,t,n){let r=st(n);r?(Se(n,r),Z(e,t,r)):Z(e,t,null)}function Z(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)Z(e,r,n)}}function ye(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),o=`__krate_${r}`,u=e[o];u&&e.removeEventListener(r,u),e.addEventListener(r,n),e[o]=n}else t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function ke(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)ke(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),xe(n,S(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function V(e,t,...n){if(typeof e=="function")return e(Ee(He({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[o,u]of Object.entries(t))typeof u=="function"&&!o.startsWith("on")?xe(r,S(()=>ye(r,o,u()))):ye(r,o,u);for(let o of n)ke(r,o);return r}function we(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function at(e,t){let n=we(t),r=!1;S(()=>{r||(r=!0,n.appendChild(e()))})}function ut(e,t){let n=we(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&L(r)}function lt(e,t){let[n,r]=w(void 0),[o,u]=w(!0),[d,h]=w(void 0),[f,m]=w("unresolved"),[E,g]=w(0),l,p=()=>typeof e=="function"?e():e,v=async()=>{l&&l.abort(),l=new AbortController;let y=l,I=p();m(E()>0?"refreshing":"loading"),u(!0),h(void 0);try{let x=await t(I,{signal:y.signal});y.signal.aborted||(r(()=>x),m("ready"))}catch(x){(x==null?void 0:x.name)!=="AbortError"&&!y.signal.aborted&&(h(x),m("error"))}finally{y.signal.aborted||u(!1)}};S(()=>{typeof e=="function"&&e.length===0&&e(),E(),v(),$(()=>{l&&(l.abort(),l=void 0)})});let T=function(){return n()};return Object.defineProperties(T,{loading:{get:()=>o()},error:{get:()=>d()},state:{get:()=>f()}}),[T,{mutate:y=>{r(y)},refetch:()=>{g(y=>y+1)}}]}function ct(e){let t=document.createDocumentFragment(),n=e.children;if(n){let r=Array.isArray(n)?n:[n];for(let o of r)o instanceof Node?t.appendChild(o):t.appendChild(document.createTextNode(String(o)))}return t}function Ce(e,t,n){let r=e;if(!t)return V(r,null);let h=t,{children:o}=h,u=Ae(h,["children"]),d=o!==void 0?Array.isArray(o)?o:[o]:[];return V(r,Object.keys(u).length>0?u:null,...d)}function dt(e,t,n){return Ce(e,t,n)}function gt(e,t,n,r,o,u){let d=[],h=t.nextSibling;for(;h&&h!==n;)d.push(h),h=h.nextSibling;if(u){let f=new Map;for(let g of d){let l=g.__k;l!=null&&f.set(l,g)}let m=[],E=new Set;for(let g=0;g<r.length;g++){let l=r[g],p=u(l);E.add(p);let v=o(l,g);v.__k=p,m.push(v)}for(let[g,l]of f)!E.has(g)&&l.parentNode===e&&(L(l),e.removeChild(l));for(let g=0;g<m.length;g++){let l=m[g],p=g===0?t:m[g-1];l!==p.nextSibling&&e.insertBefore(l,p.nextSibling)}}else{let f=Math.max(d.length,r.length);for(let m=0;m<f;m++)if(m<r.length){let E=o(r[m],m);m<d.length?d[m]!==E&&(L(d[m]),e.replaceChild(E,d[m])):e.insertBefore(E,n)}else m<d.length&&d[m].parentNode===e&&(L(d[m]),e.removeChild(d[m]))}}function bt(e,t,n,r,o,u){let d=null;S(()=>{let f=r()?o():u?u():null;d?f?(L(d),e.replaceChild(f,d)):(L(d),e.removeChild(d)):f&&e.insertBefore(f,n),d=f})}function O(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function Ne(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let o=t.attributes[r].name,u=t.attributes[r].value;n.add(o),e.getAttribute(o)!==u&&e.setAttribute(o,u)}for(let r=0;r<e.attributes.length;r++){let o=e.attributes[r].name;n.has(o)||e.removeAttribute(o)}}function ee(e,t){let n=document.importNode(t,!0);return e.parentNode&&(L(e),e.parentNode.replaceChild(n,e)),n}function Pe(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function te(e,t){if(!Pe(e,t))return ee(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?ee(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return O(n)!==O(r)?ee(n,r):(Ne(n,r),Oe(n,r),n)}function Oe(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let g=!0;for(let l=0;l<r.length;l++)if(O(n[l])!==O(r[l])){g=!1;break}if(g){for(let l=0;l<r.length;l++)te(n[l],r[l]);return}}let o=new Map,u=[];n.forEach((g,l)=>{let p=O(g);p!=null?o.has(p)||o.set(p,l):u.push(l)});let d=new Set,h=0,f=null,m=0,E=()=>{for(;m<u.length&&d.has(u[m]);)m++;return m<u.length?u[m]:-1};for(let g of r){let l=O(g),p;if(l!=null&&o.has(l)){let v=o.get(l);o.delete(l),d.add(v);let T=n[v];v<h?e.insertBefore(T,f):h=v,p=te(T,g)}else if(l==null){let v=E();if(v>=0&&Pe(n[v],g)){d.add(v);let T=n[v];T.parentNode===e&&T.nextSibling!==f&&e.insertBefore(T,f),p=te(T,g)}else p=document.importNode(g,!0),e.insertBefore(p,f)}else p=document.importNode(g,!0),e.insertBefore(p,f);f=p.nextSibling}n.forEach((g,l)=>{!d.has(l)&&g.parentNode===e&&(L(g),e.removeChild(g))})}function ne(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let o=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(o,n);return}Ne(n,r),Oe(n,r)}var re=!1,R,U=null,C=new Map,ft=30,D=new Map,mt=50,Re=/\/chunks\/runtime\.[^/]+\.js$/;function De(){if(typeof document=="undefined"||re)return;re=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,o=null,u=new Map,d=null;function h(i){for(let s of e.split(", ")){let a=i.querySelector(s.trim());if(a)return a}return i.body}function f(i){if(i.hasAttribute("data-krate-external"))return!1;let s=i.getAttribute("href");return!(!s||s.startsWith("#")||s.startsWith("javascript:")||i.origin!==location.origin||i.target==="_blank")}function m(i){C.has(i)||fetch(i,{headers:{Accept:"text/html"}}).then(s=>s.ok?s.text():null).then(s=>{if(s){if(C.size>=ft){let a=C.keys().next().value;a!==void 0&&C.delete(a)}C.set(i,s)}}).catch(()=>{})}function E(){document.addEventListener("mouseover",p),document.addEventListener("focusin",p),typeof IntersectionObserver!="undefined"&&(d=new IntersectionObserver(i=>{for(let s of i)if(s.isIntersecting){let a=s.target,c=a.getAttribute("href");if(c&&f(a)){let b=new URL(c,location.origin).href;m(b)}d.unobserve(s.target)}},{rootMargin:"200px"}),g())}function g(){d&&document.querySelectorAll("a[data-prefetch]").forEach(i=>{d.observe(i)})}function l(){document.removeEventListener("mouseover",p),document.removeEventListener("focusin",p);for(let i of u.values())clearTimeout(i);u.clear(),d&&(d.disconnect(),d=null)}function p(i){let s=i.target.closest("a[data-prefetch]");if(!s||!f(s))return;let a=s.getAttribute("href");if(!a)return;let c=new URL(a,location.origin).href;if(C.has(c))return;let b=u.get(s);b&&clearTimeout(b);let H=setTimeout(()=>{u.delete(s),m(c)},n);u.set(s,H)}function v(i){let s=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),a=s.nextNode();for(;a;){let c=a;for(let b of Object.keys(c))b.indexOf("__krate_")===0&&delete c[b];a=s.nextNode()}}let T=null;function ie(){let i=h(document),s=document.querySelector("template[data-krate-loading]");s&&s.content&&i&&(T=s.content.cloneNode(!0),document.body.appendChild(T)),i&&(i.style.transition=`opacity ${t}ms ease`,i.style.opacity="0")}function y(){T&&T.parentNode&&T.parentNode.removeChild(T),T=null;let i=h(document);i&&(i.style.opacity="1")}function I(i){try{let s=globalThis.__krate_onNavigation;typeof s=="function"&&s(i)}catch(s){}}function x(i,s,a,c={}){let{replace:b=!1,scroll:H=!0,restoreScroll:N=!1}=c,z=new DOMParser().parseFromString(i,"text/html"),be=h(z),K=h(document);if(!be||!K){location.href=s;return}let fe=z.querySelector("title");fe&&(document.title=fe.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),v(K),ne(K,be);let me=z.querySelectorAll('link[rel="stylesheet"]'),pe=new Set;me.forEach(A=>{let M=A.getAttribute("href");M&&pe.add(M)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(A=>{let M=A.getAttribute("href");M&&!pe.has(M)&&A.remove()});let he=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(A=>{he.add(A.href)}),me.forEach(A=>{let M=A.getAttribute("href");if(M&&!he.has(M)){let j=document.createElement("link");j.rel="stylesheet",j.href=M,document.head.appendChild(j)}}),_e(a,s).then(()=>{try{qe(),g()}catch(A){try{let M=globalThis.__krate_onHydrationError;typeof M=="function"&&M(A)}catch(M){}location.href=s}}),y();let ze=location.pathname+location.search;if(b)history.replaceState({},"",s);else{if(!N){if(D.size>=mt){let A=D.keys().next().value;A!==void 0&&D.delete(A)}D.set(ze,window.scrollY)}history.pushState({},"",s)}se(s,{restoreScroll:N,scroll:H}),oe(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:s}})),I(s)}function Ie(i){let s=i.indexOf("#");if(s<0||s===i.length-1)return!1;let a=i.slice(s);try{let c=document.querySelector(a);if(c)return c.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(c){return!1}return!1}function se(i,s){if(s.restoreScroll){let a=D.get(i);if(a!==void 0){window.scrollTo(0,a);return}}Ie(i)||s.scroll&&window.scrollTo(0,0)}function oe(){let i=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(s=>{let a=s.getAttribute("href");if(!a){s.removeAttribute("aria-current");return}let c=a;try{c=new URL(a,location.origin).pathname}catch(H){return}c===i||i==="/"&&(c===""||c==="/")||c!=="/"&&c.length>1&&i.startsWith(c)?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")})}function _e(i,s){return i.length===0?Promise.resolve():Promise.all(i.map(a=>{let c=a.getAttribute("src");return c?Be(c,s):Promise.resolve()})).then(()=>{})}function Be(i,s){return new Promise(a=>{let c=document.createElement("script"),b=ae(i,s);c.src=b,Re.test(b)||c.setAttribute("data-krate-spa",""),c.onload=()=>a(),c.onerror=()=>a(),document.body.appendChild(c)})}function ae(i,s){if(/^(https?:)?\/\//.test(i)||i.startsWith("/"))return new URL(i,s).href;let a=s;if(!a.endsWith("/")){let c=a.lastIndexOf("/");a=c>0?a.slice(0,c+1):"/"}return new URL(i,a).href}function qe(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function Fe(i,s){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",s),I(s),document.open(),document.write(i),document.close()}function Ve(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(r=i,i)).catch(()=>null)}function Ue(){return o!==null?Promise.resolve(o):fetch("/500.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(o=i,i)).catch(()=>null)}function ue(i,s){document.querySelectorAll("script[data-krate-spa]").forEach(b=>b.remove());let a=[],c=new Set;return document.querySelectorAll("script[src]").forEach(b=>{c.add(b.src)}),i.querySelectorAll("script[src]").forEach(b=>{let H=b.getAttribute("src");H&&!c.has(ae(H,s))&&a.push(b)}),a}function le(i,s={}){let a=C.get(i);if(a){let H=new DOMParser().parseFromString(a,"text/html");x(a,i,ue(H,i),s);return}ie(),R&&R.abort(),R=new AbortController;let c=R.signal;fetch(i,{headers:{Accept:"text/html"},signal:c}).then(b=>b.ok?b.text().then(H=>{let ge=new DOMParser().parseFromString(H,"text/html");x(H,i,ue(ge,i),s)}):(b.status>=500?Ue():Ve()).then(N=>{N?Fe(N,i):location.href=i})).catch(b=>{(b==null?void 0:b.name)!=="AbortError"&&(y(),location.href=i)}).finally(()=>{R&&!c.aborted&&(R=void 0)})}let ce=i=>{if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;let s=i.target.closest("a[data-krate-link]");if(!s||!f(s))return;i.preventDefault();let a=s.getAttribute("href");if(!a)return;let c=new URL(a,location.origin).href,b=s.hasAttribute("data-krate-replace"),H=s.getAttribute("data-krate-scroll")!=="false";if(a===location.pathname+location.search+location.hash){b&&history.replaceState({},"",a),se(c,{scroll:H});return}le(c,{replace:b,scroll:H})},de=()=>{le(location.href,{restoreScroll:!0})};document.addEventListener("click",ce),window.addEventListener("popstate",de),E(),oe(),document.querySelectorAll("script[src]").forEach(i=>{Re.test(i.src)||i.setAttribute("data-krate-spa","")}),U=()=>{document.removeEventListener("click",ce),window.removeEventListener("popstate",de),l()}}function pt(){U&&(U(),U=null),re=!1,De()}return Ye(ht);})();
1
+ var __krate_exports=(()=>{var B=Object.defineProperty,ze=Object.defineProperties,je=Object.getOwnPropertyDescriptor,We=Object.getOwnPropertyDescriptors,Xe=Object.getOwnPropertyNames,D=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var Te=(e,t,n)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,He=(e,t)=>{for(var n in t||(t={}))W.call(t,n)&&Te(e,n,t[n]);if(D)for(var n of D(t))ve.call(t,n)&&Te(e,n,t[n]);return e},Ee=(e,t)=>ze(e,We(t));var Ae=(e,t)=>{var n={};for(var r in e)W.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&D)for(var r of D(e))t.indexOf(r)<0&&ve.call(e,r)&&(n[r]=e[r]);return n};var Ge=(e,t)=>{for(var n in t)B(e,n,{get:t[n],enumerable:!0})},Je=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Xe(t))!W.call(e,o)&&o!==n&&B(e,o,{get:()=>t[o],enumerable:!(r=je(t,o))||r.enumerable});return e};var Ye=e=>Je(B({},"__esModule",{value:!0}),e);var Mt={};Ge(Mt,{Fragment:()=>pt,clearNodes:()=>Se,conditional:()=>vt,createCSSChoice:()=>Qe,createCSSFlags:()=>et,createCSSGroup:()=>tt,createCSSRange:()=>nt,createCSSStack:()=>rt,createCSSToggle:()=>Ze,createEffect:()=>k,createMemo:()=>ut,createResource:()=>mt,createSignal:()=>L,disposeAll:()=>$e,disposeNode:()=>y,forwardRef:()=>ct,h:()=>F,hydrate:()=>ft,initRouter:()=>Ie,insert:()=>gt,jsx:()=>we,jsxs:()=>ht,mount:()=>bt,onCleanup:()=>$,onMount:()=>ot,reconcile:()=>Tt,reconcileTrees:()=>ne,reinitRouter:()=>At,useRef:()=>lt});var C=[],Me=[],X=!1,P=new Set,G=[],J=[],K=!1;function Le(e){return{fn:e,cleanups:[],disposed:!1,sources:new Set,running:!1,rerun:!1,queued:!1}}function Y(e){if(!e.disposed){e.disposed=!0;for(let t of e.sources)t.delete(e);e.sources.clear();for(let t of e.cleanups)t();e.cleanups.length=0}}function $e(){for(let e of P)Y(e);P.clear();for(let e of G)try{e()}catch(t){}G.length=0,J.length=0,K=!1}function Qe(e,t){return L(e)}function Ze(e,t){return L(e)}function et(e,t){let n={};for(let o of e){let[u]=L(!1);n[o]=u}return[n,(o,u)=>{}]}function tt(e,t){return L(e)}function nt(e,t){return L(e)}function rt(e,t){let n=()=>e[0];return[{top:n,peek:n},{push:r=>{},pop:()=>{},clear:()=>{}}]}function L(e){let t=e,n=new Set;return[()=>{let u=C[C.length-1];return u&&!u.disposed&&(n.add(u),u.sources.add(n)),t},u=>{let d=typeof u=="function"?u(t):u;if(d!==t){t=d;let h=Array.from(n);for(let f of h){if(f.disposed){n.delete(f);continue}if(f.running){f.rerun=!0;continue}f.queued||(f.queued=!0,J.push(f))}it()}}]}function it(){K||(K=!0,queueMicrotask(st))}function st(){K=!1;let e=J.splice(0);for(let t of e)t.disposed||(t.queued=!1,t.rerun=!1,q(t),t.rerun&&!t.disposed&&(t.rerun=!1,q(t)))}function q(e){e.running=!0;for(let t of e.cleanups)t();e.cleanups.length=0,C.push(e);try{let t=e.fn();typeof t=="function"&&e.cleanups.push(t)}finally{C.pop(),e.running=!1}}function k(e){let t=Le(e);return P.add(t),q(t),()=>{Y(t),P.delete(t)}}function $(e){let t=C[C.length-1];t?t.cleanups.push(e):G.push(e)}function ot(e){Me.push(e),X||(X=!0,queueMicrotask(at))}function at(){X=!1;let e=Me.splice(0);for(let t of e)t()}function ut(e){let[t,n]=L(void 0),r=Le(()=>{let u=e();n(u)});P.add(r),q(r);let o=C[C.length-1];return o&&o.cleanups.push(()=>{r.disposed||(Y(r),P.delete(r))}),t}function lt(e){return{current:e}}function ct(e){return t=>e(t,t.ref||(()=>{}))}var Q=new WeakMap;function xe(e,t){let n=Q.get(e);n||(n=[],Q.set(e,n)),n.push(t)}function y(e){let t=Q.get(e);if(t){for(let n of t)n();t.length=0}for(let n=0;n<e.childNodes.length;n++)y(e.childNodes[n])}function dt(e){let t=e.nextSibling;for(;t;){if(t.nodeType===8&&t.nodeValue==="k")return t;t=t.nextSibling}return null}function Se(e,t){let n=e.parentNode;if(!n)return;let r=e.nextSibling;for(;r&&r!==t;){let o=r.nextSibling;y(r),n.removeChild(r),r=o}}function gt(e,t,n){let r=dt(n);r?(Se(n,r),Z(e,t,r)):Z(e,t,null)}function Z(e,t,n){if(!(t==null||t===!1||t===!0)){if(typeof t=="string"||typeof t=="number")e.insertBefore(document.createTextNode(String(t)),n);else if(t instanceof Node)e.insertBefore(t,n);else if(Array.isArray(t))for(let r of t)Z(e,r,n)}}function ye(e,t,n){if(t==="class"||t==="className")n===!1||n===null||n===void 0?e.className="":e.className=String(n);else if(t==="style")typeof n=="string"?e.setAttribute("style",n):n&&typeof n=="object"&&Object.assign(e.style,n);else if(t.startsWith("on")&&typeof n=="function"){let r=t.slice(2).toLowerCase(),o=`__krate_${r}`,u=e[o];u&&e.removeEventListener(r,u),e.addEventListener(r,n),e[o]=n}else t==="ref"?typeof n=="function"?n(e):n&&typeof n=="object"&&"current"in n&&(n.current=e):t==="key"||n!=null&&n!==!1&&e.setAttribute(t,String(n))}function ke(e,t){if(!(t==null||t===!1||t===!0)){if(Array.isArray(t)){for(let n of t)ke(e,n);return}if(typeof t=="function"){let n=document.createTextNode("");e.appendChild(n),xe(n,k(()=>{n.nodeValue=String(t())}));return}e.appendChild(t instanceof Node?t:document.createTextNode(String(t)))}}function F(e,t,...n){if(typeof e=="function")return e(Ee(He({},t||{}),{children:n}));let r=document.createElement(e);if(t)for(let[o,u]of Object.entries(t))typeof u=="function"&&!o.startsWith("on")?xe(r,k(()=>ye(r,o,u()))):ye(r,o,u);for(let o of n)ke(r,o);return r}function Ce(e){if(typeof e=="string"){let t=document.querySelector(e);if(!t)throw new Error(`Container "${e}" not found`);return t}return e}function bt(e,t){let n=Ce(t),r=!1;k(()=>{r||(r=!0,n.appendChild(e()))})}function ft(e,t){let n=Ce(t);if(n.childNodes.length===0){n.appendChild(e());return}let r=e();r&&y(r)}function mt(e,t){let[n,r]=L(void 0),[o,u]=L(!0),[d,h]=L(void 0),[f,m]=L("unresolved"),[E,g]=L(0),l,p=()=>typeof e=="function"?e():e,v=async()=>{l&&l.abort(),l=new AbortController;let x=l,_=p();m(E()>0?"refreshing":"loading"),u(!0),h(void 0);try{let S=await t(_,{signal:x.signal});x.signal.aborted||(r(()=>S),m("ready"))}catch(S){(S==null?void 0:S.name)!=="AbortError"&&!x.signal.aborted&&(h(S),m("error"))}finally{x.signal.aborted||u(!1)}};k(()=>{typeof e=="function"&&e.length===0&&e(),E(),v(),$(()=>{l&&(l.abort(),l=void 0)})});let T=function(){return n()};return Object.defineProperties(T,{loading:{get:()=>o()},error:{get:()=>d()},state:{get:()=>f()}}),[T,{mutate:x=>{r(x)},refetch:()=>{g(x=>x+1)}}]}function pt(e){let t=document.createDocumentFragment(),n=e.children;if(n){let r=Array.isArray(n)?n:[n];for(let o of r)o instanceof Node?t.appendChild(o):t.appendChild(document.createTextNode(String(o)))}return t}function we(e,t,n){let r=e;if(!t)return F(r,null);let h=t,{children:o}=h,u=Ae(h,["children"]),d=o!==void 0?Array.isArray(o)?o:[o]:[];return F(r,Object.keys(u).length>0?u:null,...d)}function ht(e,t,n){return we(e,t,n)}function Tt(e,t,n,r,o,u){let d=[],h=t.nextSibling;for(;h&&h!==n;)d.push(h),h=h.nextSibling;if(u){let f=new Map;for(let g of d){let l=g.__k;l!=null&&f.set(l,g)}let m=[],E=new Set;for(let g=0;g<r.length;g++){let l=r[g],p=u(l);E.add(p);let v=o(l,g);v.__k=p,m.push(v)}for(let[g,l]of f)!E.has(g)&&l.parentNode===e&&(y(l),e.removeChild(l));for(let g=0;g<m.length;g++){let l=m[g],p=g===0?t:m[g-1];l!==p.nextSibling&&e.insertBefore(l,p.nextSibling)}}else{let f=Math.max(d.length,r.length);for(let m=0;m<f;m++)if(m<r.length){let E=o(r[m],m);m<d.length?d[m]!==E&&(y(d[m]),e.replaceChild(E,d[m])):e.insertBefore(E,n)}else m<d.length&&d[m].parentNode===e&&(y(d[m]),e.removeChild(d[m]))}}function vt(e,t,n,r,o,u){let d=null;k(()=>{let f=r()?o():u?u():null;d?f?(y(d),e.replaceChild(f,d)):(y(d),e.removeChild(d)):f&&e.insertBefore(f,n),d=f})}function O(e){if(e.nodeType===Node.COMMENT_NODE){let t=e.nodeValue||"";return t.indexOf("k:")===0?t:null}if(e.nodeType===Node.ELEMENT_NODE){let t=e,n=t.getAttribute("data-k");if(n)return n;let r=t.getAttribute("id");if(r)return"#"+r}return null}function Ne(e,t){let n=new Set;for(let r=0;r<t.attributes.length;r++){let o=t.attributes[r].name,u=t.attributes[r].value;n.add(o),e.getAttribute(o)!==u&&e.setAttribute(o,u)}for(let r=0;r<e.attributes.length;r++){let o=e.attributes[r].name;n.has(o)||e.removeAttribute(o)}}function ee(e,t){let n=document.importNode(t,!0);return e.parentNode&&(y(e),e.parentNode.replaceChild(n,e)),n}function Pe(e,t){return e.nodeType!==t.nodeType?!1:e.nodeType===Node.ELEMENT_NODE?e.tagName===t.tagName:!0}function te(e,t){if(!Pe(e,t))return ee(e,t);if(e.nodeType===Node.TEXT_NODE)return e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e;if(e.nodeType===Node.COMMENT_NODE)return e.nodeValue!==t.nodeValue?ee(e,t):e;if(e.nodeType!==Node.ELEMENT_NODE)return e;let n=e,r=t;return O(n)!==O(r)?ee(n,r):(Ne(n,r),Oe(n,r),n)}function Oe(e,t){let n=Array.from(e.childNodes),r=Array.from(t.childNodes);if(n.length===r.length){let g=!0;for(let l=0;l<r.length;l++)if(O(n[l])!==O(r[l])){g=!1;break}if(g){for(let l=0;l<r.length;l++)te(n[l],r[l]);return}}let o=new Map,u=[];n.forEach((g,l)=>{let p=O(g);p!=null?o.has(p)||o.set(p,l):u.push(l)});let d=new Set,h=0,f=null,m=0,E=()=>{for(;m<u.length&&d.has(u[m]);)m++;return m<u.length?u[m]:-1};for(let g of r){let l=O(g),p;if(l!=null&&o.has(l)){let v=o.get(l);o.delete(l),d.add(v);let T=n[v];v<h?e.insertBefore(T,f):h=v,p=te(T,g)}else if(l==null){let v=E();if(v>=0&&Pe(n[v],g)){d.add(v);let T=n[v];T.parentNode===e&&T.nextSibling!==f&&e.insertBefore(T,f),p=te(T,g)}else p=document.importNode(g,!0),e.insertBefore(p,f)}else p=document.importNode(g,!0),e.insertBefore(p,f);f=p.nextSibling}n.forEach((g,l)=>{!d.has(l)&&g.parentNode===e&&(y(g),e.removeChild(g))})}function ne(e,t){if(e.nodeType!==Node.ELEMENT_NODE||t.nodeType!==Node.ELEMENT_NODE)return;let n=e,r=t;if(n.tagName!==r.tagName){let o=document.importNode(t,!0);n.parentNode&&n.parentNode.replaceChild(o,n);return}Ne(n,r),Oe(n,r)}var re=!1,R,V=null,w=new Map,Ht=30,I=new Map,Et=50,Re=/\/chunks\/runtime\.[^/]+\.js$/;function Ie(){if(typeof document=="undefined"||re)return;re=!0;let e=".docs-content, main, #root",t=150,n=200,r=null,o=null,u=new Map,d=null;function h(i){for(let s of e.split(", ")){let a=i.querySelector(s.trim());if(a)return a}return i.body}function f(i){if(i.hasAttribute("data-krate-external"))return!1;let s=i.getAttribute("href");return!(!s||s.startsWith("#")||s.startsWith("javascript:")||i.origin!==location.origin||i.target==="_blank")}function m(i){w.has(i)||fetch(i,{headers:{Accept:"text/html"}}).then(s=>s.ok?s.text():null).then(s=>{if(s){if(w.size>=Ht){let a=w.keys().next().value;a!==void 0&&w.delete(a)}w.set(i,s)}}).catch(()=>{})}function E(){document.addEventListener("mouseover",p),document.addEventListener("focusin",p),typeof IntersectionObserver!="undefined"&&(d=new IntersectionObserver(i=>{for(let s of i)if(s.isIntersecting){let a=s.target,c=a.getAttribute("href");if(c&&f(a)){let b=new URL(c,location.origin).href;m(b)}d.unobserve(s.target)}},{rootMargin:"200px"}),g())}function g(){d&&document.querySelectorAll("a[data-prefetch]").forEach(i=>{d.observe(i)})}function l(){document.removeEventListener("mouseover",p),document.removeEventListener("focusin",p);for(let i of u.values())clearTimeout(i);u.clear(),d&&(d.disconnect(),d=null)}function p(i){let s=i.target.closest("a[data-prefetch]");if(!s||!f(s))return;let a=s.getAttribute("href");if(!a)return;let c=new URL(a,location.origin).href;if(w.has(c))return;let b=u.get(s);b&&clearTimeout(b);let H=setTimeout(()=>{u.delete(s),m(c)},n);u.set(s,H)}function v(i){let s=document.createTreeWalker(i,NodeFilter.SHOW_ELEMENT),a=s.nextNode();for(;a;){let c=a;for(let b of Object.keys(c))b.indexOf("__krate_")===0&&delete c[b];a=s.nextNode()}}let T=null;function ie(){let i=h(document),s=document.querySelector("template[data-krate-loading]");s&&s.content&&i&&(T=s.content.cloneNode(!0),document.body.appendChild(T)),i&&(i.style.transition=`opacity ${t}ms ease`,i.style.opacity="0")}function x(){T&&T.parentNode&&T.parentNode.removeChild(T),T=null;let i=h(document);i&&(i.style.opacity="1")}function _(i){try{let s=globalThis.__krate_onNavigation;typeof s=="function"&&s(i)}catch(s){}}function S(i,s,a,c={}){let{replace:b=!1,scroll:H=!0,restoreScroll:N=!1}=c,U=new DOMParser().parseFromString(i,"text/html"),be=h(U),z=h(document);if(!be||!z){location.href=s;return}let fe=U.querySelector("title");fe&&(document.title=fe.textContent||""),typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),v(z),ne(z,be);let me=U.querySelectorAll('link[rel="stylesheet"]'),pe=new Set;me.forEach(A=>{let M=A.getAttribute("href");M&&pe.add(M)}),document.querySelectorAll('link[rel="stylesheet"]').forEach(A=>{let M=A.getAttribute("href");M&&!pe.has(M)&&A.remove()});let he=new Set;document.querySelectorAll('link[rel="stylesheet"]').forEach(A=>{he.add(A.href)}),me.forEach(A=>{let M=A.getAttribute("href");if(M&&!he.has(M)){let j=document.createElement("link");j.rel="stylesheet",j.href=M,document.head.appendChild(j)}}),De(a,s).then(()=>{try{Ke(),g()}catch(A){try{let M=globalThis.__krate_onHydrationError;typeof M=="function"&&M(A)}catch(M){}location.href=s}}),x();let Ue=location.pathname+location.search;if(b)history.replaceState({},"",s);else{if(!N){if(I.size>=Et){let A=I.keys().next().value;A!==void 0&&I.delete(A)}I.set(Ue,window.scrollY)}history.pushState({},"",s)}se(s,{restoreScroll:N,scroll:H}),oe(),window.dispatchEvent(new CustomEvent("krate:navigate",{detail:{url:s}})),_(s)}function _e(i){let s=i.indexOf("#");if(s<0||s===i.length-1)return!1;let a=i.slice(s);try{let c=document.querySelector(a);if(c)return c.scrollIntoView({behavior:"smooth",block:"start"}),!0}catch(c){return!1}return!1}function se(i,s){if(s.restoreScroll){let a=I.get(i);if(a!==void 0){window.scrollTo(0,a);return}}_e(i)||s.scroll&&window.scrollTo(0,0)}function oe(){let i=location.pathname;document.querySelectorAll("a[data-krate-link]").forEach(s=>{let a=s.getAttribute("href");if(!a){s.removeAttribute("aria-current");return}let c=a;try{c=new URL(a,location.origin).pathname}catch(H){return}c===i||i==="/"&&(c===""||c==="/")||c!=="/"&&c.length>1&&i.startsWith(c)?s.setAttribute("aria-current","page"):s.removeAttribute("aria-current")})}function De(i,s){return i.length===0?Promise.resolve():Promise.all(i.map(a=>{let c=a.getAttribute("src");return c?Be(c,s):Promise.resolve()})).then(()=>{})}function Be(i,s){return new Promise(a=>{let c=document.createElement("script"),b=ae(i,s);c.src=b,Re.test(b)||c.setAttribute("data-krate-spa",""),c.onload=()=>a(),c.onerror=()=>a(),document.body.appendChild(c)})}function ae(i,s){if(/^(https?:)?\/\//.test(i)||i.startsWith("/"))return new URL(i,s).href;let a=s;if(!a.endsWith("/")){let c=a.lastIndexOf("/");a=c>0?a.slice(0,c+1):"/"}return new URL(i,a).href}function Ke(){typeof globalThis.__krate_hydrate=="function"&&globalThis.__krate_hydrate()}function qe(i,s){typeof globalThis.disposeAll=="function"&&globalThis.disposeAll(),history.pushState({},"",s),_(s),document.open(),document.write(i),document.close()}function Fe(){return r!==null?Promise.resolve(r):fetch("/404.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(r=i,i)).catch(()=>null)}function Ve(){return o!==null?Promise.resolve(o):fetch("/500.html",{headers:{Accept:"text/html"}}).then(i=>i.ok?i.text():null).then(i=>(o=i,i)).catch(()=>null)}function ue(i,s){document.querySelectorAll("script[data-krate-spa]").forEach(b=>b.remove());let a=[],c=new Set;return document.querySelectorAll("script[src]").forEach(b=>{c.add(b.src)}),i.querySelectorAll("script[src]").forEach(b=>{let H=b.getAttribute("src");H&&!c.has(ae(H,s))&&a.push(b)}),a}function le(i,s={}){let a=w.get(i);if(a){let H=new DOMParser().parseFromString(a,"text/html");S(a,i,ue(H,i),s);return}ie(),R&&R.abort(),R=new AbortController;let c=R.signal;fetch(i,{headers:{Accept:"text/html"},signal:c}).then(b=>b.ok?b.text().then(H=>{let ge=new DOMParser().parseFromString(H,"text/html");S(H,i,ue(ge,i),s)}):(b.status>=500?Ve():Fe()).then(N=>{N?qe(N,i):location.href=i})).catch(b=>{(b==null?void 0:b.name)!=="AbortError"&&(x(),location.href=i)}).finally(()=>{R&&!c.aborted&&(R=void 0)})}let ce=i=>{if(i.defaultPrevented||i.button!==0||i.metaKey||i.ctrlKey||i.shiftKey||i.altKey)return;let s=i.target.closest("a[data-krate-link]");if(!s||!f(s))return;i.preventDefault();let a=s.getAttribute("href");if(!a)return;let c=new URL(a,location.origin).href,b=s.hasAttribute("data-krate-replace"),H=s.getAttribute("data-krate-scroll")!=="false";if(a===location.pathname+location.search+location.hash){b&&history.replaceState({},"",a),se(c,{scroll:H});return}le(c,{replace:b,scroll:H})},de=()=>{le(location.href,{restoreScroll:!0})};document.addEventListener("click",ce),window.addEventListener("popstate",de),E(),oe(),document.querySelectorAll("script[src]").forEach(i=>{Re.test(i.src)||i.setAttribute("data-krate-spa","")}),V=()=>{document.removeEventListener("click",ce),window.removeEventListener("popstate",de),l()}}function At(){V&&(V(),V=null),re=!1,Ie()}return Ye(Mt);})();
2
2
  for (const k in __krate_exports) { window[k] = __krate_exports[k]; }
package/dist/signal.d.ts CHANGED
@@ -1,4 +1,102 @@
1
1
  export declare function disposeAll(): void;
2
+ /** ARIA role presets and raw overrides accepted by every CSS primitive. */
3
+ export interface CSSARIAOptions {
4
+ /**
5
+ * Accessibility semantics to synthesize. Defaults are native (radios,
6
+ * checkboxes) and ship no JS. Presets that need synthesized state
7
+ * (`tabs`, `listbox`, `accordion`, `disclosure`, `dialog`, `menu`,
8
+ * `popover`) inject a tiny ARIA synchroniser automatically.
9
+ */
10
+ as?: 'radiogroup' | 'tabs' | 'tablist' | 'listbox' | 'menu' | 'menubar' | 'accordion' | 'disclosure' | 'dialog' | 'modal' | 'popover' | 'switch' | 'checkbox';
11
+ /** Accessible label for the scope container. */
12
+ label?: string;
13
+ /** Raw ARIA overrides (`{ role, 'aria-controls', panelRole }`); `false` opts out of all ARIA. */
14
+ aria?: false | Record<string, string>;
15
+ }
16
+ /**
17
+ * CSS custom properties driven by the selected option. Each property maps an
18
+ * option to a value emitted verbatim (quote strings for `content:`). Every
19
+ * choice/toggle scope also publishes the built-in `--krate-current`.
20
+ *
21
+ * ```ts
22
+ * createCSSChoice('solo', { vars: { '--price': { solo: '"$9"', pro: '"$29"' } } })
23
+ * ```
24
+ */
25
+ export type CSSVars<T extends string | number> = Record<string, Partial<Record<T, string>>>;
26
+ /** Options accepted by the CSS state primitives. */
27
+ export interface CSSPrimitiveOptions<T extends string | number> extends CSSARIAOptions {
28
+ vars?: CSSVars<T>;
29
+ options?: readonly T[];
30
+ }
31
+ /**
32
+ * Zero-JS mutually-exclusive state (tabs, segments). The Krate compiler rewrites
33
+ * every `createCSSChoice` declaration at build time into hidden radio inputs +
34
+ * `:has()` CSS, so it is **never** emitted to the client at runtime. Reading the
35
+ * getter as JSX text (`{tab()}`) compiles to a live value driven by the
36
+ * inherited `--krate-current` custom property — still zero JS. Custom `vars`
37
+ * publish more inheritable properties for computed text/themes.
38
+ *
39
+ * If a component cannot be compiled to CSS the build does not fall back; it
40
+ * fails with an error telling you to replace the call with `createSignal`.
41
+ *
42
+ * @param initial - The initially-selected option.
43
+ * @param options - A literal option array, or an options object
44
+ * (`{ options, as, aria, vars, label }`). When omitted, the compiler infers
45
+ * options from every literal the setter is called with.
46
+ */
47
+ export declare function createCSSChoice<T extends string | number>(initial: T, _options?: readonly T[] | CSSPrimitiveOptions<T>): [() => T, (next: T) => void];
48
+ /**
49
+ * Zero-JS boolean state (a single checkbox). Compiler-erased like
50
+ * `createCSSChoice`; the runtime body only exists so type-checking and any
51
+ * server-side evaluation succeed. `{on()}` renders live text via the
52
+ * `--krate-current` property ("on"/"off").
53
+ */
54
+ export declare function createCSSToggle(initial: boolean, _options?: CSSARIAOptions & {
55
+ vars?: {
56
+ on?: string;
57
+ off?: string;
58
+ };
59
+ }): [() => boolean, (next: boolean) => void];
60
+ /**
61
+ * Zero-JS independent boolean flags (`createCSSFlags(['a','b'])`). Returns a
62
+ * getter object keyed by flag name plus a setter. Compiler-erased like
63
+ * `createCSSChoice`.
64
+ */
65
+ export declare function createCSSFlags<K extends string>(flags: readonly K[], _options?: CSSARIAOptions & {
66
+ vars?: Record<string, Partial<Record<K, string>>>;
67
+ }): [Record<K, () => boolean>, (flag: K, value: boolean) => void];
68
+ /**
69
+ * Zero-JS optional radio group (`createCSSGroup`) — an accordion, disclosure,
70
+ * dialog, menu, or popover. `null` means "closed". Compiler-erased like the
71
+ * other CSS primitives; the runtime body is a type-checking shim only.
72
+ */
73
+ export declare function createCSSGroup<T extends string | number>(initial: T | null, _options?: readonly T[] | CSSPrimitiveOptions<T>): [() => T | null, (next: T | null) => void];
74
+ /**
75
+ * Zero-JS discrete range (`createCSSRange`) — a stepped slider, stepper, or
76
+ * progress indicator. Values are integers from `min` to `max` by `step`.
77
+ * Compiler-erased; the runtime body is a type-checking shim only.
78
+ */
79
+ export declare function createCSSRange(initial: number, _options: CSSARIAOptions & {
80
+ min?: number;
81
+ max?: number;
82
+ step?: number;
83
+ }): [() => number, (next: number) => void];
84
+ /** Actions destructured from a `createCSSStack` result. */
85
+ export interface CSSStackActions<K extends string> {
86
+ push: (node: K) => void;
87
+ pop: () => void;
88
+ clear: () => void;
89
+ }
90
+ /**
91
+ * Zero-JS navigation stack (`createCSSStack`) — a declared tree of nested
92
+ * panels for drill-down menus and multi-level drawers. The compiler infers the
93
+ * tree from where each literal `push('node')` appears; `top()` reads the
94
+ * deepest open node. Compiler-erased; the runtime body is a shim only.
95
+ */
96
+ export declare function createCSSStack<K extends string>(_nodes: readonly K[], _options?: CSSARIAOptions): [{
97
+ top: () => K;
98
+ peek: () => K;
99
+ }, CSSStackActions<K>];
2
100
  export declare function createSignal<T>(initial: T): [() => T, (next: T | ((prev: T) => T)) => void];
3
101
  export declare function createEffect(fn: () => void): () => void;
4
102
  export declare function onCleanup(fn: () => void): void;
package/dist/signal.js CHANGED
@@ -47,6 +47,79 @@ export function disposeAll() {
47
47
  pending.length = 0;
48
48
  flushScheduled = false;
49
49
  }
50
+ /**
51
+ * Zero-JS mutually-exclusive state (tabs, segments). The Krate compiler rewrites
52
+ * every `createCSSChoice` declaration at build time into hidden radio inputs +
53
+ * `:has()` CSS, so it is **never** emitted to the client at runtime. Reading the
54
+ * getter as JSX text (`{tab()}`) compiles to a live value driven by the
55
+ * inherited `--krate-current` custom property — still zero JS. Custom `vars`
56
+ * publish more inheritable properties for computed text/themes.
57
+ *
58
+ * If a component cannot be compiled to CSS the build does not fall back; it
59
+ * fails with an error telling you to replace the call with `createSignal`.
60
+ *
61
+ * @param initial - The initially-selected option.
62
+ * @param options - A literal option array, or an options object
63
+ * (`{ options, as, aria, vars, label }`). When omitted, the compiler infers
64
+ * options from every literal the setter is called with.
65
+ */
66
+ export function createCSSChoice(initial, _options) {
67
+ return createSignal(initial);
68
+ }
69
+ /**
70
+ * Zero-JS boolean state (a single checkbox). Compiler-erased like
71
+ * `createCSSChoice`; the runtime body only exists so type-checking and any
72
+ * server-side evaluation succeed. `{on()}` renders live text via the
73
+ * `--krate-current` property ("on"/"off").
74
+ */
75
+ export function createCSSToggle(initial, _options) {
76
+ return createSignal(initial);
77
+ }
78
+ /**
79
+ * Zero-JS independent boolean flags (`createCSSFlags(['a','b'])`). Returns a
80
+ * getter object keyed by flag name plus a setter. Compiler-erased like
81
+ * `createCSSChoice`.
82
+ */
83
+ export function createCSSFlags(flags, _options) {
84
+ const getters = {};
85
+ for (const flag of flags) {
86
+ const [get] = createSignal(false);
87
+ getters[flag] = get;
88
+ }
89
+ // No-op: the compiler compiles flags to checkboxes, so this body is only a
90
+ // type-checking/server-evaluation shim.
91
+ const set = (_flag, _value) => { };
92
+ return [getters, set];
93
+ }
94
+ /**
95
+ * Zero-JS optional radio group (`createCSSGroup`) — an accordion, disclosure,
96
+ * dialog, menu, or popover. `null` means "closed". Compiler-erased like the
97
+ * other CSS primitives; the runtime body is a type-checking shim only.
98
+ */
99
+ export function createCSSGroup(initial, _options) {
100
+ return createSignal(initial);
101
+ }
102
+ /**
103
+ * Zero-JS discrete range (`createCSSRange`) — a stepped slider, stepper, or
104
+ * progress indicator. Values are integers from `min` to `max` by `step`.
105
+ * Compiler-erased; the runtime body is a type-checking shim only.
106
+ */
107
+ export function createCSSRange(initial, _options) {
108
+ return createSignal(initial);
109
+ }
110
+ /**
111
+ * Zero-JS navigation stack (`createCSSStack`) — a declared tree of nested
112
+ * panels for drill-down menus and multi-level drawers. The compiler infers the
113
+ * tree from where each literal `push('node')` appears; `top()` reads the
114
+ * deepest open node. Compiler-erased; the runtime body is a shim only.
115
+ */
116
+ export function createCSSStack(_nodes, _options) {
117
+ const top = () => _nodes[0];
118
+ return [
119
+ { top, peek: top },
120
+ { push: (_node) => { }, pop: () => { }, clear: () => { } },
121
+ ];
122
+ }
50
123
  export function createSignal(initial) {
51
124
  let value = initial;
52
125
  const subs = new Set();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krate/runtime",
3
- "version": "0.4.0-beta.2",
3
+ "version": "0.4.0-beta.4",
4
4
  "description": "Client-side runtime for Krate — signals, hydration, SPA router, resources, and context.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",