@torpor/view 1.2.5 → 1.3.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/dist/{AsyncOptions-ClS1_ERX.d.mts → AsyncOptions-BDtArmeL.d.mts} +2 -8
- package/dist/AsyncOptions-BDtArmeL.d.mts.map +1 -0
- package/dist/{AsyncOptions-BtMe2PAd.d.cts → AsyncOptions-C_7mWR6F.d.cts} +2 -8
- package/dist/AsyncOptions-C_7mWR6F.d.cts.map +1 -0
- package/dist/{Effect-DazmAdyC.d.mts → Effect-99HYQdzZ.d.mts} +50 -33
- package/dist/Effect-99HYQdzZ.d.mts.map +1 -0
- package/dist/{Effect-Dewn7MLc.d.cts → Effect-Bf8fz_zC.d.cts} +50 -33
- package/dist/Effect-Bf8fz_zC.d.cts.map +1 -0
- package/dist/compile.cjs +1509 -120
- package/dist/compile.d.cts +268 -1
- package/dist/compile.d.cts.map +1 -1
- package/dist/compile.d.mts +268 -1
- package/dist/compile.d.mts.map +1 -1
- package/dist/compile.mjs +1506 -121
- package/dist/compile.mjs.map +1 -1
- package/dist/dev.d.cts +1 -1
- package/dist/dev.d.mts +1 -1
- package/dist/{fromWebSocket-DrN-IduP.cjs → fromWebSocket-Cdoghvmh.cjs} +15 -0
- package/dist/{fromWebSocket-CFGoMkV2.mjs → fromWebSocket-ERhd9KZR.mjs} +11 -2
- package/dist/fromWebSocket-ERhd9KZR.mjs.map +1 -0
- package/dist/index.cjs +223 -158
- package/dist/index.d.cts +24 -8
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +24 -8
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +223 -158
- package/dist/index.mjs.map +1 -1
- package/dist/runtime.iife.js +1 -0
- package/dist/slotAutoClose-BbKfzpkz.cjs +177 -0
- package/dist/slotAutoClose-CgDkf8fM.mjs +156 -0
- package/dist/slotAutoClose-CgDkf8fM.mjs.map +1 -0
- package/dist/ssr.cjs +57 -3
- package/dist/ssr.d.cts +53 -2
- package/dist/ssr.d.cts.map +1 -1
- package/dist/ssr.d.mts +53 -2
- package/dist/ssr.d.mts.map +1 -1
- package/dist/ssr.mjs +51 -2
- package/dist/ssr.mjs.map +1 -1
- package/package.json +8 -5
- package/dist/AsyncOptions-BtMe2PAd.d.cts.map +0 -1
- package/dist/AsyncOptions-ClS1_ERX.d.mts.map +0 -1
- package/dist/Effect-DazmAdyC.d.mts.map +0 -1
- package/dist/Effect-Dewn7MLc.d.cts.map +0 -1
- package/dist/fromWebSocket-CFGoMkV2.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var TorporView=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=Symbol.for(`torp.Context`),n=globalThis[t]??={activeTarget:null,previousEffect:null,extent:0,batch:0,batchOperation:0,registerComputed:null,effectsToRun:[],firstSignalToUpdate:null,lastSignalToUpdate:null,activeRegion:null,previousRegion:null,rootRegion:null,awaitBoundary:null,suspendPeek:!1,suspendPeekHit:!1,refreshSignals:null,refreshInitialized:null,mountEffects:[],stashedEvents:[],stashedAnimations:[],hydrationNode:null,serverValues:null};function r(e,t,r){n.stashedAnimations.push({region:n.activeRegion,el:e,in:t,out:r})}function i(e,t,r){r!=null&&n.stashedEvents.push({el:e,type:t,listener:r})}function a(e){return e.nodeType===3}let o=/^\^(?:\d+)?$/;function s(e){return o.test(e)}function c(e){if(!e.startsWith(`^`)||e.length===1)return;let t=Number(e.slice(1));return Number.isNaN(t)?void 0:t}function l(e){return e.nodeType===8}function u(e){if(e!==null&&l(e)&&s(e.data)){let t=e;e=e.nextSibling,t.remove()}return n.hydrationNode=e,e}function d(e,t=!1){if(n.hydrationNode!==null){if(t&&a(e))return e;let r=u(e.nextSibling);for(;!t&&r!==null&&a(r)&&r.textContent?.trim()===``;)r=u(r.nextSibling);return!t&&r!==null&&r.nodeName===`TBODY`&&r.firstChild&&a(e)&&(r=r.firstChild,n.hydrationNode=r),r}return e.nextSibling}let f=Symbol.for(`t_dev_context`),p=()=>{},m=globalThis[f]??={enabled:!1,depth:0,index:-1,boundaries:[],format:()=>``,getDetails:()=>``,unmark:p,mark:p,onWatch:p,onRun:p,onRegionPushed:p,onRegionPopped:p,onRegionCleared:p,signalSet:p,effectRun:p};function h(e,t){if(m.enabled&&!e)throw Error(t)}function g(e){let t=null;for(let n=e.firstSource;n!==null;n=n.nextSource)e.didError||!n.active?(t===null?e.firstSource=n.nextSource:t.nextSource=n.nextSource,n.previousTarget===null?n.source.firstTarget===n&&(n.source.firstTarget=n.nextTarget):n.previousTarget.nextTarget=n.nextTarget):(n.recalc=!1,t=n)}function _(e){for(let t=e.firstSource;t!==null;t=t.nextSource)t.active=!1}function v(e){let t=n.activeTarget;if(t!==null){for(let n=t.firstSource;n!==null;n=n.nextSource)if(n.source===e){n.active=!0;return}let n=e.firstTarget,r={source:e,target:t,previousTarget:null,nextTarget:n,nextSource:t.firstSource,active:!0,recalc:!1};n!==null&&(n.previousTarget=r),e.firstTarget=r,t.firstSource=r}}function y(e){let t=n.activeTarget;e.running=!0,e.didError=!1,e.didSuspend=!1;try{n.activeTarget=e,e.value=e.run()}catch(t){throw e.didError=!0,e.value=t,t}finally{n.activeTarget=t,e.running=!1}return v(e),e.value}function ee(e){let t=te(e),n=!1;if(t){_(e);let t=e.value;y(e),n=e.value!==t,g(e)}if(e.recalc=!1,!n)for(let t=e.firstTarget;t!==null;t=t.nextTarget)t.active=!0,t.recalc=!1;return n}function te(e){let t=!1;for(let n=e.firstSource;n!==null;n=n.nextSource)if(n.recalc){if(n.source.type===0)return!0;if(n.source.recalc)t=!0;else return!0}if(t){for(let t=e.firstSource;t!==null;t=t.nextSource)if(t.recalc&&t.source.type===1&&t.source.recalc){let r=n.activeTarget;n.activeTarget=e;let i=ee(t.source);if(n.activeTarget=r,i)return!0}}return!1}function b(e){let t=e;for(let r=0;r<e.extent&&t!==null;r++){if(typeof t.cleanup==`function`){let e=n.activeTarget;n.activeTarget=null;try{t.cleanup()}catch(e){throw t.didError=!0,g(t),e}finally{t.cleanup=void 0,n.activeTarget=e}}t=t.nextEffect}}function ne(e){te(e)&&(b(e),_(e),C(e),g(e))}function re(e,t){let n=e.region??null;for(;n!==null;){let r=n.errorBoundary;if(r!==void 0&&r.effect!==null){let n=r.effect,i=[];for(let e=n.firstSource;e!==null;e=e.nextSource)i.push(e.source);for(let t of e.errorSources??[])i.includes(t)||i.push(t);return r.error=t,r.hasError=!0,r.heldSignals=i,b(n),_(n),C(n),g(n),!0}let i=n.depth,a=n.previousRegion;for(;a!==null&&a.depth>=i;)a=a.previousRegion;n=a}return!1}function ie(e){let t=e.suspendSources;if(!t||t.size===0)return;let r=n.activeTarget;n.activeTarget=e;for(let e of t)v(e);n.activeTarget=r}function ae(){let e=null,t=n.effectsToRun;for(let r=0;r<t.length;r++){let i=t[r];n.batchOperation++,i.queued=!1;try{ne(i)}catch(t){let n=!1;try{n=re(i,t)}catch(t){e===null&&(e={error:t})}n||(ie(i),e===null&&(e={error:t}))}}for(let e of t)e.queued=!1;n.effectsToRun=[];let r=n.firstSignalToUpdate;for(n.firstSignalToUpdate=null,n.lastSignalToUpdate=null;r!==null;){let e=r.nextSignalToUpdate;r.nextSignalToUpdate=null,r=e}if(e!==null)throw e.error}function x(){if(h(n.batch>0,`batchEnd called without a matching batchStart`),n.batch>1)n.batch--;else try{ae()}finally{n.batch=0,n.batchOperation=0,n.previousEffect=null}}function S(){n.batch++}function C(e){m.effectRun(e);let t=n.activeTarget,r=n.extent;e.didError=!1,e.errorSources=null,e.didSuspend=!1,e.suspendSources=null,S();try{n.previousEffect!==null&&(n.previousEffect.nextEffect=e),n.activeTarget=e,n.previousEffect=e,n.extent=1,e.cleanup=e.run(),e.extent=n.extent}catch(t){e.didError=!0;let n=null;for(let t=e.firstSource;t!==null;t=t.nextSource)(n??=[]).push(t.source);throw e.errorSources=n,g(e),t}finally{n.activeTarget=t,n.extent+=r-1,x()}}function w(e,t,r){let i={type:2,run:e,cleanup:void 0,firstSource:null,nextEffect:null,extent:0,queued:!1,didError:!1,didSuspend:!1,region:null,errorSources:null,name:t,isMountEffect:r?.isMountEffect,forVarMask:r?.forVarMask},a=n.activeRegion;return a!==null&&(a.effects.push(i),i.region=a),m.onRun(i),C(i),i}function oe(e){let t=n.activeTarget;n.activeTarget=null;let r=e();return n.activeTarget=t,r}function se(){if(n.mountEffects.length===0)return;let e=n.activeRegion;for(let e of n.mountEffects)n.activeRegion=e.region,w(()=>ce(e.fn),void 0,{isMountEffect:!0});n.activeRegion=e,n.mountEffects.length=0}function ce(e){if(!m.enabled)return oe(e);let t=e(),r=n.activeTarget;return r!==null&&r.type===2&&r.firstSource!==null&&(console.warn(`[torpor] A $onmount/onmount callback read reactive state, but mount callbacks run only once and will not re-run. Wrap the reactive part in $run(), e.g. $onmount(() => { $run(() => ...); });`),_(r),g(r)),t}function T(e){return/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[a-z%]+)?$/i.test(e.trim())?Number.parseFloat(e):null}function E(e){return T(e)===0}function D(e){return T(e)===1}function O(e,t,n){return e.length===t&&e.every(n)}function le(e,t){switch(e){case`matrix`:{let e=t.map(T);return e.length===6&&e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1&&e[4]===0&&e[5]===0}case`matrix3d`:{let e=t.map(T),n=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];return e.length===16&&e.every((e,t)=>e===n[t])}case`translate`:return t.length>=1&&t.length<=2&&t.every(E);case`translatex`:case`translatey`:case`translatez`:return O(t,1,E);case`translate3d`:return O(t,3,E);case`scale`:return t.length>=1&&t.length<=2&&t.every(D);case`scalex`:case`scaley`:case`scalez`:return O(t,1,D);case`scale3d`:return O(t,3,D);case`rotate`:case`rotatex`:case`rotatey`:case`rotatez`:case`skewx`:case`skewy`:return O(t,1,E);case`rotate3d`:return t.length===4&&E(t[3]);case`skew`:return t.length>=1&&t.length<=2&&t.every(E);default:return!1}}function k(e){let t=e.trim().toLowerCase();if(t===``||t===`none`)return!0;let n=t;for(;n.length>0;){let e=/^([a-z0-9]+)\(([^()]*)\)/.exec(n);if(!e)return!1;let t=e[2].split(`,`).map(e=>e.trim());if(!le(e[1],t))return!1;n=n.slice(e[0].length).trim()}return!0}function ue(e){if(e===null)return null;if(Array.isArray(e)){let t=e.length-1;for(;t>=0&&e[t]==null;)t--;if(t<0)return e;let n=e[t];if(typeof n.transform!=`string`||!k(n.transform))return e;let r=e.slice();return r[t]={...n,transform:`none`},r}let t=e.transform;if(Array.isArray(t)){let n=t[t.length-1];if(typeof n!=`string`||!k(n))return e;let r=t.slice();return r[r.length-1]=`none`,{...e,transform:r}}return typeof t==`string`&&k(t)?{...e,transform:`none`}:e}async function de(e,t,r,i){let a=Object.assign({direction:t?`normal`:`reverse`,duration:300,easing:`ease-in-out`,fill:`forwards`},i),o=a.fill===`forwards`||a.fill===`both`,s=t===!0&&o?ue(r):r,c=e.animate(s,a);setTimeout(()=>{c.timeline=e.ownerDocument.timeline},1);let l=n.activeRegion;l.animations??=/* @__PURE__ */ new Set,l.animations.add(c),await c.finished}let fe=/* @__PURE__ */ new Set(/* @__PURE__ */ `auxclick.beforeinput.change.click.compositionend.compositionstart.compositionupdate.contextmenu.dblclick.drag.dragend.dragenter.dragleave.dragover.dragstart.drop.focusin.focusout.input.keydown.keypress.keyup.mousedown.mousemove.mouseout.mouseover.mouseup.pointerdown.pointermove.pointerout.pointerover.pointerup.reset.submit.touchend.touchmove.touchstart.wheel`.split(`.`));function pe(e){return fe.has(e)}let A=`torp.$$`,me=Symbol.for(`torp.delegated.registered`);function he(e){let t=e.target,n=e.currentTarget,r=A+e.type;for(;t!=null&&t!==n;){let n=t[r];if(n!==void 0){Object.defineProperty(e,"currentTarget",{configurable:!0,value:t,writable:!1});try{n.call(t,e)}finally{delete e.currentTarget}return}t=t.parentNode}}function ge(e){if(typeof document>`u`)return;let t=document[me];t||(t=/* @__PURE__ */ new Set,document[me]=t),!t.has(e)&&(t.add(e),document.addEventListener(e,he))}function _e(e,t,n){let r=A+t;n==null?e[r]=void 0:(ge(t),e[r]=n)}let j=`torp.$directListeners`;function ve(e,t,n){let r=e[j];r||(r=[],e[j]=r),r.push({type:t,listener:n})}function ye(e,t){for(let n of fe){let r=A+n,i=e[r];i!==void 0&&(t[r]=i)}let n=e[j];if(n){t[j]=n;for(let{type:e,listener:r}of n)t.addEventListener(e,r)}}function be(e){return e.nodeType===11}function xe(e,t,r){if(!be(e)){if(r===null&&se(),n.stashedEvents.length>0){for(let e of n.stashedEvents)pe(e.type)?_e(e.el,e.type,e.listener):(e.el.addEventListener(e.type,e.listener),ve(e.el,e.type,e.listener));n.stashedEvents.length=0}for(let e of n.stashedAnimations)n.activeRegion=e.region,w(function(){if(e.in!==void 0&&de(e.el,!0,e.in.keyframes,e.in.options),e.out!==void 0)return()=>{de(e.el,!1,e.out.keyframes,e.out.options)}});n.stashedAnimations.length=0,n.activeRegion=t}}function Se(e,t,r){let i=n.activeRegion,a=n.hydrationNode;i.startNode=e,i.endNode=e,t=r?.parentNode??t,a===null&&t.insertBefore(e,r),xe(t,i,a),a!==null&&d(e)}function Ce(e,t,r,i,a){let o=n.activeRegion,s=n.hydrationNode;s===null?(o.startNode=e.firstChild,o.endNode=e.lastChild):(a!==void 0&&a.parentNode!==null&&(o.startNode=a),o.endNode=i??s),t=r?.parentNode??t,s===null&&t.insertBefore(e,r),xe(t,o,s),s!==null&&i!==void 0&&d(i)}function we(e,t,n){if(t!==void 0){for(let[r,i]of Object.entries(t))if(!n.includes(r)){if(r.startsWith(`on`)){let t=r.substring(2);pe(t)?_e(e,t,i):e.addEventListener(t,i)}else w(function(){e.setAttribute(r,i)})}}}let M=Symbol.for(`torp.ProxyData`),N=Symbol.for(`torp.ProxyKeys`);function P(e){return e!=null&&e[M]!==void 0?e[M].target??e:e}function Te(e,t){if(typeof e==`string`)return t!==void 0&&(e+=` `+t),e;{let n=[];return Ee(``,e,n),t!==void 0&&n.push(t),n.join(` `)}}function Ee(e,t,n){if(t){if(t=P(t),Array.isArray(t))for(let e of t)Ee(e,e,n);else if(typeof t==`object`)for(let e in t)Ee(e,t[e],n);else n.push(e)}}let De=/[A-Z]+(?![a-z])|[A-Z]/g;function Oe(e){if(typeof e==`string`)return e;{let t=[];return ke(e,t),t.join(`; `)}}function ke(e,t){if(e){if(Array.isArray(e))for(let n of e)ke(n,t);else if(typeof e==`object`)for(let[n,r]of Object.entries(e)){if(r==null)continue;let e=n.replace(De,(e,t)=>(t>0?`-`:``)+e.toLowerCase());t.push(`${e}: ${r}`)}else t.push(String(e))}}function F(e){m.onRegionCleared(e);let t=e.animations===null?void 0:Array.from(e.animations),n=e.nextRegion;for(;n!==null&&n.depth>e.depth;){n.animations!==null&&(t??=[],t.push(...n.animations));let e=n.nextRegion;je(n),n.depth=-2,n=e}e.nextRegion=n,e.previousRegion!==null&&(e.previousRegion.nextRegion=e.nextRegion),e.nextRegion!==null&&(e.nextRegion.previousRegion=e.previousRegion),t===void 0?Ae(e):(t.forEach(e=>{e.reverse(),e.play()}),Promise.all(t.map(e=>e.finished)).then(()=>Ae(e)))}function Ae(e){if(e.startNode!==null&&e.endNode!==null){let t=e.endNode.nextSibling,n=e.startNode,r=e.startNode.parentNode===null,i=!1;if(r){let t=e.previousRegion;for(;t!==null&&t.depth>e.depth;)t=t.previousRegion;t!==null&&t.endNode!==null&&t.endNode.parentNode!==null&&(n=t.endNode,i=!0)}let a=e.endNode;for(;a!==null&&a!==n;){let e=a.previousSibling;if(a.remove(),e===null)break;a=e}!i&&a===e.startNode&&a.remove();let o=i?n:t;if(o!==null){let t=e.previousRegion,n=e.depth;for(;t!==null&&t.depth<n;)t.startNode!==null&&t.startNode.parentNode===null&&(t.startNode=o),n=t.depth,t=t.previousRegion}}je(e)}function je(e){e.generation=-1,e.startNode=null,e.endNode=null,e.previousRegion=null,e.nextRegion=null,e.animations=null,e.errorBoundary=void 0;for(let t of e.effects){typeof t.cleanup==`function`&&(t.cleanup(),t.cleanup=void 0);let e=t.firstSource;for(t.firstSource=null;e!==null;){let t=e.nextSource,n=e.previousTarget,r=e.nextTarget;n===null?e.source.firstTarget===e&&(e.source.firstTarget=r):n.nextTarget=r,r!==null&&(r.previousTarget=n),e.previousTarget=null,e.nextTarget=null,e.nextSource=null,e=t}}e.effects.length=0}function I(e){return{startNode:null,endNode:null,previousRegion:null,nextRegion:null,depth:-1,animations:null,name:e,effects:[]}}function L(e){n.activeRegion=e,m.onRegionPopped()}function R(e,t=!1){let r=n.activeRegion;if(t){let t=n.previousRegion;e.previousRegion=t;let i=t.nextRegion;t.nextRegion=e,e.nextRegion=i,i!==null&&(i.previousRegion=e),e.depth=r.depth+1}return n.activeRegion=e,n.previousRegion=e,m.onRegionPushed(e,t),r}let z=/* @__PURE__ */ new WeakMap;function Me(e,t){z.set(e,t)}function Ne(e,t,n,r,i,a){let o=I(m.enabled?`Layout slot`:void 0),s=R(o,!0),c=z.get(n);return c!==void 0&&(o.depth=c,z.delete(n)),e(n,r,i,a,{_:t}),L(s),o}function Pe(e){n.previousRegion=e.previousRegion;let t=e.startNode?.parentNode;t&&Me(t,e.depth),F(e)}function Fe(e){return e==null?``:typeof e==`string`?e:String(P(e))}let Ie=/* @__PURE__ */ new WeakMap;function Le(e,t){Ie.set(e,t)}function Re(e){return Ie.get(e)}function ze(e,t,n,r,i){if(t[n]===void 0){if(i===!0){let i=e.createElementNS(`http://www.w3.org/2000/svg`,`template`);i.innerHTML=r;let a=new DocumentFragment;a.append(...i.childNodes),t[n]=a}else{let i=e.createElement(`template`);i.innerHTML=r,t[n]=i.content}}return t[n].cloneNode(!0)}function Be(e,t,n,r,i){if(t[n]===void 0){if(i===!0){let i=e.createElementNS(`http://www.w3.org/2000/svg`,`template`);i.innerHTML=r,t[n]=i.firstElementChild}else{let i=e.createElement(`template`);i.innerHTML=r,t[n]=i.content.firstElementChild}}return t[n].cloneNode(!0)}function Ve(e){return e.constructor?.name===`AsyncFunction`}function He(e,t,r,i){if(Ve(t))throw Error(`The component was compiled for SSR (it renders to an HTML string) and cannot be hydrated in the browser. Import the client build instead, e.g. with the '?client' import query`);n.hydrationNode=e.firstChild,n.rootRegion=I(m.enabled?`Root`:void 0),n.previousRegion=n.rootRegion,R(n.rootRegion),t(e,null,r,void 0,i),n.hydrationNode=null,se()}function Ue(e,t,r,i){if(Ve(t))throw Error(`The component was compiled for SSR (it renders to an HTML string) and cannot be mounted in the browser. Import the client build instead, e.g. with the '?client' import query`);if(e.childElementCount>0)throw Error(`The parent node must have no child elements`);for(;e.firstChild!==null;)e.firstChild.remove();n.rootRegion===null&&(n.rootRegion=I(m.enabled?`Root`:void 0),n.previousRegion=n.rootRegion,R(n.rootRegion)),t(e,null,r,void 0,i)}function We(e){for(n.rootRegion!==null&&(F(n.rootRegion),n.rootRegion=null,n.previousRegion=null,n.activeRegion=null);e.firstChild!==null;)e.firstChild.remove()}function Ge(e,t,n){return{startNode:null,endNode:null,previousRegion:null,nextRegion:null,depth:-1,animations:null,name:n,data:e,key:t,effects:[]}}let B=/* @__PURE__ */ new WeakMap;function Ke(e,t){B.set(e,t)}function qe(e){let t=B.get(e);return t!==void 0&&B.delete(e),t}function Je(e){if(n.hydrationNode!==null&&l(e)&&e.data===`[`){let t=e.parentNode,r,i=e.nextSibling;for(;i!==null&&a(i)&&(i.textContent??``).trim()===``;)i=i.nextSibling;i!==null&&l(i)&&s(i.data)&&(r=c(i.data));let o=d(e);for(e.remove();o!==null&&l(o)&&s(o.data);){r===void 0&&(r=c(o.data));let e=o.nextSibling;o.remove(),o=e,n.hydrationNode=o}let u=o,f=1;for(;o!==null;){if(l(o)){if(o.data===`[`)f+=1;else if(o.data===`]`&&(--f,f===0)){let e=o.nextSibling;o.remove(),n.hydrationNode===o&&(n.hydrationNode=e);let t=u===o?null:u,i=n.activeRegion;return i.startNode===null&&(i.startNode=t??e),Le(e,t),r!==void 0&&Ke(e,r),e}}if(o.firstChild)o=o.firstChild;else if(o.nextSibling)o=o.nextSibling;else{let e=o.parentNode;for(;e!==null&&e.nextSibling===null&&e!==t;)e=e.parentNode;o=e===null||e===t?null:e.nextSibling}}if(o===null)throw Error(`End hydration comment not found`)}return e}function Ye(e){let t=e.firstChild;return n.hydrationNode!==null&&(t===null&&(t=e.appendChild(e.ownerDocument.createTextNode(``))),n.hydrationNode=t),t}function Xe(){let e=n.hydrationNode;for(;e!==null&&Ze(e);){let t=e.nextSibling;l(e)&&s(e.data)&&e.remove(),e=t,n.hydrationNode=e}for(;e!==null&&e.nodeName===`TBODY`&&e.firstChild!==null;)e=e.firstChild,n.hydrationNode=e;let t=n.activeRegion,r=e!==null&&l(e)&&e.data===`[`;return t.startNode===null&&!r&&(t.startNode=e),e}function Ze(e){return a(e)&&(e.textContent??``).trim()===``?!0:l(e)?s(e.data)||e.data===``:!1}function Qe(e){return n.hydrationNode===null?e:Xe()}function $e(e,t=!1){if(n.hydrationNode!==null){let e=n.hydrationNode;if(t&&!a(e)&&e.previousSibling!==null&&a(e.previousSibling)&&(e=e.previousSibling,n.hydrationNode=e),!t)return Xe();let r=n.activeRegion,i=e!==null&&l(e)&&e.data===`[`;return r.startNode===null&&!i&&(r.startNode=e),e}return e.firstChild}function et(e,t,r=0){let i=e;if(n.hydrationNode!==null){if(r===0)for(let e=0;e<t;e++)i=u(i.nextSibling);else for(let e=0;e<t;e++)i=d(i,!!(r&1<<e))}else for(let e=0;e<t;e++)i=i.nextSibling;return i}function tt(e,t){nt(e,t);let n=e.nextRegion;for(;n!==null&&n.depth>e.depth;)nt(n,t),n=n.nextRegion}function nt(e,t){for(let n of e.effects)n.isMountEffect||(n.forVarMask===void 0||(n.forVarMask&t)!==0)&&(b(n),_(n),C(n),g(n))}function rt(e){n.hydrationNode=e}function V(e,t){if(t===null)return;let n=e.nextRegion;for(;n!==null&&n.depth>e.depth&&n.startNode===null;)n=n.nextRegion;if(n===null||n.depth<=e.depth||n.startNode===t)return;let r=n.startNode,i=e.previousRegion,a=e.depth;for(;i!==null&&i.depth<a;)i.startNode===t&&(i.startNode=r),a=i.depth,i=i.previousRegion}function it(e,t,r,i){let a=!0;if(n.hydrationNode!==null&&t!==null){e.ssrBranchAnchor=t;let n=qe(t);n!==void 0&&(e.ssrBranchIndex=n)}let o=e.generation=(e.generation??0)+1;w(function(){if(e.generation!==o)return;e.depth===-2&&(e.recreate=!0);let i=R(e,a);a=!1,r(t),L(i),V(e,t),t!==null&&(n.hydrationNode!==null||e.ssrBranchRecreated===!0)&&(e.ssrBranchRecreated=void 0,n.hydrationNode=t)},i)}function H(e,t,r){let i=e.recreate;i&&(e.recreate=!1);let a=e.ssrBranchAnchor;if(a!==void 0){e.ssrBranchAnchor=void 0;let t=e.ssrBranchIndex;e.ssrBranchIndex=void 0;let i=n.hydrationNode;i!==null&&(t!==void 0&&t!==r||t===void 0&&i===a)&&(e.ssrBranchRecreated=!0,at(e,i,a))}let o=e.hasRenderedBranch!==!0;return e.hasRenderedBranch=!0,t===r?i?(e.nextRegion!==null&&e.nextRegion.depth>e.depth&&F(e.nextRegion),!0):!1:(!o&&e.nextRegion!==null&&e.nextRegion.depth>e.depth&&F(e.nextRegion),!0)}function at(e,t,r){let i=e.previousRegion,a=e.depth;for(;i!==null&&i.depth<a;)i.startNode===t&&(i.startNode=r),a=i.depth,i=i.previousRegion;n.hydrationNode=null;let o=t;for(;o!==null&&o!==r;){let e=o.nextSibling;o.remove(),o=e}}let ot=/* @__PURE__ */ new WeakMap;function st(e,t){let n;for(let r=0;r<t.length;r++){let i=t[r].key;if(i==null)continue;if(n===void 0&&(n=/* @__PURE__ */ new Set),!n.has(i)){n.add(i);continue}let a=ot.get(e);a===void 0&&(a=/* @__PURE__ */ new Set,ot.set(e,a)),a.has(i)||(a.add(i),console.warn(`[torpor] Duplicate @key value ${ct(i)} in a keyed @for list. Keys must be unique, or updates and removals will affect the wrong rows.`))}}function ct(e){try{let t=JSON.stringify(e);return t===void 0?String(e):t}catch{return String(e)}}function U(e){let t=e.firstTarget;if(t===null)return;let r=t,i;outer:for(;;){r.active=!1,r.recalc=!0;let e=r.target;if(e.type===2)e.queued||(e.queued=!0,n.effectsToRun.push(e));else if(!e.recalc&&(e.recalc=!0,e.firstTarget!==null)){i=e,i.rollback=r,r=e.firstTarget;continue}for(;r.nextTarget===null&&i!==void 0;){let e=i.rollback;if(e===null)break;if(r=e,r.source.type!==1){i=void 0;continue outer}i=r.source}if(r.nextTarget===null)break;r=r.nextTarget}}function W(e,t){let r=e.signals.get(t);if(r!==void 0&&r.firstTarget!==null){S();try{h(n.firstSignalToUpdate===null==(n.lastSignalToUpdate===null),`Signal update chain head/tail out of sync`),n.lastSignalToUpdate===null?(n.firstSignalToUpdate=r,n.lastSignalToUpdate=r):r.nextSignalToUpdate===null&&(n.lastSignalToUpdate.nextSignalToUpdate=r,n.lastSignalToUpdate=r),U(r)}finally{x()}}}var lt=class extends Error{constructor(){super(`Suspended async value`),this.name=`AwaitSuspend`}};let G=/* @__PURE__ */ new WeakMap;function K(e){if(typeof e!=`object`||!e)return e;if(e[M]!==void 0)return G.get(e)??e;if(e.then!==void 0||e.nodeType!==void 0)return e;let t=G.get(e);if(t!==void 0)return t;let n=St(e);return G.set(e,n),n}function q(e,t){let n=e.signals.get(t);n===void 0&&(n={type:0,firstTarget:null,nextSignalToUpdate:null},e.signals.set(t,n)),v(n)}function ut(e){if(v(e),n.suspendPeek)e.suspendQuiet||(n.suspendPeekHit=!0);else{if(n.activeTarget!==null&&(n.activeTarget.didSuspend=!0,n.activeTarget.type===2)){let t=n.activeTarget;(t.suspendSources??=/* @__PURE__ */ new Set).add(e)}if(n.awaitBoundary!==null){n.awaitBoundary.suspended=!0,n.awaitBoundary.pending.add(e);let t=n.awaitBoundary.effect;if(t!==null&&t!==n.activeTarget){let r=n.activeTarget;n.activeTarget=t,v(e),n.activeTarget=r}if(e.settle===void 0||!e.settle.ok)throw new lt}return e.settle!==void 0&&e.settle.ok?e.settle.value:void 0}}function dt(e,t,r){let i=e[M];if(t===M)return i;if((i.isDate||i.isMap||i.isSet)&&!Object.prototype.hasOwnProperty.call(e,t))return pt(i,e,t,r);let a=i.signals.get(t);if(a===void 0){let a=Object.getOwnPropertyDescriptor(e,t);if(a!==void 0){if(a.writable){if(i.shallow!==!0){let n=e[t],r=K(n);r!==n&&(e[t]=r)}q(i,t)}else if(a.get){let a=n.registerComputed;try{n.registerComputed=e=>{i.signals.set(t,e)};let a=Reflect.get(e,t,r),o=i.signals.get(t);return n.refreshSignals!==null&&o!==void 0&&o.type===1&&o.isAsync&&(n.refreshSignals.push(o),n.refreshInitialized?.add(o)),o!==void 0&&o.type===1&&o.didSuspend?ut(o):a}finally{n.registerComputed=a}}}else if(i.isArray){if(ft[t]!==void 0)return ft[t](i,e,t)}else q(i,t)}else if(a.type===0){if(i.shallow!==!0){let n=e[t];if(typeof n==`object`&&n){let r=Object.getOwnPropertyDescriptor(e,t);if(r!==void 0&&r.writable){let r=K(n);r!==n&&(e[t]=r)}}}q(i,t)}else if(a.type===1){if(n.refreshSignals!==null&&a.isAsync)return n.refreshSignals.push(a),a.value;if(a.running)throw Error(`Cycle detected`);if(a.recalc&&ee(a),a.didError)throw v(a),a.value;return a.didSuspend?ut(a):(v(a),a.value)}return e[t]}let ft={[Symbol.iterator]:function(e,t,r){return q(e,`length`),n.activeTarget=null,function(){let n=0;return{next(){if(n>=t.length)return{value:void 0,done:!0};let r=t[n];if(e.shallow!==!0){let e=K(r);e!==r&&(r=e,t[n]=r)}return q(e,String(n)),n++,{value:r,done:!1}},[Symbol.iterator](){return this}}}},pop:Y,push:Y,reverse:Y,shift:Y,sort:Y,splice:Y,unshift:Y,slice:J,concat:J,filter:J,map:J,toReversed:J,toSorted:J,toSpliced:J,indexOf:J,lastIndexOf:J,includes:J,find:J,findIndex:J,some:J,every:J,join:J,forEach:J,reduce:J,reduceRight:J,flat:J,flatMap:J,at:J};function J(e,t,n){return function(...r){return q(e,`length`),t[n].apply(t,r)}}function Y(e,t,n){return function(...r){let i=t[n].apply(t,r);return W(e,`length`),n!==`sort`&&n!==`reverse`&&W(e,N),i}}let X=Symbol(`torp.collection`),Z=`#time`;function pt(e,t,n,r){if(e.isDate)return mt(e,t,n);let i=(e.isMap?ht:_t)[n];return i===void 0?t[n]:i(e,t,n,r)}function Q(e){let t=typeof e;return t===`string`||t===`number`||t===`symbol`?e:X}function $(e,t){t!==X&&W(e,t),W(e,X)}function mt(e,t,n){if(typeof n==`symbol`)return n===Symbol.toPrimitive?function(n){let r=t[Symbol.toPrimitive](n);return q(e,Z),r}:t[n];if(typeof n!=`string`)return t[n];let r=t[n];return typeof r==`function`?n.startsWith(`set`)?function(...n){let i=t.getTime(),a=r.apply(t,n);return t.getTime()!==i&&W(e,Z),a}:n.startsWith(`get`)||n.startsWith(`to`)||n===`valueOf`?function(...n){let i=r.apply(t,n);return q(e,Z),i}:r:r}let ht={size:function(e,t){return q(e,X),t.size},get:function(e,t){return function(n){n=P(n),q(e,Q(n));let r=t.get(n);if(e.shallow!==!0){let e=K(r);return e!==r&&t.set(n,e),e}return r}},has:function(e,t){return function(n){return n=P(n),q(e,Q(n)),t.has(n)}},set:function(e,t,n,r){return function(n,i){if(n=P(n),t.has(n)&&P(t.get(n))===P(i))return r??t;let a=t.set(n,i);return $(e,Q(n)),r??a}},delete:function(e,t){return function(n){n=P(n);let r=t.delete(n);return $(e,Q(n)),r}},clear:function(e,t){return function(){let n=t.clear();S();try{for(let t of e.signals.keys())W(e,t)}finally{x()}return n}},keys:function(e,t){return function(){return q(e,X),[...t.keys()][Symbol.iterator]()}},values:function(e,t){return function(){q(e,X);let n=[...t.values()];return e.shallow!==!0&&(n=n.map(K)),n[Symbol.iterator]()}},entries:gt,[Symbol.iterator]:gt,forEach:function(e,t,n,r){return function(n,i){q(e,X);let a=e.shallow!==!0;t.forEach((e,o)=>{n.call(i,a?K(e):e,o,r??t)})}}};function gt(e,t){return function(){q(e,X);let n=e.shallow!==!0;return[...t.entries()].map(e=>[e[0],n?K(e[1]):e[1]])[Symbol.iterator]()}}let _t={size:function(e,t){return q(e,X),t.size},has:function(e,t){return function(n){return n=P(n),q(e,Q(n)),t.has(n)}},add:function(e,t,n,r){return function(n){if(n=P(n),t.has(n))return r??t;let i=t.add(n);return $(e,Q(n)),r??i}},delete:function(e,t){return function(n){n=P(n);let r=t.delete(n);return $(e,Q(n)),r}},clear:function(e,t){return function(){let n=t.clear();S();try{for(let t of e.signals.keys())W(e,t)}finally{x()}return n}},keys:vt,values:vt,[Symbol.iterator]:vt,entries:yt,forEach:function(e,t,n,r){return function(n,i){q(e,X);let a=e.shallow!==!0;t.forEach(e=>{let o=a?K(e):e;n.call(i,o,o,r??t)})}}};function vt(e,t){return function(){q(e,X);let n=[...t.values()];return e.shallow!==!0&&(n=n.map(K)),n[Symbol.iterator]()}}function yt(e,t){return function(){q(e,X);let n=e.shallow!==!0;return[...t.values()].map(e=>{let t=n?K(e):e;return[t,t]})[Symbol.iterator]()}}function bt(e,t,r,i){let a=e[t];if(r!==a){if(n.batchOperation>100)throw Error(`Cycle detected`);let a=e[M];m.signalSet(a,t),a.shallow!==!0&&(r=K(r));let o=!Object.prototype.hasOwnProperty.call(e,t);Reflect.set(e,t,r,i),W(a,t),o&&W(a,N),a.isArray&&typeof t!=`symbol`&&!isNaN(+t)&&W(a,`length`)}return!0}let xt={get:dt,set:bt,ownKeys:e=>{let t=e[M];return t!==void 0&&q(t,N),Reflect.ownKeys(e)},deleteProperty:(e,t)=>{let n=Reflect.deleteProperty(e,t),r=e[M];return n&&r!==void 0&&(W(r,t),W(r,N)),n}};function St(e,t){if(e==null||e[M]!==void 0)return e;let n={target:e,isArray:Array.isArray(e),isDate:e instanceof Date,isMap:e instanceof Map,isSet:e instanceof Set,shallow:t?.shallow===!0,signals:/* @__PURE__ */ new Map};Object.defineProperty(e,M,{value:n,writable:!0,enumerable:!1,configurable:!0});let r=new Proxy(e,xt);return m.onWatch(n),r}function Ct(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function wt(e,t,n){e=n?.parentNode??e;let r=t.endNode??t.startNode,i=t.startNode;for(;i!==null;){let t=i.nextSibling;if(e.insertBefore(i,n),i===r)break;i=t}}let Tt={shallow:!0};function Et(e,t,r,i,a,o){let s=Ge(e.data,e.key),c=n.activeRegion;s.depth=t.depth+1,n.activeRegion=s,o!==!0&&(s.data=St(s.data,Tt));let l=n.hydrationNode!==null&&n.hydrationNode===i,u=n.hydrationNode;return l&&(n.hydrationNode=null),a(s,r),l&&(n.hydrationNode=u),n.activeRegion=c,s}function Dt(e,t,r,i,a,o,s,c){let l=Array.from({length:a.length}),u;if(i.length>0){let e=i[i.length-1];for(u=e.nextRegion;u!==null&&u.depth>e.depth;)u=u.nextRegion}else u=e.nextRegion;let d=0,f=i.length-1,p=0,m=a.length-1,h=!1;for(;d<=f&&p<=m;)if(i[d].key===a[p].key){let e=i[d];e.data!==a[p].data&&s(e,a[p]),l[p]=e,d++,p++}else if(i[f].key===a[m].key){let e=i[f];e.data!==a[m].data&&s(e,a[m]),l[m]=e,f--,m--}else if(i[d].key===a[m].key){let e=i[d];wt(t,e,i[f].endNode?.nextSibling??r),h=!0,e.data!==a[m].data&&s(e,a[m]),l[m]=e,d++,m--}else if(i[f].key===a[p].key){let e=i[f];wt(t,e,i[d].startNode),h=!0,e.data!==a[p].data&&s(e,a[p]),l[p]=e,f--,p++}else break;if(d>f&&p<=m){let t=m+1<a.length?l[m+1].startNode:r;for(let n=p;n<=m;n++)l[n]=Et(a[n],e,t,r,o,c);h=!0}else if(p>m)for(let e=d;e<=f;e++)F(i[e]);else{let n=/* @__PURE__ */ new Map;for(let e=p;e<=m;e++)n.set(a[e].key,e);let u=!1;for(let e=d;e<=f;e++)if(n.has(i[e].key)){u=!0;break}if(u){let u=m-p+1,g=Array.from({length:u}).fill(0);for(let e=d;e<=f;e++){let t=i[e],r=n.get(t.key);r===void 0?F(t):(g[r-p]=e+1,t.data!==a[r].data&&s(t,a[r]),l[r]=t)}let _=Ct(g),v=_.length-1;for(let n=u-1;n>=0;n--){let i=p+n,s=i+1<a.length?l[i+1].startNode:r;g[n]===0?(l[i]=Et(a[i],e,s,r,o,c),h=!0):v<0||n!==_[v]?(wt(t,l[i],s),h=!0):v--}}else{let t=i[f]?.endNode?.nextSibling??r;for(let e=f;e>=d;e--)F(i[e]);for(let n=p;n<=m;n++)l[n]=Et(a[n],e,t,r,o,c),t=l[n].endNode.nextSibling;h=!0}}if(!h&&l.length>0){let e=l[l.length-1],t=e.nextRegion;for(;t!==null&&t.depth>e.depth;)e=t,t=t.nextRegion;return n.previousRegion=e,l}if(l.length>0){let t=e;for(let e=0;e<l.length;e++){let n=l[e];n.previousRegion=t,t.nextRegion=n;let r=n,i=n.nextRegion;for(;i!==null&&i.depth>n.depth;)r=i,i=i.nextRegion;t=r}t.nextRegion=u,u!==null&&(u.previousRegion=t),e.nextRegion=l[0],n.previousRegion=t}else e.nextRegion=u,u!==null&&(u.previousRegion=e),n.previousRegion=e;return l}function Ot(e,t,r,i,a,o,s){let c=!0,l=[];w(function(){if(e.depth===-2)return;let u=R(e,c);c=!1;let d=i();m.enabled&&st(e,d),n.activeTarget=null,l=Dt(e,t,r,l,d,a,o,s),L(u)})}function kt(e,t,r,i,a){let o={suspended:!1,pending:/* @__PURE__ */ new Set,effect:null},s=-1,c=!0,u=!1,d=null,f=null;if(n.hydrationNode!==null&&t!==null){let e=t.nextSibling;if(e!==null&&l(e)&&e.data.startsWith(`t-await:`)){try{f=JSON.parse(e.data.substring(8))}catch{f=null}e.remove()}}let p=e.generation=(e.generation??0)+1;w(function(){if(e.generation!==p)return;d=n.activeTarget,o.effect=d;let a=R(e,c);c=!1;let l=(r,i)=>{H(e,s,r),n.previousRegion=e;let a=R(I(r===0?`await_content`:`await_with`),!0);try{i(t)}finally{L(a)}s=r},m=()=>{let t=n.awaitBoundary;n.awaitBoundary=o,o.suspended=!1;let a=n.hydrationNode,c=n.serverValues;f!==null&&a!==null?n.serverValues={values:f,index:0}:a!==null&&(n.hydrationNode=null);let d=!1;try{l(0,r)}catch(e){if(!(e instanceof lt))throw e;d=!0,s=0}finally{n.hydrationNode=a,n.serverValues=c,n.awaitBoundary=t}o.suspended&&i!==null?l(1,i):o.suspended&&d?(H(e,s,1),s=1):o.suspended||(u=!0)};if(d===null)m();else{let t=!1;for(let e of o.pending)e.didSuspend?(t=!0,v(e)):o.pending.delete(e);let n=+!!t;n!==s&&(n===0?m():u||(i===null?(H(e,s,1),s=1):l(1,i)))}L(a),V(e,t)},a)}function At(){return n.hydrationNode}function jt(e,t,r,i,a){let o={error:void 0,hasError:!1,effect:null,heldSignals:null};i!==null&&(e.errorBoundary=o);let s=-1,c=!0,l=e.generation=(e.generation??0)+1;w(function(){if(e.generation!==l)return;let a=n.activeTarget;o.effect=a;let u=R(e,c);c=!1;let d=(r,i)=>{H(e,s,r),n.previousRegion=e;let a=R(I(r===0?`try`:`catch`),!0);i(t),L(a),s=r},f=()=>{if(o.heldSignals!==null&&a!==null)for(let e of o.heldSignals)v(e)},p=o.hasError,m=o.error;if(o.hasError=!1,p&&i!==null)s=-1,d(1,e=>i(e,m)),f();else if(s!==0){let t=At();try{d(0,r),o.heldSignals=null}catch(n){if(R(e),rt(t),i!==null)s=-1,d(1,e=>i(e,n)),f();else throw n}}L(u),V(e,t),n.hydrationNode!==null&&t!==null&&(n.hydrationNode=t)},a)}function Mt(e,t){if(t){let e=document.head.querySelector(t);if(e)return e}let n=document.createElement(e);return document.head.appendChild(n),n}function Nt(e,t,n){n===!1||n==null?(e.removeAttribute(t),t===`value`&&Pt(e,``)):t===`value`&&Pt(e,String(n))||e.setAttribute(t,n)}function Pt(e,t){return e.tagName===`INPUT`||e.tagName===`SELECT`||e.tagName===`TEXTAREA`?(e.value=t,!0):!1}function Ft(e,t){if(n.hydrationNode!==null)return e;let r=e.ownerDocument.createElement(t);for(let t of e.attributes)r.setAttributeNS(null,t.name,t.value);return ye(e,r),r.replaceChildren(...e.childNodes.values()),e.replaceWith(r),r}function It(e,t){return n=>{let r=typeof e==`function`?e():e;if(!r)throw Error(`fromElement: element not found. When passing a &ref variable, wrap it in a getter: fromElement(() => buttonEl, "click")`);let i=n;return r.addEventListener(t,i),()=>{r.removeEventListener(t,i)}}}function Lt(e){return t=>{let n=new EventSource(typeof e==`function`?e():e);return n.onmessage=t,()=>{n.close()}}}function Rt(e){return t=>{let n=new WebSocket(typeof e==`function`?e():e);return n.onmessage=t,()=>{n.close()}}}function zt(e){if(n.batch>0)return e();S();try{return e()}finally{x()}}function Bt(e,t){if(n.registerComputed===null)throw Error(`$async must be used in a getter`);let r={type:1,isAsync:!0,value:null,run:null,firstSource:null,firstTarget:null,recalc:!1,running:!1,didError:!1,didSuspend:!1,generation:0,settle:void 0,suspendQuiet:!1,rollback:null},i=n.serverValues,a=i!==null&&i.index<i.values.length?i.values[i.index]:void 0,o=!0;return r.run=()=>{let t=e(o?a:void 0);if(o=!1,t!=null&&typeof t.then==`function`){let e=++r.generation;r.didSuspend=!0,r.suspendQuiet=r.settle!==void 0&&!r.recalc,t.then(t=>{r.generation===e&&(h(r.didSuspend,`$async: resolved while not suspended (settle bookkeeping is broken)`),r.value=t,r.didSuspend=!1,r.settle={ok:!0,value:t},S(),U(r),x())},t=>{r.generation===e&&(h(r.didSuspend,`$async: rejected while not suspended (settle bookkeeping is broken)`),r.value=t,r.didError=!0,r.didSuspend=!1,r.settle={ok:!1,error:t},S(),U(r),x())})}return t},n.registerComputed(r),y(r),i!==null&&i.index<i.values.length&&(r.generation++,r.didSuspend=!1,r.didError=!1,r.value=i.values[i.index++],r.settle={ok:!0,value:r.value}),r.value}function Vt(e,t,...n){if(t!==void 0)for(let r of n.flat()){if(!(r in e))throw Error(`$bind: the key "${r}" does not exist on the state object. $bind syncs same-named keys, so the state object must declare it (e.g. in the initial $watch).`);w(()=>{let n=t[r];n!==void 0&&(e[r]=n)},`bind:forward:${r}`);let n=!0;w(()=>{let i=e[r];n||(t[r]=i),n=!1},`bind:backward:${r}`)}}function Ht(e){if(n.registerComputed===null)throw Error(`$cache must be used in a getter`);let t={type:1,isAsync:!1,value:null,run:e,firstSource:null,firstTarget:null,recalc:!1,running:!1,didError:!1,didSuspend:!1,generation:0,settle:void 0,suspendQuiet:!1,rollback:null};if(n.registerComputed(t),y(t),t.value!==null&&t.value!==void 0&&typeof t.value.then==`function`)throw Error(`$cache returned a Promise — use $async for async getters`);return t.value}function Ut(e){n.mountEffects.push({region:n.activeRegion,fn:e})}function Wt(e){let t=n.suspendPeek;n.suspendPeek=!0,n.suspendPeekHit=!1;try{return e(),n.suspendPeekHit}finally{n.suspendPeek=t}}function Gt(e,t){let r=t?.silent===!0,i=n.refreshSignals,a=n.suspendPeek,o=n.refreshInitialized;n.refreshSignals=[],n.suspendPeek=!0,n.refreshInitialized=/* @__PURE__ */ new Set;let s,c;try{e(),s=new Set(n.refreshSignals??[]),c=n.refreshInitialized}finally{n.refreshSignals=i,n.suspendPeek=a,n.refreshInitialized=o}for(let e of s){if(c.has(e))continue;e.recalc=!r,_(e);let t=n.activeTarget;n.activeTarget=null;try{y(e)}finally{n.activeTarget=t}e.recalc=!1,g(e),r||(S(),U(e),x())}}function Kt(e,t,r){n.mountEffects.push({region:n.activeRegion,fn:()=>{let n;w(()=>{let i=e(e=>{r?.debounce?(clearTimeout(n),n=setTimeout(()=>t(e),r.debounce)):t(e)});return()=>{i?.(),clearTimeout(n)}})}})}return e.$async=Bt,e.$batch=zt,e.$bind=Vt,e.$cache=Ht,e.$onmount=Ut,e.$peek=oe,e.$pending=Wt,e.$refresh=Gt,e.$run=w,e.$stream=Kt,e.$unwrap=P,e.$watch=St,e.clearLayoutSlot=Pe,e.fillLayoutSlot=Ne,e.fromElement=It,e.fromServer=Lt,e.fromWebSocket=Rt,e.hydrate=He,e.mount=Ue,e.t_add_element=Se,e.t_add_fragment=Ce,e.t_anchor=Je,e.t_animate=r,e.t_apply_props=we,e.t_attribute=Nt,e.t_child=Ye,e.t_class=Te,e.t_dynamic=Ft,e.t_event=i,e.t_first_inside=Re,e.t_fmt=Fe,e.t_fragment=ze,e.t_fragment_el=Be,e.t_head_element=Mt,e.t_list_item=Ge,e.t_next=d,e.t_pop_region=L,e.t_push_region=R,e.t_region=I,e.t_rerun_region_effects=tt,e.t_restore_hydration=rt,e.t_root=$e,e.t_root_el=Qe,e.t_run_await=kt,e.t_run_branch=H,e.t_run_control=it,e.t_run_list=Ot,e.t_run_try=jt,e.t_save_hydration=At,e.t_skip=et,e.t_style=Oe,e.unmount=We,e})({});
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
//#region src/compile/utils/slotAutoClose.ts
|
|
2
|
+
/**
|
|
3
|
+
* HTML auto-close analysis for slot regions.
|
|
4
|
+
*
|
|
5
|
+
* When a host wraps each slot region in an element that the HTML parser
|
|
6
|
+
* auto-closes (`<li><slot/></li>`, `<p><slot/></p>`, table parts, …) and the
|
|
7
|
+
* consumer's fill starts with a tag that implies the wrapper's end
|
|
8
|
+
* (`<li>` fill inside `<li><slot/></li>`), the parser re-nests the markup:
|
|
9
|
+
* the slot region's markers end up as siblings of the fill content instead
|
|
10
|
+
* of wrapping it, and hydration can't adopt the region.
|
|
11
|
+
*
|
|
12
|
+
* These helpers let the server builds (JS and restricted) detect the shape —
|
|
13
|
+
* at compile time for static fallbacks, at render time for fill content —
|
|
14
|
+
* and fail with an actionable message instead of shipping broken HTML.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The start tags on the left imply the end of the open ancestor tags in the
|
|
18
|
+
* value list, per the HTML "in body" and "in table" insertion modes. E.g.
|
|
19
|
+
* a `<div>` start tag closes an open `<p>`; a `<li>` start tag closes an
|
|
20
|
+
* open `<li>`.
|
|
21
|
+
*/
|
|
22
|
+
const CLOSES = {
|
|
23
|
+
li: ["li"],
|
|
24
|
+
dt: [
|
|
25
|
+
"dt",
|
|
26
|
+
"dd",
|
|
27
|
+
"p"
|
|
28
|
+
],
|
|
29
|
+
dd: [
|
|
30
|
+
"dt",
|
|
31
|
+
"dd",
|
|
32
|
+
"p"
|
|
33
|
+
],
|
|
34
|
+
p: ["p"],
|
|
35
|
+
address: ["p"],
|
|
36
|
+
article: ["p"],
|
|
37
|
+
aside: ["p"],
|
|
38
|
+
blockquote: ["p"],
|
|
39
|
+
center: ["p"],
|
|
40
|
+
details: ["p"],
|
|
41
|
+
dialog: ["p"],
|
|
42
|
+
dir: ["p"],
|
|
43
|
+
div: ["p"],
|
|
44
|
+
dl: ["p"],
|
|
45
|
+
fieldset: ["p"],
|
|
46
|
+
figcaption: ["p"],
|
|
47
|
+
figure: ["p"],
|
|
48
|
+
footer: ["p"],
|
|
49
|
+
header: ["p"],
|
|
50
|
+
hgroup: ["p"],
|
|
51
|
+
main: ["p"],
|
|
52
|
+
menu: ["p"],
|
|
53
|
+
nav: ["p"],
|
|
54
|
+
ol: ["p"],
|
|
55
|
+
section: ["p"],
|
|
56
|
+
summary: ["p"],
|
|
57
|
+
ul: ["p"],
|
|
58
|
+
h1: ["p"],
|
|
59
|
+
h2: ["p"],
|
|
60
|
+
h3: ["p"],
|
|
61
|
+
h4: ["p"],
|
|
62
|
+
h5: ["p"],
|
|
63
|
+
h6: ["p"],
|
|
64
|
+
pre: ["p"],
|
|
65
|
+
listing: ["p"],
|
|
66
|
+
form: ["p"],
|
|
67
|
+
plaintext: ["p"],
|
|
68
|
+
table: ["p"],
|
|
69
|
+
hr: ["p"],
|
|
70
|
+
xmp: ["p"],
|
|
71
|
+
option: ["option"],
|
|
72
|
+
optgroup: ["option", "optgroup"],
|
|
73
|
+
td: ["td", "th"],
|
|
74
|
+
th: ["td", "th"],
|
|
75
|
+
tr: [
|
|
76
|
+
"tr",
|
|
77
|
+
"td",
|
|
78
|
+
"th"
|
|
79
|
+
],
|
|
80
|
+
caption: [
|
|
81
|
+
"caption",
|
|
82
|
+
"tr",
|
|
83
|
+
"td",
|
|
84
|
+
"th",
|
|
85
|
+
"tbody",
|
|
86
|
+
"thead",
|
|
87
|
+
"tfoot",
|
|
88
|
+
"colgroup"
|
|
89
|
+
],
|
|
90
|
+
colgroup: [
|
|
91
|
+
"colgroup",
|
|
92
|
+
"caption",
|
|
93
|
+
"tr",
|
|
94
|
+
"td",
|
|
95
|
+
"th",
|
|
96
|
+
"tbody",
|
|
97
|
+
"thead",
|
|
98
|
+
"tfoot"
|
|
99
|
+
],
|
|
100
|
+
tbody: [
|
|
101
|
+
"tbody",
|
|
102
|
+
"thead",
|
|
103
|
+
"tfoot",
|
|
104
|
+
"tr",
|
|
105
|
+
"td",
|
|
106
|
+
"th",
|
|
107
|
+
"caption",
|
|
108
|
+
"colgroup"
|
|
109
|
+
],
|
|
110
|
+
thead: [
|
|
111
|
+
"tbody",
|
|
112
|
+
"thead",
|
|
113
|
+
"tfoot",
|
|
114
|
+
"tr",
|
|
115
|
+
"td",
|
|
116
|
+
"th",
|
|
117
|
+
"caption",
|
|
118
|
+
"colgroup"
|
|
119
|
+
],
|
|
120
|
+
tfoot: [
|
|
121
|
+
"tbody",
|
|
122
|
+
"thead",
|
|
123
|
+
"tfoot",
|
|
124
|
+
"tr",
|
|
125
|
+
"td",
|
|
126
|
+
"th",
|
|
127
|
+
"caption",
|
|
128
|
+
"colgroup"
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
/** Tags that some start tag can auto-close (the union of the CLOSES values). */
|
|
132
|
+
const AUTO_CLOSEABLE = new Set(Object.values(CLOSES).flat());
|
|
133
|
+
/** The first start tag in an HTML fragment, lowercased (undefined if none). */
|
|
134
|
+
function firstElementTag(html) {
|
|
135
|
+
return /^<([a-zA-Z][a-zA-Z0-9-]*)/.exec(html)?.[1]?.toLowerCase();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Whether a fragment whose first element is `firstTag` would auto-close any
|
|
139
|
+
* of the open `ancestor` tags (most recent ancestor last, like a stack).
|
|
140
|
+
*/
|
|
141
|
+
function closesAncestor(firstTag, ancestors) {
|
|
142
|
+
const closed = CLOSES[firstTag.toLowerCase()];
|
|
143
|
+
if (closed === void 0) return false;
|
|
144
|
+
return ancestors.some((ancestor) => closed.includes(ancestor));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The message for a detected re-nesting, naming the offending fill tag, the
|
|
148
|
+
* wrapper it closes, and the fix.
|
|
149
|
+
*/
|
|
150
|
+
function autoCloseMessage(firstTag, ancestor) {
|
|
151
|
+
return `Slot content was re-nested by the HTML parser: the fill starts with <${firstTag}>, which auto-closes the enclosing <${ancestor}> around the slot (e.g. <li><slot/></li> with an <li> fill). Wrap the slot in a different element (e.g. <div>), or start the fill with a tag that nests there.`;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
Object.defineProperty(exports, "AUTO_CLOSEABLE", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: function() {
|
|
157
|
+
return AUTO_CLOSEABLE;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
Object.defineProperty(exports, "autoCloseMessage", {
|
|
161
|
+
enumerable: true,
|
|
162
|
+
get: function() {
|
|
163
|
+
return autoCloseMessage;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, "closesAncestor", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function() {
|
|
169
|
+
return closesAncestor;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
Object.defineProperty(exports, "firstElementTag", {
|
|
173
|
+
enumerable: true,
|
|
174
|
+
get: function() {
|
|
175
|
+
return firstElementTag;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
//#region src/compile/utils/slotAutoClose.ts
|
|
2
|
+
/**
|
|
3
|
+
* HTML auto-close analysis for slot regions.
|
|
4
|
+
*
|
|
5
|
+
* When a host wraps each slot region in an element that the HTML parser
|
|
6
|
+
* auto-closes (`<li><slot/></li>`, `<p><slot/></p>`, table parts, …) and the
|
|
7
|
+
* consumer's fill starts with a tag that implies the wrapper's end
|
|
8
|
+
* (`<li>` fill inside `<li><slot/></li>`), the parser re-nests the markup:
|
|
9
|
+
* the slot region's markers end up as siblings of the fill content instead
|
|
10
|
+
* of wrapping it, and hydration can't adopt the region.
|
|
11
|
+
*
|
|
12
|
+
* These helpers let the server builds (JS and restricted) detect the shape —
|
|
13
|
+
* at compile time for static fallbacks, at render time for fill content —
|
|
14
|
+
* and fail with an actionable message instead of shipping broken HTML.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* The start tags on the left imply the end of the open ancestor tags in the
|
|
18
|
+
* value list, per the HTML "in body" and "in table" insertion modes. E.g.
|
|
19
|
+
* a `<div>` start tag closes an open `<p>`; a `<li>` start tag closes an
|
|
20
|
+
* open `<li>`.
|
|
21
|
+
*/
|
|
22
|
+
const CLOSES = {
|
|
23
|
+
li: ["li"],
|
|
24
|
+
dt: [
|
|
25
|
+
"dt",
|
|
26
|
+
"dd",
|
|
27
|
+
"p"
|
|
28
|
+
],
|
|
29
|
+
dd: [
|
|
30
|
+
"dt",
|
|
31
|
+
"dd",
|
|
32
|
+
"p"
|
|
33
|
+
],
|
|
34
|
+
p: ["p"],
|
|
35
|
+
address: ["p"],
|
|
36
|
+
article: ["p"],
|
|
37
|
+
aside: ["p"],
|
|
38
|
+
blockquote: ["p"],
|
|
39
|
+
center: ["p"],
|
|
40
|
+
details: ["p"],
|
|
41
|
+
dialog: ["p"],
|
|
42
|
+
dir: ["p"],
|
|
43
|
+
div: ["p"],
|
|
44
|
+
dl: ["p"],
|
|
45
|
+
fieldset: ["p"],
|
|
46
|
+
figcaption: ["p"],
|
|
47
|
+
figure: ["p"],
|
|
48
|
+
footer: ["p"],
|
|
49
|
+
header: ["p"],
|
|
50
|
+
hgroup: ["p"],
|
|
51
|
+
main: ["p"],
|
|
52
|
+
menu: ["p"],
|
|
53
|
+
nav: ["p"],
|
|
54
|
+
ol: ["p"],
|
|
55
|
+
section: ["p"],
|
|
56
|
+
summary: ["p"],
|
|
57
|
+
ul: ["p"],
|
|
58
|
+
h1: ["p"],
|
|
59
|
+
h2: ["p"],
|
|
60
|
+
h3: ["p"],
|
|
61
|
+
h4: ["p"],
|
|
62
|
+
h5: ["p"],
|
|
63
|
+
h6: ["p"],
|
|
64
|
+
pre: ["p"],
|
|
65
|
+
listing: ["p"],
|
|
66
|
+
form: ["p"],
|
|
67
|
+
plaintext: ["p"],
|
|
68
|
+
table: ["p"],
|
|
69
|
+
hr: ["p"],
|
|
70
|
+
xmp: ["p"],
|
|
71
|
+
option: ["option"],
|
|
72
|
+
optgroup: ["option", "optgroup"],
|
|
73
|
+
td: ["td", "th"],
|
|
74
|
+
th: ["td", "th"],
|
|
75
|
+
tr: [
|
|
76
|
+
"tr",
|
|
77
|
+
"td",
|
|
78
|
+
"th"
|
|
79
|
+
],
|
|
80
|
+
caption: [
|
|
81
|
+
"caption",
|
|
82
|
+
"tr",
|
|
83
|
+
"td",
|
|
84
|
+
"th",
|
|
85
|
+
"tbody",
|
|
86
|
+
"thead",
|
|
87
|
+
"tfoot",
|
|
88
|
+
"colgroup"
|
|
89
|
+
],
|
|
90
|
+
colgroup: [
|
|
91
|
+
"colgroup",
|
|
92
|
+
"caption",
|
|
93
|
+
"tr",
|
|
94
|
+
"td",
|
|
95
|
+
"th",
|
|
96
|
+
"tbody",
|
|
97
|
+
"thead",
|
|
98
|
+
"tfoot"
|
|
99
|
+
],
|
|
100
|
+
tbody: [
|
|
101
|
+
"tbody",
|
|
102
|
+
"thead",
|
|
103
|
+
"tfoot",
|
|
104
|
+
"tr",
|
|
105
|
+
"td",
|
|
106
|
+
"th",
|
|
107
|
+
"caption",
|
|
108
|
+
"colgroup"
|
|
109
|
+
],
|
|
110
|
+
thead: [
|
|
111
|
+
"tbody",
|
|
112
|
+
"thead",
|
|
113
|
+
"tfoot",
|
|
114
|
+
"tr",
|
|
115
|
+
"td",
|
|
116
|
+
"th",
|
|
117
|
+
"caption",
|
|
118
|
+
"colgroup"
|
|
119
|
+
],
|
|
120
|
+
tfoot: [
|
|
121
|
+
"tbody",
|
|
122
|
+
"thead",
|
|
123
|
+
"tfoot",
|
|
124
|
+
"tr",
|
|
125
|
+
"td",
|
|
126
|
+
"th",
|
|
127
|
+
"caption",
|
|
128
|
+
"colgroup"
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
/** Tags that some start tag can auto-close (the union of the CLOSES values). */
|
|
132
|
+
const AUTO_CLOSEABLE = new Set(Object.values(CLOSES).flat());
|
|
133
|
+
/** The first start tag in an HTML fragment, lowercased (undefined if none). */
|
|
134
|
+
function firstElementTag(html) {
|
|
135
|
+
return /^<([a-zA-Z][a-zA-Z0-9-]*)/.exec(html)?.[1]?.toLowerCase();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Whether a fragment whose first element is `firstTag` would auto-close any
|
|
139
|
+
* of the open `ancestor` tags (most recent ancestor last, like a stack).
|
|
140
|
+
*/
|
|
141
|
+
function closesAncestor(firstTag, ancestors) {
|
|
142
|
+
const closed = CLOSES[firstTag.toLowerCase()];
|
|
143
|
+
if (closed === void 0) return false;
|
|
144
|
+
return ancestors.some((ancestor) => closed.includes(ancestor));
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The message for a detected re-nesting, naming the offending fill tag, the
|
|
148
|
+
* wrapper it closes, and the fix.
|
|
149
|
+
*/
|
|
150
|
+
function autoCloseMessage(firstTag, ancestor) {
|
|
151
|
+
return `Slot content was re-nested by the HTML parser: the fill starts with <${firstTag}>, which auto-closes the enclosing <${ancestor}> around the slot (e.g. <li><slot/></li> with an <li> fill). Wrap the slot in a different element (e.g. <div>), or start the fill with a tag that nests there.`;
|
|
152
|
+
}
|
|
153
|
+
//#endregion
|
|
154
|
+
export { firstElementTag as i, autoCloseMessage as n, closesAncestor as r, AUTO_CLOSEABLE as t };
|
|
155
|
+
|
|
156
|
+
//# sourceMappingURL=slotAutoClose-CgDkf8fM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotAutoClose-CgDkf8fM.mjs","names":[],"sources":["../src/compile/utils/slotAutoClose.ts"],"sourcesContent":["/**\n * HTML auto-close analysis for slot regions.\n *\n * When a host wraps each slot region in an element that the HTML parser\n * auto-closes (`<li><slot/></li>`, `<p><slot/></p>`, table parts, …) and the\n * consumer's fill starts with a tag that implies the wrapper's end\n * (`<li>` fill inside `<li><slot/></li>`), the parser re-nests the markup:\n * the slot region's markers end up as siblings of the fill content instead\n * of wrapping it, and hydration can't adopt the region.\n *\n * These helpers let the server builds (JS and restricted) detect the shape —\n * at compile time for static fallbacks, at render time for fill content —\n * and fail with an actionable message instead of shipping broken HTML.\n */\n\n/**\n * The start tags on the left imply the end of the open ancestor tags in the\n * value list, per the HTML \"in body\" and \"in table\" insertion modes. E.g.\n * a `<div>` start tag closes an open `<p>`; a `<li>` start tag closes an\n * open `<li>`.\n */\nconst CLOSES: Record<string, string[]> = {\n\tli: [\"li\"],\n\tdt: [\"dt\", \"dd\", \"p\"],\n\tdd: [\"dt\", \"dd\", \"p\"],\n\tp: [\"p\"],\n\taddress: [\"p\"],\n\tarticle: [\"p\"],\n\taside: [\"p\"],\n\tblockquote: [\"p\"],\n\tcenter: [\"p\"],\n\tdetails: [\"p\"],\n\tdialog: [\"p\"],\n\tdir: [\"p\"],\n\tdiv: [\"p\"],\n\tdl: [\"p\"],\n\tfieldset: [\"p\"],\n\tfigcaption: [\"p\"],\n\tfigure: [\"p\"],\n\tfooter: [\"p\"],\n\theader: [\"p\"],\n\thgroup: [\"p\"],\n\tmain: [\"p\"],\n\tmenu: [\"p\"],\n\tnav: [\"p\"],\n\tol: [\"p\"],\n\tsection: [\"p\"],\n\tsummary: [\"p\"],\n\tul: [\"p\"],\n\th1: [\"p\"],\n\th2: [\"p\"],\n\th3: [\"p\"],\n\th4: [\"p\"],\n\th5: [\"p\"],\n\th6: [\"p\"],\n\tpre: [\"p\"],\n\tlisting: [\"p\"],\n\tform: [\"p\"],\n\tplaintext: [\"p\"],\n\ttable: [\"p\"],\n\thr: [\"p\"],\n\txmp: [\"p\"],\n\toption: [\"option\"],\n\toptgroup: [\"option\", \"optgroup\"],\n\ttd: [\"td\", \"th\"],\n\tth: [\"td\", \"th\"],\n\ttr: [\"tr\", \"td\", \"th\"],\n\tcaption: [\"caption\", \"tr\", \"td\", \"th\", \"tbody\", \"thead\", \"tfoot\", \"colgroup\"],\n\tcolgroup: [\"colgroup\", \"caption\", \"tr\", \"td\", \"th\", \"tbody\", \"thead\", \"tfoot\"],\n\ttbody: [\"tbody\", \"thead\", \"tfoot\", \"tr\", \"td\", \"th\", \"caption\", \"colgroup\"],\n\tthead: [\"tbody\", \"thead\", \"tfoot\", \"tr\", \"td\", \"th\", \"caption\", \"colgroup\"],\n\ttfoot: [\"tbody\", \"thead\", \"tfoot\", \"tr\", \"td\", \"th\", \"caption\", \"colgroup\"],\n};\n\n/** Tags that some start tag can auto-close (the union of the CLOSES values). */\nexport const AUTO_CLOSEABLE: ReadonlySet<string> = new Set(Object.values(CLOSES).flat());\n\n/** The first start tag in an HTML fragment, lowercased (undefined if none). */\nexport function firstElementTag(html: string): string | undefined {\n\tconst match = /^<([a-zA-Z][a-zA-Z0-9-]*)/.exec(html);\n\treturn match?.[1]?.toLowerCase();\n}\n\n/**\n * Whether a fragment whose first element is `firstTag` would auto-close any\n * of the open `ancestor` tags (most recent ancestor last, like a stack).\n */\nexport function closesAncestor(firstTag: string, ancestors: string[]): boolean {\n\tconst closed = CLOSES[firstTag.toLowerCase()];\n\tif (closed === undefined) return false;\n\treturn ancestors.some((ancestor) => closed.includes(ancestor));\n}\n\n/**\n * The message for a detected re-nesting, naming the offending fill tag, the\n * wrapper it closes, and the fix.\n */\nexport function autoCloseMessage(firstTag: string, ancestor: string): string {\n\treturn (\n\t\t`Slot content was re-nested by the HTML parser: the fill starts with <${firstTag}>, ` +\n\t\t`which auto-closes the enclosing <${ancestor}> around the slot ` +\n\t\t`(e.g. <li><slot/></li> with an <li> fill). Wrap the slot in a different ` +\n\t\t`element (e.g. <div>), or start the fill with a tag that nests there.`\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,SAAmC;CACxC,IAAI,CAAC,IAAI;CACT,IAAI;EAAC;EAAM;EAAM;CAAG;CACpB,IAAI;EAAC;EAAM;EAAM;CAAG;CACpB,GAAG,CAAC,GAAG;CACP,SAAS,CAAC,GAAG;CACb,SAAS,CAAC,GAAG;CACb,OAAO,CAAC,GAAG;CACX,YAAY,CAAC,GAAG;CAChB,QAAQ,CAAC,GAAG;CACZ,SAAS,CAAC,GAAG;CACb,QAAQ,CAAC,GAAG;CACZ,KAAK,CAAC,GAAG;CACT,KAAK,CAAC,GAAG;CACT,IAAI,CAAC,GAAG;CACR,UAAU,CAAC,GAAG;CACd,YAAY,CAAC,GAAG;CAChB,QAAQ,CAAC,GAAG;CACZ,QAAQ,CAAC,GAAG;CACZ,QAAQ,CAAC,GAAG;CACZ,QAAQ,CAAC,GAAG;CACZ,MAAM,CAAC,GAAG;CACV,MAAM,CAAC,GAAG;CACV,KAAK,CAAC,GAAG;CACT,IAAI,CAAC,GAAG;CACR,SAAS,CAAC,GAAG;CACb,SAAS,CAAC,GAAG;CACb,IAAI,CAAC,GAAG;CACR,IAAI,CAAC,GAAG;CACR,IAAI,CAAC,GAAG;CACR,IAAI,CAAC,GAAG;CACR,IAAI,CAAC,GAAG;CACR,IAAI,CAAC,GAAG;CACR,IAAI,CAAC,GAAG;CACR,KAAK,CAAC,GAAG;CACT,SAAS,CAAC,GAAG;CACb,MAAM,CAAC,GAAG;CACV,WAAW,CAAC,GAAG;CACf,OAAO,CAAC,GAAG;CACX,IAAI,CAAC,GAAG;CACR,KAAK,CAAC,GAAG;CACT,QAAQ,CAAC,QAAQ;CACjB,UAAU,CAAC,UAAU,UAAU;CAC/B,IAAI,CAAC,MAAM,IAAI;CACf,IAAI,CAAC,MAAM,IAAI;CACf,IAAI;EAAC;EAAM;EAAM;CAAI;CACrB,SAAS;EAAC;EAAW;EAAM;EAAM;EAAM;EAAS;EAAS;EAAS;CAAU;CAC5E,UAAU;EAAC;EAAY;EAAW;EAAM;EAAM;EAAM;EAAS;EAAS;CAAO;CAC7E,OAAO;EAAC;EAAS;EAAS;EAAS;EAAM;EAAM;EAAM;EAAW;CAAU;CAC1E,OAAO;EAAC;EAAS;EAAS;EAAS;EAAM;EAAM;EAAM;EAAW;CAAU;CAC1E,OAAO;EAAC;EAAS;EAAS;EAAS;EAAM;EAAM;EAAM;EAAW;CAAU;AAC3E;;AAGA,MAAa,iBAAsC,IAAI,IAAI,OAAO,OAAO,MAAM,CAAC,CAAC,KAAK,CAAC;;AAGvF,SAAgB,gBAAgB,MAAkC;CAEjE,OADc,4BAA4B,KAAK,IACpC,CAAC,GAAG,EAAE,EAAE,YAAY;AAChC;;;;;AAMA,SAAgB,eAAe,UAAkB,WAA8B;CAC9E,MAAM,SAAS,OAAO,SAAS,YAAY;CAC3C,IAAI,WAAW,KAAA,GAAW,OAAO;CACjC,OAAO,UAAU,MAAM,aAAa,OAAO,SAAS,QAAQ,CAAC;AAC9D;;;;;AAMA,SAAgB,iBAAiB,UAAkB,UAA0B;CAC5E,OACC,wEAAwE,SAAS,sCAC7C,SAAS;AAI/C"}
|
package/dist/ssr.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_fromWebSocket = require("./fromWebSocket-
|
|
2
|
+
const require_fromWebSocket = require("./fromWebSocket-Cdoghvmh.cjs");
|
|
3
|
+
const require_slotAutoClose = require("./slotAutoClose-BbKfzpkz.cjs");
|
|
3
4
|
//#region src/render/formatAttributeText.ts
|
|
4
5
|
function formatAttributeText(value) {
|
|
5
6
|
return (value ?? "").toString().replaceAll("\"", """);
|
|
@@ -22,6 +23,54 @@ function formatServerText(value) {
|
|
|
22
23
|
return require_fromWebSocket.formatText(value).replace(/[&<>]/g, (c) => ESCAPABLE[c]);
|
|
23
24
|
}
|
|
24
25
|
//#endregion
|
|
26
|
+
//#region src/ssr/buildClasses.ts
|
|
27
|
+
/**
|
|
28
|
+
* Server counterpart of `render/buildClasses`: builds the class string and
|
|
29
|
+
* wraps it in a `class="..."` attribute, or returns `""` when there are no
|
|
30
|
+
* classes, so the attribute is omitted rather than rendered empty. Exported
|
|
31
|
+
* as `t_class` from `@torpor/view/ssr` — the only way server-compiled code
|
|
32
|
+
* uses it is to interpolate the attribute into a tag.
|
|
33
|
+
*/
|
|
34
|
+
function buildServerClasses(value, styleHash) {
|
|
35
|
+
const classes = require_fromWebSocket.buildClasses(value, styleHash);
|
|
36
|
+
return classes === "" ? "" : `class="${classes}"`;
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/ssr/buildStyles.ts
|
|
40
|
+
/**
|
|
41
|
+
* Server counterpart of `render/buildStyles`: builds the style string and
|
|
42
|
+
* wraps it in a `style="..."` attribute, or returns `""` when there are no
|
|
43
|
+
* styles, so the attribute is omitted rather than rendered empty. Exported
|
|
44
|
+
* as `t_style` from `@torpor/view/ssr` — the only way server-compiled code
|
|
45
|
+
* uses it is to interpolate the attribute into a tag.
|
|
46
|
+
*/
|
|
47
|
+
function buildServerStyles(value) {
|
|
48
|
+
const styles = require_fromWebSocket.buildStyles(value);
|
|
49
|
+
return styles === "" ? "" : `style="${styles}"`;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/ssr/slotGuard.ts
|
|
53
|
+
/**
|
|
54
|
+
* Server counterpart for generated slot regions whose wrapper the HTML
|
|
55
|
+
* parser can auto-close (e.g. a `<slot>` inside `<li>`). Checks the rendered
|
|
56
|
+
* fill content and throws when the parser would re-nest the region, so
|
|
57
|
+
* broken shapes fail loudly at SSR instead of shipping markup hydration
|
|
58
|
+
* can't adopt. Exported as `t_slot_guard` from `@torpor/view/ssr`.
|
|
59
|
+
*
|
|
60
|
+
* @param closeTags The slot's enclosing tags that some start tag can
|
|
61
|
+
* auto-close (nearest last).
|
|
62
|
+
* @param content The rendered fill content.
|
|
63
|
+
* @param slotName The slot name, for the error message.
|
|
64
|
+
*/
|
|
65
|
+
function slotGuard(closeTags, content, slotName) {
|
|
66
|
+
const firstTag = require_slotAutoClose.firstElementTag(content);
|
|
67
|
+
if (firstTag !== void 0 && require_slotAutoClose.closesAncestor(firstTag, closeTags)) {
|
|
68
|
+
const ancestor = closeTags.slice().reverse().find((ancestor) => require_slotAutoClose.closesAncestor(firstTag, [ancestor]));
|
|
69
|
+
throw new Error(`Slot "${slotName}": ${require_slotAutoClose.autoCloseMessage(firstTag, ancestor ?? closeTags[0])}`);
|
|
70
|
+
}
|
|
71
|
+
return content;
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
25
74
|
//#region src/ssr/$serverWatch.ts
|
|
26
75
|
let currentSite = null;
|
|
27
76
|
/** The watched getter currently being read, or null outside a `$watch` get. */
|
|
@@ -484,8 +533,12 @@ exports.$run = $serverRun;
|
|
|
484
533
|
exports.$stream = $serverStream;
|
|
485
534
|
exports.$unwrap = $serverUnwrap;
|
|
486
535
|
exports.$watch = $serverWatch;
|
|
536
|
+
exports.AUTO_CLOSEABLE = require_slotAutoClose.AUTO_CLOSEABLE;
|
|
537
|
+
exports.autoCloseMessage = require_slotAutoClose.autoCloseMessage;
|
|
487
538
|
exports.clearLayoutSlot = clearLayoutSlot;
|
|
539
|
+
exports.closesAncestor = require_slotAutoClose.closesAncestor;
|
|
488
540
|
exports.fillLayoutSlot = fillLayoutSlot;
|
|
541
|
+
exports.firstElementTag = require_slotAutoClose.firstElementTag;
|
|
489
542
|
exports.fromElement = require_fromWebSocket.fromElement;
|
|
490
543
|
exports.fromServer = require_fromWebSocket.fromServer;
|
|
491
544
|
exports.fromWebSocket = require_fromWebSocket.fromWebSocket;
|
|
@@ -500,7 +553,7 @@ exports.t_attr = formatAttributeText;
|
|
|
500
553
|
exports.t_attribute = t_attribute;
|
|
501
554
|
exports.t_await_server = runServerAwait;
|
|
502
555
|
exports.t_child = t_child;
|
|
503
|
-
exports.t_class =
|
|
556
|
+
exports.t_class = buildServerClasses;
|
|
504
557
|
exports.t_dynamic = t_dynamic;
|
|
505
558
|
exports.t_event = t_event;
|
|
506
559
|
exports.t_first_inside = t_first_inside;
|
|
@@ -525,5 +578,6 @@ exports.t_run_try = t_run_try;
|
|
|
525
578
|
exports.t_save_hydration = t_save_hydration;
|
|
526
579
|
exports.t_server_flush = serverFlush;
|
|
527
580
|
exports.t_skip = t_skip;
|
|
528
|
-
exports.
|
|
581
|
+
exports.t_slot_guard = slotGuard;
|
|
582
|
+
exports.t_style = buildServerStyles;
|
|
529
583
|
exports.unmount = unmount;
|
package/dist/ssr.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as Cleanup } from "./Cleanup-D0wvGW5d.cjs";
|
|
2
|
-
import { a as StreamSource,
|
|
2
|
+
import { a as StreamSource, i as fromElement, n as fromWebSocket, o as StyleValue, r as fromServer, s as ClassValue, t as AsyncOptions } from "./AsyncOptions-C_7mWR6F.cjs";
|
|
3
3
|
//#region src/render/formatAttributeText.d.ts
|
|
4
4
|
declare function formatAttributeText(value: any): string;
|
|
5
5
|
//#endregion
|
|
@@ -13,6 +13,57 @@ declare function formatAttributeText(value: any): string;
|
|
|
13
13
|
*/
|
|
14
14
|
declare function formatServerText(value: any): string;
|
|
15
15
|
//#endregion
|
|
16
|
+
//#region src/ssr/buildClasses.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Server counterpart of `render/buildClasses`: builds the class string and
|
|
19
|
+
* wraps it in a `class="..."` attribute, or returns `""` when there are no
|
|
20
|
+
* classes, so the attribute is omitted rather than rendered empty. Exported
|
|
21
|
+
* as `t_class` from `@torpor/view/ssr` — the only way server-compiled code
|
|
22
|
+
* uses it is to interpolate the attribute into a tag.
|
|
23
|
+
*/
|
|
24
|
+
declare function buildServerClasses(value: ClassValue, styleHash?: string): string;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region src/ssr/buildStyles.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* Server counterpart of `render/buildStyles`: builds the style string and
|
|
29
|
+
* wraps it in a `style="..."` attribute, or returns `""` when there are no
|
|
30
|
+
* styles, so the attribute is omitted rather than rendered empty. Exported
|
|
31
|
+
* as `t_style` from `@torpor/view/ssr` — the only way server-compiled code
|
|
32
|
+
* uses it is to interpolate the attribute into a tag.
|
|
33
|
+
*/
|
|
34
|
+
declare function buildServerStyles(value: StyleValue): string;
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/ssr/slotGuard.d.ts
|
|
37
|
+
/**
|
|
38
|
+
* Server counterpart for generated slot regions whose wrapper the HTML
|
|
39
|
+
* parser can auto-close (e.g. a `<slot>` inside `<li>`). Checks the rendered
|
|
40
|
+
* fill content and throws when the parser would re-nest the region, so
|
|
41
|
+
* broken shapes fail loudly at SSR instead of shipping markup hydration
|
|
42
|
+
* can't adopt. Exported as `t_slot_guard` from `@torpor/view/ssr`.
|
|
43
|
+
*
|
|
44
|
+
* @param closeTags The slot's enclosing tags that some start tag can
|
|
45
|
+
* auto-close (nearest last).
|
|
46
|
+
* @param content The rendered fill content.
|
|
47
|
+
* @param slotName The slot name, for the error message.
|
|
48
|
+
*/
|
|
49
|
+
declare function slotGuard(closeTags: string[], content: string, slotName: string): string;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/compile/utils/slotAutoClose.d.ts
|
|
52
|
+
/** Tags that some start tag can auto-close (the union of the CLOSES values). */
|
|
53
|
+
export declare const AUTO_CLOSEABLE: ReadonlySet<string>;
|
|
54
|
+
/** The first start tag in an HTML fragment, lowercased (undefined if none). */
|
|
55
|
+
export declare function firstElementTag(html: string): string | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Whether a fragment whose first element is `firstTag` would auto-close any
|
|
58
|
+
* of the open `ancestor` tags (most recent ancestor last, like a stack).
|
|
59
|
+
*/
|
|
60
|
+
export declare function closesAncestor(firstTag: string, ancestors: string[]): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The message for a detected re-nesting, naming the offending fill tag, the
|
|
63
|
+
* wrapper it closes, and the fix.
|
|
64
|
+
*/
|
|
65
|
+
export declare function autoCloseMessage(firstTag: string, ancestor: string): string;
|
|
66
|
+
//#endregion
|
|
16
67
|
//#region src/ssr/$serverAsync.d.ts
|
|
17
68
|
/**
|
|
18
69
|
* Server counterpart of the client-side `$async` getter primitive.
|
|
@@ -252,5 +303,5 @@ export declare const t_run_try: Unavailable;
|
|
|
252
303
|
export declare const t_save_hydration: Unavailable;
|
|
253
304
|
export declare const t_skip: Unavailable;
|
|
254
305
|
//#endregion
|
|
255
|
-
export { $serverAsync as $async, $serverBatch as $batch, $serverBind as $bind, $serverCache as $cache, $serverOnmount as $onmount, $serverPeek as $peek, $serverPending as $pending, $serverRefresh as $refresh, $serverRun as $run, $serverStream as $stream, $serverUnwrap as $unwrap, $serverWatch as $watch, type AsyncOptions, type ServerComponent, type ServerSlotRender, type StreamSource, fromElement, fromServer, fromWebSocket, formatAttributeText as t_attr, runServerAwait as t_await_server,
|
|
306
|
+
export { $serverAsync as $async, $serverBatch as $batch, $serverBind as $bind, $serverCache as $cache, $serverOnmount as $onmount, $serverPeek as $peek, $serverPending as $pending, $serverRefresh as $refresh, $serverRun as $run, $serverStream as $stream, $serverUnwrap as $unwrap, $serverWatch as $watch, type AsyncOptions, type ServerComponent, type ServerSlotRender, type StreamSource, fromElement, fromServer, fromWebSocket, formatAttributeText as t_attr, runServerAwait as t_await_server, buildServerClasses as t_class, formatServerText as t_fmt, serverFlush as t_server_flush, slotGuard as t_slot_guard, buildServerStyles as t_style };
|
|
256
307
|
//# sourceMappingURL=ssr.d.cts.map
|
package/dist/ssr.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssr.d.cts","names":[],"sources":["../src/render/formatAttributeText.ts","../src/ssr/formatText.ts","../src/ssr/$serverAsync.ts","../src/ssr/$serverBatch.ts","../src/ssr/$serverBind.ts","../src/ssr/$serverCache.ts","../src/ssr/$serverOnmount.ts","../src/ssr/$serverPeek.ts","../src/ssr/$serverPending.ts","../src/ssr/$serverRefresh.ts","../src/ssr/$serverRun.ts","../src/ssr/$serverStream.ts","../src/ssr/$serverUnwrap.ts","../src/ssr/$serverWatch.ts","../src/ssr/runServerAwait.ts","../src/ssr/serverSentinels.ts","../src/types/ServerSlotRender.ts","../src/types/ServerComponent.ts","../src/ssr/unavailable.ts"],"mappings":";;;iBAAwB,oBAAoB;;;;;;;;;;iBCepB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ssr.d.cts","names":[],"sources":["../src/render/formatAttributeText.ts","../src/ssr/formatText.ts","../src/ssr/buildClasses.ts","../src/ssr/buildStyles.ts","../src/ssr/slotGuard.ts","../src/compile/utils/slotAutoClose.ts","../src/ssr/$serverAsync.ts","../src/ssr/$serverBatch.ts","../src/ssr/$serverBind.ts","../src/ssr/$serverCache.ts","../src/ssr/$serverOnmount.ts","../src/ssr/$serverPeek.ts","../src/ssr/$serverPending.ts","../src/ssr/$serverRefresh.ts","../src/ssr/$serverRun.ts","../src/ssr/$serverStream.ts","../src/ssr/$serverUnwrap.ts","../src/ssr/$serverWatch.ts","../src/ssr/runServerAwait.ts","../src/ssr/serverSentinels.ts","../src/types/ServerSlotRender.ts","../src/types/ServerComponent.ts","../src/ssr/unavailable.ts"],"mappings":";;;iBAAwB,oBAAoB;;;;;;;;;;iBCepB,iBAAiB;;;;;;;;;;iBCLjB,mBAAmB,OAAO,YAAY;;;;;;;;;;iBCAtC,kBAAkB,OAAO;;;;;;;;;;;;;;;iBCIzB,UAAU,qBAAqB,iBAAiB;;;;qBC6D3D,gBAAgB;;wBAGb,gBAAgB;;;;;wBAShB,eAAe,kBAAkB;;;;;wBAUjC,iBAAiB,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBClD3B,aAAa,GACpC,KAAK,cAAc,MAAM,QAAQ,IACjC,UAAU,eACR;;;iBClDqB,aAAa,GAAG,UAAU,IAAI;;;;;;;;;iBCM9B,YACvB,QAAQ,OAAO,mBACf,QAAQ,OAAO,kCACZ;;;iBCToB,aAAa,GAAG,UAAU,IAAI;;;iBCE9B,eAAe,WAAW;;;iBCF1B,YAAY,GAAG,UAAU,IAAI;;;;;;;;iBCK7B,eAAe;;;;;;;;iBCAf,eAAe;;;iBCHf,WAAW,WAAW;;;;;;;;iBCKtB,cAAc,GACrC,SAAS,aAAa,IACtB,WAAW,OAAO,YAClB;EAAa;;;;iBCVU,cAAc,UAAU,OAAO,mBAAmB,QAAQ,IAAI;;;;;;;;;;;;;;iBC8B9D,aAAa,UAAU,OAAO,mBAAmB,QAAQ,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCmB7D,eACvB,YACA,qBAAqB;EAAU;EAAc;IAC7C,mBAAmB;EAAU;EAAc;;EACvC;EAAc;IAAiB;EAAU;EAAc;;;;;UC9C3C;EAChB;EACA;;;;;;;;;;;;;;;;iBAiBqB,YAAY,cAAc,QAAQ,cAAc,QAAQ;;;;;;;KCtBzE,oBACJ,QAAQ,OAAO,mBACf,WAAW,OAAO,sBACd;;;;;;;;;;KCEA,mBACJ,SAAS,OAAO,mBAChB,WAAW,OAAO,mBAClB,SAAS,eAAe,sBACpB;EAAU;EAAc;;;;;;;;;;;;;;;KCFxB,kBAAkB;qBAQV,OAAO;qBACP,SAAS;qBACT,SAAS;qBACT,gBAAgB;qBAChB,iBAAiB;qBAEjB,eAAe;qBACf,gBAAgB;qBAChB,UAAU;qBACV,WAAW;qBACX,eAAe;qBACf,aAAa;qBACb,SAAS;qBACT,WAAW;qBACX,SAAS;qBACT,gBAAgB;qBAChB,YAAY;qBACZ,eAAe;qBACf,gBAAgB;qBAChB,aAAa;qBACb,QAAQ;qBACR,cAAc;qBACd,eAAe;qBACf,UAAU;qBACV,wBAAwB;qBACxB,qBAAqB;qBACrB,QAAQ;qBACR,WAAW;qBACX,aAAa;qBACb,cAAc;qBACd,eAAe;qBACf,YAAY;qBACZ,WAAW;qBACX,kBAAkB;qBAClB,QAAQ"}
|