@yak/solid 0.1.0 → 0.2.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
@@ -16,7 +16,7 @@ Most CSS-in-JS libraries assume a re-rendering component model. `@yak/solid` doe
16
16
 
17
17
  ```bash
18
18
  pnpm add @yak/solid
19
- pnpm add -D vite-plugin-solid@next
19
+ pnpm add -D @solidjs/vite-plugin@next
20
20
  ```
21
21
 
22
22
  Add the yak plugin before `solid()` in your Vite config:
@@ -24,7 +24,7 @@ Add the yak plugin before `solid()` in your Vite config:
24
24
  ```ts
25
25
  // vite.config.ts
26
26
  import { defineConfig } from "vite";
27
- import solid from "vite-plugin-solid";
27
+ import solid from "@solidjs/vite-plugin";
28
28
  import { yak } from "@yak/solid/vite";
29
29
 
30
30
  export default defineConfig({
@@ -32,6 +32,12 @@ export default defineConfig({
32
32
  });
33
33
  ```
34
34
 
35
+ For server rendering, bundle Solid together with `@yak/solid` or keep both external. Solid 2 ships a `development` export condition, so an app that lists only `@yak/solid` under `ssr.noExternal` ends up with two copies of Solid on the server and context lookups fail:
36
+
37
+ ```ts
38
+ ssr: { noExternal: ["@yak/solid", "solid-js", "@solidjs/web", "@solidjs/signals"] },
39
+ ```
40
+
35
41
  Then write styled components the way you'd write them anywhere else. Prop-based interpolations are tracked reactively:
36
42
 
37
43
  ```tsx
@@ -126,8 +132,8 @@ Like `next-yak`, the yak SWC compiler extracts your CSS at build time. At runtim
126
132
 
127
133
  ## Requirements
128
134
 
129
- - `solid-js` >= 2.0.0-rc.5 and `@solidjs/web` >= 2.0.0-rc.5
130
- - `vite-plugin-solid` >= 3.0.0-next (the Solid 2 line, npm tag `next`)
135
+ - `solid-js` >= 2.0.0-rc.6 and `@solidjs/web` >= 2.0.0-rc.6
136
+ - `@solidjs/vite-plugin` >= 3.0.0-next (the Solid 2 line, npm tag `next`)
131
137
  - `yak-swc` with yak-package auto-detection (bundled as a dependency, version released together with this package or newer)
132
138
 
133
139
  See the [`examples/vite-solid`](https://github.com/DigitecGalaxus/next-yak/tree/main/examples/vite-solid) app for a full setup.
@@ -1,5 +1,4 @@
1
1
  import { YakTheme } from "@yak/solid";
2
-
3
2
  //#region runtime/context/baseContext.d.ts
4
3
  declare function getYakThemeContext(): YakTheme | undefined;
5
4
  //#endregion
@@ -1,6 +1,5 @@
1
1
  import { Accessor } from "solid-js";
2
2
  import { JSX } from "@solidjs/web";
3
-
4
3
  //#region runtime/context/index.d.ts
5
4
  interface YakTheme {}
6
5
  /**
@@ -4,8 +4,9 @@ import { createComponent, createContext, createMemo, useContext } from "solid-js
4
4
  const YakThemeContext = /* @__PURE__ */ createContext(() => ({}));
5
5
  const useTheme = () => useContext(YakThemeContext);
6
6
  const YakThemeProvider = (props) => {
7
+ const theme = createMemo(() => props.theme ?? {});
7
8
  return createComponent(YakThemeContext, {
8
- value: createMemo(() => props.theme ?? {}),
9
+ value: theme,
9
10
  get children() {
10
11
  return props.children;
11
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../runtime/context/index.ts"],"sourcesContent":["import { createComponent, createContext, createMemo, useContext } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\n\nexport interface YakTheme {}\n\n/**\n * The yak theme context\n *\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nexport const YakThemeContext = /* @__PURE__ */ createContext<Accessor<YakTheme>>(() => ({}));\n\n/**\n * Returns an accessor to the current yak theme\n */\nexport const useTheme = (): Accessor<YakTheme> => useContext(YakThemeContext);\n\n/**\n * Yak theme context provider\n *\n * ```tsx\n * <YakThemeProvider theme={{ highContrast: highContrast() }}>\n * ```\n */\nexport const YakThemeProvider = (props: {\n children?: JSX.Element;\n theme?: YakTheme;\n}): JSX.Element => {\n const theme = createMemo<YakTheme>(() => props.theme ?? {});\n return createComponent(YakThemeContext, {\n value: theme,\n get children() {\n return props.children;\n },\n });\n};\n"],"mappings":";;;AAWA,MAAa,kBAAkC,qCAAyC,CAAC,EAAE;AAK3F,MAAa,iBAAqC,WAAW,eAAe;AAS5E,MAAa,oBAAoB,UAGd;CAEjB,OAAO,gBAAgB,iBAAiB;EACtC,OAFY,iBAA2B,MAAM,SAAS,CAAC,CAE5C;EACX,IAAI,WAAW;GACb,OAAO,MAAM;EACf;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../runtime/context/index.ts"],"sourcesContent":["import { createComponent, createContext, createMemo, useContext } from \"solid-js\";\nimport type { Accessor } from \"solid-js\";\nimport type { JSX } from \"@solidjs/web\";\n\nexport interface YakTheme {}\n\n/**\n * The yak theme context\n *\n * @see https://github.com/DigitecGalaxus/next-yak/blob/main/packages/next-yak/runtime/context/README.md\n */\nexport const YakThemeContext = /* @__PURE__ */ createContext<Accessor<YakTheme>>(() => ({}));\n\n/**\n * Returns an accessor to the current yak theme\n */\nexport const useTheme = (): Accessor<YakTheme> => useContext(YakThemeContext);\n\n/**\n * Yak theme context provider\n *\n * ```tsx\n * <YakThemeProvider theme={{ highContrast: highContrast() }}>\n * ```\n */\nexport const YakThemeProvider = (props: {\n children?: JSX.Element;\n theme?: YakTheme;\n}): JSX.Element => {\n const theme = createMemo<YakTheme>(() => props.theme ?? {});\n return createComponent(YakThemeContext, {\n value: theme,\n get children() {\n return props.children;\n },\n });\n};\n"],"mappings":";;;AAWA,MAAa,kBAAkC,qCAAyC,CAAC,EAAE;AAK3F,MAAa,iBAAqC,WAAW,eAAe;AAS5E,MAAa,oBAAoB,UAGd;CACjB,MAAM,QAAQ,iBAA2B,MAAM,SAAS,CAAC,CAAC;CAC1D,OAAO,gBAAgB,iBAAiB;EACtC,OAAO;EACP,IAAI,WAAW;GACb,OAAO,MAAM;EACf;CACF,CAAC;AACH"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Accessor } from "solid-js";
2
2
  import { JSX } from "@solidjs/web";
3
-
4
3
  //#region runtime/context/index.d.ts
5
4
  interface YakTheme {}
6
5
  /**
@@ -58,7 +57,7 @@ interface StyledFn {
58
57
  * @example styled.svg`${Button}:hover & { fill: red; }` or styled(Button)`color: red;`
59
58
  */
60
59
  interface YakComponent<T> extends AnyComponent<T> {
61
- [yakComponentSymbol]: [unknown, unknown, unknown, unknown];
60
+ [yakComponentSymbol]: readonly [unknown, unknown, unknown];
62
61
  }
63
62
  /**
64
63
  * Styled component with attrs method for adding default props.
@@ -96,7 +95,7 @@ type AttrsMerged<TBaseProps, TIn extends object = {}> = Substitute<TBaseProps &
96
95
  * Maps all HTML tag names to their corresponding styled component types with attributes support.
97
96
  * Provides typed access to all standard HTML elements through the styled interface.
98
97
  */
99
- type MappedHtmlTags = { [Tag in HtmlTags]: LiteralWithAttrs<JSX.IntrinsicElements[Tag]> };
98
+ type MappedHtmlTags = { [Tag in HtmlTags]: LiteralWithAttrs<JSX.IntrinsicElements[Tag]>; };
100
99
  /**
101
100
  * The attrs function allows adding additional props to a styled component.
102
101
  * Props can be specified as an object or as a function that receives current props.
@@ -121,16 +120,16 @@ type CustomWebComponentTag = `${string}-${string}`;
121
120
  * Utility type to efficiently remove properties from an object type.
122
121
  * More performant than the built-in Omit type for large object types.
123
122
  */
124
- type FastOmit<T extends object, U extends string | number | symbol> = { [K in keyof T as K extends U ? never : K]: T[K] };
123
+ type FastOmit<T extends object, U extends string | number | symbol> = { [K in keyof T as K extends U ? never : K]: T[K]; };
125
124
  /**
126
- * Set-like collector for class names.
127
- *
128
- * Implemented as a string builder in the runtime (a Set<string>
129
- * split → Set → Array.from → join round-trip dominates render cost);
130
- * a real Set<string> also satisfies this interface.
125
+ * Collects the class names of one render. The runtime keeps them in one
126
+ * space-separated string (Classes in cssLiteral.ts, the only implementation):
127
+ * add() appends, has() and delete() let a runtime processor take a name back
128
+ * out. A Set would need a split and a join on every render for the same string.
131
129
  */
132
130
  type ClassCollector = {
133
- add(name: string): void;
131
+ /** generated is false for an author string such as an atom; the server writer escapes those */
132
+ add(name: string, generated?: boolean): void;
134
133
  has(name: string): boolean;
135
134
  delete(name: string): void;
136
135
  };
@@ -162,25 +161,9 @@ type ComponentStyles<TProps> = (props: TProps) => {
162
161
  type CSSInterpolation<TProps> = string | number | undefined | null | false | ComponentStyles<TProps> | {
163
162
  [yakComponentSymbol]: any;
164
163
  } | ((props: TProps) => CSSInterpolation<TProps>);
165
- /**
166
- * css() runtime factory of css``
167
- *
168
- * /!\ @yak/solid transpiles css`` and styled``
169
- *
170
- * This changes the typings of the css`` and styled`` functions.
171
- * During development the user of @yak/solid wants to work with the
172
- * typings BEFORE compilation.
173
- *
174
- * Therefore this is only an internal function only and it must be cast to any
175
- * before exported to the user.
176
- *
177
- * The internal functioning of css`` is to return a single callback function that runs all functions
178
- * (or creates new ones if needed) that are passed as arguments. These functions receive the props, classes, and style object as arguments
179
- * and operate directly on the classes and style objects.
180
- */
181
- declare function css$1<TProps>(styles: TemplateStringsArray, ...values: CSSInterpolation<NoInfer<TProps> & {
164
+ type CSSFunction = <TProps>(styles: TemplateStringsArray, ...values: CSSInterpolation<NoInfer<TProps> & {
182
165
  theme: Accessor<YakTheme>;
183
- }>[]): ComponentStyles<TProps>;
166
+ }>[]) => ComponentStyles<TProps>;
184
167
  //#endregion
185
168
  //#region runtime/cssProp.d.ts
186
169
  declare module "@solidjs/web" {
@@ -221,7 +204,7 @@ declare const atoms: <T>(...atoms: (string | RuntimeStyleProcessor<T> | false)[]
221
204
  * `;
222
205
  * ```
223
206
  */
224
- declare const css: typeof css$1;
207
+ declare const css: CSSFunction;
225
208
  //#endregion
226
209
  //#region runtime/keyframes.d.ts
227
210
  /**
@@ -275,17 +258,9 @@ declare const keyframes: typeof keyframes$1;
275
258
  //#endregion
276
259
  //#region runtime/styled.d.ts
277
260
  /**
278
- * The `styled` method works perfectly on all of your own or any third-party component,
279
- * as long as they attach the passed `class` prop to a DOM element.
280
- *
281
- * @usage
282
- *
283
- * ```tsx
284
- * const StyledLink = styled(Link)`
285
- * color: #BF4F74;
286
- * font-weight: bold;
287
- * `;
288
- * ```
261
+ * style a tag or a component that forwards its class prop. styled.div is
262
+ * compiled to styled("div"); the untransformed export in mocks/styled.ts
263
+ * adds the tag properties with a proxy
289
264
  */
290
265
  declare const styled$1: Styled;
291
266
  //#endregion
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{createMemo as i,merge as a}from"solid-js";import{Dynamic as o,createComponent as s}from"@solidjs/web";const c=Symbol(`yak`);var l=class{value;constructor(e){this.value=e||``}add(e){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 u(...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];typeof i==`function`?n[t]=String(f(e,i)):n[t]=String(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++)d(e,n[t],r,i)},{$dynamic:!0})}const d=(e,t,n,r)=>{let i=t(e,n,r);for(;i;){if(typeof i==`function`){i=i(e,n,r);continue}else 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}},f=(e,t)=>{let n=t(e);if(typeof n==`function`)return f(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},p=(...e)=>{let t=[],n=[];for(let r of e)typeof r==`string`?t.push(...r.split(` `)):typeof r==`function`&&n.push(r);return u(...t.length>0?[(e,n)=>{t.forEach(e=>n.add(e))},...n]:n)},m=(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++)h(e,n[t]);return{class:``,style:void 0}})};function h(e,t){let n=new Set,r={},i=t(e,n,r);for(;typeof i==`function`;)i=i(e,n,r);return i}const g=(e,...t)=>``,_=e=>e?typeof e==`string`?e:Array.isArray(e)?e.map(_).filter(Boolean).join(` `):typeof e==`object`?Object.keys(e).filter(t=>e[t]).join(` `):String(e):``,v=e=>s(o,e),y=e=>Object.assign(b(e),{attrs:t=>b(e,t)}),b=(e,t)=>{let n=typeof e==`function`&&e[c]!==void 0,[,o,d,f]=n?e[c]:[],p=n?f:e,m=E(t,o);return(e,...t)=>{let n=D(u(e,...t),d),o=typeof p==`string`,f=o?{component:p}:{},h=o?v:e=>s(p,e),g=!m&&!n.$dynamic?e=>h(C(a(e,f,{get class(){let t=new l(_(e.class));return n(e,t,void 0),t.value||void 0}}))):e=>{let t=r(),o=a({theme:t},e),s=m?i(()=>m(o)):void 0,c=s?a(o,s):o,u=i(()=>{let t=s?.(),r=new l(_(e.class)),i=_(t?.class);i&&r.add(i);let a=n.$dynamic||t?.style?{...x(e.style),...x(t?.style)}:x(e.style);return n(c,r,a),{class:r.value||void 0,style:a&&Object.keys(a).length>0?a:void 0}});return h(C(a(a(e,s??{},{get class(){return u().class},get style(){return u().style}}),f),()=>{let e=s?.();return!!e&&`theme`in e&&e.theme!==t}))};return Object.assign(g,{[c]:[g,m,n,p]})}},x=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},S=(e,t)=>typeof e==`string`&&(e.startsWith(`$`)||e===`theme`&&!(t&&t())),C=(e,t)=>new Proxy(e,{get:(e,n)=>S(n,t)?void 0:Reflect.get(e,n),has:(e,n)=>!S(n,t)&&Reflect.has(e,n),ownKeys:e=>Reflect.ownKeys(e).filter(e=>!S(e,t)),getOwnPropertyDescriptor:(e,n)=>S(n,t)?void 0:Reflect.getOwnPropertyDescriptor(e,n)}),w=(e,t)=>{if(!(!e&&!t))return e?t?e+` `+t:e:t},T=(e,t)=>t?(e.class===t.class||!t.class)&&(e.style===t.style||!t.style)?{...e,...t}:{...e,...t,class:w(e.class,t.class),style:{...x(e.style),...x(t.style)}}:e,E=(e,t)=>{let n=e&&(typeof e==`function`?e:()=>e);return n&&t?e=>{let r=t(e);return T(r,n(T(e,r)))}:n||t},D=(e,t)=>e&&t?Object.assign((n,r,i)=>{t(n,r,i),e(n,r,i)},{$dynamic:e.$dynamic||t.$dynamic}):e||t,O=new Proxy(y,{get(e,t){return e(t)}}),k=(e,...t)=>{};export{e as YakThemeContext,t as YakThemeProvider,p as atoms,m as css,k as globalStyle,g as keyframes,O 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}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};
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, RuntimeStyleProcessor, StyleObject } from \"./publicStyledApi.js\";\n\nexport const yakComponentSymbol = Symbol(\"yak\");\n\n/**\n * Collects class names as a single space-separated string.\n *\n * `add` is the render hot path and stays a plain string append;\n * `has`/`delete` keep a Set-like contract for the rare runtime\n * functions that remove classes again (e.g. atoms).\n */\nexport class Classes implements ClassCollector {\n value: string;\n constructor(initial?: string) {\n this.value = initial || \"\";\n }\n add(name: string) {\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\ntype CSSFunction = <TProps = {}>(\n styles: TemplateStringsArray,\n ...values: CSSInterpolation<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 | NestedRuntimeStyleProcessor;\n\n/**\n * css() runtime factory of css``\n *\n * /!\\ @yak/solid transpiles css`` and styled``\n *\n * This changes the typings of the css`` and styled`` functions.\n * During development the user of @yak/solid wants to work with the\n * typings BEFORE compilation.\n *\n * Therefore this is only an internal function only and it must be cast to any\n * before exported to the user.\n *\n * The internal functioning of css`` is to return a single callback function that runs all functions\n * (or creates new ones if needed) that are passed as arguments. These functions receive the props, classes, and style object as arguments\n * and operate directly on the classes and style objects.\n */\nexport function css<TProps>(\n styles: TemplateStringsArray,\n ...values: CSSInterpolation<NoInfer<TProps> & { theme: Accessor<YakTheme> }>[]\n): ComponentStyles<TProps>;\nexport function css<TProps>(...args: Array<any>): RuntimeStyleProcessor<TProps> {\n // Normally this could be an array of strings passed, but as we transpile the usage of css`` ourselves, we control the arguments\n // and ensure that only the first argument is a string (class name of the non-dynamic styles)\n let staticClass: string | undefined;\n const dynamicCssFunctions: NestedRuntimeStyleProcessor[] = [];\n for (const arg of args as Array<string | CSSFunction | CSSStyles<any>>) {\n // A CSS-module class name which got auto generated during build from static css\n // e.g. css`color: red;`\n // compiled -> css(\"yak31e4\")\n if (typeof arg === \"string\") {\n staticClass = arg;\n }\n // Dynamic CSS e.g.\n // css`${props => props.active && css`color: red;`}`\n // compiled -> css((props: { active: boolean }) => props.active && css(\"yak31e4\"))\n else if (typeof arg === \"function\") {\n dynamicCssFunctions.push(arg as unknown as NestedRuntimeStyleProcessor);\n }\n // Dynamic CSS with css variables e.g.\n // css`transform: translate(${props => props.x}, ${props => props.y});`\n // compiled -> css(\"yak31e4\", { style: { \"--yakVarX\": props => props.x }, \"--yakVarY\": props => props.y }})\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 // The value for a css value can be a theme dependent function e.g.:\n // const borderColor = (props: { theme: { mode: \"dark\" | \"light\" } }) => props.theme === \"dark\" ? \"black\" : \"white\";\n // css`border-color: ${borderColor};`\n // Therefore the value has to be extracted recursively\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 // Non Dynamic CSS\n // This is just an optimization for the common case where there are no dynamic css functions\n // `$dynamic: false` lets the styled runtime skip theme lookup and\n // style-object allocation entirely for static components\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 },\n );\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 unwrapProps(props, dynamicCssFunctions[i], classes, allStyles);\n }\n },\n { $dynamic: true },\n );\n}\n\n// Dynamic CSS with runtime logic\nconst unwrapProps = (\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 // This is hard for typescript to infer\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 staticClasses.forEach((cls) => classes.add(cls));\n },\n ...dynamicFunctions,\n ]\n : dynamicFunctions;\n\n // @ts-expect-error the internal implementation of css is not typed\n return css(...runtimeFunctions);\n};\n","import type { css as cssInternal, NestedRuntimeStyleProcessor } from \"../cssLiteral.js\";\n\nexport type { ComponentStyles, CSSInterpolation } 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: typeof cssInternal = (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 */\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","import { css, CSSInterpolation, Classes, yakComponentSymbol } from \"./cssLiteral.js\";\nimport type {\n AnyComponent,\n Attrs,\n AttrsMerged,\n Styled,\n YakComponent,\n AttrsFunction,\n StyledFn,\n HtmlTags,\n Substitute,\n StyledLiteral,\n RuntimeStyleProcessor,\n StyleObject,\n} from \"./publicStyledApi.js\";\nimport { createMemo, merge } from \"solid-js\";\nimport { createComponent, Dynamic, type JSX } from \"@solidjs/web\";\nimport { normalizeClass } from \"./internals/mergeClasses.js\";\n// the following import is not relative but the package-level \"@yak/solid/context\"\n// export: it keeps a single context instance shared between the bundled runtime\n// and user code (and lets the vite plugin alias the user's theme context)\nimport { useTheme } from \"@yak/solid/context\";\nimport type { YakTheme } from \"./context/index.js\";\nimport type { Accessor } from \"solid-js\";\n\n//\n// The `styled()` API without `styled.` syntax\n//\n// The API design is inspired by styled-components:\n// https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/constructors/styled.tsx\n// https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/models/StyledComponent.ts\n//\n/**\n * Renders `props.component` (a tag name or component) with the remaining\n * props. Loosely typed on purpose: the runtime passes lazily-merged Proxy\n * props that no concrete component type can describe.\n */\nconst renderDynamic = (props: Record<PropertyKey, unknown>): JSX.Element =>\n createComponent(Dynamic as (props: Record<PropertyKey, unknown>) => JSX.Element, props);\n\nconst styledFactory: StyledFn = (Component) =>\n Object.assign(yakStyled(Component), {\n attrs: (attrs: Attrs<any>) => yakStyled(Component, attrs),\n });\n\n/**\n * The `styled` method works perfectly on all of your own or any third-party component,\n * as long as they attach the passed `class` prop to a DOM element.\n *\n * @usage\n *\n * ```tsx\n * const StyledLink = styled(Link)`\n * color: #BF4F74;\n * font-weight: bold;\n * `;\n * ```\n */\nexport const styled = styledFactory as Styled;\n\ntype PropsWithClassAndStyle = {\n class?: string;\n style?: StyleObject | string;\n theme?: Accessor<YakTheme>;\n} & Record<string, unknown>;\n\nconst yakStyled: StyledInternal = (Component, attrs) => {\n // Probe with a property read, not the `in` operator: in dev, solid-refresh\n // wraps registered components in a Proxy that forwards `get` to the live\n // implementation but has no `has` trap, so `in` would miss the symbol and\n // silently skip chain flattening (breaking attrs override order).\n const isYakComponent =\n typeof Component === \"function\" &&\n (Component as Partial<YakComponent<unknown>>)[yakComponentSymbol] !== undefined;\n\n // if the component that is wrapped is a yak component, we can extract the attrs function\n // and the dynamic style function to merge it with the current attrs function (or dynamic\n // style function) so that the sequence of the attrs functions is preserved\n const [, parentAttrsFn, parentRuntimeStylesFn, parentTarget] = isYakComponent\n ? ((Component as YakComponent<unknown>)[yakComponentSymbol] as unknown as [\n YakComponent<unknown>,\n ExtractAttrsFunction<typeof attrs>,\n RuntimeStyleProcessor<unknown>,\n AnyComponent<any> | string,\n ])\n : [];\n\n // the ultimate render target of the whole styled(styled(...)) chain:\n // attrs and style processors are already merged at construction time, so\n // a chain of N levels renders the target directly in ONE component instead\n // of re-entering every parent wrapper per element\n const targetComponent = (isYakComponent ? parentTarget : Component) as AnyComponent<any> | string;\n\n const mergedAttrsFn = buildRuntimeAttrsProcessor(attrs, parentAttrsFn);\n\n return (styles, ...values) => {\n // combine all interpolated logic into a single function\n // e.g. styled.button`color: ${props => props.color}; margin: ${props => props.margin};`\n const runtimeStylesFn = css(\n styles,\n ...(values as CSSInterpolation<unknown>[]),\n ) as RuntimeStyleProcessor<unknown>;\n const runtimeStyleProcessor = buildRuntimeStylesProcessor(\n runtimeStylesFn,\n parentRuntimeStylesFn,\n );\n\n // decided once per styled component: tag names render through Dynamic\n // (which needs a `component` prop), component targets are called\n // directly so a user prop named `component` reaches them (Dynamic\n // would consume it). `targetProps` is merged BEFORE filterDomProps -\n // the filter proxy must stay the outermost layer (see filterDomProps)\n const isTag = typeof targetComponent === \"string\";\n const targetProps = isTag ? { component: targetComponent } : {};\n const renderTarget = isTag\n ? renderDynamic\n : (finalProps: Record<PropertyKey, unknown>) =>\n createComponent(\n targetComponent as (props: Record<PropertyKey, unknown>) => JSX.Element,\n finalProps,\n );\n\n // fast path for fully static components (no attrs, no dynamic styles;\n // the most common case): contribute the chain's class names through a\n // single reactive `class` getter and strip $-props; skips theme lookup,\n // memo creation and style handling entirely\n const Yak: AnyComponent<PropsWithClassAndStyle> =\n !mergedAttrsFn && !runtimeStyleProcessor.$dynamic\n ? (props) =>\n renderTarget(\n filterDomProps(\n merge(props, targetProps, {\n // reading props.class inside the getter keeps the class\n // binding reactive without re-creating the element\n get class(): string | undefined {\n const classes = new Classes(normalizeClass(props.class));\n runtimeStyleProcessor(props, classes, undefined as unknown as StyleObject);\n return classes.value || undefined;\n },\n }),\n ),\n )\n : (props) => {\n // the component body runs ONCE in Solid: all per-update work\n // lives in memos/getters so only the affected DOM bindings update\n\n // attrs functions and dynamic style functions receive the theme;\n // fully static components take the fast path above and never\n // subscribe to the theme context\n const theme = useTheme();\n\n // getter-preserving merge: compiled prop functions like\n // `({ $bottom }) => ...` destructure this proxy INSIDE the memo\n // below, so every read is tracked at its use-site\n const propsWithTheme = merge({ theme }, props) as PropsWithClassAndStyle & {\n theme: Accessor<YakTheme>;\n };\n\n // The first component which is not wrapped in a yak component executes all attrs\n // functions starting from the innermost yak component to the outermost (itself)\n const attrsProps = mergedAttrsFn\n ? createMemo(() => mergedAttrsFn(propsWithTheme as any) as PropsWithClassAndStyle)\n : undefined;\n\n // input for the style processor: props + theme + attrs output\n const styleInput = attrsProps ? merge(propsWithTheme, attrsProps) : propsWithTheme;\n\n // execute all functions inside the style literal\n // e.g. styled.button`color: ${props => props.color};`\n // only reads inside this memo re-run it; the element itself is\n // never re-created, only its class/style bindings update\n const computed = createMemo(() => {\n const attrsResult = attrsProps?.();\n const classes = new Classes(normalizeClass(props.class));\n const attrsClass = normalizeClass(attrsResult?.class);\n if (attrsClass) {\n classes.add(attrsClass);\n }\n // static processors never write style values, so the incoming\n // style object can be passed through without a defensive copy\n const style =\n runtimeStyleProcessor.$dynamic || attrsResult?.style\n ? { ...unwrapStyle(props.style), ...unwrapStyle(attrsResult?.style) }\n : unwrapStyle(props.style);\n runtimeStyleProcessor(styleInput, classes, style as StyleObject);\n return {\n class: classes.value || undefined,\n style: style && Object.keys(style).length > 0 ? style : undefined,\n };\n });\n\n const merged = merge(props, attrsProps ?? {}, {\n get class(): string | undefined {\n return computed().class;\n },\n get style(): StyleObject | undefined {\n return computed().style;\n },\n });\n\n // keep the theme prop only if an attrs function intentionally\n // replaced it; the context theme itself never reaches the target\n const allowTheme = () => {\n const attrsResult = attrsProps?.();\n return !!attrsResult && \"theme\" in attrsResult && attrsResult.theme !== theme;\n };\n\n // render the chain's target directly; parent wrappers contribute\n // only their (already merged) attrs and style processors\n return renderTarget(filterDomProps(merge(merged, targetProps), allowTheme));\n };\n\n return Object.assign(Yak, {\n [yakComponentSymbol]: [Yak, mergedAttrsFn, runtimeStyleProcessor, targetComponent] as [\n unknown,\n unknown,\n unknown,\n unknown,\n ],\n });\n };\n};\n\n/**\n * Normalize a Solid style prop to an object the style processor can extend.\n * Solid allows string styles on elements; they are converted here so CSS custom\n * properties from dynamic values can be merged in (prefer object styles).\n */\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\nconst isBlockedProp = (key: PropertyKey, allowTheme?: () => boolean): boolean =>\n typeof key === \"string\" &&\n (key.startsWith(\"$\") || (key === \"theme\" && !(allowTheme && allowTheme())));\n\n/**\n * Remove all props that start with a $ sign (plus the internal theme) so\n * they reach neither DOM elements nor custom components.\n *\n * Implemented as a lazy Proxy instead of an eager copy: Solid's compiled\n * spread reads props through getters, and copying would read every prop\n * exactly once and freeze its value, killing reactivity.\n */\nconst filterDomProps = <T extends object>(props: T, allowTheme?: () => boolean): T =>\n new Proxy(props, {\n get: (target, key) => (isBlockedProp(key, allowTheme) ? undefined : Reflect.get(target, key)),\n has: (target, key) => !isBlockedProp(key, allowTheme) && Reflect.has(target, key),\n ownKeys: (target) => Reflect.ownKeys(target).filter((key) => !isBlockedProp(key, allowTheme)),\n getOwnPropertyDescriptor: (target, key) =>\n isBlockedProp(key, allowTheme) ? undefined : Reflect.getOwnPropertyDescriptor(target, key),\n });\n\n// util function to merge class names, as they are concatenated with a space\nconst mergeClasses = (a?: string, b?: string) => {\n if (!a && !b) return undefined;\n if (!a) return b;\n if (!b) return a;\n return a + \" \" + b;\n};\n\n/**\n * merge props and processed props (including class names and styles)\n * e.g.:\\\n * `{ class: \"a\", foo: 1 }` and `{ class: \"b\", bar: 2 }` \\\n * => `{ class: \"a b\", foo: 1, bar: 2 }`\n */\nconst combineProps = <\n T extends {\n class?: string;\n style?: StyleObject | string;\n },\n TOther extends\n | {\n class?: string;\n style?: StyleObject | string;\n }\n | null\n | undefined,\n>(\n props: T,\n newProps: TOther,\n) =>\n newProps\n ? (props.class === newProps.class || !newProps.class) &&\n (props.style === newProps.style || !newProps.style)\n ? // shortcut if no style and class merging is necessary\n {\n ...props,\n ...newProps,\n }\n : // merge class names and styles\n {\n ...props,\n ...newProps,\n class: mergeClasses(props.class, newProps.class),\n style: { ...unwrapStyle(props.style), ...unwrapStyle(newProps.style) },\n }\n : // if no new props are provided, no merging is necessary\n props;\n\n/**\n * Merges the attrs function of the current component with the attrs function of the parent component\n * in order to preserve the sequence of the attrs functions.\n * Note: In theory, the parentAttrsFn can have different types for TAttrsIn and TAttrsOut\n * but as this is only used internally, we can ignore and simplify this case\n * @param attrs The attrs object or function of the current component (if any)\n * @param parentAttrsFn The attrs function of the parent/wrapped component (if any)\n * @returns A function that receives the props and returns the transformed props\n */\nconst buildRuntimeAttrsProcessor = <\n T,\n TAttrsIn extends object,\n TAttrsOut extends AttrsMerged<T, TAttrsIn>,\n>(\n attrs?: Attrs<T, TAttrsIn, TAttrsOut>,\n parentAttrsFn?: AttrsFunction<T, TAttrsIn, TAttrsOut>,\n): AttrsFunction<T, TAttrsIn, TAttrsOut> | undefined => {\n const ownAttrsFn = attrs && (typeof attrs === \"function\" ? attrs : () => attrs);\n\n if (ownAttrsFn && parentAttrsFn) {\n return (props) => {\n const parentProps = parentAttrsFn(props);\n\n // overwrite and merge the parent props with the props received from the attrs function\n // after they went through the parent attrs function.\n //\n // This makes sure the linearity of the attrs functions is preserved and all attrs function receive\n // the whole props object calculated from the previous attrs functions\n return combineProps(\n parentProps as any,\n ownAttrsFn(combineProps(props as any, parentProps as any) as any),\n ) as any;\n };\n }\n\n return ownAttrsFn || parentAttrsFn;\n};\n\n/**\n * Merges the runtime style function of the current component with the runtime style function of the parent component\n * in order to preserve the sequence of the attrs functions.\n * @param runtimeStylesFn The current runtime styles function\n * @param parentRuntimeStylesFn The parent runtime styles function\n * @returns The merged runtime styles function\n */\nconst buildRuntimeStylesProcessor = <T>(\n runtimeStylesFn: RuntimeStyleProcessor<T>,\n parentRuntimeStylesFn?: RuntimeStyleProcessor<T>,\n) => {\n if (runtimeStylesFn && parentRuntimeStylesFn) {\n const combined: RuntimeStyleProcessor<T> = Object.assign(\n (props: T, classes: Parameters<RuntimeStyleProcessor<T>>[1], style: StyleObject) => {\n parentRuntimeStylesFn(props, classes, style);\n runtimeStylesFn(props, classes, style);\n },\n // the chain is dynamic if any level is dynamic\n { $dynamic: runtimeStylesFn.$dynamic || parentRuntimeStylesFn.$dynamic },\n );\n return combined;\n }\n return runtimeStylesFn || parentRuntimeStylesFn;\n};\n\n/**\n * Internal function where attrs are passed to be processed\n */\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/**\n * Utility type to extract the AttrsFunction from the Attrs type\n */\nexport type ExtractAttrsFunction<T> = T extends (p: any) => any ? T : never;\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, TagName: keyof JSX.IntrinsicElements) {\n return target(TagName);\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":"oNAIA,MAAa,EAAqB,OAAO,KAAK,EAS9C,IAAa,EAAb,KAA+C,CAC7C,MACA,YAAY,EAAkB,CAC5B,KAAK,MAAQ,GAAW,EAC1B,CACA,IAAI,EAAc,CACX,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,EAgEA,SAAgBA,EAAY,GAAG,EAAiD,CAG9E,IAAI,EACE,EAAqD,CAAC,EAC5D,IAAK,IAAM,KAAO,EAIZ,OAAO,GAAQ,SACjB,EAAc,EAKP,OAAO,GAAQ,WACtB,EAAoB,KAAK,CAA6C,EAK/D,OAAO,GAAQ,UAAY,UAAW,GAC7C,EAAoB,MAAM,EAAO,EAAG,IAAU,CAC5C,IAAK,IAAM,KAAO,EAAI,MAAO,C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gB,EAAO,EAAS,CAAK,CACvC,EAEA,CAAE,SAAU,EAAgB,UAAY,EAAsB,QAAS,CAE3D,EAET,GAAmB,ECnXf,EAAyB,IAAI,MAAMC,EAAe,CAC7D,IAAI,EAAQ,EAAsC,CAChD,OAAO,EAAO,CAAO,CACvB,CACF,CAAC,ECIY,GAA2C,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 } 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/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