@firsthandjs/dom 0.10.0 → 0.10.1

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/adapter.d.ts CHANGED
@@ -21,9 +21,6 @@ export type ComponentAdapter = (target: (props: never) => unknown) => Component<
21
21
  */
22
22
  export declare function setComponentAdapter(next: ComponentAdapter | null): void;
23
23
  /** Thrown for an element type this framework cannot run. */
24
- export declare class FirsthandComponentError extends Error {
25
- constructor(name: string);
26
- }
27
24
  /** Resolves a foreign element type, or says why it cannot be resolved. */
28
25
  export declare function adapt(target: object): Component<never>;
29
26
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC;AAcvF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAKvE;AAED,4DAA4D;AAC5D,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,IAAI,EAAE,MAAM;CAQzB;AAED,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAYtD"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,8EAA8E;AAC9E,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,KAAK,SAAS,CAAC,KAAK,CAAC,CAAC;AAcvF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAKvE;AAED,4DAA4D;AAE5D,0EAA0E;AAC1E,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAYtD"}
@@ -1 +1 @@
1
- import{b as E,f as P,g as x,h as T,i as f,j as v,l as O,m as $}from"./chunk-467WEPXM.js";var g=null,y=new WeakMap;function vn(n){g=n,y=new WeakMap}var h=class extends Error{constructor(e){super(`${e} 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 A(n){let e=y.get(n);if(e!==void 0)return e;if(g===null){let o=typeof n=="function"&&n.name!==""?n.name:"The value";throw new h(o)}let t=g(n);return y.set(n,t),t}import{signal as tn,createOwner as N,devEnterSetup as S,devExitSetup as p,disposeOwner as on,getOwner as j,handleError as L,setOwner as a,untrack as H}from"@firsthandjs/core";var M=Symbol.for("firsthand.component"),D=Symbol.for("firsthand.view"),rn=0,V="firsthand";function Hn(n){V=n}function Mn(n,e,t,o){let s=Object.assign(i=>sn(s,i),{[M]:!0,setup:n,options:e,id:t??`c${String(++rn)}`,tag:void 0});return Object.defineProperty(s,"name",{configurable:!0,value:o??(n.name===""?"Component":n.name)}),t===void 0&&(`${s.name}`,void 0),(e?.tag!==void 0||e?.shadow===!0)&&un(s,typeof e.tag=="string"?e.tag:void 0),s}function Dn(n){return typeof n=="function"&&M in n}function Vn(n){return n[D]=!0,n}function sn(n,e){if(Object.freeze(e),n.setup===void 0)return D in n?f(()=>n(e)):A(n)(e);if(n.tag!==void 0)return an(n,e);let t=N(j());n.name;let o=a(t);try{S(n.id);let r=H(()=>n.setup(e));return p(),a(o),r}catch(r){return p(),a(o),L(r,t),null}}function dn(n){let e=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return`${V}-${e}`}function un(n,e){let t=n;if(t.tag!==void 0)return t.tag;let o=e??dn(t);return customElements.get(o)!==void 0&&(o=`${o}-${t.id.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}`),t.tag=o,customElements.define(o,cn(t)),o}function cn(n){let e=n.options?.shadow===!0,t=n.options?.attributes,o=t!==void 0?Object.keys(t):[];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=ln(this,t,this.$attrs),F(this,n,e))}disconnectedCallback(){!this.$standalone||this.$owner===null||(on(this.$owner),this.$owner=null)}attributeChangedCallback(s,i,d){let u=this.$attrs?.[s];u!==void 0&&(u.value=t[s]?.(d))}}}function ln(n,e,t){let o={};if(e!==void 0)for(let r in e){let s=tn(e[r](n.getAttribute(r)));t[r]=s,Object.defineProperty(o,r,{enumerable:!0,get:()=>s.value})}return Object.freeze(o)}function F(n,e,t){let o=N(j());e.name,n.$owner=o;let r=a(o);try{S(e.id);let s=t?n.attachShadow({mode:"open"}):n,i=H(()=>e.setup(n.$props));p(),O(s,null,null,i)}catch(s){p(),L(s,o)}finally{a(r)}}function an(n,e){let t=document.createElement(n.tag);return t.$props=e,F(t,n,n.options?.shadow===!0),t}import{batch as fn,createOwner as z,disposeOwner as pn,getOwner as mn,setOwner as W,signal as I,untrack as K}from"@firsthandjs/core";function Bn(n,e,t){let o=z(mn()),r=new Map,s,i=!1;return()=>{i&&s!==void 0&&wn(s,r);let d=[];d[x]=!0;let u={items:n(),rows:r,next:new Map,nodes:d,host:o,keyOf:e,render:t,pending:void 0,views:i};K(()=>{fn(()=>{gn(u)})}),i=u.views,r=u.next,s=d;let c=u.pending;return c!==void 0&&(d[T]=l=>{for(let en of c)q(en,l)}),d}}function wn(n,e){n.length=0;for(let t of e.values())for(let o of t.pieces===void 0?t.nodes:B(t))n.push(o)}function gn(n){let{items:e,rows:t,next:o,nodes:r}=n;for(let s=0;s<e.length;s++){let i=e[s],d=n.keyOf(i,s);if(o.has(d)){`${String(d)}`;continue}let u=t.get(d)??yn(n,i,s);t.delete(d)&&(u.item.value=i,u.index.value=s),o.set(d,u);let c=u.pieces===void 0?u.nodes:B(u);for(let l=0;l<c.length;l++)r.push(c[l])}P(()=>{for(let s of t.values())pn(s.owner)})}function yn(n,e,t){let o=hn(n.host,e,t,n.render);return o.pieces!==void 0&&(n.views=!0,q(o,null)||(n.pending=n.pending===void 0?[o]:[...n.pending,o])),o}function Z(n){return typeof n.nodeType=="number"}function q(n,e){let t=n.pieces;for(let o of t){if(Z(o))continue;let r=e??E.current?.place(o.child.anchor)??null;if(r===null)return!1;$(o.child,r,s=>{o.nodes=s})}return!0}function B(n){let e=[];for(let t of n.pieces)if(Z(t))e.push(t);else for(let o of t.nodes)e.push(o);return e}function hn(n,e,t,o){let r=z(n),s=I(e),i=I(t),d=W(r),u=[],c;try{c=G(K(()=>o(s,i)),u)}finally{W(d)}return c?{owner:r,item:s,index:i,nodes:[],pieces:u}:{owner:r,item:s,index:i,nodes:u}}function G(n,e){if(n==null||typeof n=="boolean")return!1;if(Array.isArray(n)){let t=!1;for(let o=0;o<n.length;o++)t=G(n[o],e)||t;return t}if(typeof n=="function"){let t=f(n);return e.push({child:t,nodes:[t.anchor]}),!0}if(typeof n=="object"){if(v(n))return e.push({child:n,nodes:[n.anchor]}),!0;if(typeof n.nodeType=="number")return e.push(n),!1}return e.push(document.createTextNode(String(n))),!1}var bn=new Set(["click","dblclick","contextmenu","input","beforeinput","change","keydown","keyup","keypress","pointerdown","pointerup","pointermove","mousedown","mouseup","mouseover","mouseout","submit","focusin","focusout","touchstart","touchend"]),_=new Set;function m(n){return`$firsthand$${n}`}function kn(n){let e=m(n.type),t=n.composedPath(),o=null;Object.defineProperty(n,"currentTarget",{configurable:!0,get:()=>o});for(let r=0;r<t.length;r++){let s=t[r],i=s[e];if(i!==void 0&&(o=s,i.call(s,n),n.cancelBubble)||s===document)break}o=null}function w(n,e,t,o){if(o!==void 0||!bn.has(e)){let r=n,s=o===!0?void 0:o,i=`${m(e)}$${s===void 0?"":Object.keys(s).sort().join(",")}`,d=r[i];d!==void 0&&n.removeEventListener(e,d.handler,d.options),r[i]={handler:t,options:s},n.addEventListener(e,t,s);return}n[m(e)]=t,_.has(e)||(_.add(e),document.addEventListener(e,kn))}function _n(n,e){n[m(e)]=void 0}var Rn={class:"className",for:"htmlFor"};function k(n,e,t){t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,t===!0?"":String(t))}function Un(n,e,t,o){o==null||o===!1?n.removeAttributeNS(e,t):n.setAttributeNS(e,t,o===!0?"":String(o))}function R(n,e,t){n[Rn[e]??e]=t}function Xn(n,e,t){n[e]=!!t}function C(n,e){e==null?n.removeAttribute("class"):n.className=String(e)}function J(n,e,t){let o=n.classList;if(t!==void 0)for(let r in t)r in e||o.remove(r);for(let r in e){let s=!!e[r];(t===void 0||!!t[r]!==s)&&o.toggle(r,s)}}function Q(n,e){e==null?n.style.cssText="":n.style.cssText=String(e)}function U(n,e,t){let o=n.style;if(t!==void 0)for(let r in t)r in e||o.removeProperty(b(r));for(let r in e){let s=e[r];(t===void 0||t[r]!==s)&&(s==null?o.removeProperty(b(r)):o.setProperty(b(r),String(s)))}}var Cn=/[A-Z]/g,Y=new Map;function b(n){let e=Y.get(n);return e===void 0&&(e=n.startsWith("--")?n:n.replace(Cn,t=>`-${t.toLowerCase()}`),Y.set(n,e)),e}function En(n,e,t){if(e==="class"||e==="className"){Pn(n,t);return}if(e==="style"){xn(n,t);return}if(e==="ref"){t(n);return}if(e.startsWith("prop:")){R(n,e.slice(5),t);return}if(e.startsWith("attr:")){k(n,e.slice(5),t);return}if(e.startsWith("on")&&e.length>2&&/[A-Z:]/.test(e[2])){Tn(n,e,t);return}if(e in n&&typeof t!="string"){R(n,e,t);return}k(n,e,t)}function Pn(n,e){if(Array.isArray(e)){C(n,e.filter(Boolean).join(" "));return}if(e!==null&&typeof e=="object"){J(n,e,nn(n,"class",e));return}C(n,e)}function xn(n,e){let t=n;if(e!==null&&typeof e=="object"){U(t,e,nn(n,"style",e));return}Q(t,e)}function Tn(n,e,t){let o=e.slice(2).split(":"),r=o[0]==="",s=r?o[1]:o[0].toLowerCase(),i=o[r?2:1];i===void 0?w(n,s,t):i==="native"?w(n,s,t,!0):w(n,s,t,{[i]:!0})}function oe(n,e){for(let t in e)t!=="children"&&En(n,t,e[t])}function re(...n){let e={};for(let t=0;t<n.length;t++){let o=n[t];for(let r of Object.keys(o))Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>o[r]})}return e}function se(n,e){let t={};for(let o of Object.keys(n))e.includes(o)||Object.defineProperty(t,o,{enumerable:!0,get:()=>n[o]});return Object.freeze(t)}var X=new WeakMap;function nn(n,e,t){let o=X.get(n);o===void 0&&(o={},X.set(n,o));let r=o[e];return o[e]=t,r}export{vn as a,h as b,M as c,D as d,Hn as e,Mn as f,Dn as g,Vn as h,sn as i,un as j,Bn as k,w as l,_n as m,k as n,Un as o,R as p,Xn as q,C as r,J as s,Q as t,U as u,En as v,oe as w,re as x,se as y};
1
+ import{b as E,f as P,g as x,h as T,i as f,j as v,l as O,m as $}from"./chunk-467WEPXM.js";var p=class extends Error{constructor(e){super(`${e} 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"}};var y=null,h=new WeakMap;function $n(n){y=n,h=new WeakMap}function A(n){let e=h.get(n);if(e!==void 0)return e;if(y===null){let o=typeof n=="function"&&n.name!==""?n.name:"The value";throw new p(o)}let t=y(n);return h.set(n,t),t}import{signal as tn,createOwner as N,devEnterSetup as S,devExitSetup as m,disposeOwner as on,getOwner as j,handleError as L,setOwner as a,untrack as H}from"@firsthandjs/core";var M=Symbol.for("firsthand.component"),D=Symbol.for("firsthand.view"),rn=0,F="firsthand";function Dn(n){F=n}function Fn(n,e,t,o){let s=Object.assign(i=>sn(s,i),{[M]:!0,setup:n,options:e,id:t??`c${String(++rn)}`,tag:void 0});return Object.defineProperty(s,"name",{configurable:!0,value:o??(n.name===""?"Component":n.name)}),t===void 0&&(`${s.name}`,void 0),(e?.tag!==void 0||e?.shadow===!0)&&un(s,typeof e.tag=="string"?e.tag:void 0),s}function Vn(n){return typeof n=="function"&&M in n}function Wn(n){return n[D]=!0,n}function sn(n,e){if(Object.freeze(e),n.setup===void 0)return D in n?f(()=>n(e)):A(n)(e);if(n.tag!==void 0)return an(n,e);let t=N(j());n.name;let o=a(t);try{S(n.id);let r=H(()=>n.setup(e));return m(),a(o),r}catch(r){return m(),a(o),L(r,t),null}}function dn(n){let e=n.name.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[^a-zA-Z0-9-]/g,"-").toLowerCase();return`${F}-${e}`}function un(n,e){let t=n;if(t.tag!==void 0)return t.tag;let o=e??dn(t);return customElements.get(o)!==void 0&&(o=`${o}-${t.id.replace(/[^a-zA-Z0-9]/g,"").toLowerCase()}`),t.tag=o,customElements.define(o,cn(t)),o}function cn(n){let e=n.options?.shadow===!0,t=n.options?.attributes,o=t!==void 0?Object.keys(t):[];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=ln(this,t,this.$attrs),V(this,n,e))}disconnectedCallback(){!this.$standalone||this.$owner===null||(on(this.$owner),this.$owner=null)}attributeChangedCallback(s,i,d){let u=this.$attrs?.[s];u!==void 0&&(u.value=t[s]?.(d))}}}function ln(n,e,t){let o={};if(e!==void 0)for(let r in e){let s=tn(e[r](n.getAttribute(r)));t[r]=s,Object.defineProperty(o,r,{enumerable:!0,get:()=>s.value})}return Object.freeze(o)}function V(n,e,t){let o=N(j());e.name,n.$owner=o;let r=a(o);try{S(e.id);let s=t?n.attachShadow({mode:"open"}):n,i=H(()=>e.setup(n.$props));m(),O(s,null,null,i)}catch(s){m(),L(s,o)}finally{a(r)}}function an(n,e){let t=document.createElement(n.tag);return t.$props=e,V(t,n,n.options?.shadow===!0),t}import{batch as fn,createOwner as z,disposeOwner as pn,getOwner as mn,setOwner as W,signal as I,untrack as K}from"@firsthandjs/core";function _n(n,e,t){let o=z(mn()),r=new Map,s,i=!1;return()=>{i&&s!==void 0&&wn(s,r);let d=[];d[x]=!0;let u={items:n(),rows:r,next:new Map,nodes:d,host:o,keyOf:e,render:t,pending:void 0,views:i};K(()=>{fn(()=>{gn(u)})}),i=u.views,r=u.next,s=d;let c=u.pending;return c!==void 0&&(d[T]=l=>{for(let en of c)q(en,l)}),d}}function wn(n,e){n.length=0;for(let t of e.values())for(let o of t.pieces===void 0?t.nodes:B(t))n.push(o)}function gn(n){let{items:e,rows:t,next:o,nodes:r}=n;for(let s=0;s<e.length;s++){let i=e[s],d=n.keyOf(i,s);if(o.has(d)){`${String(d)}`;continue}let u=t.get(d)??yn(n,i,s);t.delete(d)&&(u.item.value=i,u.index.value=s),o.set(d,u);let c=u.pieces===void 0?u.nodes:B(u);for(let l=0;l<c.length;l++)r.push(c[l])}P(()=>{for(let s of t.values())pn(s.owner)})}function yn(n,e,t){let o=hn(n.host,e,t,n.render);return o.pieces!==void 0&&(n.views=!0,q(o,null)||(n.pending=n.pending===void 0?[o]:[...n.pending,o])),o}function Z(n){return typeof n.nodeType=="number"}function q(n,e){let t=n.pieces;for(let o of t){if(Z(o))continue;let r=e??E.current?.place(o.child.anchor)??null;if(r===null)return!1;$(o.child,r,s=>{o.nodes=s})}return!0}function B(n){let e=[];for(let t of n.pieces)if(Z(t))e.push(t);else for(let o of t.nodes)e.push(o);return e}function hn(n,e,t,o){let r=z(n),s=I(e),i=I(t),d=W(r),u=[],c;try{c=G(K(()=>o(s,i)),u)}finally{W(d)}return c?{owner:r,item:s,index:i,nodes:[],pieces:u}:{owner:r,item:s,index:i,nodes:u}}function G(n,e){if(n==null||typeof n=="boolean")return!1;if(Array.isArray(n)){let t=!1;for(let o=0;o<n.length;o++)t=G(n[o],e)||t;return t}if(typeof n=="function"){let t=f(n);return e.push({child:t,nodes:[t.anchor]}),!0}if(typeof n=="object"){if(v(n))return e.push({child:n,nodes:[n.anchor]}),!0;if(typeof n.nodeType=="number")return e.push(n),!1}return e.push(document.createTextNode(String(n))),!1}var bn=new Set(["click","dblclick","contextmenu","input","beforeinput","change","keydown","keyup","keypress","pointerdown","pointerup","pointermove","mousedown","mouseup","mouseover","mouseout","submit","focusin","focusout","touchstart","touchend"]),_=new Set;function w(n){return`$firsthand$${n}`}function kn(n){let e=w(n.type),t=n.composedPath(),o=null;Object.defineProperty(n,"currentTarget",{configurable:!0,get:()=>o});for(let r=0;r<t.length;r++){let s=t[r],i=s[e];if(i!==void 0&&(o=s,i.call(s,n),n.cancelBubble)||s===document)break}o=null}function g(n,e,t,o){if(o!==void 0||!bn.has(e)){let r=n,s=o===!0?void 0:o,i=`${w(e)}$${s===void 0?"":Object.keys(s).sort().join(",")}`,d=r[i];d!==void 0&&n.removeEventListener(e,d.handler,d.options),r[i]={handler:t,options:s},n.addEventListener(e,t,s);return}n[w(e)]=t,_.has(e)||(_.add(e),document.addEventListener(e,kn))}function Jn(n,e){n[w(e)]=void 0}var Rn={class:"className",for:"htmlFor"};function k(n,e,t){t==null||t===!1?n.removeAttribute(e):n.setAttribute(e,t===!0?"":String(t))}function ne(n,e,t,o){o==null||o===!1?n.removeAttributeNS(e,t):n.setAttributeNS(e,t,o===!0?"":String(o))}function R(n,e,t){n[Rn[e]??e]=t}function ee(n,e,t){n[e]=!!t}function C(n,e){e==null?n.removeAttribute("class"):n.className=String(e)}function J(n,e,t){let o=n.classList;if(t!==void 0)for(let r in t)r in e||o.remove(r);for(let r in e){let s=!!e[r];(t===void 0||!!t[r]!==s)&&o.toggle(r,s)}}function Q(n,e){e==null?n.style.cssText="":n.style.cssText=String(e)}function U(n,e,t){let o=n.style;if(t!==void 0)for(let r in t)r in e||o.removeProperty(b(r));for(let r in e){let s=e[r];(t===void 0||t[r]!==s)&&(s==null?o.removeProperty(b(r)):o.setProperty(b(r),String(s)))}}var Cn=/[A-Z]/g,Y=new Map;function b(n){let e=Y.get(n);return e===void 0&&(e=n.startsWith("--")?n:n.replace(Cn,t=>`-${t.toLowerCase()}`),Y.set(n,e)),e}function En(n,e,t){if(e==="class"||e==="className"){Pn(n,t);return}if(e==="style"){xn(n,t);return}if(e==="ref"){t(n);return}if(e.startsWith("prop:")){R(n,e.slice(5),t);return}if(e.startsWith("attr:")){k(n,e.slice(5),t);return}if(e.startsWith("on")&&e.length>2&&/[A-Z:]/.test(e[2])){Tn(n,e,t);return}if(e in n&&typeof t!="string"){R(n,e,t);return}k(n,e,t)}function Pn(n,e){if(Array.isArray(e)){C(n,e.filter(Boolean).join(" "));return}if(e!==null&&typeof e=="object"){J(n,e,nn(n,"class",e));return}C(n,e)}function xn(n,e){let t=n;if(e!==null&&typeof e=="object"){U(t,e,nn(n,"style",e));return}Q(t,e)}function Tn(n,e,t){let o=e.slice(2).split(":"),r=o[0]==="",s=r?o[1]:o[0].toLowerCase(),i=o[r?2:1];i===void 0?g(n,s,t):i==="native"?g(n,s,t,!0):g(n,s,t,{[i]:!0})}function se(n,e){for(let t in e)t!=="children"&&En(n,t,e[t])}function ie(...n){let e={};for(let t=0;t<n.length;t++){let o=n[t];for(let r of Object.keys(o))Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>o[r]})}return e}function de(n,e){let t={};for(let o of Object.keys(n))e.includes(o)||Object.defineProperty(t,o,{enumerable:!0,get:()=>n[o]});return Object.freeze(t)}var X=new WeakMap;function nn(n,e,t){let o=X.get(n);o===void 0&&(o={},X.set(n,o));let r=o[e];return o[e]=t,r}export{p as a,$n as b,M as c,D as d,Dn as e,Fn as f,Vn as g,Wn as h,sn as i,un as j,_n as k,g as l,Jn as m,k as n,ne as o,R as p,ee as q,C as r,J as s,Q as t,U as u,En as v,se as w,ie as x,de as y};
@@ -13,13 +13,7 @@ import {
13
13
  part
14
14
  } from "./dev-chunk-U46CIJCO.js";
15
15
 
16
- // packages/dom/src/adapter.ts
17
- var adapter = null;
18
- var adapted = /* @__PURE__ */ new WeakMap();
19
- function setComponentAdapter(next) {
20
- adapter = next;
21
- adapted = /* @__PURE__ */ new WeakMap();
22
- }
16
+ // packages/dom/src/errors.ts
23
17
  var FirsthandComponentError = class extends Error {
24
18
  constructor(name) {
25
19
  super(
@@ -28,6 +22,14 @@ var FirsthandComponentError = class extends Error {
28
22
  this.name = "FirsthandComponentError";
29
23
  }
30
24
  };
25
+
26
+ // packages/dom/src/adapter.ts
27
+ var adapter = null;
28
+ var adapted = /* @__PURE__ */ new WeakMap();
29
+ function setComponentAdapter(next) {
30
+ adapter = next;
31
+ adapted = /* @__PURE__ */ new WeakMap();
32
+ }
31
33
  function adapt(target) {
32
34
  const existing = adapted.get(target);
33
35
  if (existing !== void 0) {
@@ -671,8 +673,8 @@ function remember(node, slot, value) {
671
673
  }
672
674
 
673
675
  export {
674
- setComponentAdapter,
675
676
  FirsthandComponentError,
677
+ setComponentAdapter,
676
678
  COMPONENT,
677
679
  VIEW,
678
680
  setElementPrefix,
@@ -0,0 +1,11 @@
1
+ /**
2
+ * What `@firsthandjs/dom` throws.
3
+ *
4
+ * Its own file so that the adapter is about resolving a foreign element type
5
+ * and nothing else. Prefixed like every other error in this project, so that
6
+ * `instanceof` cannot be confused by a `ComponentError` from somewhere else.
7
+ */
8
+ export declare class FirsthandComponentError extends Error {
9
+ constructor(name: string);
10
+ }
11
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qBAAa,uBAAwB,SAAQ,KAAK;gBACpC,IAAI,EAAE,MAAM;CAQzB"}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,8 @@
4
4
  * Re-exports the reactive core so that applications have one import site.
5
5
  */
6
6
  export { component, defineElement, setElementPrefix, createComponent, view } from './component.js';
7
- export { setComponentAdapter, FirsthandComponentError } from './adapter.js';
7
+ export { setComponentAdapter } from './adapter.js';
8
+ export { FirsthandComponentError } from './errors.js';
8
9
  export type { ComponentAdapter } from './adapter.js';
9
10
  export type { Component, ComponentOptions, AttributeCodec, View, Render } from './component.js';
10
11
  export { render } from './render.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,MAAM,GACP,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACnG,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACtD,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,aAAa,EACb,OAAO,EACP,UAAU,EACV,qBAAqB,EACrB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,WAAW,EACX,OAAO,EACP,YAAY,EACZ,OAAO,EACP,YAAY,EACZ,aAAa,EACb,MAAM,GACP,MAAM,mBAAmB,CAAC"}
package/dist/index.dev.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  setComponentAdapter,
11
11
  setElementPrefix,
12
12
  view
13
- } from "./dev-chunk-O5KFGWVZ.js";
13
+ } from "./dev-chunk-HLMVSIC4.js";
14
14
  import {
15
15
  render
16
16
  } from "./dev-chunk-KJHYMOKB.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{a as d,b as i,e as f,f as s,h as a,i as m,j as l,k as x,l as C,m as h,x as y}from"./chunk-J5525WK6.js";import{a as c}from"./chunk-YX6HJXS6.js";import"./chunk-467WEPXM.js";import{onCleanup as u}from"@firsthandjs/core";function N(e,t){let o=[];p(e,o);for(let r=0;r<o.length;r++)t.appendChild(o[r]);return u(()=>{for(let r=0;r<o.length;r++){let n=o[r];n.parentNode?.removeChild(n)}}),null}function p(e,t){if(!(e==null||typeof e=="boolean")){if(Array.isArray(e)){for(let o=0;o<e.length;o++)p(e[o],t);return}if(typeof e=="object"&&typeof e.nodeType=="number"){t.push(e);return}t.push(document.createTextNode(String(e)))}}import{signal as D,computed as S,effect as T,batch as V,untrack as W,onCleanup as q,createRoot as z,catchError as B,runWithOwner as G,createContext as H,provide as I,useContext as J,FirsthandContextError as K,FirsthandCycleError as L,FirsthandReadonlyError as M}from"@firsthandjs/core";export{i as FirsthandComponentError,K as FirsthandContextError,L as FirsthandCycleError,M as FirsthandReadonlyError,V as batch,B as catchError,s as component,S as computed,m as createComponent,H as createContext,z as createRoot,l as defineElement,T as effect,x as list,y as mergeProps,h as off,C as on,q as onCleanup,N as portal,I as provide,c as render,G as runWithOwner,d as setComponentAdapter,f as setElementPrefix,D as signal,W as untrack,J as useContext,a as view};
1
+ import{a as d,b as i,e as f,f as s,h as m,i as a,j as l,k as x,l as C,m as h,x as y}from"./chunk-MWEKNBIC.js";import{a as c}from"./chunk-YX6HJXS6.js";import"./chunk-467WEPXM.js";import{onCleanup as u}from"@firsthandjs/core";function N(e,t){let o=[];p(e,o);for(let r=0;r<o.length;r++)t.appendChild(o[r]);return u(()=>{for(let r=0;r<o.length;r++){let n=o[r];n.parentNode?.removeChild(n)}}),null}function p(e,t){if(!(e==null||typeof e=="boolean")){if(Array.isArray(e)){for(let o=0;o<e.length;o++)p(e[o],t);return}if(typeof e=="object"&&typeof e.nodeType=="number"){t.push(e);return}t.push(document.createTextNode(String(e)))}}import{signal as S,computed as T,effect as V,batch as W,untrack as q,onCleanup as z,createRoot as B,catchError as G,runWithOwner as H,createContext as I,provide as J,useContext as K,FirsthandContextError as L,FirsthandCycleError as M,FirsthandReadonlyError as Q}from"@firsthandjs/core";export{d as FirsthandComponentError,L as FirsthandContextError,M as FirsthandCycleError,Q as FirsthandReadonlyError,W as batch,G as catchError,s as component,T as computed,a as createComponent,I as createContext,B as createRoot,l as defineElement,V as effect,x as list,y as mergeProps,h as off,C as on,z as onCleanup,N as portal,J as provide,c as render,H as runWithOwner,i as setComponentAdapter,f as setElementPrefix,S as signal,q as untrack,K as useContext,m as view};
@@ -19,7 +19,7 @@ import {
19
19
  setStyleObject,
20
20
  spread,
21
21
  view
22
- } from "./dev-chunk-O5KFGWVZ.js";
22
+ } from "./dev-chunk-HLMVSIC4.js";
23
23
  import {
24
24
  applyChild,
25
25
  devHandedNewFunction,
package/dist/internal.js CHANGED
@@ -1 +1 @@
1
- import{c as h,d as b,g as N,h as C,i as O,k as T,l as k,m as j,n as E,o as P,p as F,q as H,r as L,s as M,t as R,u as A,v as D,w as I,x as V,y as W}from"./chunk-J5525WK6.js";import{a as x,b as l,c as w,d as y,e as S,i as g,j as a,k as f,l as s}from"./chunk-467WEPXM.js";function q(e,i=!1){let r,n;return()=>{let o=l.current;if(o!==null){n??=o.tag(e);let t=o.adopt(n);if(t!==null)return t}if(r===void 0){let t=document.createElement("template");t.innerHTML=e,r=i?t.content:t.content.firstChild}return r.cloneNode(!0)}}function B(e,...i){let r=e;for(let n=0;n<i.length;n++){let o=r.firstChild;for(let t=i[n];t>0;t--)o=o.nextSibling;r=o}return r}import{createOwner as _,disposeOwner as z,getOwner as G,runWithOwner as J,setOwner as m,signal as K}from"@firsthandjs/core";function Q(e=""){return{slots:[],owner:G(),generation:0,name:e}}function d(e){e.busy=!0}function p(e,i){let r=e.slots[i];if(r!==void 0)return r.seen=e.generation,r;let n={seen:e.generation};return e.slots[i]=n,n}function U(e,i){let r=_(e.owner);return i.owner=r,m(r)}function X(e){m(e)}function Y(e,i){let r=e.generation,n=e.slots;for(let o=0;o<n.length;o++){let t=n[o];t===void 0||t.seen===r||(t.owner!==void 0&&z(t.owner),n[o]=void 0)}return e.generation=r+1,i}function Z(e,i,r){let n=p(e,i),o=n.cell;if(o===void 0){let t=K(r);return n.cell=t,t}return o.peek()!==r&&(d(e),o.value=r),o}function $(e,i,r,n,o){let t=p(e,i);if(t.node===void 0&&l.current!==null&&v(t,r,n,o))return;let c=typeof o;if(c==="string"||c==="number"){let u=String(o);if(u===t.text)return;d(e),t.text=u,t.node=s(r,n,t.node??null,u);return}t.text=void 0,o!==t.last&&(d(e),t.last=o,t.node=s(r,n,t.node??null,o))}function v(e,i,r,n){let o=l.current.claim(i,r);return o===null?!1:typeof n=="object"&&n!==null&&a(n)?(e.last=n,l.current.keep(e,i,n.anchor,o),J(n.owner,()=>{f(i,n.thunk,n.anchor)}),!0):(e.node=o.nodes,e.text=o.text,!1)}import{bind as Ne}from"@firsthandjs/core";var pe=1;export{h as COMPONENT,pe as PROTOCOL_VERSION,b as VIEW,s as applyChild,D as applyProp,Ne as bind,Z as cell,X as close,O as createComponent,w as first,f as insert,N as isComponent,x as label,T as list,V as mergeProps,y as next,j as off,k as on,U as open,g as part,B as path,Y as ran,S as reconcile,W as rest,E as setAttribute,P as setAttributeNS,H as setBoolean,L as setClass,M as setClassList,F as setProperty,R as setStyle,A as setStyleObject,p as site,I as spread,Q as store,q as template,C as view,$ as writeChild,d as wrote};
1
+ import{c as h,d as b,g as N,h as C,i as O,k as T,l as k,m as j,n as E,o as P,p as F,q as H,r as L,s as M,t as R,u as A,v as D,w as I,x as V,y as W}from"./chunk-MWEKNBIC.js";import{a as x,b as l,c as w,d as y,e as S,i as g,j as a,k as f,l as s}from"./chunk-467WEPXM.js";function q(e,i=!1){let r,n;return()=>{let o=l.current;if(o!==null){n??=o.tag(e);let t=o.adopt(n);if(t!==null)return t}if(r===void 0){let t=document.createElement("template");t.innerHTML=e,r=i?t.content:t.content.firstChild}return r.cloneNode(!0)}}function B(e,...i){let r=e;for(let n=0;n<i.length;n++){let o=r.firstChild;for(let t=i[n];t>0;t--)o=o.nextSibling;r=o}return r}import{createOwner as _,disposeOwner as z,getOwner as G,runWithOwner as J,setOwner as m,signal as K}from"@firsthandjs/core";function Q(e=""){return{slots:[],owner:G(),generation:0,name:e}}function d(e){e.busy=!0}function p(e,i){let r=e.slots[i];if(r!==void 0)return r.seen=e.generation,r;let n={seen:e.generation};return e.slots[i]=n,n}function U(e,i){let r=_(e.owner);return i.owner=r,m(r)}function X(e){m(e)}function Y(e,i){let r=e.generation,n=e.slots;for(let o=0;o<n.length;o++){let t=n[o];t===void 0||t.seen===r||(t.owner!==void 0&&z(t.owner),n[o]=void 0)}return e.generation=r+1,i}function Z(e,i,r){let n=p(e,i),o=n.cell;if(o===void 0){let t=K(r);return n.cell=t,t}return o.peek()!==r&&(d(e),o.value=r),o}function $(e,i,r,n,o){let t=p(e,i);if(t.node===void 0&&l.current!==null&&v(t,r,n,o))return;let c=typeof o;if(c==="string"||c==="number"){let u=String(o);if(u===t.text)return;d(e),t.text=u,t.node=s(r,n,t.node??null,u);return}t.text=void 0,o!==t.last&&(d(e),t.last=o,t.node=s(r,n,t.node??null,o))}function v(e,i,r,n){let o=l.current.claim(i,r);return o===null?!1:typeof n=="object"&&n!==null&&a(n)?(e.last=n,l.current.keep(e,i,n.anchor,o),J(n.owner,()=>{f(i,n.thunk,n.anchor)}),!0):(e.node=o.nodes,e.text=o.text,!1)}import{bind as Ne}from"@firsthandjs/core";var pe=1;export{h as COMPONENT,pe as PROTOCOL_VERSION,b as VIEW,s as applyChild,D as applyProp,Ne as bind,Z as cell,X as close,O as createComponent,w as first,f as insert,N as isComponent,x as label,T as list,V as mergeProps,y as next,j as off,k as on,U as open,g as part,B as path,Y as ran,S as reconcile,W as rest,E as setAttribute,P as setAttributeNS,H as setBoolean,L as setClass,M as setClassList,F as setProperty,R as setStyle,A as setStyleObject,p as site,I as spread,Q as store,q as template,C as view,$ as writeChild,d as wrote};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firsthandjs/dom",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "DOM parts, templates, components, portals and keyed lists for Firsthand.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "LICENSE"
31
31
  ],
32
32
  "dependencies": {
33
- "@firsthandjs/core": "0.10.0"
33
+ "@firsthandjs/core": "0.10.1"
34
34
  },
35
35
  "engines": {
36
36
  "node": ">=20.11.0"