@tenphi/tasty 3.13.0 → 3.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{babel-types-docs8f4c.d.ts → babel-types-Cq4OMhXa.d.ts} +2 -2
- package/dist/chunks/{build-config-DmSCYjYl.js → build-config-mdijGIGa.js} +5 -5
- package/dist/chunks/{build-config-DmSCYjYl.js.map → build-config-mdijGIGa.js.map} +1 -1
- package/dist/chunks/{collector-8w5r-xFl.js → collector-B4cuf4Ne.js} +4 -4
- package/dist/chunks/{collector-8w5r-xFl.js.map → collector-B4cuf4Ne.js.map} +1 -1
- package/dist/chunks/{config-engine-DjRv6Axa.js → config-engine-BlZE_Nop.js} +4 -4
- package/dist/chunks/{config-engine-DjRv6Axa.js.map → config-engine-BlZE_Nop.js.map} +1 -1
- package/dist/chunks/{css-definitions-_UidGa56.js → css-definitions-38rLam_O.js} +3 -3
- package/dist/chunks/{css-definitions-_UidGa56.js.map → css-definitions-38rLam_O.js.map} +1 -1
- package/dist/chunks/{debug-B6dZq3uH.js → debug-B4d71eRy.js} +4 -4
- package/dist/chunks/{debug-B6dZq3uH.js.map → debug-B4d71eRy.js.map} +1 -1
- package/dist/chunks/{dsl-rgu6XQcD.js → dsl-dFfTOacf.js} +2 -2
- package/dist/chunks/{dsl-rgu6XQcD.js.map → dsl-dFfTOacf.js.map} +1 -1
- package/dist/chunks/{react-runtime-DS1cEAMK.js → react-runtime-CZeqWqBJ.js} +8 -6
- package/dist/chunks/react-runtime-CZeqWqBJ.js.map +1 -0
- package/dist/chunks/{runtime-engine-DFCZN1nF.js → runtime-engine-DZYyyrhB.js} +9 -6
- package/dist/chunks/{runtime-engine-DFCZN1nF.js.map → runtime-engine-DZYyyrhB.js.map} +1 -1
- package/dist/chunks/{runtime-state-C8MzPjBR.js → runtime-state-B8fkpfgp.js} +2 -2
- package/dist/chunks/{runtime-state-C8MzPjBR.js.map → runtime-state-B8fkpfgp.js.map} +1 -1
- package/dist/chunks/{style-engine-DoGrZPBB.js → style-engine-BB3Ruaa4.js} +25 -7
- package/dist/chunks/style-engine-BB3Ruaa4.js.map +1 -0
- package/dist/chunks/{zero-engine-CiVidroC.js → zero-engine-BLELcyfS.js} +5 -5
- package/dist/chunks/{zero-engine-CiVidroC.js.map → zero-engine-BLELcyfS.js.map} +1 -1
- package/dist/{collector-CTU-nl0g.d.ts → collector-sOn_LJks.d.ts} +2 -2
- package/dist/{config-DDY7NlZ1.d.ts → config-bnwIG-_F.d.ts} +2 -2
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +7 -7
- package/dist/{index-enN6b6o_.d.ts → index-B-ufiyqs.d.ts} +9 -7
- package/dist/index.d.ts +4 -4
- package/dist/index.js +8 -8
- package/dist/{merge-styles-DSkVc6CD.d.ts → merge-styles-CLE6OMiV.d.ts} +2 -2
- package/dist/ssr/astro.js +2 -2
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +2 -2
- package/dist/ssr/next-config.d.ts +1 -1
- package/dist/ssr/next-config.js +3 -3
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +3 -3
- package/dist/static/index.d.ts +2 -2
- package/dist/{types-DJEM_BOJ.d.ts → types-DsK6JM1J.d.ts} +3 -2
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.d.ts +3 -3
- package/dist/zero/index.js +3 -3
- package/dist/zero/next.d.ts +1 -1
- package/docs/ai-agents.md +1 -1
- package/docs/react-api.md +2 -2
- package/docs/styles.md +37 -3
- package/package.json +3 -3
- package/dist/chunks/react-runtime-DS1cEAMK.js.map +0 -1
- package/dist/chunks/style-engine-DoGrZPBB.js.map +0 -1
package/dist/zero/next.d.ts
CHANGED
package/docs/ai-agents.md
CHANGED
|
@@ -134,7 +134,7 @@ Directional modifiers beat placeholder zeros:
|
|
|
134
134
|
- ❌ `padding: '2x 4x top right'` — a directional group takes one value, so `4x` is dropped → ✅ `padding: '2x top, 4x right'`
|
|
135
135
|
- ❌ `fade: '3x 1x top bottom'` → ✅ `fade: '3x top, 1x bottom'`
|
|
136
136
|
|
|
137
|
-
Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, and `tabSize`. Logical axis category styles accept one or two values in start/end order and the `start`, `end`, and `longhand` modifiers. `fill`, `color`, `caretColor`, and `accentColor` take a color only (use `#clear` for transparent).
|
|
137
|
+
Value-only properties reject both colors and modifiers: `gap`, `columnGap`, `rowGap`, `opacity`, `zIndex`, `order`, `flexGrow`, `flexShrink`, `flexBasis`, `aspectRatio`, `lineClamp`, and `tabSize`. Logical axis category styles accept one or two values in start/end order and the `start`, `end`, and `longhand` modifiers. `fill`, `color`, `caretColor`, and `accentColor` take a color only (use `#clear` for transparent). `fill` also mixes two colors with a comma, the weight as a percentage: ❌ `fill: '#surface #dark.04'` (deprecated overlay layer) · ❌ `fill: '#dark.04, #surface'` (half-transparent mix) → ✅ `fill: '#dark 4%, #surface'`.
|
|
138
138
|
|
|
139
139
|
### `transition`
|
|
140
140
|
|
package/docs/react-api.md
CHANGED
|
@@ -356,7 +356,7 @@ const Badge = tasty({
|
|
|
356
356
|
variants: {
|
|
357
357
|
primary: {
|
|
358
358
|
border: { '': '#white.2', pressed: '#primary-text', disabled: '#clear' },
|
|
359
|
-
fill: { '': '#
|
|
359
|
+
fill: { '': '#primary', hovered: '#primary-text' },
|
|
360
360
|
},
|
|
361
361
|
secondary: {
|
|
362
362
|
border: { '': '#primary.15', pressed: '#primary.3' },
|
|
@@ -406,7 +406,7 @@ elements: {
|
|
|
406
406
|
}
|
|
407
407
|
```
|
|
408
408
|
|
|
409
|
-
The sub-components produced by `elements` support `mods`, `tokens`, `isDisabled`, `isHidden`, and `isChecked` props — the same modifier interface as the root component.
|
|
409
|
+
The sub-components produced by `elements` support `mods`, `tokens`, `theme`, `isDisabled`, `isHidden`, and `isChecked` props — the same modifier interface as the root component. As on the root, `theme` renders as `data-theme`, and an explicit `data-theme` wins over it.
|
|
410
410
|
|
|
411
411
|
If you don't need sub-components (e.g., the inner elements are already rendered by a third-party library), you can still style them by key alone — just omit `elements` and apply `data-element` manually:
|
|
412
412
|
|
package/docs/styles.md
CHANGED
|
@@ -303,17 +303,51 @@ Avoid setting physical and logical declarations that resolve to the same edge in
|
|
|
303
303
|
|
|
304
304
|
Background color with design token support. Preferred over `backgroundColor` and `background`.
|
|
305
305
|
|
|
306
|
-
**Syntax:** `[color]
|
|
306
|
+
**Syntax:** `[color]`, or two colors mixed with a comma: `[color] [weight%], [color]`
|
|
307
307
|
|
|
308
308
|
| Value | Effect |
|
|
309
309
|
|-------|--------|
|
|
310
310
|
| `"#purple"` | Token-based background color |
|
|
311
311
|
| `"#purple.10"` | Token color at 10% opacity |
|
|
312
|
-
| `"#
|
|
312
|
+
| `"#dark 4%, #surface"` | `#dark` mixed into `#surface` at 4% — the color `#dark` at 4% opacity over `#surface` would show |
|
|
313
313
|
| `"rgb(255 128 0)"` | CSS color value |
|
|
314
314
|
| `"color-mix(in oklab, #primary 50%, #surface)"` | CSS color function — see [CSS Color Functions](dsl.md#css-color-functions) |
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
#### Mixing two colors
|
|
317
|
+
|
|
318
|
+
A comma between two colors mixes them into one:
|
|
319
|
+
|
|
320
|
+
```jsx
|
|
321
|
+
fill: '#dark 4%, #surface'
|
|
322
|
+
// → background-color: color-mix(in srgb, var(--dark-color) 4%, var(--surface-color));
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
The comma-separated parts are the arguments of `color-mix()`, as written, mixed in sRGB: the space browsers composite layers in. When the weighted color is opaque, the mix is exactly what drawing it at that opacity over the other color shows. And because it is one `background-color`:
|
|
326
|
+
|
|
327
|
+
- contrast checkers such as axe-core and Lighthouse can read it;
|
|
328
|
+
- it transitions and animates between states like any other color;
|
|
329
|
+
- an `image` on the same element stays the only `background-image` layer.
|
|
330
|
+
|
|
331
|
+
The weight can come from a token or an expression: `'#dark $hover-weight, #surface'`, `'#dark ($hover * 100%), #surface'`.
|
|
332
|
+
|
|
333
|
+
Give the weight as a percentage, not as an opacity. A color without a percentage takes half the weight, and its own alpha weighs it down again, so the mix comes out see-through: `'#dark.04, #surface'` is 52% opaque, not `#dark` at 4% over `#surface`. In development Tasty warns about a `#name.N` or `#clear` part without a percentage. It can't see into a token, though, so a token holding a translucent color mixes the same way with no warning: keep the token opaque and put its weight in the percentage.
|
|
334
|
+
|
|
335
|
+
A mix takes two colors. Any more are ignored, with a development warning.
|
|
336
|
+
|
|
337
|
+
#### Two colors separated by a space (deprecated)
|
|
338
|
+
|
|
339
|
+
`fill: '#surface #dark.04'` paints the first color as `background-color` and the second as a `linear-gradient()` layer over it, through the `--tasty-second-fill-color` custom property. It still works, with a development warning, and is going away in the next major version: contrast checkers can't see through a `background-image`, so axe-core reports every text node over the layer as *incomplete*.
|
|
340
|
+
|
|
341
|
+
| Before | After |
|
|
342
|
+
|--------|-------|
|
|
343
|
+
| `'#surface #dark.04'` | `'#dark 4%, #surface'` |
|
|
344
|
+
| `'#surface #clear'` | `'#surface'` |
|
|
345
|
+
| `'#surface #accent'` (an opaque overlay) | `'#accent'` |
|
|
346
|
+
| `'#base #overlay'` (a token holding a translucent color) | `'#overlay $overlay-weight, #base'`, with `#overlay` opaque and `$overlay-weight` a percentage |
|
|
347
|
+
|
|
348
|
+
The rewrites are exact when the overlay token is opaque. A state map no longer needs the same two-color shape in every state to transition smoothly: every state is now a plain background color.
|
|
349
|
+
|
|
350
|
+
If an overlay has to stay a translucent token, draw the layer yourself with `fill: '#base', image: 'linear-gradient(#overlay, #overlay)'`. Contrast checkers can't read that either.
|
|
317
351
|
|
|
318
352
|
There is no default fill color, so `fill: true` is ignored with a development warning. Use `false` for no fill.
|
|
319
353
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tenphi/tasty",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
4
|
"description": "A design-system-integrated styling system and DSL for concise, state-aware UI styling",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
"name": "core (import *)",
|
|
234
234
|
"path": "dist/core/index.js",
|
|
235
235
|
"import": "*",
|
|
236
|
-
"limit": "
|
|
236
|
+
"limit": "57.38 kB"
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
239
|
"name": "static",
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
"node:module",
|
|
288
288
|
"node:path"
|
|
289
289
|
],
|
|
290
|
-
"limit": "
|
|
290
|
+
"limit": "41.48 kB"
|
|
291
291
|
}
|
|
292
292
|
],
|
|
293
293
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-runtime-DS1cEAMK.js","names":["getClientState"],"sources":["../../src/utils/get-display-name.ts","../../src/utils/is-valid-element-type.ts","../../src/tasty.tsx","../../src/ssr/context.ts","../../src/hooks/useStyles.ts","../../src/hooks/useGlobalStyles.ts","../../src/hooks/useRawCSS.ts","../../src/hooks/useKeyframes.ts","../../src/hooks/useProperty.ts","../../src/hooks/useFontFace.ts","../../src/hooks/useCounterStyle.ts","../../src/hooks/useFunction.ts","../../src/batch-provider.tsx"],"sourcesContent":["import type { ElementType } from 'react';\n\nconst DEFAULT_NAME = 'Anonymous';\n\ninterface NamedType {\n displayName?: string;\n name?: string;\n /** The component inside `forwardRef()`. */\n render?: unknown;\n /** The component inside `memo()`. */\n type?: unknown;\n}\n\nfunction nameOf(type: unknown): string | undefined {\n if (typeof type === 'string') return type;\n if (!type || (typeof type !== 'function' && typeof type !== 'object')) {\n return undefined;\n }\n\n const { displayName, name, render, type: inner } = type as NamedType;\n if (displayName) return displayName;\n if (typeof type === 'function') return name || undefined;\n\n // `forwardRef()` and `memo()` return objects; name them after what they wrap.\n return nameOf(render) ?? nameOf(inner);\n}\n\n/**\n * A readable name for a component: its `displayName`, else its function name,\n * looking through `forwardRef()` and `memo()` to the component they wrap. A\n * tag name names itself. Falls back to `fallbackName` when there is none.\n */\nexport function getDisplayName<T>(\n Component: ElementType<T>,\n fallbackName = DEFAULT_NAME,\n): string {\n return nameOf(Component) ?? fallbackName;\n}\n","/**\n * Lightweight replacement for `react-is`'s isValidElementType.\n * Detects string tags, function/class components, and React exotic types\n * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.\n */\nexport function isValidElementType(value: unknown): boolean {\n if (typeof value === 'string' || typeof value === 'function') {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n return typeof (value as { $$typeof?: unknown }).$$typeof === 'symbol';\n }\n\n return false;\n}\n","import type {\n AllHTMLAttributes,\n ComponentType,\n ElementType,\n ForwardRefExoticComponent,\n JSX,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { createElement, forwardRef, Fragment } from 'react';\nimport type { ComputeStylesOptions } from './compute-styles';\nimport { computeStyles } from './compute-styles';\nimport type { PropHandlerProps } from './prop-handlers';\nimport { propHandlerRegistry } from './prop-handlers';\nimport { baseStylePropsRegistry } from './styles/base-props';\nimport { BASE_STYLES } from './styles/list';\nimport type { Styles, StylesInterface } from './styles/types';\nimport type {\n AllBaseProps,\n BaseProps,\n BaseStyleProps,\n ExtraBaseStyleProps,\n ModValue,\n Mods,\n TastyCustomProps,\n TokenValue,\n Tokens,\n} from './types';\nimport { getDisplayName } from './utils/get-display-name';\nimport { hasKeys } from './utils/has-keys';\nimport { isValidElementType } from './utils/is-valid-element-type';\nimport { isSelector } from './utils/is-selector';\nimport { mergeStyles } from './utils/merge-styles';\nimport { modAttrs } from './utils/mod-attrs';\nimport { processTokens } from './utils/process-tokens';\nimport { getConfig, getGlobalInjector } from './config';\nimport { touch } from './injector';\nimport type { StyleInjector } from './injector/injector';\nimport { checkRequestScope } from './rsc-cache';\n\nimport type { StyleValue, StyleValueStateMap } from './utils/styles';\n\n/** Transform one is* prop to its HTML and matching data attributes. */\nfunction handleIsProperty(\n props: Record<string, unknown>,\n isProperty: string,\n targetAttribute: string,\n dataAttribute: string,\n) {\n if (isProperty in props) {\n props[targetAttribute] = props[isProperty];\n delete props[isProperty];\n }\n\n if (!(dataAttribute in props) && props[targetAttribute]) {\n props[dataAttribute] = '';\n }\n}\n\nfunction handleIsProperties(props: Record<string, unknown>) {\n handleIsProperty(props, 'isDisabled', 'disabled', 'data-disabled');\n handleIsProperty(props, 'isHidden', 'hidden', 'data-hidden');\n handleIsProperty(props, 'isChecked', 'checked', 'data-checked');\n}\n\n/**\n * Creates a sub-element component for compound component patterns.\n * Sub-elements are lightweight components with data-element attribute for CSS targeting.\n */\nfunction createSubElement<Tag extends keyof JSX.IntrinsicElements>(\n elementName: string,\n definition: SubElementDefinition<Tag>,\n): ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<Tag>> & RefAttributes<unknown>\n> {\n // Normalize definition to object form\n const config =\n typeof definition === 'string'\n ? { as: definition as Tag }\n : (definition as { as?: Tag; qa?: string; qaVal?: string | number });\n\n const tag = config.as ?? ('div' as Tag);\n const defaultQa = config.qa;\n const defaultQaVal = config.qaVal;\n\n const SubElement = forwardRef<unknown, SubElementProps<Tag>>((props, ref) => {\n const {\n qa,\n qaVal,\n mods,\n tokens,\n isDisabled,\n isHidden,\n isChecked,\n className,\n style,\n ...htmlProps\n } = props as SubElementProps<Tag> & {\n className?: string;\n style?: Record<string, unknown>;\n };\n\n // Build mod attributes\n let modDataAttrs: Record<string, unknown> | undefined;\n if (mods) {\n modDataAttrs = modAttrs(mods as Mods) as Record<string, unknown>;\n }\n\n // Process tokens into inline style properties\n const tokenStyle = tokens\n ? (processTokens(tokens) as Record<string, unknown>)\n : undefined;\n\n // Merge token styles with explicit style prop (style has priority)\n let mergedStyle: Record<string, unknown> | undefined;\n if (tokenStyle || style) {\n mergedStyle =\n tokenStyle && style\n ? { ...tokenStyle, ...style }\n : ((tokenStyle ?? style) as Record<string, unknown>);\n }\n\n const elementProps = {\n 'data-element': elementName,\n 'data-qa': qa ?? defaultQa,\n 'data-qaval': qaVal ?? defaultQaVal,\n ...(modDataAttrs || {}),\n ...htmlProps,\n className,\n style: mergedStyle,\n isDisabled: isDisabled ?? (htmlProps as Record<string, unknown>).disabled,\n isHidden: isHidden ?? (htmlProps as Record<string, unknown>).hidden,\n isChecked: isChecked ?? (htmlProps as Record<string, unknown>).checked,\n ref,\n } as Record<string, unknown>;\n\n // Handle is* properties (isDisabled -> disabled + data-disabled, etc.)\n handleIsProperties(elementProps);\n\n // Clean up undefined data attributes\n if (elementProps['data-qa'] === undefined) delete elementProps['data-qa'];\n if (elementProps['data-qaval'] === undefined)\n delete elementProps['data-qaval'];\n\n return createElement(tag, elementProps);\n });\n\n SubElement.displayName = `SubElement(${elementName})`;\n\n return SubElement as ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<Tag>> & RefAttributes<unknown>\n >;\n}\n\ntype AnySubElement = ReturnType<typeof createSubElement>;\n\n/** Create the sub-element components an `elements` definition declares. */\nfunction createSubElements(\n elements: ElementsDefinition,\n): Record<string, AnySubElement> {\n const subElements: Record<string, AnySubElement> = {};\n for (const [name, definition] of Object.entries(elements)) {\n subElements[name] = createSubElement(\n name,\n definition as SubElementDefinition<keyof JSX.IntrinsicElements>,\n );\n }\n return subElements;\n}\n\n/** Statics React itself reads; never copied from a base onto its extension. */\nconst REACT_STATICS = new Set([\n '$$typeof',\n 'render',\n 'type',\n 'compare',\n 'displayName',\n 'defaultProps',\n 'propTypes',\n 'contextType',\n 'contextTypes',\n 'childContextTypes',\n 'getDerivedStateFromProps',\n 'getDerivedStateFromError',\n]);\n\n/**\n * Copy the component statics of `source` onto `target`, so an extension keeps\n * its base's sub-elements (`tasty(Card, …).Title`).\n */\nfunction hoistComponentStatics(target: object, source: object): void {\n for (const key of Object.keys(source)) {\n if (REACT_STATICS.has(key) || key in target) continue;\n\n const value = (source as Record<string, unknown>)[key];\n if (typeof value !== 'string' && isValidElementType(value)) {\n (target as Record<string, unknown>)[key] = value;\n }\n }\n}\n\n/**\n * Merge each variant over the base styles, once, at factory time.\n *\n * Extend-mode state maps in the base styles (no `''` key, not a selector) are\n * pulled out and applied AFTER the variant merge, so they survive replace-mode\n * maps in variants. Without a `default` variant, `default` is the base styles.\n */\nfunction buildVariantStylesMap(\n defaultStyles: Styles | undefined,\n variants: VariantMap,\n): Record<string, Styles | undefined> {\n let baseStyles = defaultStyles;\n let extensionStyles: Styles | undefined;\n\n if (defaultStyles) {\n for (const key of Object.keys(defaultStyles)) {\n if (isSelector(key)) continue;\n\n const value = (defaultStyles as Record<string, unknown>)[key];\n\n if (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n !('' in value)\n ) {\n if (!extensionStyles) {\n baseStyles = { ...defaultStyles } as Styles;\n extensionStyles = {} as Styles;\n }\n (extensionStyles as Record<string, unknown>)[key] = value;\n delete (baseStyles as Record<string, unknown>)[key];\n }\n }\n }\n\n const variantStylesMap: Record<string, Styles | undefined> = {};\n for (const [variant, variantStyles] of Object.entries(variants)) {\n variantStylesMap[variant] = extensionStyles\n ? mergeStyles(baseStyles, variantStyles, extensionStyles)\n : mergeStyles(baseStyles, variantStyles);\n }\n // Ensure 'default' variant always exists\n if (!variantStylesMap['default']) {\n variantStylesMap['default'] = defaultStyles;\n }\n\n return variantStylesMap;\n}\n\ninterface MergedStylesEntry {\n /** The styles the passed-in object was merged over. */\n base: Styles | undefined;\n styles: Styles;\n /** What `computeStyles()` returned for `styles` (client only). */\n className?: string;\n}\n\n/**\n * Merges keyed by the passed-in styles object, held weakly so a per-render\n * object is not kept alive.\n */\ntype MergedStylesCache = WeakMap<object, MergedStylesEntry>;\n\n/**\n * `mergeStyles(base, extra)`, reusing the previous result while `extra` and\n * `base` are the same objects — a wrapper's defaults, a module-level constant\n * or a memoized object. The merged object then stays the same too, which lets\n * the class names computed for it be cached. Styles are treated as immutable,\n * as React treats props.\n */\nfunction getMergedStyles(\n cache: MergedStylesCache,\n base: Styles | undefined,\n extra: Styles,\n): MergedStylesEntry {\n let entry = cache.get(extra);\n if (!entry || entry.base !== base) {\n entry = { base, styles: mergeStyles(base, extra) };\n cache.set(extra, entry);\n }\n return entry;\n}\n\n/** Move the listed props out of `props`, into a new object. */\nfunction takeProps(\n props: Record<string, unknown>,\n keys: readonly string[],\n): Record<string, unknown> | undefined {\n let taken: Record<string, unknown> | undefined;\n for (const key of keys) {\n if (key in props) {\n if (!taken) taken = {};\n taken[key] = props[key];\n delete props[key];\n }\n }\n return taken;\n}\n\n/** Move the `tokenProps` props out of `props`, keyed by their tokens. */\nfunction takeTokenProps(\n props: Record<string, unknown>,\n mapping: readonly [propName: string, tokenKey: string][],\n): Tokens | undefined {\n let tokens: Record<string, TokenValue> | undefined;\n for (const [propName, tokenKey] of mapping) {\n if (propName in props) {\n if (!tokens) tokens = {};\n tokens[tokenKey] = props[propName] as TokenValue;\n delete props[propName];\n }\n }\n return tokens as Tokens | undefined;\n}\n\n/** The keys a `modProps` definition declares. */\nfunction getModPropsKeys(def: ModPropsInput): string[] {\n return (Array.isArray(def) ? def : Object.keys(def)) as string[];\n}\n\ntype StyleList = readonly (keyof {\n [key in keyof StylesInterface]: StylesInterface[key];\n})[];\n\n// ============================================================================\n// Mod props types — expose modifier keys as top-level component props\n// ============================================================================\n\n/** Type descriptor for a single mod prop: a JS constructor or an enum array. */\nexport type ModPropDef =\n | BooleanConstructor\n | StringConstructor\n | NumberConstructor\n | readonly string[];\n\n/** Array form: list of mod key names (types default to ModValue). */\ntype ModPropsList = readonly string[];\n\n/** Object form: map of mod key names to type descriptors. */\ntype ModPropsMap = Readonly<Record<string, ModPropDef>>;\n\n/** Either array or object form accepted by `modProps` option. */\nexport type ModPropsInput = ModPropsList | ModPropsMap;\n\n/** Resolve a single ModPropDef to its TypeScript type. */\nexport type ResolveModPropDef<T> = T extends BooleanConstructor\n ? boolean\n : T extends StringConstructor\n ? string\n : T extends NumberConstructor\n ? number\n : T extends readonly (infer U)[]\n ? U\n : ModValue;\n\n/** Resolve an entire `modProps` definition to the component prop types it adds. */\nexport type ResolveModProps<M extends ModPropsInput> =\n M extends readonly (infer K)[]\n ? Partial<Record<K & string, ModValue>>\n : M extends Record<string, ModPropDef>\n ? { [key in keyof M & string]?: ResolveModPropDef<M[key]> }\n : // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n {};\n\n// ============================================================================\n// Token props types — expose token keys as top-level component props\n// ============================================================================\n\n/** A token key with `$` or `#` prefix. */\ntype TokenPropKey = `$${string}` | `#${string}`;\n\n/** Array form: list of prop names. Names ending in `Color` map to `#` color tokens. */\ntype TokenPropsList = readonly string[];\n\n/** Object form: prop name -> token key with explicit `$`/`#` prefix. */\ntype TokenPropsMap = Readonly<Record<string, TokenPropKey>>;\n\n/** Either array or object form accepted by `tokenProps` option. */\nexport type TokenPropsInput = TokenPropsList | TokenPropsMap;\n\n/** Resolve a `tokenProps` definition to the component prop types it adds. */\nexport type ResolveTokenProps<TP extends TokenPropsInput> =\n TP extends readonly (infer K)[]\n ? Partial<Record<K & string, TokenValue>>\n : TP extends Record<string, TokenPropKey>\n ? Partial<Record<keyof TP & string, TokenValue>>\n : // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n {};\n\n/**\n * Pre-compute the mapping from prop name to token key at component-creation time.\n * Array form: `'progress'` -> `'$progress'`, `'accentColor'` -> `'#accent'`.\n * Object form: entries used as-is.\n */\nfunction buildTokenPropsMapping(\n def: TokenPropsInput,\n): [propName: string, tokenKey: string][] {\n if (Array.isArray(def)) {\n return (def as string[]).map((propName) => {\n if (propName.endsWith('Color') && propName.length > 5) {\n return [propName, `#${propName.slice(0, -5)}`];\n }\n return [propName, `$${propName}`];\n });\n }\n return Object.entries(def);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyProps = Record<string, any>;\n\ntype PropsWithStyles = {\n styles?: Styles;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Omit<Record<string, any>, 'styles'>;\n\nexport type VariantMap = Record<string, Styles>;\n\nexport interface WithVariant<V extends VariantMap> {\n variant?: keyof V;\n}\n\n// ============================================================================\n// Sub-element types for compound components\n// ============================================================================\n\n/**\n * Definition for a sub-element. Can be either:\n * - A tag name string (e.g., 'div', 'span')\n * - An object with configuration options\n */\nexport type SubElementDefinition<\n Tag extends keyof JSX.IntrinsicElements = 'div',\n> =\n | Tag\n | {\n as?: Tag;\n qa?: string;\n qaVal?: string | number;\n };\n\n/**\n * Map of sub-element definitions.\n * Keys become the sub-component names (e.g., { Icon: 'span' } -> Component.Icon)\n */\nexport type ElementsDefinition = Record<\n string,\n SubElementDefinition<keyof JSX.IntrinsicElements>\n>;\n\n/**\n * Resolves the tag from a SubElementDefinition\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ResolveElementTag<T extends SubElementDefinition<any>> = T extends string\n ? T\n : T extends { as?: infer Tag }\n ? Tag extends keyof JSX.IntrinsicElements\n ? Tag\n : 'div'\n : 'div';\n\n/**\n * Props for sub-element components.\n * Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, isDisabled, etc.)\n */\nexport type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> =\n Omit<\n JSX.IntrinsicElements[Tag],\n 'ref' | 'color' | 'content' | 'translate'\n > & {\n qa?: string;\n qaVal?: string | number;\n mods?: Mods;\n tokens?: Tokens;\n isDisabled?: boolean;\n isHidden?: boolean;\n isChecked?: boolean;\n };\n\n/**\n * Generates the sub-element component types from an ElementsDefinition\n */\ntype SubElementComponents<E extends ElementsDefinition> = {\n [K in keyof E]: ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> &\n RefAttributes<\n ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[ResolveElementTag<E[K]>]\n : Element\n >\n >;\n};\n\n/**\n * Base type containing common properties shared between TastyProps and TastyElementOptions.\n * Separated to avoid code duplication while allowing different type constraints.\n */\ntype TastyBaseProps<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = {\n /** Default styles of the element. */\n styles?: Styles;\n /** The list of styles that can be provided by props */\n styleProps?: K;\n /** Modifier keys exposed as top-level component props (array or typed object form). */\n modProps?: M;\n /** Token keys exposed as top-level component props (array or typed object form). */\n tokenProps?: TP;\n element?: BaseProps['element'];\n variants?: V;\n /** Default tokens for inline CSS custom properties */\n tokens?: Tokens;\n /** Sub-element definitions for compound components */\n elements?: E;\n} & Pick<BaseProps, 'qa' | 'qaVal'>;\n\n/**\n * The names the `variant` option of `tasty(Base, options)` accepts: the\n * extension's own variants and the base's, as its `variant` prop does. A\n * union, not an intersection of the two, so an extension can default to a\n * variant only one of them defines.\n */\ntype ExtensionVariantName<V extends VariantMap, Props> = string extends keyof V\n ? 'variant' extends keyof Props\n ? NonNullable<Props['variant' & keyof Props]>\n : keyof V\n : | keyof V\n | ('variant' extends keyof Props\n ? NonNullable<Props['variant' & keyof Props]>\n : never);\n\nexport type TastyProps<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n DefaultProps = AnyProps,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = TastyBaseProps<K, V, E, M, TP> & {\n /** The tag name of the element or a React component. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n as?: string | ComponentType<any>;\n /**\n * The variant applied when the `variant` prop is omitted or names no\n * variant: one of `variants`, or one of the base component's.\n */\n variant?: ExtensionVariantName<V, DefaultProps>;\n} & Partial<\n Omit<\n DefaultProps,\n | 'as'\n | 'styles'\n | 'styleProps'\n | 'modProps'\n | 'tokenProps'\n | 'tokens'\n | 'variant'\n >\n >;\n\n/**\n * Resolves the props of a polymorphic `as` value (intrinsic tag or component).\n * - For intrinsic tags (`'div'`, `'button'`, ...): returns `JSX.IntrinsicElements[Tag]`.\n * - For React component types: returns the component's own props.\n * - Falls back to an empty record for anything else.\n */\nexport type ResolveAsProps<AsType extends ElementType> =\n AsType extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[AsType]\n : AsType extends ComponentType<infer P>\n ? P\n : Record<string, never>;\n\n/**\n * TastyElementOptions is used for the element-creation overload of tasty().\n * It includes an `AsType` generic that allows TypeScript to infer the correct\n * element type from the `as` prop — both for intrinsic tags and for React\n * components (so the wrapped component's prop API is preserved).\n *\n * Note: Uses a separate index signature with `unknown` instead of an `any`\n * record to ensure strict type checking for styles.\n */\nexport type TastyElementOptions<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n AsType extends ElementType = 'div',\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = TastyBaseProps<K, V, E, M, TP> &\n WithVariant<V> & {\n /** The tag name of the element or a React component. */\n as?: AsType;\n } & Record<string, unknown>;\n\nexport type AllBasePropsWithMods<\n K extends StyleList,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = AllBaseProps & {\n [key in K[number]]?:\n StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>;\n} & BaseStyleProps &\n ExtraBaseStyleProps &\n Partial<TastyCustomProps> &\n ResolveModProps<M> &\n ResolveTokenProps<TP>;\n\n/**\n * Props consumed by Tasty rather than forwarded to the `as` component.\n * Event handlers are resolved from JSX.IntrinsicElements or the component's own props.\n */\ntype TastySpecificKeys =\n | keyof BaseStyleProps\n | 'as'\n | 'qa'\n | 'qaVal'\n | 'element'\n | 'styles'\n | 'mods'\n | 'isHidden'\n | 'isDisabled'\n | 'isChecked'\n | 'style'\n | 'theme'\n | 'tokens'\n | 'ref';\n\n/** Extract prop key names from a ModPropsInput (array elements or object keys). */\ntype ModPropsKeys<M extends ModPropsInput> = M extends readonly (infer K)[]\n ? K & string\n : keyof M & string;\n\n/** Extract prop key names from a TokenPropsInput (array elements or object keys). */\ntype TokenPropsKeys<TP extends TokenPropsInput> =\n TP extends readonly (infer K)[] ? K & string : keyof TP & string;\n\n/**\n * Props type for tasty elements that combines:\n * - AllBasePropsWithMods for style props with strict tokens type\n * - HTML attributes for flexibility (properly typed based on `as`)\n * - Variant support\n *\n * AllBasePropsWithMods carries generic AllHTMLAttributes which can conflict\n * with element-specific types (e.g. `src` is `string` in AllHTMLAttributes but\n * `string | Blob` in ImgHTMLAttributes, or the custom props on a third-party\n * component like Next.js `Link`). To avoid intersection-narrowing, we Omit\n * element-specific keys from AllBasePropsWithMods (keeping TastySpecificKeys,\n * style props, mod props, and token props) and let the resolved `as` props\n * supply the authoritative attribute types. The `AllHTMLAttributes<HTMLElement>`\n * baseline is preserved so generic HTML attributes still work even when `as`\n * is a component type with a narrower prop API.\n */\nexport type TastyElementProps<\n K extends StyleList,\n V extends VariantMap,\n AsType extends ElementType = 'div',\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = Omit<\n AllBasePropsWithMods<K, M, TP>,\n Exclude<\n keyof ResolveAsProps<AsType>,\n | TastySpecificKeys\n | keyof TastyCustomProps\n | keyof ExtraBaseStyleProps\n | K[number]\n | ModPropsKeys<M>\n | TokenPropsKeys<TP>\n >\n> &\n WithVariant<V> &\n Omit<\n Omit<AllHTMLAttributes<HTMLElement>, keyof ResolveAsProps<AsType>> &\n ResolveAsProps<AsType>,\n | TastySpecificKeys\n | keyof TastyCustomProps\n | keyof ExtraBaseStyleProps\n | K[number]\n | ModPropsKeys<M>\n | TokenPropsKeys<TP>\n >;\n\n/** Statics React itself reads, as a type (see `REACT_STATICS`). */\ntype ReactStaticKey =\n | '$$typeof'\n | 'render'\n | 'type'\n | 'compare'\n | 'displayName'\n | 'defaultProps'\n | 'propTypes'\n | 'contextType'\n | 'contextTypes'\n | 'childContextTypes'\n | 'getDerivedStateFromProps'\n | 'getDerivedStateFromError';\n\n/**\n * The statics of a component that are components themselves — a `tasty()`\n * base's sub-elements (`Card.Title`) — which its extension keeps.\n */\nexport type ComponentStatics<C> = {\n [\n Key in keyof C as Key extends ReactStaticKey\n ? never\n : C[Key] extends string\n ? never\n : C[Key] extends ElementType\n ? Key\n : never\n ]: C[Key];\n};\n\n/** Prop names the extension form's own options claim from the base's props. */\ntype ExtensionClaimedKeys<\n K extends StyleList,\n V extends VariantMap,\n M extends ModPropsInput,\n TP extends TokenPropsInput,\n> =\n | K[number]\n | ModPropsKeys<M>\n | TokenPropsKeys<TP>\n | (string extends keyof V ? never : 'variant');\n\n/**\n * Props of a `tasty(Component, options)` extension: the base's props, plus\n * whatever its own `styleProps`, `modProps`, `tokenProps` and `variants` add.\n * Its variants extend the base's: `variant` accepts either set.\n */\nexport type TastyExtensionProps<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props>,\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = [ExtensionClaimedKeys<K, V, M, TP>] extends [never]\n ? TastyComponentPropsWithDefaults<Props, DefaultProps>\n : Omit<\n TastyComponentPropsWithDefaults<Props, DefaultProps>,\n ExtensionClaimedKeys<K, V, M, TP>\n > & {\n [key in K[number]]?:\n | StyleValue<StylesInterface[key]>\n | StyleValueStateMap<StylesInterface[key]>;\n } & ResolveModProps<M> &\n ResolveTokenProps<TP> &\n (string extends keyof V\n ? unknown\n : {\n variant?:\n | keyof V\n | ('variant' extends keyof Props\n ? NonNullable<Props['variant']>\n : never);\n });\n\nexport type TastyComponentPropsWithDefaults<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props>,\n> = keyof DefaultProps extends never\n ? Props\n : // Defaults for every prop (the extension form's own default) make them all\n // optional. `Partial` keeps the base's props named in declarations, where\n // the mapped type below expands each one and needs every type it uses.\n keyof Props extends keyof DefaultProps\n ? Partial<Props>\n : {\n [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key];\n } & {\n [key in keyof Omit<Props, keyof DefaultProps>]: Props[key];\n };\n\n/**\n * The component type returned by the `tasty(options)` element-factory overload.\n *\n * It's a regular React forward-ref component whose props are typed from the\n * factory-time `as` value. Polymorphism is at factory time: each call to\n * `tasty({ as: X })` produces a component whose prop API includes `X`'s own\n * props (so `tasty({ as: NextLink })` exposes `href`, `replace`, `prefetch`,\n * etc.) alongside the Tasty-specific props (`mods`, `tokens`, `styleProps`,\n * `modProps`, `tokenProps`).\n *\n * Note: a render-time `<X as={SomeComponent} />` does not re-infer props from\n * `SomeComponent`; create another `tasty({ as: SomeComponent })` for that.\n */\nexport type TastyPolymorphicComponent<\n DefaultAs extends ElementType,\n K extends StyleList,\n V extends VariantMap,\n M extends ModPropsInput,\n TP extends TokenPropsInput,\n> = ForwardRefExoticComponent<\n PropsWithoutRef<TastyElementProps<K, V, DefaultAs, M, TP>> &\n RefAttributes<unknown>\n>;\n\n// An omitted styleProps list must not infer the entire StyleList constraint:\n// that would claim every CSS name, including the `as` component's own props.\nexport function tasty<\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n AsType extends ElementType = 'div',\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n options: TastyElementOptions<K, V, E, AsType, M, TP>,\n secondArg?: never,\n): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElementComponents<E>;\nexport function tasty<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props> = Partial<Props>,\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n // `const`: the base's props in the options type would widen tag names.\n const E extends ElementsDefinition = Record<string, never>,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n C extends ComponentType<Props> = ComponentType<Props>,\n>(\n Component: C & ComponentType<Props>,\n options?: TastyProps<K, V, E, Props, M, TP>,\n): ComponentType<TastyExtensionProps<Props, DefaultProps, K, V, M, TP>> &\n ComponentStatics<C> &\n (string extends keyof E ? unknown : SubElementComponents<E>);\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n// Implementation\nexport function tasty<\n K extends StyleList,\n V extends VariantMap,\n _C = Record<string, unknown>,\n>(Component: any, options?: any) {\n if (isValidElementType(Component)) {\n return tastyWrap(Component as ComponentType<any>, options);\n }\n\n return tastyElement(Component as TastyProps<K, V>);\n}\n\nfunction tastyWrap<\n P extends PropsWithStyles,\n DefaultProps extends Partial<P> = Partial<P>,\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n Component: ComponentType<P>,\n options?: TastyProps<K, V, E, P, M, TP>,\n): ComponentType<TastyComponentPropsWithDefaults<P, DefaultProps>> {\n // The wrap path forwards props to `Component`; it does not re-run the base\n // factory. Its own `styleProps`, `modProps`, `tokenProps` and `variants`\n // resolve here into the `styles`, `mods` and `tokens` it forwards, and the\n // `variant` it forwards still selects the base's own variants. Other options\n // are default props, with `styles` and `*Styles` merged under instance ones.\n const {\n as: extendTag,\n element: extendElement,\n styleProps,\n modProps: modPropsDef,\n tokenProps: tokenPropsDef,\n variants,\n variant: defaultVariant,\n elements,\n ...defaultProps\n } = (options ?? {}) as TastyProps<K, V, E, P, M, TP>;\n\n const defaultStyles = (defaultProps as { styles?: Styles }).styles;\n const variantStylesMap = variants\n ? buildVariantStylesMap(defaultStyles, variants)\n : undefined;\n const fallbackVariant = (defaultVariant as string | undefined) ?? 'default';\n const stylePropNames = styleProps as readonly string[] | undefined;\n const modPropsKeys = modPropsDef ? getModPropsKeys(modPropsDef) : undefined;\n const tokenPropsMapping = tokenPropsDef\n ? buildTokenPropsMapping(tokenPropsDef)\n : undefined;\n\n const propsWithStyles = ['styles'];\n for (const prop of Object.keys(defaultProps)) {\n if (prop.endsWith('Styles')) propsWithStyles.push(prop);\n }\n\n const mergedCache: MergedStylesCache = new WeakMap();\n\n const _WrappedComponent = forwardRef<any, any>((props, ref) => {\n const { as, element, ...restProps } = props as Record<string, unknown>;\n\n const propStyles = stylePropNames\n ? takeProps(restProps, stylePropNames)\n : undefined;\n const propMods = modPropsKeys\n ? takeProps(restProps, modPropsKeys)\n : undefined;\n const propTokens = tokenPropsMapping\n ? takeTokenProps(restProps, tokenPropsMapping)\n : undefined;\n\n const variant = (restProps.variant as string | undefined) ?? defaultVariant;\n const baseStyles = variantStylesMap\n ? (variantStylesMap[(variant as string) || fallbackVariant] ??\n variantStylesMap[fallbackVariant] ??\n variantStylesMap['default'])\n : defaultStyles;\n\n // Unchanged instance styles keep the merged object stable across renders,\n // so the base can answer from its class name cache.\n const mergedStylesMap: Record<string, unknown> = {};\n for (const prop of propsWithStyles) {\n const restValue = restProps[prop] as Styles | undefined;\n const defaultValue =\n prop === 'styles'\n ? baseStyles\n : ((defaultProps as Record<string, unknown>)[prop] as\n Styles | undefined);\n\n mergedStylesMap[prop] =\n restValue != null && defaultValue != null\n ? getMergedStyles(mergedCache, defaultValue, restValue).styles\n : (restValue ?? defaultValue);\n }\n\n if (propStyles) {\n mergedStylesMap.styles = mergeStyles(\n mergedStylesMap.styles as Styles | undefined,\n propStyles as Styles,\n );\n }\n\n const elementProps = {\n ...(defaultProps as unknown as Record<string, unknown>),\n ...restProps,\n ...mergedStylesMap,\n as: (as as string | undefined) ?? extendTag,\n element: (element as string | undefined) || extendElement,\n ref,\n } as Record<string, unknown>;\n\n if (variant !== undefined) elementProps.variant = variant;\n if (propMods) {\n elementProps.mods = { ...(elementProps.mods as Mods), ...propMods };\n }\n if (propTokens) {\n elementProps.tokens = {\n ...(elementProps.tokens as Tokens),\n ...propTokens,\n };\n }\n\n return createElement(\n Component as ComponentType<P>,\n elementProps as unknown as P,\n );\n });\n\n _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(\n Component,\n (defaultProps as any).qa ?? (extendTag as any) ?? 'Anonymous',\n )})`;\n\n // Keep the base's sub-elements, then add (or replace with) this one's own.\n hoistComponentStatics(_WrappedComponent, Component);\n if (elements) {\n Object.assign(_WrappedComponent, createSubElements(elements));\n }\n\n return _WrappedComponent as unknown as ComponentType<\n TastyComponentPropsWithDefaults<P, DefaultProps>\n >;\n}\n\nfunction tastyElement<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition,\n>(tastyOptions: TastyProps<K, V, E>) {\n const {\n as: originalAs = 'div',\n element: defaultElement,\n styles: defaultStyles,\n styleProps,\n modProps: modPropsDef,\n tokenProps: tokenPropsDef,\n variants,\n variant: defaultVariant,\n tokens: defaultTokens,\n elements,\n ...defaultProps\n } = tastyOptions;\n\n // Pre-compute merged styles for each variant (if variants are defined)\n // This avoids creating separate component instances per variant\n const variantStylesMap = variants\n ? buildVariantStylesMap(defaultStyles, variants)\n : undefined;\n // The variant applied when the prop is omitted or names no variant: the\n // `variant` option, else `default`.\n const fallbackVariant = (defaultVariant as string | undefined) ?? 'default';\n const fallbackStyles = variantStylesMap\n ? (variantStylesMap[fallbackVariant] ?? variantStylesMap['default'])\n : defaultStyles;\n\n const {\n qa: defaultQa,\n qaVal: defaultQaVal,\n ...otherDefaultProps\n } = defaultProps;\n\n // Fixed at factory-creation time — no dependency on global config.\n const ownPropsToCheck: readonly string[] = styleProps\n ? (styleProps as StyleList).concat(BASE_STYLES)\n : BASE_STYLES;\n\n // Resolved lazily and refreshed on registry version change. `configure()` can\n // run *after* this factory was created (module eval order — see `Element` at\n // the bottom of this file), and `resetConfig()` reopens configuration, so a\n // one-shot lazy init would go stale. Starts at -1 to force first resolution.\n let propsToCheck: readonly string[] = ownPropsToCheck;\n let propsToCheckVersion = -1;\n\n const modPropsKeys: string[] | undefined = modPropsDef\n ? getModPropsKeys(modPropsDef as ModPropsInput)\n : undefined;\n\n const tokenPropsMapping: [string, string][] | undefined = tokenPropsDef\n ? buildTokenPropsMapping(tokenPropsDef as TokenPropsInput)\n : undefined;\n\n // Factory-level caches from styles to the class names computeStyles() gave\n // them, so a re-render skips the pipeline (client only):\n // - classNameCache: the factory's own styles, per variant.\n // - mergedCache: instance styles that stay the same object between renders —\n // an extension's defaults, a module-level constant, a memoized object —\n // merged over the variant's styles.\n // Both are dropped when the injector deletes rules (`gc()`, `cleanup()`,\n // `destroy()`) or is replaced, since a cached name may have lost its CSS.\n let classNameCache = new Map<Styles | undefined, string>();\n let mergedCache: MergedStylesCache = new WeakMap();\n let cacheInjector: StyleInjector | undefined;\n let cacheEvictions = 0;\n\n // Passed when the styles object handed to computeStyles() is the factory's\n // own AND computeStyles() will see it again — which is only true where\n // classNameCache is unavailable, i.e. the server. On the client that cache\n // answers every render after the first, so memoizing chunk keys during that\n // first render would write entries nothing ever reads back. Hoisted so the\n // hot path does not allocate it.\n const STABLE_STYLES: ComputeStylesOptions = { stableStyles: true };\n\n const _TastyComponent = forwardRef<\n unknown,\n AllBasePropsWithMods<K> & WithVariant<V>\n >((incomingProps, ref) => {\n // Global props middleware (`configure({ propHandlers })`). Runs before any\n // destructuring so a handler can rewrite every tasty prop — `styles`, `mods`,\n // `tokens`, `variant`, `as`, `element`, `qa` — and strip its own custom props\n // so they never reach the DOM. `ref` is out of reach: forwardRef separates it.\n // Fast path while nothing is registered: one property load and one branch.\n const applyPropHandlers = propHandlerRegistry.apply;\n const allProps = applyPropHandlers\n ? (applyPropHandlers(\n incomingProps as unknown as PropHandlerProps,\n ) as unknown as typeof incomingProps)\n : incomingProps;\n\n const {\n as,\n styles: rawStyles,\n variant,\n mods,\n element,\n qa,\n qaVal,\n className: userClassName,\n tokens,\n style,\n theme,\n ...otherProps\n } = allProps as Record<string, unknown> as AllBasePropsWithMods<K> &\n WithVariant<V> & {\n className?: string;\n tokens?: Tokens;\n style?: Record<string, unknown>;\n theme?: string;\n };\n\n const styles = rawStyles;\n\n let propStyles: Styles | null = null;\n\n if (propsToCheckVersion !== baseStylePropsRegistry.version) {\n const promoted = baseStylePropsRegistry.list;\n\n propsToCheck =\n promoted.length === 0\n ? ownPropsToCheck\n : ownPropsToCheck.concat(promoted);\n propsToCheckVersion = baseStylePropsRegistry.version;\n }\n\n for (const prop of propsToCheck) {\n const key = prop as unknown as string;\n\n if (key in otherProps) {\n if (!propStyles) propStyles = {};\n const value = (otherProps as any)[key];\n (propStyles as any)[key] = value;\n delete (otherProps as any)[key];\n }\n }\n\n const propMods = modPropsKeys\n ? (takeProps(otherProps as Record<string, unknown>, modPropsKeys) as\n Record<string, ModValue> | undefined)\n : undefined;\n\n const propTokens = tokenPropsMapping\n ? takeTokenProps(otherProps as Record<string, unknown>, tokenPropsMapping)\n : undefined;\n\n const baseStyles = variantStylesMap\n ? (variant && variantStylesMap[variant as string]) || fallbackStyles\n : defaultStyles;\n\n const hasInstanceStyles =\n !!styles && hasKeys(styles as Record<string, unknown>);\n\n // Use factory-level caches for stable style references (client only).\n // On the server they must be skipped: both the SSR collector and the RSC\n // inline-style paths are per-request, so every request must call\n // computeStyles() to ensure CSS is actually collected/emitted.\n const useFactoryCache = typeof document !== 'undefined';\n\n if (useFactoryCache) {\n const injector = getGlobalInjector();\n if (injector !== cacheInjector || injector.evictions !== cacheEvictions) {\n classNameCache = new Map();\n mergedCache = new WeakMap();\n cacheInjector = injector;\n cacheEvictions = injector.evictions;\n }\n }\n\n let allStyles: Styles | undefined;\n let generatedClassName: string | undefined;\n let mergedEntry: MergedStylesEntry | undefined;\n\n if (propStyles) {\n // Style props are fresh values every render; nothing to reuse.\n allStyles = mergeStyles(baseStyles, styles as Styles, propStyles);\n } else if (hasInstanceStyles) {\n if (useFactoryCache) {\n mergedEntry = getMergedStyles(\n mergedCache,\n baseStyles,\n styles as Styles,\n );\n allStyles = mergedEntry.styles;\n generatedClassName = mergedEntry.className;\n } else {\n allStyles = mergeStyles(baseStyles, styles as Styles);\n }\n } else {\n allStyles = baseStyles;\n if (useFactoryCache) generatedClassName = classNameCache.get(baseStyles);\n }\n\n let rscCSS: string | undefined;\n\n if (generatedClassName !== undefined) {\n touch(generatedClassName);\n } else {\n const result = computeStyles(\n allStyles,\n !useFactoryCache && allStyles === baseStyles\n ? STABLE_STYLES\n : undefined,\n );\n generatedClassName = result.className;\n rscCSS = result.css;\n if (mergedEntry) {\n mergedEntry.className = generatedClassName;\n } else if (useFactoryCache && allStyles === baseStyles) {\n classNameCache.set(allStyles, generatedClassName);\n }\n }\n\n // Merge tokens: default -> instance -> tokenProps\n let mergedTokens: Tokens | undefined;\n if (defaultTokens || tokens || propTokens) {\n if (!defaultTokens && !propTokens) {\n mergedTokens = tokens as Tokens;\n } else if (!tokens && !propTokens) {\n mergedTokens = defaultTokens;\n } else {\n mergedTokens = {\n ...defaultTokens,\n ...(tokens as Tokens),\n ...propTokens,\n } as Tokens;\n }\n }\n\n const processedTokenStyle = processTokens(mergedTokens);\n\n let mergedStyle: Record<string, unknown> | undefined;\n if (processedTokenStyle || style) {\n if (!processedTokenStyle) {\n mergedStyle = style;\n } else if (!style) {\n mergedStyle = processedTokenStyle as Record<string, unknown>;\n } else {\n mergedStyle = {\n ...(processedTokenStyle as Record<string, unknown>),\n ...style,\n };\n }\n }\n\n const mergedMods = propMods\n ? { ...(mods as Record<string, ModValue>), ...propMods }\n : (mods as Record<string, ModValue> | undefined);\n\n let modDataAttrs: Record<string, unknown> | undefined;\n if (mergedMods) {\n modDataAttrs = modAttrs(mergedMods as unknown as Mods) as Record<\n string,\n unknown\n >;\n }\n\n let finalClassName = generatedClassName;\n if (userClassName) {\n finalClassName = finalClassName\n ? `${userClassName} ${finalClassName}`\n : userClassName;\n }\n\n const elementProps = {\n 'data-element': (element as string | undefined) || defaultElement,\n 'data-qa': (qa as string | undefined) || defaultQa,\n 'data-qaval': (qaVal as string | undefined) || defaultQaVal,\n 'data-theme': theme,\n ...(otherDefaultProps as unknown as Record<string, unknown>),\n ...(modDataAttrs || {}),\n ...(otherProps as unknown as Record<string, unknown>),\n className: finalClassName,\n style: mergedStyle,\n ref,\n } as Record<string, unknown>;\n\n handleIsProperties(elementProps);\n\n if (elementProps['data-theme'] === undefined) {\n delete elementProps['data-theme'];\n }\n\n const el = createElement(\n (as as string | 'div') ?? originalAs,\n elementProps,\n );\n\n // RSC mode: wrap element with inline <style> tag.\n // Class names are extracted from these tags on the client via\n // the doubled-specificity pattern (.tXXX.tXXX), so no <script> is needed.\n if (rscCSS) {\n checkRequestScope();\n const nonce = getConfig().nonce;\n\n return createElement(\n Fragment,\n null,\n createElement('style', {\n 'data-tasty-rsc': '',\n nonce,\n dangerouslySetInnerHTML: { __html: rscCSS },\n }),\n el,\n );\n }\n\n return el;\n });\n\n _TastyComponent.displayName = `TastyComponent(${\n (defaultProps as any).qa || originalAs\n })`;\n\n // Attach sub-element components if elements are defined\n if (elements) {\n return Object.assign(_TastyComponent, createSubElements(elements));\n }\n\n return _TastyComponent;\n}\n\nexport const Element = /* @__PURE__ */ tasty({});\n","/**\n * React context for SSR collector discovery.\n *\n * Used by Next.js TastyRegistry to provide the ServerStyleCollector\n * to useStyles() via React context (the streaming-compatible path).\n *\n * This avoids relying on globalThis for cross-layer communication,\n * which leaks between RSC and SSR module graphs in Next.js App Router.\n *\n * The context is created lazily to avoid calling createContext() at\n * module evaluation time, which would break Server Components that\n * import from `@tenphi/tasty` without using any React hooks. React's\n * `react-server` build has no `createContext` export at all, so it is read\n * off the default export: a named import would fail to link there.\n */\n\nimport React from 'react';\nimport type { Context } from 'react';\n\nimport type { ServerStyleCollector } from './collector';\n\nlet _ctx: Context<ServerStyleCollector | null> | undefined;\n\nexport function getTastySSRContext(): Context<ServerStyleCollector | null> {\n if (!_ctx) {\n _ctx = React.createContext<ServerStyleCollector | null>(null);\n }\n return _ctx;\n}\n","import React from 'react';\n\nimport { computeStyles } from '../compute-styles';\nimport { checkRequestScope, getRSCCache, queueRSCCSS } from '../rsc-cache';\nimport type { ServerStyleCollector } from '../ssr/collector';\nimport { getTastySSRContext } from '../ssr/context';\nimport type { Styles } from '../styles/types';\n\n/**\n * The collector `TastyRegistry` provides through context. React's\n * `react-server` build has no `useContext` (nor any context to read), so a\n * Server Component skips the lookup. Chosen once per module, so the hook\n * order of a component never changes.\n */\nconst useContextCollector: () => ServerStyleCollector | null =\n typeof React.useContext === 'function'\n ? () => React.useContext(getTastySSRContext())\n : () => null;\n\nexport interface UseStylesResult {\n /**\n * Generated className(s) to apply to the element.\n * Can be empty string if no styles are provided.\n * With chunking enabled, may contain multiple space-separated class names.\n */\n className: string;\n}\n\n/**\n * Hook to generate CSS classes from Tasty styles.\n * Thin wrapper around `computeStyles()` that adds React context-based\n * SSR collector discovery for backward compatibility with TastyRegistry.\n *\n * Works in Server Components too. There, like the other style functions, it\n * cannot emit CSS itself: the next `tasty()` element in the tree emits it, so\n * render one after it.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { className } = useStyles({\n * padding: '2x',\n * fill: '#purple',\n * radius: '1r',\n * });\n *\n * return <div className={className}>Styled content</div>;\n * }\n * ```\n */\nexport function useStyles(\n styles: Styles | undefined,\n options?: { root?: Document | ShadowRoot },\n): UseStylesResult {\n const result = computeStyles(styles, {\n ssrCollector: useContextCollector(),\n root: options?.root,\n });\n\n // RSC: the CSS comes back for an inline <style>, which only a tasty()\n // element renders. Queue it for the next one, as the other style functions\n // do, rather than drop it with the result.\n if (result.css) {\n checkRequestScope();\n queueRSCCSS(getRSCCache(), result.css);\n return { className: result.className };\n }\n\n return result;\n}\n","import { getConfig, getGlobalInjector, getGlobalKeyframes } from '../config';\nimport { injectGlobal } from '../injector';\nimport type { KeyframesSteps } from '../injector/types';\nimport { resolveSelectorKeyframes } from '../keyframes';\nimport type { StyleResult } from '../pipeline';\nimport { renderStyles } from '../pipeline';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport {\n collectAutoInferredProperties,\n collectAutoInferredPropertiesRSC,\n} from '../ssr/collect-auto-properties';\nimport { formatGlobalRules } from '../ssr/format-global-rules';\nimport { formatKeyframesCSS } from '../ssr/format-keyframes';\nimport type { Styles } from '../styles/types';\nimport { createClientState } from '../utils/client-state';\nimport { hashString } from '../utils/hash';\nimport { resolveRecipes } from '../utils/resolve-recipes';\n\ninterface UseGlobalStylesOptions {\n /**\n * Stable identifier for update tracking (client-only). When provided,\n * changing the styles will dispose the previous injection and inject the\n * new one. Without an id, the selector is used as the slot key.\n * In RSC mode, renders are single-pass so update tracking does not apply.\n */\n id?: string;\n /** Shadow root or document to inject into (client only). */\n root?: Document | ShadowRoot;\n}\n\ninterface ClientGlobalEntry {\n stylesKey: string;\n dispose: () => void;\n}\n\nconst getClientGlobalSlots = /* @__PURE__ */ createClientState(\n () => new Map<string, ClientGlobalEntry>(),\n);\n\nconst noop = () => {\n /* nothing to dispose */\n};\n\n/**\n * Inject global styles for a given selector.\n * Useful for styling elements by selector without generating classNames.\n *\n * SSR-aware: when a ServerStyleCollector is available, CSS is collected\n * during the render phase instead of being injected into the DOM.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * Injected styles are permanent — they are not cleaned up on component unmount.\n * Use the `id` option for update tracking when styles change over the\n * component lifecycle.\n *\n * Update tracking is per-slot and per-root: a slot (`id`, or the selector when\n * no `id` is given) holds exactly one injection per `root`. Changing the styles\n * replaces it; rendering styles that produce no CSS clears it.\n *\n * @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')\n * @param styles - Tasty styles object\n * @param options - Optional settings including `id` for update tracking\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * useGlobalStyles('.card', {\n * padding: '2x',\n * radius: '1r',\n * fill: '#white',\n * });\n *\n * return <div className=\"card\">Content</div>;\n * }\n * ```\n */\nexport function useGlobalStyles(\n selector: string,\n styles?: Styles,\n options?: UseGlobalStylesOptions,\n): void {\n if (!styles) return;\n\n if (!selector) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n '[Tasty] useGlobalStyles: selector is required and cannot be empty. ' +\n 'Styles will not be injected.',\n );\n }\n return;\n }\n\n const target = getStyleTarget();\n\n // Resolve the client slot once — both the fast path below and the injection\n // at the end need it.\n const slots =\n target.mode === 'client'\n ? getClientGlobalSlots(options?.root ?? document)\n : null;\n const slotKey = options?.id ?? selector;\n const stylesKey = slots ? JSON.stringify(styles) : '';\n const existing = slots?.get(slotKey);\n\n // Client fast path: skip resolveRecipes/renderStyles if styles haven't changed\n if (existing && existing.stylesKey === stylesKey) return;\n\n const resolvedStyles = resolveRecipes(styles);\n\n const rendered = renderStyles(resolvedStyles, selector) as StyleResult[];\n\n if (rendered.length === 0) {\n // An update that renders no CSS must still clear the slot's previous\n // injection, otherwise the stale rules keep applying to the selector.\n if (slots) {\n existing?.dispose();\n slots.set(slotKey, { stylesKey, dispose: noop });\n }\n return;\n }\n\n // Animated rules name keyframes that have to exist: emit them under the\n // resolved names the class path uses, and point the rules at those names.\n const { rules: styleResults, keyframes } = resolveSelectorKeyframes(\n resolvedStyles,\n rendered,\n getGlobalKeyframes(),\n );\n\n if (target.mode === 'ssr') {\n target.collector.collectInternals();\n\n if (keyframes) {\n for (const [name, steps] of keyframes) {\n target.collector.collectKeyframes(\n name,\n formatKeyframesCSS(name, steps),\n );\n }\n }\n\n const css = formatGlobalRules(styleResults);\n if (css) {\n // A slot key (explicit `id`) replaces, matching client update tracking;\n // content-hashed keys only dedup.\n const key = options?.id\n ? `global:${options.id}`\n : `global:${selector}:${hashString(css)}`;\n target.collector.collectGlobalStyles(key, css, options?.id != null);\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n collectAutoInferredProperties(\n styleResults,\n target.collector,\n resolvedStyles,\n );\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n if (keyframes) {\n for (const [name, steps] of keyframes) {\n pushRSCCSS(\n target.cache,\n `__kf:${name}`,\n formatKeyframesCSS(name, steps),\n );\n }\n }\n\n const css = formatGlobalRules(styleResults);\n if (css) {\n const key = options?.id\n ? `__global:${options.id}`\n : `__global:${selector}:${hashString(css)}`;\n pushRSCCSS(target.cache, key, css, options?.id != null);\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n collectAutoInferredPropertiesRSC(\n styleResults,\n target.cache,\n resolvedStyles,\n );\n }\n return;\n }\n\n // Client path\n if (slots) {\n // Keyframes are referenced before the previous injection is released, so\n // ones that survive the update are not deleted and re-inserted.\n const releaseKeyframes = holdKeyframes(keyframes, options?.root);\n\n existing?.dispose();\n\n const { dispose } = injectGlobal(styleResults, { root: options?.root });\n slots.set(slotKey, {\n stylesKey,\n dispose: () => {\n dispose();\n releaseKeyframes();\n },\n });\n }\n}\n\n/**\n * Take a reference on each keyframes rule under its resolved name, which the\n * rules were rewritten to. Shares the entries the class path holds, so neither\n * side deletes a rule the other still animates.\n */\nfunction holdKeyframes(\n keyframes: Map<string, KeyframesSteps> | null,\n root?: Document | ShadowRoot,\n): () => void {\n if (!keyframes) return noop;\n\n const injector = getGlobalInjector();\n const disposers = [...keyframes].map(\n ([name, steps]) =>\n injector.keyframes(steps, { name, root, distinctByName: true }).dispose,\n );\n\n return () => {\n for (const dispose of disposers) dispose();\n };\n}\n","import { injectRawCSS } from '../injector';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { createClientState } from '../utils/client-state';\nimport { depsEqual } from '../utils/deps-equal';\nimport { hashString } from '../utils/hash';\n\ninterface UseRawCSSOptions {\n /**\n * Shadow root or document to inject into. Update tracking is per-root: the\n * same id in two roots holds a separate injection in each.\n */\n root?: Document | ShadowRoot;\n /**\n * Stable identifier for update tracking (client-only). When provided,\n * changing the CSS content will dispose the previous injection and inject\n * the new one. Without an id, deduplication is purely content-based (same\n * CSS is injected only once). In RSC mode, renders are single-pass so\n * update tracking does not apply.\n */\n id?: string;\n}\n\ninterface ClientEntry {\n css: string;\n dispose: () => void;\n}\n\ninterface ClientRawCSSState {\n /** id -> the single injection that slot currently owns */\n entries: Map<string, ClientEntry>;\n /** content hashes injected without an id (permanent, deduped) */\n dedup: Set<string>;\n /** id -> last factory deps, to skip re-evaluating the factory */\n deps: Map<string, readonly unknown[]>;\n}\n\nconst getClientState = /* @__PURE__ */ createClientState(\n (): ClientRawCSSState => ({\n entries: new Map(),\n dedup: new Set(),\n deps: new Map(),\n }),\n);\n\n// Overload 1: Static CSS string\nexport function useRawCSS(css: string, options?: UseRawCSSOptions): void;\n\n// Overload 2: Factory function with dependencies\nexport function useRawCSS(\n factory: () => string,\n deps: readonly unknown[],\n options?: UseRawCSSOptions,\n): void;\n\n/**\n * Inject raw CSS text directly without parsing.\n * This is a low-overhead alternative for injecting global CSS that doesn't need tasty processing.\n *\n * The CSS is inserted into a separate style element (data-tasty-raw) to avoid conflicts\n * with tasty's chunked style sheets.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * Injected styles are permanent — they are not cleaned up on component unmount.\n * Use the `id` option for update tracking when styles change over the\n * component lifecycle.\n *\n * @example Static CSS string\n * ```tsx\n * function GlobalStyles() {\n * useRawCSS(`\n * body {\n * margin: 0;\n * padding: 0;\n * font-family: sans-serif;\n * }\n * `);\n *\n * return null;\n * }\n * ```\n *\n * @example Factory function with dependencies\n * ```tsx\n * function ThemeStyles({ theme }: { theme: 'light' | 'dark' }) {\n * useRawCSS(() => `\n * :root {\n * --bg-color: ${theme === 'dark' ? '#1a1a1a' : '#ffffff'};\n * --text-color: ${theme === 'dark' ? '#ffffff' : '#1a1a1a'};\n * }\n * `, [theme], { id: 'theme-vars' });\n *\n * return null;\n * }\n * ```\n *\n * @example With options\n * ```tsx\n * function ShadowStyles({ shadowRoot }) {\n * useRawCSS(() => `.scoped { color: red; }`, [], { root: shadowRoot });\n * return null;\n * }\n * ```\n */\nexport function useRawCSS(\n cssOrFactory: string | (() => string),\n depsOrOptions?: readonly unknown[] | UseRawCSSOptions,\n options?: UseRawCSSOptions,\n): void {\n const isFactory = typeof cssOrFactory === 'function';\n\n const deps =\n isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : undefined;\n const opts = isFactory\n ? options\n : (depsOrOptions as UseRawCSSOptions | undefined);\n const id = opts?.id;\n\n const target = getStyleTarget();\n\n const state =\n target.mode === 'client' ? getClientState(opts?.root ?? document) : null;\n\n // Client deps cache: skip factory re-evaluation when deps haven't changed\n if (isFactory && deps && id && state) {\n const cachedDeps = state.deps.get(id);\n if (cachedDeps && depsEqual(cachedDeps, deps)) {\n return;\n }\n }\n\n const css = isFactory\n ? (cssOrFactory as () => string)()\n : (cssOrFactory as string);\n\n if (!css.trim()) return;\n\n if (target.mode !== 'client') {\n // A slot key (explicit `id`) replaces, matching client update tracking;\n // content-hashed keys only dedup.\n const key = `${target.mode === 'rsc' ? '__' : ''}raw:${id || hashString(css)}`;\n const replace = id != null;\n if (target.mode === 'ssr') {\n target.collector.collectRawCSS(key, css, replace);\n } else {\n pushRSCCSS(target.cache, key, css, replace);\n }\n return;\n }\n\n // Client path\n if (!state) return;\n\n if (id) {\n const existing = state.entries.get(id);\n if (existing) {\n if (existing.css === css) return;\n existing.dispose();\n }\n\n const { dispose } = injectRawCSS(css, opts);\n state.entries.set(id, { css, dispose });\n if (deps) state.deps.set(id, deps);\n } else {\n const contentKey = hashString(css);\n if (state.dedup.has(contentKey)) return;\n state.dedup.add(contentKey);\n injectRawCSS(css, opts);\n }\n}\n","import { getNamePrefix } from '../config';\nimport { keyframes } from '../injector';\nimport type { KeyframesSteps } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { formatKeyframesCSS } from '../ssr/format-keyframes';\nimport { createClientState } from '../utils/client-state';\nimport { depsEqual } from '../utils/deps-equal';\nimport { hashString } from '../utils/hash';\nimport { makeKeyframeName } from '../utils/name-prefix';\n\ninterface UseKeyframesOptions {\n name?: string;\n root?: Document | ShadowRoot;\n}\n\ninterface FactoryDepsEntry {\n deps: readonly unknown[];\n name: string;\n}\n\ninterface NamedSlotEntry {\n cacheKey: string;\n dispose: () => void;\n}\n\ninterface ClientKeyframesState {\n /** cacheKey (name + serialized steps) -> generated animation name */\n contentToName: Map<string, string>;\n /** provided name -> the single injection that slot currently owns */\n namedSlots: Map<string, NamedSlotEntry>;\n /** provided name -> last factory deps, to skip re-evaluating the factory */\n factoryDeps: Map<string, FactoryDepsEntry>;\n}\n\nconst getClientState = /* @__PURE__ */ createClientState(\n (): ClientKeyframesState => ({\n contentToName: new Map(),\n namedSlots: new Map(),\n factoryDeps: new Map(),\n }),\n);\n\n/**\n * Inject CSS @keyframes and return the generated animation name.\n * Deduplicates by content — identical steps always return the same name.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * Passing `name` claims a slot owned by that one call site (like `useRawCSS`'s\n * `id`): when its steps change, the previous injection is disposed and the name\n * is reused, so the rules don't accumulate. Anonymous keyframes are permanent\n * and shared by content.\n *\n * @example Basic usage - steps object is the dependency\n * ```tsx\n * function MyComponent() {\n * const bounce = useKeyframes({\n * '0%': { transform: 'scale(1)' },\n * '50%': { transform: 'scale(1.1)' },\n * '100%': { transform: 'scale(1)' },\n * });\n *\n * return <div style={{ animation: `${bounce} 1s infinite` }}>Bouncing</div>;\n * }\n * ```\n *\n * @example With custom name\n * ```tsx\n * function MyComponent() {\n * const fadeIn = useKeyframes(\n * { from: { opacity: 0 }, to: { opacity: 1 } },\n * { name: 'fadeIn' }\n * );\n *\n * return <div style={{ animation: `${fadeIn} 0.3s ease-out` }}>Fading in</div>;\n * }\n * ```\n *\n * @example Factory function with dependencies\n * ```tsx\n * function MyComponent({ scale }: { scale: number }) {\n * const pulse = useKeyframes(\n * () => ({\n * '0%': { transform: 'scale(1)' },\n * '100%': { transform: `scale(${scale})` },\n * }),\n * [scale]\n * );\n *\n * return <div style={{ animation: `${pulse} 1s infinite` }}>Pulsing</div>;\n * }\n * ```\n */\n\n// Overload 1: Static steps object\nexport function useKeyframes(\n steps: KeyframesSteps,\n options?: UseKeyframesOptions,\n): string;\n\n// Overload 2: Factory function with dependencies\nexport function useKeyframes(\n factory: () => KeyframesSteps,\n deps: readonly unknown[],\n options?: UseKeyframesOptions,\n): string;\n\n// Implementation\nexport function useKeyframes(\n stepsOrFactory: KeyframesSteps | (() => KeyframesSteps),\n depsOrOptions?: readonly unknown[] | UseKeyframesOptions,\n options?: UseKeyframesOptions,\n): string {\n const isFactory = typeof stepsOrFactory === 'function';\n\n const deps =\n isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : undefined;\n const opts = isFactory\n ? options\n : (depsOrOptions as UseKeyframesOptions | undefined);\n\n const target = getStyleTarget();\n\n const clientState =\n target.mode === 'client' ? getClientState(opts?.root ?? document) : null;\n\n // Client deps cache: skip factory re-evaluation when deps haven't changed\n if (isFactory && deps && opts?.name && clientState) {\n const cached = clientState.factoryDeps.get(opts.name);\n if (cached && depsEqual(cached.deps, deps)) {\n return cached.name;\n }\n }\n\n const steps = isFactory\n ? (stepsOrFactory as () => KeyframesSteps)()\n : (stepsOrFactory as KeyframesSteps);\n\n if (!steps || Object.keys(steps).length === 0) {\n return '';\n }\n\n if (target.mode === 'ssr') {\n const actualName = target.collector.allocateKeyframeName(opts?.name);\n const css = formatKeyframesCSS(actualName, steps);\n target.collector.collectKeyframes(actualName, css);\n return actualName;\n }\n\n if (target.mode === 'rsc') {\n const serializedContent = JSON.stringify(steps);\n const key = `__kf:${opts?.name ?? ''}:${serializedContent}`;\n\n const existingName = target.cache.generatedNames.get(key);\n if (existingName) return existingName;\n\n const actualName =\n opts?.name ??\n makeKeyframeName(getNamePrefix(), hashString(serializedContent));\n const css = formatKeyframesCSS(actualName, steps);\n pushRSCCSS(target.cache, key, css);\n target.cache.generatedNames.set(key, actualName);\n return actualName;\n }\n\n // Client path: stable name via content-based dedup\n const state = clientState ?? getClientState(opts?.root ?? document);\n const serializedContent = JSON.stringify(steps);\n const cacheKey = `${opts?.name ?? ''}:${serializedContent}`;\n\n const cachedName = state.contentToName.get(cacheKey);\n if (cachedName) {\n return cachedName;\n }\n\n const providedName = opts?.name;\n\n // A named slot owns exactly one injection. When its content changes, drop the\n // previous one first: disposing frees the name so the new steps can reclaim\n // it, and it keeps old @keyframes rules from piling up in the sheet.\n if (providedName) {\n const slot = state.namedSlots.get(providedName);\n\n if (slot && slot.cacheKey !== cacheKey) {\n slot.dispose();\n // Forget the stale content too, so any other call site still passing the\n // old steps re-injects instead of pointing at a removed rule.\n state.contentToName.delete(slot.cacheKey);\n state.namedSlots.delete(providedName);\n }\n }\n\n const result = keyframes(steps, {\n name: providedName,\n root: opts?.root,\n });\n\n const name = result.toString();\n state.contentToName.set(cacheKey, name);\n\n if (providedName) {\n state.namedSlots.set(providedName, { cacheKey, dispose: result.dispose });\n\n if (deps) {\n state.factoryDeps.set(providedName, { deps, name });\n }\n }\n\n return name;\n}\n","import { getGlobalInjector } from '../config';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { formatPropertyCSS } from '../ssr/format-property';\nimport type { PropertyOptions } from '../injector/types';\n\n/**\n * Options for {@link useProperty}. Extends the shared {@link PropertyOptions}\n * (which is `PropertyDefinition` plus an optional injection `root`).\n */\nexport type UsePropertyOptions = PropertyOptions;\n\n/**\n * Register a CSS @property custom property.\n * This enables advanced features like animating custom properties.\n *\n * Note: @property rules are global and persistent once defined.\n * The function ensures the property is only registered once per root.\n *\n * Accepts tasty token syntax for the property name:\n * - `$name` → defines `--name`\n * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')\n * - `--name` → defines `--name` (legacy format)\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @param name - The property token ($name, #name) or CSS property name (--name)\n * @param options - Property configuration\n *\n * @example Basic property with token syntax\n * ```tsx\n * function Spinner() {\n * useProperty('$rotation', {\n * syntax: '<angle>',\n * inherits: false,\n * initialValue: '0deg',\n * });\n *\n * return <div className=\"spinner\" />;\n * }\n * ```\n *\n * @example Color property with token syntax (auto-sets syntax)\n * ```tsx\n * function MyComponent() {\n * useProperty('#theme', {\n * initialValue: 'red', // syntax: '<color>' is auto-set\n * });\n *\n * // Now --theme-color can be animated with CSS transitions\n * return <div style={{ '--theme-color': 'blue' } as React.CSSProperties}>Colored</div>;\n * }\n * ```\n *\n * @example Legacy format (still supported)\n * ```tsx\n * function ResizableBox() {\n * useProperty('--box-size', {\n * syntax: '<length>',\n * initialValue: '100px',\n * });\n *\n * return <div style={{ width: 'var(--box-size)' }} />;\n * }\n * ```\n */\nexport function useProperty(name: string, options?: UsePropertyOptions): void {\n if (!name) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Tasty] useProperty: property name is required`);\n }\n return;\n }\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n target.collector.collectInternals();\n\n const css = formatPropertyCSS(name, {\n syntax: options?.syntax,\n inherits: options?.inherits,\n initialValue: options?.initialValue,\n });\n if (css) {\n target.collector.collectProperty(name, css);\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n const css = formatPropertyCSS(name, {\n syntax: options?.syntax,\n inherits: options?.inherits,\n initialValue: options?.initialValue,\n });\n if (css) {\n pushRSCCSS(target.cache, `__prop:${name}`, css);\n }\n return;\n }\n\n const injector = getGlobalInjector();\n\n if (injector.isPropertyDefined(name, { root: options?.root })) {\n return;\n }\n\n injector.property(name, {\n syntax: options?.syntax,\n inherits: options?.inherits,\n initialValue: options?.initialValue,\n root: options?.root,\n });\n}\n","import { getGlobalInjector } from '../config';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport type { FontFaceDescriptors, FontFaceInput } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\n\ninterface UseFontFaceOptions {\n root?: Document | ShadowRoot;\n}\n\n/**\n * Inject CSS @font-face rules.\n * Permanent — no cleanup on unmount. Deduplicates by content hash.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @param family - The font-family name\n * @param input - Single descriptor object or array of descriptors (for multiple weights/styles)\n * @param options - Optional settings (e.g. Shadow DOM root)\n *\n * @example Single weight\n * ```tsx\n * function App() {\n * useFontFace('Brand Sans', {\n * src: 'url(\"/fonts/brand-sans.woff2\") format(\"woff2\")',\n * fontWeight: '400 700',\n * fontDisplay: 'swap',\n * });\n *\n * return <div style={{ fontFamily: '\"Brand Sans\", sans-serif' }}>Hello</div>;\n * }\n * ```\n *\n * @example Multiple weights\n * ```tsx\n * function App() {\n * useFontFace('Brand Sans', [\n * { src: 'url(\"/fonts/brand-regular.woff2\") format(\"woff2\")', fontWeight: 400, fontDisplay: 'swap' },\n * { src: 'url(\"/fonts/brand-bold.woff2\") format(\"woff2\")', fontWeight: 700, fontDisplay: 'swap' },\n * ]);\n *\n * return <div style={{ fontFamily: '\"Brand Sans\", sans-serif' }}>Hello</div>;\n * }\n * ```\n */\nexport function useFontFace(\n family: string,\n input: FontFaceInput,\n options?: UseFontFaceOptions,\n): void {\n if (!family) return;\n\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n target.collector.collectFontFace(hash, css);\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n pushRSCCSS(target.cache, `__ff:${hash}`, css);\n }\n return;\n }\n\n const injector = getGlobalInjector();\n for (const desc of descriptors) {\n injector.fontFace(family, desc, { root: options?.root });\n }\n}\n","import { getGlobalInjector, getNamePrefix } from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport type { CounterStyleDescriptors } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { createClientState } from '../utils/client-state';\nimport { hashString } from '../utils/hash';\nimport { makeCounterStyleName } from '../utils/name-prefix';\n\ninterface UseCounterStyleOptions {\n name?: string;\n root?: Document | ShadowRoot;\n}\n\nlet clientCounterStyleCounter = 0;\n\nconst getClientContentToName = /* @__PURE__ */ createClientState(\n () => new Map<string, string>(),\n);\n\n/**\n * Inject a CSS @counter-style rule and return the generated name.\n * Permanent — no cleanup on unmount. Deduplicates by name.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @example Basic usage\n * ```tsx\n * function EmojiList() {\n * const styleName = useCounterStyle({\n * system: 'cyclic',\n * symbols: '\"👍\"',\n * suffix: '\" \"',\n * }, { name: 'thumbs' });\n *\n * return (\n * <ol style={{ listStyleType: styleName }}>\n * <li>First</li>\n * <li>Second</li>\n * </ol>\n * );\n * }\n * ```\n *\n */\nexport function useCounterStyle(\n descriptors: CounterStyleDescriptors,\n options?: UseCounterStyleOptions,\n): string {\n if (!descriptors || !descriptors.system) {\n return '';\n }\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n const actualName = target.collector.allocateCounterStyleName(options?.name);\n const css = formatCounterStyleRule(actualName, descriptors);\n target.collector.collectCounterStyle(actualName, css);\n return actualName;\n }\n\n if (target.mode === 'rsc') {\n const serializedContent = JSON.stringify(descriptors);\n const key = `__cs:${options?.name ?? ''}:${serializedContent}`;\n\n const existingName = target.cache.generatedNames.get(key);\n if (existingName) return existingName;\n\n const actualName =\n options?.name ??\n makeCounterStyleName(getNamePrefix(), hashString(serializedContent));\n const css = formatCounterStyleRule(actualName, descriptors);\n pushRSCCSS(target.cache, key, css);\n target.cache.generatedNames.set(key, actualName);\n return actualName;\n }\n\n // Client path: stable name via content-based dedup\n const contentToName = getClientContentToName(options?.root ?? document);\n const serializedContent = JSON.stringify(descriptors);\n const cacheKey = `${options?.name ?? ''}:${serializedContent}`;\n\n const existingName = contentToName.get(cacheKey);\n if (existingName) {\n return existingName;\n }\n\n const name =\n options?.name ??\n makeCounterStyleName(getNamePrefix(), String(clientCounterStyleCounter++));\n contentToName.set(cacheKey, name);\n\n const injector = getGlobalInjector();\n injector.counterStyle(name, descriptors, { root: options?.root });\n\n return name;\n}\n","import { getGlobalInjector, isFunctionsPolyfillEnabled } from '../config';\nimport {\n formatFunctionRule,\n parseFunctionName,\n registerFunctionPolyfill,\n} from '../functions';\nimport type { FunctionDefinition } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\n\nexport interface UseFunctionOptions {\n /** Shadow root or document to inject into. */\n root?: Document | ShadowRoot;\n}\n\n/**\n * Register a CSS @function (custom function).\n *\n * @function rules are global and persistent once defined. The hook ensures the\n * function is only registered once per root (deduplicated by function name).\n *\n * Accepts tasty token syntax for the function name:\n * - `$$name` → defines `--name` (matches the call site `$$name(...)`)\n * - `$name` / `--name` → also accepted\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @param name - The function name token (`$$name`, `$name`, or `--name`)\n * @param definition - Function definition (args, returns, result, local vars)\n *\n * Call the function through the Tasty DSL, not a raw `style` prop: an inline\n * `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never\n * expanded and `polyfills.functions` cannot rewrite it either.\n *\n * @example\n * ```tsx\n * const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });\n *\n * function Layout() {\n * useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });\n * return <Box />;\n * }\n * ```\n */\nexport function useFunction(\n name: string,\n definition: FunctionDefinition,\n options?: UseFunctionOptions,\n): void {\n if (!name) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Tasty] useFunction: function name is required`);\n }\n return;\n }\n\n // @function polyfill: register an inline closure so call sites are expanded\n // into plain CSS by the parser. No native @function rule is emitted.\n if (isFunctionsPolyfillEnabled()) {\n registerFunctionPolyfill(name, definition);\n return;\n }\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n target.collector.collectInternals();\n\n const css = formatFunctionRule(name, definition);\n if (css) {\n target.collector.collectFunction(parseFunctionName(name), css);\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n const css = formatFunctionRule(name, definition);\n if (css) {\n pushRSCCSS(target.cache, `__func:${parseFunctionName(name)}`, css);\n }\n return;\n }\n\n getGlobalInjector().func(name, definition, { root: options?.root });\n}\n","// A default import: React's `react-server` build has no `useInsertionEffect`,\n// and a named import would stop the main entry loading in Server Components.\nimport React from 'react';\nimport type { ReactNode } from 'react';\n\nimport { closeBatchWindow, openBatchWindow } from './injector/batch';\n\nexport interface TastyBatchProviderProps {\n children?: ReactNode;\n}\n\n/**\n * Opens a *batch window* for the commit it renders in, so `batchInjection`\n * can defer stylesheet writes without ever letting a layout effect measure an\n * unstyled element.\n *\n * Every `insertRule()` on a live sheet invalidates style for that sheet's\n * scope. When components inject during React's render phase while others read\n * layout in the same pass, the two interleave and the browser recalculates\n * style between every injection. Batching collapses that into one invalidation\n * per flush — but only if the flush happens before anything can measure.\n *\n * ```\n * provider renders -> window OPEN\n * children render -> injections queued\n * provider insertionEffect -> FLUSH, window CLOSED\n * layout effects run -> rules are in the sheet\n * ```\n *\n * `useInsertionEffect` runs in React's mutation phase, after every render in\n * the commit and before any `useLayoutEffect` — which is exactly why React\n * added it for CSS-in-JS libraries. Effects fire child-first, so this\n * provider's runs after every descendant's and still before all layout\n * effects.\n *\n * A commit that does not re-render this provider gets no window, and those\n * injections are written synchronously instead. That is the point: turning\n * `batchInjection: true` on can only ever make injection cheaper, never make a\n * measurement wrong. It also means batching applies to commits this provider\n * takes part in, so mount it as high in the tree as you can.\n *\n * Requires `configure({ batchInjection: true })`; without it this component\n * only renders its children. `batchInjection: 'always'` does not need the\n * provider at all — see that option's docs for the trade-off it accepts.\n *\n * @example\n * ```tsx\n * configure({ batchInjection: true });\n *\n * createRoot(el).render(\n * <TastyBatchProvider>\n * <App />\n * </TastyBatchProvider>,\n * );\n * ```\n */\nexport function TastyBatchProvider({ children }: TastyBatchProviderProps) {\n // Opened during render on purpose: the window has to be open before children\n // render, and this is the only phase that precedes them. It is idempotent and\n // has no other side effect, so StrictMode's double render costs nothing. A\n // render that is thrown away (aborted or suspended) leaves the window open,\n // which the microtask backstop closes — and such a render mounts nothing, so\n // nothing can measure what it queued.\n openBatchWindow();\n\n // Fires in the mutation phase, before any layout effect. No dependency array:\n // it must run on every commit this provider is part of.\n React.useInsertionEffect(() => {\n closeBatchWindow();\n });\n\n return children;\n}\n"],"mappings":";;;;;;;AAEA,MAAM,eAAe;AAWrB,SAAS,OAAO,MAAmC;CACjD,IAAI,OAAO,SAAS,UAAU,OAAO;CACrC,IAAI,CAAC,QAAS,OAAO,SAAS,cAAc,OAAO,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