@yak/solid 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.js +56 -86
- package/dist/internal.js.map +1 -1
- package/package.json +7 -7
- package/runtime/__tests__/reactivity.test.tsx +36 -0
- package/runtime/styled.ts +109 -118
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","names":["useTheme"],"sources":["../runtime/cssLiteral.ts","../runtime/internals/mergeClasses.ts","../runtime/styled.ts","../runtime/atoms.ts","../runtime/keyframes.ts","../runtime/globalStyle.ts","../runtime/internals/unitPostFix.ts","../runtime/internals/mergeCssProp.ts","../runtime/styledDom.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","/**\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(\"&\", \"&\").replaceAll('\"', \""\");\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 { 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","/**\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 = <T extends (string | number | bigint)[] = never>(\n styles: TemplateStringsArray,\n ..._dynamic: T\n): string => {\n // during compilation all args of keyframe are compiled\n // to a string which references the animation name\n return styles as any as string;\n};\n","import type { ComponentStyles } from \"./cssLiteral.js\";\nimport type { YakComponent } from \"./publicStyledApi.js\";\n\n/**\n * Values that may be interpolated into a `globalStyle` template.\n *\n * Only build-time values are allowed: constants, `keyframes` animation names,\n * static `css` mixins and styled-component selectors. Runtime functions\n * (`${(props) => ...}`) are intentionally excluded: a global rule has no element\n * to attach a CSS variable to. Declare a CSS custom property instead and toggle\n * it via an attribute/class on the root element.\n */\nexport type GlobalStyleInterpolation = string | number | ComponentStyles<{}> | YakComponent<any>;\n\n/**\n * Declares global, unscoped styles that ride the same zero-runtime extraction\n * pipeline as `styled` and `keyframes`.\n *\n * Global styles are **part of the stylesheet, not part of the render tree**.\n * They apply exactly when the module declaring them is included in the bundle,\n * typically by importing it from a layout or entry point. They cannot be\n * conditionally mounted; express conditions in CSS (`@media`, `@supports`,\n * `:root[data-theme]`, `:has()`) or through CSS custom properties.\n *\n * @usage\n *\n * ```tsx\n * import { globalStyle, keyframes } from \"@yak/solid\";\n *\n * const fadeIn = keyframes`\n * from { opacity: 0; }\n * `;\n *\n * globalStyle`\n * :root {\n * --spacing: 4px;\n * }\n *\n * body {\n * margin: 0;\n * }\n *\n * ::view-transition-new(root) {\n * animation: ${fadeIn} 200ms ease;\n * }\n * `;\n * ```\n */\nexport const globalStyle = (\n _styles: TemplateStringsArray,\n ..._values: Array<GlobalStyleInterpolation>\n): void => {\n return undefined;\n};\n","/**\n * Internal helper called by transformed code. Do not use directly.\n *\n * Takes a function and a css unit and returns the result of the function concatenated with the unit\n *\n * ```tsx\n * import { styled } from \"@yak/solid\";\n *\n * const Button = styled.button<{ $width?: boolean }>`\n * width: ${({ $width }) => $width}px;\n * `;\n * ```\n *\n * Which will be transformed to:\n * ```tsx\n * import { styled } from \"@yak/solid/internal\";\n *\n * const Button = styled.button<{ $width?: boolean }>(\n * \"button\", {\n * width: unitPostFix({ $width }) => $width, \"px\")\n * });\n */\nexport const unitPostFix = (arg: unknown, unit: string) => {\n switch (typeof arg) {\n case \"function\":\n return (props: any) => unitPostFix(arg(props), unit);\n case \"number\":\n case \"string\":\n return `${arg}${unit}`;\n // Ignore falsy values\n default:\n return undefined;\n }\n};\n","import { isServer } from \"@solidjs/web\";\nimport { Classes } from \"../cssLiteral.js\";\nimport { RuntimeStyleProcessor, StyleObject } from \"../publicStyledApi.js\";\nimport { normalizeClass } from \"./mergeClasses.js\";\n\ntype Source = Record<PropertyKey, unknown>;\n\n/** the last source that carries the key */\nconst lastWith = (sources: Source[], key: string): Source | undefined => {\n for (let index = sources.length - 1; index >= 0; index--) {\n if (key in sources[index]) return sources[index];\n }\n return undefined;\n};\n\n/**\n * Merges the relevant props of a native element with a css prop. The\n * compiler adds it for the `css` prop:\n * ```tsx\n * <button class=\"a\" {...props} style={s} css={css`color: green;`} />\n * ```\n * compiles to\n * ```tsx\n * <button {...__yak_mergeCssProp(css(\"yak1\"), { class: \"a\" }, props, { style: s })} />\n * ```\n */\nexport const mergeCssProp = (\n cssProp: RuntimeStyleProcessor<unknown> | false | null | undefined,\n ...sources: (Source | null | undefined)[]\n) => {\n const present = sources.filter((source): source is Source => source != null);\n const out: Source = {};\n for (const source of present) {\n for (const key of Reflect.ownKeys(source)) {\n // contributed below, from the last source that carries them\n if (key === \"class\" || key === \"style\") continue;\n const descriptor = Reflect.getOwnPropertyDescriptor(source, key)!;\n if (descriptor.get || descriptor.set || !descriptor.enumerable) {\n Object.defineProperty(out, key, descriptor);\n } else {\n out[key] = descriptor.value;\n }\n }\n }\n // `in` finds the owner without invoking its getter\n const classOwner = lastWith(present, \"class\");\n const styleOwner = lastWith(present, \"style\");\n\n const mergedClass = (): string | undefined => {\n const classes = new Classes(normalizeClass(classOwner?.class));\n // a falsy css prop applies no styles, e.g. `css={on && css`...`}` with `on` false\n if (cssProp) cssProp({}, classes, {} as StyleObject);\n return classes.value || undefined;\n };\n const mergedStyle = (): StyleObject | undefined => {\n const base = styleOwner?.style as StyleObject | undefined;\n const style: StyleObject = base ? { ...base } : {};\n if (cssProp) cssProp({}, new Classes(), style);\n for (const _ in style) return style;\n return undefined;\n };\n\n if (isServer) {\n // The server reads once, so the values are resolved here; a class or\n // style read takes no hydration id. A key left undefined would make\n // `ssrElement` write `class=\"\"`, so only carried values are set.\n const className = mergedClass();\n if (className !== undefined) out.class = className;\n const style = mergedStyle();\n if (style !== undefined) out.style = style;\n return out;\n }\n // on the client the spread reads these inside its effect, so a signal read\n // by a source or by the css prop updates the attribute in place\n if (cssProp || classOwner) {\n Object.defineProperty(out, \"class\", { get: mergedClass, enumerable: true, configurable: true });\n }\n if (cssProp || styleOwner) {\n Object.defineProperty(out, \"style\", { get: mergedStyle, enumerable: true, configurable: true });\n }\n return out;\n};\n","import { styled } from \"./styled.js\";\n/// Internal API to create styled components\n/// Optimization for faster rendering and smaller bundle size in production\n/// thanks to better minification and dead code elimination\n///\n/// List taken from https://github.com/styled-components/styled-components/blob/e0019ba666fab4b5aaa2bff71ba6ad0005a299fd/packages/styled-components/src/utils/domElements.ts#L90\nexport const __yak_a = /*#__PURE__*/ styled(\"a\");\nexport const __yak_abbr = /*#__PURE__*/ styled(\"abbr\");\nexport const __yak_address = /*#__PURE__*/ styled(\"address\");\nexport const __yak_area = /*#__PURE__*/ styled(\"area\");\nexport const __yak_article = /*#__PURE__*/ styled(\"article\");\nexport const __yak_aside = /*#__PURE__*/ styled(\"aside\");\nexport const __yak_audio = /*#__PURE__*/ styled(\"audio\");\nexport const __yak_b = /*#__PURE__*/ styled(\"b\");\nexport const __yak_base = /*#__PURE__*/ styled(\"base\");\nexport const __yak_bdi = /*#__PURE__*/ styled(\"bdi\");\nexport const __yak_bdo = /*#__PURE__*/ styled(\"bdo\");\nexport const __yak_big = /*#__PURE__*/ styled(\"big\");\nexport const __yak_blockquote = /*#__PURE__*/ styled(\"blockquote\");\nexport const __yak_body = /*#__PURE__*/ styled(\"body\");\nexport const __yak_br = /*#__PURE__*/ styled(\"br\");\nexport const __yak_button = /*#__PURE__*/ styled(\"button\");\nexport const __yak_canvas = /*#__PURE__*/ styled(\"canvas\");\nexport const __yak_caption = /*#__PURE__*/ styled(\"caption\");\nexport const __yak_cite = /*#__PURE__*/ styled(\"cite\");\nexport const __yak_code = /*#__PURE__*/ styled(\"code\");\nexport const __yak_col = /*#__PURE__*/ styled(\"col\");\nexport const __yak_colgroup = /*#__PURE__*/ styled(\"colgroup\");\nexport const __yak_data = /*#__PURE__*/ styled(\"data\");\nexport const __yak_datalist = /*#__PURE__*/ styled(\"datalist\");\nexport const __yak_dd = /*#__PURE__*/ styled(\"dd\");\nexport const __yak_del = /*#__PURE__*/ styled(\"del\");\nexport const __yak_details = /*#__PURE__*/ styled(\"details\");\nexport const __yak_dfn = /*#__PURE__*/ styled(\"dfn\");\nexport const __yak_dialog = /*#__PURE__*/ styled(\"dialog\");\nexport const __yak_div = /*#__PURE__*/ styled(\"div\");\nexport const __yak_dl = /*#__PURE__*/ styled(\"dl\");\nexport const __yak_dt = /*#__PURE__*/ styled(\"dt\");\nexport const __yak_em = /*#__PURE__*/ styled(\"em\");\nexport const __yak_embed = /*#__PURE__*/ styled(\"embed\");\nexport const __yak_fieldset = /*#__PURE__*/ styled(\"fieldset\");\nexport const __yak_figcaption = /*#__PURE__*/ styled(\"figcaption\");\nexport const __yak_figure = /*#__PURE__*/ styled(\"figure\");\nexport const __yak_footer = /*#__PURE__*/ styled(\"footer\");\nexport const __yak_form = /*#__PURE__*/ styled(\"form\");\nexport const __yak_h1 = /*#__PURE__*/ styled(\"h1\");\nexport const __yak_h2 = /*#__PURE__*/ styled(\"h2\");\nexport const __yak_h3 = /*#__PURE__*/ styled(\"h3\");\nexport const __yak_h4 = /*#__PURE__*/ styled(\"h4\");\nexport const __yak_h5 = /*#__PURE__*/ styled(\"h5\");\nexport const __yak_h6 = /*#__PURE__*/ styled(\"h6\");\nexport const __yak_header = /*#__PURE__*/ styled(\"header\");\nexport const __yak_hgroup = /*#__PURE__*/ styled(\"hgroup\");\nexport const __yak_hr = /*#__PURE__*/ styled(\"hr\");\nexport const __yak_html = /*#__PURE__*/ styled(\"html\");\nexport const __yak_i = /*#__PURE__*/ styled(\"i\");\nexport const __yak_iframe = /*#__PURE__*/ styled(\"iframe\");\nexport const __yak_img = /*#__PURE__*/ styled(\"img\");\nexport const __yak_input = /*#__PURE__*/ styled(\"input\");\nexport const __yak_ins = /*#__PURE__*/ styled(\"ins\");\nexport const __yak_kbd = /*#__PURE__*/ styled(\"kbd\");\nexport const __yak_keygen = /*#__PURE__*/ styled(\"keygen\");\nexport const __yak_label = /*#__PURE__*/ styled(\"label\");\nexport const __yak_legend = /*#__PURE__*/ styled(\"legend\");\nexport const __yak_li = /*#__PURE__*/ styled(\"li\");\nexport const __yak_link = /*#__PURE__*/ styled(\"link\");\nexport const __yak_main = /*#__PURE__*/ styled(\"main\");\nexport const __yak_map = /*#__PURE__*/ styled(\"map\");\nexport const __yak_mark = /*#__PURE__*/ styled(\"mark\");\nexport const __yak_menu = /*#__PURE__*/ styled(\"menu\");\nexport const __yak_menuitem = /*#__PURE__*/ styled(\"menuitem\");\nexport const __yak_meta = /*#__PURE__*/ styled(\"meta\");\nexport const __yak_meter = /*#__PURE__*/ styled(\"meter\");\nexport const __yak_nav = /*#__PURE__*/ styled(\"nav\");\nexport const __yak_noscript = /*#__PURE__*/ styled(\"noscript\");\nexport const __yak_object = /*#__PURE__*/ styled(\"object\");\nexport const __yak_ol = /*#__PURE__*/ styled(\"ol\");\nexport const __yak_optgroup = /*#__PURE__*/ styled(\"optgroup\");\nexport const __yak_option = /*#__PURE__*/ styled(\"option\");\nexport const __yak_output = /*#__PURE__*/ styled(\"output\");\nexport const __yak_p = /*#__PURE__*/ styled(\"p\");\nexport const __yak_param = /*#__PURE__*/ styled(\"param\");\nexport const __yak_picture = /*#__PURE__*/ styled(\"picture\");\nexport const __yak_pre = /*#__PURE__*/ styled(\"pre\");\nexport const __yak_progress = /*#__PURE__*/ styled(\"progress\");\nexport const __yak_q = /*#__PURE__*/ styled(\"q\");\nexport const __yak_rp = /*#__PURE__*/ styled(\"rp\");\nexport const __yak_rt = /*#__PURE__*/ styled(\"rt\");\nexport const __yak_ruby = /*#__PURE__*/ styled(\"ruby\");\nexport const __yak_s = /*#__PURE__*/ styled(\"s\");\nexport const __yak_samp = /*#__PURE__*/ styled(\"samp\");\nexport const __yak_script = /*#__PURE__*/ styled(\"script\");\nexport const __yak_section = /*#__PURE__*/ styled(\"section\");\nexport const __yak_select = /*#__PURE__*/ styled(\"select\");\nexport const __yak_small = /*#__PURE__*/ styled(\"small\");\nexport const __yak_source = /*#__PURE__*/ styled(\"source\");\nexport const __yak_span = /*#__PURE__*/ styled(\"span\");\nexport const __yak_strong = /*#__PURE__*/ styled(\"strong\");\nexport const __yak_style = /*#__PURE__*/ styled(\"style\");\nexport const __yak_sub = /*#__PURE__*/ styled(\"sub\");\nexport const __yak_summary = /*#__PURE__*/ styled(\"summary\");\nexport const __yak_sup = /*#__PURE__*/ styled(\"sup\");\nexport const __yak_table = /*#__PURE__*/ styled(\"table\");\nexport const __yak_tbody = /*#__PURE__*/ styled(\"tbody\");\nexport const __yak_td = /*#__PURE__*/ styled(\"td\");\nexport const __yak_textarea = /*#__PURE__*/ styled(\"textarea\");\nexport const __yak_tfoot = /*#__PURE__*/ styled(\"tfoot\");\nexport const __yak_th = /*#__PURE__*/ styled(\"th\");\nexport const __yak_thead = /*#__PURE__*/ styled(\"thead\");\nexport const __yak_time = /*#__PURE__*/ styled(\"time\");\nexport const __yak_tr = /*#__PURE__*/ styled(\"tr\");\nexport const __yak_track = /*#__PURE__*/ styled(\"track\");\nexport const __yak_u = /*#__PURE__*/ styled(\"u\");\nexport const __yak_ul = /*#__PURE__*/ styled(\"ul\");\nexport const __yak_use = /*#__PURE__*/ styled(\"use\");\nexport const __yak_var = /*#__PURE__*/ styled(\"var\");\nexport const __yak_video = /*#__PURE__*/ styled(\"video\");\nexport const __yak_wbr = /*#__PURE__*/ styled(\"wbr\");\nexport const __yak_circle = /*#__PURE__*/ styled(\"circle\");\nexport const __yak_clipPath = /*#__PURE__*/ styled(\"clipPath\");\nexport const __yak_defs = /*#__PURE__*/ styled(\"defs\");\nexport const __yak_ellipse = /*#__PURE__*/ styled(\"ellipse\");\nexport const __yak_foreignObject = /*#__PURE__*/ styled(\"foreignObject\");\nexport const __yak_g = /*#__PURE__*/ styled(\"g\");\nexport const __yak_image = /*#__PURE__*/ styled(\"image\");\nexport const __yak_line = /*#__PURE__*/ styled(\"line\");\nexport const __yak_linearGradient = /*#__PURE__*/ styled(\"linearGradient\");\nexport const __yak_marker = /*#__PURE__*/ styled(\"marker\");\nexport const __yak_mask = /*#__PURE__*/ styled(\"mask\");\nexport const __yak_path = /*#__PURE__*/ styled(\"path\");\nexport const __yak_pattern = /*#__PURE__*/ styled(\"pattern\");\nexport const __yak_polygon = /*#__PURE__*/ styled(\"polygon\");\nexport const __yak_polyline = /*#__PURE__*/ styled(\"polyline\");\nexport const __yak_radialGradient = /*#__PURE__*/ styled(\"radialGradient\");\nexport const __yak_rect = /*#__PURE__*/ styled(\"rect\");\nexport const __yak_stop = /*#__PURE__*/ styled(\"stop\");\nexport const __yak_svg = /*#__PURE__*/ styled(\"svg\");\nexport const __yak_text = /*#__PURE__*/ styled(\"text\");\nexport const __yak_tspan = /*#__PURE__*/ styled(\"tspan\");\n"],"mappings":";;;;;AAOA,MAAa,qBAAqB,OAAO,IAAI,sBAAsB;AAUnE,IAAa,UAAb,MAA+C;CAC7C;CAMA,YAAY;CACZ,YAAY,SAAkB;EAC5B,KAAK,QAAQ,WAAW;CAC1B;CACA,IAAI,MAAc,YAAY,MAAM;EAClC,IAAI,CAAC,WAAW,KAAK,YAAY;EACjC,IA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a,aAA2B,qBAAO,MAAM;AACrD,MAAa,gBAA8B,qBAAO,SAAS;AAC3D,MAAa,gBAA8B,qBAAO,SAAS;AAC3D,MAAa,iBAA+B,qBAAO,UAAU;AAC7D,MAAa,uBAAqC,qBAAO,gBAAgB;AACzE,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,YAA0B,qBAAO,KAAK;AACnD,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,cAA4B,qBAAO,OAAO"}
|
|
1
|
+
{"version":3,"file":"internal.js","names":["useTheme"],"sources":["../runtime/cssLiteral.ts","../runtime/internals/mergeClasses.ts","../runtime/styled.ts","../runtime/atoms.ts","../runtime/keyframes.ts","../runtime/globalStyle.ts","../runtime/internals/unitPostFix.ts","../runtime/internals/mergeCssProp.ts","../runtime/styledDom.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","/**\n * Normalize Solid `class` values for string merging.\n * Solid 2 allows strings, arrays and object syntax on the class attribute.\n */\nexport const normalizeClass = (value: unknown): string => {\n if (!value) return \"\";\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) return value.map(normalizeClass).filter(Boolean).join(\" \");\n if (typeof value === \"object\") {\n return Object.keys(value)\n .filter((key) => (value as Record<string, unknown>)[key])\n .join(\" \");\n }\n return String(value);\n};\n\n/**\n * Merges the folded yak class name with a user `class` value.\n *\n * Injected by the compiler (as `__yak_mergeClassNames`) when it replaces a JSX\n * usage of a fully static styled component with a plain element:\n * ```tsx\n * const Card = styled.div`color: red;`;\n * <Card class={active() && \"active\"} />\n * ```\n * becomes\n * ```tsx\n * <div class={__yak_mergeClassNames(\"yX\", active() && \"active\")} />\n * ```\n * combineProps in styled.ts uses it for two attrs layers' classes as well.\n */\nexport const mergeClasses = (yakClass: string, userClass: unknown): string | undefined => {\n const user = normalizeClass(userClass);\n if (!yakClass) return user || undefined;\n if (!user) return yakClass;\n return yakClass + \" \" + user;\n};\n","// the compiler extracts the css at build time; this file only builds class\n// and style per element, prints the tag on the server and binds it on the\n// client. the map, for a reader who lands in the middle:\n//\n// styled() flattens a chain of styled components and picks one of two\n// component shapes at definition. static: the class is fixed, there is no\n// attrs function and the css block writes no style values at render time,\n// so no memo and no theme read. dynamic: one memo per element resolves\n// attrs, class and style.\n//\n// both hand the target a RenderMeta and a props view. on the server\n// serializeElement (the writer) prints a tag, on the client bindElement\n// spreads onto a cloned template, a component target gets targetProps\n// (a copy or a proxy).\n//\n// the one rule every path keeps: a prop getter may render a child and take\n// hydration keys of its own, so the element takes its key first and reads\n// each getter once, in the target's order.\n//\n// words: author = the app code that writes the css block, renders the\n// component and passes props; target = the tag or component under the\n// styled layer; attrs = the .attrs() values, an object or a function of\n// props; baked = object attrs printed into the tag at definition; view = a\n// proxy over props that adds the theme or attrs; collector = the Classes\n// instance a css block adds its names to; atom = a class name the author\n// passes into a css block via atoms(\"...\"), author text that needs\n// escaping; reactive spread = a {...props} in jsx, which solid compiles to\n// a proxy marked with $PROXY; hole = a slot in a server template that\n// ssr() fills, possibly async; hydration key = the id the server prints on\n// an element so the client can claim the same node\nimport { css, Classes, yakComponentSymbol } from \"./cssLiteral.js\";\nimport type {\n AnyComponent,\n Attrs,\n AttrsMerged,\n Styled,\n YakComponent,\n StyledFn,\n HtmlTags,\n Substitute,\n StyledLiteral,\n CompiledStyleProcessor,\n StaticStyleProcessor,\n StyleObject,\n} from \"./publicStyledApi.js\";\nimport { $PROXY, createMemo, merge, omit } from \"solid-js\";\n// the helpers solid's compiled jsx calls; this file hand-writes what the compiler would emit for a tag\nimport {\n ChildProperties,\n createComponent,\n DOMWithState,\n escape,\n getNextElement,\n insert,\n isServer,\n MathMLElements,\n runHydrationEvents,\n spread,\n ssr,\n ssrClassName,\n ssrHydrationKey,\n ssrStyle,\n SVGElements,\n template,\n type JSX,\n} from \"@solidjs/web\";\nimport { mergeClasses, normalizeClass } from \"./internals/mergeClasses.js\";\n// the runtime and the app share one theme context; vite can alias this export\nimport { useTheme } from \"@yak/solid/context\";\nimport type { YakTheme } from \"./context/index.js\";\nimport type { Accessor } from \"solid-js\";\n\n/** the props a styled component receives from its author; theme is an accessor (the provider's or the author's) */\ntype Props = {\n class?: string;\n style?: StyleObject | string;\n theme?: Accessor<YakTheme>;\n} & Record<PropertyKey, unknown>;\n\n/**\n * the compiled css block: adds its class names to the collector and, when\n * $dynamic, style values for the props; the css itself is extracted at build time\n */\ntype StyleProcessor = CompiledStyleProcessor<unknown>;\n\ntype RuntimeAttrsFn = (props: Props) => Props;\n\n/** the .attrs() values: an object, or a function of the author's props */\ntype RuntimeAttrs = Props | RuntimeAttrsFn;\n\ntype ComputedStyles = {\n class: string | undefined;\n /** true when the class holds generated names only, nothing from the author or attrs; the writer prints it unescaped then */\n generatedClass: boolean;\n style: StyleObject | undefined;\n attrs: Props | undefined;\n};\n\n/**\n * the information to build class and style for one render\n * kept outside of the component props so solid never copies or filters\n * it when it walks the props object\n */\ntype RenderMeta = StaticMeta | DynamicMeta;\n\n/** static component (fixed class, no attrs function, no style values at render time): one meta per component, the class comes from classOf */\ntype StaticMeta = {\n /** keys the target must never see; the rule is `skip` in yakStyled */\n skip: (key: PropertyKey) => boolean;\n compute: undefined;\n classOf: (props: Props) => string | undefined;\n attrsAddKeys: false;\n /** the static class when every name in it is generated, so the writer prints it unescaped; undefined when an atom put author text in it */\n unescapedClass: string | undefined;\n};\n\n/**\n * dynamic component: one memo (run once on the server) holds class,\n * style and attrs, one meta per element. the two meta literals (in\n * createStaticComponent and createDynamicComponent) keep the same keys in\n * the same order so every meta read sees one shape\n */\ntype DynamicMeta = {\n skip: (key: PropertyKey) => boolean;\n compute: () => ComputedStyles;\n classOf: undefined;\n /**\n * an attrs function may add keys at render time, so the target gets a\n * proxy, not a copy. decided at definition: the memo's current attrs say\n * nothing about later runs\n */\n attrsAddKeys: boolean;\n unescapedClass: undefined;\n};\n\n/** what a styled component built on another yak component inherits from it */\ntype ComponentMetadata = readonly [\n attrs: RuntimeAttrs | undefined,\n styles: StyleProcessor,\n target: AnyComponent<any> | string,\n];\n\n/** renders one element of the flattened target: props are the author's raw props, meta says how to build class and style */\ntype TargetRenderer = (props: Props, meta: RenderMeta) => JSX.Element;\n\n/** the loosely typed form of Styled that yakStyled implements; the public overloads live in publicStyledApi */\nexport type StyledInternal = <\n T extends object,\n TAttrsIn extends object = {},\n TAttrsOut extends AttrsMerged<T, TAttrsIn> = AttrsMerged<T, TAttrsIn>,\n>(\n Component: AnyComponent<T> | YakComponent<T> | HtmlTags | string,\n attrs?: Attrs<T, TAttrsIn, TAttrsOut>,\n) => StyledLiteral<Substitute<T, TAttrsIn>>;\n\n/** solid's server regex (not exported); its VoidElements set lacks keygen and menuitem */\nconst VOID_ELEMENTS =\n /^(?:area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)$/i;\n\nconst styledFactory: StyledFn = (Component) =>\n Object.assign(yakStyled(Component), {\n attrs: (attrs: Attrs<any>) => yakStyled(Component, attrs),\n });\n\n/**\n * style a tag or a component that forwards its class prop. styled.div is\n * compiled to styled(\"div\"); the untransformed export in mocks/styled.ts\n * adds the tag properties with a proxy\n */\nexport const styled = styledFactory as Styled;\n\nconst yakStyled: StyledInternal = (Component, attrs) => {\n // solid-refresh forwards reads to the live component, but does not forward `in` checks\n const isYakComponent =\n typeof Component === \"function\" &&\n (Component as Partial<YakComponent<unknown>>)[yakComponentSymbol] !== undefined;\n\n // the public tuple type hides the shape, one cast at the read\n const [parentAttrs, parentRuntimeStylesFn, parentTarget] = isYakComponent\n ? ((Component as YakComponent<unknown>)[yakComponentSymbol] as ComponentMetadata)\n : [];\n\n // the chain renders its final target once, with all attrs and style processors combined\n const targetComponent = parentTarget ?? Component;\n\n const mergedAttrs = composeAttrs(attrs as RuntimeAttrs | undefined, parentAttrs);\n\n return (styles, ...values) => {\n // the interpolations of the style block, e.g.\n // styled.button`color: ${props => props.color}; margin: ${props => props.margin};`\n // arrive compiled: styles and values hold class names, style callbacks\n // and css-variable maps, no css text\n const runtimeStylesFn = css(styles, ...values);\n const runtimeStyleProcessor = composeStyles(runtimeStylesFn, parentRuntimeStylesFn);\n\n const isTag = typeof targetComponent === \"string\";\n // object attrs with plain attribute values bake into the tag's opening\n // string and template; the component stays static. baked keys reach the\n // dom only through that string: skip drops them from the target\n const baked =\n isTag &&\n mergedAttrs &&\n typeof mergedAttrs !== \"function\" &&\n bakeable(targetComponent, mergedAttrs)\n ? mergedAttrs\n : undefined;\n const attrString = baked ? bakeAttributes(baked) : \"\";\n const renderTarget = createTargetRenderer(targetComponent, attrString);\n // static: attrs are none or baked, and the css block writes no style values\n const isStatic = (!mergedAttrs || !!baked) && !runtimeStyleProcessor.$dynamic;\n // the target never sees $-props, the provider theme, or the author class\n // (yak hands it the combined one); a dynamic component merges style in its\n // memo, so the author's style key is dropped here and handed over combined.\n // no symbol passes: solid's merge() flattens any object that answers its\n // private $SOURCES key, which would hand a target's mergeProps() the\n // unfiltered originals; solid's own omit() blocks that key the same way\n const skip = (key: PropertyKey) =>\n typeof key !== \"string\" ||\n key.charCodeAt(0) === 36 /* $ */ ||\n key === \"class\" ||\n key === \"theme\" ||\n (!isStatic && key === \"style\") ||\n // a baked attr wins over the author's prop of the same name, even when its value is null\n (baked !== undefined && Object.hasOwn(baked, key));\n // baked attrs still run inside a dynamic component's memo: style callbacks\n // read them through withAttrs\n const attrsFn =\n typeof mergedAttrs === \"function\" ? mergedAttrs : mergedAttrs && (() => mergedAttrs);\n const Yak = isStatic\n ? createStaticComponent(\n isTag ? targetComponent : undefined,\n renderTarget,\n runtimeStyleProcessor,\n skip,\n attrString,\n )\n : createDynamicComponent(renderTarget, attrsFn, runtimeStyleProcessor, skip, !!baked);\n\n const metadata: ComponentMetadata = [mergedAttrs, runtimeStyleProcessor, targetComponent];\n return Object.assign(Yak, { [yakComponentSymbol]: metadata });\n };\n};\n\n/**\n * object attrs bake when every entry is a plain attribute with a primitive\n * value. rejected keys are the union of what skip drops, what attribute()\n * treats specially, and what solid sets as a dom property (DOMWithState:\n * value, checked, ...), which a template would turn into a markup\n * attribute. enumerable value keys only, so the three walks (here,\n * bakeAttributes, skip) see the same keys; a getter blocks baking and runs\n * at render time\n */\nconst bakeable = (tag: string, attrs: Props): boolean => {\n const stateful = DOMWithState[tag.toUpperCase()];\n return Object.getOwnPropertyNames(attrs).every((key) => {\n const descriptor = Object.getOwnPropertyDescriptor(attrs, key)!;\n if (!descriptor.enumerable || !(\"value\" in descriptor)) return false;\n const type = typeof descriptor.value;\n return (\n (type === \"string\" || type === \"number\" || type === \"boolean\" || descriptor.value == null) &&\n // the name goes into the template and the opening string unescaped; anything\n // else (a computed key with markup in it) takes the writer, whose attribute() escapes names\n ATTRIBUTE_NAME.test(key) &&\n key.charCodeAt(0) !== 36 &&\n key !== \"class\" &&\n key !== \"style\" &&\n key !== \"theme\" &&\n key !== \"ref\" &&\n !ChildProperties.has(key) &&\n !key.startsWith(\"on\") &&\n !key.startsWith(\"prop:\") &&\n !(stateful && key in stateful)\n );\n });\n};\n\n/**\n * the attribute string of baked attrs, built once at definition. the value\n * rules follow attribute(), which prints one prop on the server; the escaping\n * is local because the client build's escape is an empty stub, and the names\n * passed the ATTRIBUTE_NAME check. `<` stays unescaped, harmless in a quoted value\n */\nconst bakeAttributes = (attrs: Props): string => {\n let result = \"\";\n for (const key of Object.keys(attrs)) {\n const value = attrs[key];\n if (value == null || value === false) continue;\n result +=\n value === true || value === \"\" ? ` ${key}` : ` ${key}=\"${escapeAttribute(String(value))}\"`;\n }\n return result;\n};\n\nconst escapeAttribute = (value: string) => value.replaceAll(\"&\", \"&\").replaceAll('\"', \""\");\n\n/** an attribute name that needs no escaping in markup */\nconst ATTRIBUTE_NAME = /^[A-Za-z_:][\\w:.-]*$/;\n\n/** parent attrs first, then own attrs read and override that result */\nconst composeAttrs = (attrs?: RuntimeAttrs, parent?: RuntimeAttrs): RuntimeAttrs | undefined => {\n if (!attrs) return parent;\n if (!parent) return attrs;\n // two objects without getters combine once here and stay an object; a\n // getter must run per render, inside the memo\n if (\n typeof attrs !== \"function\" &&\n typeof parent !== \"function\" &&\n !hasGetter(attrs) &&\n !hasGetter(parent)\n ) {\n return combineProps(parent, attrs);\n }\n const own = typeof attrs === \"function\" ? attrs : () => attrs;\n const parentFn = typeof parent === \"function\" ? parent : () => parent;\n return (props) => {\n const parentProps = parentFn(props);\n return combineProps(parentProps, own(combineProps(props, parentProps)));\n };\n};\n\n/** parent styles before own styles, with one collector and one style object */\nconst composeStyles = (own: StyleProcessor, parent?: StyleProcessor): StyleProcessor => {\n if (!parent) return own;\n return Object.assign(\n (props: unknown, classes: Parameters<StyleProcessor>[1], style: StyleObject) => {\n parent(props, classes, style);\n own(props, classes, style);\n },\n { $dynamic: own.$dynamic || parent.$dynamic },\n ) as StyleProcessor;\n};\n\n/**\n * attrs override props; class and style values combine, e.g.\n * { class: \"a\", foo: 1 } and { class: \"b\", bar: 2 } -> { class: \"a b\", foo: 1, bar: 2 }\n */\nconst combineProps = (props: Props, newProps: Props | null | undefined): Props => {\n if (!newProps) return props;\n // descriptors, not values: a spread would run every author getter here,\n // and a children getter renders (twice, and with the wrong hydration keys)\n const descriptors = {\n ...rehomedDescriptors(props),\n ...rehomedDescriptors(newProps),\n };\n // an equal class counts as nothing: own attrs get the combined props and\n // may hand the same class back, merging it again would duplicate it\n if (newProps.class && props.class !== newProps.class) {\n descriptors.class = valueDescriptor(mergeClasses(normalizeClass(props.class), newProps.class));\n }\n if (newProps.style && props.style !== newProps.style) {\n descriptors.style = valueDescriptor({\n ...unwrapStyle(props.style),\n ...unwrapStyle(newProps.style),\n });\n }\n return Object.defineProperties({}, descriptors) as Props;\n};\n\nconst valueDescriptor = (value: unknown): PropertyDescriptor => ({\n value,\n enumerable: true,\n configurable: true,\n writable: true,\n});\n\n/**\n * a getter is only defined for a read through its own object: solid's\n * compiled props getters (2.0.0-rc.10, `hoistProps`) reach their captured\n * values through `this`, so a descriptor moved to another object reads\n * nothing. re-homing keeps the laziness (nothing is read here) and reads\n * the source when the target is read; a data descriptor passes as it is\n */\nconst rehome = (\n source: object,\n key: PropertyKey,\n descriptor: PropertyDescriptor,\n): PropertyDescriptor =>\n descriptor.get || descriptor.set\n ? {\n get: () => (source as any)[key],\n set: descriptor.set && ((value: unknown) => ((source as any)[key] = value)),\n enumerable: descriptor.enumerable,\n configurable: true,\n }\n : descriptor;\n\nconst rehomedDescriptors = (source: object): PropertyDescriptorMap => {\n const descriptors = Object.getOwnPropertyDescriptors(source) as PropertyDescriptorMap;\n for (const key of Reflect.ownKeys(descriptors)) {\n descriptors[key as string] = rehome(source, key, descriptors[key as string]);\n }\n return descriptors;\n};\n\nconst hasGetter = (object: object): boolean => {\n for (const key of Object.getOwnPropertyNames(object)) {\n if (!(\"value\" in Object.getOwnPropertyDescriptor(object, key)!)) return true;\n }\n return false;\n};\n\n/** static: no theme, no memo; one class per component, a children-only fast path for a tag */\nconst createStaticComponent = (\n tag: string | undefined,\n renderTarget: TargetRenderer,\n processor: StaticStyleProcessor,\n skip: (key: PropertyKey) => boolean,\n attrString: string,\n): AnyComponent<Props> => {\n const collected = new Classes();\n // a static processor ignores its props argument, it only adds class names\n processor(undefined, collected);\n const staticClass = collected.value || undefined;\n const classOf = (props: Props): string | undefined => {\n const userClass = normalizeClass(props.class);\n if (!userClass) return staticClass;\n // the collector skips generated names the author's class already holds,\n // and an atom may remove one\n const classes = new Classes(userClass);\n processor(props, classes);\n return classes.value || undefined;\n };\n const renderChildrenOnly =\n tag && !VOID_ELEMENTS.test(tag)\n ? createChildrenOnlyRenderer(tag, staticClass, attrString)\n : undefined;\n const meta: RenderMeta = {\n skip,\n compute: undefined,\n classOf,\n attrsAddKeys: false,\n unescapedClass: collected.generated ? staticClass : undefined,\n };\n return (props) => {\n // no props or only children: no skip walk, no props copy, no spread.\n // a reactive spread can add props later and needs the full client binding;\n // on the server props are read once so the proxy check does not matter\n if (renderChildrenOnly && (isServer || !($PROXY in props))) {\n const keys = Object.keys(props);\n if (!keys.length || (keys.length === 1 && keys[0] === \"children\")) {\n return renderChildrenOnly(props, keys.length !== 0);\n }\n }\n return renderTarget(props, meta);\n };\n};\n\n/** tag and class cached per component; only the children need a binding or serialization */\nconst createChildrenOnlyRenderer = (\n tag: string,\n className: string | undefined,\n attrString: string,\n): ((props: Props, hasChildren: boolean) => JSX.Element) => {\n if (isServer) {\n const head = `<${tag}${attrString}`;\n const open = `${className ? ` class=\"${ssrClassName(className)}\"` : \"\"}>`;\n const closing = `</${tag}>`;\n const parts = [head, open, closing];\n // as in childContent: script and style content is not escaped\n const raw = tag === \"script\" || tag === \"style\";\n return (props, hasChildren): { t: string } => {\n // key first: the child getter may render\n const hk = ssrHydrationKey();\n const children = hasChildren ? (raw ? props.children : escape(props.children)) : undefined;\n // text joins in place; anything else goes through ssr() like a compiled\n // template's hole, which handles async children and text separators\n const text = plainContent(children);\n if (text !== undefined) return { t: `${head}${hk}${open}${text}${closing}` };\n return ssr(parts, hk, children);\n };\n }\n const create = createElementTemplate(tag, attrString, className);\n return (props, hasChildren) => {\n const el = getNextElement(create);\n if (hasChildren) {\n // static text arrives as a plain value, not a getter: one insert, no effect.\n // a getter is dynamic and keeps the binding\n const descriptor = Object.getOwnPropertyDescriptor(props, \"children\");\n if (descriptor && \"value\" in descriptor) insert(el, descriptor.value);\n else insert(el, () => props.children);\n }\n runHydrationEvents();\n return el;\n };\n};\n\n/** dynamic: the provider theme plus one memo per element for attrs, class and style */\nconst createDynamicComponent =\n (\n renderTarget: TargetRenderer,\n attrsFn: RuntimeAttrsFn | undefined,\n processor: StyleProcessor,\n skip: (key: PropertyKey) => boolean,\n baked: boolean,\n ): AnyComponent<Props> =>\n (props) => {\n const theme = useTheme();\n // style callbacks see an explicit theme prop before the provider theme\n const propsWithTheme = withTheme(props, theme);\n // one memo per element runs the attrs function and every interpolation\n // of the style block, e.g. styled.button`color: ${props => props.color}`.\n // only reads inside it re-run it; the element is never re-created.\n // attrs and styles share the memo on purpose:\n // a style-only prop change also reruns attrs, still cheaper than\n // two memos per element\n const compute = () => computeStyles(props, propsWithTheme, attrsFn, processor);\n // the server has no updates, so a run-once closure replaces the memo:\n // solid's server createMemo still builds an owner and a node per element.\n // on the client the memo is transparent: it claims no hydration key\n const computed = isServer ? once(compute) : createMemo(compute, { transparent: true });\n // theme reaches the target only when attrs set their own; the provider\n // accessor must not land on the dom element. identity, not `in`: an attrs\n // function that spreads its input hands the provider accessor back\n const allowTheme =\n attrsFn &&\n (() => {\n const attrs = computed().attrs;\n return !!attrs && \"theme\" in attrs && attrs.theme !== theme;\n });\n return renderTarget(props, {\n skip: allowTheme ? (key) => (key === \"theme\" ? !allowTheme() : skip(key)) : skip,\n compute: computed,\n classOf: undefined,\n // baked attrs sit in the template and cannot add keys, the copy path serves them\n attrsAddKeys: !!attrsFn && !baked,\n unescapedClass: undefined,\n });\n };\n\n/** resolve attrs, then run the styles against that props view */\nconst computeStyles = (\n props: Props,\n propsWithTheme: Props,\n attrsFn: RuntimeAttrsFn | undefined,\n processor: StyleProcessor,\n): ComputedStyles => {\n const attrs = attrsFn?.(propsWithTheme);\n const authorClass = normalizeClass(props.class);\n const classes = new Classes(authorClass);\n const attrsClass = normalizeClass(attrs?.class);\n if (attrsClass) classes.add(attrsClass);\n // a static processor writes no style values, so the author's style object\n // passes through without a copy\n const style =\n processor.$dynamic || attrs?.style\n ? { ...unwrapStyle(props.style), ...unwrapStyle(attrs?.style) }\n : unwrapStyle(props.style);\n processor(\n attrs ? withAttrs(propsWithTheme, attrs) : propsWithTheme,\n classes,\n style as StyleObject,\n );\n return {\n class: classes.value || undefined,\n generatedClass: !authorClass && !attrsClass && classes.generated,\n style: style && hasKeys(style) ? style : undefined,\n attrs,\n };\n};\n\n/**\n * backing object of a props view: the author's props, a provider theme to\n * fill in when props has none, and attrs whose values win over props.\n * one shared handler serves both views, so a view costs one proxy and one\n * small object per element and no trap closures\n */\ntype View = { props: Props; theme?: Accessor<YakTheme>; attrs?: Props };\n\nconst viewTraps: ProxyHandler<View> = {\n get: ({ props, theme, attrs }, key) => {\n if (key === \"theme\" && theme && !(\"theme\" in props)) return theme;\n if (attrs && key in attrs) return Reflect.get(attrs, key);\n return Reflect.get(props, key);\n },\n // no props check for theme here: when props has one, Reflect.has says so anyway\n has: ({ props, theme, attrs }, key) =>\n (key === \"theme\" && !!theme) || (!!attrs && key in attrs) || Reflect.has(props, key),\n ownKeys: ({ props, theme, attrs }) => {\n const keys = new Set(Reflect.ownKeys(props));\n if (attrs) for (const key of Reflect.ownKeys(attrs)) keys.add(key);\n if (theme) keys.add(\"theme\");\n return [...keys];\n },\n getOwnPropertyDescriptor: ({ props, theme, attrs }, key) => {\n if (key === \"theme\" && theme && !(\"theme\" in props)) {\n return { value: theme, enumerable: true, configurable: true };\n }\n const descriptor = Reflect.getOwnPropertyDescriptor(attrs && key in attrs ? attrs : props, key);\n // a prop the view adds must report configurable, the backing object has no such key\n return descriptor && { ...descriptor, configurable: true };\n },\n};\n\n/**\n * the provider theme when props has none. a props proxy (a reactive spread)\n * can gain or lose its theme key later, so it always gets the view; a plain\n * object with a theme is used as is\n */\nconst withTheme = (props: Props, theme: Accessor<YakTheme>): Props =>\n (!($PROXY in props) && \"theme\" in props\n ? props\n : new Proxy({ props, theme }, viewTraps)) as Props;\n\n/** style interpolations read attrs over author props, getters only on demand */\nconst withAttrs = (props: Props, attrs: Props): Props =>\n new Proxy({ props, attrs }, viewTraps) as Props;\n\n/** server stand-in for createMemo: run once, no owner and no node */\nconst once = <T extends object>(fn: () => T): (() => T) => {\n let value: T | undefined;\n return () => (value ??= fn());\n};\n\n/** string styles become objects before css variables are added */\nconst unwrapStyle = (style: StyleObject | string | undefined): StyleObject | undefined => {\n if (typeof style !== \"string\") {\n return style;\n }\n const result: Record<string, string> = {};\n for (const declaration of style.split(\";\")) {\n const colonIndex = declaration.indexOf(\":\");\n if (colonIndex === -1) continue;\n const property = declaration.slice(0, colonIndex).trim();\n const value = declaration.slice(colonIndex + 1).trim();\n if (property && value) {\n result[property] = value;\n }\n }\n return result as StyleObject;\n};\n\n/** no array for a yes/no answer */\nconst hasKeys = (object: object): boolean => {\n for (const _ in object) return true;\n return false;\n};\n\n/** the target's render path, chosen once per styled component */\nconst createTargetRenderer = (\n target: AnyComponent<any> | string,\n attrString: string,\n): TargetRenderer => {\n if (typeof target !== \"string\") {\n return (props, meta) => createComponent(target, targetProps(props, meta));\n }\n if (isServer) {\n const head = `<${target}${attrString}`;\n const closing = VOID_ELEMENTS.test(target) ? undefined : `</${target}>`;\n return (props, meta) => serializeElement(target, head, closing, props, meta);\n }\n return createElementRenderer(target, attrString);\n};\n\n/**\n * the server writer: writes the html string by hand instead of using ssrElement.\n * ssrElement needs a filtered props object with getters to keep the\n * read order, that costs more than writing directly\n */\nconst serializeElement = (\n tag: string,\n head: string,\n closing: string | undefined,\n props: Props,\n meta: RenderMeta,\n): { t: string } => {\n // key first: a prop getter may render a child and take keys\n const hk = ssrHydrationKey();\n // one memo read for class, style and attrs. branch on meta.compute, not\n // on computed, so the static writer makes no call here\n let computed: ComputedStyles | undefined;\n let className: string | undefined;\n if (meta.compute) {\n computed = meta.compute();\n className = computed.class;\n } else {\n className = meta.classOf(props);\n }\n const attrs = computed?.attrs;\n const style = computed?.style;\n const skip = meta.skip;\n let result = head + hk;\n let children: unknown;\n // a textarea's value is its content, like solid's ssrElement writes it\n const textarea = tag === \"textarea\";\n // author keys first, an attrs value wins; then the keys only attrs has.\n // two loops on purpose: one loop over both key sets is slower on the\n // attrs path, it needs a push and a second `in` per key.\n // only the first child prop is read, and none on a void tag: a child\n // getter may render and take hydration keys\n for (const key of Object.keys(props)) {\n if (skip(key)) continue;\n const source = attrs && key in attrs ? attrs : props;\n if (!isChildKey(key, textarea)) result += attribute(key, source[key]);\n else if (children === undefined && closing) children = childContent(tag, key, source[key]);\n }\n if (attrs) {\n for (const key of Object.keys(attrs)) {\n if (skip(key) || key in props) continue;\n if (!isChildKey(key, textarea)) result += attribute(key, attrs[key]);\n else if (children === undefined && closing) children = childContent(tag, key, attrs[key]);\n }\n }\n // generated class names need no escaping, an author or attrs class does\n if (className !== undefined) {\n const generated = computed ? computed.generatedClass : className === meta.unescapedClass;\n result += ` class=\"${generated ? className : ssrClassName(className)}\"`;\n }\n if (style !== undefined) result += ` style=\"${ssrStyle(style as Record<string, string>)}\"`;\n // a void tag has no children: the finished string is the node, no ssr() call.\n // the space keeps an unquoted hydration key from swallowing the slash\n if (!closing) return { t: result + \" />\" };\n // text and finished nodes join in place, as solid's own resolver does.\n // functions, arrays and nodes with pending holes go to ssr(): async wrap,\n // error boundary routing, and the separator marker between adjacent\n // text items so the client can claim two text nodes\n const text = plainContent(children);\n if (text !== undefined) return { t: result + \">\" + text + closing };\n return ssr([result + \">\", closing], children);\n};\n\n/** a prop that becomes the element's content: solid's child properties, and a textarea's value */\nconst isChildKey = (key: string, textarea: boolean) =>\n ChildProperties.has(key) || (textarea && (key === \"value\" || key === \"defaultValue\"));\n\n/**\n * the string a child resolves to without ssr(), else undefined. a server\n * node is { t: html, h?: pending async holes }; one with holes needs ssr()\n */\nconst plainContent = (node: unknown): string | undefined => {\n if (typeof node === \"string\") return node;\n if (typeof node === \"number\") return String(node);\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node !== \"object\" || Array.isArray(node)) return undefined;\n const server = node as { t?: unknown; h?: unknown[] };\n if (server.h && server.h.length > 0) return undefined;\n if (typeof server.t === \"string\") return server.t;\n return undefined;\n};\n\n/**\n * one server attribute with its leading space, the value rules of solid's\n * ssrElement; bakeAttributes applies the same rules once at definition\n */\nconst attribute = (prop: string, value: unknown): string => {\n if (prop === \"style\") return ` style=\"${ssrStyle(value as string)}\"`;\n // class never reaches here, skip drops it; the branch stays, the static\n // writer is slower without it (jit code placement)\n if (prop === \"class\") return ` class=\"${ssrClassName(value as string)}\"`;\n // refs, event handlers and prop: bindings only exist on the client\n if (value == undefined || prop === \"ref\" || prop.startsWith(\"on\") || prop.startsWith(\"prop:\")) {\n return \"\";\n }\n if (typeof value === \"boolean\") return value ? ` ${escape(prop)}` : \"\";\n return value === \"\" ? ` ${escape(prop)}` : ` ${escape(prop)}=\"${escape(value, true)}\"`;\n};\n\n/** raw markup stays as is, every other child value is escaped */\nconst childContent = (tag: string, prop: string, value: unknown): unknown =>\n tag === \"script\" || tag === \"style\" || prop === \"innerHTML\" ? value : escape(value);\n\n/** the cached template for a fixed tag; svg and mathml tags parse inside their namespace root */\nconst createElementTemplate = (tag: string, attrString: string, className?: string) => {\n // atoms can put author names into the static class, so the template escapes it\n const classAttribute = className ? ` class=\"${escapeAttribute(className)}\"` : \"\";\n const opening = `<${tag}${attrString}${classAttribute}>`;\n // flag 2 returns firstChild.firstChild\n // skips the <svg>/<math> wrapper we add so the child parses in its namespace\n if (SVGElements.has(tag) && tag !== \"svg\") return template(`<svg>${opening}`, 2);\n if (MathMLElements.has(tag) && tag !== \"math\") return template(`<math>${opening}`, 2);\n return template(opening);\n};\n\n/**\n * bind a fixed client tag without dynamic()'s per-element memo. hydration\n * claims the server node by key; a fresh mount clones the cached template.\n * solid's SVGElements set lacks a, script, style and title, so a fresh\n * mount makes them html elements even inside an <svg>, as solid's own\n * dynamic() does\n */\nconst createElementRenderer = (tag: string, attrString: string): TargetRenderer => {\n const create = createElementTemplate(tag, attrString);\n return (props, meta) => bindElement(getNextElement(create), props, meta);\n};\n\nconst bindElement = (el: Element, props: Props, meta: RenderMeta): Element => {\n // no untrack anywhere below: a component body runs untracked\n if (!meta.attrsAddKeys && !($PROXY in props)) {\n // a fixed key set read by one spread: copying the few descriptors is\n // cheaper than a view. measured on the client with omit() + the source\n // list instead: +12–15% hydrate and mount on dynamic-prop tags (an\n // omit view, spread()'s source walk and their garbage, per element)\n const bound = copyProps(props, meta);\n spread(el, bound, !(\"children\" in bound));\n } else {\n // attrs or a reactive spread can add keys — children too — so the target\n // reads views. the sources as an array, like a compiled <tag {...a} {...b}>:\n // spread() reads a function source inline, no memo and no hydration id.\n // that matters here: the server writer for a tag builds none of this, so\n // an owner created only on the client would shift every later element's id\n spread(el, targetSources(props, meta), false);\n }\n // replay events once the element's bindings are ready\n runHydrationEvents();\n return el;\n};\n\n/** the props a component target receives: the sources as one merge() view */\nconst targetProps = (props: Props, meta: RenderMeta): Props =>\n merge(...targetSources(props, meta)) as Props;\n\n/**\n * the client tag path when the keys cannot change: the computed class/style\n * getters, then the author's props copied in without reading them — a\n * getter like icon={<Icon />} renders a child and takes hydration keys, so it\n * is re-homed (see `rehome`) and read by the spread in its own order\n */\nconst copyProps = (props: Props, meta: RenderMeta): Props => {\n const out = clientExtras(props, meta);\n // string keys only, like solid's omit(): a symbol never reaches the target.\n // skip drops class (and style with a memo), the keys the extras own\n for (const key of Object.getOwnPropertyNames(props)) {\n if (meta.skip(key)) continue;\n const descriptor = Reflect.getOwnPropertyDescriptor(props, key)!;\n if (\"value\" in descriptor && descriptor.enumerable) out[key] = descriptor.value;\n else Object.defineProperty(out, key, rehome(props, key, descriptor));\n }\n return out;\n};\n\n/**\n * what the target sees, as the sources solid's own primitives take: omit()\n * with the skip predicate over the author's props ($-props, theme, and the\n * keys attrs bake), the attrs the memo produced as a function source when\n * they can add keys, and the computed class/style last. views, not a copy:\n * a getter like icon={<Icon />} renders a child and takes hydration keys,\n * so it is read by the target in its own order, once. on the server the\n * values are final and go in as data properties; on the client as getters\n * over the memo\n */\nconst targetSources = (props: Props, meta: RenderMeta): [Props, TargetAttrs, Props] => {\n const { skip, compute, classOf } = meta;\n const rest = omit(props, skip as (key: string | symbol) => boolean);\n let extras: Props;\n if (isServer) {\n extras = {};\n if (compute) {\n const computed = compute();\n extras.class = computed.class;\n if (computed.style !== undefined) extras.style = computed.style;\n } else extras.class = classOf(props);\n } else extras = clientExtras(props, meta);\n if (!meta.attrsAddKeys) return [rest, undefined, extras];\n // meta.attrsAddKeys, not the destructured copy: the read narrows meta.compute\n const attrsSource = () => {\n const attrs = meta.compute().attrs;\n return attrs ? omit(attrs, skip as (key: string | symbol) => boolean) : undefined;\n };\n return [rest, attrsSource, extras];\n};\n\n/** the attrs source, or none when attrs cannot add keys (baked, or no attrs) */\ntype TargetAttrs = (() => Props | undefined) | undefined;\n\n/**\n * client only: the computed class and style as getters over the memo. object\n * literals, two shapes: a getter defined on a literal takes V8's boilerplate\n * path\n */\nconst clientExtras = (props: Props, { compute, classOf }: RenderMeta): Props =>\n compute\n ? {\n get class() {\n // compute().class is accessed lazily and includes props.class in its results\n return compute().class;\n },\n get style() {\n return compute().style;\n },\n }\n : {\n get class() {\n return classOf(props);\n },\n };\n","import { 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","/**\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 = <T extends (string | number | bigint)[] = never>(\n styles: TemplateStringsArray,\n ..._dynamic: T\n): string => {\n // during compilation all args of keyframe are compiled\n // to a string which references the animation name\n return styles as any as string;\n};\n","import type { ComponentStyles } from \"./cssLiteral.js\";\nimport type { YakComponent } from \"./publicStyledApi.js\";\n\n/**\n * Values that may be interpolated into a `globalStyle` template.\n *\n * Only build-time values are allowed: constants, `keyframes` animation names,\n * static `css` mixins and styled-component selectors. Runtime functions\n * (`${(props) => ...}`) are intentionally excluded: a global rule has no element\n * to attach a CSS variable to. Declare a CSS custom property instead and toggle\n * it via an attribute/class on the root element.\n */\nexport type GlobalStyleInterpolation = string | number | ComponentStyles<{}> | YakComponent<any>;\n\n/**\n * Declares global, unscoped styles that ride the same zero-runtime extraction\n * pipeline as `styled` and `keyframes`.\n *\n * Global styles are **part of the stylesheet, not part of the render tree**.\n * They apply exactly when the module declaring them is included in the bundle,\n * typically by importing it from a layout or entry point. They cannot be\n * conditionally mounted; express conditions in CSS (`@media`, `@supports`,\n * `:root[data-theme]`, `:has()`) or through CSS custom properties.\n *\n * @usage\n *\n * ```tsx\n * import { globalStyle, keyframes } from \"@yak/solid\";\n *\n * const fadeIn = keyframes`\n * from { opacity: 0; }\n * `;\n *\n * globalStyle`\n * :root {\n * --spacing: 4px;\n * }\n *\n * body {\n * margin: 0;\n * }\n *\n * ::view-transition-new(root) {\n * animation: ${fadeIn} 200ms ease;\n * }\n * `;\n * ```\n */\nexport const globalStyle = (\n _styles: TemplateStringsArray,\n ..._values: Array<GlobalStyleInterpolation>\n): void => {\n return undefined;\n};\n","/**\n * Internal helper called by transformed code. Do not use directly.\n *\n * Takes a function and a css unit and returns the result of the function concatenated with the unit\n *\n * ```tsx\n * import { styled } from \"@yak/solid\";\n *\n * const Button = styled.button<{ $width?: boolean }>`\n * width: ${({ $width }) => $width}px;\n * `;\n * ```\n *\n * Which will be transformed to:\n * ```tsx\n * import { styled } from \"@yak/solid/internal\";\n *\n * const Button = styled.button<{ $width?: boolean }>(\n * \"button\", {\n * width: unitPostFix({ $width }) => $width, \"px\")\n * });\n */\nexport const unitPostFix = (arg: unknown, unit: string) => {\n switch (typeof arg) {\n case \"function\":\n return (props: any) => unitPostFix(arg(props), unit);\n case \"number\":\n case \"string\":\n return `${arg}${unit}`;\n // Ignore falsy values\n default:\n return undefined;\n }\n};\n","import { isServer } from \"@solidjs/web\";\nimport { Classes } from \"../cssLiteral.js\";\nimport { RuntimeStyleProcessor, StyleObject } from \"../publicStyledApi.js\";\nimport { normalizeClass } from \"./mergeClasses.js\";\n\ntype Source = Record<PropertyKey, unknown>;\n\n/** the last source that carries the key */\nconst lastWith = (sources: Source[], key: string): Source | undefined => {\n for (let index = sources.length - 1; index >= 0; index--) {\n if (key in sources[index]) return sources[index];\n }\n return undefined;\n};\n\n/**\n * Merges the relevant props of a native element with a css prop. The\n * compiler adds it for the `css` prop:\n * ```tsx\n * <button class=\"a\" {...props} style={s} css={css`color: green;`} />\n * ```\n * compiles to\n * ```tsx\n * <button {...__yak_mergeCssProp(css(\"yak1\"), { class: \"a\" }, props, { style: s })} />\n * ```\n */\nexport const mergeCssProp = (\n cssProp: RuntimeStyleProcessor<unknown> | false | null | undefined,\n ...sources: (Source | null | undefined)[]\n) => {\n const present = sources.filter((source): source is Source => source != null);\n const out: Source = {};\n for (const source of present) {\n for (const key of Reflect.ownKeys(source)) {\n // contributed below, from the last source that carries them\n if (key === \"class\" || key === \"style\") continue;\n const descriptor = Reflect.getOwnPropertyDescriptor(source, key)!;\n if (descriptor.get || descriptor.set || !descriptor.enumerable) {\n Object.defineProperty(out, key, descriptor);\n } else {\n out[key] = descriptor.value;\n }\n }\n }\n // `in` finds the owner without invoking its getter\n const classOwner = lastWith(present, \"class\");\n const styleOwner = lastWith(present, \"style\");\n\n const mergedClass = (): string | undefined => {\n const classes = new Classes(normalizeClass(classOwner?.class));\n // a falsy css prop applies no styles, e.g. `css={on && css`...`}` with `on` false\n if (cssProp) cssProp({}, classes, {} as StyleObject);\n return classes.value || undefined;\n };\n const mergedStyle = (): StyleObject | undefined => {\n const base = styleOwner?.style as StyleObject | undefined;\n const style: StyleObject = base ? { ...base } : {};\n if (cssProp) cssProp({}, new Classes(), style);\n for (const _ in style) return style;\n return undefined;\n };\n\n if (isServer) {\n // The server reads once, so the values are resolved here; a class or\n // style read takes no hydration id. A key left undefined would make\n // `ssrElement` write `class=\"\"`, so only carried values are set.\n const className = mergedClass();\n if (className !== undefined) out.class = className;\n const style = mergedStyle();\n if (style !== undefined) out.style = style;\n return out;\n }\n // on the client the spread reads these inside its effect, so a signal read\n // by a source or by the css prop updates the attribute in place\n if (cssProp || classOwner) {\n Object.defineProperty(out, \"class\", { get: mergedClass, enumerable: true, configurable: true });\n }\n if (cssProp || styleOwner) {\n Object.defineProperty(out, \"style\", { get: mergedStyle, enumerable: true, configurable: true });\n }\n return out;\n};\n","import { styled } from \"./styled.js\";\n/// Internal API to create styled components\n/// Optimization for faster rendering and smaller bundle size in production\n/// thanks to better minification and dead code elimination\n///\n/// List taken from https://github.com/styled-components/styled-components/blob/e0019ba666fab4b5aaa2bff71ba6ad0005a299fd/packages/styled-components/src/utils/domElements.ts#L90\nexport const __yak_a = /*#__PURE__*/ styled(\"a\");\nexport const __yak_abbr = /*#__PURE__*/ styled(\"abbr\");\nexport const __yak_address = /*#__PURE__*/ styled(\"address\");\nexport const __yak_area = /*#__PURE__*/ styled(\"area\");\nexport const __yak_article = /*#__PURE__*/ styled(\"article\");\nexport const __yak_aside = /*#__PURE__*/ styled(\"aside\");\nexport const __yak_audio = /*#__PURE__*/ styled(\"audio\");\nexport const __yak_b = /*#__PURE__*/ styled(\"b\");\nexport const __yak_base = /*#__PURE__*/ styled(\"base\");\nexport const __yak_bdi = /*#__PURE__*/ styled(\"bdi\");\nexport const __yak_bdo = /*#__PURE__*/ styled(\"bdo\");\nexport const __yak_big = /*#__PURE__*/ styled(\"big\");\nexport const __yak_blockquote = /*#__PURE__*/ styled(\"blockquote\");\nexport const __yak_body = /*#__PURE__*/ styled(\"body\");\nexport const __yak_br = /*#__PURE__*/ styled(\"br\");\nexport const __yak_button = /*#__PURE__*/ styled(\"button\");\nexport const __yak_canvas = /*#__PURE__*/ styled(\"canvas\");\nexport const __yak_caption = /*#__PURE__*/ styled(\"caption\");\nexport const __yak_cite = /*#__PURE__*/ styled(\"cite\");\nexport const __yak_code = /*#__PURE__*/ styled(\"code\");\nexport const __yak_col = /*#__PURE__*/ styled(\"col\");\nexport const __yak_colgroup = /*#__PURE__*/ styled(\"colgroup\");\nexport const __yak_data = /*#__PURE__*/ styled(\"data\");\nexport const __yak_datalist = /*#__PURE__*/ styled(\"datalist\");\nexport const __yak_dd = /*#__PURE__*/ styled(\"dd\");\nexport const __yak_del = /*#__PURE__*/ styled(\"del\");\nexport const __yak_details = /*#__PURE__*/ styled(\"details\");\nexport const __yak_dfn = /*#__PURE__*/ styled(\"dfn\");\nexport const __yak_dialog = /*#__PURE__*/ styled(\"dialog\");\nexport const __yak_div = /*#__PURE__*/ styled(\"div\");\nexport const __yak_dl = /*#__PURE__*/ styled(\"dl\");\nexport const __yak_dt = /*#__PURE__*/ styled(\"dt\");\nexport const __yak_em = /*#__PURE__*/ styled(\"em\");\nexport const __yak_embed = /*#__PURE__*/ styled(\"embed\");\nexport const __yak_fieldset = /*#__PURE__*/ styled(\"fieldset\");\nexport const __yak_figcaption = /*#__PURE__*/ styled(\"figcaption\");\nexport const __yak_figure = /*#__PURE__*/ styled(\"figure\");\nexport const __yak_footer = /*#__PURE__*/ styled(\"footer\");\nexport const __yak_form = /*#__PURE__*/ styled(\"form\");\nexport const __yak_h1 = /*#__PURE__*/ styled(\"h1\");\nexport const __yak_h2 = /*#__PURE__*/ styled(\"h2\");\nexport const __yak_h3 = /*#__PURE__*/ styled(\"h3\");\nexport const __yak_h4 = /*#__PURE__*/ styled(\"h4\");\nexport const __yak_h5 = /*#__PURE__*/ styled(\"h5\");\nexport const __yak_h6 = /*#__PURE__*/ styled(\"h6\");\nexport const __yak_header = /*#__PURE__*/ styled(\"header\");\nexport const __yak_hgroup = /*#__PURE__*/ styled(\"hgroup\");\nexport const __yak_hr = /*#__PURE__*/ styled(\"hr\");\nexport const __yak_html = /*#__PURE__*/ styled(\"html\");\nexport const __yak_i = /*#__PURE__*/ styled(\"i\");\nexport const __yak_iframe = /*#__PURE__*/ styled(\"iframe\");\nexport const __yak_img = /*#__PURE__*/ styled(\"img\");\nexport const __yak_input = /*#__PURE__*/ styled(\"input\");\nexport const __yak_ins = /*#__PURE__*/ styled(\"ins\");\nexport const __yak_kbd = /*#__PURE__*/ styled(\"kbd\");\nexport const __yak_keygen = /*#__PURE__*/ styled(\"keygen\");\nexport const __yak_label = /*#__PURE__*/ styled(\"label\");\nexport const __yak_legend = /*#__PURE__*/ styled(\"legend\");\nexport const __yak_li = /*#__PURE__*/ styled(\"li\");\nexport const __yak_link = /*#__PURE__*/ styled(\"link\");\nexport const __yak_main = /*#__PURE__*/ styled(\"main\");\nexport const __yak_map = /*#__PURE__*/ styled(\"map\");\nexport const __yak_mark = /*#__PURE__*/ styled(\"mark\");\nexport const __yak_menu = /*#__PURE__*/ styled(\"menu\");\nexport const __yak_menuitem = /*#__PURE__*/ styled(\"menuitem\");\nexport const __yak_meta = /*#__PURE__*/ styled(\"meta\");\nexport const __yak_meter = /*#__PURE__*/ styled(\"meter\");\nexport const __yak_nav = /*#__PURE__*/ styled(\"nav\");\nexport const __yak_noscript = /*#__PURE__*/ styled(\"noscript\");\nexport const __yak_object = /*#__PURE__*/ styled(\"object\");\nexport const __yak_ol = /*#__PURE__*/ styled(\"ol\");\nexport const __yak_optgroup = /*#__PURE__*/ styled(\"optgroup\");\nexport const __yak_option = /*#__PURE__*/ styled(\"option\");\nexport const __yak_output = /*#__PURE__*/ styled(\"output\");\nexport const __yak_p = /*#__PURE__*/ styled(\"p\");\nexport const __yak_param = /*#__PURE__*/ styled(\"param\");\nexport const __yak_picture = /*#__PURE__*/ styled(\"picture\");\nexport const __yak_pre = /*#__PURE__*/ styled(\"pre\");\nexport const __yak_progress = /*#__PURE__*/ styled(\"progress\");\nexport const __yak_q = /*#__PURE__*/ styled(\"q\");\nexport const __yak_rp = /*#__PURE__*/ styled(\"rp\");\nexport const __yak_rt = /*#__PURE__*/ styled(\"rt\");\nexport const __yak_ruby = /*#__PURE__*/ styled(\"ruby\");\nexport const __yak_s = /*#__PURE__*/ styled(\"s\");\nexport const __yak_samp = /*#__PURE__*/ styled(\"samp\");\nexport const __yak_script = /*#__PURE__*/ styled(\"script\");\nexport const __yak_section = /*#__PURE__*/ styled(\"section\");\nexport const __yak_select = /*#__PURE__*/ styled(\"select\");\nexport const __yak_small = /*#__PURE__*/ styled(\"small\");\nexport const __yak_source = /*#__PURE__*/ styled(\"source\");\nexport const __yak_span = /*#__PURE__*/ styled(\"span\");\nexport const __yak_strong = /*#__PURE__*/ styled(\"strong\");\nexport const __yak_style = /*#__PURE__*/ styled(\"style\");\nexport const __yak_sub = /*#__PURE__*/ styled(\"sub\");\nexport const __yak_summary = /*#__PURE__*/ styled(\"summary\");\nexport const __yak_sup = /*#__PURE__*/ styled(\"sup\");\nexport const __yak_table = /*#__PURE__*/ styled(\"table\");\nexport const __yak_tbody = /*#__PURE__*/ styled(\"tbody\");\nexport const __yak_td = /*#__PURE__*/ styled(\"td\");\nexport const __yak_textarea = /*#__PURE__*/ styled(\"textarea\");\nexport const __yak_tfoot = /*#__PURE__*/ styled(\"tfoot\");\nexport const __yak_th = /*#__PURE__*/ styled(\"th\");\nexport const __yak_thead = /*#__PURE__*/ styled(\"thead\");\nexport const __yak_time = /*#__PURE__*/ styled(\"time\");\nexport const __yak_tr = /*#__PURE__*/ styled(\"tr\");\nexport const __yak_track = /*#__PURE__*/ styled(\"track\");\nexport const __yak_u = /*#__PURE__*/ styled(\"u\");\nexport const __yak_ul = /*#__PURE__*/ styled(\"ul\");\nexport const __yak_use = /*#__PURE__*/ styled(\"use\");\nexport const __yak_var = /*#__PURE__*/ styled(\"var\");\nexport const __yak_video = /*#__PURE__*/ styled(\"video\");\nexport const __yak_wbr = /*#__PURE__*/ styled(\"wbr\");\nexport const __yak_circle = /*#__PURE__*/ styled(\"circle\");\nexport const __yak_clipPath = /*#__PURE__*/ styled(\"clipPath\");\nexport const __yak_defs = /*#__PURE__*/ styled(\"defs\");\nexport const __yak_ellipse = /*#__PURE__*/ styled(\"ellipse\");\nexport const __yak_foreignObject = /*#__PURE__*/ styled(\"foreignObject\");\nexport const __yak_g = /*#__PURE__*/ styled(\"g\");\nexport const __yak_image = /*#__PURE__*/ styled(\"image\");\nexport const __yak_line = /*#__PURE__*/ styled(\"line\");\nexport const __yak_linearGradient = /*#__PURE__*/ styled(\"linearGradient\");\nexport const __yak_marker = /*#__PURE__*/ styled(\"marker\");\nexport const __yak_mask = /*#__PURE__*/ styled(\"mask\");\nexport const __yak_path = /*#__PURE__*/ styled(\"path\");\nexport const __yak_pattern = /*#__PURE__*/ styled(\"pattern\");\nexport const __yak_polygon = /*#__PURE__*/ styled(\"polygon\");\nexport const __yak_polyline = /*#__PURE__*/ styled(\"polyline\");\nexport const __yak_radialGradient = /*#__PURE__*/ styled(\"radialGradient\");\nexport const __yak_rect = /*#__PURE__*/ styled(\"rect\");\nexport const __yak_stop = /*#__PURE__*/ styled(\"stop\");\nexport const __yak_svg = /*#__PURE__*/ styled(\"svg\");\nexport const __yak_text = /*#__PURE__*/ styled(\"text\");\nexport const __yak_tspan = /*#__PURE__*/ styled(\"tspan\");\n"],"mappings":";;;;;AAOA,MAAa,qBAAqB,OAAO,IAAI,sBAAsB;AAUnE,IAAa,UAAb,MAA+C;CAC7C;CAMA,YAAY;CACZ,YAAY,SAAkB;EAC5B,KAAK,QAAQ,WAAW;CAC1B;CACA,IAAI,MAAc,YAAY,MAAM;EAClC,IAAI,CAAC,WAAW,KAAK,YAAY;EACjC,IAAI,CAAC,KAAK,OACR,KAAK,QAAQ;OACR,IAAI,CAAC,KAAK,IAAI,IAAI,GACvB,KAAK,SAAS,MAAM;CAExB;CACA,IAAI,MAAc;EAChB,QAAQ,MAAM,KAAK,QAAQ,IAAG,CAAE,SAAS,MAAM,OAAO,GAAG;CAC3D;CACA,OAAO,MAAc;EACnB,IAAI,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D,MAAa,gBAA8B,qBAAO,SAAS;AAC3D,MAAa,gBAA8B,qBAAO,SAAS;AAC3D,MAAa,iBAA+B,qBAAO,UAAU;AAC7D,MAAa,uBAAqC,qBAAO,gBAAgB;AACzE,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,YAA0B,qBAAO,KAAK;AACnD,MAAa,aAA2B,qBAAO,MAAM;AACrD,MAAa,cAA4B,qBAAO,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yak/solid",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "SolidJS runtime for yak: styled-components syntax, compiled to plain CSS at build time. Targets Solid 2.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css-in-js",
|
|
@@ -74,15 +74,15 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@babel/parser": "^8.0.4",
|
|
76
76
|
"@swc/core": "~1.15.47",
|
|
77
|
-
"yak-swc": "9.10.
|
|
77
|
+
"yak-swc": "9.10.2"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@solidjs/vite-plugin": "3.0.0-next.
|
|
81
|
-
"@solidjs/web": "^2.0.0-rc.
|
|
80
|
+
"@solidjs/vite-plugin": "3.0.0-next.46",
|
|
81
|
+
"@solidjs/web": "^2.0.0-rc.10",
|
|
82
82
|
"@testing-library/jest-dom": "7.0.1",
|
|
83
83
|
"@types/node": "26.4.1",
|
|
84
84
|
"jsdom": "30.0.1",
|
|
85
|
-
"solid-js": "^2.0.0-rc.
|
|
85
|
+
"solid-js": "^2.0.0-rc.10",
|
|
86
86
|
"tsdown": "0.22.14",
|
|
87
87
|
"typescript": "6.0.3",
|
|
88
88
|
"vite": "8.2.2",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"yak-internals": "0.0.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"@solidjs/web": "^2.0.0-rc.
|
|
94
|
-
"solid-js": "^2.0.0-rc.
|
|
93
|
+
"@solidjs/web": "^2.0.0-rc.10",
|
|
94
|
+
"solid-js": "^2.0.0-rc.10",
|
|
95
95
|
"vite": ">=7.0.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependenciesMeta": {
|
|
@@ -155,3 +155,39 @@ it("should support subtree overrides through YakThemeContext", () => {
|
|
|
155
155
|
flush();
|
|
156
156
|
expect(box.style.getPropertyValue("--color")).toBe("blue");
|
|
157
157
|
});
|
|
158
|
+
|
|
159
|
+
// solid 2.0.0-rc.10 compiles a props literal with getters into a hoisted
|
|
160
|
+
// constructor whose getters read their captured values through `this`
|
|
161
|
+
// (`hoistProps`): a descriptor copied onto another object reads nothing.
|
|
162
|
+
// This is the compiler's output shape, built by hand because the test JSX
|
|
163
|
+
// is compiled by the plugin version pinned here.
|
|
164
|
+
const hoistedProps = <T,>(label: () => T, className: string) => {
|
|
165
|
+
const slot = Symbol();
|
|
166
|
+
const labelDescriptor = {
|
|
167
|
+
get(this: any) {
|
|
168
|
+
return this[slot]();
|
|
169
|
+
},
|
|
170
|
+
enumerable: true,
|
|
171
|
+
configurable: true,
|
|
172
|
+
};
|
|
173
|
+
const props: any = {};
|
|
174
|
+
props[slot] = label;
|
|
175
|
+
Object.defineProperty(props, "aria-label", labelDescriptor);
|
|
176
|
+
props.class = className;
|
|
177
|
+
return props;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
it("reads a receiver-dependent getter through its props when a styled(Component) copies props", () => {
|
|
181
|
+
const Inner = (props: any) => <input aria-label={props["aria-label"]} class={props.class} />;
|
|
182
|
+
const Component = styled(Inner)("cssClass");
|
|
183
|
+
const [label, setLabel] = createSignal("first");
|
|
184
|
+
const container = renderInto(() => Component(hoistedProps(label, "own")));
|
|
185
|
+
|
|
186
|
+
const element = container.querySelector("input")!;
|
|
187
|
+
expect(element.getAttribute("aria-label")).toBe("first");
|
|
188
|
+
expect(element.className).toBe("own cssClass");
|
|
189
|
+
|
|
190
|
+
setLabel("second");
|
|
191
|
+
flush();
|
|
192
|
+
expect(element.getAttribute("aria-label")).toBe("second");
|
|
193
|
+
});
|