@yak/solid 0.2.1 → 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/README.md CHANGED
@@ -132,7 +132,7 @@ Like `next-yak`, the yak SWC compiler extracts your CSS at build time. At runtim
132
132
 
133
133
  ## Requirements
134
134
 
135
- - `solid-js` >= 2.0.0-rc.6 and `@solidjs/web` >= 2.0.0-rc.6
135
+ - `solid-js` >= 2.0.0-rc.10 and `@solidjs/web` >= 2.0.0-rc.10
136
136
  - `@solidjs/vite-plugin` >= 3.0.0-next (the Solid 2 line, npm tag `next`)
137
137
  - `yak-swc` with yak-package auto-detection (bundled as a dependency, version released together with this package or newer)
138
138
 
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{YakThemeContext as e,YakThemeProvider as t,useTheme as n,useTheme as r}from"@yak/solid/context";import{$PROXY as i,createMemo as a}from"solid-js";import{ChildProperties as o,DOMWithState as s,MathMLElements as c,SVGElements as l,createComponent as u,escape as d,getNextElement as f,insert as p,isServer as m,runHydrationEvents as h,spread as g,ssr as _,ssrClassName as v,ssrHydrationKey as y,ssrStyle as b,template as x}from"@solidjs/web";const S=Symbol.for(`@yak/solid:component`);var C=class{value;generated=!0;constructor(e){this.value=e||``}add(e,t=!0){t||(this.generated=!1),this.value?this.has(e)||(this.value+=` `+e):this.value=e}has(e){return(` `+this.value+` `).includes(` `+e+` `)}delete(e){this.has(e)&&(this.value=this.value.split(` `).filter(t=>t!==e).join(` `))}};function w(...e){let t,n=[];for(let r of e)typeof r==`string`?t=r:typeof r==`function`?n.push(r):typeof r==`object`&&`style`in r&&n.push((e,t,n)=>{for(let t in r.style){let i=r.style[t];n[t]=String(typeof i==`function`?E(e,i):i)}});return n.length===0?Object.assign((e,n)=>{t&&n.add(t)},{$dynamic:!1}):Object.assign((e,r,i)=>{t&&r.add(t);for(let t=0;t<n.length;t++)T(e,n[t],r,i)},{$dynamic:!0})}const T=(e,t,n,r)=>{let i=t(e,n,r);for(;i;){if(typeof i==`function`){i=i(e,n,r);continue}if(typeof i==`object`){let e=`class`in i?i.class:void 0;if(e&&n.add(e),`style`in i&&i.style)for(let e in i.style)r[e]=i.style[e]}break}},E=(e,t)=>{let n=t(e);if(typeof n==`function`)return E(e,n);if(typeof n!=`string`&&typeof n!=`number`&&!(n instanceof String)&&process.env.NODE_ENV===`development`)throw Error(`Dynamic CSS functions must return a string or number but returned ${JSON.stringify(n)}\n\nDynamic CSS function: ${t.toString()}\n`);return n},ee=(...e)=>{let t=[],n=[];for(let r of e)typeof r==`string`?t.push(...r.split(` `)):typeof r==`function`&&n.push(r);return w(...t.length>0?[(e,n)=>{t.forEach(e=>n.add(e,!1))},...n]:n)},te=(e,...t)=>{if(Array.isArray(e)&&`raw`in e){let n=e[0];for(let r=0;r<t.length;r++){let i=t[r];n+=i&&typeof i==`object`&&`__yak`in i?i.__yak:String(i),n+=e[r+1]}return{__yak:n}}let n=[];for(let e of t)typeof e==`function`&&n.push(e);return n.length===0?{class:``,style:void 0}:(e=>{for(let t=0;t<n.length;t++)D(e,n[t]);return{class:``,style:void 0}})};function D(e,t){let n=new Set,r={},i=t(e,n,r);for(;typeof i==`function`;)i=i(e,n,r);return i}const O=(e,...t)=>``,k=e=>e?typeof e==`string`?e:Array.isArray(e)?e.map(k).filter(Boolean).join(` `):typeof e==`object`?Object.keys(e).filter(t=>e[t]).join(` `):String(e):``,A=(e,t)=>{let n=k(t);return e?n?e+` `+n:e:n||void 0},j=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,ne=e=>Object.assign(M(e),{attrs:t=>M(e,t)}),M=(e,t)=>{let[n,r,i]=typeof e==`function`&&e[S]!==void 0?e[S]:[],a=i??e,o=oe(t,n);return(e,...t)=>{let n=w(e,...t),i=se(n,r),s=typeof a==`string`,c=s&&o&&typeof o!=`function`&&re(a,o)?o:void 0,l=c?ie(c):``,u=le(a,l),d=(!o||!!c)&&!i.$dynamic,f=e=>typeof e!=`string`||e.charCodeAt(0)===36||e===`class`||e===`theme`||!d&&e===`style`||c!==void 0&&Object.hasOwn(c,e),p=d?L(s?a:void 0,u,i,f,l):z(u,typeof o==`function`?o:o&&(()=>o),i,f,!!c),m=[o,i,a];return Object.assign(p,{[S]:m})}},re=(e,t)=>{let n=s[e.toUpperCase()];return Object.getOwnPropertyNames(t).every(e=>{let r=Object.getOwnPropertyDescriptor(t,e);if(!r.enumerable||!(`value`in r))return!1;let i=typeof r.value;return(i===`string`||i===`number`||i===`boolean`||r.value==null)&&ae.test(e)&&e.charCodeAt(0)!==36&&e!==`class`&&e!==`style`&&e!==`theme`&&e!==`ref`&&!o.has(e)&&!e.startsWith(`on`)&&!e.startsWith(`prop:`)&&!(n&&e in n)})},ie=e=>{let t=``;for(let n of Object.keys(e)){let r=e[n];r!=null&&r!==!1&&(t+=r===!0||r===``?` ${n}`:` ${n}="${N(String(r))}"`)}return t},N=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`),ae=/^[A-Za-z_:][\w:.-]*$/,oe=(e,t)=>{if(!e)return t;if(!t)return e;if(typeof e!=`function`&&typeof t!=`function`&&!I(e)&&!I(t))return P(t,e);let n=typeof e==`function`?e:()=>e,r=typeof t==`function`?t:()=>t;return e=>{let t=r(e);return P(t,n(P(e,t)))}},se=(e,t)=>t?Object.assign((n,r,i)=>{t(n,r,i),e(n,r,i)},{$dynamic:e.$dynamic||t.$dynamic}):e,P=(e,t)=>{if(!t)return e;let n={...Object.getOwnPropertyDescriptors(e),...Object.getOwnPropertyDescriptors(t)};return t.class&&e.class!==t.class&&(n.class=F(A(k(e.class),t.class))),t.style&&e.style!==t.style&&(n.style=F({...G(e.style),...G(t.style)})),Object.defineProperties({},n)},F=e=>({value:e,enumerable:!0,configurable:!0,writable:!0}),I=e=>{for(let t of Object.getOwnPropertyNames(e))if(!(`value`in Object.getOwnPropertyDescriptor(e,t)))return!0;return!1},L=(e,t,n,r,a)=>{let o=new C;n(void 0,o);let s=o.value||void 0,c=e=>{let t=k(e.class);if(!t)return s;let r=new C(t);return n(e,r),r.value||void 0},l=e&&!j.test(e)?R(e,s,a):void 0,u={skip:r,compute:void 0,classOf:c,attrsAddKeys:!1,unescapedClass:o.generated?s:void 0};return e=>{if(l&&(m||!(i in e))){let t=Object.keys(e);if(!t.length||t.length===1&&t[0]===`children`)return l(e,t.length!==0)}return t(e,u)}},R=(e,t,n)=>{if(m){let r=`<${e}${n}`,i=`${t?` class="${v(t)}"`:``}>`,a=`</${e}>`,o=[r,i,a],s=e===`script`||e===`style`;return(e,t)=>{let n=y(),c=t?s?e.children:d(e.children):void 0,l=q(c);return l===void 0?_(o,n,c):{t:`${r}${n}${i}${l}${a}`}}}let r=X(e,n,t);return(e,t)=>{let n=f(r);if(t){let t=Object.getOwnPropertyDescriptor(e,`children`);t&&`value`in t?p(n,t.value):p(n,()=>e.children)}return h(),n}},z=(e,t,n,i,o)=>s=>{let c=r(),l=H(s,c),u=()=>B(s,l,t,n),d=m?W(u):a(u,{transparent:!0}),f=t&&(()=>{let e=d().attrs;return!!e&&`theme`in e&&e.theme!==c});return e(s,{skip:f?e=>e===`theme`?!f():i(e):i,compute:d,classOf:void 0,attrsAddKeys:!!t&&!o,unescapedClass:void 0})},B=(e,t,n,r)=>{let i=n?.(t),a=k(e.class),o=new C(a),s=k(i?.class);s&&o.add(s);let c=r.$dynamic||i?.style?{...G(e.style),...G(i?.style)}:G(e.style);return r(i?U(t,i):t,o,c),{class:o.value||void 0,generatedClass:!a&&!s&&o.generated,style:c&&ce(c)?c:void 0,attrs:i}},V={get:({props:e,theme:t,attrs:n},r)=>r===`theme`&&t&&!(`theme`in e)?t:n&&r in n?Reflect.get(n,r):Reflect.get(e,r),has:({props:e,theme:t,attrs:n},r)=>r===`theme`&&!!t||!!n&&r in n||Reflect.has(e,r),ownKeys:({props:e,theme:t,attrs:n})=>{let r=new Set(Reflect.ownKeys(e));if(n)for(let e of Reflect.ownKeys(n))r.add(e);return t&&r.add(`theme`),[...r]},getOwnPropertyDescriptor:({props:e,theme:t,attrs:n},r)=>{if(r===`theme`&&t&&!(`theme`in e))return{value:t,enumerable:!0,configurable:!0};let i=Reflect.getOwnPropertyDescriptor(n&&r in n?n:e,r);return i&&{...i,configurable:!0}}},H=(e,t)=>!(i in e)&&`theme`in e?e:new Proxy({props:e,theme:t},V),U=(e,t)=>new Proxy({props:e,attrs:t},V),W=e=>{let t;return()=>t??=e()},G=e=>{if(typeof e!=`string`)return e;let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}return t},ce=e=>{for(let t in e)return!0;return!1},le=(e,t)=>{if(typeof e!=`string`)return(t,n)=>u(e,Q(t,n));if(m){let n=`<${e}${t}`,r=j.test(e)?void 0:`</${e}>`;return(t,i)=>ue(e,n,r,t,i)}return de(e,t)},ue=(e,t,n,r,i)=>{let a=y(),o,s;i.compute?(o=i.compute(),s=o.class):s=i.classOf(r);let c=o?.attrs,l=o?.style,u=i.skip,d=t+a,f,p=e===`textarea`;for(let t of Object.keys(r)){if(u(t))continue;let i=c&&t in c?c:r;K(t,p)?f===void 0&&n&&(f=Y(e,t,i[t])):d+=J(t,i[t])}if(c)for(let t of Object.keys(c))u(t)||t in r||(K(t,p)?f===void 0&&n&&(f=Y(e,t,c[t])):d+=J(t,c[t]));if(s!==void 0){let e=o?o.generatedClass:s===i.unescapedClass;d+=` class="${e?s:v(s)}"`}if(l!==void 0&&(d+=` style="${b(l)}"`),!n)return{t:d+` />`};let m=q(f);return m===void 0?_([d+`>`,n],f):{t:d+`>`+m+n}},K=(e,t)=>o.has(e)||t&&(e===`value`||e===`defaultValue`),q=e=>{if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`)return``;if(typeof e!=`object`||Array.isArray(e))return;let t=e;if(!(t.h&&t.h.length>0)&&typeof t.t==`string`)return t.t},J=(e,t)=>e===`style`?` style="${b(t)}"`:e===`class`?` class="${v(t)}"`:t==null||e===`ref`||e.startsWith(`on`)||e.startsWith(`prop:`)?``:typeof t==`boolean`?t?` ${d(e)}`:``:t===``?` ${d(e)}`:` ${d(e)}="${d(t,!0)}"`,Y=(e,t,n)=>e===`script`||e===`style`||t===`innerHTML`?n:d(n),X=(e,t,n)=>{let r=`<${e}${t}${n?` class="${N(n)}"`:``}>`;return l.has(e)&&e!==`svg`?x(`<svg>${r}`,2):c.has(e)&&e!==`math`?x(`<math>${r}`,2):x(r)},de=(e,t)=>{let n=X(e,t);return(e,t)=>Z(f(n),e,t)},Z=(e,t,n)=>{let r=Q(t,n),a=!(i in r)&&!(`children`in r);return g(e,r,a),h(),e},Q=(e,t)=>!t.attrsAddKeys&&!(i in e)?fe(e,t):pe(e,t),fe=(e,t)=>{let{compute:n,classOf:r}=t,i={};for(let n of Object.getOwnPropertyNames(e)){if(t.skip(n))continue;let r=Reflect.getOwnPropertyDescriptor(e,n);`value`in r&&r.enumerable?i[n]=r.value:Object.defineProperty(i,n,r)}if(m){if(n){let e=n();i.class=e.class,e.style!==void 0&&(i.style=e.style)}else i.class=r(e);return i}let a=n?()=>n().class:()=>r(e),o=$(n);return Object.defineProperty(i,"class",{get:a,enumerable:!0,configurable:!0}),o&&Object.defineProperty(i,"style",{get:o,enumerable:!0,configurable:!0}),i},$=e=>{if(e&&!(m&&e().style===void 0))return()=>e().style},pe=(e,t)=>{let{skip:n,compute:r,classOf:a}=t,o=()=>t.attrsAddKeys?t.compute().attrs:void 0,s=r?()=>r().class:()=>a(e),c=$(r),l=e=>e===`class`?s:e===`style`?c:void 0,u=e=>{let t=o();return t&&e in t?t:void 0};return new Proxy(e,{get(e,t,r){if(t===i)return r;let a=l(t);if(a)return a();if(n(t))return;let o=u(t);return o?o[t]:Reflect.get(e,t)},has(e,t){return t===i||l(t)?!0:n(t)?!1:Reflect.has(e,t)||u(t)!==void 0},ownKeys(e){let t=new Set;for(let r of Reflect.ownKeys(e))n(r)||t.add(r);for(let e of Object.keys(o()??{}))n(e)||t.add(e);return t.add(`class`),c&&t.add(`style`),[...t]},getOwnPropertyDescriptor(e,t){let r=l(t);if(r)return{enumerable:!0,configurable:!0,get:r};if(!n(t))return u(t)?{enumerable:!0,configurable:!0,get:()=>o()?.[t]}:Reflect.getOwnPropertyDescriptor(e,t)}})},me=new Proxy(ne,{get(e,t){return typeof t!=`string`||t===`then`||t in e?Reflect.get(e,t):e(t)}}),he=(e,...t)=>{};export{e as YakThemeContext,t as YakThemeProvider,ee as atoms,te as css,he as globalStyle,O as keyframes,me as styled,n as useTheme};
1
+ import{YakThemeContext as e,YakThemeProvider as t,useTheme as n,useTheme as r}from"@yak/solid/context";import{$PROXY as i,createMemo as a,merge as o,omit as s}from"solid-js";import{ChildProperties as c,DOMWithState as l,MathMLElements as u,SVGElements as d,createComponent as f,escape as p,getNextElement as m,insert as h,isServer as g,runHydrationEvents as _,spread as v,ssr as y,ssrClassName as b,ssrHydrationKey as x,ssrStyle as S,template as C}from"@solidjs/web";const w=Symbol.for(`@yak/solid:component`);var T=class{value;generated=!0;constructor(e){this.value=e||``}add(e,t=!0){t||(this.generated=!1),this.value?this.has(e)||(this.value+=` `+e):this.value=e}has(e){return(` `+this.value+` `).includes(` `+e+` `)}delete(e){this.has(e)&&(this.value=this.value.split(` `).filter(t=>t!==e).join(` `))}};function E(...e){let t,n=[];for(let r of e)typeof r==`string`?t=r:typeof r==`function`?n.push(r):typeof r==`object`&&`style`in r&&n.push((e,t,n)=>{for(let t in r.style){let i=r.style[t];n[t]=String(typeof i==`function`?D(e,i):i)}});return n.length===0?Object.assign((e,n)=>{t&&n.add(t)},{$dynamic:!1}):Object.assign((e,r,i)=>{t&&r.add(t);for(let t=0;t<n.length;t++)ee(e,n[t],r,i)},{$dynamic:!0})}const ee=(e,t,n,r)=>{let i=t(e,n,r);for(;i;){if(typeof i==`function`){i=i(e,n,r);continue}if(typeof i==`object`){let e=`class`in i?i.class:void 0;if(e&&n.add(e),`style`in i&&i.style)for(let e in i.style)r[e]=i.style[e]}break}},D=(e,t)=>{let n=t(e);if(typeof n==`function`)return D(e,n);if(typeof n!=`string`&&typeof n!=`number`&&!(n instanceof String)&&process.env.NODE_ENV===`development`)throw Error(`Dynamic CSS functions must return a string or number but returned ${JSON.stringify(n)}\n\nDynamic CSS function: ${t.toString()}\n`);return n},O=(...e)=>{let t=[],n=[];for(let r of e)typeof r==`string`?t.push(...r.split(` `)):typeof r==`function`&&n.push(r);return E(...t.length>0?[(e,n)=>{t.forEach(e=>n.add(e,!1))},...n]:n)},k=(e,...t)=>{if(Array.isArray(e)&&`raw`in e){let n=e[0];for(let r=0;r<t.length;r++){let i=t[r];n+=i&&typeof i==`object`&&`__yak`in i?i.__yak:String(i),n+=e[r+1]}return{__yak:n}}let n=[];for(let e of t)typeof e==`function`&&n.push(e);return n.length===0?{class:``,style:void 0}:(e=>{for(let t=0;t<n.length;t++)te(e,n[t]);return{class:``,style:void 0}})};function te(e,t){let n=new Set,r={},i=t(e,n,r);for(;typeof i==`function`;)i=i(e,n,r);return i}const ne=(e,...t)=>``,A=e=>e?typeof e==`string`?e:Array.isArray(e)?e.map(A).filter(Boolean).join(` `):typeof e==`object`?Object.keys(e).filter(t=>e[t]).join(` `):String(e):``,j=(e,t)=>{let n=A(t);return e?n?e+` `+n:e:n||void 0},M=/^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i,N=e=>Object.assign(P(e),{attrs:t=>P(e,t)}),P=(e,t)=>{let[n,r,i]=typeof e==`function`&&e[w]!==void 0?e[w]:[],a=i??e,o=oe(t,n);return(e,...t)=>{let n=E(e,...t),i=se(n,r),s=typeof a==`string`,c=s&&o&&typeof o!=`function`&&re(a,o)?o:void 0,l=c?ie(c):``,u=fe(a,l),d=(!o||!!c)&&!i.$dynamic,f=e=>typeof e!=`string`||e.charCodeAt(0)===36||e===`class`||e===`theme`||!d&&e===`style`||c!==void 0&&Object.hasOwn(c,e),p=d?V(s?a:void 0,u,i,f,l):U(u,typeof o==`function`?o:o&&(()=>o),i,f,!!c),m=[o,i,a];return Object.assign(p,{[w]:m})}},re=(e,t)=>{let n=l[e.toUpperCase()];return Object.getOwnPropertyNames(t).every(e=>{let r=Object.getOwnPropertyDescriptor(t,e);if(!r.enumerable||!(`value`in r))return!1;let i=typeof r.value;return(i===`string`||i===`number`||i===`boolean`||r.value==null)&&ae.test(e)&&e.charCodeAt(0)!==36&&e!==`class`&&e!==`style`&&e!==`theme`&&e!==`ref`&&!c.has(e)&&!e.startsWith(`on`)&&!e.startsWith(`prop:`)&&!(n&&e in n)})},ie=e=>{let t=``;for(let n of Object.keys(e)){let r=e[n];r!=null&&r!==!1&&(t+=r===!0||r===``?` ${n}`:` ${n}="${F(String(r))}"`)}return t},F=e=>e.replaceAll(`&`,`&amp;`).replaceAll(`"`,`&quot;`),ae=/^[A-Za-z_:][\w:.-]*$/,oe=(e,t)=>{if(!e)return t;if(!t)return e;if(typeof e!=`function`&&typeof t!=`function`&&!B(e)&&!B(t))return I(t,e);let n=typeof e==`function`?e:()=>e,r=typeof t==`function`?t:()=>t;return e=>{let t=r(e);return I(t,n(I(e,t)))}},se=(e,t)=>t?Object.assign((n,r,i)=>{t(n,r,i),e(n,r,i)},{$dynamic:e.$dynamic||t.$dynamic}):e,I=(e,t)=>{if(!t)return e;let n={...z(e),...z(t)};return t.class&&e.class!==t.class&&(n.class=L(j(A(e.class),t.class))),t.style&&e.style!==t.style&&(n.style=L({...K(e.style),...K(t.style)})),Object.defineProperties({},n)},L=e=>({value:e,enumerable:!0,configurable:!0,writable:!0}),R=(e,t,n)=>n.get||n.set?{get:()=>e[t],set:n.set&&(n=>e[t]=n),enumerable:n.enumerable,configurable:!0}:n,z=e=>{let t=Object.getOwnPropertyDescriptors(e);for(let n of Reflect.ownKeys(t))t[n]=R(e,n,t[n]);return t},B=e=>{for(let t of Object.getOwnPropertyNames(e))if(!(`value`in Object.getOwnPropertyDescriptor(e,t)))return!0;return!1},V=(e,t,n,r,a)=>{let o=new T;n(void 0,o);let s=o.value||void 0,c=e=>{let t=A(e.class);if(!t)return s;let r=new T(t);return n(e,r),r.value||void 0},l=e&&!M.test(e)?H(e,s,a):void 0,u={skip:r,compute:void 0,classOf:c,attrsAddKeys:!1,unescapedClass:o.generated?s:void 0};return e=>{if(l&&(g||!(i in e))){let t=Object.keys(e);if(!t.length||t.length===1&&t[0]===`children`)return l(e,t.length!==0)}return t(e,u)}},H=(e,t,n)=>{if(g){let r=`<${e}${n}`,i=`${t?` class="${b(t)}"`:``}>`,a=`</${e}>`,o=[r,i,a],s=e===`script`||e===`style`;return(e,t)=>{let n=x(),c=t?s?e.children:p(e.children):void 0,l=J(c);return l===void 0?y(o,n,c):{t:`${r}${n}${i}${l}${a}`}}}let r=Z(e,n,t);return(e,t)=>{let n=m(r);if(t){let t=Object.getOwnPropertyDescriptor(e,`children`);t&&`value`in t?h(n,t.value):h(n,()=>e.children)}return _(),n}},U=(e,t,n,i,o)=>s=>{let c=r(),l=ce(s,c),u=()=>W(s,l,t,n),d=g?ue(u):a(u,{transparent:!0}),f=t&&(()=>{let e=d().attrs;return!!e&&`theme`in e&&e.theme!==c});return e(s,{skip:f?e=>e===`theme`?!f():i(e):i,compute:d,classOf:void 0,attrsAddKeys:!!t&&!o,unescapedClass:void 0})},W=(e,t,n,r)=>{let i=n?.(t),a=A(e.class),o=new T(a),s=A(i?.class);s&&o.add(s);let c=r.$dynamic||i?.style?{...K(e.style),...K(i?.style)}:K(e.style);return r(i?le(t,i):t,o,c),{class:o.value||void 0,generatedClass:!a&&!s&&o.generated,style:c&&de(c)?c:void 0,attrs:i}},G={get:({props:e,theme:t,attrs:n},r)=>r===`theme`&&t&&!(`theme`in e)?t:n&&r in n?Reflect.get(n,r):Reflect.get(e,r),has:({props:e,theme:t,attrs:n},r)=>r===`theme`&&!!t||!!n&&r in n||Reflect.has(e,r),ownKeys:({props:e,theme:t,attrs:n})=>{let r=new Set(Reflect.ownKeys(e));if(n)for(let e of Reflect.ownKeys(n))r.add(e);return t&&r.add(`theme`),[...r]},getOwnPropertyDescriptor:({props:e,theme:t,attrs:n},r)=>{if(r===`theme`&&t&&!(`theme`in e))return{value:t,enumerable:!0,configurable:!0};let i=Reflect.getOwnPropertyDescriptor(n&&r in n?n:e,r);return i&&{...i,configurable:!0}}},ce=(e,t)=>!(i in e)&&`theme`in e?e:new Proxy({props:e,theme:t},G),le=(e,t)=>new Proxy({props:e,attrs:t},G),ue=e=>{let t;return()=>t??=e()},K=e=>{if(typeof e!=`string`)return e;let t={};for(let n of e.split(`;`)){let e=n.indexOf(`:`);if(e===-1)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r&&i&&(t[r]=i)}return t},de=e=>{for(let t in e)return!0;return!1},fe=(e,t)=>{if(typeof e!=`string`)return(t,n)=>f(e,ge(t,n));if(g){let n=`<${e}${t}`,r=M.test(e)?void 0:`</${e}>`;return(t,i)=>pe(e,n,r,t,i)}return me(e,t)},pe=(e,t,n,r,i)=>{let a=x(),o,s;i.compute?(o=i.compute(),s=o.class):s=i.classOf(r);let c=o?.attrs,l=o?.style,u=i.skip,d=t+a,f,p=e===`textarea`;for(let t of Object.keys(r)){if(u(t))continue;let i=c&&t in c?c:r;q(t,p)?f===void 0&&n&&(f=X(e,t,i[t])):d+=Y(t,i[t])}if(c)for(let t of Object.keys(c))u(t)||t in r||(q(t,p)?f===void 0&&n&&(f=X(e,t,c[t])):d+=Y(t,c[t]));if(s!==void 0){let e=o?o.generatedClass:s===i.unescapedClass;d+=` class="${e?s:b(s)}"`}if(l!==void 0&&(d+=` style="${S(l)}"`),!n)return{t:d+` />`};let m=J(f);return m===void 0?y([d+`>`,n],f):{t:d+`>`+m+n}},q=(e,t)=>c.has(e)||t&&(e===`value`||e===`defaultValue`),J=e=>{if(typeof e==`string`)return e;if(typeof e==`number`)return String(e);if(e==null||typeof e==`boolean`)return``;if(typeof e!=`object`||Array.isArray(e))return;let t=e;if(!(t.h&&t.h.length>0)&&typeof t.t==`string`)return t.t},Y=(e,t)=>e===`style`?` style="${S(t)}"`:e===`class`?` class="${b(t)}"`:t==null||e===`ref`||e.startsWith(`on`)||e.startsWith(`prop:`)?``:typeof t==`boolean`?t?` ${p(e)}`:``:t===``?` ${p(e)}`:` ${p(e)}="${p(t,!0)}"`,X=(e,t,n)=>e===`script`||e===`style`||t===`innerHTML`?n:p(n),Z=(e,t,n)=>{let r=`<${e}${t}${n?` class="${F(n)}"`:``}>`;return d.has(e)&&e!==`svg`?C(`<svg>${r}`,2):u.has(e)&&e!==`math`?C(`<math>${r}`,2):C(r)},me=(e,t)=>{let n=Z(e,t);return(e,t)=>he(m(n),e,t)},he=(e,t,n)=>{if(!n.attrsAddKeys&&!(i in t)){let r=_e(t,n);v(e,r,!(`children`in r))}else v(e,Q(t,n),!1);return _(),e},ge=(e,t)=>o(...Q(e,t)),_e=(e,t)=>{let n=$(e,t);for(let r of Object.getOwnPropertyNames(e)){if(t.skip(r))continue;let i=Reflect.getOwnPropertyDescriptor(e,r);`value`in i&&i.enumerable?n[r]=i.value:Object.defineProperty(n,r,R(e,r,i))}return n},Q=(e,t)=>{let{skip:n,compute:r,classOf:i}=t,a=s(e,n),o;if(g){if(o={},r){let e=r();o.class=e.class,e.style!==void 0&&(o.style=e.style)}else o.class=i(e)}else o=$(e,t);return t.attrsAddKeys?[a,()=>{let e=t.compute().attrs;return e?s(e,n):void 0},o]:[a,void 0,o]},$=(e,{compute:t,classOf:n})=>t?{get class(){return t().class},get style(){return t().style}}:{get class(){return n(e)}},ve=new Proxy(N,{get(e,t){return typeof t!=`string`||t===`then`||t in e?Reflect.get(e,t):e(t)}}),ye=(e,...t)=>{};export{e as YakThemeContext,t as YakThemeProvider,O as atoms,k as css,ye as globalStyle,ne as keyframes,ve as styled,n as useTheme};
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["css","css","styled","css","useTheme","StyledFactory"],"sources":["../runtime/cssLiteral.ts","../runtime/atoms.ts","../runtime/mocks/cssLiteral.ts","../runtime/mocks/keyframes.ts","../runtime/internals/mergeClasses.ts","../runtime/styled.ts","../runtime/mocks/styled.ts","../runtime/mocks/globalStyle.ts"],"sourcesContent":["import type { YakTheme } from \"./index.ts\";\nimport type { Accessor } from \"solid-js\";\nimport { ClassCollector, CompiledStyleProcessor, StyleObject } from \"./publicStyledApi.js\";\n\n// Symbol.for, not Symbol(): the package ships two bundles (the public entry\n// and the internal one the compiler imports) and both contain this module. a\n// styled component created through one must be recognized by the other\nexport const yakComponentSymbol = Symbol.for(\"@yak/solid:component\");\n\n/**\n * the class names of one render, kept as one space-separated string in the\n * order the style block adds them. add() is the hot path: an append, and a\n * duplicate check only once a second name arrives. has() and delete() exist\n * for runtime processors that take a name back out, such as an atom that\n * reverts a class. a Set would need a split and a join per render for the\n * same string\n */\nexport class Classes implements ClassCollector {\n value: string;\n /**\n * false once a name came from the author, such as an atom. compiler names\n * are safe to print as they are; serializeElement in styled.ts escapes the\n * class once this is false\n */\n generated = true;\n constructor(initial?: string) {\n this.value = initial || \"\";\n }\n add(name: string, generated = true) {\n if (!generated) this.generated = false;\n if (!this.value) {\n this.value = name;\n } else if (!this.has(name)) {\n this.value += \" \" + name;\n }\n }\n has(name: string) {\n return (\" \" + this.value + \" \").includes(\" \" + name + \" \");\n }\n delete(name: string) {\n if (this.has(name)) {\n this.value = this.value\n .split(\" \")\n .filter((existing) => existing !== name)\n .join(\" \");\n }\n }\n}\n\nexport type ComponentStyles<TProps> = (props: TProps) => {\n class: string;\n style?: {\n [key: string]: string;\n };\n};\n\nexport type CSSInterpolation<TProps> =\n | string\n | number\n | undefined\n | null\n | false\n | ComponentStyles<TProps>\n | {\n // type only identifier to allow targeting components\n // e.g. styled.svg`${Button}:hover & { fill: red; }`\n [yakComponentSymbol]: any;\n }\n | ((props: TProps) => CSSInterpolation<TProps>);\n\ntype CSSStyles<TProps = {}> = {\n style: { [key: string]: string | ((props: TProps) => string) };\n};\n\nexport type CSSFunction = <TProps>(\n styles: TemplateStringsArray,\n ...values: CSSInterpolation<NoInfer<TProps> & { theme: Accessor<YakTheme> }>[]\n) => ComponentStyles<TProps>;\n\nexport type NestedRuntimeStyleProcessor = (\n props: unknown,\n classes: ClassCollector,\n style: StyleObject,\n) =>\n | {\n class?: string;\n style?: StyleObject;\n }\n | void\n | false\n | null\n | string\n | number\n | NestedRuntimeStyleProcessor;\n\n/**\n * the runtime behind css``. the compiler rewrites every css`` and styled``\n * call, so what arrives here is never the template the author wrote but its\n * compiled form: class names, callbacks and css-variable maps (examples in\n * the loop below). the public typings describe the call before compilation,\n * which is why this function is internal: mocks/cssLiteral.ts exports the\n * css the author sees, cast to the public type.\n *\n * it returns one processor, (props, classes, style) => void, that runs every\n * compiled piece: class names go into the collector, css values into the\n * style object\n */\nexport function css<TProps>(...args: Array<any>): CompiledStyleProcessor<TProps> {\n let staticClass: string | undefined;\n const dynamicCssFunctions: NestedRuntimeStyleProcessor[] = [];\n for (const arg of args as Array<string | NestedRuntimeStyleProcessor | CSSStyles<any>>) {\n // static css became a css-module class name at build time:\n // css`color: red;` -> css(\"yak31e4\")\n if (typeof arg === \"string\") {\n staticClass = arg;\n }\n // conditional css stays a callback that returns another compiled css():\n // css`${props => props.active && css`color: red;`}`\n // -> css(props => props.active && css(\"yak31e4\"))\n else if (typeof arg === \"function\") {\n dynamicCssFunctions.push(arg);\n }\n // a css value became a variable the callback fills at render time:\n // css`transform: translate(${props => props.x});`\n // -> css(\"yak31e4\", { style: { \"--yakVarX\": props => props.x } })\n else if (typeof arg === \"object\" && \"style\" in arg) {\n dynamicCssFunctions.push((props, _, style) => {\n for (const key in arg.style) {\n const value = arg.style[key];\n if (typeof value === \"function\") {\n style[key as keyof StyleObject] = String(\n // a callback may return another callback before it yields the\n // value, such as a theme-dependent one:\n // const color = (props) => props.theme().mode === \"dark\" ? \"black\" : \"white\";\n // css`border-color: ${color};`\n recursivePropExecution(props, value),\n ) as never;\n } else {\n style[key as keyof StyleObject] = String(value) as never;\n }\n }\n });\n }\n }\n\n // no dynamic parts, the common case: $dynamic false lets styled() skip the\n // theme lookup and the style object for the component\n if (dynamicCssFunctions.length === 0) {\n return Object.assign(\n (_: unknown, classes: ClassCollector) => {\n if (staticClass) {\n classes.add(staticClass);\n }\n },\n { $dynamic: false as const },\n ) satisfies CompiledStyleProcessor<TProps>;\n }\n\n return Object.assign(\n (props: TProps, classes: ClassCollector, allStyles: StyleObject) => {\n if (staticClass) {\n classes.add(staticClass);\n }\n for (let i = 0; i < dynamicCssFunctions.length; i++) {\n runProcessor(props, dynamicCssFunctions[i], classes, allStyles);\n }\n },\n { $dynamic: true as const },\n ) satisfies CompiledStyleProcessor<TProps>;\n}\n\n/** run one processor and fold what it returns into the collector and the style object */\nconst runProcessor = (\n props: unknown,\n fn: NestedRuntimeStyleProcessor,\n classes: ClassCollector,\n style: StyleObject,\n) => {\n let result = fn(props, classes, style);\n while (result) {\n if (typeof result === \"function\") {\n result = result(props, classes, style);\n continue;\n } else if (typeof result === \"object\") {\n const resultClass = \"class\" in result ? result.class : undefined;\n if (resultClass) {\n classes.add(resultClass);\n }\n if (\"style\" in result && result.style) {\n for (const key in result.style) {\n // both objects use StyleObject; typescript loses the key/value relation in this loop\n style[key as keyof StyleObject] = result.style[key as keyof StyleObject] as any;\n }\n }\n }\n break;\n }\n};\n\nconst recursivePropExecution = (props: unknown, fn: (props: unknown) => any): string | number => {\n const result = fn(props);\n if (typeof result === \"function\") {\n return recursivePropExecution(props, result);\n }\n // typeof guards first: the `process.env` lookup is a real per-call cost\n // for unbundled Node consumers, so it must only run on the invalid path\n if (typeof result !== \"string\" && typeof result !== \"number\" && !(result instanceof String)) {\n if (process.env.NODE_ENV === \"development\") {\n throw new Error(\n `Dynamic CSS functions must return a string or number but returned ${JSON.stringify(\n result,\n )}\\n\\nDynamic CSS function: ${fn.toString()}\\n`,\n );\n }\n }\n return result;\n};\n","import { ComponentStyles, css } from \"./cssLiteral.js\";\nimport { RuntimeStyleProcessor } from \"./publicStyledApi.js\";\n\n/**\n * Allows to use atomic CSS classes in a styled or css block\n *\n * @usage\n *\n * ```tsx\n * import { styled, atoms } from \"@yak/solid\";\n *\n * const Button = styled.button<{ $primary?: boolean }>`\n * ${atoms(\"text-teal-600\", \"text-base\", \"rounded-md\")}\n * ${props => props.$primary && atoms(\"shadow-md\")}\n * `;\n * ```\n */\nexport const atoms = <T>(\n ...atoms: (string | RuntimeStyleProcessor<T> | false)[]\n): ComponentStyles<T> => {\n const staticClasses: string[] = [];\n const dynamicFunctions: RuntimeStyleProcessor<T>[] = [];\n\n for (const atom of atoms) {\n if (typeof atom === \"string\") {\n staticClasses.push(...atom.split(\" \"));\n } else if (typeof atom === \"function\") {\n dynamicFunctions.push(atom);\n }\n }\n\n const runtimeFunctions: RuntimeStyleProcessor<T>[] =\n staticClasses.length > 0\n ? [\n (_, classes) => {\n // author strings, not compiler names: the server writer must escape them\n staticClasses.forEach((cls) => classes.add(cls, false));\n },\n ...dynamicFunctions,\n ]\n : dynamicFunctions;\n\n // css() is typed for its compiled arguments; the public type describes the\n // interpolation the author writes before compilation\n return css(...runtimeFunctions) as unknown as ComponentStyles<T>;\n};\n","import type { CSSFunction, NestedRuntimeStyleProcessor } from \"../cssLiteral.js\";\n\n/**\n * Allows to use CSS styles in a styled or css block\n *\n * e.g.\n *\n * ```tsx\n * const Component = styled.div`\n * color: black;\n * ${({$active}) => $active && css`color: red;`}\n * `;\n * ```\n */\nexport const css: CSSFunction = (styles: TemplateStringsArray, ...args: unknown[]) => {\n // When called in yak files as a template tag (without SWC transformation),\n // return { __yak: rawCss } so the cross-file resolver can\n // extract the mixin value from evaluated .yak files.\n if (Array.isArray(styles) && \"raw\" in styles) {\n let rawCss = styles[0];\n for (let i = 0; i < args.length; i++) {\n const interpolation = args[i];\n rawCss +=\n interpolation && typeof interpolation === \"object\" && \"__yak\" in interpolation\n ? (interpolation as { __yak: string }).__yak\n : String(interpolation);\n rawCss += styles[i + 1];\n }\n return { __yak: rawCss } as any;\n }\n\n const dynamicCssFunctions: NestedRuntimeStyleProcessor[] = [];\n for (const arg of args as Array<string | Function | object>) {\n // Dynamic CSS e.g.\n // css`${props => props.active && css`color: red;`}`\n // compiled -> css((props: { active: boolean }) => props.active && css(\"yak31e4\"))\n if (typeof arg === \"function\") {\n dynamicCssFunctions.push(arg as unknown as NestedRuntimeStyleProcessor);\n }\n }\n if (dynamicCssFunctions.length === 0) {\n return {\n class: \"\",\n style: undefined,\n };\n }\n return ((props: unknown) => {\n for (let i = 0; i < dynamicCssFunctions.length; i++) {\n // run the dynamic expressions and ignore the return value\n // the execution is important to ensure that the user code is executed\n // the same way as in the real runtime\n executeDynamicExpressionRecursively(props, dynamicCssFunctions[i]);\n }\n return {\n class: \"\",\n style: undefined,\n };\n }) as any;\n};\n\nfunction executeDynamicExpressionRecursively(\n props: unknown,\n expression: NestedRuntimeStyleProcessor,\n) {\n const classes = new Set<string>();\n const style = {};\n let result = expression(props, classes, style);\n while (typeof result === \"function\") {\n result = result(props, classes, style);\n }\n return result;\n}\n","import type { keyframes as keyframesInternal } from \"../keyframes.js\";\n\n/**\n * Allows to use CSS keyframe animations in a styled or css block\n *\n * @usage\n *\n * ```tsx\n * import { styled, keyframes } from \"@yak/solid\";\n *\n * const rotate = keyframes`\n * from {\n * transform: rotate(0deg);\n * }\n * to {\n * transform: rotate(360deg);\n * }\n * `;\n *\n * const Spinner = styled.div`\n * animation: ${rotate} 1s linear infinite;\n * `;\n * ```\n */\nexport const keyframes: typeof keyframesInternal = (_styles, ..._dynamic) => {\n // the keyframes function is a no-op in the mock\n // as it has no dynamic runtime behavior but only css\n return \"\";\n};\n","/**\n * Normalize Solid `class` values for string merging.\n * Solid 2 allows strings, arrays and object syntax on the class attribute.\n */\nexport const normalizeClass = (value: unknown): string => {\n if (!value) return \"\";\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.map(normalizeClass).filter(Boolean).join(\" \");\n if (typeof value === \"object\") {\n return Object.keys(value)\n .filter((key) => (value as Record<string, unknown>)[key])\n .join(\" \");\n }\n return String(value);\n};\n\n/**\n * Merges the folded yak class name with a user `class` value.\n *\n * Injected by the compiler (as `__yak_mergeClassNames`) when it replaces a JSX\n * usage of a fully static styled component with a plain element:\n * ```tsx\n * const Card = styled.div`color: red;`;\n * <Card class={active() && \"active\"} />\n * ```\n * becomes\n * ```tsx\n * <div class={__yak_mergeClassNames(\"yX\", active() && \"active\")} />\n * ```\n * combineProps in styled.ts uses it for two attrs layers' classes as well.\n */\nexport const mergeClasses = (yakClass: string, userClass: unknown): string | undefined => {\n const user = normalizeClass(userClass);\n if (!yakClass) return user || undefined;\n if (!user) return yakClass;\n return yakClass + \" \" + user;\n};\n","// the compiler extracts the css at build time; this file only builds class\n// and style per element, prints the tag on the server and binds it on the\n// client. the map, for a reader who lands in the middle:\n//\n// styled() flattens a chain of styled components and picks one of two\n// component shapes at definition. static: the class is fixed, there is no\n// attrs function and the css block writes no style values at render time,\n// so no memo and no theme read. dynamic: one memo per element resolves\n// attrs, class and style.\n//\n// both hand the target a RenderMeta and a props view. on the server\n// serializeElement (the writer) prints a tag, on the client bindElement\n// spreads onto a cloned template, a component target gets targetProps\n// (a copy or a proxy).\n//\n// the one rule every path keeps: a prop getter may render a child and take\n// hydration keys of its own, so the element takes its key first and reads\n// each getter once, in the target's order.\n//\n// words: author = the app code that writes the css block, renders the\n// component and passes props; target = the tag or component under the\n// styled layer; attrs = the .attrs() values, an object or a function of\n// props; baked = object attrs printed into the tag at definition; view = a\n// proxy over props that adds the theme or attrs; collector = the Classes\n// instance a css block adds its names to; atom = a class name the author\n// passes into a css block via atoms(\"...\"), author text that needs\n// escaping; reactive spread = a {...props} in jsx, which solid compiles to\n// a proxy marked with $PROXY; hole = a slot in a server template that\n// ssr() fills, possibly async; hydration key = the id the server prints on\n// an element so the client can claim the same node\nimport { css, Classes, yakComponentSymbol } from \"./cssLiteral.js\";\nimport type {\n AnyComponent,\n Attrs,\n AttrsMerged,\n Styled,\n YakComponent,\n StyledFn,\n HtmlTags,\n Substitute,\n StyledLiteral,\n CompiledStyleProcessor,\n StaticStyleProcessor,\n StyleObject,\n} from \"./publicStyledApi.js\";\nimport { $PROXY, createMemo } from \"solid-js\";\n// the helpers solid's compiled jsx calls; this file hand-writes what the compiler would emit for a tag\nimport {\n ChildProperties,\n createComponent,\n DOMWithState,\n escape,\n getNextElement,\n insert,\n isServer,\n MathMLElements,\n runHydrationEvents,\n spread,\n ssr,\n ssrClassName,\n ssrHydrationKey,\n ssrStyle,\n SVGElements,\n template,\n type JSX,\n} from \"@solidjs/web\";\nimport { mergeClasses, normalizeClass } from \"./internals/mergeClasses.js\";\n// the runtime and the app share one theme context; vite can alias this export\nimport { useTheme } from \"@yak/solid/context\";\nimport type { YakTheme } from \"./context/index.js\";\nimport type { Accessor } from \"solid-js\";\n\n/** the props a styled component receives from its author; theme is an accessor (the provider's or the author's) */\ntype Props = {\n class?: string;\n style?: StyleObject | string;\n theme?: Accessor<YakTheme>;\n} & Record<PropertyKey, unknown>;\n\n/**\n * the compiled css block: adds its class names to the collector and, when\n * $dynamic, style values for the props; the css itself is extracted at build time\n */\ntype StyleProcessor = CompiledStyleProcessor<unknown>;\n\ntype RuntimeAttrsFn = (props: Props) => Props;\n\n/** the .attrs() values: an object, or a function of the author's props */\ntype RuntimeAttrs = Props | RuntimeAttrsFn;\n\ntype ComputedStyles = {\n class: string | undefined;\n /** true when the class holds generated names only, nothing from the author or attrs; the writer prints it unescaped then */\n generatedClass: boolean;\n style: StyleObject | undefined;\n attrs: Props | undefined;\n};\n\n/**\n * the information to build class and style for one render\n * kept outside of the component props so solid never copies or filters\n * it when it walks the props object\n */\ntype RenderMeta = StaticMeta | DynamicMeta;\n\n/** static component (fixed class, no attrs function, no style values at render time): one meta per component, the class comes from classOf */\ntype StaticMeta = {\n /** keys the target must never see; the rule is `skip` in yakStyled */\n skip: (key: PropertyKey) => boolean;\n compute: undefined;\n classOf: (props: Props) => string | undefined;\n attrsAddKeys: false;\n /** the static class when every name in it is generated, so the writer prints it unescaped; undefined when an atom put author text in it */\n unescapedClass: string | undefined;\n};\n\n/**\n * dynamic component: one memo (run once on the server) holds class,\n * style and attrs, one meta per element. the two meta literals (in\n * createStaticComponent and createDynamicComponent) keep the same keys in\n * the same order so every meta read sees one shape\n */\ntype DynamicMeta = {\n skip: (key: PropertyKey) => boolean;\n compute: () => ComputedStyles;\n classOf: undefined;\n /**\n * an attrs function may add keys at render time, so the target gets a\n * proxy, not a copy. decided at definition: the memo's current attrs say\n * nothing about later runs\n */\n attrsAddKeys: boolean;\n unescapedClass: undefined;\n};\n\n/** what a styled component built on another yak component inherits from it */\ntype ComponentMetadata = readonly [\n attrs: RuntimeAttrs | undefined,\n styles: StyleProcessor,\n target: AnyComponent<any> | string,\n];\n\n/** renders one element of the flattened target: props are the author's raw props, meta says how to build class and style */\ntype TargetRenderer = (props: Props, meta: RenderMeta) => JSX.Element;\n\n/** the loosely typed form of Styled that yakStyled implements; the public overloads live in publicStyledApi */\nexport type StyledInternal = <\n T extends object,\n TAttrsIn extends object = {},\n TAttrsOut extends AttrsMerged<T, TAttrsIn> = AttrsMerged<T, TAttrsIn>,\n>(\n Component: AnyComponent<T> | YakComponent<T> | HtmlTags | string,\n attrs?: Attrs<T, TAttrsIn, TAttrsOut>,\n) => StyledLiteral<Substitute<T, TAttrsIn>>;\n\n/** solid's server regex (not exported); its VoidElements set lacks keygen and menuitem */\nconst VOID_ELEMENTS =\n /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;\n\nconst styledFactory: StyledFn = (Component) =>\n Object.assign(yakStyled(Component), {\n attrs: (attrs: Attrs<any>) => yakStyled(Component, attrs),\n });\n\n/**\n * style a tag or a component that forwards its class prop. styled.div is\n * compiled to styled(\"div\"); the untransformed export in mocks/styled.ts\n * adds the tag properties with a proxy\n */\nexport const styled = styledFactory as Styled;\n\nconst yakStyled: StyledInternal = (Component, attrs) => {\n // solid-refresh forwards reads to the live component, but does not forward `in` checks\n const isYakComponent =\n typeof Component === \"function\" &&\n (Component as Partial<YakComponent<unknown>>)[yakComponentSymbol] !== undefined;\n\n // the public tuple type hides the shape, one cast at the read\n const [parentAttrs, parentRuntimeStylesFn, parentTarget] = isYakComponent\n ? ((Component as YakComponent<unknown>)[yakComponentSymbol] as ComponentMetadata)\n : [];\n\n // the chain renders its final target once, with all attrs and style processors combined\n const targetComponent = parentTarget ?? Component;\n\n const mergedAttrs = composeAttrs(attrs as RuntimeAttrs | undefined, parentAttrs);\n\n return (styles, ...values) => {\n // the interpolations of the style block, e.g.\n // styled.button`color: ${props => props.color}; margin: ${props => props.margin};`\n // arrive compiled: styles and values hold class names, style callbacks\n // and css-variable maps, no css text\n const runtimeStylesFn = css(styles, ...values);\n const runtimeStyleProcessor = composeStyles(runtimeStylesFn, parentRuntimeStylesFn);\n\n const isTag = typeof targetComponent === \"string\";\n // object attrs with plain attribute values bake into the tag's opening\n // string and template; the component stays static. baked keys reach the\n // dom only through that string: skip drops them from the target\n const baked =\n isTag &&\n mergedAttrs &&\n typeof mergedAttrs !== \"function\" &&\n bakeable(targetComponent, mergedAttrs)\n ? mergedAttrs\n : undefined;\n const attrString = baked ? bakeAttributes(baked) : \"\";\n const renderTarget = createTargetRenderer(targetComponent, attrString);\n // static: attrs are none or baked, and the css block writes no style values\n const isStatic = (!mergedAttrs || !!baked) && !runtimeStyleProcessor.$dynamic;\n // the target never sees $-props, the provider theme, or the author class\n // (yak hands it the combined one); a dynamic component merges style in its\n // memo, so the author's style key is dropped here and handed over combined.\n // no symbol passes: solid's merge() flattens any object that answers its\n // private $SOURCES key, which would hand a target's mergeProps() the\n // unfiltered originals; solid's own omit() blocks that key the same way\n const skip = (key: PropertyKey) =>\n typeof key !== \"string\" ||\n key.charCodeAt(0) === 36 /* $ */ ||\n key === \"class\" ||\n key === \"theme\" ||\n (!isStatic && key === \"style\") ||\n // a baked attr wins over the author's prop of the same name, even when its value is null\n (baked !== undefined && Object.hasOwn(baked, key));\n // baked attrs still run inside a dynamic component's memo: style callbacks\n // read them through withAttrs\n const attrsFn =\n typeof mergedAttrs === \"function\" ? mergedAttrs : mergedAttrs && (() => mergedAttrs);\n const Yak = isStatic\n ? createStaticComponent(\n isTag ? targetComponent : undefined,\n renderTarget,\n runtimeStyleProcessor,\n skip,\n attrString,\n )\n : createDynamicComponent(renderTarget, attrsFn, runtimeStyleProcessor, skip, !!baked);\n\n const metadata: ComponentMetadata = [mergedAttrs, runtimeStyleProcessor, targetComponent];\n return Object.assign(Yak, { [yakComponentSymbol]: metadata });\n };\n};\n\n/**\n * object attrs bake when every entry is a plain attribute with a primitive\n * value. rejected keys are the union of what skip drops, what attribute()\n * treats specially, and what solid sets as a dom property (DOMWithState:\n * value, checked, ...), which a template would turn into a markup\n * attribute. enumerable value keys only, so the three walks (here,\n * bakeAttributes, skip) see the same keys; a getter blocks baking and runs\n * at render time\n */\nconst bakeable = (tag: string, attrs: Props): boolean => {\n const stateful = DOMWithState[tag.toUpperCase()];\n return Object.getOwnPropertyNames(attrs).every((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(attrs, key)!;\n if (!descriptor.enumerable || !(\"value\" in descriptor)) return false;\n const type = typeof descriptor.value;\n return (\n (type === \"string\" || type === \"number\" || type === \"boolean\" || descriptor.value == null) &&\n // the name goes into the template and the opening string unescaped; anything\n // else (a computed key with markup in it) takes the writer, whose attribute() escapes names\n ATTRIBUTE_NAME.test(key) &&\n key.charCodeAt(0) !== 36 &&\n key !== \"class\" &&\n key !== \"style\" &&\n key !== \"theme\" &&\n key !== \"ref\" &&\n !ChildProperties.has(key) &&\n !key.startsWith(\"on\") &&\n !key.startsWith(\"prop:\") &&\n !(stateful && key in stateful)\n );\n });\n};\n\n/**\n * the attribute string of baked attrs, built once at definition. the value\n * rules follow attribute(), which prints one prop on the server; the escaping\n * is local because the client build's escape is an empty stub, and the names\n * passed the ATTRIBUTE_NAME check. `<` stays unescaped, harmless in a quoted value\n */\nconst bakeAttributes = (attrs: Props): string => {\n let result = \"\";\n for (const key of Object.keys(attrs)) {\n const value = attrs[key];\n if (value == null || value === false) continue;\n result +=\n value === true || value === \"\" ? ` ${key}` : ` ${key}=\"${escapeAttribute(String(value))}\"`;\n }\n return result;\n};\n\nconst escapeAttribute = (value: string) => value.replaceAll(\"&\", \"&amp;\").replaceAll('\"', \"&quot;\");\n\n/** an attribute name that needs no escaping in markup */\nconst ATTRIBUTE_NAME = /^[A-Za-z_:][\\w:.-]*$/;\n\n/** parent attrs first, then own attrs read and override that result */\nconst composeAttrs = (attrs?: RuntimeAttrs, parent?: RuntimeAttrs): RuntimeAttrs | undefined => {\n if (!attrs) return parent;\n if (!parent) return attrs;\n // two objects without getters combine once here and stay an object; a\n // getter must run per render, inside the memo\n if (\n typeof attrs !== \"function\" &&\n typeof parent !== \"function\" &&\n !hasGetter(attrs) &&\n !hasGetter(parent)\n ) {\n return combineProps(parent, attrs);\n }\n const own = typeof attrs === \"function\" ? attrs : () => attrs;\n const parentFn = typeof parent === \"function\" ? parent : () => parent;\n return (props) => {\n const parentProps = parentFn(props);\n return combineProps(parentProps, own(combineProps(props, parentProps)));\n };\n};\n\n/** parent styles before own styles, with one collector and one style object */\nconst composeStyles = (own: StyleProcessor, parent?: StyleProcessor): StyleProcessor => {\n if (!parent) return own;\n return Object.assign(\n (props: unknown, classes: Parameters<StyleProcessor>[1], style: StyleObject) => {\n parent(props, classes, style);\n own(props, classes, style);\n },\n { $dynamic: own.$dynamic || parent.$dynamic },\n ) as StyleProcessor;\n};\n\n/**\n * attrs override props; class and style values combine, e.g.\n * { class: \"a\", foo: 1 } and { class: \"b\", bar: 2 } -> { class: \"a b\", foo: 1, bar: 2 }\n */\nconst combineProps = (props: Props, newProps: Props | null | undefined): Props => {\n if (!newProps) return props;\n // descriptors, not values: a spread would run every author getter here,\n // and a children getter renders (twice, and with the wrong hydration keys)\n const descriptors = {\n ...Object.getOwnPropertyDescriptors(props),\n ...Object.getOwnPropertyDescriptors(newProps),\n };\n // an equal class counts as nothing: own attrs get the combined props and\n // may hand the same class back, merging it again would duplicate it\n if (newProps.class && props.class !== newProps.class) {\n descriptors.class = valueDescriptor(mergeClasses(normalizeClass(props.class), newProps.class));\n }\n if (newProps.style && props.style !== newProps.style) {\n descriptors.style = valueDescriptor({\n ...unwrapStyle(props.style),\n ...unwrapStyle(newProps.style),\n });\n }\n return Object.defineProperties({}, descriptors) as Props;\n};\n\nconst valueDescriptor = (value: unknown): PropertyDescriptor => ({\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n});\n\nconst hasGetter = (object: object): boolean => {\n for (const key of Object.getOwnPropertyNames(object)) {\n if (!(\"value\" in Object.getOwnPropertyDescriptor(object, key)!)) return true;\n }\n return false;\n};\n\n/** static: no theme, no memo; one class per component, a children-only fast path for a tag */\nconst createStaticComponent = (\n tag: string | undefined,\n renderTarget: TargetRenderer,\n processor: StaticStyleProcessor,\n skip: (key: PropertyKey) => boolean,\n attrString: string,\n): AnyComponent<Props> => {\n const collected = new Classes();\n // a static processor ignores its props argument, it only adds class names\n processor(undefined, collected);\n const staticClass = collected.value || undefined;\n const classOf = (props: Props): string | undefined => {\n const userClass = normalizeClass(props.class);\n if (!userClass) return staticClass;\n // the collector skips generated names the author's class already holds,\n // and an atom may remove one\n const classes = new Classes(userClass);\n processor(props, classes);\n return classes.value || undefined;\n };\n const renderChildrenOnly =\n tag && !VOID_ELEMENTS.test(tag)\n ? createChildrenOnlyRenderer(tag, staticClass, attrString)\n : undefined;\n const meta: RenderMeta = {\n skip,\n compute: undefined,\n classOf,\n attrsAddKeys: false,\n unescapedClass: collected.generated ? staticClass : undefined,\n };\n return (props) => {\n // no props or only children: no skip walk, no props copy, no spread.\n // a reactive spread can add props later and needs the full client binding;\n // on the server props are read once so the proxy check does not matter\n if (renderChildrenOnly && (isServer || !($PROXY in props))) {\n const keys = Object.keys(props);\n if (!keys.length || (keys.length === 1 && keys[0] === \"children\")) {\n return renderChildrenOnly(props, keys.length !== 0);\n }\n }\n return renderTarget(props, meta);\n };\n};\n\n/** tag and class cached per component; only the children need a binding or serialization */\nconst createChildrenOnlyRenderer = (\n tag: string,\n className: string | undefined,\n attrString: string,\n): ((props: Props, hasChildren: boolean) => JSX.Element) => {\n if (isServer) {\n const head = `<${tag}${attrString}`;\n const open = `${className ? ` class=\"${ssrClassName(className)}\"` : \"\"}>`;\n const closing = `</${tag}>`;\n const parts = [head, open, closing];\n // as in childContent: script and style content is not escaped\n const raw = tag === \"script\" || tag === \"style\";\n return (props, hasChildren): { t: string } => {\n // key first: the child getter may render\n const hk = ssrHydrationKey();\n const children = hasChildren ? (raw ? props.children : escape(props.children)) : undefined;\n // text joins in place; anything else goes through ssr() like a compiled\n // template's hole, which handles async children and text separators\n const text = plainContent(children);\n if (text !== undefined) return { t: `${head}${hk}${open}${text}${closing}` };\n return ssr(parts, hk, children);\n };\n }\n const create = createElementTemplate(tag, attrString, className);\n return (props, hasChildren) => {\n const el = getNextElement(create);\n if (hasChildren) {\n // static text arrives as a plain value, not a getter: one insert, no effect.\n // a getter is dynamic and keeps the binding\n const descriptor = Object.getOwnPropertyDescriptor(props, \"children\");\n if (descriptor && \"value\" in descriptor) insert(el, descriptor.value);\n else insert(el, () => props.children);\n }\n runHydrationEvents();\n return el;\n };\n};\n\n/** dynamic: the provider theme plus one memo per element for attrs, class and style */\nconst createDynamicComponent =\n (\n renderTarget: TargetRenderer,\n attrsFn: RuntimeAttrsFn | undefined,\n processor: StyleProcessor,\n skip: (key: PropertyKey) => boolean,\n baked: boolean,\n ): AnyComponent<Props> =>\n (props) => {\n const theme = useTheme();\n // style callbacks see an explicit theme prop before the provider theme\n const propsWithTheme = withTheme(props, theme);\n // one memo per element runs the attrs function and every interpolation\n // of the style block, e.g. styled.button`color: ${props => props.color}`.\n // only reads inside it re-run it; the element is never re-created.\n // attrs and styles share the memo on purpose:\n // a style-only prop change also reruns attrs, still cheaper than\n // two memos per element\n const compute = () => computeStyles(props, propsWithTheme, attrsFn, processor);\n // the server has no updates, so a run-once closure replaces the memo:\n // solid's server createMemo still builds an owner and a node per element.\n // on the client the memo is transparent: it claims no hydration key\n const computed = isServer ? once(compute) : createMemo(compute, { transparent: true });\n // theme reaches the target only when attrs set their own; the provider\n // accessor must not land on the dom element. identity, not `in`: an attrs\n // function that spreads its input hands the provider accessor back\n const allowTheme =\n attrsFn &&\n (() => {\n const attrs = computed().attrs;\n return !!attrs && \"theme\" in attrs && attrs.theme !== theme;\n });\n return renderTarget(props, {\n skip: allowTheme ? (key) => (key === \"theme\" ? !allowTheme() : skip(key)) : skip,\n compute: computed,\n classOf: undefined,\n // baked attrs sit in the template and cannot add keys, the copy path serves them\n attrsAddKeys: !!attrsFn && !baked,\n unescapedClass: undefined,\n });\n };\n\n/** resolve attrs, then run the styles against that props view */\nconst computeStyles = (\n props: Props,\n propsWithTheme: Props,\n attrsFn: RuntimeAttrsFn | undefined,\n processor: StyleProcessor,\n): ComputedStyles => {\n const attrs = attrsFn?.(propsWithTheme);\n const authorClass = normalizeClass(props.class);\n const classes = new Classes(authorClass);\n const attrsClass = normalizeClass(attrs?.class);\n if (attrsClass) classes.add(attrsClass);\n // a static processor writes no style values, so the author's style object\n // passes through without a copy\n const style =\n processor.$dynamic || attrs?.style\n ? { ...unwrapStyle(props.style), ...unwrapStyle(attrs?.style) }\n : unwrapStyle(props.style);\n processor(\n attrs ? withAttrs(propsWithTheme, attrs) : propsWithTheme,\n classes,\n style as StyleObject,\n );\n return {\n class: classes.value || undefined,\n generatedClass: !authorClass && !attrsClass && classes.generated,\n style: style && hasKeys(style) ? style : undefined,\n attrs,\n };\n};\n\n/**\n * backing object of a props view: the author's props, a provider theme to\n * fill in when props has none, and attrs whose values win over props.\n * one shared handler serves both views, so a view costs one proxy and one\n * small object per element and no trap closures\n */\ntype View = { props: Props; theme?: Accessor<YakTheme>; attrs?: Props };\n\nconst viewTraps: ProxyHandler<View> = {\n get: ({ props, theme, attrs }, key) => {\n if (key === \"theme\" && theme && !(\"theme\" in props)) return theme;\n if (attrs && key in attrs) return Reflect.get(attrs, key);\n return Reflect.get(props, key);\n },\n // no props check for theme here: when props has one, Reflect.has says so anyway\n has: ({ props, theme, attrs }, key) =>\n (key === \"theme\" && !!theme) || (!!attrs && key in attrs) || Reflect.has(props, key),\n ownKeys: ({ props, theme, attrs }) => {\n const keys = new Set(Reflect.ownKeys(props));\n if (attrs) for (const key of Reflect.ownKeys(attrs)) keys.add(key);\n if (theme) keys.add(\"theme\");\n return [...keys];\n },\n getOwnPropertyDescriptor: ({ props, theme, attrs }, key) => {\n if (key === \"theme\" && theme && !(\"theme\" in props)) {\n return { value: theme, enumerable: true, configurable: true };\n }\n const descriptor = Reflect.getOwnPropertyDescriptor(attrs && key in attrs ? attrs : props, key);\n // a prop the view adds must report configurable, the backing object has no such key\n return descriptor && { ...descriptor, configurable: true };\n },\n};\n\n/**\n * the provider theme when props has none. a props proxy (a reactive spread)\n * can gain or lose its theme key later, so it always gets the view; a plain\n * object with a theme is used as is\n */\nconst withTheme = (props: Props, theme: Accessor<YakTheme>): Props =>\n (!($PROXY in props) && \"theme\" in props\n ? props\n : new Proxy({ props, theme }, viewTraps)) as Props;\n\n/** style interpolations read attrs over author props, getters only on demand */\nconst withAttrs = (props: Props, attrs: Props): Props =>\n new Proxy({ props, attrs }, viewTraps) as Props;\n\n/** server stand-in for createMemo: run once, no owner and no node */\nconst once = <T extends object>(fn: () => T): (() => T) => {\n let value: T | undefined;\n return () => (value ??= fn());\n};\n\n/** string styles become objects before css variables are added */\nconst unwrapStyle = (style: StyleObject | string | undefined): StyleObject | undefined => {\n if (typeof style !== \"string\") {\n return style;\n }\n const result: Record<string, string> = {};\n for (const declaration of style.split(\";\")) {\n const colonIndex = declaration.indexOf(\":\");\n if (colonIndex === -1) continue;\n const property = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n if (property && value) {\n result[property] = value;\n }\n }\n return result as StyleObject;\n};\n\n/** no array for a yes/no answer */\nconst hasKeys = (object: object): boolean => {\n for (const _ in object) return true;\n return false;\n};\n\n/** the target's render path, chosen once per styled component */\nconst createTargetRenderer = (\n target: AnyComponent<any> | string,\n attrString: string,\n): TargetRenderer => {\n if (typeof target !== \"string\") {\n return (props, meta) => createComponent(target, targetProps(props, meta));\n }\n if (isServer) {\n const head = `<${target}${attrString}`;\n const closing = VOID_ELEMENTS.test(target) ? undefined : `</${target}>`;\n return (props, meta) => serializeElement(target, head, closing, props, meta);\n }\n return createElementRenderer(target, attrString);\n};\n\n/**\n * the server writer: writes the html string by hand instead of using ssrElement.\n * ssrElement needs a filtered props object with getters to keep the\n * read order, that costs more than writing directly\n */\nconst serializeElement = (\n tag: string,\n head: string,\n closing: string | undefined,\n props: Props,\n meta: RenderMeta,\n): { t: string } => {\n // key first: a prop getter may render a child and take keys\n const hk = ssrHydrationKey();\n // one memo read for class, style and attrs. branch on meta.compute, not\n // on computed, so the static writer makes no call here\n let computed: ComputedStyles | undefined;\n let className: string | undefined;\n if (meta.compute) {\n computed = meta.compute();\n className = computed.class;\n } else {\n className = meta.classOf(props);\n }\n const attrs = computed?.attrs;\n const style = computed?.style;\n const skip = meta.skip;\n let result = head + hk;\n let children: unknown;\n // a textarea's value is its content, like solid's ssrElement writes it\n const textarea = tag === \"textarea\";\n // author keys first, an attrs value wins; then the keys only attrs has.\n // two loops on purpose: one loop over both key sets is slower on the\n // attrs path, it needs a push and a second `in` per key.\n // only the first child prop is read, and none on a void tag: a child\n // getter may render and take hydration keys\n for (const key of Object.keys(props)) {\n if (skip(key)) continue;\n const source = attrs && key in attrs ? attrs : props;\n if (!isChildKey(key, textarea)) result += attribute(key, source[key]);\n else if (children === undefined && closing) children = childContent(tag, key, source[key]);\n }\n if (attrs) {\n for (const key of Object.keys(attrs)) {\n if (skip(key) || key in props) continue;\n if (!isChildKey(key, textarea)) result += attribute(key, attrs[key]);\n else if (children === undefined && closing) children = childContent(tag, key, attrs[key]);\n }\n }\n // generated class names need no escaping, an author or attrs class does\n if (className !== undefined) {\n const generated = computed ? computed.generatedClass : className === meta.unescapedClass;\n result += ` class=\"${generated ? className : ssrClassName(className)}\"`;\n }\n if (style !== undefined) result += ` style=\"${ssrStyle(style as Record<string, string>)}\"`;\n // a void tag has no children: the finished string is the node, no ssr() call.\n // the space keeps an unquoted hydration key from swallowing the slash\n if (!closing) return { t: result + \" />\" };\n // text and finished nodes join in place, as solid's own resolver does.\n // functions, arrays and nodes with pending holes go to ssr(): async wrap,\n // error boundary routing, and the separator marker between adjacent\n // text items so the client can claim two text nodes\n const text = plainContent(children);\n if (text !== undefined) return { t: result + \">\" + text + closing };\n return ssr([result + \">\", closing], children);\n};\n\n/** a prop that becomes the element's content: solid's child properties, and a textarea's value */\nconst isChildKey = (key: string, textarea: boolean) =>\n ChildProperties.has(key) || (textarea && (key === \"value\" || key === \"defaultValue\"));\n\n/**\n * the string a child resolves to without ssr(), else undefined. a server\n * node is { t: html, h?: pending async holes }; one with holes needs ssr()\n */\nconst plainContent = (node: unknown): string | undefined => {\n if (typeof node === \"string\") return node;\n if (typeof node === \"number\") return String(node);\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node !== \"object\" || Array.isArray(node)) return undefined;\n const server = node as { t?: unknown; h?: unknown[] };\n if (server.h && server.h.length > 0) return undefined;\n if (typeof server.t === \"string\") return server.t;\n return undefined;\n};\n\n/**\n * one server attribute with its leading space, the value rules of solid's\n * ssrElement; bakeAttributes applies the same rules once at definition\n */\nconst attribute = (prop: string, value: unknown): string => {\n if (prop === \"style\") return ` style=\"${ssrStyle(value as string)}\"`;\n // class never reaches here, skip drops it; the branch stays, the static\n // writer is slower without it (jit code placement)\n if (prop === \"class\") return ` class=\"${ssrClassName(value as string)}\"`;\n // refs, event handlers and prop: bindings only exist on the client\n if (value == undefined || prop === \"ref\" || prop.startsWith(\"on\") || prop.startsWith(\"prop:\")) {\n return \"\";\n }\n if (typeof value === \"boolean\") return value ? ` ${escape(prop)}` : \"\";\n return value === \"\" ? ` ${escape(prop)}` : ` ${escape(prop)}=\"${escape(value, true)}\"`;\n};\n\n/** raw markup stays as is, every other child value is escaped */\nconst childContent = (tag: string, prop: string, value: unknown): unknown =>\n tag === \"script\" || tag === \"style\" || prop === \"innerHTML\" ? value : escape(value);\n\n/** the cached template for a fixed tag; svg and mathml tags parse inside their namespace root */\nconst createElementTemplate = (tag: string, attrString: string, className?: string) => {\n // atoms can put author names into the static class, so the template escapes it\n const classAttribute = className ? ` class=\"${escapeAttribute(className)}\"` : \"\";\n const opening = `<${tag}${attrString}${classAttribute}>`;\n // flag 2 returns firstChild.firstChild\n // skips the <svg>/<math> wrapper we add so the child parses in its namespace\n if (SVGElements.has(tag) && tag !== \"svg\") return template(`<svg>${opening}`, 2);\n if (MathMLElements.has(tag) && tag !== \"math\") return template(`<math>${opening}`, 2);\n return template(opening);\n};\n\n/**\n * bind a fixed client tag without dynamic()'s per-element memo. hydration\n * claims the server node by key; a fresh mount clones the cached template.\n * solid's SVGElements set lacks a, script, style and title, so a fresh\n * mount makes them html elements even inside an <svg>, as solid's own\n * dynamic() does\n */\nconst createElementRenderer = (tag: string, attrString: string): TargetRenderer => {\n const create = createElementTemplate(tag, attrString);\n return (props, meta) => bindElement(getNextElement(create), props, meta);\n};\n\nconst bindElement = (el: Element, props: Props, meta: RenderMeta): Element => {\n const bound = targetProps(props, meta);\n // a proxy can add children later, so it keeps the child binding\n const skipChildren = !($PROXY in bound) && !(\"children\" in bound);\n // no untrack here: a component body runs untracked\n spread(el, bound, skipChildren);\n // replay events once the element's bindings are ready\n runHydrationEvents();\n return el;\n};\n\n/**\n * the props the target sees: author props, attrs output, computed class and style\n * $-props and the provider theme are hidden. solid's omit() takes fixed key\n * names and $-props are open-ended, so the filter is hand-written\n *\n * plain copy when the keys can't change, proxy when attrs or a reactive\n * spread can add keys and downstream omit() has to notice\n * the copy stays unmarked on purpose, a $PROXY mark makes omit()/merge()\n * wrap it again and every read gets slower\n */\nconst targetProps = (props: Props, meta: RenderMeta): Record<PropertyKey, unknown> => {\n if (!meta.attrsAddKeys && !($PROXY in props)) return copyProps(props, meta);\n return proxyProps(props, meta);\n};\n\n/**\n * copies descriptors without reading them: a getter like icon={<Icon />}\n * renders a child and takes hydration keys, the target reads it in its own\n * order. moving the getter is safe, solid's compiled getters do not depend on `this`\n */\nconst copyProps = (props: Props, meta: RenderMeta): Record<PropertyKey, unknown> => {\n const { compute, classOf } = meta;\n const out: Record<PropertyKey, unknown> = {};\n // string keys only, like solid's omit(): a symbol never reaches the target\n for (const key of Object.getOwnPropertyNames(props)) {\n if (meta.skip(key)) continue;\n const descriptor = Reflect.getOwnPropertyDescriptor(props, key)!;\n if (\"value\" in descriptor && descriptor.enumerable) {\n out[key] = descriptor.value;\n } else {\n Object.defineProperty(out, key, descriptor);\n }\n }\n if (isServer) {\n // the values are final on the server: plain values take the value path\n // in solid's omit() and merge() instead of a getter per read\n if (compute) {\n const computed = compute();\n out.class = computed.class;\n if (computed.style !== undefined) out.style = computed.style;\n } else out.class = classOf(props);\n return out;\n }\n const classFn = compute ? () => compute().class : () => classOf(props);\n const styleFn = styleGetter(compute);\n Object.defineProperty(out, \"class\", {\n get: classFn,\n enumerable: true,\n configurable: true,\n });\n if (styleFn) {\n Object.defineProperty(out, \"style\", { get: styleFn, enumerable: true, configurable: true });\n }\n return out;\n};\n\n/**\n * the style accessor a component target receives, or none\n * on the server the value is final, and a target that spreads its props\n * into ssrElement would write style=\"\" for an undefined one; on the client\n * the accessor stays so the memo can set a style later\n */\nconst styleGetter = (\n compute: (() => ComputedStyles) | undefined,\n): (() => StyleObject | undefined) | undefined => {\n if (!compute) return undefined;\n if (isServer && compute().style === undefined) return undefined;\n return () => compute().style;\n};\n\n/**\n * attrs and reactive spreads can add or remove keys; the $PROXY mark keeps\n * downstream omit() calls reactive\n */\nconst proxyProps = (props: Props, meta: RenderMeta): Record<PropertyKey, unknown> => {\n // trap closures per element on purpose, not shared with viewTraps: solid's\n // for-in hits two traps per key, so a backing object would add an\n // indirection to each\n const { skip, compute, classOf } = meta;\n // meta.attrsAddKeys, not the destructured copy: the read narrows meta.compute\n const attrsProps = () => (meta.attrsAddKeys ? meta.compute().attrs : undefined);\n const classFn = compute ? () => compute().class : () => classOf(props);\n const styleFn = styleGetter(compute);\n const contributed = (key: PropertyKey) =>\n key === \"class\" ? classFn : key === \"style\" ? styleFn : undefined;\n const fromAttrs = (key: PropertyKey) => {\n const attrs = attrsProps();\n return attrs && key in attrs ? attrs : undefined;\n };\n return new Proxy(props, {\n get(target, key, receiver) {\n // the receiver, like solid's own props proxies: solid's spread walks\n // a proxy's keys through its traps only when props[$PROXY] === props\n if (key === $PROXY) return receiver;\n const getter = contributed(key);\n if (getter) return getter();\n if (skip(key)) return undefined;\n const attrs = fromAttrs(key);\n return attrs ? attrs[key] : Reflect.get(target, key);\n },\n has(target, key) {\n if (key === $PROXY) return true;\n if (contributed(key)) return true;\n if (skip(key)) return false;\n return Reflect.has(target, key) || fromAttrs(key) !== undefined;\n },\n ownKeys(target) {\n const keys = new Set<string | symbol>();\n for (const key of Reflect.ownKeys(target)) if (!skip(key)) keys.add(key);\n for (const key of Object.keys(attrsProps() ?? {})) if (!skip(key)) keys.add(key);\n // class and style are always own keys, listed after the author keys and attrs\n keys.add(\"class\");\n if (styleFn) keys.add(\"style\");\n return [...keys];\n },\n getOwnPropertyDescriptor(target, key) {\n const getter = contributed(key);\n if (getter) return { enumerable: true, configurable: true, get: getter };\n if (skip(key)) return undefined;\n const attrs = fromAttrs(key);\n if (attrs) {\n return { enumerable: true, configurable: true, get: () => attrsProps()?.[key] };\n }\n return Reflect.getOwnPropertyDescriptor(target, key);\n },\n });\n};\n","import type { JSX } from \"@solidjs/web\";\nimport { styled as StyledFactory } from \"../styled.js\";\n\nexport const styled = /* @__PURE__ */ new Proxy(StyledFactory, {\n get(target, key) {\n // only a tag name becomes a factory. symbols, the function's own\n // properties and `then` pass through, so a promise that resolves the\n // factory does not take it for a thenable\n if (typeof key !== \"string\" || key === \"then\" || key in target) return Reflect.get(target, key);\n return target(key as keyof JSX.IntrinsicElements);\n },\n}) as typeof StyledFactory;\n","import type { globalStyle as globalStyleInternal } from \"../globalStyle.js\";\n\nexport type { GlobalStyleInterpolation } from \"../globalStyle.js\";\n\n/**\n * Test-friendly mock of `globalStyle`.\n *\n * `globalStyle` has no runtime behaviour: the SWC plugin extracts its CSS at\n * build time and replaces the call with a no-op. The mock mirrors that: it does\n * nothing so yak files can be imported in Jest/Vitest without the compiler.\n */\nexport const globalStyle: typeof globalStyleInternal = (_styles, ..._values) => {\n // no-op in the mock\n};\n"],"mappings":"8bAOA,MAAa,EAAqB,OAAO,IAAI,sBAAsB,EAUnE,IAAa,EAAb,KAA+C,CAC7C,MAMA,UAAY,GACZ,YAAY,EAAkB,CAC5B,KAAK,MAAQ,GAAW,EAC1B,CACA,IAAI,EAAc,EAAY,GAAM,CAC7B,IAAW,KAAK,UAAY,IAC5B,KAAK,MAEE,KAAK,IAAI,CAAI,IACvB,KAAK,OAAS,IAAM,GAFpB,KAAK,MAAQ,CAIjB,CACA,IAAI,EAAc,CAChB,OAAQ,IAAM,KAAK,MAAQ,IAAA,CAAK,SAAS,IAAM,EAAO,GAAG,CAC3D,CACA,OAAO,EAAc,CACf,KAAK,IAAI,CAAI,IACf,KAAK,MAAQ,KAAK,MACf,MAAM,GAAG,CAAC,CACV,OAAQ,GAAa,IAAa,CAAI,CAAC,CACvC,KAAK,GAAG,EAEf,CACF,EA4DA,SAAgBA,EAAY,GAAG,EAAkD,CAC/E,IAAI,EACE,EAAqD,CAAC,EAC5D,IAAK,IAAM,KAAO,EAGZ,OAAO,GAAQ,SACjB,EAAc,EAKP,OAAO,GAAQ,WACtB,EAAoB,KAAK,CAAG,EAKrB,OAAO,GAAQ,UAAY,UAAW,GAC7C,EAAoB,MAAM,EAAO,EAAG,IAAU,CAC5C,IAAK,IAAM,KAAO,EAAI,MAAO,CAC3B,IAAM,EAAQ,EAAI,MAAM,GACxB,AAS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AAK,IAAM,KAAO,QAAQ,QAAQ,CAAM,EAAQ,EAAK,CAAG,GAAG,EAAK,IAAI,CAAG,EACvE,IAAK,IAAM,KAAO,OAAO,KAAK,EAAW,GAAK,CAAC,CAAC,EAAQ,EAAK,CAAG,GAAG,EAAK,IAAI,CAAG,EAI/E,OAFA,EAAK,IAAI,OAAO,EACZ,GAAS,EAAK,IAAI,OAAO,EACtB,CAAC,GAAG,CAAI,CACjB,EACA,yBAAyB,EAAQ,EAAK,CACpC,IAAM,EAAS,EAAY,CAAG,EAC9B,GAAI,EAAQ,MAAO,CAAE,WAAY,GAAM,aAAc,GAAM,IAAK,CAAO,EACnE,MAAK,CAAG,EAKZ,OAJc,EAAU,CAChB,EACC,CAAE,WAAY,GAAM,aAAc,GAAM,QAAW,EAAW,CAAC,GAAG,EAAK,EAEzE,QAAQ,yBAAyB,EAAQ,CAAG,CACrD,CACF,CAAC,CACH,ECz3Ba,GAAyB,IAAI,MAAMC,GAAe,CAC7D,IAAI,EAAQ,EAAK,CAKf,OADI,OAAO,GAAQ,UAAY,IAAQ,QAAU,KAAO,EAAe,QAAQ,IAAI,EAAQ,CAAG,EACvF,EAAO,CAAkC,CAClD,CACF,CAAC,ECAY,IAA2C,EAAS,GAAG,IAAY,CAEhF"}
1
+ {"version":3,"file":"index.js","names":["css","css","styled","css","useTheme","StyledFactory"],"sources":["../runtime/cssLiteral.ts","../runtime/atoms.ts","../runtime/mocks/cssLiteral.ts","../runtime/mocks/keyframes.ts","../runtime/internals/mergeClasses.ts","../runtime/styled.ts","../runtime/mocks/styled.ts","../runtime/mocks/globalStyle.ts"],"sourcesContent":["import type { YakTheme } from \"./index.ts\";\nimport type { Accessor } from \"solid-js\";\nimport { ClassCollector, CompiledStyleProcessor, StyleObject } from \"./publicStyledApi.js\";\n\n// Symbol.for, not Symbol(): the package ships two bundles (the public entry\n// and the internal one the compiler imports) and both contain this module. a\n// styled component created through one must be recognized by the other\nexport const yakComponentSymbol = Symbol.for(\"@yak/solid:component\");\n\n/**\n * the class names of one render, kept as one space-separated string in the\n * order the style block adds them. add() is the hot path: an append, and a\n * duplicate check only once a second name arrives. has() and delete() exist\n * for runtime processors that take a name back out, such as an atom that\n * reverts a class. a Set would need a split and a join per render for the\n * same string\n */\nexport class Classes implements ClassCollector {\n value: string;\n /**\n * false once a name came from the author, such as an atom. compiler names\n * are safe to print as they are; serializeElement in styled.ts escapes the\n * class once this is false\n */\n generated = true;\n constructor(initial?: string) {\n this.value = initial || \"\";\n }\n add(name: string, generated = true) {\n if (!generated) this.generated = false;\n if (!this.value) {\n this.value = name;\n } else if (!this.has(name)) {\n this.value += \" \" + name;\n }\n }\n has(name: string) {\n return (\" \" + this.value + \" \").includes(\" \" + name + \" \");\n }\n delete(name: string) {\n if (this.has(name)) {\n this.value = this.value\n .split(\" \")\n .filter((existing) => existing !== name)\n .join(\" \");\n }\n }\n}\n\nexport type ComponentStyles<TProps> = (props: TProps) => {\n class: string;\n style?: {\n [key: string]: string;\n };\n};\n\nexport type CSSInterpolation<TProps> =\n | string\n | number\n | undefined\n | null\n | false\n | ComponentStyles<TProps>\n | {\n // type only identifier to allow targeting components\n // e.g. styled.svg`${Button}:hover & { fill: red; }`\n [yakComponentSymbol]: any;\n }\n | ((props: TProps) => CSSInterpolation<TProps>);\n\ntype CSSStyles<TProps = {}> = {\n style: { [key: string]: string | ((props: TProps) => string) };\n};\n\nexport type CSSFunction = <TProps>(\n styles: TemplateStringsArray,\n ...values: CSSInterpolation<NoInfer<TProps> & { theme: Accessor<YakTheme> }>[]\n) => ComponentStyles<TProps>;\n\nexport type NestedRuntimeStyleProcessor = (\n props: unknown,\n classes: ClassCollector,\n style: StyleObject,\n) =>\n | {\n class?: string;\n style?: StyleObject;\n }\n | void\n | false\n | null\n | string\n | number\n | NestedRuntimeStyleProcessor;\n\n/**\n * the runtime behind css``. the compiler rewrites every css`` and styled``\n * call, so what arrives here is never the template the author wrote but its\n * compiled form: class names, callbacks and css-variable maps (examples in\n * the loop below). the public typings describe the call before compilation,\n * which is why this function is internal: mocks/cssLiteral.ts exports the\n * css the author sees, cast to the public type.\n *\n * it returns one processor, (props, classes, style) => void, that runs every\n * compiled piece: class names go into the collector, css values into the\n * style object\n */\nexport function css<TProps>(...args: Array<any>): CompiledStyleProcessor<TProps> {\n let staticClass: string | undefined;\n const dynamicCssFunctions: NestedRuntimeStyleProcessor[] = [];\n for (const arg of args as Array<string | NestedRuntimeStyleProcessor | CSSStyles<any>>) {\n // static css became a css-module class name at build time:\n // css`color: red;` -> css(\"yak31e4\")\n if (typeof arg === \"string\") {\n staticClass = arg;\n }\n // conditional css stays a callback that returns another compiled css():\n // css`${props => props.active && css`color: red;`}`\n // -> css(props => props.active && css(\"yak31e4\"))\n else if (typeof arg === \"function\") {\n dynamicCssFunctions.push(arg);\n }\n // a css value became a variable the callback fills at render time:\n // css`transform: translate(${props => props.x});`\n // -> css(\"yak31e4\", { style: { \"--yakVarX\": props => props.x } })\n else if (typeof arg === \"object\" && \"style\" in arg) {\n dynamicCssFunctions.push((props, _, style) => {\n for (const key in arg.style) {\n const value = arg.style[key];\n if (typeof value === \"function\") {\n style[key as keyof StyleObject] = String(\n // a callback may return another callback before it yields the\n // value, such as a theme-dependent one:\n // const color = (props) => props.theme().mode === \"dark\" ? \"black\" : \"white\";\n // css`border-color: ${color};`\n recursivePropExecution(props, value),\n ) as never;\n } else {\n style[key as keyof StyleObject] = String(value) as never;\n }\n }\n });\n }\n }\n\n // no dynamic parts, the common case: $dynamic false lets styled() skip the\n // theme lookup and the style object for the component\n if (dynamicCssFunctions.length === 0) {\n return Object.assign(\n (_: unknown, classes: ClassCollector) => {\n if (staticClass) {\n classes.add(staticClass);\n }\n },\n { $dynamic: false as const },\n ) satisfies CompiledStyleProcessor<TProps>;\n }\n\n return Object.assign(\n (props: TProps, classes: ClassCollector, allStyles: StyleObject) => {\n if (staticClass) {\n classes.add(staticClass);\n }\n for (let i = 0; i < dynamicCssFunctions.length; i++) {\n runProcessor(props, dynamicCssFunctions[i], classes, allStyles);\n }\n },\n { $dynamic: true as const },\n ) satisfies CompiledStyleProcessor<TProps>;\n}\n\n/** run one processor and fold what it returns into the collector and the style object */\nconst runProcessor = (\n props: unknown,\n fn: NestedRuntimeStyleProcessor,\n classes: ClassCollector,\n style: StyleObject,\n) => {\n let result = fn(props, classes, style);\n while (result) {\n if (typeof result === \"function\") {\n result = result(props, classes, style);\n continue;\n } else if (typeof result === \"object\") {\n const resultClass = \"class\" in result ? result.class : undefined;\n if (resultClass) {\n classes.add(resultClass);\n }\n if (\"style\" in result && result.style) {\n for (const key in result.style) {\n // both objects use StyleObject; typescript loses the key/value relation in this loop\n style[key as keyof StyleObject] = result.style[key as keyof StyleObject] as any;\n }\n }\n }\n break;\n }\n};\n\nconst recursivePropExecution = (props: unknown, fn: (props: unknown) => any): string | number => {\n const result = fn(props);\n if (typeof result === \"function\") {\n return recursivePropExecution(props, result);\n }\n // typeof guards first: the `process.env` lookup is a real per-call cost\n // for unbundled Node consumers, so it must only run on the invalid path\n if (typeof result !== \"string\" && typeof result !== \"number\" && !(result instanceof String)) {\n if (process.env.NODE_ENV === \"development\") {\n throw new Error(\n `Dynamic CSS functions must return a string or number but returned ${JSON.stringify(\n result,\n )}\\n\\nDynamic CSS function: ${fn.toString()}\\n`,\n );\n }\n }\n return result;\n};\n","import { ComponentStyles, css } from \"./cssLiteral.js\";\nimport { RuntimeStyleProcessor } from \"./publicStyledApi.js\";\n\n/**\n * Allows to use atomic CSS classes in a styled or css block\n *\n * @usage\n *\n * ```tsx\n * import { styled, atoms } from \"@yak/solid\";\n *\n * const Button = styled.button<{ $primary?: boolean }>`\n * ${atoms(\"text-teal-600\", \"text-base\", \"rounded-md\")}\n * ${props => props.$primary && atoms(\"shadow-md\")}\n * `;\n * ```\n */\nexport const atoms = <T>(\n ...atoms: (string | RuntimeStyleProcessor<T> | false)[]\n): ComponentStyles<T> => {\n const staticClasses: string[] = [];\n const dynamicFunctions: RuntimeStyleProcessor<T>[] = [];\n\n for (const atom of atoms) {\n if (typeof atom === \"string\") {\n staticClasses.push(...atom.split(\" \"));\n } else if (typeof atom === \"function\") {\n dynamicFunctions.push(atom);\n }\n }\n\n const runtimeFunctions: RuntimeStyleProcessor<T>[] =\n staticClasses.length > 0\n ? [\n (_, classes) => {\n // author strings, not compiler names: the server writer must escape them\n staticClasses.forEach((cls) => classes.add(cls, false));\n },\n ...dynamicFunctions,\n ]\n : dynamicFunctions;\n\n // css() is typed for its compiled arguments; the public type describes the\n // interpolation the author writes before compilation\n return css(...runtimeFunctions) as unknown as ComponentStyles<T>;\n};\n","import type { CSSFunction, NestedRuntimeStyleProcessor } from \"../cssLiteral.js\";\n\n/**\n * Allows to use CSS styles in a styled or css block\n *\n * e.g.\n *\n * ```tsx\n * const Component = styled.div`\n * color: black;\n * ${({$active}) => $active && css`color: red;`}\n * `;\n * ```\n */\nexport const css: CSSFunction = (styles: TemplateStringsArray, ...args: unknown[]) => {\n // When called in yak files as a template tag (without SWC transformation),\n // return { __yak: rawCss } so the cross-file resolver can\n // extract the mixin value from evaluated .yak files.\n if (Array.isArray(styles) && \"raw\" in styles) {\n let rawCss = styles[0];\n for (let i = 0; i < args.length; i++) {\n const interpolation = args[i];\n rawCss +=\n interpolation && typeof interpolation === \"object\" && \"__yak\" in interpolation\n ? (interpolation as { __yak: string }).__yak\n : String(interpolation);\n rawCss += styles[i + 1];\n }\n return { __yak: rawCss } as any;\n }\n\n const dynamicCssFunctions: NestedRuntimeStyleProcessor[] = [];\n for (const arg of args as Array<string | Function | object>) {\n // Dynamic CSS e.g.\n // css`${props => props.active && css`color: red;`}`\n // compiled -> css((props: { active: boolean }) => props.active && css(\"yak31e4\"))\n if (typeof arg === \"function\") {\n dynamicCssFunctions.push(arg as unknown as NestedRuntimeStyleProcessor);\n }\n }\n if (dynamicCssFunctions.length === 0) {\n return {\n class: \"\",\n style: undefined,\n };\n }\n return ((props: unknown) => {\n for (let i = 0; i < dynamicCssFunctions.length; i++) {\n // run the dynamic expressions and ignore the return value\n // the execution is important to ensure that the user code is executed\n // the same way as in the real runtime\n executeDynamicExpressionRecursively(props, dynamicCssFunctions[i]);\n }\n return {\n class: \"\",\n style: undefined,\n };\n }) as any;\n};\n\nfunction executeDynamicExpressionRecursively(\n props: unknown,\n expression: NestedRuntimeStyleProcessor,\n) {\n const classes = new Set<string>();\n const style = {};\n let result = expression(props, classes, style);\n while (typeof result === \"function\") {\n result = result(props, classes, style);\n }\n return result;\n}\n","import type { keyframes as keyframesInternal } from \"../keyframes.js\";\n\n/**\n * Allows to use CSS keyframe animations in a styled or css block\n *\n * @usage\n *\n * ```tsx\n * import { styled, keyframes } from \"@yak/solid\";\n *\n * const rotate = keyframes`\n * from {\n * transform: rotate(0deg);\n * }\n * to {\n * transform: rotate(360deg);\n * }\n * `;\n *\n * const Spinner = styled.div`\n * animation: ${rotate} 1s linear infinite;\n * `;\n * ```\n */\nexport const keyframes: typeof keyframesInternal = (_styles, ..._dynamic) => {\n // the keyframes function is a no-op in the mock\n // as it has no dynamic runtime behavior but only css\n return \"\";\n};\n","/**\n * Normalize Solid `class` values for string merging.\n * Solid 2 allows strings, arrays and object syntax on the class attribute.\n */\nexport const normalizeClass = (value: unknown): string => {\n if (!value) return \"\";\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.map(normalizeClass).filter(Boolean).join(\" \");\n if (typeof value === \"object\") {\n return Object.keys(value)\n .filter((key) => (value as Record<string, unknown>)[key])\n .join(\" \");\n }\n return String(value);\n};\n\n/**\n * Merges the folded yak class name with a user `class` value.\n *\n * Injected by the compiler (as `__yak_mergeClassNames`) when it replaces a JSX\n * usage of a fully static styled component with a plain element:\n * ```tsx\n * const Card = styled.div`color: red;`;\n * <Card class={active() && \"active\"} />\n * ```\n * becomes\n * ```tsx\n * <div class={__yak_mergeClassNames(\"yX\", active() && \"active\")} />\n * ```\n * combineProps in styled.ts uses it for two attrs layers' classes as well.\n */\nexport const mergeClasses = (yakClass: string, userClass: unknown): string | undefined => {\n const user = normalizeClass(userClass);\n if (!yakClass) return user || undefined;\n if (!user) return yakClass;\n return yakClass + \" \" + user;\n};\n","// the compiler extracts the css at build time; this file only builds class\n// and style per element, prints the tag on the server and binds it on the\n// client. the map, for a reader who lands in the middle:\n//\n// styled() flattens a chain of styled components and picks one of two\n// component shapes at definition. static: the class is fixed, there is no\n// attrs function and the css block writes no style values at render time,\n// so no memo and no theme read. dynamic: one memo per element resolves\n// attrs, class and style.\n//\n// both hand the target a RenderMeta and a props view. on the server\n// serializeElement (the writer) prints a tag, on the client bindElement\n// spreads onto a cloned template, a component target gets targetProps\n// (a copy or a proxy).\n//\n// the one rule every path keeps: a prop getter may render a child and take\n// hydration keys of its own, so the element takes its key first and reads\n// each getter once, in the target's order.\n//\n// words: author = the app code that writes the css block, renders the\n// component and passes props; target = the tag or component under the\n// styled layer; attrs = the .attrs() values, an object or a function of\n// props; baked = object attrs printed into the tag at definition; view = a\n// proxy over props that adds the theme or attrs; collector = the Classes\n// instance a css block adds its names to; atom = a class name the author\n// passes into a css block via atoms(\"...\"), author text that needs\n// escaping; reactive spread = a {...props} in jsx, which solid compiles to\n// a proxy marked with $PROXY; hole = a slot in a server template that\n// ssr() fills, possibly async; hydration key = the id the server prints on\n// an element so the client can claim the same node\nimport { css, Classes, yakComponentSymbol } from \"./cssLiteral.js\";\nimport type {\n AnyComponent,\n Attrs,\n AttrsMerged,\n Styled,\n YakComponent,\n StyledFn,\n HtmlTags,\n Substitute,\n StyledLiteral,\n CompiledStyleProcessor,\n StaticStyleProcessor,\n StyleObject,\n} from \"./publicStyledApi.js\";\nimport { $PROXY, createMemo, merge, omit } from \"solid-js\";\n// the helpers solid's compiled jsx calls; this file hand-writes what the compiler would emit for a tag\nimport {\n ChildProperties,\n createComponent,\n DOMWithState,\n escape,\n getNextElement,\n insert,\n isServer,\n MathMLElements,\n runHydrationEvents,\n spread,\n ssr,\n ssrClassName,\n ssrHydrationKey,\n ssrStyle,\n SVGElements,\n template,\n type JSX,\n} from \"@solidjs/web\";\nimport { mergeClasses, normalizeClass } from \"./internals/mergeClasses.js\";\n// the runtime and the app share one theme context; vite can alias this export\nimport { useTheme } from \"@yak/solid/context\";\nimport type { YakTheme } from \"./context/index.js\";\nimport type { Accessor } from \"solid-js\";\n\n/** the props a styled component receives from its author; theme is an accessor (the provider's or the author's) */\ntype Props = {\n class?: string;\n style?: StyleObject | string;\n theme?: Accessor<YakTheme>;\n} & Record<PropertyKey, unknown>;\n\n/**\n * the compiled css block: adds its class names to the collector and, when\n * $dynamic, style values for the props; the css itself is extracted at build time\n */\ntype StyleProcessor = CompiledStyleProcessor<unknown>;\n\ntype RuntimeAttrsFn = (props: Props) => Props;\n\n/** the .attrs() values: an object, or a function of the author's props */\ntype RuntimeAttrs = Props | RuntimeAttrsFn;\n\ntype ComputedStyles = {\n class: string | undefined;\n /** true when the class holds generated names only, nothing from the author or attrs; the writer prints it unescaped then */\n generatedClass: boolean;\n style: StyleObject | undefined;\n attrs: Props | undefined;\n};\n\n/**\n * the information to build class and style for one render\n * kept outside of the component props so solid never copies or filters\n * it when it walks the props object\n */\ntype RenderMeta = StaticMeta | DynamicMeta;\n\n/** static component (fixed class, no attrs function, no style values at render time): one meta per component, the class comes from classOf */\ntype StaticMeta = {\n /** keys the target must never see; the rule is `skip` in yakStyled */\n skip: (key: PropertyKey) => boolean;\n compute: undefined;\n classOf: (props: Props) => string | undefined;\n attrsAddKeys: false;\n /** the static class when every name in it is generated, so the writer prints it unescaped; undefined when an atom put author text in it */\n unescapedClass: string | undefined;\n};\n\n/**\n * dynamic component: one memo (run once on the server) holds class,\n * style and attrs, one meta per element. the two meta literals (in\n * createStaticComponent and createDynamicComponent) keep the same keys in\n * the same order so every meta read sees one shape\n */\ntype DynamicMeta = {\n skip: (key: PropertyKey) => boolean;\n compute: () => ComputedStyles;\n classOf: undefined;\n /**\n * an attrs function may add keys at render time, so the target gets a\n * proxy, not a copy. decided at definition: the memo's current attrs say\n * nothing about later runs\n */\n attrsAddKeys: boolean;\n unescapedClass: undefined;\n};\n\n/** what a styled component built on another yak component inherits from it */\ntype ComponentMetadata = readonly [\n attrs: RuntimeAttrs | undefined,\n styles: StyleProcessor,\n target: AnyComponent<any> | string,\n];\n\n/** renders one element of the flattened target: props are the author's raw props, meta says how to build class and style */\ntype TargetRenderer = (props: Props, meta: RenderMeta) => JSX.Element;\n\n/** the loosely typed form of Styled that yakStyled implements; the public overloads live in publicStyledApi */\nexport type StyledInternal = <\n T extends object,\n TAttrsIn extends object = {},\n TAttrsOut extends AttrsMerged<T, TAttrsIn> = AttrsMerged<T, TAttrsIn>,\n>(\n Component: AnyComponent<T> | YakComponent<T> | HtmlTags | string,\n attrs?: Attrs<T, TAttrsIn, TAttrsOut>,\n) => StyledLiteral<Substitute<T, TAttrsIn>>;\n\n/** solid's server regex (not exported); its VoidElements set lacks keygen and menuitem */\nconst VOID_ELEMENTS =\n /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;\n\nconst styledFactory: StyledFn = (Component) =>\n Object.assign(yakStyled(Component), {\n attrs: (attrs: Attrs<any>) => yakStyled(Component, attrs),\n });\n\n/**\n * style a tag or a component that forwards its class prop. styled.div is\n * compiled to styled(\"div\"); the untransformed export in mocks/styled.ts\n * adds the tag properties with a proxy\n */\nexport const styled = styledFactory as Styled;\n\nconst yakStyled: StyledInternal = (Component, attrs) => {\n // solid-refresh forwards reads to the live component, but does not forward `in` checks\n const isYakComponent =\n typeof Component === \"function\" &&\n (Component as Partial<YakComponent<unknown>>)[yakComponentSymbol] !== undefined;\n\n // the public tuple type hides the shape, one cast at the read\n const [parentAttrs, parentRuntimeStylesFn, parentTarget] = isYakComponent\n ? ((Component as YakComponent<unknown>)[yakComponentSymbol] as ComponentMetadata)\n : [];\n\n // the chain renders its final target once, with all attrs and style processors combined\n const targetComponent = parentTarget ?? Component;\n\n const mergedAttrs = composeAttrs(attrs as RuntimeAttrs | undefined, parentAttrs);\n\n return (styles, ...values) => {\n // the interpolations of the style block, e.g.\n // styled.button`color: ${props => props.color}; margin: ${props => props.margin};`\n // arrive compiled: styles and values hold class names, style callbacks\n // and css-variable maps, no css text\n const runtimeStylesFn = css(styles, ...values);\n const runtimeStyleProcessor = composeStyles(runtimeStylesFn, parentRuntimeStylesFn);\n\n const isTag = typeof targetComponent === \"string\";\n // object attrs with plain attribute values bake into the tag's opening\n // string and template; the component stays static. baked keys reach the\n // dom only through that string: skip drops them from the target\n const baked =\n isTag &&\n mergedAttrs &&\n typeof mergedAttrs !== \"function\" &&\n bakeable(targetComponent, mergedAttrs)\n ? mergedAttrs\n : undefined;\n const attrString = baked ? bakeAttributes(baked) : \"\";\n const renderTarget = createTargetRenderer(targetComponent, attrString);\n // static: attrs are none or baked, and the css block writes no style values\n const isStatic = (!mergedAttrs || !!baked) && !runtimeStyleProcessor.$dynamic;\n // the target never sees $-props, the provider theme, or the author class\n // (yak hands it the combined one); a dynamic component merges style in its\n // memo, so the author's style key is dropped here and handed over combined.\n // no symbol passes: solid's merge() flattens any object that answers its\n // private $SOURCES key, which would hand a target's mergeProps() the\n // unfiltered originals; solid's own omit() blocks that key the same way\n const skip = (key: PropertyKey) =>\n typeof key !== \"string\" ||\n key.charCodeAt(0) === 36 /* $ */ ||\n key === \"class\" ||\n key === \"theme\" ||\n (!isStatic && key === \"style\") ||\n // a baked attr wins over the author's prop of the same name, even when its value is null\n (baked !== undefined && Object.hasOwn(baked, key));\n // baked attrs still run inside a dynamic component's memo: style callbacks\n // read them through withAttrs\n const attrsFn =\n typeof mergedAttrs === \"function\" ? mergedAttrs : mergedAttrs && (() => mergedAttrs);\n const Yak = isStatic\n ? createStaticComponent(\n isTag ? targetComponent : undefined,\n renderTarget,\n runtimeStyleProcessor,\n skip,\n attrString,\n )\n : createDynamicComponent(renderTarget, attrsFn, runtimeStyleProcessor, skip, !!baked);\n\n const metadata: ComponentMetadata = [mergedAttrs, runtimeStyleProcessor, targetComponent];\n return Object.assign(Yak, { [yakComponentSymbol]: metadata });\n };\n};\n\n/**\n * object attrs bake when every entry is a plain attribute with a primitive\n * value. rejected keys are the union of what skip drops, what attribute()\n * treats specially, and what solid sets as a dom property (DOMWithState:\n * value, checked, ...), which a template would turn into a markup\n * attribute. enumerable value keys only, so the three walks (here,\n * bakeAttributes, skip) see the same keys; a getter blocks baking and runs\n * at render time\n */\nconst bakeable = (tag: string, attrs: Props): boolean => {\n const stateful = DOMWithState[tag.toUpperCase()];\n return Object.getOwnPropertyNames(attrs).every((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(attrs, key)!;\n if (!descriptor.enumerable || !(\"value\" in descriptor)) return false;\n const type = typeof descriptor.value;\n return (\n (type === \"string\" || type === \"number\" || type === \"boolean\" || descriptor.value == null) &&\n // the name goes into the template and the opening string unescaped; anything\n // else (a computed key with markup in it) takes the writer, whose attribute() escapes names\n ATTRIBUTE_NAME.test(key) &&\n key.charCodeAt(0) !== 36 &&\n key !== \"class\" &&\n key !== \"style\" &&\n key !== \"theme\" &&\n key !== \"ref\" &&\n !ChildProperties.has(key) &&\n !key.startsWith(\"on\") &&\n !key.startsWith(\"prop:\") &&\n !(stateful && key in stateful)\n );\n });\n};\n\n/**\n * the attribute string of baked attrs, built once at definition. the value\n * rules follow attribute(), which prints one prop on the server; the escaping\n * is local because the client build's escape is an empty stub, and the names\n * passed the ATTRIBUTE_NAME check. `<` stays unescaped, harmless in a quoted value\n */\nconst bakeAttributes = (attrs: Props): string => {\n let result = \"\";\n for (const key of Object.keys(attrs)) {\n const value = attrs[key];\n if (value == null || value === false) continue;\n result +=\n value === true || value === \"\" ? ` ${key}` : ` ${key}=\"${escapeAttribute(String(value))}\"`;\n }\n return result;\n};\n\nconst escapeAttribute = (value: string) => value.replaceAll(\"&\", \"&amp;\").replaceAll('\"', \"&quot;\");\n\n/** an attribute name that needs no escaping in markup */\nconst ATTRIBUTE_NAME = /^[A-Za-z_:][\\w:.-]*$/;\n\n/** parent attrs first, then own attrs read and override that result */\nconst composeAttrs = (attrs?: RuntimeAttrs, parent?: RuntimeAttrs): RuntimeAttrs | undefined => {\n if (!attrs) return parent;\n if (!parent) return attrs;\n // two objects without getters combine once here and stay an object; a\n // getter must run per render, inside the memo\n if (\n typeof attrs !== \"function\" &&\n typeof parent !== \"function\" &&\n !hasGetter(attrs) &&\n !hasGetter(parent)\n ) {\n return combineProps(parent, attrs);\n }\n const own = typeof attrs === \"function\" ? attrs : () => attrs;\n const parentFn = typeof parent === \"function\" ? parent : () => parent;\n return (props) => {\n const parentProps = parentFn(props);\n return combineProps(parentProps, own(combineProps(props, parentProps)));\n };\n};\n\n/** parent styles before own styles, with one collector and one style object */\nconst composeStyles = (own: StyleProcessor, parent?: StyleProcessor): StyleProcessor => {\n if (!parent) return own;\n return Object.assign(\n (props: unknown, classes: Parameters<StyleProcessor>[1], style: StyleObject) => {\n parent(props, classes, style);\n own(props, classes, style);\n },\n { $dynamic: own.$dynamic || parent.$dynamic },\n ) as StyleProcessor;\n};\n\n/**\n * attrs override props; class and style values combine, e.g.\n * { class: \"a\", foo: 1 } and { class: \"b\", bar: 2 } -> { class: \"a b\", foo: 1, bar: 2 }\n */\nconst combineProps = (props: Props, newProps: Props | null | undefined): Props => {\n if (!newProps) return props;\n // descriptors, not values: a spread would run every author getter here,\n // and a children getter renders (twice, and with the wrong hydration keys)\n const descriptors = {\n ...rehomedDescriptors(props),\n ...rehomedDescriptors(newProps),\n };\n // an equal class counts as nothing: own attrs get the combined props and\n // may hand the same class back, merging it again would duplicate it\n if (newProps.class && props.class !== newProps.class) {\n descriptors.class = valueDescriptor(mergeClasses(normalizeClass(props.class), newProps.class));\n }\n if (newProps.style && props.style !== newProps.style) {\n descriptors.style = valueDescriptor({\n ...unwrapStyle(props.style),\n ...unwrapStyle(newProps.style),\n });\n }\n return Object.defineProperties({}, descriptors) as Props;\n};\n\nconst valueDescriptor = (value: unknown): PropertyDescriptor => ({\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n});\n\n/**\n * a getter is only defined for a read through its own object: solid's\n * compiled props getters (2.0.0-rc.10, `hoistProps`) reach their captured\n * values through `this`, so a descriptor moved to another object reads\n * nothing. re-homing keeps the laziness (nothing is read here) and reads\n * the source when the target is read; a data descriptor passes as it is\n */\nconst rehome = (\n source: object,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n): PropertyDescriptor =>\n descriptor.get || descriptor.set\n ? {\n get: () => (source as any)[key],\n set: descriptor.set && ((value: unknown) => ((source as any)[key] = value)),\n enumerable: descriptor.enumerable,\n configurable: true,\n }\n : descriptor;\n\nconst rehomedDescriptors = (source: object): PropertyDescriptorMap => {\n const descriptors = Object.getOwnPropertyDescriptors(source) as PropertyDescriptorMap;\n for (const key of Reflect.ownKeys(descriptors)) {\n descriptors[key as string] = rehome(source, key, descriptors[key as string]);\n }\n return descriptors;\n};\n\nconst hasGetter = (object: object): boolean => {\n for (const key of Object.getOwnPropertyNames(object)) {\n if (!(\"value\" in Object.getOwnPropertyDescriptor(object, key)!)) return true;\n }\n return false;\n};\n\n/** static: no theme, no memo; one class per component, a children-only fast path for a tag */\nconst createStaticComponent = (\n tag: string | undefined,\n renderTarget: TargetRenderer,\n processor: StaticStyleProcessor,\n skip: (key: PropertyKey) => boolean,\n attrString: string,\n): AnyComponent<Props> => {\n const collected = new Classes();\n // a static processor ignores its props argument, it only adds class names\n processor(undefined, collected);\n const staticClass = collected.value || undefined;\n const classOf = (props: Props): string | undefined => {\n const userClass = normalizeClass(props.class);\n if (!userClass) return staticClass;\n // the collector skips generated names the author's class already holds,\n // and an atom may remove one\n const classes = new Classes(userClass);\n processor(props, classes);\n return classes.value || undefined;\n };\n const renderChildrenOnly =\n tag && !VOID_ELEMENTS.test(tag)\n ? createChildrenOnlyRenderer(tag, staticClass, attrString)\n : undefined;\n const meta: RenderMeta = {\n skip,\n compute: undefined,\n classOf,\n attrsAddKeys: false,\n unescapedClass: collected.generated ? staticClass : undefined,\n };\n return (props) => {\n // no props or only children: no skip walk, no props copy, no spread.\n // a reactive spread can add props later and needs the full client binding;\n // on the server props are read once so the proxy check does not matter\n if (renderChildrenOnly && (isServer || !($PROXY in props))) {\n const keys = Object.keys(props);\n if (!keys.length || (keys.length === 1 && keys[0] === \"children\")) {\n return renderChildrenOnly(props, keys.length !== 0);\n }\n }\n return renderTarget(props, meta);\n };\n};\n\n/** tag and class cached per component; only the children need a binding or serialization */\nconst createChildrenOnlyRenderer = (\n tag: string,\n className: string | undefined,\n attrString: string,\n): ((props: Props, hasChildren: boolean) => JSX.Element) => {\n if (isServer) {\n const head = `<${tag}${attrString}`;\n const open = `${className ? ` class=\"${ssrClassName(className)}\"` : \"\"}>`;\n const closing = `</${tag}>`;\n const parts = [head, open, closing];\n // as in childContent: script and style content is not escaped\n const raw = tag === \"script\" || tag === \"style\";\n return (props, hasChildren): { t: string } => {\n // key first: the child getter may render\n const hk = ssrHydrationKey();\n const children = hasChildren ? (raw ? props.children : escape(props.children)) : undefined;\n // text joins in place; anything else goes through ssr() like a compiled\n // template's hole, which handles async children and text separators\n const text = plainContent(children);\n if (text !== undefined) return { t: `${head}${hk}${open}${text}${closing}` };\n return ssr(parts, hk, children);\n };\n }\n const create = createElementTemplate(tag, attrString, className);\n return (props, hasChildren) => {\n const el = getNextElement(create);\n if (hasChildren) {\n // static text arrives as a plain value, not a getter: one insert, no effect.\n // a getter is dynamic and keeps the binding\n const descriptor = Object.getOwnPropertyDescriptor(props, \"children\");\n if (descriptor && \"value\" in descriptor) insert(el, descriptor.value);\n else insert(el, () => props.children);\n }\n runHydrationEvents();\n return el;\n };\n};\n\n/** dynamic: the provider theme plus one memo per element for attrs, class and style */\nconst createDynamicComponent =\n (\n renderTarget: TargetRenderer,\n attrsFn: RuntimeAttrsFn | undefined,\n processor: StyleProcessor,\n skip: (key: PropertyKey) => boolean,\n baked: boolean,\n ): AnyComponent<Props> =>\n (props) => {\n const theme = useTheme();\n // style callbacks see an explicit theme prop before the provider theme\n const propsWithTheme = withTheme(props, theme);\n // one memo per element runs the attrs function and every interpolation\n // of the style block, e.g. styled.button`color: ${props => props.color}`.\n // only reads inside it re-run it; the element is never re-created.\n // attrs and styles share the memo on purpose:\n // a style-only prop change also reruns attrs, still cheaper than\n // two memos per element\n const compute = () => computeStyles(props, propsWithTheme, attrsFn, processor);\n // the server has no updates, so a run-once closure replaces the memo:\n // solid's server createMemo still builds an owner and a node per element.\n // on the client the memo is transparent: it claims no hydration key\n const computed = isServer ? once(compute) : createMemo(compute, { transparent: true });\n // theme reaches the target only when attrs set their own; the provider\n // accessor must not land on the dom element. identity, not `in`: an attrs\n // function that spreads its input hands the provider accessor back\n const allowTheme =\n attrsFn &&\n (() => {\n const attrs = computed().attrs;\n return !!attrs && \"theme\" in attrs && attrs.theme !== theme;\n });\n return renderTarget(props, {\n skip: allowTheme ? (key) => (key === \"theme\" ? !allowTheme() : skip(key)) : skip,\n compute: computed,\n classOf: undefined,\n // baked attrs sit in the template and cannot add keys, the copy path serves them\n attrsAddKeys: !!attrsFn && !baked,\n unescapedClass: undefined,\n });\n };\n\n/** resolve attrs, then run the styles against that props view */\nconst computeStyles = (\n props: Props,\n propsWithTheme: Props,\n attrsFn: RuntimeAttrsFn | undefined,\n processor: StyleProcessor,\n): ComputedStyles => {\n const attrs = attrsFn?.(propsWithTheme);\n const authorClass = normalizeClass(props.class);\n const classes = new Classes(authorClass);\n const attrsClass = normalizeClass(attrs?.class);\n if (attrsClass) classes.add(attrsClass);\n // a static processor writes no style values, so the author's style object\n // passes through without a copy\n const style =\n processor.$dynamic || attrs?.style\n ? { ...unwrapStyle(props.style), ...unwrapStyle(attrs?.style) }\n : unwrapStyle(props.style);\n processor(\n attrs ? withAttrs(propsWithTheme, attrs) : propsWithTheme,\n classes,\n style as StyleObject,\n );\n return {\n class: classes.value || undefined,\n generatedClass: !authorClass && !attrsClass && classes.generated,\n style: style && hasKeys(style) ? style : undefined,\n attrs,\n };\n};\n\n/**\n * backing object of a props view: the author's props, a provider theme to\n * fill in when props has none, and attrs whose values win over props.\n * one shared handler serves both views, so a view costs one proxy and one\n * small object per element and no trap closures\n */\ntype View = { props: Props; theme?: Accessor<YakTheme>; attrs?: Props };\n\nconst viewTraps: ProxyHandler<View> = {\n get: ({ props, theme, attrs }, key) => {\n if (key === \"theme\" && theme && !(\"theme\" in props)) return theme;\n if (attrs && key in attrs) return Reflect.get(attrs, key);\n return Reflect.get(props, key);\n },\n // no props check for theme here: when props has one, Reflect.has says so anyway\n has: ({ props, theme, attrs }, key) =>\n (key === \"theme\" && !!theme) || (!!attrs && key in attrs) || Reflect.has(props, key),\n ownKeys: ({ props, theme, attrs }) => {\n const keys = new Set(Reflect.ownKeys(props));\n if (attrs) for (const key of Reflect.ownKeys(attrs)) keys.add(key);\n if (theme) keys.add(\"theme\");\n return [...keys];\n },\n getOwnPropertyDescriptor: ({ props, theme, attrs }, key) => {\n if (key === \"theme\" && theme && !(\"theme\" in props)) {\n return { value: theme, enumerable: true, configurable: true };\n }\n const descriptor = Reflect.getOwnPropertyDescriptor(attrs && key in attrs ? attrs : props, key);\n // a prop the view adds must report configurable, the backing object has no such key\n return descriptor && { ...descriptor, configurable: true };\n },\n};\n\n/**\n * the provider theme when props has none. a props proxy (a reactive spread)\n * can gain or lose its theme key later, so it always gets the view; a plain\n * object with a theme is used as is\n */\nconst withTheme = (props: Props, theme: Accessor<YakTheme>): Props =>\n (!($PROXY in props) && \"theme\" in props\n ? props\n : new Proxy({ props, theme }, viewTraps)) as Props;\n\n/** style interpolations read attrs over author props, getters only on demand */\nconst withAttrs = (props: Props, attrs: Props): Props =>\n new Proxy({ props, attrs }, viewTraps) as Props;\n\n/** server stand-in for createMemo: run once, no owner and no node */\nconst once = <T extends object>(fn: () => T): (() => T) => {\n let value: T | undefined;\n return () => (value ??= fn());\n};\n\n/** string styles become objects before css variables are added */\nconst unwrapStyle = (style: StyleObject | string | undefined): StyleObject | undefined => {\n if (typeof style !== \"string\") {\n return style;\n }\n const result: Record<string, string> = {};\n for (const declaration of style.split(\";\")) {\n const colonIndex = declaration.indexOf(\":\");\n if (colonIndex === -1) continue;\n const property = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n if (property && value) {\n result[property] = value;\n }\n }\n return result as StyleObject;\n};\n\n/** no array for a yes/no answer */\nconst hasKeys = (object: object): boolean => {\n for (const _ in object) return true;\n return false;\n};\n\n/** the target's render path, chosen once per styled component */\nconst createTargetRenderer = (\n target: AnyComponent<any> | string,\n attrString: string,\n): TargetRenderer => {\n if (typeof target !== \"string\") {\n return (props, meta) => createComponent(target, targetProps(props, meta));\n }\n if (isServer) {\n const head = `<${target}${attrString}`;\n const closing = VOID_ELEMENTS.test(target) ? undefined : `</${target}>`;\n return (props, meta) => serializeElement(target, head, closing, props, meta);\n }\n return createElementRenderer(target, attrString);\n};\n\n/**\n * the server writer: writes the html string by hand instead of using ssrElement.\n * ssrElement needs a filtered props object with getters to keep the\n * read order, that costs more than writing directly\n */\nconst serializeElement = (\n tag: string,\n head: string,\n closing: string | undefined,\n props: Props,\n meta: RenderMeta,\n): { t: string } => {\n // key first: a prop getter may render a child and take keys\n const hk = ssrHydrationKey();\n // one memo read for class, style and attrs. branch on meta.compute, not\n // on computed, so the static writer makes no call here\n let computed: ComputedStyles | undefined;\n let className: string | undefined;\n if (meta.compute) {\n computed = meta.compute();\n className = computed.class;\n } else {\n className = meta.classOf(props);\n }\n const attrs = computed?.attrs;\n const style = computed?.style;\n const skip = meta.skip;\n let result = head + hk;\n let children: unknown;\n // a textarea's value is its content, like solid's ssrElement writes it\n const textarea = tag === \"textarea\";\n // author keys first, an attrs value wins; then the keys only attrs has.\n // two loops on purpose: one loop over both key sets is slower on the\n // attrs path, it needs a push and a second `in` per key.\n // only the first child prop is read, and none on a void tag: a child\n // getter may render and take hydration keys\n for (const key of Object.keys(props)) {\n if (skip(key)) continue;\n const source = attrs && key in attrs ? attrs : props;\n if (!isChildKey(key, textarea)) result += attribute(key, source[key]);\n else if (children === undefined && closing) children = childContent(tag, key, source[key]);\n }\n if (attrs) {\n for (const key of Object.keys(attrs)) {\n if (skip(key) || key in props) continue;\n if (!isChildKey(key, textarea)) result += attribute(key, attrs[key]);\n else if (children === undefined && closing) children = childContent(tag, key, attrs[key]);\n }\n }\n // generated class names need no escaping, an author or attrs class does\n if (className !== undefined) {\n const generated = computed ? computed.generatedClass : className === meta.unescapedClass;\n result += ` class=\"${generated ? className : ssrClassName(className)}\"`;\n }\n if (style !== undefined) result += ` style=\"${ssrStyle(style as Record<string, string>)}\"`;\n // a void tag has no children: the finished string is the node, no ssr() call.\n // the space keeps an unquoted hydration key from swallowing the slash\n if (!closing) return { t: result + \" />\" };\n // text and finished nodes join in place, as solid's own resolver does.\n // functions, arrays and nodes with pending holes go to ssr(): async wrap,\n // error boundary routing, and the separator marker between adjacent\n // text items so the client can claim two text nodes\n const text = plainContent(children);\n if (text !== undefined) return { t: result + \">\" + text + closing };\n return ssr([result + \">\", closing], children);\n};\n\n/** a prop that becomes the element's content: solid's child properties, and a textarea's value */\nconst isChildKey = (key: string, textarea: boolean) =>\n ChildProperties.has(key) || (textarea && (key === \"value\" || key === \"defaultValue\"));\n\n/**\n * the string a child resolves to without ssr(), else undefined. a server\n * node is { t: html, h?: pending async holes }; one with holes needs ssr()\n */\nconst plainContent = (node: unknown): string | undefined => {\n if (typeof node === \"string\") return node;\n if (typeof node === \"number\") return String(node);\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node !== \"object\" || Array.isArray(node)) return undefined;\n const server = node as { t?: unknown; h?: unknown[] };\n if (server.h && server.h.length > 0) return undefined;\n if (typeof server.t === \"string\") return server.t;\n return undefined;\n};\n\n/**\n * one server attribute with its leading space, the value rules of solid's\n * ssrElement; bakeAttributes applies the same rules once at definition\n */\nconst attribute = (prop: string, value: unknown): string => {\n if (prop === \"style\") return ` style=\"${ssrStyle(value as string)}\"`;\n // class never reaches here, skip drops it; the branch stays, the static\n // writer is slower without it (jit code placement)\n if (prop === \"class\") return ` class=\"${ssrClassName(value as string)}\"`;\n // refs, event handlers and prop: bindings only exist on the client\n if (value == undefined || prop === \"ref\" || prop.startsWith(\"on\") || prop.startsWith(\"prop:\")) {\n return \"\";\n }\n if (typeof value === \"boolean\") return value ? ` ${escape(prop)}` : \"\";\n return value === \"\" ? ` ${escape(prop)}` : ` ${escape(prop)}=\"${escape(value, true)}\"`;\n};\n\n/** raw markup stays as is, every other child value is escaped */\nconst childContent = (tag: string, prop: string, value: unknown): unknown =>\n tag === \"script\" || tag === \"style\" || prop === \"innerHTML\" ? value : escape(value);\n\n/** the cached template for a fixed tag; svg and mathml tags parse inside their namespace root */\nconst createElementTemplate = (tag: string, attrString: string, className?: string) => {\n // atoms can put author names into the static class, so the template escapes it\n const classAttribute = className ? ` class=\"${escapeAttribute(className)}\"` : \"\";\n const opening = `<${tag}${attrString}${classAttribute}>`;\n // flag 2 returns firstChild.firstChild\n // skips the <svg>/<math> wrapper we add so the child parses in its namespace\n if (SVGElements.has(tag) && tag !== \"svg\") return template(`<svg>${opening}`, 2);\n if (MathMLElements.has(tag) && tag !== \"math\") return template(`<math>${opening}`, 2);\n return template(opening);\n};\n\n/**\n * bind a fixed client tag without dynamic()'s per-element memo. hydration\n * claims the server node by key; a fresh mount clones the cached template.\n * solid's SVGElements set lacks a, script, style and title, so a fresh\n * mount makes them html elements even inside an <svg>, as solid's own\n * dynamic() does\n */\nconst createElementRenderer = (tag: string, attrString: string): TargetRenderer => {\n const create = createElementTemplate(tag, attrString);\n return (props, meta) => bindElement(getNextElement(create), props, meta);\n};\n\nconst bindElement = (el: Element, props: Props, meta: RenderMeta): Element => {\n // no untrack anywhere below: a component body runs untracked\n if (!meta.attrsAddKeys && !($PROXY in props)) {\n // a fixed key set read by one spread: copying the few descriptors is\n // cheaper than a view. measured on the client with omit() + the source\n // list instead: +12–15% hydrate and mount on dynamic-prop tags (an\n // omit view, spread()'s source walk and their garbage, per element)\n const bound = copyProps(props, meta);\n spread(el, bound, !(\"children\" in bound));\n } else {\n // attrs or a reactive spread can add keys — children too — so the target\n // reads views. the sources as an array, like a compiled <tag {...a} {...b}>:\n // spread() reads a function source inline, no memo and no hydration id.\n // that matters here: the server writer for a tag builds none of this, so\n // an owner created only on the client would shift every later element's id\n spread(el, targetSources(props, meta), false);\n }\n // replay events once the element's bindings are ready\n runHydrationEvents();\n return el;\n};\n\n/** the props a component target receives: the sources as one merge() view */\nconst targetProps = (props: Props, meta: RenderMeta): Props =>\n merge(...targetSources(props, meta)) as Props;\n\n/**\n * the client tag path when the keys cannot change: the computed class/style\n * getters, then the author's props copied in without reading them — a\n * getter like icon={<Icon />} renders a child and takes hydration keys, so it\n * is re-homed (see `rehome`) and read by the spread in its own order\n */\nconst copyProps = (props: Props, meta: RenderMeta): Props => {\n const out = clientExtras(props, meta);\n // string keys only, like solid's omit(): a symbol never reaches the target.\n // skip drops class (and style with a memo), the keys the extras own\n for (const key of Object.getOwnPropertyNames(props)) {\n if (meta.skip(key)) continue;\n const descriptor = Reflect.getOwnPropertyDescriptor(props, key)!;\n if (\"value\" in descriptor && descriptor.enumerable) out[key] = descriptor.value;\n else Object.defineProperty(out, key, rehome(props, key, descriptor));\n }\n return out;\n};\n\n/**\n * what the target sees, as the sources solid's own primitives take: omit()\n * with the skip predicate over the author's props ($-props, theme, and the\n * keys attrs bake), the attrs the memo produced as a function source when\n * they can add keys, and the computed class/style last. views, not a copy:\n * a getter like icon={<Icon />} renders a child and takes hydration keys,\n * so it is read by the target in its own order, once. on the server the\n * values are final and go in as data properties; on the client as getters\n * over the memo\n */\nconst targetSources = (props: Props, meta: RenderMeta): [Props, TargetAttrs, Props] => {\n const { skip, compute, classOf } = meta;\n const rest = omit(props, skip as (key: string | symbol) => boolean);\n let extras: Props;\n if (isServer) {\n extras = {};\n if (compute) {\n const computed = compute();\n extras.class = computed.class;\n if (computed.style !== undefined) extras.style = computed.style;\n } else extras.class = classOf(props);\n } else extras = clientExtras(props, meta);\n if (!meta.attrsAddKeys) return [rest, undefined, extras];\n // meta.attrsAddKeys, not the destructured copy: the read narrows meta.compute\n const attrsSource = () => {\n const attrs = meta.compute().attrs;\n return attrs ? omit(attrs, skip as (key: string | symbol) => boolean) : undefined;\n };\n return [rest, attrsSource, extras];\n};\n\n/** the attrs source, or none when attrs cannot add keys (baked, or no attrs) */\ntype TargetAttrs = (() => Props | undefined) | undefined;\n\n/**\n * client only: the computed class and style as getters over the memo. object\n * literals, two shapes: a getter defined on a literal takes V8's boilerplate\n * path\n */\nconst clientExtras = (props: Props, { compute, classOf }: RenderMeta): Props =>\n compute\n ? {\n get class() {\n // compute().class is accessed lazily and includes props.class in its results\n return compute().class;\n },\n get style() {\n return compute().style;\n },\n }\n : {\n get class() {\n return classOf(props);\n },\n };\n","import type { JSX } from \"@solidjs/web\";\nimport { styled as StyledFactory } from \"../styled.js\";\n\nexport const styled = /* @__PURE__ */ new Proxy(StyledFactory, {\n get(target, key) {\n // only a tag name becomes a factory. symbols, the function's own\n // properties and `then` pass through, so a promise that resolves the\n // factory does not take it for a thenable\n if (typeof key !== \"string\" || key === \"then\" || key in target) return Reflect.get(target, key);\n return target(key as keyof JSX.IntrinsicElements);\n },\n}) as typeof StyledFactory;\n","import type { globalStyle as globalStyleInternal } from \"../globalStyle.js\";\n\nexport type { GlobalStyleInterpolation } from \"../globalStyle.js\";\n\n/**\n * Test-friendly mock of `globalStyle`.\n *\n * `globalStyle` has no runtime behaviour: the SWC plugin extracts its CSS at\n * build time and replaces the call with a no-op. The mock mirrors that: it does\n * nothing so yak files can be imported in Jest/Vitest without the compiler.\n */\nexport const globalStyle: typeof globalStyleInternal = (_styles, ..._values) => {\n // no-op in the mock\n};\n"],"mappings":"mdAOA,MAAa,EAAqB,OAAO,IAAI,sBAAsB,EAUnE,IAAa,EAAb,KAA+C,CAC7C,MAMA,UAAY,GACZ,YAAY,EAAkB,CAC5B,KAAK,MAAQ,GAAW,EAC1B,CACA,IAAI,EAAc,EAAY,GAAM,CAC7B,IAAW,KAAK,UAAY,IAC5B,KAAK,MAEE,KAAK,IAAI,CAAI,IACvB,KAAK,OAAS,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AI,IAAA,EAC1E,EAC2B,CAAM,EANF,CAAC,EAAM,IAAA,GAAW,CAAM,CAOzD,EAUM,GAAgB,EAAc,CAAE,UAAS,aAC7C,EACI,CACE,IAAI,OAAQ,CAEV,OAAO,EAAQ,CAAC,CAAC,KACnB,EACA,IAAI,OAAQ,CACV,OAAO,EAAQ,CAAC,CAAC,KACnB,CACF,EACA,CACE,IAAI,OAAQ,CACV,OAAO,EAAQ,CAAK,CACtB,CACF,ECh3BO,GAAyB,IAAI,MAAMC,EAAe,CAC7D,IAAI,EAAQ,EAAK,CAKf,OADI,OAAO,GAAQ,UAAY,IAAQ,QAAU,KAAO,EAAe,QAAQ,IAAI,EAAQ,CAAG,EACvF,EAAO,CAAkC,CAClD,CACF,CAAC,ECAY,IAA2C,EAAS,GAAG,IAAY,CAEhF"}
package/dist/internal.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $PROXY, createMemo } from "solid-js";
1
+ import { $PROXY, createMemo, merge, omit } from "solid-js";
2
2
  import { ChildProperties, DOMWithState, MathMLElements, SVGElements, createComponent, escape, getNextElement, insert, isServer, runHydrationEvents, spread, ssr, ssrClassName, ssrHydrationKey, ssrStyle, template } from "@solidjs/web";
3
3
  import { YakThemeContext, YakThemeProvider, useTheme, useTheme as useTheme$1 } from "@yak/solid/context";
4
4
 
@@ -149,8 +149,8 @@ const composeStyles = (own, parent) => {
149
149
  const combineProps = (props, newProps) => {
150
150
  if (!newProps) return props;
151
151
  const descriptors = {
152
- ...Object.getOwnPropertyDescriptors(props),
153
- ...Object.getOwnPropertyDescriptors(newProps)
152
+ ...rehomedDescriptors(props),
153
+ ...rehomedDescriptors(newProps)
154
154
  };
155
155
  if (newProps.class && props.class !== newProps.class) descriptors.class = valueDescriptor(mergeClasses(normalizeClass(props.class), newProps.class));
156
156
  if (newProps.style && props.style !== newProps.style) descriptors.style = valueDescriptor({
@@ -165,6 +165,17 @@ const valueDescriptor = (value) => ({
165
165
  configurable: true,
166
166
  writable: true
167
167
  });
168
+ const rehome = (source, key, descriptor) => descriptor.get || descriptor.set ? {
169
+ get: () => source[key],
170
+ set: descriptor.set && ((value) => source[key] = value),
171
+ enumerable: descriptor.enumerable,
172
+ configurable: true
173
+ } : descriptor;
174
+ const rehomedDescriptors = (source) => {
175
+ const descriptors = Object.getOwnPropertyDescriptors(source);
176
+ for (const key of Reflect.ownKeys(descriptors)) descriptors[key] = rehome(source, key, descriptors[key]);
177
+ return descriptors;
178
+ };
168
179
  const hasGetter = (object) => {
169
180
  for (const key of Object.getOwnPropertyNames(object)) if (!("value" in Object.getOwnPropertyDescriptor(object, key))) return true;
170
181
  return false;
@@ -389,102 +400,61 @@ const createElementRenderer = (tag, attrString) => {
389
400
  return (props, meta) => bindElement(getNextElement(create), props, meta);
390
401
  };
391
402
  const bindElement = (el, props, meta) => {
392
- const bound = targetProps(props, meta);
393
- const skipChildren = !($PROXY in bound) && !("children" in bound);
394
- spread(el, bound, skipChildren);
403
+ if (!meta.attrsAddKeys && !($PROXY in props)) {
404
+ const bound = copyProps(props, meta);
405
+ spread(el, bound, !("children" in bound));
406
+ } else spread(el, targetSources(props, meta), false);
395
407
  runHydrationEvents();
396
408
  return el;
397
409
  };
398
- const targetProps = (props, meta) => {
399
- if (!meta.attrsAddKeys && !($PROXY in props)) return copyProps(props, meta);
400
- return proxyProps(props, meta);
401
- };
410
+ const targetProps = (props, meta) => merge(...targetSources(props, meta));
402
411
  const copyProps = (props, meta) => {
403
- const { compute, classOf } = meta;
404
- const out = {};
412
+ const out = clientExtras(props, meta);
405
413
  for (const key of Object.getOwnPropertyNames(props)) {
406
414
  if (meta.skip(key)) continue;
407
415
  const descriptor = Reflect.getOwnPropertyDescriptor(props, key);
408
416
  if ("value" in descriptor && descriptor.enumerable) out[key] = descriptor.value;
409
- else Object.defineProperty(out, key, descriptor);
410
- }
411
- if (isServer) {
412
- if (compute) {
413
- const computed = compute();
414
- out.class = computed.class;
415
- if (computed.style !== void 0) out.style = computed.style;
416
- } else out.class = classOf(props);
417
- return out;
417
+ else Object.defineProperty(out, key, rehome(props, key, descriptor));
418
418
  }
419
- const classFn = compute ? () => compute().class : () => classOf(props);
420
- const styleFn = styleGetter(compute);
421
- Object.defineProperty(out, "class", {
422
- get: classFn,
423
- enumerable: true,
424
- configurable: true
425
- });
426
- if (styleFn) Object.defineProperty(out, "style", {
427
- get: styleFn,
428
- enumerable: true,
429
- configurable: true
430
- });
431
419
  return out;
432
420
  };
433
- const styleGetter = (compute) => {
434
- if (!compute) return void 0;
435
- if (isServer && compute().style === void 0) return void 0;
436
- return () => compute().style;
437
- };
438
- const proxyProps = (props, meta) => {
421
+ const targetSources = (props, meta) => {
439
422
  const { skip, compute, classOf } = meta;
440
- const attrsProps = () => meta.attrsAddKeys ? meta.compute().attrs : void 0;
441
- const classFn = compute ? () => compute().class : () => classOf(props);
442
- const styleFn = styleGetter(compute);
443
- const contributed = (key) => key === "class" ? classFn : key === "style" ? styleFn : void 0;
444
- const fromAttrs = (key) => {
445
- const attrs = attrsProps();
446
- return attrs && key in attrs ? attrs : void 0;
423
+ const rest = omit(props, skip);
424
+ let extras;
425
+ if (isServer) {
426
+ extras = {};
427
+ if (compute) {
428
+ const computed = compute();
429
+ extras.class = computed.class;
430
+ if (computed.style !== void 0) extras.style = computed.style;
431
+ } else extras.class = classOf(props);
432
+ } else extras = clientExtras(props, meta);
433
+ if (!meta.attrsAddKeys) return [
434
+ rest,
435
+ void 0,
436
+ extras
437
+ ];
438
+ const attrsSource = () => {
439
+ const attrs = meta.compute().attrs;
440
+ return attrs ? omit(attrs, skip) : void 0;
447
441
  };
448
- return new Proxy(props, {
449
- get(target, key, receiver) {
450
- if (key === $PROXY) return receiver;
451
- const getter = contributed(key);
452
- if (getter) return getter();
453
- if (skip(key)) return void 0;
454
- const attrs = fromAttrs(key);
455
- return attrs ? attrs[key] : Reflect.get(target, key);
456
- },
457
- has(target, key) {
458
- if (key === $PROXY) return true;
459
- if (contributed(key)) return true;
460
- if (skip(key)) return false;
461
- return Reflect.has(target, key) || fromAttrs(key) !== void 0;
462
- },
463
- ownKeys(target) {
464
- const keys = /* @__PURE__ */ new Set();
465
- for (const key of Reflect.ownKeys(target)) if (!skip(key)) keys.add(key);
466
- for (const key of Object.keys(attrsProps() ?? {})) if (!skip(key)) keys.add(key);
467
- keys.add("class");
468
- if (styleFn) keys.add("style");
469
- return [...keys];
470
- },
471
- getOwnPropertyDescriptor(target, key) {
472
- const getter = contributed(key);
473
- if (getter) return {
474
- enumerable: true,
475
- configurable: true,
476
- get: getter
477
- };
478
- if (skip(key)) return void 0;
479
- if (fromAttrs(key)) return {
480
- enumerable: true,
481
- configurable: true,
482
- get: () => attrsProps()?.[key]
483
- };
484
- return Reflect.getOwnPropertyDescriptor(target, key);
485
- }
486
- });
487
- };
442
+ return [
443
+ rest,
444
+ attrsSource,
445
+ extras
446
+ ];
447
+ };
448
+ const clientExtras = (props, { compute, classOf }) => compute ? {
449
+ get class() {
450
+ return compute().class;
451
+ },
452
+ get style() {
453
+ return compute().style;
454
+ }
455
+ } : { get class() {
456
+ return classOf(props);
457
+ } };
488
458
 
489
459
  //#endregion
490
460
  //#region runtime/atoms.ts