@firsthandjs/dom 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-6OI7S46K.js +1 -0
- package/dist/component.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/internal.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-H2EEOOJ6.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var C=null,x=new WeakMap;function $n(n){C=n,x=new WeakMap}var E=class extends Error{constructor(t){super(`${t} is not a Firsthand component. If it is a React component, import '@firsthandjs/react/auto' once at startup to render React components directly, or wrap it with fromReact(). Otherwise, declare it with component().`),this.name="FirsthandComponentError"}};function T(n){let t=x.get(n);if(t!==void 0)return t;if(C===null){let o=typeof n=="function"&&n.name!==""?n.name:"The value";throw new E(o)}let e=C(n);return x.set(n,e),e}import{bind as ln,getOwner as L,onCleanup as dn,runWithOwner as un}from"@firsthandjs/core";var cn=3;function H(n){return typeof n.nodeType=="number"}var D=Symbol("firsthand.part");function Mn(n){return{[D]:!0,anchor:document.createTextNode(""),thunk:n,owner:L()}}function W(n){return D in n}function M(n,t,e=null){if(typeof t!="function"){p(n,e,null,t);return}let o=null;ln(()=>{let r=t();if(typeof r=="function"){o=g(o),M(n,r,e);return}o=p(n,e,o,r)}),dn(()=>{o=g(o)})}function p(n,t,e,o){let r=typeof o;if(o==null||r==="boolean")return g(e);if(r==="string"||r==="number"){let i=String(o);return e!==null&&!Array.isArray(e)&&e.nodeType===cn?(e.data=i,e):j(n,t,e,document.createTextNode(i))}if(r==="function")return p(n,t,e,o());if(Array.isArray(o)){let i=[],s=[];if(I(o,i,s),i.length===0)return g(e);an(n,t,e===null?[]:Array.isArray(e)?e:[e],i);for(let d=0;d<s.length;d++){let l=s[d];un(l.owner??L(),()=>{M(n,l.thunk,l.anchor)})}return i}return W(o)?p(n,t,e,[o]):H(o)?j(n,t,e,o):p(n,t,e,String(o))}function I(n,t,e){for(let o=0;o<n.length;o++){let r=n[o];if(typeof r=="object"&&r!==null&&W(r)){t.push(r.anchor),e.push(r);continue}for(;typeof r=="function";)r=r();r==null||typeof r=="boolean"||(Array.isArray(r)?I(r,t,e):typeof r=="object"&&H(r)?t.push(r):t.push(document.createTextNode(String(r))))}}function $(n){let t=n.parentNode;t!==null&&t.removeChild(n)}function g(n){if(n!==null)if(Array.isArray(n))for(let t=0;t<n.length;t++)$(n[t]);else $(n);return null}function j(n,t,e,o){return e===o?o:e!==null&&!Array.isArray(e)?(n.replaceChild(o,e),o):(g(e),n.insertBefore(o,t),o)}function an(n,t,e,o){let r=0,i=0,s=e.length-1,d=o.length-1;for(;r<=s&&i<=d&&e[r]===o[i];)r++,i++;for(;r<=s&&i<=d&&e[s]===o[d];)s--,d--;let l=d+1<o.length?o[d+1]:t;if(r>s){for(let u=i;u<=d;u++)n.insertBefore(o[u],l);return}if(i>d){for(let u=r;u<=s;u++)n.removeChild(e[u]);return}let c=new Map;for(let u=r;u<=s;u++)c.set(e[u],u);let a=d-i+1,f=new Int32Array(a).fill(-1);for(let u=0;u<a;u++){let w=o[i+u],v=c.get(w);v!==void 0&&(f[u]=v,c.delete(w))}for(let u of c.keys())n.removeChild(u);let m=fn(f),k=m.length-1,O=l;for(let u=a-1;u>=0;u--){let w=o[i+u];k>=0&&m[k]===u?k--:n.insertBefore(w,O),O=w}}function fn(n){let t=n.length,e=new Int32Array(t).fill(-1),o=[];for(let s=0;s<t;s++){let d=n[s];if(d===-1)continue;let l=0,c=o.length;for(;l<c;){let a=l+c>>1;n[o[a]]<d?l=a+1:c=a}l>0&&(e[s]=o[l-1]),o[l]=s}let r=[],i=o.length>0?o[o.length-1]:-1;for(;i!==-1;)r.push(i),i=e[i];return r.reverse()}import{signal as pn,createOwner as F,devEnterSetup as V,devExitSetup as y,disposeOwner as mn,getOwner as _,handleError as z,setOwner as h,untrack as B}from"@firsthandjs/core";var K=Symbol.for("firsthand.component"),wn=0,Z="firsthand";function Kn(n){Z=n}function Zn(n,t,e,o){let i=Object.assign(s=>gn(i,s),{[K]:!0,setup:n,options:t,id:e??`c${String(++wn)}`,tag:void 0});return Object.defineProperty(i,"name",{configurable:!0,value:o??(n.name===""?"Component":n.name)}),e===void 0&&(`${i.name}`,void 0),(t?.tag!==void 0||t?.shadow===!0)&&yn(i,typeof t.tag=="string"?t.tag:void 0),i}function qn(n){return typeof n=="function"&&K in n}function gn(n,t){if(Object.freeze(t),n.setup===void 0)return T(n)(t);if(n.tag!==void 0)return Cn(n,t);let e=F(_()),o=h(e);try{V(n.id);let r=B(()=>n.setup(t));return y(),h(o),r}catch(r){return y(),h(o),z(r,e),null}}function hn(n){let t=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return`${Z}-${t}`}function yn(n,t){let e=n;if(e.tag!==void 0)return e.tag;let o=t??hn(e);return customElements.get(o)!==void 0&&(o=`${o}-${e.id.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}`),e.tag=o,customElements.define(o,bn(e)),o}function bn(n){let t=n.options?.shadow===!0,e=n.options?.attributes,o=e!==void 0?Object.keys(e):[];return class extends HTMLElement{static observedAttributes=o;constructor(){super(),this.$owner=null,this.$props=null,this.$attrs=null,this.$standalone=!1}connectedCallback(){this.$owner===null&&(this.$standalone=!0,this.$attrs={},this.$props=kn(this,e,this.$attrs),q(this,n,t))}disconnectedCallback(){!this.$standalone||this.$owner===null||(mn(this.$owner),this.$owner=null)}attributeChangedCallback(i,s,d){let l=this.$attrs?.[i];l!==void 0&&(l.value=e[i]?.(d))}}}function kn(n,t,e){let o={};if(t!==void 0)for(let r in t){let i=pn(t[r](n.getAttribute(r)));e[r]=i,Object.defineProperty(o,r,{enumerable:!0,get:()=>i.value})}return Object.freeze(o)}function q(n,t,e){let o=F(_());n.$owner=o;let r=h(o);try{V(t.id);let i=e?n.attachShadow({mode:"open"}):n,s=B(()=>t.setup(n.$props));y(),p(i,null,null,s)}catch(i){y(),z(i,o)}finally{h(r)}}function Cn(n,t){let e=document.createElement(n.tag);return e.$props=t,q(e,n,n.options?.shadow===!0),e}import{batch as xn,createOwner as G,disposeOwner as En,getOwner as Rn,setOwner as R,signal as Y,untrack as X}from"@firsthandjs/core";function Un(n,t,e){let o=G(Rn()),r=new Map;return()=>{let i=n(),s=new Map,d=[];return xn(()=>{for(let l=0;l<i.length;l++){let c=i[l],a=X(()=>t(c,l));if(s.has(a)){`${String(a)}`;continue}let f=r.get(a);f===void 0?f=Nn(o,c,l,e):(r.delete(a),f.item.value=c,f.index.value=l),s.set(a,f);for(let m=0;m<f.nodes.length;m++)d.push(f.nodes[m])}for(let l of r.values())En(l.owner)}),r=s,d}}function Nn(n,t,e,o){let r=G(n),i=Y(t),s=Y(e),d=R(r),l;try{l=X(()=>o(i,s)),R(d)}catch(a){throw R(d),a}let c=[];return J(l,c),{owner:r,item:i,index:s,nodes:c}}function J(n,t){if(!(n==null||typeof n=="boolean")){if(Array.isArray(n)){for(let e=0;e<n.length;e++)J(n[e],t);return}if(typeof n=="object"&&typeof n.nodeType=="number"){t.push(n);return}t.push(document.createTextNode(String(n)))}}var An=new Set(["click","dblclick","contextmenu","input","beforeinput","change","keydown","keyup","keypress","pointerdown","pointerup","pointermove","mousedown","mouseup","mouseover","mouseout","submit","focusin","focusout","touchstart","touchend"]),Q=new Set;function N(n){return`$firsthand$${n}`}function Pn(n){let t=N(n.type),e=n.composedPath(),o=null;Object.defineProperty(n,"currentTarget",{configurable:!0,get:()=>o});for(let r=0;r<e.length;r++){let i=e[r],s=i[t];if(s!==void 0&&(o=i,s.call(i,n),n.cancelBubble)||i===document)break}o=null}function b(n,t,e,o){if(o!==void 0||!An.has(t)){n.addEventListener(t,e,o===!0?void 0:o);return}n[N(t)]=e,Q.has(t)||(Q.add(t),document.addEventListener(t,Pn))}function ee(n,t){n[N(t)]=void 0}var Sn={class:"className",for:"htmlFor"};function P(n,t,e){e==null||e===!1?n.removeAttribute(t):n.setAttribute(t,e===!0?"":String(e))}function oe(n,t,e,o){o==null||o===!1?n.removeAttributeNS(t,e):n.setAttributeNS(t,e,o===!0?"":String(o))}function S(n,t,e){n[Sn[t]??t]=e}function re(n,t,e){n[t]=!!e}function nn(n,t){t==null?n.removeAttribute("class"):n.className=String(t)}function en(n,t,e){let o=n.classList;if(e!==void 0)for(let r in e)r in t||o.remove(r);for(let r in t){let i=!!t[r];(e===void 0||!!e[r]!==i)&&o.toggle(r,i)}}function tn(n,t){t==null?n.style.cssText="":n.style.cssText=String(t)}function on(n,t,e){let o=n.style;if(e!==void 0)for(let r in e)r in t||o.removeProperty(A(r));for(let r in t){let i=t[r];(e===void 0||e[r]!==i)&&(i==null?o.removeProperty(A(r)):o.setProperty(A(r),String(i)))}}var On=/[A-Z]/g,U=new Map;function A(n){let t=U.get(n);return t===void 0&&(t=n.startsWith("--")?n:n.replace(On,e=>`-${e.toLowerCase()}`),U.set(n,t)),t}function vn(n,t,e){if(t==="class"||t==="className"){e!==null&&typeof e=="object"?en(n,e,sn(n,"class",e)):nn(n,e);return}if(t==="style"){e!==null&&typeof e=="object"?on(n,e,sn(n,"style",e)):tn(n,e);return}if(t==="ref"){e(n);return}if(t.startsWith("prop:")){S(n,t.slice(5),e);return}if(t.startsWith("attr:")){P(n,t.slice(5),e);return}if(t.startsWith("on")&&t.length>2&&/[A-Z:]/.test(t[2])){Tn(n,t,e);return}if(t in n&&typeof e!="string"){S(n,t,e);return}P(n,t,e)}function Tn(n,t,e){let o=t.slice(2).split(":"),r=o[0]==="",i=r?o[1]:o[0].toLowerCase(),s=o[r?2:1];s===void 0?b(n,i,e):s==="native"?b(n,i,e,!0):b(n,i,e,{[s]:!0})}function de(n,t){for(let e in t)e!=="children"&&vn(n,e,t[e])}function ue(...n){let t={};for(let e=0;e<n.length;e++){let o=n[e];for(let r of Object.keys(o))Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o[r]})}return t}function ce(n,t){let e={};for(let o of Object.keys(n))t.includes(o)||Object.defineProperty(e,o,{enumerable:!0,get:()=>n[o]});return Object.freeze(e)}var rn=new WeakMap;function sn(n,t,e){let o=rn.get(n);o===void 0&&(o={},rn.set(n,o));let r=o[t];return o[t]=e,r}export{$n as a,E as b,Mn as c,M as d,p as e,an as f,K as g,Kn as h,Zn as i,qn as j,gn as k,yn as l,Un as m,b as n,ee as o,P as p,oe as q,S as r,re as s,nn as t,en as u,tn as v,on as w,vn as x,de as y,ue as z,ce as A};
|
package/dist/component.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAE5D,oFAAoF;AACpF,eAAO,MAAM,SAAS,EAAE,OAAO,MAA0C,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACpB,2EAA2E;IAC3E,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAAC;CACvD;AAED,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,IAAI,GACd,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,IAAI,EAAE,CAAC;AAEvF;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI;KAC5B,CAAC,IAAI,MAAM,CAAC,GAAG,SAAS,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,CAAC;CACjE,CAAC;AAEF,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B;;;;;;;OAOG;IACH,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC/C,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,oEAAoE;IACpE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;AAKD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,CAAC,EACzB,KAAK,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,IAAI,EACxC,OAAO,CAAC,EAAE,gBAAgB,EAC1B,EAAE,CAAC,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,CAAC,CAAC,CAAC,CAgCd;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,CAErE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CA+BvE;AAcD,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,GAAG,MAAM,CAM7D;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAc5E"}
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as d,b as i,e as p,h as s,i as m,k as f,l as a,m as c,n as u,o as C,z as x}from"./chunk-
|
|
1
|
+
import{a as d,b as i,e as p,h as s,i as m,k as f,l as a,m as c,n as u,o as C,z as x}from"./chunk-6OI7S46K.js";import{createRoot as y,onCleanup as h,untrack as N}from"@firsthandjs/core";function g(e,r=document.body){let o;return y(t=>{o=t;let n=null;n=p(r,null,null,N(e)),h(()=>{p(r,null,n,null)})}),o}import{onCleanup as E}from"@firsthandjs/core";function b(e,r){let o=[];l(e,o);for(let t=0;t<o.length;t++)r.appendChild(o[t]);return E(()=>{for(let t=0;t<o.length;t++){let n=o[t];n.parentNode?.removeChild(n)}}),null}function l(e,r){if(!(e==null||typeof e=="boolean")){if(Array.isArray(e)){for(let o=0;o<e.length;o++)l(e[o],r);return}if(typeof e=="object"&&typeof e.nodeType=="number"){r.push(e);return}r.push(document.createTextNode(String(e)))}}import{signal as z,computed as B,effect as G,batch as H,untrack as I,onCleanup as J,createRoot as K,catchError as L,runWithOwner as M,createContext as Q,provide as U,useContext as X,FirsthandContextError as Y,FirsthandCycleError as Z,FirsthandReadonlyError as _}from"@firsthandjs/core";export{i as FirsthandComponentError,Y as FirsthandContextError,Z as FirsthandCycleError,_ as FirsthandReadonlyError,H as batch,L as catchError,m as component,B as computed,f as createComponent,Q as createContext,K as createRoot,a as defineElement,G as effect,c as list,x as mergeProps,C as off,u as on,J as onCleanup,b as portal,U as provide,g as render,M as runWithOwner,d as setComponentAdapter,s as setElementPrefix,z as signal,I as untrack,X as useContext};
|
package/dist/internal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as L,c as l,d as s,e as i,f as a,g as m,j as d,k as f,m as c,n as u,o as x,p as N,q as y,r as C,s as h,t as b,u as O,v as S,w as P,x as T,y as g,z as E}from"./chunk-
|
|
1
|
+
import{A as L,c as l,d as s,e as i,f as a,g as m,j as d,k as f,m as c,n as u,o as x,p as N,q as y,r as C,s as h,t as b,u as O,v as S,w as P,x as T,y as g,z as E}from"./chunk-6OI7S46K.js";function j(r,o=!1){let e;return()=>{if(e===void 0){let t=document.createElement("template");t.innerHTML=r,e=o?t.content:t.content.firstChild}return e.cloneNode(!0)}}function A(r,...o){let e=r;for(let t=0;t<o.length;t++){let n=e.firstChild;for(let p=o[t];p>0;p--)n=n.nextSibling;e=n}return e}import{bind as k}from"@firsthandjs/core";var M=1;export{m as COMPONENT,M as PROTOCOL_VERSION,i as applyChild,T as applyProp,k as bind,f as createComponent,s as insert,d as isComponent,c as list,E as mergeProps,x as off,u as on,l as part,A as path,a as reconcile,L as rest,N as setAttribute,y as setAttributeNS,h as setBoolean,b as setClass,O as setClassList,C as setProperty,S as setStyle,P as setStyleObject,g as spread,j as template};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firsthandjs/dom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "DOM parts, templates, components, portals and keyed lists for Firsthand.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"LICENSE"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@firsthandjs/core": "0.
|
|
26
|
+
"@firsthandjs/core": "0.3.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=20.11.0"
|
package/dist/chunk-H2EEOOJ6.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var k=null,C=new WeakMap;function vn(n){k=n,C=new WeakMap}var x=class extends Error{constructor(t){super(`${t} is not a Firsthand component. If it is a React component, import '@firsthandjs/react/auto' once at startup to render React components directly, or wrap it with fromReact(). Otherwise, declare it with component().`),this.name="FirsthandComponentError"}};function v(n){let t=C.get(n);if(t!==void 0)return t;if(k===null){let o=typeof n=="function"&&n.name!==""?n.name:"The value";throw new x(o)}let e=k(n);return C.set(n,e),e}import{bind as rn,getOwner as j,onCleanup as sn,runWithOwner as ln}from"@firsthandjs/core";var dn=3;function L(n){return typeof n.nodeType=="number"}var H=Symbol("firsthand.part");function Dn(n){return{[H]:!0,anchor:document.createTextNode(""),thunk:n,owner:j()}}function D(n){return H in n}function W(n,t,e=null){if(typeof t!="function"){p(n,e,null,t);return}let o=null;rn(()=>{let r=t();if(typeof r=="function"){o=w(o),W(n,r,e);return}o=p(n,e,o,r)}),sn(()=>{o=w(o)})}function p(n,t,e,o){let r=typeof o;if(o==null||r==="boolean")return w(e);if(r==="string"||r==="number"){let i=String(o);return e!==null&&!Array.isArray(e)&&e.nodeType===dn?(e.data=i,e):$(n,t,e,document.createTextNode(i))}if(r==="function")return p(n,t,e,o());if(Array.isArray(o)){let i=[],s=[];if(M(o,i,s),i.length===0)return w(e);un(n,t,e===null?[]:Array.isArray(e)?e:[e],i);for(let d=0;d<s.length;d++){let l=s[d];ln(l.owner??j(),()=>{W(n,l.thunk,l.anchor)})}return i}return D(o)?p(n,t,e,[o]):L(o)?$(n,t,e,o):p(n,t,e,String(o))}function M(n,t,e){for(let o=0;o<n.length;o++){let r=n[o];if(typeof r=="object"&&r!==null&&D(r)){t.push(r.anchor),e.push(r);continue}for(;typeof r=="function";)r=r();r==null||typeof r=="boolean"||(Array.isArray(r)?M(r,t,e):typeof r=="object"&&L(r)?t.push(r):t.push(document.createTextNode(String(r))))}}function T(n){let t=n.parentNode;t!==null&&t.removeChild(n)}function w(n){if(n!==null)if(Array.isArray(n))for(let t=0;t<n.length;t++)T(n[t]);else T(n);return null}function $(n,t,e,o){return e===o?o:e!==null&&!Array.isArray(e)?(n.replaceChild(o,e),o):(w(e),n.insertBefore(o,t),o)}function un(n,t,e,o){let r=0,i=0,s=e.length-1,d=o.length-1;for(;r<=s&&i<=d&&e[r]===o[i];)r++,i++;for(;r<=s&&i<=d&&e[s]===o[d];)s--,d--;let l=d+1<o.length?o[d+1]:t;if(r>s){for(let u=i;u<=d;u++)n.insertBefore(o[u],l);return}if(i>d){for(let u=r;u<=s;u++)n.removeChild(e[u]);return}let c=new Map;for(let u=r;u<=s;u++)c.set(e[u],u);let a=d-i+1,f=new Int32Array(a).fill(-1);for(let u=0;u<a;u++){let g=o[i+u],O=c.get(g);O!==void 0&&(f[u]=O,c.delete(g))}for(let u of c.keys())n.removeChild(u);let m=cn(f),b=m.length-1,S=l;for(let u=a-1;u>=0;u--){let g=o[i+u];b>=0&&m[b]===u?b--:n.insertBefore(g,S),S=g}}function cn(n){let t=n.length,e=new Int32Array(t).fill(-1),o=[];for(let s=0;s<t;s++){let d=n[s];if(d===-1)continue;let l=0,c=o.length;for(;l<c;){let a=l+c>>1;n[o[a]]<d?l=a+1:c=a}l>0&&(e[s]=o[l-1]),o[l]=s}let r=[],i=o.length>0?o[o.length-1]:-1;for(;i!==-1;)r.push(i),i=e[i];return r.reverse()}import{signal as an,createOwner as I,disposeOwner as fn,getOwner as F,handleError as V,setOwner as h,untrack as _}from"@firsthandjs/core";var z=Symbol.for("firsthand.component"),pn=0,B="firsthand";function zn(n){B=n}function Bn(n,t,e,o){let i=Object.assign(s=>mn(i,s),{[z]:!0,setup:n,options:t,id:e??`c${String(++pn)}`,tag:void 0});return Object.defineProperty(i,"name",{configurable:!0,value:o??(n.name===""?"Component":n.name)}),e===void 0&&(`${i.name}`,void 0),(t?.tag!==void 0||t?.shadow===!0)&&wn(i,typeof t.tag=="string"?t.tag:void 0),i}function Kn(n){return typeof n=="function"&&z in n}function mn(n,t){if(Object.freeze(t),n.setup===void 0)return v(n)(t);if(n.tag!==void 0)return bn(n,t);let e=I(F()),o=h(e);try{let r=_(()=>n.setup(t));return h(o),r}catch(r){return h(o),V(r,e),null}}function gn(n){let t=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return`${B}-${t}`}function wn(n,t){let e=n;if(e.tag!==void 0)return e.tag;let o=t??gn(e);return customElements.get(o)!==void 0&&(o=`${o}-${e.id.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}`),e.tag=o,customElements.define(o,hn(e)),o}function hn(n){let t=n.options?.shadow===!0,e=n.options?.attributes,o=e!==void 0?Object.keys(e):[];return class extends HTMLElement{static observedAttributes=o;constructor(){super(),this.$owner=null,this.$props=null,this.$attrs=null,this.$standalone=!1}connectedCallback(){this.$owner===null&&(this.$standalone=!0,this.$attrs={},this.$props=yn(this,e,this.$attrs),K(this,n,t))}disconnectedCallback(){!this.$standalone||this.$owner===null||(fn(this.$owner),this.$owner=null)}attributeChangedCallback(i,s,d){let l=this.$attrs?.[i];l!==void 0&&(l.value=e[i]?.(d))}}}function yn(n,t,e){let o={};if(t!==void 0)for(let r in t){let i=an(t[r](n.getAttribute(r)));e[r]=i,Object.defineProperty(o,r,{enumerable:!0,get:()=>i.value})}return Object.freeze(o)}function K(n,t,e){let o=I(F());n.$owner=o;let r=h(o);try{let i=e?n.attachShadow({mode:"open"}):n,s=_(()=>t.setup(n.$props));p(i,null,null,s)}catch(i){V(i,o)}finally{h(r)}}function bn(n,t){let e=document.createElement(n.tag);return e.$props=t,K(e,n,n.options?.shadow===!0),e}import{batch as kn,createOwner as q,disposeOwner as Cn,getOwner as xn,setOwner as E,signal as Z,untrack as Y}from"@firsthandjs/core";function Jn(n,t,e){let o=q(xn()),r=new Map;return()=>{let i=n(),s=new Map,d=[];return kn(()=>{for(let l=0;l<i.length;l++){let c=i[l],a=Y(()=>t(c,l));if(s.has(a)){`${String(a)}`;continue}let f=r.get(a);f===void 0?f=En(o,c,l,e):(r.delete(a),f.item.value=c,f.index.value=l),s.set(a,f);for(let m=0;m<f.nodes.length;m++)d.push(f.nodes[m])}for(let l of r.values())Cn(l.owner)}),r=s,d}}function En(n,t,e,o){let r=q(n),i=Z(t),s=Z(e),d=E(r),l;try{l=Y(()=>o(i,s)),E(d)}catch(a){throw E(d),a}let c=[];return G(l,c),{owner:r,item:i,index:s,nodes:c}}function G(n,t){if(!(n==null||typeof n=="boolean")){if(Array.isArray(n)){for(let e=0;e<n.length;e++)G(n[e],t);return}if(typeof n=="object"&&typeof n.nodeType=="number"){t.push(n);return}t.push(document.createTextNode(String(n)))}}var Rn=new Set(["click","dblclick","contextmenu","input","beforeinput","change","keydown","keyup","keypress","pointerdown","pointerup","pointermove","mousedown","mouseup","mouseover","mouseout","submit","focusin","focusout","touchstart","touchend"]),X=new Set;function R(n){return`$firsthand$${n}`}function Nn(n){let t=R(n.type),e=n.composedPath(),o=null;Object.defineProperty(n,"currentTarget",{configurable:!0,get:()=>o});for(let r=0;r<e.length;r++){let i=e[r],s=i[t];if(s!==void 0&&(o=i,s.call(i,n),n.cancelBubble)||i===document)break}o=null}function y(n,t,e,o){if(o!==void 0||!Rn.has(t)){n.addEventListener(t,e,o===!0?void 0:o);return}n[R(t)]=e,X.has(t)||(X.add(t),document.addEventListener(t,Nn))}function Un(n,t){n[R(t)]=void 0}var An={class:"className",for:"htmlFor"};function A(n,t,e){e==null||e===!1?n.removeAttribute(t):n.setAttribute(t,e===!0?"":String(e))}function ee(n,t,e,o){o==null||o===!1?n.removeAttributeNS(t,e):n.setAttributeNS(t,e,o===!0?"":String(o))}function P(n,t,e){n[An[t]??t]=e}function te(n,t,e){n[t]=!!e}function Q(n,t){t==null?n.removeAttribute("class"):n.className=String(t)}function U(n,t,e){let o=n.classList;if(e!==void 0)for(let r in e)r in t||o.remove(r);for(let r in t){let i=!!t[r];(e===void 0||!!e[r]!==i)&&o.toggle(r,i)}}function nn(n,t){t==null?n.style.cssText="":n.style.cssText=String(t)}function en(n,t,e){let o=n.style;if(e!==void 0)for(let r in e)r in t||o.removeProperty(N(r));for(let r in t){let i=t[r];(e===void 0||e[r]!==i)&&(i==null?o.removeProperty(N(r)):o.setProperty(N(r),String(i)))}}var Pn=/[A-Z]/g,J=new Map;function N(n){let t=J.get(n);return t===void 0&&(t=n.startsWith("--")?n:n.replace(Pn,e=>`-${e.toLowerCase()}`),J.set(n,t)),t}function Sn(n,t,e){if(t==="class"||t==="className"){e!==null&&typeof e=="object"?U(n,e,on(n,"class",e)):Q(n,e);return}if(t==="style"){e!==null&&typeof e=="object"?en(n,e,on(n,"style",e)):nn(n,e);return}if(t==="ref"){e(n);return}if(t.startsWith("prop:")){P(n,t.slice(5),e);return}if(t.startsWith("attr:")){A(n,t.slice(5),e);return}if(t.startsWith("on")&&t.length>2&&/[A-Z:]/.test(t[2])){On(n,t,e);return}if(t in n&&typeof e!="string"){P(n,t,e);return}A(n,t,e)}function On(n,t,e){let o=t.slice(2).split(":"),r=o[0]==="",i=r?o[1]:o[0].toLowerCase(),s=o[r?2:1];s===void 0?y(n,i,e):s==="native"?y(n,i,e,!0):y(n,i,e,{[s]:!0})}function se(n,t){for(let e in t)e!=="children"&&Sn(n,e,t[e])}function le(...n){let t={};for(let e=0;e<n.length;e++){let o=n[e];for(let r of Object.keys(o))Object.defineProperty(t,r,{enumerable:!0,configurable:!0,get:()=>o[r]})}return t}function de(n,t){let e={};for(let o of Object.keys(n))t.includes(o)||Object.defineProperty(e,o,{enumerable:!0,get:()=>n[o]});return Object.freeze(e)}var tn=new WeakMap;function on(n,t,e){let o=tn.get(n);o===void 0&&(o={},tn.set(n,o));let r=o[t];return o[t]=e,r}export{vn as a,x as b,Dn as c,W as d,p as e,un as f,z as g,zn as h,Bn as i,Kn as j,mn as k,wn as l,Jn as m,y as n,Un as o,A as p,ee as q,P as r,te as s,Q as t,U as u,nn as v,en as w,Sn as x,se as y,le as z,de as A};
|