@tenphi/tasty 2.6.4 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/{collector-C-keQH9m.js → collector-BWvvN7_y.js} +3 -3
  2. package/dist/{collector-C-keQH9m.js.map → collector-BWvvN7_y.js.map} +1 -1
  3. package/dist/{config-BBiyxMCe.js → config-DF2QZQEW.js} +421 -269
  4. package/dist/config-DF2QZQEW.js.map +1 -0
  5. package/dist/core/index.d.ts +2 -2
  6. package/dist/core/index.js +6 -6
  7. package/dist/{core-BO4319td.js → core-BbdGIKAK.js} +5 -5
  8. package/dist/core-BbdGIKAK.js.map +1 -0
  9. package/dist/{css-writer-BWvwQzz0.js → css-writer-Bh05D6KI.js} +3 -3
  10. package/dist/css-writer-Bh05D6KI.js.map +1 -0
  11. package/dist/{format-rules-BSjeH4Z7.js → format-rules-DCI2lomx.js} +2 -2
  12. package/dist/{format-rules-BSjeH4Z7.js.map → format-rules-DCI2lomx.js.map} +1 -1
  13. package/dist/{hydrate-CcvrP4qJ.js → hydrate-DsFfFPVK.js} +2 -2
  14. package/dist/{hydrate-CcvrP4qJ.js.map → hydrate-DsFfFPVK.js.map} +1 -1
  15. package/dist/{index-B_k47mc_.d.ts → index-D-OA_O6i.d.ts} +95 -2
  16. package/dist/index.d.ts +2 -2
  17. package/dist/index.js +7 -7
  18. package/dist/index.js.map +1 -1
  19. package/dist/{keyframes-BUQhdOSJ.js → keyframes-Dg95rDpN.js} +10 -3
  20. package/dist/keyframes-Dg95rDpN.js.map +1 -0
  21. package/dist/{merge-styles-Cd2vBl9b.js → merge-styles-Bnn6j_SA.js} +2 -2
  22. package/dist/{merge-styles-Cd2vBl9b.js.map → merge-styles-Bnn6j_SA.js.map} +1 -1
  23. package/dist/{resolve-recipes-C1nrvnYh.js → resolve-recipes-CBQaQ3tD.js} +3 -3
  24. package/dist/{resolve-recipes-C1nrvnYh.js.map → resolve-recipes-CBQaQ3tD.js.map} +1 -1
  25. package/dist/ssr/astro-client.js +1 -1
  26. package/dist/ssr/astro.js +3 -3
  27. package/dist/ssr/index.js +3 -3
  28. package/dist/ssr/next.js +4 -4
  29. package/dist/static/index.js +1 -1
  30. package/dist/zero/babel.js +4 -4
  31. package/dist/zero/index.js +1 -1
  32. package/docs/dsl.md +109 -0
  33. package/docs/pipeline.md +49 -4
  34. package/package.json +15 -6
  35. package/tasty.config.ts +1 -0
  36. package/dist/config-BBiyxMCe.js.map +0 -1
  37. package/dist/core-BO4319td.js.map +0 -1
  38. package/dist/css-writer-BWvwQzz0.js.map +0 -1
  39. package/dist/keyframes-BUQhdOSJ.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyframes-Dg95rDpN.js","names":[],"sources":["../src/chunks/definitions.ts","../src/chunks/cacheKey.ts","../src/chunks/renderChunk.ts","../src/keyframes/index.ts"],"sourcesContent":["/**\n * Style chunk definitions for CSS chunking optimization.\n *\n * Styles are grouped into chunks based on:\n * 1. Handler dependencies - styles that share a handler MUST be in the same chunk\n * 2. Logical grouping - related styles grouped for better cache reuse\n *\n * See STYLE_CHUNKING_SPEC.md for detailed rationale.\n *\n * ============================================================================\n * ⚠️ CRITICAL ARCHITECTURAL CONSTRAINT: NO CROSS-CHUNK HANDLER DEPENDENCIES\n * ============================================================================\n *\n * Style handlers declare their dependencies via `__lookupStyles` array.\n * This creates a dependency graph where handlers read multiple style props.\n *\n * **ALL styles in a handler's `__lookupStyles` MUST be in the SAME chunk.**\n *\n * Why this matters:\n * 1. Each chunk computes a cache key from ONLY its own style values\n * 2. If a handler reads a style from another chunk, that value isn't in the cache key\n * 3. Changing the cross-chunk style won't invalidate this chunk's cache\n * 4. Result: stale CSS output or incorrect cache hits\n *\n * Example of a violation:\n * ```\n * // flowStyle.__lookupStyles = ['display', 'flow']\n * // If 'display' is in DISPLAY chunk and 'flow' is in LAYOUT chunk:\n * // - User sets { display: 'grid', flow: 'column' }\n * // - LAYOUT chunk caches CSS with flow=column, display=grid\n * // - User changes to { display: 'flex', flow: 'column' }\n * // - LAYOUT chunk cache key unchanged (only has 'flow')\n * // - Returns stale CSS computed with display=grid!\n * ```\n *\n * Before adding/moving styles, verify:\n * 1. Find all handlers that use this style (grep for the style name in __lookupStyles)\n * 2. Ensure ALL styles from each handler's __lookupStyles are in the same chunk\n * ============================================================================\n */\n\nimport { isSelector } from '../pipeline';\n\n// ============================================================================\n// Chunk Style Lists\n// ============================================================================\n\n/**\n * Appearance chunk - visual styling with independent handlers\n *\n * @public\n */\nexport const APPEARANCE_CHUNK_STYLES = [\n 'fill', // fillStyle (independent)\n 'color', // colorStyle (independent)\n 'opacity', // independent\n 'border', // borderStyle (independent)\n 'radius', // radiusStyle (independent)\n 'outline', // outlineStyle: outline ↔ outlineOffset\n 'outlineOffset', // outlineStyle: outline ↔ outlineOffset\n 'shadow', // shadowStyle (independent)\n 'fade', // fadeStyle (independent)\n] as const;\n\n/**\n * Font chunk - typography styles\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ presetStyle: preset, fontSize, lineHeight, letterSpacing, textTransform,\n * fontWeight, fontStyle, font\n */\n/** @public */\nexport const FONT_CHUNK_STYLES = [\n // All from presetStyle handler - MUST stay together\n 'preset',\n 'font',\n 'fontWeight',\n 'fontStyle',\n 'fontSize',\n 'lineHeight',\n 'letterSpacing',\n 'textTransform',\n // Independent text styles grouped for cohesion\n 'fontFamily', // independent alias (logical grouping with font styles)\n 'textAlign',\n 'textDecoration',\n 'wordBreak',\n 'wordWrap',\n 'boldFontWeight',\n] as const;\n\n/**\n * Dimension chunk - sizing and spacing\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ paddingStyle: padding, paddingTop/Right/Bottom/Left, paddingBlock/Inline\n * ⚠️ marginStyle: margin, marginTop/Right/Bottom/Left, marginBlock/Inline\n * ⚠️ widthStyle: width, minWidth, maxWidth\n * ⚠️ heightStyle: height, minHeight, maxHeight\n */\n/** @public */\nexport const DIMENSION_CHUNK_STYLES = [\n // All from paddingStyle handler - MUST stay together\n 'padding',\n 'paddingTop',\n 'paddingRight',\n 'paddingBottom',\n 'paddingLeft',\n 'paddingBlock',\n 'paddingInline',\n // All from marginStyle handler - MUST stay together\n 'margin',\n 'marginTop',\n 'marginRight',\n 'marginBottom',\n 'marginLeft',\n 'marginBlock',\n 'marginInline',\n // widthStyle handler - MUST stay together\n 'width',\n 'minWidth',\n 'maxWidth',\n // heightStyle handler - MUST stay together\n 'height',\n 'minHeight',\n 'maxHeight',\n 'flexBasis',\n 'flexGrow',\n 'flexShrink',\n 'flex',\n] as const;\n\n/**\n * Display chunk - display mode, layout flow, text overflow, and scrollbar\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ displayStyle: display, hide, textOverflow, overflow, whiteSpace\n * ⚠️ flowStyle: display, flow\n * ⚠️ gapStyle: display, flow, gap\n * ⚠️ scrollbarStyle: scrollbar, overflow\n */\n/** @public */\nexport const DISPLAY_CHUNK_STYLES = [\n // displayStyle handler\n 'display',\n 'hide',\n 'textOverflow',\n 'overflow', // also used by scrollbarStyle\n 'whiteSpace',\n // flowStyle handler (requires display)\n 'flow',\n // gapStyle handler (requires display, flow)\n 'gap',\n // scrollbarStyle handler (requires overflow)\n 'scrollbar',\n] as const;\n\n/**\n * Layout chunk - flex/grid alignment and grid templates\n *\n * Note: flow and gap are in DISPLAY chunk due to handler dependencies\n * (flowStyle and gapStyle both require 'display' prop).\n */\n/** @public */\nexport const LAYOUT_CHUNK_STYLES = [\n // Alignment styles (all independent handlers)\n 'placeItems',\n 'placeContent',\n 'alignItems',\n 'alignContent',\n 'justifyItems',\n 'justifyContent',\n 'align', // placementStyle\n 'justify', // placementStyle\n 'place', // placementStyle\n 'columnGap',\n 'rowGap',\n // Grid template styles\n 'gridColumns',\n 'gridRows',\n 'gridTemplate',\n 'gridAreas',\n 'gridAutoFlow',\n 'gridAutoColumns',\n 'gridAutoRows',\n] as const;\n\n/**\n * Position chunk - element positioning\n *\n * Handler dependencies (all styles in each handler MUST stay in this chunk):\n * ⚠️ insetStyle: inset, insetBlock, insetInline, top, right, bottom, left\n */\n/** @public */\nexport const POSITION_CHUNK_STYLES = [\n 'position',\n // All from insetStyle handler - MUST stay together\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'top',\n 'right',\n 'bottom',\n 'left',\n 'zIndex',\n 'gridArea',\n 'gridColumn',\n 'gridRow',\n 'order',\n 'placeSelf',\n 'alignSelf',\n 'justifySelf',\n 'transform',\n 'transition',\n 'animation',\n] as const;\n\n// ============================================================================\n// Chunk Names\n// ============================================================================\n\nexport const CHUNK_NAMES = {\n /** Special chunk for styles that cannot be split */\n COMBINED: 'combined',\n SUBCOMPONENTS: 'subcomponents',\n APPEARANCE: 'appearance',\n FONT: 'font',\n DIMENSION: 'dimension',\n DISPLAY: 'display',\n LAYOUT: 'layout',\n POSITION: 'position',\n MISC: 'misc',\n} as const;\n\nexport type ChunkName = (typeof CHUNK_NAMES)[keyof typeof CHUNK_NAMES];\n\n// ============================================================================\n// Style-to-Chunk Lookup Map (O(1) categorization)\n// ============================================================================\n\n/**\n * Pre-computed map for O(1) style-to-chunk lookup.\n * Built once at module load time.\n */\nexport const STYLE_TO_CHUNK = new Map<string, ChunkName>();\n\n// Populate the lookup map\nfunction populateStyleToChunkMap() {\n for (const style of APPEARANCE_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.APPEARANCE);\n }\n for (const style of FONT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.FONT);\n }\n for (const style of DIMENSION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DIMENSION);\n }\n for (const style of DISPLAY_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.DISPLAY);\n }\n for (const style of LAYOUT_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.LAYOUT);\n }\n for (const style of POSITION_CHUNK_STYLES) {\n STYLE_TO_CHUNK.set(style, CHUNK_NAMES.POSITION);\n }\n}\n\n// Initialize at module load\npopulateStyleToChunkMap();\n\n// ============================================================================\n// Chunk Priority Order\n// ============================================================================\n\n/**\n * Chunk processing order. This ensures deterministic className allocation\n * regardless of style key order in the input.\n */\nconst CHUNK_ORDER: readonly string[] = [\n CHUNK_NAMES.APPEARANCE,\n CHUNK_NAMES.FONT,\n CHUNK_NAMES.DIMENSION,\n CHUNK_NAMES.DISPLAY,\n CHUNK_NAMES.LAYOUT,\n CHUNK_NAMES.POSITION,\n CHUNK_NAMES.MISC,\n CHUNK_NAMES.SUBCOMPONENTS,\n] as const;\n\n/**\n * Map from chunk name to its priority index for sorting.\n */\nconst _CHUNK_PRIORITY = new Map<string, number>(\n CHUNK_ORDER.map((name, index) => [name, index]),\n);\n\n// ============================================================================\n// Chunk Info Interface\n// ============================================================================\n\nexport interface ChunkInfo {\n /** Name of the chunk */\n name: ChunkName | string;\n /** Style keys belonging to this chunk */\n styleKeys: string[];\n}\n\n// ============================================================================\n// Style Categorization\n// ============================================================================\n\n/**\n * Categorize style keys into chunks.\n *\n * Returns chunks in a deterministic order (by CHUNK_ORDER) regardless\n * of the order of keys in the input styles object.\n *\n * @param styles - The styles object to categorize\n * @returns Map of chunk name to array of style keys in that chunk (in priority order)\n */\nexport function categorizeStyleKeys(\n styles: Record<string, unknown>,\n): Map<string, string[]> {\n // First pass: collect keys into chunks (unordered)\n const chunkData: Record<string, string[]> = {};\n const keys = Object.keys(styles);\n\n for (const key of keys) {\n // Skip the $ helper key (used for selector combinators)\n // Skip @keyframes and @properties (processed separately in useStyles)\n // Skip recipe (resolved before pipeline by resolveRecipes)\n if (\n key === '$' ||\n key === '@keyframes' ||\n key === '@properties' ||\n key === '@fontFace' ||\n key === '@counterStyle' ||\n key === 'recipe'\n ) {\n continue;\n }\n\n if (isSelector(key)) {\n // All selectors go into the subcomponents chunk\n if (!chunkData[CHUNK_NAMES.SUBCOMPONENTS]) {\n chunkData[CHUNK_NAMES.SUBCOMPONENTS] = [];\n }\n chunkData[CHUNK_NAMES.SUBCOMPONENTS].push(key);\n } else {\n // Look up the chunk for this style, default to misc\n const chunkName = STYLE_TO_CHUNK.get(key) ?? CHUNK_NAMES.MISC;\n if (!chunkData[chunkName]) {\n chunkData[chunkName] = [];\n }\n chunkData[chunkName].push(key);\n }\n }\n\n // Second pass: build ordered Map based on CHUNK_ORDER\n const orderedChunks = new Map<string, string[]>();\n\n // Add chunks in priority order\n for (const chunkName of CHUNK_ORDER) {\n if (chunkData[chunkName] && chunkData[chunkName].length > 0) {\n // Sort keys within chunk for consistent cache key generation\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n // Handle any unknown chunks (shouldn't happen, but be defensive)\n for (const chunkName of Object.keys(chunkData)) {\n if (!orderedChunks.has(chunkName)) {\n orderedChunks.set(chunkName, chunkData[chunkName].sort());\n }\n }\n\n return orderedChunks;\n}\n","/**\n * Chunk-specific cache key generation.\n *\n * Generates cache keys that only include styles relevant to a specific chunk,\n * enabling more granular caching and reuse.\n *\n * Enhanced to support predefined states:\n * - Global predefined states don't affect cache keys (constant across app)\n * - Local predefined states only affect cache keys if referenced in the chunk\n */\n\nimport {\n extractLocalPredefinedStates,\n extractPredefinedStateRefs,\n} from '../states';\nimport type { Styles } from '../styles/types';\n\nconst _stableStringifyCache = new WeakMap<object, string>();\n\n/**\n * Recursively serialize a value with sorted keys for stable output.\n * This ensures that {a: 1, b: 2} and {b: 2, a: 1} produce the same string.\n * Uses a WeakMap cache for object values to avoid re-serializing the same references.\n */\nfunction stableStringify(value: unknown): string {\n if (value === null) {\n return 'null';\n }\n if (value === undefined) {\n return 'undefined';\n }\n if (typeof value !== 'object') {\n return JSON.stringify(value);\n }\n\n const cached = _stableStringifyCache.get(value as object);\n if (cached !== undefined) return cached;\n\n let result: string;\n if (Array.isArray(value)) {\n result = '[' + value.map(stableStringify).join(',') + ']';\n } else {\n const obj = value as Record<string, unknown>;\n const sortedKeys = Object.keys(obj).sort();\n const parts: string[] = [];\n for (const key of sortedKeys) {\n if (obj[key] !== undefined) {\n parts.push(`${JSON.stringify(key)}:${stableStringify(obj[key])}`);\n }\n }\n result = '{' + parts.join(',') + '}';\n }\n\n _stableStringifyCache.set(value as object, result);\n return result;\n}\n\n/**\n * Generate a cache key for a specific chunk.\n *\n * Only includes the styles that belong to this chunk, allowing\n * chunks to be cached independently.\n *\n * Also includes relevant local predefined states that are referenced\n * by this chunk's styles.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns A stable cache key string\n */\nexport function generateChunkCacheKey(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n): string {\n // Start with chunk name for namespace separation\n const parts: string[] = [chunkName];\n\n // styleKeys are already sorted by categorizeStyleKeys\n let chunkStylesStr = '';\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n // Use stable stringify for consistent serialization regardless of key order\n const serialized = stableStringify(value);\n parts.push(`${key}:${serialized}`);\n chunkStylesStr += serialized;\n }\n }\n\n // Extract local predefined states from the full styles object\n const localStates = extractLocalPredefinedStates(styles);\n\n // Only include local predefined states that are actually referenced in this chunk\n if (Object.keys(localStates).length > 0) {\n const referencedStates = extractPredefinedStateRefs(chunkStylesStr);\n const relevantLocalStates: string[] = [];\n\n for (const stateName of referencedStates) {\n if (localStates[stateName]) {\n relevantLocalStates.push(`${stateName}=${localStates[stateName]}`);\n }\n }\n\n // Add relevant local states to the cache key (sorted for stability)\n if (relevantLocalStates.length > 0) {\n relevantLocalStates.sort();\n parts.unshift(`[states:${relevantLocalStates.join('|')}]`);\n }\n }\n\n // Use null character as separator (safe, not in JSON output)\n return parts.join('\\0');\n}\n","/**\n * Chunk-specific style rendering.\n *\n * Renders styles for a specific chunk by filtering the styles object\n * to only include relevant keys before passing to renderStyles.\n */\n\nimport type { RenderResult } from '../pipeline';\nimport { hasPipelineCacheEntry, renderStyles } from '../pipeline';\nimport { extractLocalPredefinedStates } from '../states';\nimport type { Styles } from '../styles/types';\n\nimport { CHUNK_NAMES } from './definitions';\n\n/**\n * Build a filtered styles object for a regular chunk.\n */\nfunction buildFilteredStyles(styles: Styles, styleKeys: string[]): Styles {\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n const filteredStyles: Styles = {};\n\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n for (const key of styleKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n return filteredStyles;\n}\n\n/**\n * Build a filtered styles object for the subcomponents chunk.\n */\nfunction buildSubcomponentFilteredStyles(\n styles: Styles,\n selectorKeys: string[],\n): Styles {\n const localPredefinedStates = extractLocalPredefinedStates(styles);\n const filteredStyles: Styles = {};\n\n for (const [key, value] of Object.entries(localPredefinedStates)) {\n filteredStyles[key] = value;\n }\n\n for (const key of selectorKeys) {\n const value = styles[key];\n if (value !== undefined) {\n filteredStyles[key] = value;\n }\n }\n\n if (styles.$ !== undefined) {\n filteredStyles.$ = styles.$;\n }\n\n return filteredStyles;\n}\n\n/**\n * Render styles for a specific chunk.\n *\n * On pipeline cache hit, avoids building the filtered styles object entirely.\n * Only constructs it on cache miss when the pipeline actually needs the styles.\n *\n * IMPORTANT: Local predefined states (e.g., '@mobile': '@media(w < 600px)')\n * are always included in the filtered styles, regardless of which chunk is\n * being rendered. This ensures that state references like '@mobile' in any\n * chunk can be properly resolved by the pipeline.\n *\n * @param styles - The full styles object\n * @param chunkName - Name of the chunk being rendered\n * @param styleKeys - Keys of styles belonging to this chunk\n * @returns RenderResult with rules for this chunk\n */\nexport function renderStylesForChunk(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n pipelineCacheKey?: string,\n): RenderResult {\n if (styleKeys.length === 0) {\n return { rules: [], className: '' };\n }\n\n // Fast path: skip building filteredStyles when pipeline has a cached result\n if (pipelineCacheKey && hasPipelineCacheEntry(pipelineCacheKey)) {\n return renderStyles(undefined, undefined, undefined, pipelineCacheKey);\n }\n\n // Cache miss: build filtered styles and run pipeline\n const filteredStyles =\n chunkName === CHUNK_NAMES.SUBCOMPONENTS\n ? buildSubcomponentFilteredStyles(styles, styleKeys)\n : buildFilteredStyles(styles, styleKeys);\n\n return renderStyles(filteredStyles, undefined, undefined, pipelineCacheKey);\n}\n","/**\n * Keyframes Utilities\n *\n * Optimized utilities for extracting and processing keyframes in styles.\n * Designed for zero overhead when no keyframes are used.\n */\n\nimport type { KeyframesSteps } from '../injector/types';\nimport type { Styles } from '../styles/types';\n\n// ============================================================================\n// Constants\n// ============================================================================\n\nconst KEYFRAMES_KEY = '@keyframes';\n\n/**\n * Pattern to extract animation names from CSS animation property values.\n * Animation name is typically the first identifier in the shorthand.\n * Handles: \"fadeIn 300ms ease-in\", \"pulse 1s infinite\", etc.\n *\n * CSS animation shorthand order (all optional except name):\n * animation: name | duration | timing | delay | iteration | direction | fill-mode | play-state\n *\n * Animation names must:\n * - Start with a letter, underscore, or hyphen (but not a digit or CSS keyword)\n * - Not be CSS keywords: none, initial, inherit, unset, revert\n */\nconst CSS_KEYWORDS = new Set([\n 'none',\n 'initial',\n 'inherit',\n 'unset',\n 'revert',\n 'auto',\n 'normal',\n 'running',\n 'paused',\n]);\n\n/**\n * Pattern to match animation name at the start of an animation value.\n * Must start with letter, underscore, or hyphen (not digit).\n */\nconst ANIMATION_NAME_PATTERN = /^([a-zA-Z_-][a-zA-Z0-9_-]*)/;\n\n// ============================================================================\n// Extraction Functions\n// ============================================================================\n\n/**\n * Check if styles object has local @keyframes definition.\n * Fast path: single property lookup.\n */\nexport function hasLocalKeyframes(styles: Styles): boolean {\n return KEYFRAMES_KEY in styles;\n}\n\n/**\n * Extract local @keyframes from styles object.\n * Returns null if no local keyframes (fast path).\n */\nexport function extractLocalKeyframes(\n styles: Styles,\n): Record<string, KeyframesSteps> | null {\n const keyframes = styles[KEYFRAMES_KEY];\n if (!keyframes || typeof keyframes !== 'object') {\n return null;\n }\n return keyframes as Record<string, KeyframesSteps>;\n}\n\n/**\n * Merge local and global keyframes.\n * Local keyframes take priority over global.\n * Returns null if no keyframes exist (fast path).\n */\nexport function mergeKeyframes(\n local: Record<string, KeyframesSteps> | null,\n global: Record<string, KeyframesSteps> | null,\n): Record<string, KeyframesSteps> | null {\n if (!local && !global) return null;\n if (!local) return global;\n if (!global) return local;\n // Local overrides global\n return { ...global, ...local };\n}\n\n// ============================================================================\n// Animation Name Extraction\n// ============================================================================\n\n/**\n * Extract animation name from a single animation value.\n * Returns null if no valid name found.\n *\n * Examples:\n * - \"fadeIn 300ms ease-in\" → \"fadeIn\"\n * - \"1s pulse infinite\" → \"pulse\" (name can be anywhere)\n * - \"none\" → null (CSS keyword)\n * - \"300ms ease-in\" → null (no name, just duration/timing)\n */\nfunction extractAnimationNameFromValue(value: string): string | null {\n const trimmed = value.trim();\n if (!trimmed) return null;\n\n // Split by whitespace and find the first valid animation name\n const parts = trimmed.split(/\\s+/);\n\n for (const part of parts) {\n // Skip CSS keywords\n if (CSS_KEYWORDS.has(part.toLowerCase())) continue;\n\n // Skip time values (e.g., 300ms, 1s, 0.5s)\n if (/^-?[\\d.]+m?s$/i.test(part)) continue;\n\n // Skip iteration counts (e.g., infinite, 3)\n if (part === 'infinite' || /^\\d+$/.test(part)) continue;\n\n // Skip direction values\n if (\n ['normal', 'reverse', 'alternate', 'alternate-reverse'].includes(\n part.toLowerCase(),\n )\n )\n continue;\n\n // Skip fill-mode values\n if (['forwards', 'backwards', 'both'].includes(part.toLowerCase()))\n continue;\n\n // Skip play-state values\n if (['running', 'paused'].includes(part.toLowerCase())) continue;\n\n // Skip timing functions (ease, linear, ease-in, etc., or cubic-bezier/steps)\n if (\n /^(ease|linear|ease-in|ease-out|ease-in-out|step-start|step-end)$/i.test(\n part,\n )\n )\n continue;\n if (/^(cubic-bezier|steps)\\(/i.test(part)) continue;\n\n // Check if it looks like a valid animation name\n const match = ANIMATION_NAME_PATTERN.exec(part);\n if (match) {\n return match[1];\n }\n }\n\n return null;\n}\n\n/**\n * Extract all animation names from an animation property value.\n * Handles multiple animations separated by commas.\n *\n * Example: \"fadeIn 300ms, slideIn 500ms ease-out\" → [\"fadeIn\", \"slideIn\"]\n */\nfunction extractAnimationNamesFromAnimationValue(value: string): string[] {\n const names: string[] = [];\n\n // Split by comma for multiple animations\n const animations = value.split(',');\n\n for (const animation of animations) {\n const name = extractAnimationNameFromValue(animation);\n if (name && !names.includes(name)) {\n names.push(name);\n }\n }\n\n return names;\n}\n\n/**\n * Extract animation names from a style value (handles mappings and arrays).\n */\nfunction extractAnimationNamesFromStyleValue(\n value: unknown,\n names: Set<string>,\n): void {\n if (typeof value === 'string') {\n for (const name of extractAnimationNamesFromAnimationValue(value)) {\n names.add(name);\n }\n } else if (Array.isArray(value)) {\n // Responsive array\n for (const v of value) {\n extractAnimationNamesFromStyleValue(v, names);\n }\n } else if (value && typeof value === 'object') {\n // State mapping\n for (const v of Object.values(value)) {\n extractAnimationNamesFromStyleValue(v, names);\n }\n }\n}\n\n/**\n * Extract all animation names referenced in styles.\n * Scans 'animation' and 'animationName' properties including in state mappings.\n * Returns empty set if no animation properties found (fast path).\n */\nexport function extractAnimationNamesFromStyles(styles: Styles): Set<string> {\n const names = new Set<string>();\n\n // Check animation property\n if ('animation' in styles) {\n extractAnimationNamesFromStyleValue(styles.animation, names);\n }\n\n // Check animationName property\n if ('animationName' in styles) {\n extractAnimationNamesFromStyleValue(styles.animationName, names);\n }\n\n // Check nested selectors (sub-elements)\n for (const [key, value] of Object.entries(styles)) {\n // Skip non-selector keys and special keys\n if (key === '$' || key === KEYFRAMES_KEY) continue;\n\n // Check if it's a selector (starts with &, ., or uppercase)\n if (\n (key.startsWith('&') || key.startsWith('.') || /^[A-Z]/.test(key)) &&\n value &&\n typeof value === 'object'\n ) {\n // Recursively extract from nested styles\n const nestedNames = extractAnimationNamesFromStyles(value as Styles);\n for (const name of nestedNames) {\n names.add(name);\n }\n }\n }\n\n return names;\n}\n\n// ============================================================================\n// Name Replacement\n// ============================================================================\n\n/**\n * Replace animation names in CSS declarations with injected names.\n * Optimized to avoid regex creation - uses simple string replacement.\n *\n * @param declarations CSS declarations string\n * @param nameMap Map from original name to injected name (only contains names that differ)\n * @returns Updated declarations string\n */\nexport function replaceAnimationNames(\n declarations: string,\n nameMap: Map<string, string>,\n): string {\n // Fast path: no animation properties\n if (!declarations.includes('animation')) return declarations;\n\n // Parse and replace\n const parts = declarations.split(';');\n let modified = false;\n\n for (let i = 0; i < parts.length; i++) {\n const part = parts[i];\n const colonIdx = part.indexOf(':');\n if (colonIdx === -1) continue;\n\n const prop = part.slice(0, colonIdx).trim().toLowerCase();\n\n if (prop === 'animation' || prop === 'animation-name') {\n const prefix = part.slice(0, colonIdx + 1);\n let value = part.slice(colonIdx + 1);\n\n // Replace each animation name using simple word replacement\n for (const [original, injected] of nameMap) {\n // Simple word boundary replacement without regex\n const newValue = replaceWord(value, original, injected);\n if (newValue !== value) {\n value = newValue;\n modified = true;\n }\n }\n\n parts[i] = prefix + value;\n }\n }\n\n return modified ? parts.join(';') : declarations;\n}\n\n/**\n * Replace a word in a string (word boundary aware, no regex).\n */\nfunction replaceWord(str: string, word: string, replacement: string): string {\n let result = str;\n let idx = 0;\n\n while ((idx = result.indexOf(word, idx)) !== -1) {\n // Check word boundaries\n const before = idx === 0 ? ' ' : result[idx - 1];\n const after =\n idx + word.length >= result.length ? ' ' : result[idx + word.length];\n\n const isWordBoundaryBefore = !/[a-zA-Z0-9_-]/.test(before);\n const isWordBoundaryAfter = !/[a-zA-Z0-9_-]/.test(after);\n\n if (isWordBoundaryBefore && isWordBoundaryAfter) {\n result =\n result.slice(0, idx) + replacement + result.slice(idx + word.length);\n idx += replacement.length;\n } else {\n idx += word.length;\n }\n }\n\n return result;\n}\n\n// ============================================================================\n// Filter Functions\n// ============================================================================\n\n/**\n * Filter keyframes to only those that are actually used.\n * Returns null if no keyframes are used (fast path).\n */\nexport function filterUsedKeyframes(\n keyframes: Record<string, KeyframesSteps> | null,\n usedNames: Set<string>,\n): Record<string, KeyframesSteps> | null {\n if (!keyframes || usedNames.size === 0) return null;\n\n const used: Record<string, KeyframesSteps> = {};\n let hasAny = false;\n\n for (const name of usedNames) {\n if (keyframes[name]) {\n used[name] = keyframes[name];\n hasAny = true;\n }\n }\n\n return hasAny ? used : null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,MAAa,0BAA0B;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;AAUD,MAAa,oBAAoB;CAE/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;;AAYD,MAAa,yBAAyB;CAEpC;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;;;;AAYD,MAAa,uBAAuB;CAElC;CACA;CACA;CACA;CACA;CAEA;CAEA;CAEA;CACD;;;;;;;;AASD,MAAa,sBAAsB;CAEjC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;;AASD,MAAa,wBAAwB;CACnC;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAMD,MAAa,cAAc;;CAEzB,UAAU;CACV,eAAe;CACf,YAAY;CACZ,MAAM;CACN,WAAW;CACX,SAAS;CACT,QAAQ;CACR,UAAU;CACV,MAAM;CACP;;;;;AAYD,MAAa,iCAAiB,IAAI,KAAwB;AAG1D,SAAS,0BAA0B;CACjC,KAAK,MAAM,SAAS,yBAClB,eAAe,IAAI,OAAO,YAAY,WAAW;CAEn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ht as isDevEnv, x as isSelector } from "./config-BBiyxMCe.js";
1
+ import { ht as isDevEnv, x as isSelector } from "./config-DF2QZQEW.js";
2
2
  //#region src/utils/merge-styles.ts
3
3
  const devMode = isDevEnv();
4
4
  const INHERIT_VALUE = "@inherit";
@@ -141,4 +141,4 @@ function mergeStyles(...objects) {
141
141
  //#endregion
142
142
  export { mergeStyles as t };
143
143
 
144
- //# sourceMappingURL=merge-styles-Cd2vBl9b.js.map
144
+ //# sourceMappingURL=merge-styles-Bnn6j_SA.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-styles-Cd2vBl9b.js","names":[],"sources":["../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":";;AAKA,MAAM,UAAU,UAAU;AAE1B,MAAM,gBAAgB;;;;AAKtB,SAAS,WAAW,OAAkD;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;;;;;;;AAS7E,SAAS,oBAAoB,OAAgD;CAC3E,IAAI,WAAW,MAAM,EAAE,OAAO;CAC9B,IAAI,SAAS,QAAQ,UAAU,OAAO,OAAO,EAAE,IAAI,OAAO;CAC1D,OAAO;;;;;;;;;;;;;;AAeT,SAAS,gBACP,aACA,UACyB;CACzB,MAAM,WAAW,EAAE,MAAM;CACzB,MAAM,YAAY,oBAAoB,YAAY;CAElD,IAAI,CAAC,WAAW;EAEd,MAAM,SAAkC,EAAE;EAC1C,KAAK,MAAM,OAAO,OAAO,KAAK,SAAS,EAAE;GACvC,MAAM,MAAM,SAAS;GACrB,IAAI,QAAQ,QAAQ,QAAQ,eAAe;GAC3C,OAAO,OAAO;;EAEhB,OAAO;;CAGT,IAAI,UACF,OAAO,kBAAkB,WAAW,SAAS;CAG/C,OAAO,mBAAmB,WAAW,SAAS;;;;;AAMhD,SAAS,kBACP,WACA,UACyB;CACzB,MAAM,8BAAc,IAAI,KAAa;CACrC,MAAM,6BAAa,IAAI,KAAa;CACpC,MAAM,+BAAe,IAAI,KAAsB;CAE/C,KAAK,MAAM,OAAO,OAAO,KAAK,SAAS,EAAE;EACvC,MAAM,MAAM,SAAS;EACrB,IAAI,QAAQ;OACN,OAAO,WACT,YAAY,IAAI,IAAI;QACf,IAAI,SACT,QAAQ,KACN,o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B,IACD;;CAIL,OAAO;;AAGT,SAAgB,YAAY,GAAG,SAAgD;CAC7E,IAAI,SAAiB,QAAQ,KAAK,EAAE,GAAG,QAAQ,IAAI,GAAG,EAAE;CACxD,IAAI,MAAM;CAEV,OAAO,OAAO,SAAS;EACrB,MAAM,eAAe,OAAO,KAAK,OAAO,CAAC,QACtC,QAAQ,WAAW,IAAI,IAAI,OAAO,KACpC;EACD,MAAM,YAAY,QAAQ;EAE1B,IAAI,WAAW;GACb,MAAM,eAAe;IAAE,GAAG;IAAQ,GAAG;IAAW;GAGhD,MAAM,kBAAkB,OAAO,KAAK,UAAU,CAAC,OAAO,WAAW;GACjE,MAAM,kBAAkB,IAAI,IAAI,CAAC,GAAG,cAAc,GAAG,gBAAgB,CAAC;GAEtE,KAAK,MAAM,OAAO,iBAAiB;IACjC,MAAM,WAAW,YAAY;IAE7B,IAAI,aAAa,SAAS,aAAa,MACrC,OAAO,aAAa;SACf,IAAI,aAAa,KAAA,GACtB,aAAa,OAAO,OAAO;SACtB,IAAI,UACT,aAAa,OAAO,sBAClB,OAAO,MACP,SACD;;GAKL,KAAK,MAAM,OAAO,OAAO,KAAK,UAAU,EAAE;IACxC,IAAI,WAAW,IAAI,EAAE;IAErB,MAAM,WAAW,UAAU;IAE3B,IAAI,aAAa,KAAA,GACf,IAAI,OAAO,QACT,aAAa,OAAO,OAAO;SAE3B,OAAO,aAAa;SAEjB,IAAI,aAAa,MACtB,OAAO,aAAa;SACf,IAAI,WAAW,SAAS,EAC7B,aAA0C,OAAO,gBAC/C,OAAO,MACP,SACD;;GAIL,SAAS;;EAGX;;CAGF,OAAO"}
1
+ {"version":3,"file":"merge-styles-Bnn6j_SA.js","names":[],"sources":["../src/utils/merge-styles.ts"],"sourcesContent":["import { isSelector } from '../pipeline';\nimport type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const inheritKeys = new Set<string>();\n const removeKeys = new Set<string>();\n const overrideKeys = new Map<string, unknown>();\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n inheritKeys.add(key);\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val === null) {\n removeKeys.add(key);\n } else if (key in parentMap) {\n overrideKeys.set(key, val);\n }\n }\n\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(parentMap)) {\n if (removeKeys.has(key)) continue;\n if (inheritKeys.has(key)) continue;\n if (overrideKeys.has(key)) {\n result[key] = overrideKeys.get(key);\n } else {\n result[key] = parentMap[key];\n }\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of Object.keys(childMap)) {\n if (inheritKeys.has(key)) {\n result[key] = parentMap[key];\n } else if (\n !removeKeys.has(key) &&\n !overrideKeys.has(key) &&\n // Skip @inherit for keys that weren't in the parent (already warned above)\n childMap[key] !== INHERIT_VALUE\n ) {\n result[key] = childMap[key];\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":";;AAKA,MAAM,UAAU,UAAU;AAE1B,MAAM,gBAAgB;;;;AAKtB,SAAS,WAAW,OAAkD;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,MAAM;;;;;;;;AAS7E,SAAS,oBAAoB,OAAgD;CAC3E,IAAI,WAAW,MAAM,EAAE,OAAO;CAC9B,IAAI,SAAS,QAAQ,UAAU,OAAO,OAAO,EAAE,IAAI,OAAO;CAC1D,OAA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ACrC,OAAO,aAAa;SACf,IAAI,aAAa,KAAA,GACtB,aAAa,OAAO,OAAO;SACtB,IAAI,UACT,aAAa,OAAO,sBAClB,OAAO,MACP,SACD;;GAKL,KAAK,MAAM,OAAO,OAAO,KAAK,UAAU,EAAE;IACxC,IAAI,WAAW,IAAI,EAAE;IAErB,MAAM,WAAW,UAAU;IAE3B,IAAI,aAAa,KAAA,GACf,IAAI,OAAO,QACT,aAAa,OAAO,OAAO;SAE3B,OAAO,aAAa;SAEjB,IAAI,aAAa,MACtB,OAAO,aAAa;SACf,IAAI,WAAW,SAAS,EAC7B,aAA0C,OAAO,gBAC/C,OAAO,MACP,SACD;;GAIL,SAAS;;EAGX;;CAGF,OAAO"}
@@ -1,5 +1,5 @@
1
- import { ht as isDevEnv, l as getGlobalRecipes, x as isSelector } from "./config-BBiyxMCe.js";
2
- import { t as mergeStyles } from "./merge-styles-Cd2vBl9b.js";
1
+ import { ht as isDevEnv, l as getGlobalRecipes, x as isSelector } from "./config-DF2QZQEW.js";
2
+ import { t as mergeStyles } from "./merge-styles-Bnn6j_SA.js";
3
3
  //#region src/utils/resolve-recipes.ts
4
4
  /**
5
5
  * Recipe resolution utility.
@@ -141,4 +141,4 @@ function resolveRecipes(styles) {
141
141
  //#endregion
142
142
  export { resolveRecipes as t };
143
143
 
144
- //# sourceMappingURL=resolve-recipes-C1nrvnYh.js.map
144
+ //# sourceMappingURL=resolve-recipes-CBQaQ3tD.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-recipes-C1nrvnYh.js","names":[],"sources":["../src/utils/resolve-recipes.ts"],"sourcesContent":["/**\n * Recipe resolution utility.\n *\n * Resolves `recipe` style properties by looking up predefined recipe styles\n * from global configuration and merging them with the component's own styles.\n *\n * Resolution order per level (top-level and each sub-element independently):\n * base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2\n *\n * The `/` separator splits base recipes (before component styles)\n * from post recipes (after component styles). All merges use mergeStyles\n * semantics: primitives and state maps with '' key fully replace;\n * state maps without '' key extend the existing value.\n *\n * Returns the same object reference if no recipes are present (zero overhead).\n */\n\nimport { getGlobalRecipes } from '../config';\nimport { isSelector } from '../pipeline';\nimport type { RecipeStyles, Styles } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { mergeStyles } from './merge-styles';\n\nconst devMode = isDevEnv();\n\ninterface ParsedRecipeGroups {\n base: string[] | null;\n post: string[] | null;\n}\n\n/**\n * Parse a recipe string into base and post recipe name groups.\n *\n * Syntax: `'base1 base2 / post1 post2'`\n * - Names are space-separated within each group\n * - `/` separates base (before component) from post (after component) groups\n * - `/` is optional; if absent, all names are base\n * - `none` as the sole base value means \"no base recipes\"\n *\n * Returns `{ base: null, post: null }` if the string is empty or invalid.\n */\nfunction parseRecipeNames(value: unknown): ParsedRecipeGroups {\n const empty: ParsedRecipeGroups = { base: null, post: null };\n\n if (typeof value !== 'string') return empty;\n const trimmed = value.trim();\n if (trimmed === '') return empty;\n\n const slashIndex = trimmed.indexOf('/');\n\n if (slashIndex === -1) {\n if (trimmed === 'none') return empty;\n const names = splitNames(trimmed);\n return { base: names, post: null };\n }\n\n const basePart = trimmed.slice(0, slashIndex);\n const postPart = trimmed.slice(slashIndex + 1);\n\n return {\n base: basePart.trim() === 'none' ? null : splitNames(basePart),\n post: splitNames(postPart),\n };\n}\n\nfunction splitNames(s: string): string[] | null {\n const names = s.split(/\\s+/).filter(Boolean);\n return names.length > 0 ? names : null;\n}\n\n/**\n * Collect merged styles for a list of recipe names.\n * Each recipe is flat-spread on top of the previous.\n */\nfunction collectRecipeStyles(\n names: string[],\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> {\n let merged: Record<string, unknown> = {};\n\n for (const name of names) {\n const recipeStyles = recipes[name];\n\n if (!recipeStyles) {\n if (devMode) {\n console.warn(\n `[Tasty] Recipe \"${name}\" not found. ` +\n `Make sure it is defined in configure({ recipes: { ... } }).`,\n );\n }\n continue;\n }\n\n merged = { ...merged, ...(recipeStyles as Record<string, unknown>) };\n }\n\n return merged;\n}\n\n/**\n * Resolve recipe references in a flat styles object (no sub-elements).\n * Returns null if no `recipe` key is present.\n *\n * Resolution: base recipes → component styles → post recipes (all via mergeStyles)\n */\nfunction resolveRecipesForLevel(\n styles: Record<string, unknown>,\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> | null {\n if (!('recipe' in styles)) return null;\n\n const { base, post } = parseRecipeNames(styles.recipe);\n\n // Separate selector keys (sub-elements) from flat style properties.\n // mergeStyles handles selectors with its own semantics (e.g. false = delete),\n // but at this level we only want recipe merging on flat properties.\n\n const { recipe: _recipe, ...allRest } = styles;\n const flatStyles: Record<string, unknown> = {};\n const selectorStyles: Record<string, unknown> = {};\n\n for (const key of Object.keys(allRest)) {\n if (isSelector(key)) {\n selectorStyles[key] = allRest[key];\n } else {\n flatStyles[key] = allRest[key];\n }\n }\n\n if (!base && !post) {\n return allRest;\n }\n\n // 1. Merge base recipes, then component styles on top (via mergeStyles)\n let result: Record<string, unknown>;\n\n if (base) {\n const baseStyles = collectRecipeStyles(base, recipes);\n result = mergeStyles(baseStyles as Styles, flatStyles as Styles) as Record<\n string,\n unknown\n >;\n } else {\n result = { ...flatStyles };\n }\n\n // 2. Apply post recipes via mergeStyles (state map extend semantics)\n if (post) {\n const postStyles = collectRecipeStyles(post, recipes);\n result = mergeStyles(result as Styles, postStyles as Styles) as Record<\n string,\n unknown\n >;\n }\n\n // Re-attach selector keys unchanged\n for (const key of Object.keys(selectorStyles)) {\n result[key] = selectorStyles[key];\n }\n\n return result;\n}\n\n/**\n * Resolve all `recipe` style properties in a styles object.\n *\n * Handles both top-level and sub-element recipe references.\n * Returns the same object reference if no recipes are present anywhere\n * (zero overhead for the common case).\n *\n * @param styles - The styles object potentially containing `recipe` keys\n * @returns Resolved styles with recipe values merged in, or the original object if unchanged\n */\nexport function resolveRecipes(styles: Styles): Styles {\n const recipes = getGlobalRecipes();\n\n // Fast path: no recipes configured globally\n if (!recipes) return styles;\n\n let changed = false;\n\n // Resolve top-level recipe\n const topResolved = resolveRecipesForLevel(\n styles as Record<string, unknown>,\n recipes,\n );\n\n let result: Record<string, unknown>;\n\n if (topResolved) {\n changed = true;\n result = topResolved;\n } else {\n // Keep reference; a shallow copy is deferred until a sub-element actually changes\n result = styles as Record<string, unknown>;\n }\n\n // Resolve sub-element recipes\n const keys = Object.keys(result);\n\n for (const key of keys) {\n if (!isSelector(key)) continue;\n\n const subStyles = result[key];\n\n if (\n !subStyles ||\n typeof subStyles !== 'object' ||\n Array.isArray(subStyles)\n ) {\n continue;\n }\n\n const subRecord = subStyles as Record<string, unknown>;\n\n if (!('recipe' in subRecord)) continue;\n\n const subResolved = resolveRecipesForLevel(subRecord, recipes);\n\n if (subResolved) {\n if (!changed) {\n // First change in sub-elements -- need to shallow-copy the top level\n changed = true;\n result = { ...(styles as Record<string, unknown>) };\n }\n result[key] = subResolved;\n }\n }\n\n return changed ? (result as Styles) : styles;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAM,UAAU,UAAU;;;;;;;;;;;;AAkB1B,SAAS,iBAAiB,OAAoC;CAC5D,MAAM,QAA4B;EAAE,MAAM;EAAM,MAAM;EAAM;CAE5D,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,UAAU,MAAM,MAAM;CAC5B,IAAI,YAAY,IAAI,OAAO;CAE3B,MAAM,aAAa,QAAQ,QAAQ,IAAI;CAEvC,IAAI,eAAe,IAAI;EACrB,IAAI,YAAY,QAAQ,OAAO;EAE/B,OAAO;GAAE,MADK,WAAW,QACL;GAAE,MAAM;GAAM;;CAGpC,MAAM,WAAW,QAAQ,MAAM,GAAG,WAAW;CAC7C,MAAM,WAAW,QAAQ,MAAM,aAAa,EAAE;CAE9C,OAAO;EACL,MAAM,SAAS,MAAM,KAAK,SAAS,OAAO,WAAW,SAAS;EAC9D,MAAM,WAAW,SAAS;EAC3B;;AAGH,SAAS,WAAW,GAA4B;CAC9C,MAAM,QAAQ,EAAE,MAAM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,OAAO;CAEhC,KAAK,MAAM,OAAO,MAAM;EACtB,IAAI,CAAC,WAAW,IAAI,EAAE;EAEtB,MAAM,YAAY,OAAO;EAEzB,IACE,CAAC,aACD,OAAO,cAAc,YACrB,MAAM,QAAQ,UAAU,EAExB;EAGF,MAAM,YAAY;EAElB,IAAI,EAAE,YAAY,YAAY;EAE9B,MAAM,cAAc,uBAAuB,WAAW,QAAQ;EAE9D,IAAI,aAAa;GACf,IAAI,CAAC,SAAS;IAEZ,UAAU;IACV,SAAS,EAAE,GAAI,QAAoC;;GAErD,OAAO,OAAO;;;CAIlB,OAAO,UAAW,SAAoB"}
1
+ {"version":3,"file":"resolve-recipes-CBQaQ3tD.js","names":[],"sources":["../src/utils/resolve-recipes.ts"],"sourcesContent":["/**\n * Recipe resolution utility.\n *\n * Resolves `recipe` style properties by looking up predefined recipe styles\n * from global configuration and merging them with the component's own styles.\n *\n * Resolution order per level (top-level and each sub-element independently):\n * base_recipe_1 base_recipe_2 → component styles → post_recipe_1 post_recipe_2\n *\n * The `/` separator splits base recipes (before component styles)\n * from post recipes (after component styles). All merges use mergeStyles\n * semantics: primitives and state maps with '' key fully replace;\n * state maps without '' key extend the existing value.\n *\n * Returns the same object reference if no recipes are present (zero overhead).\n */\n\nimport { getGlobalRecipes } from '../config';\nimport { isSelector } from '../pipeline';\nimport type { RecipeStyles, Styles } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { mergeStyles } from './merge-styles';\n\nconst devMode = isDevEnv();\n\ninterface ParsedRecipeGroups {\n base: string[] | null;\n post: string[] | null;\n}\n\n/**\n * Parse a recipe string into base and post recipe name groups.\n *\n * Syntax: `'base1 base2 / post1 post2'`\n * - Names are space-separated within each group\n * - `/` separates base (before component) from post (after component) groups\n * - `/` is optional; if absent, all names are base\n * - `none` as the sole base value means \"no base recipes\"\n *\n * Returns `{ base: null, post: null }` if the string is empty or invalid.\n */\nfunction parseRecipeNames(value: unknown): ParsedRecipeGroups {\n const empty: ParsedRecipeGroups = { base: null, post: null };\n\n if (typeof value !== 'string') return empty;\n const trimmed = value.trim();\n if (trimmed === '') return empty;\n\n const slashIndex = trimmed.indexOf('/');\n\n if (slashIndex === -1) {\n if (trimmed === 'none') return empty;\n const names = splitNames(trimmed);\n return { base: names, post: null };\n }\n\n const basePart = trimmed.slice(0, slashIndex);\n const postPart = trimmed.slice(slashIndex + 1);\n\n return {\n base: basePart.trim() === 'none' ? null : splitNames(basePart),\n post: splitNames(postPart),\n };\n}\n\nfunction splitNames(s: string): string[] | null {\n const names = s.split(/\\s+/).filter(Boolean);\n return names.length > 0 ? names : null;\n}\n\n/**\n * Collect merged styles for a list of recipe names.\n * Each recipe is flat-spread on top of the previous.\n */\nfunction collectRecipeStyles(\n names: string[],\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> {\n let merged: Record<string, unknown> = {};\n\n for (const name of names) {\n const recipeStyles = recipes[name];\n\n if (!recipeStyles) {\n if (devMode) {\n console.warn(\n `[Tasty] Recipe \"${name}\" not found. ` +\n `Make sure it is defined in configure({ recipes: { ... } }).`,\n );\n }\n continue;\n }\n\n merged = { ...merged, ...(recipeStyles as Record<string, unknown>) };\n }\n\n return merged;\n}\n\n/**\n * Resolve recipe references in a flat styles object (no sub-elements).\n * Returns null if no `recipe` key is present.\n *\n * Resolution: base recipes → component styles → post recipes (all via mergeStyles)\n */\nfunction resolveRecipesForLevel(\n styles: Record<string, unknown>,\n recipes: Record<string, RecipeStyles>,\n): Record<string, unknown> | null {\n if (!('recipe' in styles)) return null;\n\n const { base, post } = parseRecipeNames(styles.recipe);\n\n // Separate selector keys (sub-elements) from flat style properties.\n // mergeStyles handles selectors with its own semantics (e.g. false = delete),\n // but at this level we only want recipe merging on flat properties.\n\n const { recipe: _recipe, ...allRest } = styles;\n const flatStyles: Record<string, unknown> = {};\n const selectorStyles: Record<string, unknown> = {};\n\n for (const key of Object.keys(allRest)) {\n if (isSelector(key)) {\n selectorStyles[key] = allRest[key];\n } else {\n flatStyles[key] = allRest[key];\n }\n }\n\n if (!base && !post) {\n return allRest;\n }\n\n // 1. Merge base recipes, then component styles on top (via mergeStyles)\n let result: Record<string, unknown>;\n\n if (base) {\n const baseStyles = collectRecipeStyles(base, recipes);\n result = mergeStyles(baseStyles as Styles, flatStyles as Styles) as Record<\n string,\n unknown\n >;\n } else {\n result = { ...flatStyles };\n }\n\n // 2. Apply post recipes via mergeStyles (state map extend semantics)\n if (post) {\n const postStyles = collectRecipeStyles(post, recipes);\n result = mergeStyles(result as Styles, postStyles as Styles) as Record<\n string,\n unknown\n >;\n }\n\n // Re-attach selector keys unchanged\n for (const key of Object.keys(selectorStyles)) {\n result[key] = selectorStyles[key];\n }\n\n return result;\n}\n\n/**\n * Resolve all `recipe` style properties in a styles object.\n *\n * Handles both top-level and sub-element recipe references.\n * Returns the same object reference if no recipes are present anywhere\n * (zero overhead for the common case).\n *\n * @param styles - The styles object potentially containing `recipe` keys\n * @returns Resolved styles with recipe values merged in, or the original object if unchanged\n */\nexport function resolveRecipes(styles: Styles): Styles {\n const recipes = getGlobalRecipes();\n\n // Fast path: no recipes configured globally\n if (!recipes) return styles;\n\n let changed = false;\n\n // Resolve top-level recipe\n const topResolved = resolveRecipesForLevel(\n styles as Record<string, unknown>,\n recipes,\n );\n\n let result: Record<string, unknown>;\n\n if (topResolved) {\n changed = true;\n result = topResolved;\n } else {\n // Keep reference; a shallow copy is deferred until a sub-element actually changes\n result = styles as Record<string, unknown>;\n }\n\n // Resolve sub-element recipes\n const keys = Object.keys(result);\n\n for (const key of keys) {\n if (!isSelector(key)) continue;\n\n const subStyles = result[key];\n\n if (\n !subStyles ||\n typeof subStyles !== 'object' ||\n Array.isArray(subStyles)\n ) {\n continue;\n }\n\n const subRecord = subStyles as Record<string, unknown>;\n\n if (!('recipe' in subRecord)) continue;\n\n const subResolved = resolveRecipesForLevel(subRecord, recipes);\n\n if (subResolved) {\n if (!changed) {\n // First change in sub-elements -- need to shallow-copy the top level\n changed = true;\n result = { ...(styles as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/astro-client.ts
3
3
  /**
4
4
  * Client-side cache hydration for Astro islands.
package/dist/ssr/astro.js CHANGED
@@ -1,6 +1,6 @@
1
- import { n as getConfig } from "../config-BBiyxMCe.js";
2
- import { a as registerSSRCollectorGetterGlobal } from "../format-rules-BSjeH4Z7.js";
3
- import { t as ServerStyleCollector } from "../collector-C-keQH9m.js";
1
+ import { n as getConfig } from "../config-DF2QZQEW.js";
2
+ import { a as registerSSRCollectorGetterGlobal } from "../format-rules-DCI2lomx.js";
3
+ import { t as ServerStyleCollector } from "../collector-BWvvN7_y.js";
4
4
  import { n as runWithCollector, t as getSSRCollector } from "../async-storage-B7_o6FKt.js";
5
5
  //#region src/ssr/astro.ts
6
6
  /**
package/dist/ssr/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as registerSSRCollectorGetterGlobal } from "../format-rules-BSjeH4Z7.js";
2
- import { t as ServerStyleCollector } from "../collector-C-keQH9m.js";
1
+ import { a as registerSSRCollectorGetterGlobal } from "../format-rules-DCI2lomx.js";
2
+ import { t as ServerStyleCollector } from "../collector-BWvvN7_y.js";
3
3
  import { n as runWithCollector, t as getSSRCollector } from "../async-storage-B7_o6FKt.js";
4
- import { n as hydrateTastyClasses, t as hydrateTastyCache } from "../hydrate-CcvrP4qJ.js";
4
+ import { n as hydrateTastyClasses, t as hydrateTastyCache } from "../hydrate-DsFfFPVK.js";
5
5
  //#region src/ssr/index.ts
6
6
  registerSSRCollectorGetterGlobal(getSSRCollector);
7
7
  //#endregion
package/dist/ssr/next.js CHANGED
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { n as getConfig } from "../config-BBiyxMCe.js";
3
- import { i as registerSSRCollectorGetter } from "../format-rules-BSjeH4Z7.js";
2
+ import { n as getConfig } from "../config-DF2QZQEW.js";
3
+ import { i as registerSSRCollectorGetter } from "../format-rules-DCI2lomx.js";
4
4
  import { t as getTastySSRContext } from "../context-CkSg-kDT.js";
5
- import { t as ServerStyleCollector } from "../collector-C-keQH9m.js";
6
- import { n as hydrateTastyClasses } from "../hydrate-CcvrP4qJ.js";
5
+ import { t as ServerStyleCollector } from "../collector-BWvvN7_y.js";
6
+ import { n as hydrateTastyClasses } from "../hydrate-DsFfFPVK.js";
7
7
  import { Fragment, createElement, useState } from "react";
8
8
  import { useServerInsertedHTML } from "next/navigation";
9
9
  //#region src/ssr/next.ts
@@ -1,4 +1,4 @@
1
- import { t as mergeStyles } from "../merge-styles-Cd2vBl9b.js";
1
+ import { t as mergeStyles } from "../merge-styles-Bnn6j_SA.js";
2
2
  //#region src/static/types.ts
3
3
  /**
4
4
  * Create a StaticStyle object.
@@ -1,7 +1,7 @@
1
- import { i as getGlobalConfigTokens, t as configure, u as getGlobalStyles, v as resetConfig } from "../config-BBiyxMCe.js";
2
- import { t as mergeStyles } from "../merge-styles-Cd2vBl9b.js";
3
- import { t as resolveRecipes } from "../resolve-recipes-C1nrvnYh.js";
4
- import { a as extractPropertiesFromStyles, c as setExtractorNamePrefix, i as extractKeyframesFromStyles, n as extractCounterStyleFromStyles, o as extractStylesForSelector, r as extractFontFaceFromStyles, s as extractStylesWithChunks, t as CSSWriter } from "../css-writer-BWvwQzz0.js";
1
+ import { i as getGlobalConfigTokens, t as configure, u as getGlobalStyles, v as resetConfig } from "../config-DF2QZQEW.js";
2
+ import { t as mergeStyles } from "../merge-styles-Bnn6j_SA.js";
3
+ import { t as resolveRecipes } from "../resolve-recipes-CBQaQ3tD.js";
4
+ import { a as extractPropertiesFromStyles, c as setExtractorNamePrefix, i as extractKeyframesFromStyles, n as extractCounterStyleFromStyles, o as extractStylesForSelector, r as extractFontFaceFromStyles, s as extractStylesWithChunks, t as CSSWriter } from "../css-writer-Bh05D6KI.js";
5
5
  import * as fs from "fs";
6
6
  import * as path from "path";
7
7
  import { declare } from "@babel/helper-plugin-utils";
@@ -1,2 +1,2 @@
1
- import { o as extractStylesForSelector, s as extractStylesWithChunks, t as CSSWriter } from "../css-writer-BWvwQzz0.js";
1
+ import { o as extractStylesForSelector, s as extractStylesWithChunks, t as CSSWriter } from "../css-writer-Bh05D6KI.js";
2
2
  export { CSSWriter, extractStylesForSelector, extractStylesWithChunks };
package/docs/dsl.md CHANGED
@@ -41,6 +41,20 @@ fill: {
41
41
  }
42
42
  ```
43
43
 
44
+ #### Default State Ordering
45
+
46
+ Key order sets priority — later keys win and turn off earlier ones via negation. The bare default (`''`) is the lowest-priority state, so it **must be the first key**. If it appears after other states, Tasty moves it to the front and emits a dev warning (`MISPLACED_DEFAULT_STATE`); otherwise it would override every state above it.
47
+
48
+ ```jsx
49
+ // Correct — default first
50
+ color: { '': '#text', hovered: '#accent' }
51
+
52
+ // Auto-corrected with a warning — '' moved to the front
53
+ color: { hovered: '#accent', '': '#text' }
54
+ ```
55
+
56
+ The bare `''` default still **receives negation** (it is turned off when a higher-priority state matches). For a value that must always apply as a guaranteed floor — even where a query is *unknown* — use the [`_` fallback floor](#_--fallback-floor) instead. The two can coexist: `''` is the negated default, `_` is the always-on floor. If a map contains only `_` and `''` (no other states), the `''` default is redundant — Tasty keeps the `_` value and drops `''` with a `REDUNDANT_DEFAULT_STATE` warning.
57
+
44
58
  ### Sub-element
45
59
 
46
60
  Element styled using a capitalized key. Identified by `data-element` attribute:
@@ -288,11 +302,21 @@ const SimpleButton = tasty(Button, {
288
302
  | `@parent` | Parent/ancestor element states | `@parent(hovered)` |
289
303
  | `@own` | Sub-element's own state | `@own(hovered)` |
290
304
  | `@starting` | Entry animation | `@starting` |
305
+ | `_` | Fallback floor (always-on, never negated) | `_` |
291
306
  | `:is()` | CSS `:is()` structural pseudo-class | `:is(fieldset > label)` |
292
307
  | `:has()` | CSS `:has()` relational pseudo-class | `:has(> Icon)` |
293
308
  | `:not()` | CSS `:not()` negation (prefer `!:is()`) | `:not(:first-child)` |
294
309
  | `:where()` | CSS `:where()` (zero specificity) | `:where(Section)` |
295
310
 
311
+ > **Specificity.** All state selectors Tasty generates (modifiers, pseudo-classes,
312
+ > `:is()`/`:not()` groups, and `@root` / `@parent` context) are wrapped in
313
+ > `:where(...)` so they carry **zero specificity**. The only specificity anchors
314
+ > are the doubled component class (`.t0.t0`) and sub-element `[data-element]`
315
+ > attributes. This means overlapping rules (e.g. a `_` fallback floor and the
316
+ > states layered over it) resolve purely by **source order** — Tasty emits
317
+ > lower-priority states first and higher-priority states last so the cascade
318
+ > produces the intended winner.
319
+
296
320
  ### `@media(...)` — Media Queries
297
321
 
298
322
  Media queries support dimension shorthands and custom unit expansion:
@@ -374,6 +398,91 @@ display: {
374
398
  }
375
399
  ```
376
400
 
401
+ ### `_` — Fallback Floor
402
+
403
+ By default Tasty makes states **mutually exclusive**: a higher-priority state
404
+ turns the lower-priority ones off via negation, so exactly one branch applies.
405
+ This relies on `A | !A` always being true. CSS feature/container queries break
406
+ that assumption: `@supports(...)` and `@(...)` queries can be **unknown** (not
407
+ just true/false), and `not(unknown)` is also unknown — so a negated default
408
+ branch silently never applies. The classic case is `scroll-state`: a browser can
409
+ support `container-type: scroll-state` while a specific `scroll-state(...)` query
410
+ is unknown, leaving *no* branch active.
411
+
412
+ The `_` fallback floor solves this. Use `_` as a **standalone key** and its value
413
+ **always applies** as a guaranteed floor: it never receives negation, and
414
+ higher-priority states simply layer over it via the cascade.
415
+
416
+ ```jsx
417
+ inset: {
418
+ _: '0 top',
419
+ '@supports(container-type: scroll-state) & @(scroll-state(scrolled: block-end))':
420
+ '-80x top',
421
+ }
422
+ ```
423
+
424
+ ```css
425
+ .t0.t0 { inset: 0 ...; }
426
+ @container scroll-state(scrolled: block-end) {
427
+ @supports (container-type: scroll-state) {
428
+ .t0.t0 { inset: -80px ...; }
429
+ }
430
+ }
431
+ ```
432
+
433
+ The floor is emitted as a bare rule (no negated `@supports` / container branches),
434
+ so it always applies. When the override matches it wins because it is emitted
435
+ later and all state selectors share the same specificity (see the note on
436
+ `:where()` below).
437
+
438
+ Notes:
439
+
440
+ - `_` is a **standalone key only** — it defines a single map-wide floor and
441
+ cannot be combined with state logic. Keys like `_ & hovered` or `_ | focused`
442
+ are ignored with an `INVALID_FALLBACK_KEY` dev warning.
443
+ - `_` can coexist with the bare `''` default when other states exist: `''` is the
444
+ negated default, `_` is the always-on floor. With only `_` and `''` (no other
445
+ states) the `''` default is redundant — Tasty keeps the `_` value and drops
446
+ `''` with a `REDUNDANT_DEFAULT_STATE` warning.
447
+ - `_` is position-independent: it is always placed at the lowest priority
448
+ regardless of where it appears in the map.
449
+
450
+ #### `_` vs the `''` default
451
+
452
+ In simple maps where every other state is a plain modifier (always cleanly
453
+ on/off), `_` and `''` produce the **same visible result** — the base value shows
454
+ whenever no other state wins. They diverge in three situations, and the root
455
+ cause is always the same: **`''` is mutually exclusive (turned off by negation),
456
+ while `_` is always on (layered underneath).**
457
+
458
+ - **Unknown / invalid branches.** If a higher-priority branch sits behind a query
459
+ that can be *unknown* (`@supports`, container, `scroll-state`) or uses a
460
+ selector the browser drops, the negated `''` default disappears along with it
461
+ (`not(unknown) = unknown`), leaving the property with no rule. The `_` floor
462
+ survives because it is an unconditional bare rule. This is the case `_` exists
463
+ for.
464
+
465
+ - **Empty / "unset" states.** A state can intentionally produce *no* output (an
466
+ empty value) to leave a property unset while that state is active. With `''`
467
+ this works — the default is negated away and nothing replaces it, so the
468
+ property unsets. With `_` the floor can never be turned off, so its value keeps
469
+ applying and the "unset on this state" intent is lost.
470
+
471
+ ```jsx
472
+ // '' : color unsets while loading. '_' : color stays #text while loading.
473
+ color: { '': '#text', loading: '' }
474
+ ```
475
+
476
+ - **States with different output shapes.** Because `_` layers additively, when
477
+ different states emit *different sets* of declarations, the floor's
478
+ declarations bleed through wherever the winning state does not override the
479
+ same property — which can produce inconsistent combinations. A `''` default is
480
+ swapped out cleanly by its mutually-exclusive condition.
481
+
482
+ Rule of thumb: **use `''` for the normal default** (clean mutual exclusivity,
483
+ supports unsetting), and reach for `_` only when a value must survive an
484
+ *unknown* higher-priority branch.
485
+
377
486
  ### `@root(...)` — Root Element States
378
487
 
379
488
  Root states generate selectors on the `:root` element. They are useful for theme modes, feature flags, and other page-level conditions:
package/docs/pipeline.md CHANGED
@@ -76,7 +76,7 @@ Output: CSSRule[]
76
76
 
77
77
  **Simplification** (`simplifyCondition` in `simplify.ts`) is not a separate numbered stage. It runs inside OR expansion, exclusive building, `expandExclusiveOrs` branch cleanup, combination ANDs, merge-by-value ORs, and materialization. Every call is cached by condition unique-id, so the repetition is cheap.
78
78
 
79
- **Post-pass:** After `processStyles` collects rules from every handler, `runPipeline` (`index.ts:188`) filters duplicates using a key of `selector|declarations|atRules|rootPrefix|startingStyle` and then reorders rules so every `@starting-style` rule is emitted **after** all normal rules. This ordering is cascade-critical: `@starting-style` rules share specificity with their normal counterparts, and source order decides which value wins.
79
+ **Post-pass:** After `processStyles` collects rules from every handler, `runPipeline` (`index.ts`) filters duplicates using a key of `selector|declarations|atRules|rootPrefix|startingStyle`, then **stable-sorts rules by their cascade `order` hint (ascending source priority)** so lower-priority rules come first and higher-priority rules win, and finally emits every `@starting-style` rule **after** all normal rules. The `order` hint is the highest source priority among the entries that produced each rule (threaded `ComputedRule → CSSRule`). This ordering is cascade-critical because Stage 7 equalizes specificity with `:where()`: once every state selector carries zero specificity, source order alone decides which of two overlapping rules wins — most importantly the `_` fallback floor (low order, emitted first) versus the states layered over it, and `@starting-style` versus its normal counterpart. Mutually-exclusive rules are unaffected by ordering (they never both match), so reordering them is safe.
80
80
 
81
81
  ---
82
82
 
@@ -120,6 +120,8 @@ Removing don't-care dimensions before parsing prevents combinatorial blowup in l
120
120
 
121
121
  Converts each state key in a style value map (like `'hovered & !disabled'`, `'@media(w < 768px)'`) into `ConditionNode` trees. `parseStyleEntries` walks the object keys in source order and assigns priorities; `parseStateKey` parses a single key string.
122
122
 
123
+ `parseStyleEntries` also handles the bare `''` default and the standalone `_` fallback floor before the priority order is finalized. The bare `''` default only behaves correctly as the lowest-priority state, so a misplaced one is moved to the front (`MISPLACED_DEFAULT_STATE` warning). The `_` key is pulled out as a separate floor entry (`floor: true`, `TrueCondition`) and always assigned the lowest priority. If a map defines only `_` and a bare `''` (no other states), the `''` default is redundant — it is dropped in favor of the `_` value (`REDUNDANT_DEFAULT_STATE` warning). A `_` combined with state logic (`_ & hovered`, `_ | x`) is ignored (`INVALID_FALLBACK_KEY` warning).
124
+
123
125
  ### How It Works
124
126
 
125
127
  1. **Tokenization**: The state key is split into tokens using a regex pattern that recognizes:
@@ -293,6 +295,32 @@ C: C & !A & !B (applies only when neither A nor B)
293
295
 
294
296
  Each exclusive condition is passed through `simplifyCondition`. Entries that simplify to `FALSE` (impossible) are filtered out. The default state (`''` → `TrueCondition`) is not added to the “prior” list for negation (see `buildExclusiveConditions`).
295
297
 
298
+ ### `_` fallback floor
299
+
300
+ An entry flagged `floor: true` (from the standalone `_` key) is the one
301
+ exception to the negation cascade above. `buildExclusiveConditions` **pulls the
302
+ floor entries out** before the negation pass, builds the remaining entries with a
303
+ plain unconditional negation loop, then re-appends each floor with its own
304
+ (`TRUE`) condition as the exclusive condition. So the floor **always applies**,
305
+ never receives `!prior`, and never negates lower-priority entries. Because its
306
+ condition is `TRUE`, Stage 1 `mergeEntriesByValue` already leaves it untouched
307
+ (same guard as the bare `''` default), so no floor-specific merge handling is
308
+ needed.
309
+
310
+ This exists to fix the *unknown-query hole*: CSS three-valued logic makes
311
+ `not(unknown) = unknown`, so a negated `@supports(...)` / container-query default
312
+ branch silently never applies. A `_` floor sidesteps negation entirely and lets
313
+ the positive override layer on top via the cascade (see Stage 7's `:where()`
314
+ equalization and the ascending-priority post-pass).
315
+
316
+ Because the floor is **additive** (always emitted, never negated) rather than
317
+ mutually exclusive, it differs observably from the `''` default in two ways
318
+ beyond the unknown-query fix: an "empty" higher-priority state (one that emits no
319
+ declarations) cannot unset the property — the floor still applies — and when
320
+ states emit different declaration sets, the floor's declarations bleed through
321
+ wherever a winning state does not override the same property. The `''` default,
322
+ being negated, swaps out cleanly. See the DSL guide's "`_` vs the `''` default".
323
+
296
324
  ### Why
297
325
 
298
326
  This eliminates CSS specificity wars. Instead of relying on cascade order, each CSS rule matches in exactly one scenario. Benefits:
@@ -333,17 +361,24 @@ This is the companion to **Stage 2a** (user-OR expansion). The split exists beca
333
361
 
334
362
  1. Collect top-level OR branches of `exclusiveCondition`.
335
363
  2. If there is no OR (single branch), the entry is unchanged. Pure selector ORs with no at-rule context are also left alone (materialization handles them via `:is()` / variant merging).
336
- 3. Otherwise `sortOrBranchesForExpansion` reorders branches so at-rule-heavy branches come first. This is load-bearing for correctness (see below).
364
+ 3. Otherwise `sortOrBranchesForExpansion` reorders branches by a three-tier rank — `@supports` branches first, then other at-rule branches (media / container / starting), then pure-selector branches. This is load-bearing for correctness (see below).
337
365
  4. Each branch is made exclusive against prior branches: `branch & !prior[0] & !prior[1] & ...`, then simplified.
338
366
  5. Impossible branches are dropped; expanded entries get a synthetic `stateKey` suffix like `[or:0]`.
339
367
 
340
368
  ### Why the sort matters
341
369
 
342
- Consider `!A | !B` where A is an at-rule (e.g. `@supports(grid)`) and B is a modifier (e.g. `:has(foo)`):
370
+ **At-rules before selectors.** Consider `!A | !B` where A is an at-rule (e.g. `@supports(grid)`) and B is a modifier (e.g. `:has(foo)`):
343
371
 
344
372
  - **With at-rule-first sort** (`!A`, then `!B & A`): the first branch emits "outside `@supports`", the second emits "inside `@supports` with `:not(:has(foo))`". Full coverage.
345
373
  - **Without the sort** (`!B`, then `!A & B`): the first branch emits `:not(:has(foo))` as a bare selector with no at-rule context — leaking the rule outside `@supports`. The second is incomplete.
346
374
 
375
+ **`@supports` before other at-rules (Kleene logic).** A `@supports` feature query is special: anything ANDed with it can become *unknown* — not simply false — when the feature is unsupported. The canonical case is a feature guard over a dependent query, e.g. `@supports(container-type: scroll-state) & @(scroll-state(scrolled: block-end))` (`S & C`). The default's exclusive is `!(S & C) = !S | !C`, which `simplify` sorts alphabetically into `[!C, !S]`.
376
+
377
+ - **Expanding `!C` first** emits a bare `@container (not scroll-state(...))` rule. In a browser without `scroll-state` support that query is unknown (not false), so it matches nothing and the default `inset` is never applied — a coverage hole.
378
+ - **Expanding `!S` first** yields `!S | (S & !C)`: a bare `@supports (not (container-type: scroll-state))` fallback carrying the default, plus the dependent negation nested inside the supported scope. Full coverage, and the unsupported path never references the guarded query.
379
+
380
+ Because `!S | (S & !R) ≡ !S | !R` in two-valued logic, this reordering is a no-op for cases without an `@supports` guard. The same supports-first ordering is also applied in `makeOrBranchesExclusive` (`materialize.ts`) for ORs that survive nested inside an AND (e.g. `compact & (!S | !C)`).
381
+
347
382
  The pre-build Stage 2a pass doesn't need this because user-authored ORs aren't produced by negation and their branches are expected to apply in each branch's own scope.
348
383
 
349
384
  ### Example (conceptual)
@@ -470,7 +505,15 @@ Converts condition trees into actual CSS selectors and at-rules.
470
505
 
471
506
  3. **Contradiction detection**: During variant merging, impossible combinations are dropped (e.g. conflicting media, root, or modifier negations).
472
507
 
473
- 4. **`materializeComputedRule`**: Groups variants by sorted at-rules plus root-prefix key; within each group, `mergeVariantsIntoSelectorGroups` merges variants that differ only in flat modifier/pseudo parts; builds selector strings and emits one or more `CSSRule` objects.
508
+ 4. **`materializeComputedRule`**: Groups variants by sorted at-rules plus root-prefix key; within each group, `mergeVariantsIntoSelectorGroups` merges variants that differ only in flat modifier/pseudo parts; builds selector strings and emits one or more `CSSRule` objects. The rule's `order` hint (cascade priority) is propagated here for the post-pass sort.
509
+
510
+ 5. **`:where()` specificity equalization**: Every stateful part of the selector is wrapped in `:where(...)` so it contributes **zero specificity**:
511
+ - the flat root modifiers + pseudos and the root element's `:is()`/`:not()` groups are combined into one `:where(...)` (`buildSelectorFromVariant`);
512
+ - the sub-element (`@own`) groups are wrapped in a **separate** `:where(...)` so the sub-element's structural `[data-element="X"]` specificity is preserved while its states are zeroed;
513
+ - `@parent` ancestors (`parentGroupsToCSS`) become `:where(... *)` / `:where(:not(... *))`;
514
+ - the `@root` context prefix (`rootGroupsToCSS`) becomes `:where(:root...)` (zeroing the `:root` pseudo too).
515
+
516
+ The only specificity anchors that remain are the doubled component class (`.tXX.tXX`, added by the injector) and sub-element `[data-element]` attributes. Because Stage 2b already makes ordinary rules mutually exclusive, zeroing specificity never changes *which* rule matches — it only makes additive layering (`_` fallback floor, `@starting-style`) resolve deterministically by source order (see the post-pass). Canonical sorting/dedup/subsumption still run first; `:where()` is only the final wrapper, and both output paths (injector and direct-selector / SSR) consume the same wrapped fragments.
474
517
 
475
518
  ### Why
476
519
 
@@ -491,6 +534,8 @@ interface CSSRule {
491
534
  declarations: string; // CSS declarations (e.g. 'color: red;')
492
535
  atRules?: string[]; // Wrapping at-rules
493
536
  rootPrefix?: string; // Root state prefix
537
+ startingStyle?: boolean; // Wrap declarations in @starting-style
538
+ order?: number; // Internal cascade order hint (ascending source priority); stripped before injection
494
539
  }
495
540
  ```
496
541