@tenphi/tasty 0.0.0-snapshot.9f4e1c4 → 0.0.0-snapshot.9f8fdf9

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 (62) hide show
  1. package/README.md +6 -6
  2. package/dist/{babel-types-BKDTT4--.d.ts → babel-types-Dc5zghyE.d.ts} +2 -2
  3. package/dist/chunks/{build-config-5d8WlQbq.js → build-config-D9Iq8QQm.js} +5 -5
  4. package/dist/chunks/{build-config-5d8WlQbq.js.map → build-config-D9Iq8QQm.js.map} +1 -1
  5. package/dist/chunks/{collector-CjCak4iE.js → collector-Cb8ah2JF.js} +4 -4
  6. package/dist/chunks/{collector-CjCak4iE.js.map → collector-Cb8ah2JF.js.map} +1 -1
  7. package/dist/chunks/{config-engine-uOFYZidB.js → config-engine-CMYFZYQh.js} +5 -5
  8. package/dist/chunks/config-engine-CMYFZYQh.js.map +1 -0
  9. package/dist/chunks/{css-definitions-ubrHP97m.js → css-definitions-B4aWBkH3.js} +3 -3
  10. package/dist/chunks/{css-definitions-ubrHP97m.js.map → css-definitions-B4aWBkH3.js.map} +1 -1
  11. package/dist/chunks/{debug-CJ31U_WE.js → debug-D2Pu7Xhy.js} +4 -4
  12. package/dist/chunks/{debug-CJ31U_WE.js.map → debug-D2Pu7Xhy.js.map} +1 -1
  13. package/dist/chunks/{dsl-DYSJc1-T.js → dsl-CsFl9LGn.js} +122 -47
  14. package/dist/chunks/dsl-CsFl9LGn.js.map +1 -0
  15. package/dist/chunks/{react-runtime-CyyCI02N.js → react-runtime-DHiopXCu.js} +8 -6
  16. package/dist/chunks/react-runtime-DHiopXCu.js.map +1 -0
  17. package/dist/chunks/{runtime-engine-BQmOu5-W.js → runtime-engine-NGCofNXy.js} +9 -6
  18. package/dist/chunks/runtime-engine-NGCofNXy.js.map +1 -0
  19. package/dist/chunks/{runtime-state-DEsyUMU-.js → runtime-state-lZjMbvwV.js} +2 -2
  20. package/dist/chunks/{runtime-state-DEsyUMU-.js.map → runtime-state-lZjMbvwV.js.map} +1 -1
  21. package/dist/chunks/{style-engine-BX2LshDZ.js → style-engine-DnkV_4Jg.js} +188 -52
  22. package/dist/chunks/style-engine-DnkV_4Jg.js.map +1 -0
  23. package/dist/chunks/{zero-engine-Dw0P4yGM.js → zero-engine-DcwaCvFs.js} +5 -5
  24. package/dist/chunks/{zero-engine-Dw0P4yGM.js.map → zero-engine-DcwaCvFs.js.map} +1 -1
  25. package/dist/{collector-CTU-nl0g.d.ts → collector-D2OT6I2G.d.ts} +2 -2
  26. package/dist/{config-CcxqSZI2.d.ts → config-C4ftFxgI.d.ts} +8 -9
  27. package/dist/core/index.d.ts +4 -4
  28. package/dist/core/index.js +7 -7
  29. package/dist/{index--GdqCPlp.d.ts → index-DxQNRj50.d.ts} +12 -10
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +8 -8
  32. package/dist/{merge-styles-DSkVc6CD.d.ts → merge-styles-D39qBtox.d.ts} +2 -2
  33. package/dist/ssr/astro.js +2 -2
  34. package/dist/ssr/index.d.ts +1 -1
  35. package/dist/ssr/index.js +2 -2
  36. package/dist/ssr/next-config.d.ts +1 -1
  37. package/dist/ssr/next-config.js +3 -3
  38. package/dist/ssr/next.d.ts +1 -1
  39. package/dist/ssr/next.js +3 -3
  40. package/dist/static/index.d.ts +2 -2
  41. package/dist/{types-DJEM_BOJ.d.ts → types-CYQIhUg1.d.ts} +5 -3
  42. package/dist/zero/babel.d.ts +9 -3
  43. package/dist/zero/babel.js +8 -8
  44. package/dist/zero/babel.js.map +1 -1
  45. package/dist/zero/index.d.ts +4 -3
  46. package/dist/zero/index.js +5 -4
  47. package/dist/zero/index.js.map +1 -1
  48. package/dist/zero/next.d.ts +1 -1
  49. package/docs/ai-agents.md +6 -2
  50. package/docs/configuration.md +12 -10
  51. package/docs/dsl.md +122 -42
  52. package/docs/pipeline.md +1 -1
  53. package/docs/react-api.md +9 -5
  54. package/docs/styles.md +53 -3
  55. package/docs/tasty-static.md +21 -7
  56. package/package.json +32 -33
  57. package/tasty.config.ts +1 -0
  58. package/dist/chunks/config-engine-uOFYZidB.js.map +0 -1
  59. package/dist/chunks/dsl-DYSJc1-T.js.map +0 -1
  60. package/dist/chunks/react-runtime-CyyCI02N.js.map +0 -1
  61. package/dist/chunks/runtime-engine-BQmOu5-W.js.map +0 -1
  62. package/dist/chunks/style-engine-BX2LshDZ.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { P as DEFAULT_PROPERTIES, R as indexPropertiesByName } from "./css-definitions-ubrHP97m.js";
1
+ import { P as DEFAULT_PROPERTIES, R as indexPropertiesByName } from "./css-definitions-B4aWBkH3.js";
2
2
  //#region src/config-resources.ts
3
3
  let runtimeConfig = null;
4
4
  let globalFontFace = null;
@@ -149,4 +149,4 @@ function getRegisteredSSRCollector() {
149
149
  //#endregion
150
150
  export { mergeGlobalKeyframes as _, getEffectivePropertiesByName as a, resetConfigResources as b, getGlobalFontFaces as c, getGlobalStyles as d, getRuntimeConfigState as f, mergeGlobalFunctions as g, mergeGlobalFontFaces as h, getEffectiveProperties as i, getGlobalFunctions as l, mergeGlobalCounterStyles as m, registerSSRCollectorGetter as n, getGlobalConfigTokens as o, mergeGlobalConfigTokens as p, registerSSRCollectorGetterGlobal as r, getGlobalCounterStyles as s, getRegisteredSSRCollector as t, getGlobalKeyframes as u, mergeGlobalProperties as v, setRuntimeConfigState as x, mergeGlobalStyles as y };
151
151
 
152
- //# sourceMappingURL=runtime-state-DEsyUMU-.js.map
152
+ //# sourceMappingURL=runtime-state-lZjMbvwV.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime-state-DEsyUMU-.js","names":[],"sources":["../../src/config-resources.ts","../../src/ssr/ssr-collector-ref.ts"],"sourcesContent":["/**\n * DOM-free storage for configured CSS resources shared by the browser runtime\n * and server collectors.\n *\n * Astro can evaluate middleware and application code in separate module\n * graphs, so resources used by SSR are mirrored on globalThis. Keeping this\n * state outside config.ts lets server-only entrypoints read it without loading\n * StyleInjector and the rest of the browser runtime.\n */\n\nimport type {\n CounterStyleDescriptors,\n FontFaceInput,\n FunctionDefinition,\n KeyframesSteps,\n PropertyDefinition,\n} from './injector/types';\nimport type { DeclaredPropertyEntry } from './properties';\nimport { indexPropertiesByName } from './properties';\nimport { DEFAULT_PROPERTIES } from './properties/defaults';\nimport type { ConfigTokens, Styles } from './styles/types';\n\ninterface RuntimeConfigState {\n namePrefix?: string;\n nonce?: string;\n}\n\nlet runtimeConfig: RuntimeConfigState | null = null;\nlet globalFontFace: Record<string, FontFaceInput> | null = null;\nlet globalCounterStyle: Record<string, CounterStyleDescriptors> | null = null;\nlet globalFunction: Record<string, FunctionDefinition> | null = null;\nlet globalProperties: Record<string, PropertyDefinition> | null = null;\nlet globalConfigTokens: ConfigTokens | null = null;\nlet globalStyles: Record<string, Styles> | null = null;\nlet globalKeyframes: Record<string, KeyframesSteps> | null = null;\n\nconst GTKEY_TOKENS = '__tasty_cfg_tokens__';\nconst GTKEY_FONT_FACE = '__tasty_cfg_font_face__';\nconst GTKEY_COUNTER_STYLE = '__tasty_cfg_counter_style__';\nconst GTKEY_FUNCTION = '__tasty_cfg_function__';\nconst GTKEY_PROPERTIES = '__tasty_cfg_properties__';\nconst GTKEY_GLOBAL_STYLES = '__tasty_cfg_global_styles__';\nconst GTKEY_KEYFRAMES = '__tasty_cfg_keyframes__';\n\nfunction setOnGlobalThis(key: string, value: unknown): void {\n (globalThis as Record<string, unknown>)[key] = value;\n}\n\nfunction getFromGlobalThis<T>(key: string): T | undefined {\n return (globalThis as Record<string, unknown>)[key] as T | undefined;\n}\n\nexport function getRuntimeConfigState(): RuntimeConfigState | null {\n return runtimeConfig;\n}\n\nexport function setRuntimeConfigState(config: RuntimeConfigState): void {\n runtimeConfig = config;\n}\n\nexport function getEffectiveProperties(): Record<string, PropertyDefinition> {\n const properties =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n return properties\n ? { ...DEFAULT_PROPERTIES, ...properties }\n : DEFAULT_PROPERTIES;\n}\n\nlet effectivePropertyIndex: {\n source: Record<string, PropertyDefinition> | null | undefined;\n index: ReadonlyMap<string, DeclaredPropertyEntry>;\n} | null = null;\n\n/**\n * The effective properties (Tasty's defaults and `configure({ properties })`)\n * keyed by the custom property each one registers — see\n * `indexPropertiesByName()`. Rebuilt only when `configure({ properties })`\n * replaces the set.\n */\nexport function getEffectivePropertiesByName(): ReadonlyMap<\n string,\n DeclaredPropertyEntry\n> {\n const source =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n\n if (effectivePropertyIndex && effectivePropertyIndex.source === source) {\n return effectivePropertyIndex.index;\n }\n\n const index = indexPropertiesByName(getEffectiveProperties());\n effectivePropertyIndex = { source, index };\n return index;\n}\n\nexport function getGlobalFontFaces(): Record<string, FontFaceInput> | null {\n return (\n globalFontFace ??\n getFromGlobalThis<Record<string, FontFaceInput>>(GTKEY_FONT_FACE) ??\n null\n );\n}\n\nexport function getGlobalCounterStyles(): Record<\n string,\n CounterStyleDescriptors\n> | null {\n return (\n globalCounterStyle ??\n getFromGlobalThis<Record<string, CounterStyleDescriptors>>(\n GTKEY_COUNTER_STYLE,\n ) ??\n null\n );\n}\n\nexport function getGlobalFunctions(): Record<\n string,\n FunctionDefinition\n> | null {\n return (\n globalFunction ??\n getFromGlobalThis<Record<string, FunctionDefinition>>(GTKEY_FUNCTION) ??\n null\n );\n}\n\nexport function getGlobalConfigTokens(): ConfigTokens | null {\n return (\n globalConfigTokens ?? getFromGlobalThis<ConfigTokens>(GTKEY_TOKENS) ?? null\n );\n}\n\nexport function getGlobalStyles(): Record<string, Styles> | null {\n return (\n globalStyles ??\n getFromGlobalThis<Record<string, Styles>>(GTKEY_GLOBAL_STYLES) ??\n null\n );\n}\n\n/**\n * Get global keyframes configuration.\n * Returns null if no keyframes configured (fast path for zero-overhead).\n */\nexport function getGlobalKeyframes(): Record<string, KeyframesSteps> | null {\n return (\n globalKeyframes ??\n getFromGlobalThis<Record<string, KeyframesSteps>>(GTKEY_KEYFRAMES) ??\n null\n );\n}\n\nexport function mergeGlobalProperties(\n properties: Record<string, PropertyDefinition>,\n): void {\n globalProperties = {\n ...(globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES) ?? {}),\n ...properties,\n };\n setOnGlobalThis(GTKEY_PROPERTIES, globalProperties);\n}\n\nexport function mergeGlobalFontFaces(\n fontFaces: Record<string, FontFaceInput>,\n): void {\n globalFontFace = { ...(getGlobalFontFaces() ?? {}), ...fontFaces };\n setOnGlobalThis(GTKEY_FONT_FACE, globalFontFace);\n}\n\nexport function mergeGlobalCounterStyles(\n counterStyles: Record<string, CounterStyleDescriptors>,\n): void {\n globalCounterStyle = {\n ...(getGlobalCounterStyles() ?? {}),\n ...counterStyles,\n };\n setOnGlobalThis(GTKEY_COUNTER_STYLE, globalCounterStyle);\n}\n\nexport function mergeGlobalFunctions(\n functions: Record<string, FunctionDefinition>,\n): void {\n globalFunction = { ...(getGlobalFunctions() ?? {}), ...functions };\n setOnGlobalThis(GTKEY_FUNCTION, globalFunction);\n}\n\nexport function mergeGlobalConfigTokens(styles: ConfigTokens): void {\n globalConfigTokens = globalConfigTokens\n ? { ...globalConfigTokens, ...styles }\n : styles;\n setOnGlobalThis(GTKEY_TOKENS, globalConfigTokens);\n}\n\nexport function mergeGlobalStyles(styles: Record<string, Styles>): void {\n if (globalStyles) {\n for (const [selector, selectorStyles] of Object.entries(styles)) {\n globalStyles[selector] = globalStyles[selector]\n ? { ...globalStyles[selector], ...selectorStyles }\n : selectorStyles;\n }\n } else {\n globalStyles = { ...styles };\n }\n setOnGlobalThis(GTKEY_GLOBAL_STYLES, globalStyles);\n}\n\nexport function mergeGlobalKeyframes(\n keyframes: Record<string, KeyframesSteps>,\n): void {\n globalKeyframes = { ...(getGlobalKeyframes() ?? {}), ...keyframes };\n setOnGlobalThis(GTKEY_KEYFRAMES, globalKeyframes);\n}\n\nexport function resetConfigResources(): void {\n runtimeConfig = null;\n globalProperties = null;\n globalFontFace = null;\n globalCounterStyle = null;\n globalFunction = null;\n globalConfigTokens = null;\n globalStyles = null;\n globalKeyframes = null;\n\n const globalState = globalThis as Record<string, unknown>;\n delete globalState[GTKEY_TOKENS];\n delete globalState[GTKEY_FONT_FACE];\n delete globalState[GTKEY_COUNTER_STYLE];\n delete globalState[GTKEY_FUNCTION];\n delete globalState[GTKEY_PROPERTIES];\n delete globalState[GTKEY_GLOBAL_STYLES];\n delete globalState[GTKEY_KEYFRAMES];\n}\n","/**\n * Global reference to the SSR collector getter function.\n *\n * This indirection avoids importing 'node:async_hooks' in the browser bundle.\n * The SSR entry point sets this ref when loaded on the server. The useStyles\n * hook calls it if set; on the client it stays null and is never called.\n *\n * Uses a module-level variable as the primary mechanism. In Next.js App\n * Router the RSC and SSR module graphs load separate copies of this module,\n * so the getter registered by TastyRegistry (SSR layer) is invisible to\n * server components (RSC layer) — which correctly fall through to inline\n * RSC styles.\n *\n * A globalThis fallback (`registerSSRCollectorGetterGlobal`) is provided\n * for frameworks like Astro where middleware and page components live in\n * different module graphs and must share the getter across them.\n */\n\nimport type { ServerStyleCollector } from './collector';\n\ntype SSRCollectorGetter = () => ServerStyleCollector | null;\n\nconst GETTER_KEY = '__tasty_ssr_collector_getter__';\n\nlet _getSSRCollector: SSRCollectorGetter | null = null;\n\n/**\n * Register the collector getter in the current module graph only.\n * Used by Next.js TastyRegistry.\n */\nexport function registerSSRCollectorGetter(fn: SSRCollectorGetter): void {\n _getSSRCollector = fn;\n}\n\n/**\n * Register the collector getter on globalThis so it is visible across\n * separate module graphs (e.g. Astro middleware ↔ page components).\n */\nexport function registerSSRCollectorGetterGlobal(fn: SSRCollectorGetter): void {\n (globalThis as Record<string, unknown>)[GETTER_KEY] = fn;\n}\n\n/**\n * Retrieve the SSR collector: module-level first, globalThis fallback.\n */\nexport function getRegisteredSSRCollector(): ServerStyleCollector | null {\n if (_getSSRCollector) return _getSSRCollector();\n const getter = (globalThis as Record<string, unknown>)[GETTER_KEY] as\n SSRCollectorGetter | undefined;\n return getter ? getter() : null;\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"runtime-state-lZjMbvwV.js","names":[],"sources":["../../src/config-resources.ts","../../src/ssr/ssr-collector-ref.ts"],"sourcesContent":["/**\n * DOM-free storage for configured CSS resources shared by the browser runtime\n * and server collectors.\n *\n * Astro can evaluate middleware and application code in separate module\n * graphs, so resources used by SSR are mirrored on globalThis. Keeping this\n * state outside config.ts lets server-only entrypoints read it without loading\n * StyleInjector and the rest of the browser runtime.\n */\n\nimport type {\n CounterStyleDescriptors,\n FontFaceInput,\n FunctionDefinition,\n KeyframesSteps,\n PropertyDefinition,\n} from './injector/types';\nimport type { DeclaredPropertyEntry } from './properties';\nimport { indexPropertiesByName } from './properties';\nimport { DEFAULT_PROPERTIES } from './properties/defaults';\nimport type { ConfigTokens, Styles } from './styles/types';\n\ninterface RuntimeConfigState {\n namePrefix?: string;\n nonce?: string;\n}\n\nlet runtimeConfig: RuntimeConfigState | null = null;\nlet globalFontFace: Record<string, FontFaceInput> | null = null;\nlet globalCounterStyle: Record<string, CounterStyleDescriptors> | null = null;\nlet globalFunction: Record<string, FunctionDefinition> | null = null;\nlet globalProperties: Record<string, PropertyDefinition> | null = null;\nlet globalConfigTokens: ConfigTokens | null = null;\nlet globalStyles: Record<string, Styles> | null = null;\nlet globalKeyframes: Record<string, KeyframesSteps> | null = null;\n\nconst GTKEY_TOKENS = '__tasty_cfg_tokens__';\nconst GTKEY_FONT_FACE = '__tasty_cfg_font_face__';\nconst GTKEY_COUNTER_STYLE = '__tasty_cfg_counter_style__';\nconst GTKEY_FUNCTION = '__tasty_cfg_function__';\nconst GTKEY_PROPERTIES = '__tasty_cfg_properties__';\nconst GTKEY_GLOBAL_STYLES = '__tasty_cfg_global_styles__';\nconst GTKEY_KEYFRAMES = '__tasty_cfg_keyframes__';\n\nfunction setOnGlobalThis(key: string, value: unknown): void {\n (globalThis as Record<string, unknown>)[key] = value;\n}\n\nfunction getFromGlobalThis<T>(key: string): T | undefined {\n return (globalThis as Record<string, unknown>)[key] as T | undefined;\n}\n\nexport function getRuntimeConfigState(): RuntimeConfigState | null {\n return runtimeConfig;\n}\n\nexport function setRuntimeConfigState(config: RuntimeConfigState): void {\n runtimeConfig = config;\n}\n\nexport function getEffectiveProperties(): Record<string, PropertyDefinition> {\n const properties =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n return properties\n ? { ...DEFAULT_PROPERTIES, ...properties }\n : DEFAULT_PROPERTIES;\n}\n\nlet effectivePropertyIndex: {\n source: Record<string, PropertyDefinition> | null | undefined;\n index: ReadonlyMap<string, DeclaredPropertyEntry>;\n} | null = null;\n\n/**\n * The effective properties (Tasty's defaults and `configure({ properties })`)\n * keyed by the custom property each one registers — see\n * `indexPropertiesByName()`. Rebuilt only when `configure({ properties })`\n * replaces the set.\n */\nexport function getEffectivePropertiesByName(): ReadonlyMap<\n string,\n DeclaredPropertyEntry\n> {\n const source =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n\n if (effectivePropertyIndex && effectivePropertyIndex.source === source) {\n return effectivePropertyIndex.index;\n }\n\n const index = indexPropertiesByName(getEffectiveProperties());\n effectivePropertyIndex = { source, index };\n return index;\n}\n\nexport function getGlobalFontFaces(): Record<string, FontFaceInput> | null {\n return (\n globalFontFace ??\n getFromGlobalThis<Record<string, FontFaceInput>>(GTKEY_FONT_FACE) ??\n null\n );\n}\n\nexport function getGlobalCounterStyles(): Record<\n string,\n CounterStyleDescriptors\n> | null {\n return (\n globalCounterStyle ??\n getFromGlobalThis<Record<string, CounterStyleDescriptors>>(\n GTKEY_COUNTER_STYLE,\n ) ??\n null\n );\n}\n\nexport function getGlobalFunctions(): Record<\n string,\n FunctionDefinition\n> | null {\n return (\n globalFunction ??\n getFromGlobalThis<Record<string, FunctionDefinition>>(GTKEY_FUNCTION) ??\n null\n );\n}\n\nexport function getGlobalConfigTokens(): ConfigTokens | null {\n return (\n globalConfigTokens ?? getFromGlobalThis<ConfigTokens>(GTKEY_TOKENS) ?? null\n );\n}\n\nexport function getGlobalStyles(): Record<string, Styles> | null {\n return (\n globalStyles ??\n getFromGlobalThis<Record<string, Styles>>(GTKEY_GLOBAL_STYLES) ??\n null\n );\n}\n\n/**\n * Get global keyframes configuration.\n * Returns null if no keyframes configured (fast path for zero-overhead).\n */\nexport function getGlobalKeyframes(): Record<string, KeyframesSteps> | null {\n return (\n globalKeyframes ??\n getFromGlobalThis<Record<string, KeyframesSteps>>(GTKEY_KEYFRAMES) ??\n null\n );\n}\n\nexport function mergeGlobalProperties(\n properties: Record<string, PropertyDefinition>,\n): void {\n globalProperties = {\n ...(globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES) ?? {}),\n ...properties,\n };\n setOnGlobalThis(GTKEY_PROPERTIES, globalProperties);\n}\n\nexport function mergeGlobalFontFaces(\n fontFaces: Record<string, FontFaceInput>,\n): void {\n globalFontFace = { ...(getGlobalFontFaces() ?? {}), ...fontFaces };\n setOnGlobalThis(GTKEY_FONT_FACE, globalFontFace);\n}\n\nexport function mergeGlobalCounterStyles(\n counterStyles: Record<string, CounterStyleDescriptors>,\n): void {\n globalCounterStyle = {\n ...(getGlobalCounterStyles() ?? {}),\n ...counterStyles,\n };\n setOnGlobalThis(GTKEY_COUNTER_STYLE, globalCounterStyle);\n}\n\nexport function mergeGlobalFunctions(\n functions: Record<string, FunctionDefinition>,\n): void {\n globalFunction = { ...(getGlobalFunctions() ?? {}), ...functions };\n setOnGlobalThis(GTKEY_FUNCTION, globalFunction);\n}\n\nexport function mergeGlobalConfigTokens(styles: ConfigTokens): void {\n globalConfigTokens = globalConfigTokens\n ? { ...globalConfigTokens, ...styles }\n : styles;\n setOnGlobalThis(GTKEY_TOKENS, globalConfigTokens);\n}\n\nexport function mergeGlobalStyles(styles: Record<string, Styles>): void {\n if (globalStyles) {\n for (const [selector, selectorStyles] of Object.entries(styles)) {\n globalStyles[selector] = globalStyles[selector]\n ? { ...globalStyles[selector], ...selectorStyles }\n : selectorStyles;\n }\n } else {\n globalStyles = { ...styles };\n }\n setOnGlobalThis(GTKEY_GLOBAL_STYLES, globalStyles);\n}\n\nexport function mergeGlobalKeyframes(\n keyframes: Record<string, KeyframesSteps>,\n): void {\n globalKeyframes = { ...(getGlobalKeyframes() ?? {}), ...keyframes };\n setOnGlobalThis(GTKEY_KEYFRAMES, globalKeyframes);\n}\n\nexport function resetConfigResources(): void {\n runtimeConfig = null;\n globalProperties = null;\n globalFontFace = null;\n globalCounterStyle = null;\n globalFunction = null;\n globalConfigTokens = null;\n globalStyles = null;\n globalKeyframes = null;\n\n const globalState = globalThis as Record<string, unknown>;\n delete globalState[GTKEY_TOKENS];\n delete globalState[GTKEY_FONT_FACE];\n delete globalState[GTKEY_COUNTER_STYLE];\n delete globalState[GTKEY_FUNCTION];\n delete globalState[GTKEY_PROPERTIES];\n delete globalState[GTKEY_GLOBAL_STYLES];\n delete globalState[GTKEY_KEYFRAMES];\n}\n","/**\n * Global reference to the SSR collector getter function.\n *\n * This indirection avoids importing 'node:async_hooks' in the browser bundle.\n * The SSR entry point sets this ref when loaded on the server. The useStyles\n * hook calls it if set; on the client it stays null and is never called.\n *\n * Uses a module-level variable as the primary mechanism. In Next.js App\n * Router the RSC and SSR module graphs load separate copies of this module,\n * so the getter registered by TastyRegistry (SSR layer) is invisible to\n * server components (RSC layer) — which correctly fall through to inline\n * RSC styles.\n *\n * A globalThis fallback (`registerSSRCollectorGetterGlobal`) is provided\n * for frameworks like Astro where middleware and page components live in\n * different module graphs and must share the getter across them.\n */\n\nimport type { ServerStyleCollector } from './collector';\n\ntype SSRCollectorGetter = () => ServerStyleCollector | null;\n\nconst GETTER_KEY = '__tasty_ssr_collector_getter__';\n\nlet _getSSRCollector: SSRCollectorGetter | null = null;\n\n/**\n * Register the collector getter in the current module graph only.\n * Used by Next.js TastyRegistry.\n */\nexport function registerSSRCollectorGetter(fn: SSRCollectorGetter): void {\n _getSSRCollector = fn;\n}\n\n/**\n * Register the collector getter on globalThis so it is visible across\n * separate module graphs (e.g. Astro middleware ↔ page components).\n */\nexport function registerSSRCollectorGetterGlobal(fn: SSRCollectorGetter): void {\n (globalThis as Record<string, unknown>)[GETTER_KEY] = fn;\n}\n\n/**\n * Retrieve the SSR collector: module-level first, globalThis fallback.\n */\nexport function getRegisteredSSRCollector(): ServerStyleCollector | null {\n if (_getSSRCollector) return _getSSRCollector();\n const getter = (globalThis as Record<string, unknown>)[GETTER_KEY] as\n SSRCollectorGetter | undefined;\n return getter ? getter() : null;\n}\n"],"mappings":"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"}
@@ -1,4 +1,4 @@
1
- import { M as toSnakeCase, N as CSS_WIDE_KEYWORDS, T as makeEmptyDetails, _ as stringifyStyles, c as getGlobalParser, d as parseColor, f as parseStyle, h as resolveCustomProperties, i as DIRECTIONS, j as normalizeDslName, u as normalizeColorTokenValue, w as Lru } from "./dsl-DYSJc1-T.js";
1
+ import { D as isTransparent, E as makeEmptyDetails, F as normalizeDslName, I as toSnakeCase, L as CSS_WIDE_KEYWORDS, N as isColorKeyword, O as parseAlphaMix, T as Lru, c as getGlobalParser, d as normalizeColorTokenValue, f as parseColor, g as resolveCustomProperties, i as DIRECTIONS, p as parseStyle, u as isDroppedValue, v as stringifyStyles } from "./dsl-CsFl9LGn.js";
2
2
  import { a as warnOnceDev, i as warn, n as isSelector, o as isDevEnv } from "./shared-utils-y-HjvPN4.js";
3
3
  //#region src/config-state.ts
4
4
  let stylesGenerated = false;
@@ -462,6 +462,9 @@ function extractCSSWideKeyword(group) {
462
462
  if (group.values.length !== 1 || group.colors.length > 0) return null;
463
463
  return CSS_WIDE_KEYWORDS.has(group.values[0]) ? group.values[0] : null;
464
464
  }
465
+ function isUnset(value) {
466
+ return value == null || value === false;
467
+ }
465
468
  const RE_VAR_REFERENCE = /^var\(/;
466
469
  function assignLineSlots(values, styleKeyword, colorToken) {
467
470
  if (styleKeyword && colorToken) return {
@@ -601,7 +604,7 @@ const STRETCH_FALLBACKS = [
601
604
  "stretch"
602
605
  ];
603
606
  function parseDimensionValue(val) {
604
- if (val == null) return null;
607
+ if (isUnset(val)) return null;
605
608
  if (typeof val === "number") return `${val}px`;
606
609
  if (val === true) return "initial";
607
610
  return parseStyle(String(val)).groups[0]?.values[0] || null;
@@ -610,8 +613,8 @@ function dimensionStyle(name) {
610
613
  const minStyle = `min-${name}`;
611
614
  const maxStyle = `max-${name}`;
612
615
  return ({ value, min, max }) => {
613
- if (value == null && min == null && max == null) return null;
614
- if (value != null && typeof value === "string" && CSS_WIDE_KEYWORDS.has(value)) {
616
+ if (isUnset(value) && isUnset(min) && isUnset(max)) return null;
617
+ if (typeof value === "string" && CSS_WIDE_KEYWORDS.has(value)) {
615
618
  const styles = {
616
619
  [name]: value,
617
620
  [minStyle]: value,
@@ -640,7 +643,7 @@ function dimensionStyle(name) {
640
643
  [minStyle]: "initial",
641
644
  [maxStyle]: "initial"
642
645
  };
643
- if (value != null) {
646
+ if (!isUnset(value)) {
644
647
  let val = value;
645
648
  if (typeof val === "number") val = `${val}px`;
646
649
  val = String(val);
@@ -701,7 +704,9 @@ const RE_READS_CURRENT = /var\(--current-color[,)]|currentcolor/i;
701
704
  function colorStyle({ color }) {
702
705
  if (!color) return null;
703
706
  if (color === true) color = "currentColor";
704
- color = (RE_HEX_LITERAL.test(color) ? parseStyle(color).groups[0]?.colors[0] : parseColor(color, true).color) || resolveCustomProperties(color);
707
+ const resolved = RE_HEX_LITERAL.test(color) ? parseStyle(color).groups[0]?.colors[0] : parseColor(color, true).color;
708
+ if (!resolved && isDroppedValue(color)) return null;
709
+ color = resolved || resolveCustomProperties(color);
705
710
  const styles = { color };
706
711
  if (!RE_READS_CURRENT.test(color)) styles["--current-color"] = color;
707
712
  return styles;
@@ -803,17 +808,39 @@ function fadeStyle({ fade }) {
803
808
  fadeStyle.__lookupStyles = ["fade"];
804
809
  //#endregion
805
810
  //#region src/styles/fill.ts
811
+ function mixFillColors(property, value, groups) {
812
+ warnOnceDev(`fill-mix:${property}:${value}`, `${property}="${value}": mixing colors with a comma is deprecated. Layer the colors as a compound color instead: "#dark 4%, #surface" is "#surface+#dark.04". For any other mix, write color-mix() itself, such as "color-mix(in srgb, #dark $weight, #surface)".` + (groups.length > 2 ? " A mix takes two colors; the rest are ignored." : ""));
813
+ const [first, second] = groups;
814
+ return `color-mix(in srgb, ${first.output}, ${second.output})`;
815
+ }
806
816
  function fillStyle({ fill, backgroundColor, image, backgroundImage, backgroundPosition, backgroundSize, backgroundRepeat, backgroundAttachment, backgroundOrigin, backgroundClip, background }) {
807
817
  if (background) return { background: parseStyle(background).output || background };
808
818
  const result = {};
809
819
  if (fill === true) warnOnceDev("fill-true", "fill: true has no default color and is ignored. Write a color (fill: '#surface'), or false for no fill.");
820
+ const colorProperty = backgroundColor != null ? "backgroundColor" : "fill";
810
821
  const colorValue = backgroundColor ?? (typeof fill === "string" ? fill : void 0);
811
822
  if (colorValue) {
812
- const parsed = parseStyle(colorValue);
813
- const firstColor = parsed.groups[0]?.colors[0];
814
- const secondColor = parsed.groups[0]?.colors[1];
815
- result["background-color"] = firstColor || resolveCustomProperties(colorValue);
816
- if (secondColor) result["--tasty-second-fill-color"] = secondColor;
823
+ const { groups } = parseStyle(colorValue);
824
+ if (groups.length > 1) result["background-color"] = mixFillColors(colorProperty, colorValue, groups);
825
+ else {
826
+ const firstColor = groups[0]?.colors[0];
827
+ const secondColor = groups[0]?.colors[1];
828
+ if (firstColor || !isDroppedValue(colorValue)) result["background-color"] = firstColor || resolveCustomProperties(colorValue);
829
+ if (secondColor) {
830
+ const tokens = colorValue.trim().split(/\s+/);
831
+ const [base, overlay] = tokens;
832
+ const join = (compound) => `Join them with a plus instead: "${compound}" paints the second color over the first as one background color.`;
833
+ const makeOpaque = `make it opaque and give it an opacity: "${base}+${overlay}.04".`;
834
+ let fix;
835
+ if (tokens.length !== 2 || base[0] !== "#" || overlay[0] !== "#") fix = join("#surface+#dark.04");
836
+ else if (isTransparent(secondColor)) fix = `"${overlay}" paints nothing, so use the first color alone: "${base}".`;
837
+ else if (overlay.includes(".")) fix = join(`${base}+${overlay}`);
838
+ else if (parseAlphaMix(secondColor) || secondColor.includes("/")) fix = `"${overlay}" is translucent, which would leave a compound see-through, so ${makeOpaque}`;
839
+ else fix = `If "${overlay}" is opaque, it covers the first color, so use it alone: "${overlay}". If it is translucent, ${makeOpaque}`;
840
+ warnOnceDev(`fill-two-colors:${colorProperty}:${colorValue}`, `${colorProperty}="${colorValue}": two colors separated by a space are deprecated. The second one is painted as a background-image layer, which contrast checkers such as axe cannot read. ${fix}`);
841
+ result["--tasty-second-fill-color"] = secondColor;
842
+ }
843
+ }
817
844
  }
818
845
  const gradientLayer = result["--tasty-second-fill-color"] ? "linear-gradient(var(--tasty-second-fill-color), var(--tasty-second-fill-color))" : null;
819
846
  const imageValue = backgroundImage ?? image;
@@ -845,7 +872,9 @@ fillStyle.__lookupStyles = [
845
872
  ];
846
873
  function svgFillStyle({ svgFill }) {
847
874
  if (!svgFill) return null;
848
- svgFill = parseStyle(svgFill).groups[0]?.colors[0] || resolveCustomProperties(svgFill);
875
+ const processed = parseStyle(svgFill);
876
+ if (!processed.groups[0]?.colors[0] && isDroppedValue(svgFill)) return null;
877
+ svgFill = processed.groups[0]?.colors[0] || resolveCustomProperties(svgFill);
849
878
  return { fill: svgFill };
850
879
  }
851
880
  svgFillStyle.__lookupStyles = ["svgFill"];
@@ -972,11 +1001,11 @@ function optimizeShorthand(property, dirs) {
972
1001
  }
973
1002
  function processDirectionalStyle(config, props) {
974
1003
  const { main, top, right, bottom, left } = props;
975
- if (main == null && top == null && right == null && bottom == null && left == null) return null;
1004
+ if (isUnset(main) && isUnset(top) && isUnset(right) && isUnset(bottom) && isUnset(left)) return null;
976
1005
  const { property, defaultValue, trueValue, defaultInit, individualOnly, directionProperty, spanModifiers } = config;
977
1006
  const dirProp = directionProperty ?? ((dir) => `${property}-${dir}`);
978
1007
  if (individualOnly) {
979
- if (main == null) {
1008
+ if (isUnset(main)) {
980
1009
  const result = {};
981
1010
  if (top != null) {
982
1011
  const val = parseSingleValue(top, defaultValue, trueValue);
@@ -1004,7 +1033,7 @@ function processDirectionalStyle(config, props) {
1004
1033
  left: defaultInit
1005
1034
  };
1006
1035
  let useLonghand = false;
1007
- if (main != null) {
1036
+ if (!isUnset(main)) {
1008
1037
  if (typeof main === "number") dirs.top = dirs.right = dirs.bottom = dirs.left = `${main}px`;
1009
1038
  else {
1010
1039
  const strMain = main === true ? trueValue : String(main);
@@ -1265,7 +1294,7 @@ function outlineStyle({ outline, outlineOffset }) {
1265
1294
  }
1266
1295
  }
1267
1296
  }
1268
- if (outlineOffset != null && result["outline-offset"] === void 0) {
1297
+ if (outlineOffset != null && typeof outlineOffset !== "boolean" && result["outline-offset"] === void 0) {
1269
1298
  const offsetValue = typeof outlineOffset === "number" ? `${outlineOffset}px` : outlineOffset;
1270
1299
  result["outline-offset"] = parseStyle(offsetValue).groups[0]?.values[0] || resolveCustomProperties(offsetValue);
1271
1300
  }
@@ -1402,7 +1431,8 @@ function presetStyle({ preset, fontSize, lineHeight, textTransform, letterSpacin
1402
1431
  const modPart = parts[1];
1403
1432
  const nameTokens = namePart?.all ?? [];
1404
1433
  const isModOnly = nameTokens.length > 0 && nameTokens.every((t) => PRESET_MODIFIERS.has(t));
1405
- const nameToken = namePart?.mods[0] ?? namePart?.values[0] ?? "";
1434
+ const nameMods = namePart?.mods ?? [];
1435
+ const nameToken = nameTokens.find((token) => nameMods.includes(token) || isColorKeyword(token)) ?? namePart?.values[0] ?? "";
1406
1436
  const name = isModOnly || isTokenNameReference("preset", nameToken) ? "inherit" : nameToken || "inherit";
1407
1437
  const modTokens = isModOnly ? nameTokens : modPart?.all ?? [];
1408
1438
  const isStrong = modTokens.includes("strong") || modTokens.includes("bold");
@@ -1740,7 +1770,8 @@ function getTiming(name) {
1740
1770
  }
1741
1771
  function transitionStyle({ transition }) {
1742
1772
  if (!transition) return null;
1743
- if (CSS_WIDE_KEYWORDS.has(transition)) return { transition };
1773
+ const keyword = String(transition).trim().toLowerCase();
1774
+ if (keyword === "none" || CSS_WIDE_KEYWORDS.has(keyword)) return { transition: keyword };
1744
1775
  const processed = parseStyle(transition);
1745
1776
  const map = {};
1746
1777
  const named = /* @__PURE__ */ new Set();
@@ -2044,6 +2075,48 @@ function rootStateIndex(selector) {
2044
2075
  if (!isRoot) return -1;
2045
2076
  return pseudoElementAt === -1 ? selector.length : pseudoElementAt;
2046
2077
  }
2078
+ function pseudoElementIndex(selector) {
2079
+ let pseudoElementAt = -1;
2080
+ let newCompound = false;
2081
+ let squareDepth = 0;
2082
+ let parenDepth = 0;
2083
+ let quote = "";
2084
+ for (let i = 0; i < selector.length; i++) {
2085
+ const char = selector[i];
2086
+ if (quote) {
2087
+ if (char === "\\") i++;
2088
+ else if (char === quote) quote = "";
2089
+ continue;
2090
+ }
2091
+ if (char === "/" && selector[i + 1] === "*") {
2092
+ const end = selector.indexOf("*/", i + 2);
2093
+ if (end === -1) break;
2094
+ i = end + 1;
2095
+ continue;
2096
+ }
2097
+ if (squareDepth === 0 && parenDepth === 0) {
2098
+ if (/[\s>+~,]/.test(char)) {
2099
+ newCompound = true;
2100
+ continue;
2101
+ }
2102
+ if (newCompound) {
2103
+ pseudoElementAt = -1;
2104
+ newCompound = false;
2105
+ }
2106
+ if (pseudoElementAt === -1 && char === ":") {
2107
+ const name = /^:[\w-]+/.exec(selector.slice(i))?.[0] ?? "";
2108
+ if (selector[i + 1] === ":" || LEGACY_PSEUDO_ELEMENT_RE.test(name)) pseudoElementAt = i;
2109
+ }
2110
+ }
2111
+ if (char === "\\") i++;
2112
+ else if (char === "\"" || char === "'") quote = char;
2113
+ else if (char === "[") squareDepth++;
2114
+ else if (char === "]") squareDepth = Math.max(0, squareDepth - 1);
2115
+ else if (char === "(") parenDepth++;
2116
+ else if (char === ")") parenDepth = Math.max(0, parenDepth - 1);
2117
+ }
2118
+ return pseudoElementAt === -1 ? selector.length : pseudoElementAt;
2119
+ }
2047
2120
  function splitSelectorsSafely(selectorList) {
2048
2121
  if (!selectorList.includes(",")) {
2049
2122
  const selector = selectorList.trim();
@@ -4615,6 +4688,35 @@ function clearParseCache() {
4615
4688
  parseCache.clear();
4616
4689
  }
4617
4690
  //#endregion
4691
+ //#region src/pipeline/pseudo-element-states.ts
4692
+ const QUOTED_RE = /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g;
4693
+ const STRUCTURAL_PSEUDO_RE = /:(?:root|empty|scope|has|(?:first|last|only)-(?:child|of-type)|nth-(?:last-)?(?:child|of-type))(?![\w-])/i;
4694
+ function leafMismatch(node) {
4695
+ if (node.kind !== "state") return null;
4696
+ if (node.type === "modifier") return "modifiers";
4697
+ if (node.type !== "pseudo") return null;
4698
+ const selector = node.pseudo.replace(QUOTED_RE, "\"\"");
4699
+ if (STRUCTURAL_PSEUDO_RE.test(selector)) return "position in the DOM tree";
4700
+ if (selector.includes("[")) return "attributes";
4701
+ if (selector.includes(".") || selector.includes("#")) return "classes or ids";
4702
+ return null;
4703
+ }
4704
+ function pseudoElementMismatch(condition, target) {
4705
+ const walk = (node, describesTarget) => {
4706
+ if (node.kind === "compound") {
4707
+ for (const child of node.children) {
4708
+ const found = walk(child, describesTarget);
4709
+ if (found) return found;
4710
+ }
4711
+ return null;
4712
+ }
4713
+ if (node.kind !== "state") return null;
4714
+ if (node.type === "own") return target.own || target.root ? walk(node.innerCondition, true) : null;
4715
+ return describesTarget ? leafMismatch(node) : null;
4716
+ };
4717
+ return walk(condition, target.root);
4718
+ }
4719
+ //#endregion
4618
4720
  //#region src/pipeline/index.ts
4619
4721
  const RE_UPPER_CASE = /[A-Z]/;
4620
4722
  const pipelineCache = new Lru(5e3);
@@ -4624,9 +4726,9 @@ function hasPipelineCacheEntry(cacheKey) {
4624
4726
  function clearPipelineCache() {
4625
4727
  pipelineCache.clear();
4626
4728
  }
4627
- function runPipeline(styles, parserContext) {
4729
+ function runPipeline(styles, parserContext, pseudoElementRoot = false) {
4628
4730
  const allRules = [];
4629
- processStyles(styles, "", parserContext, allRules);
4731
+ processStyles(styles, "", parserContext, allRules, pseudoElementRoot);
4630
4732
  const seen = /* @__PURE__ */ new Set();
4631
4733
  const normal = [];
4632
4734
  const starting = [];
@@ -4642,7 +4744,7 @@ function stableSortByOrder(rules) {
4642
4744
  if (rules.length <= 1) return rules;
4643
4745
  return [...rules].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
4644
4746
  }
4645
- function processStyles(styles, selectorSuffix, parserContext, allRules) {
4747
+ function processStyles(styles, selectorSuffix, parserContext, allRules, pseudoElementRoot) {
4646
4748
  const keys = Object.keys(styles);
4647
4749
  const selectorKeys = [];
4648
4750
  const styleKeys = [];
@@ -4658,10 +4760,10 @@ function processStyles(styles, selectorSuffix, parserContext, allRules) {
4658
4760
  }
4659
4761
  styleKeys.push(key);
4660
4762
  }
4661
- processNestedSelectors(styles, selectorKeys, selectorSuffix, parserContext, allRules);
4662
- processHandlerQueue(buildHandlerQueue(styleKeys, styles), selectorSuffix, parserContext, allRules);
4763
+ processNestedSelectors(styles, selectorKeys, selectorSuffix, parserContext, allRules, pseudoElementRoot);
4764
+ processHandlerQueue(buildHandlerQueue(styleKeys, styles), selectorSuffix, parserContext, allRules, pseudoElementRoot);
4663
4765
  }
4664
- function processNestedSelectors(styles, selectorKeys, selectorSuffix, parserContext, allRules) {
4766
+ function processNestedSelectors(styles, selectorKeys, selectorSuffix, parserContext, allRules, pseudoElementRoot) {
4665
4767
  for (const key of selectorKeys) {
4666
4768
  const nestedStyles = styles[key];
4667
4769
  if (!nestedStyles || typeof nestedStyles !== "object") continue;
@@ -4678,30 +4780,34 @@ function processNestedSelectors(styles, selectorKeys, selectorSuffix, parserCont
4678
4780
  ...subLocalStates
4679
4781
  } : parserContext.localPredefinedStates
4680
4782
  };
4681
- for (const suffix of suffixes) processStyles(cleanedStyles, selectorSuffix + suffix, subContext, allRules);
4783
+ for (const suffix of suffixes) processStyles(cleanedStyles, selectorSuffix + suffix, subContext, allRules, pseudoElementRoot);
4682
4784
  }
4683
4785
  }
4684
- function processHandlerQueue(handlerQueue, selectorSuffix, parserContext, allRules) {
4786
+ function processHandlerQueue(handlerQueue, selectorSuffix, parserContext, allRules, pseudoElementRoot) {
4787
+ const target = {
4788
+ own: pseudoElementIndex(selectorSuffix) < selectorSuffix.length,
4789
+ root: pseudoElementRoot
4790
+ };
4685
4791
  for (const { handler, styleMap, hasStateMap } of handlerQueue) {
4686
4792
  const lookupStyles = handler.__lookupStyles;
4687
- const mergedRules = mergeByValue(invokeHandler(handler, hasStateMap ? computeStateCombinations(buildExclusivesForHandler(lookupStyles, styleMap, parserContext), lookupStyles) : [{
4793
+ const mergedRules = mergeByValue(invokeHandler(handler, hasStateMap ? computeStateCombinations(buildExclusivesForHandler(lookupStyles, styleMap, parserContext, target), lookupStyles) : [{
4688
4794
  condition: trueCondition(),
4689
4795
  values: styleMap,
4690
4796
  order: 0
4691
4797
  }], selectorSuffix));
4692
4798
  for (const rule of mergedRules) {
4693
- const cssRules = materializeComputedRule(rule);
4799
+ const cssRules = materializeComputedRule(rule, pseudoElementRoot);
4694
4800
  allRules.push(...cssRules);
4695
4801
  }
4696
4802
  }
4697
4803
  }
4698
- function buildExclusivesForHandler(lookupStyles, styleMap, parserContext) {
4804
+ function buildExclusivesForHandler(lookupStyles, styleMap, parserContext, target) {
4699
4805
  const exclusiveByStyle = /* @__PURE__ */ new Map();
4700
4806
  for (const styleName of lookupStyles) {
4701
4807
  const value = styleMap[styleName];
4702
4808
  if (value === void 0) continue;
4703
4809
  if (isValueMapping(value)) {
4704
- const fullyExpanded = expandExclusiveOrs(buildExclusiveConditions(expandOrConditions(mergeEntriesByValue(parseStyleEntries(styleName, extractCompoundStates(value), (stateKey) => parseStateKey(stateKey, { context: parserContext }))))));
4810
+ const fullyExpanded = expandExclusiveOrs(buildExclusiveConditions(expandOrConditions(mergeEntriesByValue(parseStyleEntries(styleName, extractCompoundStates(target.own || target.root ? dropPseudoElementMismatches(styleName, value, parserContext, target) : value), (stateKey) => parseStateKey(stateKey, { context: parserContext }))))));
4705
4811
  exclusiveByStyle.set(styleName, fullyExpanded);
4706
4812
  } else exclusiveByStyle.set(styleName, [{
4707
4813
  styleKey: styleName,
@@ -4714,6 +4820,18 @@ function buildExclusivesForHandler(lookupStyles, styleMap, parserContext) {
4714
4820
  }
4715
4821
  return exclusiveByStyle;
4716
4822
  }
4823
+ function dropPseudoElementMismatches(styleName, valueMap, parserContext, target) {
4824
+ let kept;
4825
+ for (const stateKey of Object.keys(valueMap)) {
4826
+ if (stateKey === "" || stateKey === "_" || isMisusedFallbackKey(stateKey)) continue;
4827
+ const mismatch = pseudoElementMismatch(parseStateKey(stateKey, { context: parserContext }), target);
4828
+ if (!mismatch) continue;
4829
+ emitWarning("PSEUDO_ELEMENT_STATE_IGNORED", `State "${stateKey}" (in "${styleName}") applies to a pseudo-element, which has no ${mismatch}, so it can never match. The state has been ignored. To condition on the element the pseudo-element belongs to, write it in the selector before the pseudo-element.`);
4830
+ kept ??= { ...valueMap };
4831
+ delete kept[stateKey];
4832
+ }
4833
+ return kept ?? valueMap;
4834
+ }
4717
4835
  function invokeHandler(handler, stateSnapshots, selectorSuffix) {
4718
4836
  const computedRules = [];
4719
4837
  for (const snapshot of stateSnapshots) {
@@ -5044,20 +5162,23 @@ function mergeByValue(rules) {
5044
5162
  }
5045
5163
  return merged;
5046
5164
  }
5047
- function buildSelectorFromVariant(variant, selectorSuffix) {
5048
- let selector = "";
5165
+ function buildSelectorFromVariant(variant, selectorSuffix, pseudoElementRoot) {
5049
5166
  let rootSegment = branchToCSS([...variant.modifierConditions, ...variant.pseudoConditions]);
5050
5167
  for (const group of variant.selectorGroups) rootSegment += selectorGroupToCSS(group);
5051
- selector += wrapWhere(rootSegment);
5052
- if (variant.parentGroups.length > 0) selector += parentGroupsToCSS(variant.parentGroups);
5168
+ const parents = variant.parentGroups.length > 0 ? parentGroupsToCSS(variant.parentGroups) : "";
5169
+ const pseudoElementAt = pseudoElementRoot ? parents.length : 0;
5170
+ let selector = pseudoElementRoot ? parents + wrapWhere(rootSegment) : wrapWhere(rootSegment) + parents;
5053
5171
  selector += selectorSuffix;
5054
5172
  const ownOptimized = optimizeGroups(variant.ownGroups);
5055
5173
  let ownSegment = "";
5056
5174
  for (const group of ownOptimized) ownSegment += selectorGroupToCSS(group);
5057
5175
  selector += wrapWhere(ownSegment);
5058
- return selector;
5176
+ return {
5177
+ selector,
5178
+ pseudoElementAt
5179
+ };
5059
5180
  }
5060
- function materializeComputedRule(rule) {
5181
+ function materializeComputedRule(rule, pseudoElementRoot) {
5061
5182
  const components = conditionToCSS(rule.condition);
5062
5183
  if (components.isImpossible || components.variants.length === 0) return [];
5063
5184
  const declarations = Object.entries(rule.declarations).map(([prop, value]) => Array.isArray(value) ? value.map((v) => `${prop}: ${v};`).join(" ") : `${prop}: ${value};`).join(" ");
@@ -5080,12 +5201,13 @@ function materializeComputedRule(rule) {
5080
5201
  }
5081
5202
  const rules = [];
5082
5203
  for (const [, group] of byAtRules) {
5083
- const selectorFragments = mergeVariantsIntoSelectorGroups(group.variants).map((v) => buildSelectorFromVariant(v, rule.selectorSuffix));
5204
+ const built = mergeVariantsIntoSelectorGroups(group.variants).map((v) => buildSelectorFromVariant(v, rule.selectorSuffix, pseudoElementRoot));
5084
5205
  const cssRule = {
5085
- selector: selectorFragments.length === 1 ? selectorFragments[0] : selectorFragments,
5206
+ selector: built.length === 1 ? built[0].selector : built.map((b) => b.selector),
5086
5207
  declarations,
5087
5208
  order: rule.order
5088
5209
  };
5210
+ if (pseudoElementRoot) cssRule.pseudoElementAt = built.map((b) => b.pseudoElementAt);
5089
5211
  if (group.atRules.length > 0) cssRule.atRules = group.atRules;
5090
5212
  if (group.rootPrefix) {
5091
5213
  cssRule.rootPrefix = group.rootPrefix;
@@ -5113,23 +5235,33 @@ function renderStyles(styles, classNameOrSelector, options, pipelineCacheKey) {
5113
5235
  if (pipelineCacheKey) rules = pipelineCache.get(pipelineCacheKey);
5114
5236
  if (!rules && !styles) return directSelector ? [] : { rules: [] };
5115
5237
  const cacheKey = pipelineCacheKey || stringifyStyles(styles);
5116
- if (!rules) rules = pipelineCache.get(cacheKey);
5117
- if (!rules) {
5118
- rules = runPipeline(styles, createStateParserContext(styles));
5119
- pipelineCache.set(cacheKey, rules);
5120
- }
5238
+ const rulesFor = (pseudoElementRoot) => {
5239
+ const key = pseudoElementRoot ? `${cacheKey}\0::` : cacheKey;
5240
+ let cached = pipelineCache.get(key);
5241
+ if (!cached) {
5242
+ cached = runPipeline(styles, createStateParserContext(styles), pseudoElementRoot);
5243
+ pipelineCache.set(key, cached);
5244
+ }
5245
+ return cached;
5246
+ };
5121
5247
  if (directSelector) {
5122
5248
  const shouldDouble = options?.doubleSelector ?? false;
5123
5249
  const items = splitSelectorsSafely(classNameOrSelector);
5124
- const bases = (items.length > 0 ? items : [classNameOrSelector]).map((base) => ({
5125
- base,
5126
- rootAt: rootStateIndex(base)
5127
- }));
5128
- return mergeStyleResults(rules.map((rule) => {
5250
+ const bases = (items.length > 0 ? items : [classNameOrSelector]).map((base) => {
5251
+ const at = pseudoElementIndex(base);
5252
+ return {
5253
+ head: base.slice(0, at),
5254
+ pseudoElement: base.slice(at),
5255
+ rootAt: rootStateIndex(base)
5256
+ };
5257
+ });
5258
+ const toResults = (groupRules, group) => groupRules.map((rule) => {
5129
5259
  const result = {
5130
- selector: (Array.isArray(rule.selector) ? rule.selector : rule.selector ? [rule.selector] : [""]).flatMap((part) => bases.map(({ base, rootAt }) => {
5260
+ selector: (Array.isArray(rule.selector) ? rule.selector : rule.selector ? [rule.selector] : [""]).flatMap((part, index) => group.map(({ head, pseudoElement, rootAt }) => {
5131
5261
  const joinsRoot = rule.rootState !== void 0 && rootAt !== -1;
5132
- let sel = joinsRoot ? `${base.slice(0, rootAt)}${wrapWhere(rule.rootState)}${base.slice(rootAt)}${part}` : `${base}${part}`;
5262
+ const base = joinsRoot ? `${head.slice(0, rootAt)}${wrapWhere(rule.rootState)}${head.slice(rootAt)}` : head;
5263
+ const at = rule.pseudoElementAt?.[index] ?? 0;
5264
+ let sel = pseudoElement ? `${base}${part.slice(0, at)}${pseudoElement}${part.slice(at)}` : `${base}${part}`;
5133
5265
  if (shouldDouble && sel.startsWith(".")) {
5134
5266
  const classMatch = sel.match(/^\.[a-zA-Z_-][a-zA-Z0-9_-]*/);
5135
5267
  if (classMatch) sel = classMatch[0] + sel;
@@ -5142,8 +5274,12 @@ function renderStyles(styles, classNameOrSelector, options, pipelineCacheKey) {
5142
5274
  if (rule.atRules && rule.atRules.length > 0) result.atRules = rule.atRules;
5143
5275
  if (rule.startingStyle) result.startingStyle = true;
5144
5276
  return result;
5145
- }));
5277
+ });
5278
+ const plain = bases.filter((base) => !base.pseudoElement);
5279
+ const pseudo = bases.filter((base) => base.pseudoElement);
5280
+ return mergeStyleResults([...plain.length > 0 ? toResults(rulesFor(false), plain) : [], ...pseudo.length > 0 ? toResults(rulesFor(true), pseudo) : []]);
5146
5281
  }
5282
+ rules ??= rulesFor(false);
5147
5283
  return { rules: rules.map((r) => ({
5148
5284
  selector: Array.isArray(r.selector) ? r.selector.join("|||") : r.selector,
5149
5285
  declarations: r.declarations,
@@ -5463,4 +5599,4 @@ function renderStylesForChunk(styles, chunkName, styleKeys, pipelineCacheKey) {
5463
5599
  //#endregion
5464
5600
  export { styleHandlers as A, STYLE_TO_CHUNK as B, camelToKebab as C, normalizeHandlerDefinition as D, defineHandler as E, DIMENSION_CHUNK_STYLES as F, setGlobalPredefinedStates as G, clearGlobalPredefinedStates as H, DISPLAY_CHUNK_STYLES as I, markStylesGeneratedState as J, hasStylesGenerated as K, FONT_CHUNK_STYLES as L, createStyle as M, APPEARANCE_CHUNK_STYLES as N, registerHandler as O, CHUNK_NAMES as P, LAYOUT_CHUNK_STYLES as R, parseStateKey as S, STYLE_HANDLER_MAP as T, createStateParserContext as U, resetStyleChunks as V, getGlobalPredefinedStates as W, resetStylesGeneratedState as X, resetGlobalPolyfillsState as Y, setGlobalPolyfillsState as Z, POSITION_STYLES as _, registerBaseStyleProps as a, renderStyles as b, BLOCK_INNER_STYLES as c, COLOR_STYLES as d, CONTAINER_STYLES as f, OUTER_STYLES as g, INNER_STYLES as h, baseStylePropsRegistry as i, scanAnimationNames as j, resetHandlers as k, BLOCK_OUTER_STYLES as l, FLOW_STYLES as m, generateChunkCacheKey as n, resetBaseStyleProps as o, DIMENSION_STYLES as p, isFunctionsPolyfillEnabled as q, categorizeStyleKeys as r, BASE_STYLES as s, renderStylesForChunk as t, BLOCK_STYLES as u, TEXT_STYLES as v, splitSelectorsSafely as w, clearParseCache as x, clearPipelineCache as y, POSITION_CHUNK_STYLES as z };
5465
5601
 
5466
- //# sourceMappingURL=style-engine-BX2LshDZ.js.map
5602
+ //# sourceMappingURL=style-engine-DnkV_4Jg.js.map