@tenphi/tasty 0.0.0-snapshot.27699f6 → 0.0.0-snapshot.27b6708

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.
Files changed (91) hide show
  1. package/README.md +171 -107
  2. package/dist/{async-storage-B7_o6FKt.js → async-storage-DKK-wTD4.js} +1 -1
  3. package/dist/{async-storage-B7_o6FKt.js.map → async-storage-DKK-wTD4.js.map} +1 -1
  4. package/dist/babel-BUQGeOXA.d.ts +83 -0
  5. package/dist/{collector-QwpPODsy.js → collector-DTahQUiV.js} +97 -23
  6. package/dist/collector-DTahQUiV.js.map +1 -0
  7. package/dist/{collector-LuU1vZ68.d.ts → collector-DUaHCcTS.d.ts} +54 -7
  8. package/dist/{config-rrijM-U2.js → config-B5kHzuNz.js} +5144 -3012
  9. package/dist/config-B5kHzuNz.js.map +1 -0
  10. package/dist/{config-vuCRkBWX.d.ts → config-YsxGv4tq.d.ts} +412 -33
  11. package/dist/{context-CkSg-kDT.js → context-CA8YKeMn.js} +1 -1
  12. package/dist/{context-CkSg-kDT.js.map → context-CA8YKeMn.js.map} +1 -1
  13. package/dist/core/index.d.ts +5 -5
  14. package/dist/core/index.js +6 -6
  15. package/dist/{core-BvTG0J_M.js → core-Dr4u1NVD.js} +162 -188
  16. package/dist/core-Dr4u1NVD.js.map +1 -0
  17. package/dist/{css-writer-C7HJGEmN.js → css-writer-B-J87ncv.js} +78 -17
  18. package/dist/css-writer-B-J87ncv.js.map +1 -0
  19. package/dist/{format-global-rules-Dbc_1tc3.js → format-global-rules-DklyaXv-.js} +1 -1
  20. package/dist/{format-global-rules-Dbc_1tc3.js.map → format-global-rules-DklyaXv-.js.map} +1 -1
  21. package/dist/{format-rules-BvokPr1L.js → format-rules-DKOA-6qu.js} +4 -17
  22. package/dist/format-rules-DKOA-6qu.js.map +1 -0
  23. package/dist/{hydrate-Dsv7Pwon.js → hydrate-OeMX99We.js} +3 -11
  24. package/dist/{hydrate-Dsv7Pwon.js.map → hydrate-OeMX99We.js.map} +1 -1
  25. package/dist/{index-dUtwpOux.d.ts → index-Cd45t5NM.d.ts} +319 -64
  26. package/dist/{index-ZRxZWzlj.d.ts → index-PqN-DIpn.d.ts} +498 -189
  27. package/dist/index.d.ts +5 -5
  28. package/dist/index.js +253 -63
  29. package/dist/index.js.map +1 -1
  30. package/dist/{keyframes-DDqRjwa9.js → keyframes-CV8azJf3.js} +97 -191
  31. package/dist/keyframes-CV8azJf3.js.map +1 -0
  32. package/dist/{merge-styles-CtDJMhpJ.d.ts → merge-styles-CU7JbEwg.d.ts} +2 -2
  33. package/dist/{merge-styles-B8jV6zu3.js → merge-styles-oklji0KB.js} +2 -2
  34. package/dist/{merge-styles-B8jV6zu3.js.map → merge-styles-oklji0KB.js.map} +1 -1
  35. package/dist/{resolve-recipes-BnTZz2I_.js → resolve-recipes-DTG81rzl.js} +3 -3
  36. package/dist/{resolve-recipes-BnTZz2I_.js.map → resolve-recipes-DTG81rzl.js.map} +1 -1
  37. package/dist/ssr/astro-client.js +1 -1
  38. package/dist/ssr/astro-client.js.map +1 -1
  39. package/dist/ssr/astro-middleware-static.d.ts +16 -0
  40. package/dist/ssr/astro-middleware-static.js +18 -0
  41. package/dist/ssr/astro-middleware-static.js.map +1 -0
  42. package/dist/ssr/astro-middleware.d.ts +8 -6
  43. package/dist/ssr/astro-middleware.js +10 -10
  44. package/dist/ssr/astro-middleware.js.map +1 -1
  45. package/dist/ssr/astro.d.ts +2 -17
  46. package/dist/ssr/astro.js +29 -21
  47. package/dist/ssr/astro.js.map +1 -1
  48. package/dist/ssr/index.d.ts +2 -9
  49. package/dist/ssr/index.js +5 -5
  50. package/dist/ssr/index.js.map +1 -1
  51. package/dist/ssr/next.d.ts +2 -3
  52. package/dist/ssr/next.js +6 -7
  53. package/dist/ssr/next.js.map +1 -1
  54. package/dist/static/index.d.ts +2 -2
  55. package/dist/static/index.js +4 -4
  56. package/dist/static/index.js.map +1 -1
  57. package/dist/static/inject.js.map +1 -1
  58. package/dist/zero/babel.d.ts +2 -81
  59. package/dist/zero/babel.js +39 -27
  60. package/dist/zero/babel.js.map +1 -1
  61. package/dist/zero/index.d.ts +16 -2
  62. package/dist/zero/index.js +2 -2
  63. package/dist/zero/next.d.ts +1 -1
  64. package/dist/zero/next.js +1 -1
  65. package/dist/zero/next.js.map +1 -1
  66. package/docs/README.md +12 -6
  67. package/docs/adoption.md +53 -28
  68. package/docs/ai-agents.md +224 -0
  69. package/docs/comparison.md +59 -30
  70. package/docs/configuration.md +498 -69
  71. package/docs/debug.md +7 -7
  72. package/docs/design-system.md +43 -24
  73. package/docs/dsl.md +510 -178
  74. package/docs/getting-started.md +55 -34
  75. package/docs/injector.md +58 -5
  76. package/docs/methodology.md +68 -36
  77. package/docs/migration-v3.md +285 -0
  78. package/docs/pipeline.md +93 -25
  79. package/docs/plugins.md +349 -0
  80. package/docs/react-api.md +162 -38
  81. package/docs/ssr.md +45 -35
  82. package/docs/styles.md +65 -16
  83. package/docs/tasty-static.md +25 -8
  84. package/package.json +43 -21
  85. package/tasty.config.ts +6 -0
  86. package/dist/collector-QwpPODsy.js.map +0 -1
  87. package/dist/config-rrijM-U2.js.map +0 -1
  88. package/dist/core-BvTG0J_M.js.map +0 -1
  89. package/dist/css-writer-C7HJGEmN.js.map +0 -1
  90. package/dist/format-rules-BvokPr1L.js.map +0 -1
  91. package/dist/keyframes-DDqRjwa9.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as strToRgb, A as RawStyleHandler, B as getGlobalFuncs, C as SuffixForSelector, Ct as RawCSSResult, D as CUSTOM_UNITS, Dt as StyleInjectorConfig, E as CSSMap, Et as SheetInfo, F as StylePropValue, G as parseStyle, H as getGlobalPredefinedTokens, I as StyleValue, J as stringifyStyles, K as resetGlobalPredefinedTokens, L as StyleValueStateMap, M as StyleHandlerDefinition, N as StyleHandlerResult, O as DIRECTIONS, Ot as StyleRule, P as StyleMap, Q as hslToRgbValues, R as customFunc, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RuleInfo, U as normalizeColorTokenValue, V as getGlobalParser, W as parseColor, X as getRgbValuesFromRgbaString, Y as getNamedColorHex, Z as hexToRgb, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as StyleDetailsPart, b as Styles, bt as KeyframesResult, c as ParsedAdvancedState, ct as CacheMetrics, d as getGlobalPredefinedStates, dt as FontFaceDescriptors, et as StyleParser, f as setGlobalPredefinedStates, ft as FontFaceInput, g as NoType, gt as InjectResult, h as ConfigTokens, i as renderStyles, it as StyleDetails, j as StyleHandler, k as ParsedColor, kt as StyleUsage, l as StateParserContext, lt as CounterStyleDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as ParserOptions, o as parseStateKey, ot as UnitHandler, p as ConditionNode, pt as GCConfig, q as setGlobalPredefinedTokens, r as isSelector, rt as ProcessedStyle, s as AtRuleContext, st as CSSProperties, t as RenderResult, tt as Bucket, u as createStateParserContext, ut as DisposeFunction, v as RecipeStyles, vt as KeyframesCacheEntry, w as TastyNamedColors, wt as RootRegistry, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as filterMods } from "./index-dUtwpOux.js";
2
- import { _ as TypographyTokenValue, a as getGlobalFontFace, b as StyleInjector, c as hasGlobalKeyframes, d as isConfigLocked, f as isTestEnvironment, g as TypographyPreset, h as TastyPluginFactory, i as getGlobalCounterStyle, l as hasGlobalRecipes, m as TastyPlugin, n as configure, o as getGlobalKeyframes, p as resetConfig, r as getConfig, s as getGlobalRecipes, t as TastyConfig, u as hasStylesGenerated, v as generateTypographyTokens, x as SheetManager, y as ColorSpace } from "./config-vuCRkBWX.js";
3
- import { $ as ResolveTokenProps, A as chunkSheetRegistry, At as TastyThemeNames, B as useKeyframes, Bt as DIMENSION_STYLES, C as injectRawCSS, Ct as Mods, D as property, Dt as ShortGridStyles, E as keyframes, Et as Props, F as getDisplayName, Ft as BLOCK_INNER_STYLES, G as useStyles, Gt as TEXT_STYLES, H as useGlobalStyles, Ht as INNER_STYLES, I as useCounterStyle, It as BLOCK_OUTER_STYLES, J as ElementsDefinition, Jt as ChunkName, K as AllBasePropsWithMods, Kt as CHUNK_NAMES, L as useFontFace, Lt as BLOCK_STYLES, M as ComputeStylesResult, Mt as TokenValue, N as computeStyles, Nt as Tokens, O as touch, Ot as TagName, P as styleHandlers, Pt as BASE_STYLES, Q as ResolveModProps, Qt as okhslPlugin, R as UsePropertyOptions, Rt as COLOR_STYLES, S as injectGlobal, St as ModValue, T as isPropertyDefined, Tt as PositionStyleProps, U as UseStylesOptions, Ut as OUTER_STYLES, V as useRawCSS, Vt as FLOW_STYLES, W as UseStylesResult, Wt as POSITION_STYLES, X as ModPropsInput, Xt as categorizeStyleKeys, Y as ModPropDef, Yt as STYLE_TO_CHUNK, Z as ResolveModPropDef, Zt as okhslFunc, _ as getCssText, _t as ContainerStyleProps, a as resolveRecipes, at as TokenPropsInput, b as getRawCSSText, bt as GlobalStyledProps, c as color, ct as tasty, d as cleanup, dt as BasePropsWithoutChildren, et as SubElementDefinition, f as counterStyle, ft as BaseStyleProps, g as gc, gt as ColorStyleProps, h as fontFace, ht as BlockStyleProps, i as warn, it as TastyProps, j as ComputeStylesOptions, jt as TextStyleProps, k as ChunkSheetRegistry, kt as TastyExtensionConfig, l as filterBaseProps, lt as AllBaseProps, m as destroy, mt as BlockOuterStyleProps, n as processTokens, nt as TastyElementOptions, o as dotize, ot as VariantMap, p as createInjector, pt as BlockInnerStyleProps, q as Element, qt as ChunkInfo, r as deprecationWarning, rt as TastyElementProps, s as _modAttrs, st as WithVariant, t as tastyDebug, tt as SubElementProps, u as PropertyOptions, ut as BaseProps, v as getCssTextForNode, vt as DimensionStyleProps, w as injector, wt as OuterStyleProps, x as inject, xt as InnerStyleProps, y as getIsTestEnvironment, yt as FlowStyleProps, z as useProperty, zt as CONTAINER_STYLES } from "./index-ZRxZWzlj.js";
4
- import { t as mergeStyles } from "./merge-styles-CtDJMhpJ.js";
5
- export { AllBaseProps, AllBasePropsWithMods, AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, BaseProps, BasePropsWithoutChildren, BaseStyleProps, BlockInnerStyleProps, BlockOuterStyleProps, BlockStyleProps, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CSSMap, CSSProperties, CUSTOM_UNITS, CacheMetrics, ChunkInfo, ChunkName, ChunkSheetRegistry, ColorSpace, ColorStyleProps, ComputeStylesOptions, ComputeStylesResult, ConditionNode, ConfigTokenValue, ConfigTokens, ContainerStyleProps, CounterStyleDescriptors, DIMENSION_STYLES, DIRECTIONS, DimensionStyleProps, DisposeFunction, Element, ElementsDefinition, FLOW_STYLES, FlowStyleProps, FontFaceDescriptors, FontFaceInput, GCConfig, GCOptions, GlobalStyledProps, INNER_STYLES, InjectResult, InjectionMode, InnerStyleProps, KeyframesCacheEntry, KeyframesInfo, KeyframesResult, KeyframesSteps, ModPropDef, ModPropsInput, ModValue, Mods, NoType, NotSelector, OUTER_STYLES, OuterStyleProps, POSITION_STYLES, ParseStateKeyOptions, ParsedAdvancedState, ParsedColor, ParserOptions, PositionStyleProps, ProcessedStyle, PropertyDefinition, PropertyOptions, Props, RawCSSResult, RawStyleHandler, RecipeStyles, RenderResult, ResolveModPropDef, ResolveModProps, ResolveTokenProps, RootRegistry, RuleInfo, STYLE_TO_CHUNK, Selector, SheetInfo, SheetManager, ShortGridStyles, StateParserContext, StyleDetails, StyleDetailsPart, StyleHandler, StyleHandlerDefinition, StyleHandlerResult, StyleInjector, StyleInjectorConfig, StyleMap, StyleParser, StylePropValue, StyleResult, StyleRule, StyleUsage, StyleValue, StyleValueStateMap, Styles, StylesInterface, StylesWithoutSelectors, SubElementDefinition, SubElementProps, SuffixForSelector, TEXT_STYLES, TagName, TastyConfig, TastyElementOptions, TastyElementProps, TastyExtensionConfig, TastyNamedColors, TastyPlugin, TastyPluginFactory, TastyPresetNames, TastyProps, TastyThemeNames, TextStyleProps, TokenPropsInput, TokenValue, Tokens, TypographyPreset, TypographyTokenValue, UnitHandler, UsePropertyOptions, UseStylesOptions, UseStylesResult, VariantMap, WithVariant, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
1
+ import { C as ParseFunction, D as PropHandlerDefinition, E as PropHandler, O as PropHandlerProps, S as FunctionsConfig, T as SheetManager, _ as TastyPluginFactory, a as getGlobalFontFaces, b as generateTypographyTokens, c as getGlobalRecipes, d as hasGlobalRecipes, f as hasStylesGenerated, g as TastyPlugin, h as resetConfig, i as getGlobalCounterStyles, l as getNamePrefix, m as isTestEnvironment, n as configure, o as getGlobalFunctions, p as isConfigLocked, r as getConfig, s as getGlobalKeyframes, t as TastyConfig, u as hasGlobalKeyframes, v as TypographyPreset, w as StyleInjector, x as ColorSpace, y as TypographyTokenValue } from "./config-YsxGv4tq.js";
2
+ import { $ as StyleParser, A as ParsedColor, At as StyleUsage, B as StyleValueStateMap, C as SuffixForSelector, Ct as PropertyOptions, D as CSSMap, Dt as SheetInfo, E as AnyStyleHandler, Et as RuleInfo, F as StyleHandlerProps, G as parseColor, H as getGlobalParser, I as StyleHandlerResult, J as getNamedColorHex, K as parseStyle, L as StyleMap, M as ResolvedStyleValue, Mt as flushStyles, N as StyleHandler, Nt as hasPendingStyleWrites, O as CUSTOM_UNITS, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, Pt as resetStyleBatch, Q as strToRgb, R as StylePropValue, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RootRegistry, U as getGlobalPredefinedTokens, V as filterMods, W as normalizeColorTokenValue, X as hexToRgb, Y as getRgbValuesFromRgbaString, Z as hslToRgbValues, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as CSSProperties, b as Styles, bt as KeyframesResult, c as ParsedAdvancedState, ct as DisposeFunction, d as getGlobalPredefinedStates, dt as FunctionDefinition, et as ParserOptions, f as setGlobalPredefinedStates, ft as FunctionParameter, g as NoType, gt as InjectResult, h as ConfigTokens, i as renderStyles, it as UnitHandler, j as RawStyleHandler, jt as QueuedWrite, k as DIRECTIONS, kt as StyleRule, l as StateParserContext, lt as FontFaceDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as StyleDetails, o as parseStateKey, ot as CacheMetrics, p as ConditionNode, pt as GCConfig, q as stringifyStyles, r as isSelector, rt as StyleDetailsPart, s as AtRuleContext, st as CounterStyleDescriptors, t as RenderResult, tt as ProcessedStyle, u as createStateParserContext, ut as FontFaceInput, v as RecipeStyles, vt as KeyframesCacheEntry, w as TastyNamedColors, wt as RawCSSResult, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as StyleValue } from "./index-Cd45t5NM.js";
3
+ import { $ as okhstFunction, $t as PositionStyleProps, A as keyframes, At as TastyElementProps, B as ChunkInfo, Bt as BaseStyleProps, C as getCSSTextForNode, Ct as ResolveModPropDef, D as injectRawCSS, Dt as SubElementProps, E as injectGlobal, Et as SubElementDefinition, F as ComputeStylesOptions, Ft as WithVariant, G as DIMENSION_CHUNK_STYLES, Gt as ContainerStyleProps, H as APPEARANCE_CHUNK_STYLES, Ht as BlockOuterStyleProps, I as ComputeStylesResult, It as tasty, J as LAYOUT_CHUNK_STYLES, Jt as FlowStyleProps, K as DISPLAY_CHUNK_STYLES, Kt as DimensionStyleProps, L as computeStyles, Lt as AllBaseProps, M as touch, Mt as TastyProps, N as ChunkSheetRegistry, Nt as TokenPropsInput, O as injector, Ot as TastyComponentPropsWithDefaults, P as chunkSheetRegistry, Pt as VariantMap, Q as createColorFunc, Qt as OuterStyleProps, R as defineHandler, Rt as BaseProps, S as getCSSText, Sn as DEFAULT_ZERO_NAME_PREFIX, St as ResolveAsProps, T as inject, Tt as ResolveTokenProps, U as CHUNK_NAMES, Ut as BlockStyleProps, V as categorizeStyleKeys, Vt as BlockInnerStyleProps, W as ChunkName, Wt as ColorStyleProps, X as STYLE_TO_CHUNK, Xt as ModValue, Y as POSITION_CHUNK_STYLES, Yt as InnerStyleProps, Z as resolveFunctionColor, Zt as Mods, _ as createInjector, _n as INNER_STYLES, _t as AllBasePropsWithMods, a as DebugOptions, an as TastyThemeNames, at as TastyBatchProviderProps, b as func, bn as TEXT_STYLES, bt as ModPropDef, c as tastyDebug, cn as Tokens, ct as useCounterStyle, d as dotize, dn as BLOCK_OUTER_STYLES, dt as useProperty, en as ShortGridStyles, et as okhstPlugin, f as _modAttrs, fn as BLOCK_STYLES, ft as useKeyframes, g as counterStyle, gn as FLOW_STYLES, gt as useStyles, h as cleanup, hn as DIMENSION_STYLES, ht as UseStylesResult, i as DebugChunkInfo, in as TastyExtensionConfig, it as TastyBatchProvider, j as property, jt as TastyPolymorphicComponent, k as isPropertyDefined, kt as TastyElementOptions, l as processTokens, ln as BASE_STYLES, lt as useFontFace, m as filterBaseProps, mn as CONTAINER_STYLES, mt as useGlobalStyles, n as CacheStatus, nn as TastyBaseStylePropNames, nt as okhslPlugin, o as InspectResult, on as TextStyleProps, ot as UseFunctionOptions, p as color, pn as COLOR_STYLES, pt as useRawCSS, q as FONT_CHUNK_STYLES, qt as ExtraBaseStyleProps, r as ChunkBreakdown, rn as TastyCustomProps, rt as getDisplayName, s as Summary, sn as TokenValue, st as useFunction, t as CSSOptions, tn as TagName, tt as okhslFunction, u as resolveRecipes, un as BLOCK_INNER_STYLES, ut as UsePropertyOptions, v as destroy, vn as OUTER_STYLES, vt as Element, w as getRawCSSText, wt as ResolveModProps, x as gc, xn as DEFAULT_NAME_PREFIX, xt as ModPropsInput, y as fontFace, yn as POSITION_STYLES, yt as ElementsDefinition, z as styleHandlers, zt as BasePropsWithoutChildren } from "./index-PqN-DIpn.js";
4
+ import { t as mergeStyles } from "./merge-styles-CU7JbEwg.js";
5
+ export { APPEARANCE_CHUNK_STYLES, type AllBaseProps, type AllBasePropsWithMods, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, type CSSMap, CSSOptions, type CSSProperties, CUSTOM_UNITS, type CacheMetrics, CacheStatus, ChunkBreakdown, type ChunkInfo, type ChunkName, ChunkSheetRegistry, type ColorSpace, type ColorStyleProps, type ComputeStylesOptions, type ComputeStylesResult, type ConditionNode, type ConfigTokenValue, type ConfigTokens, type ContainerStyleProps, type CounterStyleDescriptors, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, DebugChunkInfo, DebugOptions, type DimensionStyleProps, type DisposeFunction, Element, type ElementsDefinition, type ExtraBaseStyleProps, FLOW_STYLES, FONT_CHUNK_STYLES, type FlowStyleProps, type FontFaceDescriptors, type FontFaceInput, type FunctionDefinition, type FunctionParameter, type FunctionsConfig, type GCConfig, type GCOptions, INNER_STYLES, type InjectResult, type InjectionMode, type InnerStyleProps, InspectResult, type KeyframesCacheEntry, type KeyframesInfo, type KeyframesResult, type KeyframesSteps, LAYOUT_CHUNK_STYLES, type ModPropDef, type ModPropsInput, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_CHUNK_STYLES, POSITION_STYLES, type ParseFunction, type ParseStateKeyOptions, type ParsedAdvancedState, type ParsedColor, type ParserOptions, type PositionStyleProps, type ProcessedStyle, type PropHandler, type PropHandlerDefinition, type PropHandlerProps, type PropertyDefinition, type PropertyOptions, type QueuedWrite, type RawCSSResult, type RawStyleHandler, type RecipeStyles, type RenderResult, type ResolveAsProps, type ResolveModPropDef, type ResolveModProps, type ResolveTokenProps, type ResolvedStyleValue, type RootRegistry, type RuleInfo, STYLE_TO_CHUNK, type Selector, type SheetInfo, SheetManager, type ShortGridStyles, type StateParserContext, type StyleDetails, type StyleDetailsPart, type StyleHandler, type StyleHandlerDefinition, type StyleHandlerProps, type StyleHandlerResult, StyleInjector, type StyleInjectorConfig, type StyleMap, StyleParser, type StylePropValue, type StyleResult, type StyleRule, type StyleUsage, type StyleValue, type StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SubElementDefinition, type SubElementProps, type SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, TastyBatchProvider, type TastyBatchProviderProps, type TastyComponentPropsWithDefaults, type TastyConfig, type TastyCustomProps, type TastyElementOptions, type TastyElementProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPolymorphicComponent, type TastyPresetNames, type TastyProps, type TastyThemeNames, type TextStyleProps, type TokenPropsInput, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, type UseFunctionOptions, type UsePropertyOptions, type UseStylesResult, type VariantMap, type WithVariant, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { $ as parseStyle, B as deprecationWarning, D as getGlobalPredefinedStates, F as formatFontFaceRule, G as DIRECTIONS, J as getGlobalFuncs, K as customFunc, L as SheetManager, O as setGlobalPredefinedStates, P as fontFaceContentHash, Q as parseColor, S as parseStateKey, St as strToRgb, V as warn, W as CUSTOM_UNITS, X as getGlobalPredefinedTokens, Y as getGlobalParser, Z as normalizeColorTokenValue, _ as resetConfig, a as getGlobalCounterStyle, at as StyleParser, b as isSelector, bt as hexToRgb, c as getGlobalKeyframes, ct as hashString, d as hasGlobalKeyframes, et as resetGlobalPredefinedTokens, f as hasGlobalRecipes, h as isTestEnvironment, it as okhslPlugin, j as formatCounterStyleRule, k as StyleInjector, l as getGlobalRecipes, m as isConfigLocked, n as getConfig, nt as stringifyStyles, o as getGlobalFontFace, ot as Bucket, p as hasStylesGenerated, q as filterMods, rt as okhslFunc, s as getGlobalInjector, t as configure, tt as setGlobalPredefinedTokens, v as generateTypographyTokens, vt as getNamedColorHex, w as createStateParserContext, x as renderStyles, xt as hslToRgbValues, yt as getRgbValuesFromRgbaString, z as styleHandlers } from "./config-rrijM-U2.js";
2
- import { d as categorizeStyleKeys, l as CHUNK_NAMES, u as STYLE_TO_CHUNK } from "./keyframes-DDqRjwa9.js";
3
- import { A as property, B as DIMENSION_STYLES, C as getRawCSSText, D as injector, E as injectRawCSS, F as BLOCK_INNER_STYLES, G as TEXT_STYLES, H as INNER_STYLES, I as BLOCK_OUTER_STYLES, L as BLOCK_STYLES, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, P as BASE_STYLES, R as COLOR_STYLES, S as getIsTestEnvironment, T as injectGlobal, U as OUTER_STYLES, V as FLOW_STYLES, W as POSITION_STYLES, _ as destroy, a as color, b as getCssText, c as hasKeys, d as collectAutoInferredPropertiesRSC, f as getStyleTarget, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, l as formatKeyframesCSS, m as cleanup, n as processTokens, o as filterBaseProps, p as pushRSCCSS, r as dotize, s as computeStyles, t as tastyDebug, u as collectAutoInferredProperties, v as fontFace, w as inject, x as getCssTextForNode, y as gc, z as CONTAINER_STYLES } from "./core-BvTG0J_M.js";
4
- import { n as formatPropertyCSS } from "./format-rules-BvokPr1L.js";
5
- import { t as mergeStyles } from "./merge-styles-B8jV6zu3.js";
6
- import { t as resolveRecipes } from "./resolve-recipes-BnTZz2I_.js";
7
- import { t as getTastySSRContext } from "./context-CkSg-kDT.js";
8
- import { t as formatGlobalRules } from "./format-global-rules-Dbc_1tc3.js";
9
- import { Fragment, createElement, forwardRef, useContext } from "react";
1
+ import { $ as SheetManager, $t as StyleParser, A as FLOW_STYLES, At as STYLE_TO_CHUNK, B as createStateParserContext, C as BASE_STYLES, Ct as APPEARANCE_CHUNK_STYLES, D as COLOR_STYLES, Dt as FONT_CHUNK_STYLES, E as BLOCK_STYLES, Et as DISPLAY_CHUNK_STYLES, Ft as registerFunctionPolyfill, G as StyleInjector, Gt as parseStyle, Ht as getGlobalPredefinedTokens, I as isSelector, Jt as okhstPlugin, Kt as stringifyStyles, L as renderStyles, Lt as CUSTOM_UNITS, M as OUTER_STYLES, Mt as formatFunctionRule, N as POSITION_STYLES, O as CONTAINER_STYLES, Ot as LAYOUT_CHUNK_STYLES, P as TEXT_STYLES, Pt as parseFunctionName, R as parseStateKey, Rt as DIRECTIONS, S as baseStylePropsRegistry, St as propHandlerRegistry, T as BLOCK_OUTER_STYLES, Tt as DIMENSION_CHUNK_STYLES, U as getGlobalPredefinedStates, Ut as normalizeColorTokenValue, Vt as getGlobalParser, W as setGlobalPredefinedStates, Wt as parseColor, X as fontFaceContentHash, Xt as okhslPlugin, Yt as okhslFunction, Z as formatFontFaceRule, Zt as createColorFunc, _ as isFunctionsPolyfillEnabled, _t as hashString, a as getGlobalCounterStyles, an as hslToRgbValues, at as closeBatchWindow, b as resetConfig, c as getGlobalInjector, ct as openBatchWindow, dt as DEFAULT_ZERO_NAME_PREFIX, f as getNamePrefix, g as isConfigLocked, h as hasStylesGenerated, in as hexToRgb, j as INNER_STYLES, k as DIMENSION_STYLES, kt as POSITION_CHUNK_STYLES, l as getGlobalKeyframes, lt as resetStyleBatch, m as hasGlobalRecipes, mt as makeKeyframeName, n as getConfig, nn as getNamedColorHex, nt as styleHandlers, o as getGlobalFontFaces, on as strToRgb, ot as flushStyles, p as hasGlobalKeyframes, pt as makeCounterStyleName, q as formatCounterStyleRule, qt as okhstFunction, rn as getRgbValuesFromRgbaString, s as getGlobalFunctions, st as hasPendingStyleWrites, t as configure, tt as defineHandler, u as getGlobalRecipes, ut as DEFAULT_NAME_PREFIX, v as isTestEnvironment, w as BLOCK_INNER_STYLES, wt as CHUNK_NAMES, x as generateTypographyTokens, zt as filterMods } from "./config-B5kHzuNz.js";
2
+ import { A as property, C as getRawCSSText, D as injector, E as injectRawCSS, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, P as resolveFunctionColor, S as getCSSTextForNode, T as injectGlobal, _ as destroy, a as color, b as gc, c as hasKeys, d as collectAutoInferredPropertiesRSC, f as getStyleTarget, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, l as formatKeyframesCSS, m as cleanup, n as processTokens, o as filterBaseProps, p as pushRSCCSS, r as dotize, s as computeStyles, t as tastyDebug, u as collectAutoInferredProperties, v as fontFace, w as inject, x as getCSSText, y as func } from "./core-Dr4u1NVD.js";
3
+ import { l as categorizeStyleKeys } from "./keyframes-CV8azJf3.js";
4
+ import { n as formatPropertyCSS } from "./format-rules-DKOA-6qu.js";
5
+ import { t as mergeStyles } from "./merge-styles-oklji0KB.js";
6
+ import { t as resolveRecipes } from "./resolve-recipes-DTG81rzl.js";
7
+ import { t as getTastySSRContext } from "./context-CA8YKeMn.js";
8
+ import { t as formatGlobalRules } from "./format-global-rules-DklyaXv-.js";
9
+ import { Fragment, createElement, forwardRef, useContext, useInsertionEffect } from "react";
10
10
  //#region src/utils/get-display-name.ts
11
11
  const DEFAULT_NAME = "Anonymous";
12
12
  function getDisplayName(Component, fallbackName = DEFAULT_NAME) {
@@ -106,7 +106,7 @@ function tasty(Component, options) {
106
106
  return tastyElement(Component);
107
107
  }
108
108
  function tastyWrap(Component, options) {
109
- const { as: extendTag, element: extendElement, ...defaultProps } = options ?? {};
109
+ const { as: extendTag, element: extendElement, styleProps: _styleProps, modProps: _modProps, tokenProps: _tokenProps, variants: _variants, elements: _elements, ...defaultProps } = options ?? {};
110
110
  const propsWithStyles = ["styles"].concat(Object.keys(defaultProps).filter((prop) => prop.endsWith("Styles")));
111
111
  const _WrappedComponent = forwardRef((props, ref) => {
112
112
  const { as, element, ...restProps } = props;
@@ -154,14 +154,23 @@ function tastyElement(tastyOptions) {
154
154
  if (!variantStylesMap["default"]) variantStylesMap["default"] = defaultStyles;
155
155
  }
156
156
  const { qa: defaultQa, qaVal: defaultQaVal, ...otherDefaultProps } = defaultProps ?? {};
157
- const propsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
157
+ const ownPropsToCheck = styleProps ? styleProps.concat(BASE_STYLES) : BASE_STYLES;
158
+ let propsToCheck = ownPropsToCheck;
159
+ let propsToCheckVersion = -1;
158
160
  const modPropsKeys = modPropsDef ? Array.isArray(modPropsDef) ? modPropsDef : Object.keys(modPropsDef) : void 0;
159
161
  const tokenPropsMapping = tokenPropsDef ? buildTokenPropsMapping(tokenPropsDef) : void 0;
160
162
  const classNameCache = /* @__PURE__ */ new Map();
161
- const _TastyComponent = forwardRef((allProps, ref) => {
162
- const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, ...otherProps } = allProps;
163
+ const STABLE_STYLES = { stableStyles: true };
164
+ const _TastyComponent = forwardRef((incomingProps, ref) => {
165
+ const applyPropHandlers = propHandlerRegistry.apply;
166
+ const { as, styles: rawStyles, variant, mods, element, qa, qaVal, className: userClassName, tokens, style, theme, ...otherProps } = applyPropHandlers ? applyPropHandlers(incomingProps) : incomingProps;
163
167
  let styles = rawStyles;
164
168
  let propStyles = null;
169
+ if (propsToCheckVersion !== baseStylePropsRegistry.version) {
170
+ const promoted = baseStylePropsRegistry.list;
171
+ propsToCheck = promoted.length === 0 ? ownPropsToCheck : ownPropsToCheck.concat(promoted);
172
+ propsToCheckVersion = baseStylePropsRegistry.version;
173
+ }
165
174
  for (const prop of propsToCheck) {
166
175
  const key = prop;
167
176
  if (key in otherProps) {
@@ -198,7 +207,7 @@ function tastyElement(tastyOptions) {
198
207
  stylesResult = { className: classNameCache.get(allStyles) };
199
208
  touch(stylesResult.className);
200
209
  } else {
201
- stylesResult = computeStyles(allStyles);
210
+ stylesResult = computeStyles(allStyles, !useFactoryCache && allStyles === baseStyles ? STABLE_STYLES : void 0);
202
211
  if (useFactoryCache && allStyles === baseStyles) classNameCache.set(allStyles, stylesResult.className);
203
212
  }
204
213
  let mergedTokens;
@@ -228,6 +237,7 @@ function tastyElement(tastyOptions) {
228
237
  "data-element": element || defaultElement,
229
238
  "data-qa": qa || defaultQa,
230
239
  "data-qaval": qaVal || defaultQaVal,
240
+ "data-theme": theme,
231
241
  ...otherDefaultProps,
232
242
  ...modDataAttrs || {},
233
243
  ...otherProps,
@@ -236,6 +246,7 @@ function tastyElement(tastyOptions) {
236
246
  ref
237
247
  };
238
248
  handleIsProperties(elementProps);
249
+ if (elementProps["data-theme"] === void 0) delete elementProps["data-theme"];
239
250
  const el = createElement(as ?? originalAs, elementProps);
240
251
  if (stylesResult.css) {
241
252
  const nonce = getConfig().nonce;
@@ -287,8 +298,41 @@ function useStyles(styles, options) {
287
298
  });
288
299
  }
289
300
  //#endregion
301
+ //#region src/utils/client-state.ts
302
+ /**
303
+ * Build a per-(injector, root) client state cache for the standalone style
304
+ * functions (`useGlobalStyles`, `useRawCSS`, `useKeyframes`, `useCounterStyle`).
305
+ *
306
+ * Two levels, both weak:
307
+ *
308
+ * - **injector** — `configure()` replaces the global injector, and every dispose
309
+ * handle and generated name we cache belongs to the one that produced it.
310
+ * Keying by injector makes stale state fall away with it, instead of letting
311
+ * change-detection keys suppress re-injection into the new sheets.
312
+ * - **root** — the same selector or slot name can be used in several shadow
313
+ * roots, and each holds its own injection.
314
+ */
315
+ function createClientState(create) {
316
+ const byInjector = /* @__PURE__ */ new WeakMap();
317
+ return (root) => {
318
+ const injector = getGlobalInjector();
319
+ let byRoot = byInjector.get(injector);
320
+ if (!byRoot) {
321
+ byRoot = /* @__PURE__ */ new WeakMap();
322
+ byInjector.set(injector, byRoot);
323
+ }
324
+ let state = byRoot.get(root);
325
+ if (!state) {
326
+ state = create();
327
+ byRoot.set(root, state);
328
+ }
329
+ return state;
330
+ };
331
+ }
332
+ //#endregion
290
333
  //#region src/hooks/useGlobalStyles.ts
291
- const clientGlobalEntries = /* @__PURE__ */ new Map();
334
+ const getClientGlobalSlots = createClientState(() => /* @__PURE__ */ new Map());
335
+ const noop = () => {};
292
336
  /**
293
337
  * Inject global styles for a given selector.
294
338
  * Useful for styling elements by selector without generating classNames.
@@ -302,6 +346,10 @@ const clientGlobalEntries = /* @__PURE__ */ new Map();
302
346
  * Use the `id` option for update tracking when styles change over the
303
347
  * component lifecycle.
304
348
  *
349
+ * Update tracking is per-slot and per-root: a slot (`id`, or the selector when
350
+ * no `id` is given) holds exactly one injection per `root`. Changing the styles
351
+ * replaces it; rendering styles that produce no CSS clears it.
352
+ *
305
353
  * @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')
306
354
  * @param styles - Tasty styles object
307
355
  * @param options - Optional settings including `id` for update tracking
@@ -326,21 +374,29 @@ function useGlobalStyles(selector, styles, options) {
326
374
  return;
327
375
  }
328
376
  const target = getStyleTarget();
329
- if (target.mode === "client") {
330
- const slotKey = options?.id ?? selector;
331
- const stylesKey = JSON.stringify(styles);
332
- const existing = clientGlobalEntries.get(slotKey);
333
- if (existing && existing.stylesKey === stylesKey) return;
334
- }
377
+ const slots = target.mode === "client" ? getClientGlobalSlots(options?.root ?? document) : null;
378
+ const slotKey = options?.id ?? selector;
379
+ const stylesKey = slots ? JSON.stringify(styles) : "";
380
+ const existing = slots?.get(slotKey);
381
+ if (existing && existing.stylesKey === stylesKey) return;
335
382
  const resolvedStyles = resolveRecipes(styles);
336
383
  const styleResults = renderStyles(resolvedStyles, selector);
337
- if (styleResults.length === 0) return;
384
+ if (styleResults.length === 0) {
385
+ if (slots) {
386
+ existing?.dispose();
387
+ slots.set(slotKey, {
388
+ stylesKey,
389
+ dispose: noop
390
+ });
391
+ }
392
+ return;
393
+ }
338
394
  if (target.mode === "ssr") {
339
395
  target.collector.collectInternals();
340
396
  const css = formatGlobalRules(styleResults);
341
397
  if (css) {
342
398
  const key = options?.id ? `global:${options.id}` : `global:${selector}:${hashString(css)}`;
343
- target.collector.collectGlobalStyles(key, css);
399
+ target.collector.collectGlobalStyles(key, css, options?.id != null);
344
400
  }
345
401
  if (getConfig().autoPropertyTypes !== false) collectAutoInferredProperties(styleResults, target.collector, resolvedStyles);
346
402
  return;
@@ -349,19 +405,19 @@ function useGlobalStyles(selector, styles, options) {
349
405
  const css = formatGlobalRules(styleResults);
350
406
  if (css) {
351
407
  const key = options?.id ? `__global:${options.id}` : `__global:${selector}:${hashString(css)}`;
352
- pushRSCCSS(target.cache, key, css);
408
+ pushRSCCSS(target.cache, key, css, options?.id != null);
353
409
  }
354
410
  if (getConfig().autoPropertyTypes !== false) collectAutoInferredPropertiesRSC(styleResults, target.cache, resolvedStyles);
355
411
  return;
356
412
  }
357
- const slotKey = options?.id ?? selector;
358
- const existing = clientGlobalEntries.get(slotKey);
359
- if (existing) existing.dispose();
360
- const { dispose } = injectGlobal(styleResults, { root: options?.root });
361
- clientGlobalEntries.set(slotKey, {
362
- stylesKey: JSON.stringify(styles),
363
- dispose
364
- });
413
+ if (slots) {
414
+ existing?.dispose();
415
+ const { dispose } = injectGlobal(styleResults, { root: options?.root });
416
+ slots.set(slotKey, {
417
+ stylesKey,
418
+ dispose
419
+ });
420
+ }
365
421
  }
366
422
  //#endregion
367
423
  //#region src/utils/deps-equal.ts
@@ -377,9 +433,11 @@ function depsEqual(a, b) {
377
433
  }
378
434
  //#endregion
379
435
  //#region src/hooks/useRawCSS.ts
380
- const clientEntries = /* @__PURE__ */ new Map();
381
- const clientContentDedup = /* @__PURE__ */ new Set();
382
- const factoryDepsCache$1 = /* @__PURE__ */ new Map();
436
+ const getClientState$1 = createClientState(() => ({
437
+ entries: /* @__PURE__ */ new Map(),
438
+ contentDedup: /* @__PURE__ */ new Set(),
439
+ factoryDeps: /* @__PURE__ */ new Map()
440
+ }));
383
441
  /**
384
442
  * Inject raw CSS text directly without parsing.
385
443
  * This is a low-overhead alternative for injecting global CSS that doesn't need tasty processing.
@@ -435,53 +493,59 @@ function useRawCSS(cssOrFactory, depsOrOptions, options) {
435
493
  const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
436
494
  const opts = isFactory ? options : depsOrOptions;
437
495
  const target = getStyleTarget();
438
- if (isFactory && deps && opts?.id && target.mode === "client") {
439
- const cachedDeps = factoryDepsCache$1.get(opts.id);
496
+ const state = target.mode === "client" ? getClientState$1(opts?.root ?? document) : null;
497
+ if (isFactory && deps && opts?.id && state) {
498
+ const cachedDeps = state.factoryDeps.get(opts.id);
440
499
  if (cachedDeps && depsEqual(cachedDeps, deps)) return;
441
500
  }
442
501
  const css = isFactory ? cssOrFactory() : cssOrFactory;
443
502
  if (!css.trim()) return;
444
503
  if (target.mode === "ssr") {
445
504
  const key = opts?.id ? `raw:${opts.id}` : `raw:${hashString(css)}`;
446
- target.collector.collectRawCSS(key, css);
505
+ target.collector.collectRawCSS(key, css, opts?.id != null);
447
506
  return;
448
507
  }
449
508
  if (target.mode === "rsc") {
450
509
  const key = opts?.id ? `__raw:${opts.id}` : `__raw:${hashString(css)}`;
451
- pushRSCCSS(target.cache, key, css);
510
+ pushRSCCSS(target.cache, key, css, opts?.id != null);
452
511
  return;
453
512
  }
513
+ if (!state) return;
454
514
  const id = opts?.id;
455
515
  if (id) {
456
- const existing = clientEntries.get(id);
516
+ const existing = state.entries.get(id);
457
517
  if (existing) {
458
518
  if (existing.contentKey === css) return;
459
519
  existing.dispose();
460
520
  }
461
521
  const { dispose } = injectRawCSS(css, opts);
462
- clientEntries.set(id, {
522
+ state.entries.set(id, {
463
523
  contentKey: css,
464
524
  dispose
465
525
  });
466
- if (deps) factoryDepsCache$1.set(id, deps);
526
+ if (deps) state.factoryDeps.set(id, deps);
467
527
  } else {
468
528
  const contentKey = hashString(css);
469
- if (clientContentDedup.has(contentKey)) return;
470
- clientContentDedup.add(contentKey);
529
+ if (state.contentDedup.has(contentKey)) return;
530
+ state.contentDedup.add(contentKey);
471
531
  injectRawCSS(css, opts);
472
532
  }
473
533
  }
474
534
  //#endregion
475
535
  //#region src/hooks/useKeyframes.ts
476
- const clientContentToName$1 = /* @__PURE__ */ new Map();
477
- const factoryDepsCache = /* @__PURE__ */ new Map();
536
+ const getClientState = createClientState(() => ({
537
+ contentToName: /* @__PURE__ */ new Map(),
538
+ namedSlots: /* @__PURE__ */ new Map(),
539
+ factoryDeps: /* @__PURE__ */ new Map()
540
+ }));
478
541
  function useKeyframes(stepsOrFactory, depsOrOptions, options) {
479
542
  const isFactory = typeof stepsOrFactory === "function";
480
543
  const deps = isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : void 0;
481
544
  const opts = isFactory ? options : depsOrOptions;
482
545
  const target = getStyleTarget();
483
- if (isFactory && deps && opts?.name && target.mode === "client") {
484
- const cached = factoryDepsCache.get(opts.name);
546
+ const clientState = target.mode === "client" ? getClientState(opts?.root ?? document) : null;
547
+ if (isFactory && deps && opts?.name && clientState) {
548
+ const cached = clientState.factoryDeps.get(opts.name);
485
549
  if (cached && depsEqual(cached.deps, deps)) return cached.name;
486
550
  }
487
551
  const steps = isFactory ? stepsOrFactory() : stepsOrFactory;
@@ -497,25 +561,42 @@ function useKeyframes(stepsOrFactory, depsOrOptions, options) {
497
561
  const key = `__kf:${opts?.name ?? ""}:${serializedContent}`;
498
562
  const existingName = target.cache.generatedNames.get(key);
499
563
  if (existingName) return existingName;
500
- const actualName = opts?.name ?? `k${hashString(serializedContent)}`;
564
+ const actualName = opts?.name ?? makeKeyframeName(getNamePrefix(), hashString(serializedContent));
501
565
  const css = formatKeyframesCSS(actualName, steps);
502
566
  pushRSCCSS(target.cache, key, css);
503
567
  target.cache.generatedNames.set(key, actualName);
504
568
  return actualName;
505
569
  }
570
+ const state = clientState ?? getClientState(opts?.root ?? document);
506
571
  const serializedContent = JSON.stringify(steps);
507
572
  const cacheKey = `${opts?.name ?? ""}:${serializedContent}`;
508
- const cachedName = clientContentToName$1.get(cacheKey);
573
+ const cachedName = state.contentToName.get(cacheKey);
509
574
  if (cachedName) return cachedName;
510
- const name = keyframes(steps, {
511
- name: opts?.name,
575
+ const providedName = opts?.name;
576
+ if (providedName) {
577
+ const slot = state.namedSlots.get(providedName);
578
+ if (slot && slot.cacheKey !== cacheKey) {
579
+ slot.dispose();
580
+ state.contentToName.delete(slot.cacheKey);
581
+ state.namedSlots.delete(providedName);
582
+ }
583
+ }
584
+ const result = keyframes(steps, {
585
+ name: providedName,
512
586
  root: opts?.root
513
- }).toString();
514
- clientContentToName$1.set(cacheKey, name);
515
- if (deps && opts?.name) factoryDepsCache.set(opts.name, {
516
- deps,
517
- name
518
587
  });
588
+ const name = result.toString();
589
+ state.contentToName.set(cacheKey, name);
590
+ if (providedName) {
591
+ state.namedSlots.set(providedName, {
592
+ cacheKey,
593
+ dispose: result.dispose
594
+ });
595
+ if (deps) state.factoryDeps.set(providedName, {
596
+ deps,
597
+ name
598
+ });
599
+ }
519
600
  return name;
520
601
  }
521
602
  //#endregion
@@ -671,7 +752,7 @@ function useFontFace(family, input, options) {
671
752
  //#endregion
672
753
  //#region src/hooks/useCounterStyle.ts
673
754
  let clientCounterStyleCounter = 0;
674
- const clientContentToName = /* @__PURE__ */ new Map();
755
+ const getClientContentToName = createClientState(() => /* @__PURE__ */ new Map());
675
756
  /**
676
757
  * Inject a CSS @counter-style rule and return the generated name.
677
758
  * Permanent — no cleanup on unmount. Deduplicates by name.
@@ -711,22 +792,131 @@ function useCounterStyle(descriptors, options) {
711
792
  const key = `__cs:${options?.name ?? ""}:${serializedContent}`;
712
793
  const existingName = target.cache.generatedNames.get(key);
713
794
  if (existingName) return existingName;
714
- const actualName = options?.name ?? `cs${hashString(serializedContent)}`;
795
+ const actualName = options?.name ?? makeCounterStyleName(getNamePrefix(), hashString(serializedContent));
715
796
  const css = formatCounterStyleRule(actualName, descriptors);
716
797
  pushRSCCSS(target.cache, key, css);
717
798
  target.cache.generatedNames.set(key, actualName);
718
799
  return actualName;
719
800
  }
801
+ const contentToName = getClientContentToName(options?.root ?? document);
720
802
  const serializedContent = JSON.stringify(descriptors);
721
803
  const cacheKey = `${options?.name ?? ""}:${serializedContent}`;
722
- const existingName = clientContentToName.get(cacheKey);
804
+ const existingName = contentToName.get(cacheKey);
723
805
  if (existingName) return existingName;
724
- const name = options?.name ?? `cs${clientCounterStyleCounter++}`;
725
- clientContentToName.set(cacheKey, name);
806
+ const name = options?.name ?? makeCounterStyleName(getNamePrefix(), String(clientCounterStyleCounter++));
807
+ contentToName.set(cacheKey, name);
726
808
  getGlobalInjector().counterStyle(name, descriptors, { root: options?.root });
727
809
  return name;
728
810
  }
729
811
  //#endregion
730
- export { BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, Bucket, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DIMENSION_STYLES, DIRECTIONS, Element, FLOW_STYLES, INNER_STYLES, OUTER_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createInjector, createStateParserContext, customFunc, deprecationWarning, destroy, dotize, filterBaseProps, filterMods, fontFace, gc, generateTypographyTokens, getConfig, getCssText, getCssTextForNode, getDisplayName, getGlobalCounterStyle, getGlobalFontFace, getGlobalFuncs, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getIsTestEnvironment, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunc, okhslPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetGlobalPredefinedTokens, resolveRecipes, setGlobalPredefinedStates, setGlobalPredefinedTokens, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles, warn };
812
+ //#region src/hooks/useFunction.ts
813
+ /**
814
+ * Register a CSS @function (custom function).
815
+ *
816
+ * @function rules are global and persistent once defined. The hook ensures the
817
+ * function is only registered once per root (deduplicated by function name).
818
+ *
819
+ * Accepts tasty token syntax for the function name:
820
+ * - `$$name` → defines `--name` (matches the call site `$$name(...)`)
821
+ * - `$name` / `--name` → also accepted
822
+ *
823
+ * Works in all environments: client, SSR with collector, and React Server Components.
824
+ *
825
+ * @param name - The function name token (`$$name`, `$name`, or `--name`)
826
+ * @param definition - Function definition (args, returns, result, local vars)
827
+ *
828
+ * Call the function through the Tasty DSL, not a raw `style` prop: an inline
829
+ * `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never
830
+ * expanded and `polyfills.functions` cannot rewrite it either.
831
+ *
832
+ * @example
833
+ * ```tsx
834
+ * const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });
835
+ *
836
+ * function Layout() {
837
+ * useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });
838
+ * return <Box />;
839
+ * }
840
+ * ```
841
+ */
842
+ function useFunction(name, definition, options) {
843
+ if (!name) {
844
+ console.warn(`[Tasty] useFunction: function name is required`);
845
+ return;
846
+ }
847
+ if (isFunctionsPolyfillEnabled()) {
848
+ registerFunctionPolyfill(name, definition);
849
+ return;
850
+ }
851
+ const target = getStyleTarget();
852
+ if (target.mode === "ssr") {
853
+ target.collector.collectInternals();
854
+ const css = formatFunctionRule(name, definition);
855
+ if (css) target.collector.collectFunction(parseFunctionName(name), css);
856
+ return;
857
+ }
858
+ if (target.mode === "rsc") {
859
+ const css = formatFunctionRule(name, definition);
860
+ if (css) pushRSCCSS(target.cache, `__func:${parseFunctionName(name)}`, css);
861
+ return;
862
+ }
863
+ getGlobalInjector().func(name, definition, { root: options?.root });
864
+ }
865
+ //#endregion
866
+ //#region src/batch-provider.tsx
867
+ /**
868
+ * Opens a *batch window* for the commit it renders in, so `batchInjection`
869
+ * can defer stylesheet writes without ever letting a layout effect measure an
870
+ * unstyled element.
871
+ *
872
+ * Every `insertRule()` on a live sheet invalidates style for that sheet's
873
+ * scope. When components inject during React's render phase while others read
874
+ * layout in the same pass, the two interleave and the browser recalculates
875
+ * style between every injection. Batching collapses that into one invalidation
876
+ * per flush — but only if the flush happens before anything can measure.
877
+ *
878
+ * ```
879
+ * provider renders -> window OPEN
880
+ * children render -> injections queued
881
+ * provider insertionEffect -> FLUSH, window CLOSED
882
+ * layout effects run -> rules are in the sheet
883
+ * ```
884
+ *
885
+ * `useInsertionEffect` runs in React's mutation phase, after every render in
886
+ * the commit and before any `useLayoutEffect` — which is exactly why React
887
+ * added it for CSS-in-JS libraries. Effects fire child-first, so this
888
+ * provider's runs after every descendant's and still before all layout
889
+ * effects.
890
+ *
891
+ * A commit that does not re-render this provider gets no window, and those
892
+ * injections are written synchronously instead. That is the point: turning
893
+ * `batchInjection: true` on can only ever make injection cheaper, never make a
894
+ * measurement wrong. It also means batching applies to commits this provider
895
+ * takes part in, so mount it as high in the tree as you can.
896
+ *
897
+ * Requires `configure({ batchInjection: true })`; without it this component
898
+ * only renders its children. `batchInjection: 'always'` does not need the
899
+ * provider at all — see that option's docs for the trade-off it accepts.
900
+ *
901
+ * @example
902
+ * ```tsx
903
+ * configure({ batchInjection: true });
904
+ *
905
+ * createRoot(el).render(
906
+ * <TastyBatchProvider>
907
+ * <App />
908
+ * </TastyBatchProvider>,
909
+ * );
910
+ * ```
911
+ */
912
+ function TastyBatchProvider({ children }) {
913
+ openBatchWindow();
914
+ useInsertionEffect(() => {
915
+ closeBatchWindow();
916
+ });
917
+ return children;
918
+ }
919
+ //#endregion
920
+ export { APPEARANCE_CHUNK_STYLES, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, CUSTOM_UNITS, ChunkSheetRegistry, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, Element, FLOW_STYLES, FONT_CHUNK_STYLES, INNER_STYLES, LAYOUT_CHUNK_STYLES, OUTER_STYLES, POSITION_CHUNK_STYLES, POSITION_STYLES, STYLE_TO_CHUNK, SheetManager, StyleInjector, StyleParser, TEXT_STYLES, TastyBatchProvider, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, flushStyles, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasPendingStyleWrites, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resetStyleBatch, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
731
921
 
732
922
  //# sourceMappingURL=index.js.map