@tempots/dom 28.6.0 → 28.6.2
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/index.cjs +1 -1
- package/index.js +130 -124
- package/package.json +1 -1
- package/std/signal-utils.d.ts +3 -11
- package/std/value.d.ts +3 -3
- package/types/domain.d.ts +16 -6
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var rt=Object.defineProperty;var Se=s=>{throw TypeError(s)};var nt=(s,e,t)=>e in s?rt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>nt(s,typeof e!="symbol"?e+"":e,t),be=(s,e,t)=>e.has(s)||Se("Cannot "+t);var F=(s,e,t)=>(be(s,e,"read from private field"),t?t.call(s):e.get(s)),Ae=(s,e,t)=>e.has(s)?Se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),te=(s,e,t,r)=>(be(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ve=(s,e,t)=>s+(e-s)*t,Ee=97,Ce=(s,e,t)=>{const r=Math.max(s.length,e.length);let n="";for(let i=0;i<r;i++){let l=s.charCodeAt(i);isNaN(l)&&(l=Ee);let c=e.charCodeAt(i);isNaN(c)&&(c=Ee),n+=String.fromCharCode(l+(c-l)*t)}return n},Pe=(s,e,t)=>new Date(s.getTime()+(e.getTime()-s.getTime())*t),we=(s,e)=>e,xe=s=>typeof s=="number"?ve:typeof s=="string"?Ce:s instanceof Date?Pe:we;var C;class U{constructor(e,t){o(this,"counter");o(this,"isFirst");o(this,"isEven");o(this,"isOdd");Ae(this,C);o(this,"dispose",()=>{var e;(e=F(this,C))==null||e.dispose(),te(this,C,void 0)});this.index=e,this.total=t,this.counter=e+1,this.isFirst=e===0,this.isEven=e%2===1,this.isOdd=e%2===0}get isLast(){return F(this,C)==null&&te(this,C,this.total.map(e=>this.counter===e)),F(this,C)}}C=new WeakMap;const H=class H{constructor(e,t){o(this,"$__signal__",!0);o(this,"_value");o(this,"_derivatives",[]);o(this,"_onValueListeners",[]);o(this,"_onDisposeListeners",[]);o(this,"get",()=>this._value);o(this,"hasListeners",()=>this._onValueListeners.length>0);o(this,"on",(e,t={})=>{t.skipInitial||e(this.get(),void 0);const r=t.once?(i,l)=>{n(),e(i,l)}:e;this._onValueListeners.push(r);const n=()=>{this._onValueListeners.splice(this._onValueListeners.indexOf(r),1),t.abortSignal!=null&&t.abortSignal.removeEventListener("abort",n)};return t.abortSignal!=null&&t.abortSignal.addEventListener("abort",n),n});o(this,"_setAndNotify",e=>{if(this._disposed)return;const t=this._value;this.equals(t,e)||(this._value=e,this._onValueListeners.forEach(n=>n(e,t)))});o(this,"_disposed",!1);o(this,"isDisposed",()=>this._disposed);o(this,"onDispose",e=>{this._onDisposeListeners.push(e)});o(this,"dispose",()=>{this._disposed||(this._disposed=!0,this._onDisposeListeners.forEach(e=>e()),this._onDisposeListeners.length=0,this._derivatives.length=0)});o(this,"map",(e,t=(r,n)=>r===n)=>{const r=new w(()=>{try{return e(this.get())}catch(n){throw console.error("Error in Signal.map:",n),n}},t);return this.setDerivative(r),r});o(this,"flatMap",(e,t=(r,n)=>r===n)=>{const r=new w(()=>{try{return e(this.get()).get()}catch(n){throw console.error("Error in Signal.flatMap:",n),n}},t);return this.setDerivative(r),r});o(this,"tap",e=>this.map(t=>(e(t),t)));o(this,"at",e=>this.map(t=>t[e]));o(this,"_$");o(this,"filter",(e,t)=>{let r=t??this.get();const n=new w(()=>{try{const i=this.get();return r=e(i)?i:r}catch(i){throw console.error("Error in Signal.filter:",i),i}},this.equals);return this.setDerivative(n),n});o(this,"filterMap",(e,t,r=(n,i)=>n===i)=>{let n=t;const i=new w(()=>{try{const l=this.get(),c=e(l);return n=c??n}catch(l){throw console.error("Error in Signal.filterMap:",l),l}},r);return this.setDerivative(i),i});o(this,"mapAsync",(e,t,r,n=(i,l)=>i===l)=>{const i=A(t,n);let l=0,c=new AbortController;return i.onDispose(this.on(async a=>{const u=++l;c.abort(),c=new AbortController;try{const h=await e(a,{abortSignal:c.signal});u===l&&i.set(h)}catch(h){if(u===l)if(r!=null)i.set(r(h));else throw h}})),i});o(this,"mapMaybe",(e,t)=>this.map(r=>e(r)??t));o(this,"feedProp",(e,t=!1)=>{const r=this.on(e.set);return e.onDispose(r),t?this.onDispose(e.dispose):this.onDispose(r),e});o(this,"deriveProp",({autoDisposeProp:e=!0,equals:t}={})=>this.feedProp(A(this.get(),t),e));o(this,"derive",()=>this.map(e=>e));o(this,"count",()=>{let e=0;return this.map(()=>++e)});o(this,"setDerivative",e=>{this._derivatives.push(e),e.onDispose(()=>{this._derivatives.splice(this._derivatives.indexOf(e),1)}),e.onDispose(this.on(e.setDirty)),this.onDispose(e.dispose)});this.equals=t,this._value=e}get value(){return this._value}get $(){return this._$!==void 0?this._$:this._$=new Proxy(this,{get:(e,t)=>this.at(t)})}};o(H,"ofPromise",(e,t,r,n=(i,l)=>i===l)=>{const i=new H(t,n);return e.then(l=>i._setAndNotify(l)).catch(l=>{r!=null?i._setAndNotify(r(l)):console.error("Unhandled promise rejection in Signal.ofPromise:",l)}),i}),o(H,"is",e=>e!=null&&e.$__signal__===!0);let f=H;const it=typeof queueMicrotask=="function"?queueMicrotask:s=>Promise.resolve().then(s);class w extends f{constructor(t,r){super(void 0,r);o(this,"$__computed__",!0);o(this,"_isDirty",!1);o(this,"setDirty",()=>{this._isDirty||this._disposed||(this._isDirty=!0,this._derivatives.forEach(t=>t.setDirty()),this._scheduleNotify())});o(this,"_scheduleCount",0);o(this,"_scheduleNotify",()=>{const t=++this._scheduleCount;it(()=>{this._scheduleCount!==t||this._disposed||this._isDirty&&(this._isDirty=!1,this._setAndNotify(this._fn()))})});o(this,"get",()=>(this._isDirty&&(this._isDirty=!1,this._setAndNotify(this._fn())),this._value));this._fn=t,this.setDirty()}static is(t){return t!=null&&t.$__computed__===!0}get value(){return this.get()}}const z=class z extends f{constructor(){super(...arguments);o(this,"$__prop__",!0);o(this,"set",t=>{this._setAndNotify(t)});o(this,"update",t=>{this._setAndNotify(t(this.get()))});o(this,"reducer",(t,...r)=>{const n=this;return function i(l){const c=n.value;n.update(a=>t(a,l)),!n.equals(c,n.value)&&r.forEach(a=>a({previousState:c,state:n.value,action:l,dispatch:i}))}});o(this,"iso",(t,r,n=(i,l)=>i===l)=>{const i=new z(t(this.get()),n);return i.onDispose(this.on(l=>i.set(t(l)))),i.on(l=>this._setAndNotify(r(l))),i});o(this,"atProp",t=>this.iso(r=>r[t],r=>({...this.value,[t]:r})))}get value(){return this.get()}set value(t){this._setAndNotify(t)}};o(z,"is",t=>t!=null&&t.$__prop__===!0);let N=z;const Q=(s,e,t=(r,n)=>r===n)=>{const r=new w(s,t);return e.forEach(n=>n.setDerivative(r)),r},Oe=(s,e,t={})=>{let r=t.once?()=>{i(),s()}:s;if(t.skipInitial){let l=!1;const c=r;r=()=>{l?c():l=!0}}const n=Q(r,e),i=()=>{n.dispose(),t.abortSignal!=null&&t.abortSignal.removeEventListener("abort",i)};return t.abortSignal!=null&&t.abortSignal.addEventListener("abort",i),i},A=(s,e=(t,r)=>t===r)=>new N(s,e),$=(s,e=(t,r)=>t===r)=>new f(s,e),se=()=>typeof window<"u"?window:void 0,y={map:(s,e)=>f.is(s)?s.map(e):e(s),toSignal:(s,e)=>f.is(s)?s:$(s,e),maybeToSignal:(s,e)=>{if(s!=null)return y.toSignal(s,e)},get:s=>f.is(s)?s.get():s,on:(s,e)=>f.is(s)?s.on(e):(e(s),()=>{}),dispose:s=>{f.is(s)&&s.dispose()},deriveProp:(s,{autoDisposeProp:e=!0,equals:t}={})=>f.is(s)?s.deriveProp({autoDisposeProp:e,equals:t}):A(s,t)},Z=(...s)=>(e,t)=>{if(s.length===1)return y.toSignal(s[0]).map(e);const r=s.filter(n=>f.is(n));return Q(()=>e(...s.map(n=>y.get(n))),r,t)},ot=s=>{const e=Object.keys(s);return Z(...Object.values(s))((...t)=>Object.fromEntries(e.map((r,n)=>[r,t[n]])))},lt=(...s)=>(e,t={})=>{const r=s.filter(n=>f.is(n));return Oe(()=>e(...s.map(y.get)),r,t)};class re{constructor(){o(this,"_store",new Map);o(this,"getItem",e=>this._store.get(e)??null);o(this,"setItem",(e,t)=>{this._store.set(e,t)})}}const ne=({key:s,defaultValue:e,store:t,serialize:r=JSON.stringify,deserialize:n=JSON.parse,equals:i=(c,a)=>c===a,onLoad:l=c=>c})=>{const c=t.getItem(s),a=new N(c!=null?l(n(c)):typeof e=="function"?e():e,i);return a.on(u=>t.setItem(s,r(u))),a},ct=s=>{var e;return ne({...s,store:((e=se())==null?void 0:e.localStorage)??new re})},at=s=>{var e;return ne({...s,store:((e=se())==null?void 0:e.sessionStorage)??new re})};function _e(s){return typeof requestAnimationFrame=="function"?requestAnimationFrame(s):setTimeout(s,0)}const De=(s,e,t,r)=>{const n=(r==null?void 0:r.duration)??300,i=(r==null?void 0:r.easing)??(_=>_),l=(r==null?void 0:r.equals)??((_,B)=>_===B);let c=r==null?void 0:r.interpolate,a=s,u=e(),h=performance.now(),m=null,T=!0;const p=new w(e,l),g=A(s,l);g.onDispose(()=>{m!==null&&cancelAnimationFrame(m)}),g.onDispose(p.dispose),t.forEach(_=>{_.setDerivative(p),_.onDispose(g.dispose)});const P=_=>{u=_,h=performance.now(),a=g.value,T&&(T=!1,m=_e(ye))},ye=()=>{const B=(performance.now()-h)/y.get(n),st=i(B);c==null&&(c=xe(a));let Te=c(a,u,st);B>=1?(T=!0,Te=u):m=_e(ye),g.set(Te)};return p.on(P),g},ut=(s,e)=>{const{initialValue:t,...r}=e??{};return De(t??s.get(),s.get,[s],r)},Le=(s,e)=>{const t=Object.values(s).filter(f.is),r=Object.keys(s);return Q(()=>{const n={};for(const i of r)n[i]=y.get(s[i]);return e(n)},t)},ht=s=>Le(s,e=>e),dt=(s,e)=>{const t=A(s.get());let r=null;const n=s.on(i=>{r!=null&&clearTimeout(r),r=setTimeout(()=>{r=null,t.set(i)},typeof e=="function"?e(i):e)});return t.onDispose(()=>{n(),r!=null&&clearTimeout(r)}),t},ft=s=>(...e)=>Z(s,...e)((t,...r)=>t(...r)),pt=(...s)=>Z(...s)((...e)=>e.find(t=>t!=null)),Me=new Set(["checked","disabled","hidden"]),He=new Set(["selected"]),Ne=new Set(["rowSpan","colSpan","tabIndex","valueAsNumber"]),ke=new Set(["valueAsDate"]),Ie=new Set(["value","textContent","innerText","innerHTML","outerHTML","className","classList"]),$e=(s,e)=>He.has(s)?t=>{t==null||t!==!0?e.removeAttribute(s):e.setAttribute(s,"")}:Me.has(s)?t=>{t==null?e[s]=null:e[s]=!!t}:Ne.has(s)?t=>{t==null?e[s]=null:e[s]=Number(t)}:ke.has(s)?t=>{t==null?e[s]=null:e[s]=t}:Ie.has(s)?t=>{t==null?e[s]=null:e[s]=String(t)}:t=>{t==null?e.removeAttribute(s):e.setAttribute(s,t)},Re=(s,e)=>He.has(s)?()=>e.hasAttribute(s):Me.has(s)?()=>!!e[s]:Ne.has(s)?()=>Number(e[s]):ke.has(s)?()=>e[s]:Ie.has(s)?()=>String(e[s]):()=>e.getAttribute(s),k=s=>{const e=s;e&&e.onblur&&(e.onblur=null),!(!s||s.ownerDocument===void 0)&&s.parentElement&&s.parentElement.removeChild(s)},Ve=s=>ie(s)?s:s.parentElement,ie=s=>s.nodeType===1;class oe extends Error{constructor(e){super(`Provider not found: ${e.description}`)}}class x{constructor(e,t,r,n){o(this,"createElement",(e,t)=>t!==void 0?this.document.createElementNS(t,e):this.document.createElement(e));o(this,"makeChildElement",(e,t)=>{const r=this.createElement(e,t);return this.appendOrInsert(r),this.withElement(r)});o(this,"createText",e=>this.document.createTextNode(e));o(this,"makeChildText",e=>{const t=this.createText(e);return this.appendOrInsert(t),this.withReference(t)});o(this,"setText",e=>{this.reference.nodeValue=e});o(this,"getText",()=>{var e;return((e=this.reference)==null?void 0:e.nodeValue)??this.element.textContent??""});o(this,"makeRef",()=>{const e=this.createText("");return this.appendOrInsert(e),this.withReference(e)});o(this,"appendOrInsert",e=>{this.reference===void 0?this.element.appendChild(e):this.element.insertBefore(e,this.reference)});o(this,"withElement",e=>new x(this.document,e,void 0,this.providers));o(this,"makePortal",e=>{const t=typeof e=="string"?this.document.querySelector(e):e;if(t==null)throw new Error(`Cannot find element by selector for portal: ${e}`);return this.withElement(t)});o(this,"withReference",e=>new x(this.document,this.element,e,this.providers));o(this,"setProvider",(e,t,r)=>new x(this.document,this.element,this.reference,{...this.providers,[e]:[t,r]}));o(this,"getProvider",e=>{if(this.providers[e]===void 0)throw new oe(e);const[t,r]=this.providers[e];return{value:t,onUse:r}});o(this,"clear",e=>{e&&(this.reference!==void 0?k(this.reference):k(this.element))});o(this,"addClasses",e=>{this.element.classList.add(...e)});o(this,"removeClasses",e=>{this.element.classList.remove(...e)});o(this,"getClasses",()=>Array.from(this.element.classList));o(this,"on",(e,t,r)=>{const n=i=>t(i,this);return this.element.addEventListener(e,n,r),i=>{i&&this.element.removeEventListener(e,n,r)}});o(this,"isBrowserDOM",()=>!0);o(this,"isBrowser",()=>!0);o(this,"isHeadlessDOM",()=>!1);o(this,"isHeadless",()=>!1);o(this,"setStyle",(e,t)=>{this.element.style[e]=t});o(this,"getStyle",e=>this.element.style[e]);o(this,"makeAccessors",e=>({get:Re(e,this.element),set:$e(e,this.element)}));o(this,"getWindow",()=>this.document.defaultView);this.document=e,this.element=t,this.reference=r,this.providers=n}static of(e,t,r){return new x(e.ownerDocument,e,t,r)}}const je=s=>Symbol(s),K=(s,e)=>{const t=s(e);return(r=!0)=>t(r)},mt=(s,e,{doc:t,clear:r,disposeWithParent:n=!0,providers:i={}}={})=>{const l=typeof e=="string"?(t??document).querySelector(e):e;if(l===null)throw new qe(`Cannot find element by selector for render: ${e}`);r!==!1&&(t??l.ownerDocument)!=null&&l.nodeType===1&&(l.innerHTML="");const c=Ve(l),a=ie(l)?void 0:l,u=x.of(c,a,i),h=K(s,u);let m;return n&&(m=new MutationObserver(T=>{var p;(p=T[0])==null||p.removedNodes.forEach(g=>{g===l&&(m==null||m.disconnect(),h(l.nodeType!==1))})}),m.observe(l.parentElement,{childList:!0,subtree:!1,attributes:!1})),()=>{m==null||m.disconnect(),h(!0)}},gt=(s,{startUrl:e="https://example.com",selector:t,providers:r={}}={selector:"body"})=>{const n=y.toSignal(e).deriveProp(),i=new ce(t,void 0),l=new O(i,void 0,{currentURL:n},r);return{clear:K(s(),l),root:i,currentURL:n}};class qe extends Error{constructor(e){super(e)}}const le="data-tts-node",I="data-tts-class",G="data-tts-style",J="data-tts-html",X="data-tts-text",Y="data-tts-attrs";class yt{constructor({select:e,getAttribute:t,setAttribute:r,getClass:n,setClass:i,getStyles:l,setStyles:c,appendHTML:a,getInnerHTML:u,setInnerHTML:h,getInnerText:m,setInnerText:T}){o(this,"select");o(this,"getAttribute");o(this,"setAttribute");o(this,"getClass");o(this,"setClass");o(this,"getStyles");o(this,"setStyles");o(this,"appendHTML");o(this,"getInnerHTML");o(this,"setInnerHTML");o(this,"getInnerText");o(this,"setInnerText");o(this,"setFromRoot",(e,t)=>{e.getPortals().forEach(n=>{const i=typeof n.selector=="string"?this.select(n.selector):[n.selector];for(const l of i){if(l==null)throw new Error(`Cannot find element by selector for render: ${n.selector}`);if(n.hasChildren()&&this.appendHTML(l,n.contentToHTML(t)),n.hasInnerHTML()){if(t){const c=this.getInnerHTML(l);c!=null&&this.setAttribute(l,J,c)}this.setInnerHTML(l,n.getInnerHTML())}if(n.hasInnerText()){if(t){const c=this.getInnerText(l);c!=null&&this.setAttribute(l,X,c)}this.setInnerText(l,n.getInnerText())}if(n.hasClasses()){if(t){const c=this.getClass(l);c!=null&&this.setAttribute(l,I,c)}this.setClass(l,n.getClasses().join(" "))}if(n.hasStyles()){if(t){const c=this.getStyles(l);Object.keys(c).length>0&&this.setAttribute(l,G,JSON.stringify(c))}this.setStyles(l,n.getStyles())}if(n.hasAttributes()){const c=n.getAttributes();if(t){const a=[];c.forEach(([u])=>{const h=this.getAttribute(l,u);h!=null&&a.push([u,h])}),a.length>0&&this.setAttribute(l,Y,JSON.stringify(Object.fromEntries(a)))}c.forEach(([a,u])=>{this.setAttribute(l,a,u)})}}})});this.select=e,this.getAttribute=t,this.setAttribute=r,this.getClass=n,this.setClass=i,this.getStyles=l,this.setStyles=c,this.appendHTML=a,this.getInnerHTML=u,this.setInnerHTML=h,this.getInnerText=m,this.setInnerText=T}}const Tt=()=>{document.querySelectorAll(`[${le}]`).forEach(k)},St=s=>{const e=s.getAttribute(I);s.removeAttribute(I),e!=null&&s.setAttribute("class",e)},bt=()=>{document.querySelectorAll(`[${I}]`).forEach(e=>St(e))},At=s=>{const e=s.getAttribute(J);s.removeAttribute(J),e!=null&&(s.innerHTML=e)},Et=()=>{document.querySelectorAll(`[${J}]`).forEach(e=>At(e))},_t=s=>{const e=s.getAttribute(X);s.removeAttribute(X),e!=null&&(s.innerText=e)},vt=()=>{document.querySelectorAll(`[${X}]`).forEach(e=>_t(e))},Be=s=>JSON.parse(s.replace(/"/g,'"')),Ct=s=>{const e=s.getAttribute(G);if(s.removeAttribute(G),e!=null){const t=Be(e);Object.entries(t).forEach(([r,n])=>{s.style.setProperty(r,n)})}},Pt=()=>{document.querySelectorAll(`[${G}]`).forEach(e=>Ct(e))},wt=s=>{const e=s.getAttribute(Y);if(s.removeAttribute(Y),e!=null){const t=Be(e);Object.entries(t).forEach(([r,n])=>{n==null?s.removeAttribute(r):s.setAttribute(r,n)})}},xt=()=>{document.querySelectorAll(`[${Y}]`).forEach(e=>wt(e))},Ot=()=>{Tt(),bt(),vt(),Et(),Pt(),xt()},b=Symbol("class"),v=Symbol("style"),L=Symbol("handler"),Fe=()=>Math.random().toString(36).substring(2,15),Dt=s=>s.replace(/<[^>]*>?/g,"");class We{constructor(e){o(this,"id",Fe());o(this,"properties",{});o(this,"children",[]);o(this,"isElement",()=>!0);o(this,"isText",()=>!1);o(this,"getText",()=>this.properties.innerText!=null?this.properties.innerText:this.properties.innerHTML!=null?Dt(this.properties.innerHTML):this.children.map(e=>e.getText()).join(""));o(this,"removeChild",e=>{const t=this.children.indexOf(e);t!==-1&&this.children.splice(t,1)});o(this,"remove",()=>{if(this.parent!=null)this.parent.removeChild(this);else throw new Error("Parent is undefined")});o(this,"getPortals",()=>{const e=this.elements().flatMap(t=>t.isPortal()?[t,...t.getPortals()]:t.getPortals());return this.isPortal()&&e.unshift(this),e});o(this,"elements",()=>this.children.filter(e=>e.isElement()));o(this,"hasInnerHTML",()=>this.properties.innerHTML!=null);o(this,"getInnerHTML",()=>this.properties.innerHTML??"");o(this,"getInnerText",()=>this.properties.innerText??"");o(this,"hasInnerText",()=>this.properties.innerText!=null);o(this,"hasChildren",()=>this.children.length>0);o(this,"hasClasses",()=>this.properties[b]!=null);o(this,"hasStyles",()=>this.properties[v]!=null);o(this,"hasAttributes",()=>Object.keys(this.properties).length>0);o(this,"hasHandlers",()=>this.properties[L]!=null);o(this,"hasRenderableProperties",()=>this.hasClasses()||this.hasAttributes()||this.hasStyles());o(this,"getById",e=>{if(this.properties.id===e)return this;for(const t of this.elements()){const r=t.getById(e);if(r!=null)return r}});o(this,"trigger",(e,t)=>{((this.properties[L]??{})[e]??[]).forEach(n=>n(t))});o(this,"click",()=>{this.trigger("click",{})});o(this,"on",(e,t,r,n)=>{var a;const i=(a=this.properties)[L]??(a[L]={}),l=n!=null&&n.once?u=>{c(),t(u,r)}:u=>t(u,r);i[e]=[...i[e]??[],l];const c=()=>{const u=i[e]??[],h=u.indexOf(l);h!==-1&&(u.splice(h,1),u.length===0?(delete i[e],Object.keys(i).length===0&&delete this.properties[L]):i[e]=u,(n==null?void 0:n.signal)!=null&&n.signal.removeEventListener("abort",c))};return(n==null?void 0:n.signal)!=null&&n.signal.addEventListener("abort",c),c});o(this,"addClasses",e=>{var r;if(e.length===0)return;const t=(r=this.properties)[b]??(r[b]=[]);e.forEach(n=>{t.includes(n)||t.push(n)})});o(this,"removeClasses",e=>{var r;if(e.length===0)return;const t=(r=this.properties)[b]??(r[b]=[]);e.forEach(n=>{const i=t.indexOf(n);i!==-1&&t.splice(i,1)}),t.length===0&&delete this.properties[b]});o(this,"getClasses",()=>this.properties[b]??[]);o(this,"getAttributes",()=>Object.entries(this.properties).filter(([e])=>!["innerText","innerHTML"].includes(e)));o(this,"getVisibleAttributes",()=>Reflect.ownKeys(this.properties).flatMap(e=>e===b?[["class",this.getClasses()]]:e===v?[["style",this.getStyles()]]:typeof e=="string"?[[e,String(this.properties[e])]]:[]));o(this,"setStyle",(e,t)=>{var n;const r=(n=this.properties)[v]??(n[v]={});r[e]=t,t===""&&(delete r[e],Object.keys(r).length===0&&delete this.properties[v])});o(this,"getStyle",e=>{var t;return((t=this.properties[v])==null?void 0:t[e])??""});o(this,"getStyles",()=>this.properties[v]??{});o(this,"makeAccessors",e=>{const t=this.properties;return{get:()=>t[e],set:r=>t[e]=r}});this.parent=e}}const Lt=s=>s.replace(/"/g,"""),Mt=s=>s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");class Ue extends We{constructor(t,r,n){super(n);o(this,"isPortal",()=>!1);o(this,"toHTML",(t=!1)=>{const r=this.children.map(a=>a.toHTML()).join(""),n=this.namespace?` xmlns="${this.namespace}"`:"";let i=null;const l=this.getVisibleAttributes().map(([a,u])=>a==="class"?` class="${u.join(" ")}"`:a==="style"?typeof u=="string"?` style="${u}"`:` style="${Object.entries(u).map(([h,m])=>`${h}: ${m};`).join(" ")}"`:Ht.has(a)?` ${a}`:a==="innerHTML"?(i=u,""):a==="innerText"?(i=Mt(u),""):` ${a}="${Lt(u)}"`).join(""),c=t?` ${le}`:"";return Nt.has(this.tagName)&&r===""?`<${this.tagName}${n}${l}${c} />`:`<${this.tagName}${n}${l}${c}>${i??r}</${this.tagName}>`});this.tagName=t,this.namespace=r}}class ce extends We{constructor(t,r){super(r);o(this,"isPortal",()=>!0);o(this,"toHTML",()=>"");o(this,"contentToHTML",(t=!1)=>this.children.map(r=>r.toHTML(t)).join(""));this.selector=t}}class Ge{constructor(e){o(this,"id",Fe());o(this,"isElement",()=>!1);o(this,"isText",()=>!0);o(this,"getText",()=>this.text);o(this,"toHTML",()=>this.text);this.text=e}}class O{constructor(e,t,r,n){o(this,"appendOrInsert",e=>{if(this.reference!=null){const t=this.element.children.indexOf(this.reference);this.element.children.splice(t,0,e)}else this.element.children.push(e)});o(this,"makeChildElement",(e,t)=>{const r=new Ue(e,t,this.element);return this.appendOrInsert(r),new O(r,void 0,this.container,this.providers)});o(this,"makeChildText",e=>{const t=new Ge(e);return this.appendOrInsert(t),new O(this.element,t,this.container,this.providers)});o(this,"setText",e=>{this.reference&&this.reference.isText()&&(this.reference.text=e)});o(this,"getText",()=>{var e;return((e=this.reference)==null?void 0:e.getText())??this.element.getText()});o(this,"makeRef",()=>this.makeChildText(""));o(this,"makePortal",e=>{const t=new ce(e,this.element);return this.appendOrInsert(t),new O(t,void 0,this.container,this.providers)});o(this,"setProvider",(e,t,r)=>new O(this.element,this.reference,this.container,{...this.providers,[e]:[t,r]}));o(this,"getProvider",e=>{if(this.providers[e]===void 0)throw new oe(e);const[t,r]=this.providers[e];return{value:t,onUse:r}});o(this,"clear",e=>{e&&(this.reference!==void 0?this.element.removeChild(this.reference):this.element.remove())});o(this,"on",(e,t)=>this.element.on(e,t,this));o(this,"addClasses",e=>this.element.addClasses(e));o(this,"removeClasses",e=>this.element.removeClasses(e));o(this,"getClasses",()=>this.element.getClasses());o(this,"isBrowserDOM",()=>!1);o(this,"isBrowser",()=>!1);o(this,"isHeadlessDOM",()=>!0);o(this,"isHeadless",()=>!0);o(this,"setStyle",(e,t)=>this.element.setStyle(e,t));o(this,"getStyle",e=>this.element.getStyle(e));o(this,"makeAccessors",e=>this.element.makeAccessors(e));this.element=e,this.reference=t,this.container=r,this.providers=n}}const Ht=new Set(["checked","disabled","multiple","readonly","required","selected"]),Nt=new Set(["img","br","hr","input","link","meta"]),ae=s=>e=>e.makeChildText(s).clear,ue=s=>e=>{const t=e.makeChildText(s.value),r=s.on(t.setText);return n=>{r(),t.clear(n)}},kt=s=>f.is(s)?ue(s):ae(s),S=(...s)=>e=>{const t=s.map(r=>d(r)(e));return r=>{t.forEach(n=>n(r))}},E=()=>()=>{},It=s=>e=>(e.addClasses(s),t=>{t&&e.removeClasses(s)}),$t=s=>e=>{let t=[];const r=s.on(n=>{e.removeClasses(t),t=(n??"").split(" ").filter(i=>i.length>0),e.addClasses(t)});return n=>{r(),n&&e.removeClasses(t),t.length=0}},R=(s,e)=>t=>{const{get:r,set:n}=t.makeAccessors(s),i=r();return n(e),l=>{l&&n(i)}},V=(s,e)=>t=>{const{get:r,set:n}=t.makeAccessors(s),i=r(),l=e.on(n);return c=>{l(),c&&n(i)}},D=new Proxy({},{get:(s,e)=>e==="class"?t=>f.is(t)?$t(t):It((t??"").split(" ").filter(r=>r.length>0)):t=>f.is(t)?V(e,t):R(e,t)}),Rt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(`data-${e}`,t):R(`data-${e}`,t)}),Vt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(`aria-${e}`,t):R(`aria-${e}`,t)}),jt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(e,t):R(e,t)}),qt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(e,t):R(e,t)}),d=s=>{if(s==null)return E;if(Array.isArray(s))return S(...s.map(d));if(typeof s=="string")return ae(s);if(f.is(s))return ue(s);if(typeof s=="function")return s;throw new Error(`Unknown type: '${typeof s}' for child: ${s}`)},he=(s,...e)=>t=>{const r=t.makeChildElement(s,void 0),n=e.map(i=>d(i)(r));return i=>{n.forEach(l=>l(!1)),r.clear(i)}},de=(s,e,...t)=>r=>{const n=r.makeChildElement(s,e),i=t.map(l=>d(l)(n));return l=>{i.forEach(c=>c(!1)),n.clear(l)}},Bt=new Proxy({},{get:(s,e)=>(...t)=>he(e,t.flatMap(d))}),Ft=new Proxy({},{get:(s,e)=>(...t)=>he("input",D.type(e),...t)}),Wt="http://www.w3.org/2000/svg",Ut=new Proxy({},{get:(s,e)=>(...t)=>de(e,Wt,t.flatMap(d))}),Gt="http://www.w3.org/1998/Math/MathML",Jt=new Proxy({},{get:(s,e)=>(...t)=>de(e,Gt,t.flatMap(d))}),fe=(s,e)=>{if(typeof e=="function")return fe(s,{then:e});const t=e.pending!=null?d(e.pending()):E,r=e.then,n=e.error!=null?i=>d(e.error(i)):()=>E;return i=>{let l=!0;const c=s(),a=i.makeRef();let u=d(t)(a);return c.then(h=>{l&&(u(!0),u=d(r(h))(a))},h=>{l&&(u(!0),u=d(n(h))(a))}),h=>{l=!1,u(h),a.clear(h)}}},Xt=(s,e)=>fe(()=>s,e),Je=(s,e,t)=>r=>r.on(s,e,t),Xe=s=>Je("click",(e,t)=>{e.preventDefault();const r=e.target;setTimeout(()=>{const n=r.ownerDocument!=null?r==null?void 0:r.checked:void 0;n!=null&&s(!n,t)},0)}),j=new Proxy({},{get:(s,e)=>t=>Je(e,t)}),Ye=s=>e=>{const t=e.target;s(t.value)},ze=s=>e=>{const t=e.target;s(t.valueAsNumber)},Qe=s=>e=>{const t=e.target;if(t.value==="")return;const r=t.value.split("-"),n=new Date(Number(r[0]),Number(r[1])-1,Number(r[2].substring(0,2)));s(n)},Yt=s=>e=>{const t=e.target;if(t.value===""){s(null);return}const r=t.value.split("-"),n=new Date(Number(r[0]),Number(r[1])-1,Number(r[2].substring(0,2)));s(n)},Ze=s=>e=>{const t=e.target;if(t.value==="")return;const r=t.value.split("T"),n=r[0].split("-"),i=new Date(Number(n[0]),Number(n[1])-1,Number(n[2])),l=r[1].split(":");i.setHours(Number(l[0])),i.setMinutes(Number(l[1])),i.setSeconds(Number(l[2])),s(i)},zt=s=>e=>{const t=e.target;if(t.value===""){s(null);return}const r=t.value.split("T");if(r.length!==2){s(null);return}const n=r[0].split("-"),i=new Date(Number(n[0]),Number(n[1])-1,Number(n[2])),l=r[1].split(":");i.setHours(Number(l[0]??0)),i.setMinutes(Number(l[1]??0)),i.setSeconds(Number(l[2]??0)),s(i)},Qt=s=>e=>{const t=e.target;s(t.checked)},Zt=s=>e=>{e.preventDefault(),s()},Kt=s=>e=>{e.stopPropagation(),s()},es=s=>e=>{e.stopImmediatePropagation(),s()},ts=(s,e="input")=>S(D.valueAsDate(s),j[e](Qe(s.set))),ss=(s,e="input")=>S(D.valueAsDate(s),j[e](Ze(s.set))),rs=(s,e="input")=>S(D.valueAsNumber(s),j[e](ze(s.set))),ns=(s,e="input")=>S(D.value(s),j[e](Ye(s.set))),is=s=>S(D.checked(s),Xe(s.set)),q=(s,e)=>{if(f.is(s))return r=>{const n=r.makeRef();let i,l;const c=s.map(h=>Object.keys(h)[0]);let a;const u=c.on(h=>{if(h!==a){a=h,l==null||l.dispose(),i==null||i(!0),l=s.map(T=>T[h]);const m=e[h](l);i=d(m)(n)}});return h=>{l==null||l.dispose(),u(),n.clear(h),i==null||i(h)}};const t=Object.keys(s)[0];return d(e[t]($(s[t])))},pe=(s,e,t)=>q(y.map(s,r=>({[r[e]]:r})),t),os=(s,e)=>pe(s,"kind",e),ls=(s,e)=>{const t=y.map(s,([r,n])=>({[r]:n}));return q(t,e)},cs=(s,e)=>pe(s,"type",e),Ke=(s,e)=>q(y.map(s,t=>({[t]:!0})),e),as=(s,e={})=>t=>{const r=(e==null?void 0:e.firstSeparator)??s,n=(e==null?void 0:e.lastSeparator)??s;return Ke(t.map(i=>i.isFirst?"first":i.isLast?"last":"other"),{first:r,last:n,other:s})},us=s=>e=>(e.appendOrInsert(s),t=>{t&&k(s)}),hs=(s,e,t)=>{if(f.is(s)){const r=s;return n=>{const i=n.makeRef();let l=()=>{},c=!1,a=null;const u=r.on(h=>{h==null?(l(!0),l=d(t==null?void 0:t())(i),c=!1,a==null||a.dispose(),a=null):c?a.set(h):(a=A(h),l(!0),l=d(e(a))(i),c=!0)});return h=>{a==null||a.dispose(),u(),l==null||l(h),i.clear(h)}}}else{const r=s;if(r==null){const n=t==null?void 0:t();return n!=null?d(n):E}return d(e($(r)))}},ds=(...s)=>(e,t)=>r=>{const n=r.makeRef();if(s.some(p=>!f.is(p)&&p==null))return(t!=null?d(t==null?void 0:t()):E)(n);const l=s.map(()=>null),c=s.map(p=>f.is(p)?p.value!=null:p!=null);let a=null;const u=A(c.every(p=>p)),h=(p,g)=>{if(p.value!=null){if(l[g]==null){const P=A(p.value);l[g]=P}else l[g].value=p.value;c[g]=!0}else c[g]=!1};let m=s.length-1;const T=s.map((p,g)=>{if(!f.is(p)){const P=A(p);return l[g]=P,()=>{}}return p.on(()=>{h(p,g),m===0?u.value=c.every(P=>P):m--})});return u.on(p=>{a==null||a(!0),a=null,p?a=d(e(...l))(n):a=d((t==null?void 0:t())??E)(n)}),p=>{l.forEach(g=>g==null?void 0:g.dispose()),u.dispose(),T.forEach(g=>g()),a==null||a(p),n.clear(p)}},M=(...s)=>e=>t=>s.forEach(r=>r(t,e)),me=(s,e,t)=>{if(f.is(s)){const r=s;return n=>{const i=n.makeRef();let l=()=>{};const c=r.on(a=>{l(!0),a?l=d(e())(i):l=d(t==null?void 0:t())(i)});return a=>{l(a),c(),i.clear(a)}}}else{if(s){const n=e();return n!=null?d(n):E}return d(t==null?void 0:t())}},fs=(s,e,t)=>me(y.map(s,r=>!r),e,t),ge=(s,e,t)=>{if(t!=null)return ge(s,r=>{const n=new U(r.index,r.total.map(i=>i-1));return S(M(n.dispose),d(e(r)),me(r.isLast,()=>E,()=>t(n)))});if(f.is(s))return r=>{const n=s.derive(),i=r.makeRef(),l=[];return n.on(c=>{const a=l.splice(c);for(const u of a)u(!0);for(let u=l.length;u<c;u++){const h=new U(u,n);l.push(S(M(h.dispose),d(e(h)))(i))}}),c=>{n.dispose();for(const a of l)a(c);l.length=0,i.clear(c)}};{const r=$(s);return S(...Array.from({length:s},(n,i)=>i).map(n=>{const i=new U(n,r);return S(M(i.dispose),d(e(i)))}))}},ps=(s,e,t)=>{const r=y.map(s,i=>i.length),n=y.toSignal(s);return ge(r,i=>{const l=n.map(c=>c[i.index]);return S(M(l.dispose),d(e(l,i)))},t)},ms=(s,e)=>{if(f.is(s)){const t=s;return r=>{r=r.makeRef();const n=t.map(c=>d(e(c)));let i=()=>{};const l=n.on(c=>{i(!0),i=c(r)});return c=>{l(),i(c)}}}return d(e(s))},gs=(s,e,t=()=>E)=>q(y.map(s,r=>r.length>0?{notEmpty:r}:{whenEmpty:null}),{notEmpty:r=>e(r),whenEmpty:()=>t()}),ys=(s,e)=>t=>{const r=t.makePortal(s),n=K(d(e),r);return()=>n(!0)},W=new Map,et=s=>({mark:je(`Probe(${s.description})`),create:({callback:e=()=>{},timeout:t=10}={})=>{const r=c=>{clearTimeout(n),W.delete(s),e(c)};if(W.has(s))throw new Error(`Probe already exists: ${s.description}`);const n=setTimeout(()=>r("timeout"),t),i={counter:0,timeoutId:n};return W.set(s,i),{value:()=>{clearTimeout(n);const c=W.get(s);c!=null&&--c.counter===0&&r("resolved")},dispose:()=>r("disposed"),onUse:()=>i.counter++}}}),Ts=et(Symbol("GlobalProbe")),Ss=(s,e)=>t=>{const r=t.getStyle(s);return t.setStyle(s,e),n=>{n&&t.setStyle(s,r)}},bs=(s,e)=>t=>{const r=t.getStyle(s),n=e.on(i=>t.setStyle(s,i));return i=>{n(),i&&t.setStyle(s,r)}},As=new Proxy({},{get:(s,e)=>t=>f.is(t)?bs(e,t):Ss(e,t)}),tt=s=>e=>{if(e.isBrowser()){const t=s(e);if(t!=null)return d(t)(e)}return()=>{}},Es=s=>e=>{const t=s(e);return t==null?()=>{}:d(t)(e)},_s=s=>tt(e=>s(e.element)),vs=s=>e=>{if(e.isHeadlessDOM()){const t=s(e);if(t)return d(t)(e)}return()=>{}},ee=s=>e=>{let t=e;function r(){return t}function n(c){t=c}const i=[],l=s({use:({mark:c})=>{const{value:a,onUse:u}=r().getProvider(c);return u==null||u(),a},set:({mark:c,create:a},u)=>{const{value:h,dispose:m,onUse:T}=a(u,r());i.push(m),n(r().setProvider(c,h,T))}});return l==null?()=>{}:S(d(l),M(()=>i.forEach(c=>c())))(r())},Cs=(s,e,t)=>ee(({set:r})=>(r(s,e),t())),Ps=(s,e)=>ee(({use:t})=>e(t(s))),ws=(...s)=>e=>ee(({use:t})=>{const r=s.map(t);return e(...r)});exports.Async=Xt;exports.BindChecked=is;exports.BindDate=ts;exports.BindDateTime=ss;exports.BindNumber=rs;exports.BindText=ns;exports.BrowserContext=x;exports.CLASS_PLACEHOLDER_ATTR=I;exports.Computed=w;exports.Conjunction=as;exports.DOMNode=us;exports.El=he;exports.ElNS=de;exports.ElementPosition=U;exports.Empty=E;exports.Ensure=hs;exports.EnsureAll=ds;exports.ForEach=ps;exports.Fragment=S;exports.GlobalProbe=Ts;exports.HeadlessAdapter=yt;exports.HeadlessContext=O;exports.HeadlessElement=Ue;exports.HeadlessPortal=ce;exports.HeadlessText=Ge;exports.MapSignal=ms;exports.MemoryStore=re;exports.NotEmpty=gs;exports.OnChecked=Xe;exports.OnDispose=M;exports.OneOf=q;exports.OneOfField=pe;exports.OneOfKind=os;exports.OneOfTuple=ls;exports.OneOfType=cs;exports.OneOfValue=Ke;exports.Portal=ys;exports.Prop=N;exports.Provide=Cs;exports.ProviderNotFoundError=oe;exports.RenderingError=qe;exports.Repeat=ge;exports.Signal=f;exports.Task=fe;exports.TextNode=kt;exports.Unless=fs;exports.Use=Ps;exports.UseMany=ws;exports.Value=y;exports.When=me;exports.WithBrowserCtx=tt;exports.WithCtx=Es;exports.WithElement=_s;exports.WithHeadlessCtx=vs;exports.WithProvider=ee;exports._NODE_PLACEHOLDER_ATTR=le;exports._getSelfOrParentElement=Ve;exports._isElement=ie;exports._makeGetter=Re;exports._makeSetter=$e;exports._removeDOMNode=k;exports._signalText=ue;exports._staticText=ae;exports.animateSignal=ut;exports.animateSignals=De;exports.aria=Vt;exports.attr=D;exports.bind=ft;exports.coalesce=pt;exports.computed=Q;exports.computedOf=Z;exports.computedRecord=Le;exports.dataAttr=Rt;exports.delaySignal=dt;exports.effect=Oe;exports.effectOf=lt;exports.emitChecked=Qt;exports.emitPreventDefault=Zt;exports.emitStopImmediatePropagation=es;exports.emitStopPropagation=Kt;exports.emitValue=Ye;exports.emitValueAsDate=Qe;exports.emitValueAsDateTime=Ze;exports.emitValueAsNullableDate=Yt;exports.emitValueAsNullableDateTime=zt;exports.emitValueAsNumber=ze;exports.endInterpolate=we;exports.getWindow=se;exports.guessInterpolate=xe;exports.html=Bt;exports.input=Ft;exports.interpolateDate=Pe;exports.interpolateNumber=ve;exports.interpolateString=Ce;exports.joinSignals=ot;exports.localStorageProp=ct;exports.makeProbe=et;exports.makeProviderMark=je;exports.math=Jt;exports.mathAttr=qt;exports.merge=ht;exports.on=j;exports.prop=A;exports.render=mt;exports.renderWithContext=K;exports.renderableOfTNode=d;exports.restoreTempoPlaceholders=Ot;exports.runHeadless=gt;exports.sessionStorageProp=at;exports.signal=$;exports.storedProp=ne;exports.style=As;exports.svg=Ut;exports.svgAttr=jt;
|
|
1
|
+
"use strict";var rt=Object.defineProperty;var Se=s=>{throw TypeError(s)};var nt=(s,e,t)=>e in s?rt(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var o=(s,e,t)=>nt(s,typeof e!="symbol"?e+"":e,t),be=(s,e,t)=>e.has(s)||Se("Cannot "+t);var F=(s,e,t)=>(be(s,e,"read from private field"),t?t.call(s):e.get(s)),Ae=(s,e,t)=>e.has(s)?Se("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),te=(s,e,t,r)=>(be(s,e,"write to private field"),r?r.call(s,t):e.set(s,t),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ve=(s,e,t)=>s+(e-s)*t,Ee=97,Ce=(s,e,t)=>{const r=Math.max(s.length,e.length);let n="";for(let i=0;i<r;i++){let l=s.charCodeAt(i);isNaN(l)&&(l=Ee);let c=e.charCodeAt(i);isNaN(c)&&(c=Ee),n+=String.fromCharCode(l+(c-l)*t)}return n},Pe=(s,e,t)=>new Date(s.getTime()+(e.getTime()-s.getTime())*t),we=(s,e)=>e,xe=s=>typeof s=="number"?ve:typeof s=="string"?Ce:s instanceof Date?Pe:we;var C;class U{constructor(e,t){o(this,"counter");o(this,"isFirst");o(this,"isEven");o(this,"isOdd");Ae(this,C);o(this,"dispose",()=>{var e;(e=F(this,C))==null||e.dispose(),te(this,C,void 0)});this.index=e,this.total=t,this.counter=e+1,this.isFirst=e===0,this.isEven=e%2===1,this.isOdd=e%2===0}get isLast(){return F(this,C)==null&&te(this,C,this.total.map(e=>this.counter===e)),F(this,C)}}C=new WeakMap;const H=class H{constructor(e,t){o(this,"$__signal__",!0);o(this,"_value");o(this,"_derivatives",[]);o(this,"_onValueListeners",[]);o(this,"_onDisposeListeners",[]);o(this,"get",()=>this._value);o(this,"hasListeners",()=>this._onValueListeners.length>0);o(this,"on",(e,t={})=>{t.skipInitial||e(this.get(),void 0);const r=t.once?(i,l)=>{n(),e(i,l)}:e;this._onValueListeners.push(r);const n=()=>{this._onValueListeners.splice(this._onValueListeners.indexOf(r),1),t.abortSignal!=null&&t.abortSignal.removeEventListener("abort",n)};return t.abortSignal!=null&&t.abortSignal.addEventListener("abort",n),n});o(this,"_setAndNotify",e=>{if(this._disposed)return;const t=this._value;this.equals(t,e)||(this._value=e,this._onValueListeners.forEach(n=>n(e,t)))});o(this,"_disposed",!1);o(this,"isDisposed",()=>this._disposed);o(this,"onDispose",e=>{this._onDisposeListeners.push(e)});o(this,"dispose",()=>{this._disposed||(this._disposed=!0,this._onDisposeListeners.forEach(e=>e()),this._onDisposeListeners.length=0,this._derivatives.length=0)});o(this,"map",(e,t=(r,n)=>r===n)=>{const r=new w(()=>{try{return e(this.get())}catch(n){throw console.error("Error in Signal.map:",n),n}},t);return this.setDerivative(r),r});o(this,"flatMap",(e,t=(r,n)=>r===n)=>{const r=new w(()=>{try{return e(this.get()).get()}catch(n){throw console.error("Error in Signal.flatMap:",n),n}},t);return this.setDerivative(r),r});o(this,"tap",e=>this.map(t=>(e(t),t)));o(this,"at",e=>this.map(t=>t[e]));o(this,"_$");o(this,"filter",(e,t)=>{let r=t??this.get();const n=new w(()=>{try{const i=this.get();return r=e(i)?i:r}catch(i){throw console.error("Error in Signal.filter:",i),i}},this.equals);return this.setDerivative(n),n});o(this,"filterMap",(e,t,r=(n,i)=>n===i)=>{let n=t;const i=new w(()=>{try{const l=this.get(),c=e(l);return n=c??n}catch(l){throw console.error("Error in Signal.filterMap:",l),l}},r);return this.setDerivative(i),i});o(this,"mapAsync",(e,t,r,n=(i,l)=>i===l)=>{const i=A(t,n);let l=0,c=new AbortController;return i.onDispose(this.on(async a=>{const u=++l;c.abort(),c=new AbortController;try{const h=await e(a,{abortSignal:c.signal});u===l&&i.set(h)}catch(h){if(u===l)if(r!=null)i.set(r(h));else throw h}})),i});o(this,"mapMaybe",(e,t)=>this.map(r=>e(r)??t));o(this,"feedProp",(e,t=!1)=>{const r=this.on(e.set);return e.onDispose(r),t?this.onDispose(e.dispose):this.onDispose(r),e});o(this,"deriveProp",({autoDisposeProp:e=!0,equals:t}={})=>this.feedProp(A(this.get(),t),e));o(this,"derive",()=>this.map(e=>e));o(this,"count",()=>{let e=0;return this.map(()=>++e)});o(this,"setDerivative",e=>{this._derivatives.push(e),e.onDispose(()=>{this._derivatives.splice(this._derivatives.indexOf(e),1)}),e.onDispose(this.on(e.setDirty)),this.onDispose(e.dispose)});this.equals=t,this._value=e}get value(){return this._value}get $(){return this._$!==void 0?this._$:this._$=new Proxy(this,{get:(e,t)=>this.at(t)})}};o(H,"ofPromise",(e,t,r,n=(i,l)=>i===l)=>{const i=new H(t,n);return e.then(l=>i._setAndNotify(l)).catch(l=>{r!=null?i._setAndNotify(r(l)):console.error("Unhandled promise rejection in Signal.ofPromise:",l)}),i}),o(H,"is",e=>e!=null&&e.$__signal__===!0);let f=H;const it=typeof queueMicrotask=="function"?queueMicrotask:s=>Promise.resolve().then(s);class w extends f{constructor(t,r){super(void 0,r);o(this,"$__computed__",!0);o(this,"_isDirty",!1);o(this,"setDirty",()=>{this._isDirty||this._disposed||(this._isDirty=!0,this._derivatives.forEach(t=>t.setDirty()),this._scheduleNotify())});o(this,"_scheduleCount",0);o(this,"_scheduleNotify",()=>{const t=++this._scheduleCount;it(()=>{this._scheduleCount!==t||this._disposed||this._isDirty&&(this._isDirty=!1,this._setAndNotify(this._fn()))})});o(this,"get",()=>(this._isDirty&&(this._isDirty=!1,this._setAndNotify(this._fn())),this._value));this._fn=t,this.setDirty()}static is(t){return t!=null&&t.$__computed__===!0}get value(){return this.get()}}const z=class z extends f{constructor(){super(...arguments);o(this,"$__prop__",!0);o(this,"set",t=>{this._setAndNotify(t)});o(this,"update",t=>{this._setAndNotify(t(this.get()))});o(this,"reducer",(t,...r)=>{const n=this;return function i(l){const c=n.value;n.update(a=>t(a,l)),!n.equals(c,n.value)&&r.forEach(a=>a({previousState:c,state:n.value,action:l,dispatch:i}))}});o(this,"iso",(t,r,n=(i,l)=>i===l)=>{const i=new z(t(this.get()),n);return i.onDispose(this.on(l=>i.set(t(l)))),i.on(l=>this._setAndNotify(r(l))),i});o(this,"atProp",t=>this.iso(r=>r[t],r=>({...this.value,[t]:r})))}get value(){return this.get()}set value(t){this._setAndNotify(t)}};o(z,"is",t=>t!=null&&t.$__prop__===!0);let N=z;const Q=(s,e,t=(r,n)=>r===n)=>{const r=new w(s,t);return e.forEach(n=>n.setDerivative(r)),r},Oe=(s,e,t={})=>{let r=t.once?()=>{i(),s()}:s;if(t.skipInitial){let l=!1;const c=r;r=()=>{l?c():l=!0}}const n=Q(r,e),i=()=>{n.dispose(),t.abortSignal!=null&&t.abortSignal.removeEventListener("abort",i)};return t.abortSignal!=null&&t.abortSignal.addEventListener("abort",i),i},A=(s,e=(t,r)=>t===r)=>new N(s,e),$=(s,e=(t,r)=>t===r)=>new f(s,e),se=()=>typeof window<"u"?window:void 0,y={map:(s,e)=>f.is(s)?s.map(e):e(s),toSignal:(s,e)=>f.is(s)?s:$(s,e),maybeToSignal:(s,e)=>{if(s!=null)return y.toSignal(s,e)},get:s=>f.is(s)?s.get():s,on:(s,e)=>f.is(s)?s.on(e):(e(s),()=>{}),dispose:s=>{f.is(s)&&s.dispose()},deriveProp:(s,{autoDisposeProp:e=!0,equals:t}={})=>f.is(s)?s.deriveProp({autoDisposeProp:e,equals:t}):A(s,t)},Z=(...s)=>(e,t)=>{if(s.length===1)return y.toSignal(s[0]).map(e);const r=s.filter(n=>f.is(n));return Q(()=>e(...s.map(n=>y.get(n))),r,t)},ot=s=>{const e=Object.keys(s);return Z(...Object.values(s))((...t)=>Object.fromEntries(e.map((r,n)=>[r,t[n]])))},lt=(...s)=>(e,t={})=>{const r=s.filter(n=>f.is(n));return Oe(()=>e(...s.map(y.get)),r,t)};class re{constructor(){o(this,"_store",new Map);o(this,"getItem",e=>this._store.get(e)??null);o(this,"setItem",(e,t)=>{this._store.set(e,t)})}}const ne=({key:s,defaultValue:e,store:t,serialize:r=JSON.stringify,deserialize:n=JSON.parse,equals:i=(c,a)=>c===a,onLoad:l=c=>c})=>{const c=t.getItem(s),a=new N(c!=null?l(n(c)):typeof e=="function"?e():e,i);return a.on(u=>t.setItem(s,r(u))),a},ct=s=>{var e;return ne({...s,store:((e=se())==null?void 0:e.localStorage)??new re})},at=s=>{var e;return ne({...s,store:((e=se())==null?void 0:e.sessionStorage)??new re})};function _e(s){return typeof requestAnimationFrame=="function"?requestAnimationFrame(s):setTimeout(s,0)}const De=(s,e,t,r)=>{const n=(r==null?void 0:r.duration)??300,i=(r==null?void 0:r.easing)??(_=>_),l=(r==null?void 0:r.equals)??((_,B)=>_===B);let c=r==null?void 0:r.interpolate,a=s,u=e(),h=performance.now(),m=null,T=!0;const p=new w(e,l),g=A(s,l);g.onDispose(()=>{m!==null&&cancelAnimationFrame(m)}),g.onDispose(p.dispose),t.forEach(_=>{_.setDerivative(p),_.onDispose(g.dispose)});const P=_=>{u=_,h=performance.now(),a=g.value,T&&(T=!1,m=_e(ye))},ye=()=>{const B=(performance.now()-h)/y.get(n),st=i(B);c==null&&(c=xe(a));let Te=c(a,u,st);B>=1?(T=!0,Te=u):m=_e(ye),g.set(Te)};return p.on(P),g},ut=(s,e)=>{const{initialValue:t,...r}=e??{};return De(t??s.get(),s.get,[s],r)},Le=(s,e)=>{const t=Object.values(s).filter(f.is),r=Object.keys(s);return Q(()=>{const n={};for(const i of r)n[i]=y.get(s[i]);return e(n)},t)},ht=s=>Le(s,e=>e),dt=(s,e)=>{const t=A(s.get());let r=null;const n=s.on(i=>{r!=null&&clearTimeout(r),r=setTimeout(()=>{r=null,t.set(i)},typeof e=="function"?e(i):e)});return t.onDispose(()=>{n(),r!=null&&clearTimeout(r)}),t},ft=s=>(...e)=>Z(s,...e)((t,...r)=>t(...r));function pt(...s){return Z(...s)((...e)=>{for(const t of e)if(t!=null)return t})}const Me=new Set(["checked","disabled","hidden"]),He=new Set(["selected"]),Ne=new Set(["rowSpan","colSpan","tabIndex","valueAsNumber"]),ke=new Set(["valueAsDate"]),Ie=new Set(["value","textContent","innerText","innerHTML","outerHTML","className","classList"]),$e=(s,e)=>He.has(s)?t=>{t==null||t!==!0?e.removeAttribute(s):e.setAttribute(s,"")}:Me.has(s)?t=>{t==null?e[s]=null:e[s]=!!t}:Ne.has(s)?t=>{t==null?e[s]=null:e[s]=Number(t)}:ke.has(s)?t=>{t==null?e[s]=null:e[s]=t}:Ie.has(s)?t=>{t==null?e[s]=null:e[s]=String(t)}:t=>{t==null?e.removeAttribute(s):e.setAttribute(s,t)},Re=(s,e)=>He.has(s)?()=>e.hasAttribute(s):Me.has(s)?()=>!!e[s]:Ne.has(s)?()=>Number(e[s]):ke.has(s)?()=>e[s]:Ie.has(s)?()=>String(e[s]):()=>e.getAttribute(s),k=s=>{const e=s;e&&e.onblur&&(e.onblur=null),!(!s||s.ownerDocument===void 0)&&s.parentElement&&s.parentElement.removeChild(s)},Ve=s=>ie(s)?s:s.parentElement,ie=s=>s.nodeType===1;class oe extends Error{constructor(e){super(`Provider not found: ${e.description}`)}}class x{constructor(e,t,r,n){o(this,"createElement",(e,t)=>t!==void 0?this.document.createElementNS(t,e):this.document.createElement(e));o(this,"makeChildElement",(e,t)=>{const r=this.createElement(e,t);return this.appendOrInsert(r),this.withElement(r)});o(this,"createText",e=>this.document.createTextNode(e));o(this,"makeChildText",e=>{const t=this.createText(e);return this.appendOrInsert(t),this.withReference(t)});o(this,"setText",e=>{this.reference.nodeValue=e});o(this,"getText",()=>{var e;return((e=this.reference)==null?void 0:e.nodeValue)??this.element.textContent??""});o(this,"makeRef",()=>{const e=this.createText("");return this.appendOrInsert(e),this.withReference(e)});o(this,"appendOrInsert",e=>{this.reference===void 0?this.element.appendChild(e):this.element.insertBefore(e,this.reference)});o(this,"withElement",e=>new x(this.document,e,void 0,this.providers));o(this,"makePortal",e=>{const t=typeof e=="string"?this.document.querySelector(e):e;if(t==null)throw new Error(`Cannot find element by selector for portal: ${e}`);return this.withElement(t)});o(this,"withReference",e=>new x(this.document,this.element,e,this.providers));o(this,"setProvider",(e,t,r)=>new x(this.document,this.element,this.reference,{...this.providers,[e]:[t,r]}));o(this,"getProvider",e=>{if(this.providers[e]===void 0)throw new oe(e);const[t,r]=this.providers[e];return{value:t,onUse:r}});o(this,"clear",e=>{e&&(this.reference!==void 0?k(this.reference):k(this.element))});o(this,"addClasses",e=>{this.element.classList.add(...e)});o(this,"removeClasses",e=>{this.element.classList.remove(...e)});o(this,"getClasses",()=>Array.from(this.element.classList));o(this,"on",(e,t,r)=>{const n=i=>t(i,this);return this.element.addEventListener(e,n,r),i=>{i&&this.element.removeEventListener(e,n,r)}});o(this,"isBrowserDOM",()=>!0);o(this,"isBrowser",()=>!0);o(this,"isHeadlessDOM",()=>!1);o(this,"isHeadless",()=>!1);o(this,"setStyle",(e,t)=>{this.element.style[e]=t});o(this,"getStyle",e=>this.element.style[e]);o(this,"makeAccessors",e=>({get:Re(e,this.element),set:$e(e,this.element)}));o(this,"getWindow",()=>this.document.defaultView);this.document=e,this.element=t,this.reference=r,this.providers=n}static of(e,t,r){return new x(e.ownerDocument,e,t,r)}}const je=s=>Symbol(s),K=(s,e)=>{const t=s(e);return(r=!0)=>t(r)},mt=(s,e,{doc:t,clear:r,disposeWithParent:n=!0,providers:i={}}={})=>{const l=typeof e=="string"?(t??document).querySelector(e):e;if(l===null)throw new qe(`Cannot find element by selector for render: ${e}`);r!==!1&&(t??l.ownerDocument)!=null&&l.nodeType===1&&(l.innerHTML="");const c=Ve(l),a=ie(l)?void 0:l,u=x.of(c,a,i),h=K(s,u);let m;return n&&(m=new MutationObserver(T=>{var p;(p=T[0])==null||p.removedNodes.forEach(g=>{g===l&&(m==null||m.disconnect(),h(l.nodeType!==1))})}),m.observe(l.parentElement,{childList:!0,subtree:!1,attributes:!1})),()=>{m==null||m.disconnect(),h(!0)}},gt=(s,{startUrl:e="https://example.com",selector:t,providers:r={}}={selector:"body"})=>{const n=y.toSignal(e).deriveProp(),i=new ce(t,void 0),l=new O(i,void 0,{currentURL:n},r);return{clear:K(s(),l),root:i,currentURL:n}};class qe extends Error{constructor(e){super(e)}}const le="data-tts-node",I="data-tts-class",G="data-tts-style",J="data-tts-html",X="data-tts-text",Y="data-tts-attrs";class yt{constructor({select:e,getAttribute:t,setAttribute:r,getClass:n,setClass:i,getStyles:l,setStyles:c,appendHTML:a,getInnerHTML:u,setInnerHTML:h,getInnerText:m,setInnerText:T}){o(this,"select");o(this,"getAttribute");o(this,"setAttribute");o(this,"getClass");o(this,"setClass");o(this,"getStyles");o(this,"setStyles");o(this,"appendHTML");o(this,"getInnerHTML");o(this,"setInnerHTML");o(this,"getInnerText");o(this,"setInnerText");o(this,"setFromRoot",(e,t)=>{e.getPortals().forEach(n=>{const i=typeof n.selector=="string"?this.select(n.selector):[n.selector];for(const l of i){if(l==null)throw new Error(`Cannot find element by selector for render: ${n.selector}`);if(n.hasChildren()&&this.appendHTML(l,n.contentToHTML(t)),n.hasInnerHTML()){if(t){const c=this.getInnerHTML(l);c!=null&&this.setAttribute(l,J,c)}this.setInnerHTML(l,n.getInnerHTML())}if(n.hasInnerText()){if(t){const c=this.getInnerText(l);c!=null&&this.setAttribute(l,X,c)}this.setInnerText(l,n.getInnerText())}if(n.hasClasses()){if(t){const c=this.getClass(l);c!=null&&this.setAttribute(l,I,c)}this.setClass(l,n.getClasses().join(" "))}if(n.hasStyles()){if(t){const c=this.getStyles(l);Object.keys(c).length>0&&this.setAttribute(l,G,JSON.stringify(c))}this.setStyles(l,n.getStyles())}if(n.hasAttributes()){const c=n.getAttributes();if(t){const a=[];c.forEach(([u])=>{const h=this.getAttribute(l,u);h!=null&&a.push([u,h])}),a.length>0&&this.setAttribute(l,Y,JSON.stringify(Object.fromEntries(a)))}c.forEach(([a,u])=>{this.setAttribute(l,a,u)})}}})});this.select=e,this.getAttribute=t,this.setAttribute=r,this.getClass=n,this.setClass=i,this.getStyles=l,this.setStyles=c,this.appendHTML=a,this.getInnerHTML=u,this.setInnerHTML=h,this.getInnerText=m,this.setInnerText=T}}const Tt=()=>{document.querySelectorAll(`[${le}]`).forEach(k)},St=s=>{const e=s.getAttribute(I);s.removeAttribute(I),e!=null&&s.setAttribute("class",e)},bt=()=>{document.querySelectorAll(`[${I}]`).forEach(e=>St(e))},At=s=>{const e=s.getAttribute(J);s.removeAttribute(J),e!=null&&(s.innerHTML=e)},Et=()=>{document.querySelectorAll(`[${J}]`).forEach(e=>At(e))},_t=s=>{const e=s.getAttribute(X);s.removeAttribute(X),e!=null&&(s.innerText=e)},vt=()=>{document.querySelectorAll(`[${X}]`).forEach(e=>_t(e))},Be=s=>JSON.parse(s.replace(/"/g,'"')),Ct=s=>{const e=s.getAttribute(G);if(s.removeAttribute(G),e!=null){const t=Be(e);Object.entries(t).forEach(([r,n])=>{s.style.setProperty(r,n)})}},Pt=()=>{document.querySelectorAll(`[${G}]`).forEach(e=>Ct(e))},wt=s=>{const e=s.getAttribute(Y);if(s.removeAttribute(Y),e!=null){const t=Be(e);Object.entries(t).forEach(([r,n])=>{n==null?s.removeAttribute(r):s.setAttribute(r,n)})}},xt=()=>{document.querySelectorAll(`[${Y}]`).forEach(e=>wt(e))},Ot=()=>{Tt(),bt(),vt(),Et(),Pt(),xt()},b=Symbol("class"),v=Symbol("style"),L=Symbol("handler"),Fe=()=>Math.random().toString(36).substring(2,15),Dt=s=>s.replace(/<[^>]*>?/g,"");class We{constructor(e){o(this,"id",Fe());o(this,"properties",{});o(this,"children",[]);o(this,"isElement",()=>!0);o(this,"isText",()=>!1);o(this,"getText",()=>this.properties.innerText!=null?this.properties.innerText:this.properties.innerHTML!=null?Dt(this.properties.innerHTML):this.children.map(e=>e.getText()).join(""));o(this,"removeChild",e=>{const t=this.children.indexOf(e);t!==-1&&this.children.splice(t,1)});o(this,"remove",()=>{if(this.parent!=null)this.parent.removeChild(this);else throw new Error("Parent is undefined")});o(this,"getPortals",()=>{const e=this.elements().flatMap(t=>t.isPortal()?[t,...t.getPortals()]:t.getPortals());return this.isPortal()&&e.unshift(this),e});o(this,"elements",()=>this.children.filter(e=>e.isElement()));o(this,"hasInnerHTML",()=>this.properties.innerHTML!=null);o(this,"getInnerHTML",()=>this.properties.innerHTML??"");o(this,"getInnerText",()=>this.properties.innerText??"");o(this,"hasInnerText",()=>this.properties.innerText!=null);o(this,"hasChildren",()=>this.children.length>0);o(this,"hasClasses",()=>this.properties[b]!=null);o(this,"hasStyles",()=>this.properties[v]!=null);o(this,"hasAttributes",()=>Object.keys(this.properties).length>0);o(this,"hasHandlers",()=>this.properties[L]!=null);o(this,"hasRenderableProperties",()=>this.hasClasses()||this.hasAttributes()||this.hasStyles());o(this,"getById",e=>{if(this.properties.id===e)return this;for(const t of this.elements()){const r=t.getById(e);if(r!=null)return r}});o(this,"trigger",(e,t)=>{((this.properties[L]??{})[e]??[]).forEach(n=>n(t))});o(this,"click",()=>{this.trigger("click",{})});o(this,"on",(e,t,r,n)=>{var a;const i=(a=this.properties)[L]??(a[L]={}),l=n!=null&&n.once?u=>{c(),t(u,r)}:u=>t(u,r);i[e]=[...i[e]??[],l];const c=()=>{const u=i[e]??[],h=u.indexOf(l);h!==-1&&(u.splice(h,1),u.length===0?(delete i[e],Object.keys(i).length===0&&delete this.properties[L]):i[e]=u,(n==null?void 0:n.signal)!=null&&n.signal.removeEventListener("abort",c))};return(n==null?void 0:n.signal)!=null&&n.signal.addEventListener("abort",c),c});o(this,"addClasses",e=>{var r;if(e.length===0)return;const t=(r=this.properties)[b]??(r[b]=[]);e.forEach(n=>{t.includes(n)||t.push(n)})});o(this,"removeClasses",e=>{var r;if(e.length===0)return;const t=(r=this.properties)[b]??(r[b]=[]);e.forEach(n=>{const i=t.indexOf(n);i!==-1&&t.splice(i,1)}),t.length===0&&delete this.properties[b]});o(this,"getClasses",()=>this.properties[b]??[]);o(this,"getAttributes",()=>Object.entries(this.properties).filter(([e])=>!["innerText","innerHTML"].includes(e)));o(this,"getVisibleAttributes",()=>Reflect.ownKeys(this.properties).flatMap(e=>e===b?[["class",this.getClasses()]]:e===v?[["style",this.getStyles()]]:typeof e=="string"?[[e,String(this.properties[e])]]:[]));o(this,"setStyle",(e,t)=>{var n;const r=(n=this.properties)[v]??(n[v]={});r[e]=t,t===""&&(delete r[e],Object.keys(r).length===0&&delete this.properties[v])});o(this,"getStyle",e=>{var t;return((t=this.properties[v])==null?void 0:t[e])??""});o(this,"getStyles",()=>this.properties[v]??{});o(this,"makeAccessors",e=>{const t=this.properties;return{get:()=>t[e],set:r=>t[e]=r}});this.parent=e}}const Lt=s=>s.replace(/"/g,"""),Mt=s=>s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");class Ue extends We{constructor(t,r,n){super(n);o(this,"isPortal",()=>!1);o(this,"toHTML",(t=!1)=>{const r=this.children.map(a=>a.toHTML()).join(""),n=this.namespace?` xmlns="${this.namespace}"`:"";let i=null;const l=this.getVisibleAttributes().map(([a,u])=>a==="class"?` class="${u.join(" ")}"`:a==="style"?typeof u=="string"?` style="${u}"`:` style="${Object.entries(u).map(([h,m])=>`${h}: ${m};`).join(" ")}"`:Ht.has(a)?` ${a}`:a==="innerHTML"?(i=u,""):a==="innerText"?(i=Mt(u),""):` ${a}="${Lt(u)}"`).join(""),c=t?` ${le}`:"";return Nt.has(this.tagName)&&r===""?`<${this.tagName}${n}${l}${c} />`:`<${this.tagName}${n}${l}${c}>${i??r}</${this.tagName}>`});this.tagName=t,this.namespace=r}}class ce extends We{constructor(t,r){super(r);o(this,"isPortal",()=>!0);o(this,"toHTML",()=>"");o(this,"contentToHTML",(t=!1)=>this.children.map(r=>r.toHTML(t)).join(""));this.selector=t}}class Ge{constructor(e){o(this,"id",Fe());o(this,"isElement",()=>!1);o(this,"isText",()=>!0);o(this,"getText",()=>this.text);o(this,"toHTML",()=>this.text);this.text=e}}class O{constructor(e,t,r,n){o(this,"appendOrInsert",e=>{if(this.reference!=null){const t=this.element.children.indexOf(this.reference);this.element.children.splice(t,0,e)}else this.element.children.push(e)});o(this,"makeChildElement",(e,t)=>{const r=new Ue(e,t,this.element);return this.appendOrInsert(r),new O(r,void 0,this.container,this.providers)});o(this,"makeChildText",e=>{const t=new Ge(e);return this.appendOrInsert(t),new O(this.element,t,this.container,this.providers)});o(this,"setText",e=>{this.reference&&this.reference.isText()&&(this.reference.text=e)});o(this,"getText",()=>{var e;return((e=this.reference)==null?void 0:e.getText())??this.element.getText()});o(this,"makeRef",()=>this.makeChildText(""));o(this,"makePortal",e=>{const t=new ce(e,this.element);return this.appendOrInsert(t),new O(t,void 0,this.container,this.providers)});o(this,"setProvider",(e,t,r)=>new O(this.element,this.reference,this.container,{...this.providers,[e]:[t,r]}));o(this,"getProvider",e=>{if(this.providers[e]===void 0)throw new oe(e);const[t,r]=this.providers[e];return{value:t,onUse:r}});o(this,"clear",e=>{e&&(this.reference!==void 0?this.element.removeChild(this.reference):this.element.remove())});o(this,"on",(e,t)=>this.element.on(e,t,this));o(this,"addClasses",e=>this.element.addClasses(e));o(this,"removeClasses",e=>this.element.removeClasses(e));o(this,"getClasses",()=>this.element.getClasses());o(this,"isBrowserDOM",()=>!1);o(this,"isBrowser",()=>!1);o(this,"isHeadlessDOM",()=>!0);o(this,"isHeadless",()=>!0);o(this,"setStyle",(e,t)=>this.element.setStyle(e,t));o(this,"getStyle",e=>this.element.getStyle(e));o(this,"makeAccessors",e=>this.element.makeAccessors(e));this.element=e,this.reference=t,this.container=r,this.providers=n}}const Ht=new Set(["checked","disabled","multiple","readonly","required","selected"]),Nt=new Set(["img","br","hr","input","link","meta"]),ae=s=>e=>e.makeChildText(s).clear,ue=s=>e=>{const t=e.makeChildText(s.value),r=s.on(t.setText);return n=>{r(),t.clear(n)}},kt=s=>f.is(s)?ue(s):ae(s),S=(...s)=>e=>{const t=s.map(r=>d(r)(e));return r=>{t.forEach(n=>n(r))}},E=()=>()=>{},It=s=>e=>(e.addClasses(s),t=>{t&&e.removeClasses(s)}),$t=s=>e=>{let t=[];const r=s.on(n=>{e.removeClasses(t),t=(n??"").split(" ").filter(i=>i.length>0),e.addClasses(t)});return n=>{r(),n&&e.removeClasses(t),t.length=0}},R=(s,e)=>t=>{const{get:r,set:n}=t.makeAccessors(s),i=r();return n(e),l=>{l&&n(i)}},V=(s,e)=>t=>{const{get:r,set:n}=t.makeAccessors(s),i=r(),l=e.on(n);return c=>{l(),c&&n(i)}},D=new Proxy({},{get:(s,e)=>e==="class"?t=>f.is(t)?$t(t):It((t??"").split(" ").filter(r=>r.length>0)):t=>f.is(t)?V(e,t):R(e,t)}),Rt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(`data-${e}`,t):R(`data-${e}`,t)}),Vt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(`aria-${e}`,t):R(`aria-${e}`,t)}),jt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(e,t):R(e,t)}),qt=new Proxy({},{get:(s,e)=>t=>f.is(t)?V(e,t):R(e,t)}),d=s=>{if(s==null)return E;if(Array.isArray(s))return S(...s.map(d));if(typeof s=="string")return ae(s);if(f.is(s))return ue(s);if(typeof s=="function")return s;throw new Error(`Unknown type: '${typeof s}' for child: ${s}`)},he=(s,...e)=>t=>{const r=t.makeChildElement(s,void 0),n=e.map(i=>d(i)(r));return i=>{n.forEach(l=>l(!1)),r.clear(i)}},de=(s,e,...t)=>r=>{const n=r.makeChildElement(s,e),i=t.map(l=>d(l)(n));return l=>{i.forEach(c=>c(!1)),n.clear(l)}},Bt=new Proxy({},{get:(s,e)=>(...t)=>he(e,t.flatMap(d))}),Ft=new Proxy({},{get:(s,e)=>(...t)=>he("input",D.type(e),...t)}),Wt="http://www.w3.org/2000/svg",Ut=new Proxy({},{get:(s,e)=>(...t)=>de(e,Wt,t.flatMap(d))}),Gt="http://www.w3.org/1998/Math/MathML",Jt=new Proxy({},{get:(s,e)=>(...t)=>de(e,Gt,t.flatMap(d))}),fe=(s,e)=>{if(typeof e=="function")return fe(s,{then:e});const t=e.pending!=null?d(e.pending()):E,r=e.then,n=e.error!=null?i=>d(e.error(i)):()=>E;return i=>{let l=!0;const c=s(),a=i.makeRef();let u=d(t)(a);return c.then(h=>{l&&(u(!0),u=d(r(h))(a))},h=>{l&&(u(!0),u=d(n(h))(a))}),h=>{l=!1,u(h),a.clear(h)}}},Xt=(s,e)=>fe(()=>s,e),Je=(s,e,t)=>r=>r.on(s,e,t),Xe=s=>Je("click",(e,t)=>{e.preventDefault();const r=e.target;setTimeout(()=>{const n=r.ownerDocument!=null?r==null?void 0:r.checked:void 0;n!=null&&s(!n,t)},0)}),j=new Proxy({},{get:(s,e)=>t=>Je(e,t)}),Ye=s=>e=>{const t=e.target;s(t.value)},ze=s=>e=>{const t=e.target;s(t.valueAsNumber)},Qe=s=>e=>{const t=e.target;if(t.value==="")return;const r=t.value.split("-"),n=new Date(Number(r[0]),Number(r[1])-1,Number(r[2].substring(0,2)));s(n)},Yt=s=>e=>{const t=e.target;if(t.value===""){s(null);return}const r=t.value.split("-"),n=new Date(Number(r[0]),Number(r[1])-1,Number(r[2].substring(0,2)));s(n)},Ze=s=>e=>{const t=e.target;if(t.value==="")return;const r=t.value.split("T"),n=r[0].split("-"),i=new Date(Number(n[0]),Number(n[1])-1,Number(n[2])),l=r[1].split(":");i.setHours(Number(l[0])),i.setMinutes(Number(l[1])),i.setSeconds(Number(l[2])),s(i)},zt=s=>e=>{const t=e.target;if(t.value===""){s(null);return}const r=t.value.split("T");if(r.length!==2){s(null);return}const n=r[0].split("-"),i=new Date(Number(n[0]),Number(n[1])-1,Number(n[2])),l=r[1].split(":");i.setHours(Number(l[0]??0)),i.setMinutes(Number(l[1]??0)),i.setSeconds(Number(l[2]??0)),s(i)},Qt=s=>e=>{const t=e.target;s(t.checked)},Zt=s=>e=>{e.preventDefault(),s()},Kt=s=>e=>{e.stopPropagation(),s()},es=s=>e=>{e.stopImmediatePropagation(),s()},ts=(s,e="input")=>S(D.valueAsDate(s),j[e](Qe(s.set))),ss=(s,e="input")=>S(D.valueAsDate(s),j[e](Ze(s.set))),rs=(s,e="input")=>S(D.valueAsNumber(s),j[e](ze(s.set))),ns=(s,e="input")=>S(D.value(s),j[e](Ye(s.set))),is=s=>S(D.checked(s),Xe(s.set)),q=(s,e)=>{if(f.is(s))return r=>{const n=r.makeRef();let i,l;const c=s.map(h=>Object.keys(h)[0]);let a;const u=c.on(h=>{if(h!==a){a=h,l==null||l.dispose(),i==null||i(!0),l=s.map(T=>T[h]);const m=e[h](l);i=d(m)(n)}});return h=>{l==null||l.dispose(),u(),n.clear(h),i==null||i(h)}};const t=Object.keys(s)[0];return d(e[t]($(s[t])))},pe=(s,e,t)=>q(y.map(s,r=>({[r[e]]:r})),t),os=(s,e)=>pe(s,"kind",e),ls=(s,e)=>{const t=y.map(s,([r,n])=>({[r]:n}));return q(t,e)},cs=(s,e)=>pe(s,"type",e),Ke=(s,e)=>q(y.map(s,t=>({[t]:!0})),e),as=(s,e={})=>t=>{const r=(e==null?void 0:e.firstSeparator)??s,n=(e==null?void 0:e.lastSeparator)??s;return Ke(t.map(i=>i.isFirst?"first":i.isLast?"last":"other"),{first:r,last:n,other:s})},us=s=>e=>(e.appendOrInsert(s),t=>{t&&k(s)}),hs=(s,e,t)=>{if(f.is(s)){const r=s;return n=>{const i=n.makeRef();let l=()=>{},c=!1,a=null;const u=r.on(h=>{h==null?(l(!0),l=d(t==null?void 0:t())(i),c=!1,a==null||a.dispose(),a=null):c?a.set(h):(a=A(h),l(!0),l=d(e(a))(i),c=!0)});return h=>{a==null||a.dispose(),u(),l==null||l(h),i.clear(h)}}}else{const r=s;if(r==null){const n=t==null?void 0:t();return n!=null?d(n):E}return d(e($(r)))}},ds=(...s)=>(e,t)=>r=>{const n=r.makeRef();if(s.some(p=>!f.is(p)&&p==null))return(t!=null?d(t==null?void 0:t()):E)(n);const l=s.map(()=>null),c=s.map(p=>f.is(p)?p.value!=null:p!=null);let a=null;const u=A(c.every(p=>p)),h=(p,g)=>{if(p.value!=null){if(l[g]==null){const P=A(p.value);l[g]=P}else l[g].value=p.value;c[g]=!0}else c[g]=!1};let m=s.length-1;const T=s.map((p,g)=>{if(!f.is(p)){const P=A(p);return l[g]=P,()=>{}}return p.on(()=>{h(p,g),m===0?u.value=c.every(P=>P):m--})});return u.on(p=>{a==null||a(!0),a=null,p?a=d(e(...l))(n):a=d((t==null?void 0:t())??E)(n)}),p=>{l.forEach(g=>g==null?void 0:g.dispose()),u.dispose(),T.forEach(g=>g()),a==null||a(p),n.clear(p)}},M=(...s)=>e=>t=>s.forEach(r=>r(t,e)),me=(s,e,t)=>{if(f.is(s)){const r=s;return n=>{const i=n.makeRef();let l=()=>{};const c=r.on(a=>{l(!0),a?l=d(e())(i):l=d(t==null?void 0:t())(i)});return a=>{l(a),c(),i.clear(a)}}}else{if(s){const n=e();return n!=null?d(n):E}return d(t==null?void 0:t())}},fs=(s,e,t)=>me(y.map(s,r=>!r),e,t),ge=(s,e,t)=>{if(t!=null)return ge(s,r=>{const n=new U(r.index,r.total.map(i=>i-1));return S(M(n.dispose),d(e(r)),me(r.isLast,()=>E,()=>t(n)))});if(f.is(s))return r=>{const n=s.derive(),i=r.makeRef(),l=[];return n.on(c=>{const a=l.splice(c);for(const u of a)u(!0);for(let u=l.length;u<c;u++){const h=new U(u,n);l.push(S(M(h.dispose),d(e(h)))(i))}}),c=>{n.dispose();for(const a of l)a(c);l.length=0,i.clear(c)}};{const r=$(s);return S(...Array.from({length:s},(n,i)=>i).map(n=>{const i=new U(n,r);return S(M(i.dispose),d(e(i)))}))}},ps=(s,e,t)=>{const r=y.map(s,i=>i.length),n=y.toSignal(s);return ge(r,i=>{const l=n.map(c=>c[i.index]);return S(M(l.dispose),d(e(l,i)))},t)},ms=(s,e)=>{if(f.is(s)){const t=s;return r=>{r=r.makeRef();const n=t.map(c=>d(e(c)));let i=()=>{};const l=n.on(c=>{i(!0),i=c(r)});return c=>{l(),i(c)}}}return d(e(s))},gs=(s,e,t=()=>E)=>q(y.map(s,r=>r.length>0?{notEmpty:r}:{whenEmpty:null}),{notEmpty:r=>e(r),whenEmpty:()=>t()}),ys=(s,e)=>t=>{const r=t.makePortal(s),n=K(d(e),r);return()=>n(!0)},W=new Map,et=s=>({mark:je(`Probe(${s.description})`),create:({callback:e=()=>{},timeout:t=10}={})=>{const r=c=>{clearTimeout(n),W.delete(s),e(c)};if(W.has(s))throw new Error(`Probe already exists: ${s.description}`);const n=setTimeout(()=>r("timeout"),t),i={counter:0,timeoutId:n};return W.set(s,i),{value:()=>{clearTimeout(n);const c=W.get(s);c!=null&&--c.counter===0&&r("resolved")},dispose:()=>r("disposed"),onUse:()=>i.counter++}}}),Ts=et(Symbol("GlobalProbe")),Ss=(s,e)=>t=>{const r=t.getStyle(s);return t.setStyle(s,e),n=>{n&&t.setStyle(s,r)}},bs=(s,e)=>t=>{const r=t.getStyle(s),n=e.on(i=>t.setStyle(s,i));return i=>{n(),i&&t.setStyle(s,r)}},As=new Proxy({},{get:(s,e)=>t=>f.is(t)?bs(e,t):Ss(e,t)}),tt=s=>e=>{if(e.isBrowser()){const t=s(e);if(t!=null)return d(t)(e)}return()=>{}},Es=s=>e=>{const t=s(e);return t==null?()=>{}:d(t)(e)},_s=s=>tt(e=>s(e.element)),vs=s=>e=>{if(e.isHeadlessDOM()){const t=s(e);if(t)return d(t)(e)}return()=>{}},ee=s=>e=>{let t=e;function r(){return t}function n(c){t=c}const i=[],l=s({use:({mark:c})=>{const{value:a,onUse:u}=r().getProvider(c);return u==null||u(),a},set:({mark:c,create:a},u)=>{const{value:h,dispose:m,onUse:T}=a(u,r());i.push(m),n(r().setProvider(c,h,T))}});return l==null?()=>{}:S(d(l),M(()=>i.forEach(c=>c())))(r())},Cs=(s,e,t)=>ee(({set:r})=>(r(s,e),t())),Ps=(s,e)=>ee(({use:t})=>e(t(s))),ws=(...s)=>e=>ee(({use:t})=>{const r=s.map(t);return e(...r)});exports.Async=Xt;exports.BindChecked=is;exports.BindDate=ts;exports.BindDateTime=ss;exports.BindNumber=rs;exports.BindText=ns;exports.BrowserContext=x;exports.CLASS_PLACEHOLDER_ATTR=I;exports.Computed=w;exports.Conjunction=as;exports.DOMNode=us;exports.El=he;exports.ElNS=de;exports.ElementPosition=U;exports.Empty=E;exports.Ensure=hs;exports.EnsureAll=ds;exports.ForEach=ps;exports.Fragment=S;exports.GlobalProbe=Ts;exports.HeadlessAdapter=yt;exports.HeadlessContext=O;exports.HeadlessElement=Ue;exports.HeadlessPortal=ce;exports.HeadlessText=Ge;exports.MapSignal=ms;exports.MemoryStore=re;exports.NotEmpty=gs;exports.OnChecked=Xe;exports.OnDispose=M;exports.OneOf=q;exports.OneOfField=pe;exports.OneOfKind=os;exports.OneOfTuple=ls;exports.OneOfType=cs;exports.OneOfValue=Ke;exports.Portal=ys;exports.Prop=N;exports.Provide=Cs;exports.ProviderNotFoundError=oe;exports.RenderingError=qe;exports.Repeat=ge;exports.Signal=f;exports.Task=fe;exports.TextNode=kt;exports.Unless=fs;exports.Use=Ps;exports.UseMany=ws;exports.Value=y;exports.When=me;exports.WithBrowserCtx=tt;exports.WithCtx=Es;exports.WithElement=_s;exports.WithHeadlessCtx=vs;exports.WithProvider=ee;exports._NODE_PLACEHOLDER_ATTR=le;exports._getSelfOrParentElement=Ve;exports._isElement=ie;exports._makeGetter=Re;exports._makeSetter=$e;exports._removeDOMNode=k;exports._signalText=ue;exports._staticText=ae;exports.animateSignal=ut;exports.animateSignals=De;exports.aria=Vt;exports.attr=D;exports.bind=ft;exports.coalesce=pt;exports.computed=Q;exports.computedOf=Z;exports.computedRecord=Le;exports.dataAttr=Rt;exports.delaySignal=dt;exports.effect=Oe;exports.effectOf=lt;exports.emitChecked=Qt;exports.emitPreventDefault=Zt;exports.emitStopImmediatePropagation=es;exports.emitStopPropagation=Kt;exports.emitValue=Ye;exports.emitValueAsDate=Qe;exports.emitValueAsDateTime=Ze;exports.emitValueAsNullableDate=Yt;exports.emitValueAsNullableDateTime=zt;exports.emitValueAsNumber=ze;exports.endInterpolate=we;exports.getWindow=se;exports.guessInterpolate=xe;exports.html=Bt;exports.input=Ft;exports.interpolateDate=Pe;exports.interpolateNumber=ve;exports.interpolateString=Ce;exports.joinSignals=ot;exports.localStorageProp=ct;exports.makeProbe=et;exports.makeProviderMark=je;exports.math=Jt;exports.mathAttr=qt;exports.merge=ht;exports.on=j;exports.prop=A;exports.render=mt;exports.renderWithContext=K;exports.renderableOfTNode=d;exports.restoreTempoPlaceholders=Ot;exports.runHeadless=gt;exports.sessionStorageProp=at;exports.signal=$;exports.storedProp=ne;exports.style=As;exports.svg=Ut;exports.svgAttr=jt;
|
package/index.js
CHANGED
|
@@ -298,17 +298,17 @@ const H = class H {
|
|
|
298
298
|
* @returns A property that holds the mapped value and can be observed for changes.
|
|
299
299
|
*/
|
|
300
300
|
o(this, "mapAsync", (e, t, r, n = (i, l) => i === l) => {
|
|
301
|
-
const i =
|
|
301
|
+
const i = v(t, n);
|
|
302
302
|
let l = 0, c = new AbortController();
|
|
303
303
|
return i.onDispose(
|
|
304
|
-
this.on(async (
|
|
305
|
-
const
|
|
304
|
+
this.on(async (u) => {
|
|
305
|
+
const a = ++l;
|
|
306
306
|
c.abort(), c = new AbortController();
|
|
307
307
|
try {
|
|
308
|
-
const h = await e(
|
|
309
|
-
|
|
308
|
+
const h = await e(u, { abortSignal: c.signal });
|
|
309
|
+
a === l && i.set(h);
|
|
310
310
|
} catch (h) {
|
|
311
|
-
if (
|
|
311
|
+
if (a === l)
|
|
312
312
|
if (r != null)
|
|
313
313
|
i.set(r(h));
|
|
314
314
|
else
|
|
@@ -348,7 +348,7 @@ const H = class H {
|
|
|
348
348
|
o(this, "deriveProp", ({
|
|
349
349
|
autoDisposeProp: e = !0,
|
|
350
350
|
equals: t
|
|
351
|
-
} = {}) => this.feedProp(
|
|
351
|
+
} = {}) => this.feedProp(v(this.get(), t), e));
|
|
352
352
|
/**
|
|
353
353
|
* Derives a new signal from the current signal. Useful to create a new signal that emits the same values as the current signal but can be disposed independently.
|
|
354
354
|
* @returns A new signal that emits the same values as the current signal.
|
|
@@ -545,8 +545,8 @@ const J = class J extends d {
|
|
|
545
545
|
const n = this;
|
|
546
546
|
return function i(l) {
|
|
547
547
|
const c = n.value;
|
|
548
|
-
n.update((
|
|
549
|
-
(
|
|
548
|
+
n.update((u) => t(u, l)), !n.equals(c, n.value) && r.forEach(
|
|
549
|
+
(u) => u({
|
|
550
550
|
previousState: c,
|
|
551
551
|
state: n.value,
|
|
552
552
|
action: l,
|
|
@@ -619,7 +619,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
619
619
|
n.dispose(), t.abortSignal != null && t.abortSignal.removeEventListener("abort", i);
|
|
620
620
|
};
|
|
621
621
|
return t.abortSignal != null && t.abortSignal.addEventListener("abort", i), i;
|
|
622
|
-
},
|
|
622
|
+
}, v = (s, e = (t, r) => t === r) => new j(s, e), G = (s, e = (t, r) => t === r) => new d(s, e), ce = () => (
|
|
623
623
|
/* c8 ignore next */
|
|
624
624
|
typeof window < "u" ? window : void 0
|
|
625
625
|
), y = {
|
|
@@ -692,7 +692,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
692
692
|
deriveProp: (s, {
|
|
693
693
|
autoDisposeProp: e = !0,
|
|
694
694
|
equals: t
|
|
695
|
-
} = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) :
|
|
695
|
+
} = {}) => d.is(s) ? s.deriveProp({ autoDisposeProp: e, equals: t }) : v(s, t)
|
|
696
696
|
}, K = (...s) => (e, t) => {
|
|
697
697
|
if (s.length === 1)
|
|
698
698
|
return y.toSignal(s[0]).map(e);
|
|
@@ -715,7 +715,7 @@ const Z = (s, e, t = (r, n) => r === n) => {
|
|
|
715
715
|
t
|
|
716
716
|
);
|
|
717
717
|
};
|
|
718
|
-
class
|
|
718
|
+
class ue {
|
|
719
719
|
constructor() {
|
|
720
720
|
o(this, "_store", /* @__PURE__ */ new Map());
|
|
721
721
|
/**
|
|
@@ -734,33 +734,33 @@ class ae {
|
|
|
734
734
|
});
|
|
735
735
|
}
|
|
736
736
|
}
|
|
737
|
-
const
|
|
737
|
+
const ae = ({
|
|
738
738
|
key: s,
|
|
739
739
|
defaultValue: e,
|
|
740
740
|
store: t,
|
|
741
741
|
serialize: r = JSON.stringify,
|
|
742
742
|
deserialize: n = JSON.parse,
|
|
743
|
-
equals: i = (c,
|
|
743
|
+
equals: i = (c, u) => c === u,
|
|
744
744
|
onLoad: l = (c) => c
|
|
745
745
|
}) => {
|
|
746
|
-
const c = t.getItem(s),
|
|
746
|
+
const c = t.getItem(s), u = new j(
|
|
747
747
|
c != null ? l(n(c)) : typeof e == "function" ? e() : e,
|
|
748
748
|
i
|
|
749
749
|
);
|
|
750
|
-
return
|
|
750
|
+
return u.on((a) => t.setItem(s, r(a))), u;
|
|
751
751
|
}, Dt = (s) => {
|
|
752
752
|
var e;
|
|
753
|
-
return
|
|
753
|
+
return ae({
|
|
754
754
|
...s,
|
|
755
755
|
/* c8 ignore next 3 */
|
|
756
|
-
store: ((e = ce()) == null ? void 0 : e.localStorage) ?? new
|
|
756
|
+
store: ((e = ce()) == null ? void 0 : e.localStorage) ?? new ue()
|
|
757
757
|
});
|
|
758
758
|
}, Ot = (s) => {
|
|
759
759
|
var e;
|
|
760
|
-
return
|
|
760
|
+
return ae({
|
|
761
761
|
...s,
|
|
762
762
|
/* c8 ignore next 3 */
|
|
763
|
-
store: ((e = ce()) == null ? void 0 : e.sessionStorage) ?? new
|
|
763
|
+
store: ((e = ce()) == null ? void 0 : e.sessionStorage) ?? new ue()
|
|
764
764
|
});
|
|
765
765
|
};
|
|
766
766
|
function le(s) {
|
|
@@ -768,20 +768,20 @@ function le(s) {
|
|
|
768
768
|
}
|
|
769
769
|
const Fe = (s, e, t, r) => {
|
|
770
770
|
const n = (r == null ? void 0 : r.duration) ?? 300, i = (r == null ? void 0 : r.easing) ?? ((A) => A), l = (r == null ? void 0 : r.equals) ?? ((A, $) => A === $);
|
|
771
|
-
let c = r == null ? void 0 : r.interpolate,
|
|
772
|
-
const p = new P(e, l), m =
|
|
771
|
+
let c = r == null ? void 0 : r.interpolate, u = s, a = e(), h = performance.now(), g = null, T = !0;
|
|
772
|
+
const p = new P(e, l), m = v(s, l);
|
|
773
773
|
m.onDispose(() => {
|
|
774
774
|
g !== null && cancelAnimationFrame(g);
|
|
775
775
|
}), m.onDispose(p.dispose), t.forEach((A) => {
|
|
776
776
|
A.setDerivative(p), A.onDispose(m.dispose);
|
|
777
777
|
});
|
|
778
778
|
const C = (A) => {
|
|
779
|
-
|
|
779
|
+
a = A, h = performance.now(), u = m.value, T && (T = !1, g = le(se));
|
|
780
780
|
}, se = () => {
|
|
781
781
|
const $ = (performance.now() - h) / y.get(n), Me = i($);
|
|
782
|
-
c == null && (c = je(
|
|
783
|
-
let re = c(
|
|
784
|
-
$ >= 1 ? (T = !0, re =
|
|
782
|
+
c == null && (c = je(u));
|
|
783
|
+
let re = c(u, a, Me);
|
|
784
|
+
$ >= 1 ? (T = !0, re = a) : g = le(se), m.set(re);
|
|
785
785
|
};
|
|
786
786
|
return p.on(C), m;
|
|
787
787
|
}, Mt = (s, e) => {
|
|
@@ -802,7 +802,7 @@ const Fe = (s, e, t, r) => {
|
|
|
802
802
|
return e(n);
|
|
803
803
|
}, t);
|
|
804
804
|
}, Ht = (s) => Be(s, (e) => e), kt = (s, e) => {
|
|
805
|
-
const t =
|
|
805
|
+
const t = v(s.get());
|
|
806
806
|
let r = null;
|
|
807
807
|
const n = s.on((i) => {
|
|
808
808
|
r != null && clearTimeout(r), r = setTimeout(
|
|
@@ -818,7 +818,13 @@ const Fe = (s, e, t, r) => {
|
|
|
818
818
|
}, Nt = (s) => (...e) => K(
|
|
819
819
|
s,
|
|
820
820
|
...e
|
|
821
|
-
)((t, ...r) => t(...r))
|
|
821
|
+
)((t, ...r) => t(...r));
|
|
822
|
+
function $t(...s) {
|
|
823
|
+
return K(...s)((...e) => {
|
|
824
|
+
for (const t of e) if (t != null) return t;
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
const he = /* @__PURE__ */ new Set(["checked", "disabled", "hidden"]), fe = /* @__PURE__ */ new Set(["selected"]), de = /* @__PURE__ */ new Set([
|
|
822
828
|
"rowSpan",
|
|
823
829
|
"colSpan",
|
|
824
830
|
"tabIndex",
|
|
@@ -1130,7 +1136,7 @@ const Ge = (s) => Symbol(s), ee = (s, e) => {
|
|
|
1130
1136
|
`Cannot find element by selector for render: ${e}`
|
|
1131
1137
|
);
|
|
1132
1138
|
r !== !1 && (t ?? l.ownerDocument) != null && l.nodeType === 1 && (l.innerHTML = "");
|
|
1133
|
-
const c = Je(l),
|
|
1139
|
+
const c = Je(l), u = me(l) ? void 0 : l, a = L.of(c, u, i), h = ee(s, a);
|
|
1134
1140
|
let g;
|
|
1135
1141
|
return n && (g = new MutationObserver((T) => {
|
|
1136
1142
|
var p;
|
|
@@ -1151,7 +1157,7 @@ const Ge = (s) => Symbol(s), ee = (s, e) => {
|
|
|
1151
1157
|
} = {
|
|
1152
1158
|
selector: "body"
|
|
1153
1159
|
}) => {
|
|
1154
|
-
const n = y.toSignal(e).deriveProp(), i = new
|
|
1160
|
+
const n = y.toSignal(e).deriveProp(), i = new ve(t, void 0), l = new D(i, void 0, { currentURL: n }, r);
|
|
1155
1161
|
return {
|
|
1156
1162
|
clear: ee(s(), l),
|
|
1157
1163
|
root: i,
|
|
@@ -1173,8 +1179,8 @@ class jt {
|
|
|
1173
1179
|
setClass: i,
|
|
1174
1180
|
getStyles: l,
|
|
1175
1181
|
setStyles: c,
|
|
1176
|
-
appendHTML:
|
|
1177
|
-
getInnerHTML:
|
|
1182
|
+
appendHTML: u,
|
|
1183
|
+
getInnerHTML: a,
|
|
1178
1184
|
setInnerHTML: h,
|
|
1179
1185
|
getInnerText: g,
|
|
1180
1186
|
setInnerText: T
|
|
@@ -1303,24 +1309,24 @@ class jt {
|
|
|
1303
1309
|
if (n.hasAttributes()) {
|
|
1304
1310
|
const c = n.getAttributes();
|
|
1305
1311
|
if (t) {
|
|
1306
|
-
const
|
|
1307
|
-
c.forEach(([
|
|
1308
|
-
const h = this.getAttribute(l,
|
|
1309
|
-
h != null &&
|
|
1310
|
-
}),
|
|
1312
|
+
const u = [];
|
|
1313
|
+
c.forEach(([a]) => {
|
|
1314
|
+
const h = this.getAttribute(l, a);
|
|
1315
|
+
h != null && u.push([a, h]);
|
|
1316
|
+
}), u.length > 0 && this.setAttribute(
|
|
1311
1317
|
l,
|
|
1312
1318
|
U,
|
|
1313
|
-
JSON.stringify(Object.fromEntries(
|
|
1319
|
+
JSON.stringify(Object.fromEntries(u))
|
|
1314
1320
|
);
|
|
1315
1321
|
}
|
|
1316
|
-
c.forEach(([
|
|
1317
|
-
this.setAttribute(l,
|
|
1322
|
+
c.forEach(([u, a]) => {
|
|
1323
|
+
this.setAttribute(l, u, a);
|
|
1318
1324
|
});
|
|
1319
1325
|
}
|
|
1320
1326
|
}
|
|
1321
1327
|
});
|
|
1322
1328
|
});
|
|
1323
|
-
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = l, this.setStyles = c, this.appendHTML =
|
|
1329
|
+
this.select = e, this.getAttribute = t, this.setAttribute = r, this.getClass = n, this.setClass = i, this.getStyles = l, this.setStyles = c, this.appendHTML = u, this.getInnerHTML = a, this.setInnerHTML = h, this.getInnerText = g, this.setInnerText = T;
|
|
1324
1330
|
}
|
|
1325
1331
|
}
|
|
1326
1332
|
const Ye = () => {
|
|
@@ -1412,14 +1418,14 @@ class Ae {
|
|
|
1412
1418
|
this.trigger("click", {});
|
|
1413
1419
|
});
|
|
1414
1420
|
o(this, "on", (e, t, r, n) => {
|
|
1415
|
-
var
|
|
1416
|
-
const i = (
|
|
1417
|
-
c(), t(
|
|
1418
|
-
} : (
|
|
1421
|
+
var u;
|
|
1422
|
+
const i = (u = this.properties)[x] ?? (u[x] = {}), l = n != null && n.once ? (a) => {
|
|
1423
|
+
c(), t(a, r);
|
|
1424
|
+
} : (a) => t(a, r);
|
|
1419
1425
|
i[e] = [...i[e] ?? [], l];
|
|
1420
1426
|
const c = () => {
|
|
1421
|
-
const
|
|
1422
|
-
h !== -1 && (
|
|
1427
|
+
const a = i[e] ?? [], h = a.indexOf(l);
|
|
1428
|
+
h !== -1 && (a.splice(h, 1), a.length === 0 ? (delete i[e], Object.keys(i).length === 0 && delete this.properties[x]) : i[e] = a, (n == null ? void 0 : n.signal) != null && n.signal.removeEventListener("abort", c));
|
|
1423
1429
|
};
|
|
1424
1430
|
return (n == null ? void 0 : n.signal) != null && n.signal.addEventListener("abort", c), c;
|
|
1425
1431
|
});
|
|
@@ -1470,20 +1476,20 @@ class Ae {
|
|
|
1470
1476
|
}
|
|
1471
1477
|
}
|
|
1472
1478
|
const lt = (s) => s.replace(/"/g, """), ct = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1473
|
-
class
|
|
1479
|
+
class ut extends Ae {
|
|
1474
1480
|
constructor(t, r, n) {
|
|
1475
1481
|
super(n);
|
|
1476
1482
|
o(this, "isPortal", () => !1);
|
|
1477
1483
|
o(this, "toHTML", (t = !1) => {
|
|
1478
|
-
const r = this.children.map((
|
|
1484
|
+
const r = this.children.map((u) => u.toHTML()).join(""), n = this.namespace ? ` xmlns="${this.namespace}"` : "";
|
|
1479
1485
|
let i = null;
|
|
1480
|
-
const l = this.getVisibleAttributes().map(([
|
|
1486
|
+
const l = this.getVisibleAttributes().map(([u, a]) => u === "class" ? ` class="${a.join(" ")}"` : u === "style" ? typeof a == "string" ? ` style="${a}"` : ` style="${Object.entries(a).map(([h, g]) => `${h}: ${g};`).join(" ")}"` : ht.has(u) ? ` ${u}` : u === "innerHTML" ? (i = a, "") : u === "innerText" ? (i = ct(a), "") : ` ${u}="${lt(a)}"`).join(""), c = t ? ` ${Te}` : "";
|
|
1481
1487
|
return ft.has(this.tagName) && r === "" ? `<${this.tagName}${n}${l}${c} />` : `<${this.tagName}${n}${l}${c}>${i ?? r}</${this.tagName}>`;
|
|
1482
1488
|
});
|
|
1483
1489
|
this.tagName = t, this.namespace = r;
|
|
1484
1490
|
}
|
|
1485
1491
|
}
|
|
1486
|
-
class
|
|
1492
|
+
class ve extends Ae {
|
|
1487
1493
|
constructor(t, r) {
|
|
1488
1494
|
super(r);
|
|
1489
1495
|
o(this, "isPortal", () => !0);
|
|
@@ -1492,7 +1498,7 @@ class _e extends Ae {
|
|
|
1492
1498
|
this.selector = t;
|
|
1493
1499
|
}
|
|
1494
1500
|
}
|
|
1495
|
-
class
|
|
1501
|
+
class at {
|
|
1496
1502
|
constructor(e) {
|
|
1497
1503
|
o(this, "id", Se());
|
|
1498
1504
|
o(this, "isElement", () => !1);
|
|
@@ -1512,7 +1518,7 @@ class D {
|
|
|
1512
1518
|
this.element.children.push(e);
|
|
1513
1519
|
});
|
|
1514
1520
|
o(this, "makeChildElement", (e, t) => {
|
|
1515
|
-
const r = new
|
|
1521
|
+
const r = new ut(e, t, this.element);
|
|
1516
1522
|
return this.appendOrInsert(r), new D(
|
|
1517
1523
|
r,
|
|
1518
1524
|
void 0,
|
|
@@ -1521,7 +1527,7 @@ class D {
|
|
|
1521
1527
|
);
|
|
1522
1528
|
});
|
|
1523
1529
|
o(this, "makeChildText", (e) => {
|
|
1524
|
-
const t = new
|
|
1530
|
+
const t = new at(e);
|
|
1525
1531
|
return this.appendOrInsert(t), new D(
|
|
1526
1532
|
this.element,
|
|
1527
1533
|
t,
|
|
@@ -1538,7 +1544,7 @@ class D {
|
|
|
1538
1544
|
});
|
|
1539
1545
|
o(this, "makeRef", () => this.makeChildText(""));
|
|
1540
1546
|
o(this, "makePortal", (e) => {
|
|
1541
|
-
const t = new
|
|
1547
|
+
const t = new ve(e, this.element);
|
|
1542
1548
|
return this.appendOrInsert(t), new D(
|
|
1543
1549
|
t,
|
|
1544
1550
|
void 0,
|
|
@@ -1587,17 +1593,17 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1587
1593
|
"readonly",
|
|
1588
1594
|
"required",
|
|
1589
1595
|
"selected"
|
|
1590
|
-
]), ft = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]),
|
|
1596
|
+
]), ft = /* @__PURE__ */ new Set(["img", "br", "hr", "input", "link", "meta"]), _e = (s) => (e) => e.makeChildText(s).clear, Ee = (s) => (e) => {
|
|
1591
1597
|
const t = e.makeChildText(s.value), r = s.on(t.setText);
|
|
1592
1598
|
return (n) => {
|
|
1593
1599
|
r(), t.clear(n);
|
|
1594
1600
|
};
|
|
1595
|
-
}, qt = (s) => d.is(s) ? Ee(s) :
|
|
1601
|
+
}, qt = (s) => d.is(s) ? Ee(s) : _e(s), b = (...s) => (e) => {
|
|
1596
1602
|
const t = s.map((r) => f(r)(e));
|
|
1597
1603
|
return (r) => {
|
|
1598
1604
|
t.forEach((n) => n(r));
|
|
1599
1605
|
};
|
|
1600
|
-
},
|
|
1606
|
+
}, _ = () => () => {
|
|
1601
1607
|
}, dt = (s) => (e) => (e.addClasses(s), (t) => {
|
|
1602
1608
|
t && e.removeClasses(s);
|
|
1603
1609
|
}), pt = (s) => (e) => {
|
|
@@ -1717,11 +1723,11 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1717
1723
|
}
|
|
1718
1724
|
), f = (s) => {
|
|
1719
1725
|
if (s == null)
|
|
1720
|
-
return
|
|
1726
|
+
return _;
|
|
1721
1727
|
if (Array.isArray(s))
|
|
1722
1728
|
return b(...s.map(f));
|
|
1723
1729
|
if (typeof s == "string")
|
|
1724
|
-
return
|
|
1730
|
+
return _e(s);
|
|
1725
1731
|
if (d.is(s))
|
|
1726
1732
|
return Ee(s);
|
|
1727
1733
|
if (typeof s == "function")
|
|
@@ -1780,20 +1786,20 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1780
1786
|
), xe = (s, e) => {
|
|
1781
1787
|
if (typeof e == "function")
|
|
1782
1788
|
return xe(s, { then: e });
|
|
1783
|
-
const t = e.pending != null ? f(e.pending()) :
|
|
1789
|
+
const t = e.pending != null ? f(e.pending()) : _, r = e.then, n = e.error != null ? (i) => f(e.error(i)) : () => _;
|
|
1784
1790
|
return (i) => {
|
|
1785
1791
|
let l = !0;
|
|
1786
|
-
const c = s(),
|
|
1787
|
-
let
|
|
1792
|
+
const c = s(), u = i.makeRef();
|
|
1793
|
+
let a = f(t)(u);
|
|
1788
1794
|
return c.then(
|
|
1789
1795
|
(h) => {
|
|
1790
|
-
l && (
|
|
1796
|
+
l && (a(!0), a = f(r(h))(u));
|
|
1791
1797
|
},
|
|
1792
1798
|
(h) => {
|
|
1793
|
-
l && (
|
|
1799
|
+
l && (a(!0), a = f(n(h))(u));
|
|
1794
1800
|
}
|
|
1795
1801
|
), (h) => {
|
|
1796
|
-
l = !1,
|
|
1802
|
+
l = !1, a(h), u.clear(h);
|
|
1797
1803
|
};
|
|
1798
1804
|
};
|
|
1799
1805
|
}, zt = (s, e) => xe(() => s, e), Pe = (s, e, t) => (r) => r.on(s, e, t), yt = (s) => Pe("click", (e, t) => {
|
|
@@ -1883,16 +1889,16 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1883
1889
|
const n = r.makeRef();
|
|
1884
1890
|
let i, l;
|
|
1885
1891
|
const c = s.map((h) => Object.keys(h)[0]);
|
|
1886
|
-
let
|
|
1887
|
-
const
|
|
1888
|
-
if (h !==
|
|
1889
|
-
|
|
1892
|
+
let u;
|
|
1893
|
+
const a = c.on((h) => {
|
|
1894
|
+
if (h !== u) {
|
|
1895
|
+
u = h, l == null || l.dispose(), i == null || i(!0), l = s.map((T) => T[h]);
|
|
1890
1896
|
const g = e[h](l);
|
|
1891
1897
|
i = f(g)(n);
|
|
1892
1898
|
}
|
|
1893
1899
|
});
|
|
1894
1900
|
return (h) => {
|
|
1895
|
-
l == null || l.dispose(),
|
|
1901
|
+
l == null || l.dispose(), a(), n.clear(h), i == null || i(h);
|
|
1896
1902
|
};
|
|
1897
1903
|
};
|
|
1898
1904
|
const t = Object.keys(s)[0];
|
|
@@ -1901,15 +1907,15 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1901
1907
|
y.map(s, (r) => ({ [r[e]]: r })),
|
|
1902
1908
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1903
1909
|
t
|
|
1904
|
-
), cs = (s, e) => Le(s, "kind", e),
|
|
1910
|
+
), cs = (s, e) => Le(s, "kind", e), us = (s, e) => {
|
|
1905
1911
|
const t = y.map(s, ([r, n]) => ({ [r]: n }));
|
|
1906
1912
|
return Y(t, e);
|
|
1907
|
-
},
|
|
1913
|
+
}, as = (s, e) => Le(s, "type", e), vt = (s, e) => Y(
|
|
1908
1914
|
y.map(s, (t) => ({ [t]: !0 })),
|
|
1909
1915
|
e
|
|
1910
1916
|
), hs = (s, e = {}) => (t) => {
|
|
1911
1917
|
const r = (e == null ? void 0 : e.firstSeparator) ?? s, n = (e == null ? void 0 : e.lastSeparator) ?? s;
|
|
1912
|
-
return
|
|
1918
|
+
return vt(
|
|
1913
1919
|
t.map((i) => i.isFirst ? "first" : i.isLast ? "last" : "other"),
|
|
1914
1920
|
{
|
|
1915
1921
|
first: r,
|
|
@@ -1925,21 +1931,21 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1925
1931
|
return (n) => {
|
|
1926
1932
|
const i = n.makeRef();
|
|
1927
1933
|
let l = () => {
|
|
1928
|
-
}, c = !1,
|
|
1929
|
-
const
|
|
1930
|
-
h == null ? (l(!0), l = f(t == null ? void 0 : t())(i), c = !1,
|
|
1934
|
+
}, c = !1, u = null;
|
|
1935
|
+
const a = r.on((h) => {
|
|
1936
|
+
h == null ? (l(!0), l = f(t == null ? void 0 : t())(i), c = !1, u == null || u.dispose(), u = null) : c ? u.set(h) : (u = v(h), l(!0), l = f(e(u))(
|
|
1931
1937
|
i
|
|
1932
1938
|
), c = !0);
|
|
1933
1939
|
});
|
|
1934
1940
|
return (h) => {
|
|
1935
|
-
|
|
1941
|
+
u == null || u.dispose(), a(), l == null || l(h), i.clear(h);
|
|
1936
1942
|
};
|
|
1937
1943
|
};
|
|
1938
1944
|
} else {
|
|
1939
1945
|
const r = s;
|
|
1940
1946
|
if (r == null) {
|
|
1941
1947
|
const n = t == null ? void 0 : t();
|
|
1942
|
-
return n != null ? f(n) :
|
|
1948
|
+
return n != null ? f(n) : _;
|
|
1943
1949
|
}
|
|
1944
1950
|
return f(e(G(r)));
|
|
1945
1951
|
}
|
|
@@ -1948,17 +1954,17 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1948
1954
|
if (s.some(
|
|
1949
1955
|
(p) => !d.is(p) && p == null
|
|
1950
1956
|
))
|
|
1951
|
-
return (t != null ? f(t == null ? void 0 : t()) :
|
|
1957
|
+
return (t != null ? f(t == null ? void 0 : t()) : _)(
|
|
1952
1958
|
n
|
|
1953
1959
|
);
|
|
1954
1960
|
const l = s.map(() => null), c = s.map(
|
|
1955
1961
|
(p) => d.is(p) ? p.value != null : p != null
|
|
1956
1962
|
);
|
|
1957
|
-
let
|
|
1958
|
-
const
|
|
1963
|
+
let u = null;
|
|
1964
|
+
const a = v(c.every((p) => p)), h = (p, m) => {
|
|
1959
1965
|
if (p.value != null) {
|
|
1960
1966
|
if (l[m] == null) {
|
|
1961
|
-
const C =
|
|
1967
|
+
const C = v(p.value);
|
|
1962
1968
|
l[m] = C;
|
|
1963
1969
|
} else
|
|
1964
1970
|
l[m].value = p.value;
|
|
@@ -1969,18 +1975,18 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1969
1975
|
let g = s.length - 1;
|
|
1970
1976
|
const T = s.map((p, m) => {
|
|
1971
1977
|
if (!d.is(p)) {
|
|
1972
|
-
const C =
|
|
1978
|
+
const C = v(p);
|
|
1973
1979
|
return l[m] = C, () => {
|
|
1974
1980
|
};
|
|
1975
1981
|
}
|
|
1976
1982
|
return p.on(() => {
|
|
1977
|
-
h(p, m), g === 0 ?
|
|
1983
|
+
h(p, m), g === 0 ? a.value = c.every((C) => C) : g--;
|
|
1978
1984
|
});
|
|
1979
1985
|
});
|
|
1980
|
-
return
|
|
1981
|
-
|
|
1986
|
+
return a.on((p) => {
|
|
1987
|
+
u == null || u(!0), u = null, p ? u = f(e(...l))(n) : u = f((t == null ? void 0 : t()) ?? _)(n);
|
|
1982
1988
|
}), (p) => {
|
|
1983
|
-
l.forEach((m) => m == null ? void 0 : m.dispose()),
|
|
1989
|
+
l.forEach((m) => m == null ? void 0 : m.dispose()), a.dispose(), T.forEach((m) => m()), u == null || u(p), n.clear(p);
|
|
1984
1990
|
};
|
|
1985
1991
|
}, M = (...s) => (e) => (t) => s.forEach((r) => r(t, e)), De = (s, e, t) => {
|
|
1986
1992
|
if (d.is(s)) {
|
|
@@ -1989,17 +1995,17 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
1989
1995
|
const i = n.makeRef();
|
|
1990
1996
|
let l = () => {
|
|
1991
1997
|
};
|
|
1992
|
-
const c = r.on((
|
|
1993
|
-
l(!0),
|
|
1998
|
+
const c = r.on((u) => {
|
|
1999
|
+
l(!0), u ? l = f(e())(i) : l = f(t == null ? void 0 : t())(i);
|
|
1994
2000
|
});
|
|
1995
|
-
return (
|
|
1996
|
-
l(
|
|
2001
|
+
return (u) => {
|
|
2002
|
+
l(u), c(), i.clear(u);
|
|
1997
2003
|
};
|
|
1998
2004
|
};
|
|
1999
2005
|
} else {
|
|
2000
2006
|
if (s) {
|
|
2001
2007
|
const n = e();
|
|
2002
|
-
return n != null ? f(n) :
|
|
2008
|
+
return n != null ? f(n) : _;
|
|
2003
2009
|
}
|
|
2004
2010
|
return f(t == null ? void 0 : t());
|
|
2005
2011
|
}
|
|
@@ -2019,7 +2025,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2019
2025
|
f(e(r)),
|
|
2020
2026
|
De(
|
|
2021
2027
|
r.isLast,
|
|
2022
|
-
() =>
|
|
2028
|
+
() => _,
|
|
2023
2029
|
() => t(n)
|
|
2024
2030
|
)
|
|
2025
2031
|
);
|
|
@@ -2028,11 +2034,11 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2028
2034
|
return (r) => {
|
|
2029
2035
|
const n = s.derive(), i = r.makeRef(), l = [];
|
|
2030
2036
|
return n.on((c) => {
|
|
2031
|
-
const
|
|
2032
|
-
for (const
|
|
2033
|
-
|
|
2034
|
-
for (let
|
|
2035
|
-
const h = new Q(
|
|
2037
|
+
const u = l.splice(c);
|
|
2038
|
+
for (const a of u)
|
|
2039
|
+
a(!0);
|
|
2040
|
+
for (let a = l.length; a < c; a++) {
|
|
2041
|
+
const h = new Q(a, n);
|
|
2036
2042
|
l.push(
|
|
2037
2043
|
b(
|
|
2038
2044
|
M(h.dispose),
|
|
@@ -2042,8 +2048,8 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2042
2048
|
}
|
|
2043
2049
|
}), (c) => {
|
|
2044
2050
|
n.dispose();
|
|
2045
|
-
for (const
|
|
2046
|
-
|
|
2051
|
+
for (const u of l)
|
|
2052
|
+
u(c);
|
|
2047
2053
|
l.length = 0, i.clear(c);
|
|
2048
2054
|
};
|
|
2049
2055
|
};
|
|
@@ -2089,7 +2095,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2089
2095
|
};
|
|
2090
2096
|
}
|
|
2091
2097
|
return f(e(s));
|
|
2092
|
-
}, Ts = (s, e, t = () =>
|
|
2098
|
+
}, Ts = (s, e, t = () => _) => Y(
|
|
2093
2099
|
y.map(
|
|
2094
2100
|
s,
|
|
2095
2101
|
(r) => r.length > 0 ? { notEmpty: r } : { whenEmpty: null }
|
|
@@ -2101,7 +2107,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2101
2107
|
), bs = (s, e) => (t) => {
|
|
2102
2108
|
const r = t.makePortal(s), n = ee(f(e), r);
|
|
2103
2109
|
return () => n(!0);
|
|
2104
|
-
}, R = /* @__PURE__ */ new Map(),
|
|
2110
|
+
}, R = /* @__PURE__ */ new Map(), _t = (s) => ({
|
|
2105
2111
|
mark: Ge(`Probe(${s.description})`),
|
|
2106
2112
|
create: ({ callback: e = () => {
|
|
2107
2113
|
}, timeout: t = 10 } = {}) => {
|
|
@@ -2121,7 +2127,7 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2121
2127
|
onUse: () => i.counter++
|
|
2122
2128
|
};
|
|
2123
2129
|
}
|
|
2124
|
-
}), Ss =
|
|
2130
|
+
}), Ss = _t(Symbol("GlobalProbe")), Et = (s, e) => (t) => {
|
|
2125
2131
|
const r = t.getStyle(s);
|
|
2126
2132
|
return t.setStyle(s, e), (n) => {
|
|
2127
2133
|
n && t.setStyle(s, r);
|
|
@@ -2152,11 +2158,11 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2152
2158
|
}
|
|
2153
2159
|
return () => {
|
|
2154
2160
|
};
|
|
2155
|
-
},
|
|
2161
|
+
}, vs = (s) => (e) => {
|
|
2156
2162
|
const t = s(e);
|
|
2157
2163
|
return t == null ? () => {
|
|
2158
2164
|
} : f(t)(e);
|
|
2159
|
-
},
|
|
2165
|
+
}, _s = (s) => Ct((e) => s(e.element)), Es = (s) => (e) => {
|
|
2160
2166
|
if (e.isHeadlessDOM()) {
|
|
2161
2167
|
const t = s(e);
|
|
2162
2168
|
if (t)
|
|
@@ -2174,11 +2180,11 @@ const ht = /* @__PURE__ */ new Set([
|
|
|
2174
2180
|
}
|
|
2175
2181
|
const i = [], l = s({
|
|
2176
2182
|
use: ({ mark: c }) => {
|
|
2177
|
-
const { value:
|
|
2178
|
-
return
|
|
2183
|
+
const { value: u, onUse: a } = r().getProvider(c);
|
|
2184
|
+
return a == null || a(), u;
|
|
2179
2185
|
},
|
|
2180
|
-
set: ({ mark: c, create:
|
|
2181
|
-
const { value: h, dispose: g, onUse: T } = a
|
|
2186
|
+
set: ({ mark: c, create: u }, a) => {
|
|
2187
|
+
const { value: h, dispose: g, onUse: T } = u(a, r());
|
|
2182
2188
|
i.push(g), n(r().setProvider(c, h, T));
|
|
2183
2189
|
}
|
|
2184
2190
|
});
|
|
@@ -2206,7 +2212,7 @@ export {
|
|
|
2206
2212
|
we as El,
|
|
2207
2213
|
Ce as ElNS,
|
|
2208
2214
|
Q as ElementPosition,
|
|
2209
|
-
|
|
2215
|
+
_ as Empty,
|
|
2210
2216
|
ds as Ensure,
|
|
2211
2217
|
ps as EnsureAll,
|
|
2212
2218
|
ms as ForEach,
|
|
@@ -2214,20 +2220,20 @@ export {
|
|
|
2214
2220
|
Ss as GlobalProbe,
|
|
2215
2221
|
jt as HeadlessAdapter,
|
|
2216
2222
|
D as HeadlessContext,
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2223
|
+
ut as HeadlessElement,
|
|
2224
|
+
ve as HeadlessPortal,
|
|
2225
|
+
at as HeadlessText,
|
|
2220
2226
|
ys as MapSignal,
|
|
2221
|
-
|
|
2227
|
+
ue as MemoryStore,
|
|
2222
2228
|
Ts as NotEmpty,
|
|
2223
2229
|
yt as OnChecked,
|
|
2224
2230
|
M as OnDispose,
|
|
2225
2231
|
Y as OneOf,
|
|
2226
2232
|
Le as OneOfField,
|
|
2227
2233
|
cs as OneOfKind,
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2234
|
+
us as OneOfTuple,
|
|
2235
|
+
as as OneOfType,
|
|
2236
|
+
vt as OneOfValue,
|
|
2231
2237
|
bs as Portal,
|
|
2232
2238
|
j as Prop,
|
|
2233
2239
|
ws as Provide,
|
|
@@ -2243,8 +2249,8 @@ export {
|
|
|
2243
2249
|
y as Value,
|
|
2244
2250
|
De as When,
|
|
2245
2251
|
Ct as WithBrowserCtx,
|
|
2246
|
-
|
|
2247
|
-
|
|
2252
|
+
vs as WithCtx,
|
|
2253
|
+
_s as WithElement,
|
|
2248
2254
|
Es as WithHeadlessCtx,
|
|
2249
2255
|
te as WithProvider,
|
|
2250
2256
|
Te as _NODE_PLACEHOLDER_ATTR,
|
|
@@ -2254,7 +2260,7 @@ export {
|
|
|
2254
2260
|
We as _makeSetter,
|
|
2255
2261
|
V as _removeDOMNode,
|
|
2256
2262
|
Ee as _signalText,
|
|
2257
|
-
|
|
2263
|
+
_e as _staticText,
|
|
2258
2264
|
Mt as animateSignal,
|
|
2259
2265
|
Fe as animateSignals,
|
|
2260
2266
|
Bt as aria,
|
|
@@ -2288,13 +2294,13 @@ export {
|
|
|
2288
2294
|
$e as interpolateString,
|
|
2289
2295
|
Pt as joinSignals,
|
|
2290
2296
|
Dt as localStorageProp,
|
|
2291
|
-
|
|
2297
|
+
_t as makeProbe,
|
|
2292
2298
|
Ge as makeProviderMark,
|
|
2293
2299
|
Yt as math,
|
|
2294
2300
|
Ut as mathAttr,
|
|
2295
2301
|
Ht as merge,
|
|
2296
2302
|
X as on,
|
|
2297
|
-
|
|
2303
|
+
v as prop,
|
|
2298
2304
|
It as render,
|
|
2299
2305
|
ee as renderWithContext,
|
|
2300
2306
|
f as renderableOfTNode,
|
|
@@ -2302,7 +2308,7 @@ export {
|
|
|
2302
2308
|
Rt as runHeadless,
|
|
2303
2309
|
Ot as sessionStorageProp,
|
|
2304
2310
|
G as signal,
|
|
2305
|
-
|
|
2311
|
+
ae as storedProp,
|
|
2306
2312
|
As as style,
|
|
2307
2313
|
Xt as svg,
|
|
2308
2314
|
Wt as svgAttr
|
package/package.json
CHANGED
package/std/signal-utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueType, RemoveSignals, Values } from '../types/domain';
|
|
2
2
|
import { AnySignal, Computed, Prop, Signal } from './signal';
|
|
3
3
|
import { Value } from './value';
|
|
4
4
|
/**
|
|
@@ -232,7 +232,7 @@ export declare const computedRecord: <T extends Record<string, Value<unknown>>,
|
|
|
232
232
|
* @returns - The merged signal.
|
|
233
233
|
* @public
|
|
234
234
|
*/
|
|
235
|
-
export declare const merge: <T extends Record<string, Value<unknown>>>(options: T) => Signal<{ [K in keyof T]:
|
|
235
|
+
export declare const merge: <T extends Record<string, Value<unknown>>>(options: T) => Signal<{ [K in keyof T]: ValueType<T[K]>; }>;
|
|
236
236
|
/**
|
|
237
237
|
* Delays the value of a signal by a specified amount of time.
|
|
238
238
|
*
|
|
@@ -253,12 +253,4 @@ export declare const delaySignal: <T>(signal: Signal<T>, ms: number | ((value: T
|
|
|
253
253
|
* @public
|
|
254
254
|
*/
|
|
255
255
|
export declare const bind: <FN extends (...args: any[]) => R, R = ReturnType<FN>>(fn: Value<FN>) => (...args: Values<Parameters<FN>>) => Computed<R>;
|
|
256
|
-
|
|
257
|
-
* Returns the first non-null and non-undefined value from a set of signals and literals.
|
|
258
|
-
*
|
|
259
|
-
* @typeParam T - The type of the signals and literals.
|
|
260
|
-
* @param args - The set of signals and literals to search.
|
|
261
|
-
* @returns - A computed signal that emits the first non-null and non-undefined value.
|
|
262
|
-
* @public
|
|
263
|
-
*/
|
|
264
|
-
export declare const coalesce: <T extends Value<unknown>[]>(...args: T) => Computed<{} | undefined>;
|
|
256
|
+
export declare function coalesce<L>(...args: readonly [...unknown[], L]): Computed<ValueType<L>>;
|
package/std/value.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ValueTypes } from '../types/domain';
|
|
2
2
|
import { ListenerOptions, Prop, Signal } from './signal';
|
|
3
3
|
/**
|
|
4
4
|
* Represents a value that can either be a `Signal<T>` or a generic type `T`.
|
|
@@ -81,7 +81,7 @@ export declare const Value: {
|
|
|
81
81
|
* @returns - The computed signal.
|
|
82
82
|
* @public
|
|
83
83
|
*/
|
|
84
|
-
export declare const computedOf: <T extends Value<unknown>[]>(...args: T) => <O>(fn: (...args:
|
|
84
|
+
export declare const computedOf: <T extends Value<unknown>[]>(...args: T) => <O>(fn: (...args: ValueTypes<T>) => O, equals?: (a: O, b: O) => boolean) => import('./signal').Computed<O>;
|
|
85
85
|
/**
|
|
86
86
|
* Joins a set of signals into a single signal that emits a record of the values.
|
|
87
87
|
* @param values - The set of signals to join as a record of `Value`s.
|
|
@@ -96,4 +96,4 @@ export declare const joinSignals: <T extends Record<string, Value<unknown>>>(val
|
|
|
96
96
|
* @returns A disposable object that can be used to stop the effect.
|
|
97
97
|
* @public
|
|
98
98
|
*/
|
|
99
|
-
export declare const effectOf: <T extends Value<unknown>[]>(...args: T) => (fn: (...args:
|
|
99
|
+
export declare const effectOf: <T extends Value<unknown>[]>(...args: T) => (fn: (...args: ValueTypes<T>) => void, options?: ListenerOptions) => () => void;
|
package/types/domain.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOMContext } from '../dom/dom-context';
|
|
2
|
-
import { Signal } from '../std/signal';
|
|
2
|
+
import { Computed, Prop, Signal } from '../std/signal';
|
|
3
3
|
import { Value } from '../std/value';
|
|
4
4
|
/**
|
|
5
5
|
* A function that renders content into the DOM and returns a cleanup function.
|
|
@@ -162,20 +162,25 @@ export type NValue<T> = WithNullish<T> | null | undefined;
|
|
|
162
162
|
* Otherwise, it returns the type itself.
|
|
163
163
|
* @public
|
|
164
164
|
*/
|
|
165
|
-
export type
|
|
165
|
+
export type ValueType<T> = T extends Computed<infer V> ? V : T extends Prop<infer V> ? V : T extends Signal<infer V> ? V : T;
|
|
166
|
+
/**
|
|
167
|
+
* Gets the base value type of a given Value type.
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
export type BaseValueType<T> = NonNullable<ValueType<T>>;
|
|
166
171
|
/**
|
|
167
172
|
* Gets the value types of a given array of Value types.
|
|
168
173
|
* @public
|
|
169
174
|
*/
|
|
170
|
-
export type
|
|
171
|
-
[K in keyof T]:
|
|
175
|
+
export type ValueTypes<T extends Value<unknown>[]> = {
|
|
176
|
+
[K in keyof T]: ValueType<T[K]>;
|
|
172
177
|
};
|
|
173
178
|
/**
|
|
174
179
|
* Wraps all non-`Value` types in the array in `Value`.
|
|
175
180
|
* @public
|
|
176
181
|
*/
|
|
177
182
|
export type Values<T extends unknown[]> = {
|
|
178
|
-
[K in keyof T]: T[K] extends Signal<unknown> ? T[K] : Value<T[K]>;
|
|
183
|
+
[K in keyof T]: T[K] extends Signal<unknown> | Computed<unknown> | Prop<unknown> ? T[K] : Value<T[K]>;
|
|
179
184
|
};
|
|
180
185
|
/**
|
|
181
186
|
* Removes signals from a given object type and returns a new object type
|
|
@@ -186,6 +191,11 @@ export type Values<T extends unknown[]> = {
|
|
|
186
191
|
* @public
|
|
187
192
|
*/
|
|
188
193
|
export type RemoveSignals<T extends Record<string | number | symbol, Value<unknown>>, K extends (string | number | symbol) & keyof T = keyof T> = {
|
|
189
|
-
[k in K]:
|
|
194
|
+
[k in K]: ValueType<T[k]>;
|
|
190
195
|
};
|
|
196
|
+
/**
|
|
197
|
+
* Represents a value that can be null or undefined.
|
|
198
|
+
* @public
|
|
199
|
+
*/
|
|
200
|
+
export type Nil = null | undefined;
|
|
191
201
|
export {};
|