@tenphi/tasty 3.0.1 → 3.1.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 (50) hide show
  1. package/README.md +16 -16
  2. package/dist/{babel-HlEpSZrj.d.ts → babel-R2qT7yLN.d.ts} +2 -2
  3. package/dist/{collector-D14DcZx9.js → collector-D7yzmG5G.js} +3 -3
  4. package/dist/{collector-D14DcZx9.js.map → collector-D7yzmG5G.js.map} +1 -1
  5. package/dist/{collector-BPzZezAG.d.ts → collector-D8o4Wdq-.d.ts} +2 -2
  6. package/dist/{config-CCcE_tqx.js → config-CwQ-fAsp.js} +674 -330
  7. package/dist/config-CwQ-fAsp.js.map +1 -0
  8. package/dist/{config-D2INrjr_.d.ts → config-De8L9NWM.d.ts} +2 -2
  9. package/dist/core/index.d.ts +4 -4
  10. package/dist/core/index.js +5 -5
  11. package/dist/{core-B5d0IPi2.js → core-CqSh853z.js} +11 -12
  12. package/dist/core-CqSh853z.js.map +1 -0
  13. package/dist/{css-writer-B5DBoxhf.js → css-writer-dS1srTkS.js} +3 -3
  14. package/dist/{css-writer-B5DBoxhf.js.map → css-writer-dS1srTkS.js.map} +1 -1
  15. package/dist/{format-rules-BbKDjsfO.js → format-rules-CaW4lJGg.js} +11 -9
  16. package/dist/format-rules-CaW4lJGg.js.map +1 -0
  17. package/dist/{hydrate-CwALW3J9.js → hydrate-uFv9kx7G.js} +2 -2
  18. package/dist/{hydrate-CwALW3J9.js.map → hydrate-uFv9kx7G.js.map} +1 -1
  19. package/dist/{index-BAAbdfRs.d.ts → index-DzGxoeyN.d.ts} +5 -5
  20. package/dist/{index-l_NdJSUS.d.ts → index-KUYya3x7.d.ts} +11 -1
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +6 -6
  23. package/dist/{keyframes-B8M1FmtE.js → keyframes-DaZhjqkd.js} +2 -2
  24. package/dist/{keyframes-B8M1FmtE.js.map → keyframes-DaZhjqkd.js.map} +1 -1
  25. package/dist/{merge-styles-NEvqayL_.d.ts → merge-styles-DLm4wdnb.d.ts} +2 -2
  26. package/dist/{merge-styles--1zOSFlS.js → merge-styles-H8LFJ5HY.js} +2 -2
  27. package/dist/{merge-styles--1zOSFlS.js.map → merge-styles-H8LFJ5HY.js.map} +1 -1
  28. package/dist/{resolve-recipes-Caix5NnH.js → resolve-recipes-aN94fjqS.js} +3 -3
  29. package/dist/{resolve-recipes-Caix5NnH.js.map → resolve-recipes-aN94fjqS.js.map} +1 -1
  30. package/dist/ssr/astro-client.js +1 -1
  31. package/dist/ssr/astro.js +3 -3
  32. package/dist/ssr/index.d.ts +1 -1
  33. package/dist/ssr/index.js +3 -3
  34. package/dist/ssr/next.d.ts +1 -1
  35. package/dist/ssr/next.js +4 -4
  36. package/dist/static/index.d.ts +2 -2
  37. package/dist/static/index.js +1 -1
  38. package/dist/zero/babel.d.ts +1 -1
  39. package/dist/zero/babel.js +4 -4
  40. package/dist/zero/index.d.ts +1 -1
  41. package/dist/zero/index.js +1 -1
  42. package/dist/zero/next.d.ts +1 -1
  43. package/docs/ai-agents.md +3 -0
  44. package/docs/configuration.md +11 -6
  45. package/docs/dsl.md +99 -2
  46. package/docs/styles.md +3 -1
  47. package/package.json +14 -10
  48. package/dist/config-CCcE_tqx.js.map +0 -1
  49. package/dist/core-B5d0IPi2.js.map +0 -1
  50. package/dist/format-rules-BbKDjsfO.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Jt as colorInitialValueToComponents, Qt as getComponentPropertySyntax, Zt as getColorSpaceSuffix, mt as getEffectiveDefinition, zt as parseStyle } from "./config-CCcE_tqx.js";
1
+ import { Jt as colorInitialValueToComponents, Qt as getComponentPropertySyntax, Zt as getColorSpaceSuffix, mt as getEffectiveDefinition, zt as parseStyle } from "./config-CwQ-fAsp.js";
2
2
  //#region src/ssr/ssr-collector-ref.ts
3
3
  const GETTER_KEY = "__tasty_ssr_collector_getter__";
4
4
  let _getSSRCollector = null;
@@ -33,7 +33,7 @@ function getRegisteredSSRCollector() {
33
33
  * if the token is invalid. For color properties, also returns
34
34
  * the companion component property.
35
35
  */
36
- function formatPropertyCSS(token, definition) {
36
+ function formatPropertyCSS(token, definition, options) {
37
37
  const result = getEffectiveDefinition(token, definition);
38
38
  if (!result.isValid) return "";
39
39
  const rules = [];
@@ -41,12 +41,14 @@ function formatPropertyCSS(token, definition) {
41
41
  if (result.isColor) {
42
42
  const suffix = getColorSpaceSuffix();
43
43
  const componentCssName = `${result.cssName}-${suffix}`;
44
- const componentInitial = colorInitialValueToComponents(result.definition.initialValue);
45
- rules.push(buildPropertyRule(componentCssName, {
46
- syntax: getComponentPropertySyntax(),
47
- inherits: result.definition.inherits,
48
- initialValue: componentInitial
49
- }));
44
+ if (!options?.isPropertyDefined?.(componentCssName)) {
45
+ const componentInitial = colorInitialValueToComponents(result.definition.initialValue);
46
+ rules.push(buildPropertyRule(componentCssName, {
47
+ syntax: getComponentPropertySyntax(),
48
+ inherits: result.definition.inherits,
49
+ initialValue: componentInitial
50
+ }));
51
+ }
50
52
  }
51
53
  return rules.join("\n");
52
54
  }
@@ -140,4 +142,4 @@ function formatRules(rules, className) {
140
142
  //#endregion
141
143
  export { registerSSRCollectorGetterGlobal as a, registerSSRCollectorGetter as i, formatPropertyCSS as n, getRegisteredSSRCollector as r, formatRules as t };
142
144
 
143
- //# sourceMappingURL=format-rules-BbKDjsfO.js.map
145
+ //# sourceMappingURL=format-rules-CaW4lJGg.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-rules-CaW4lJGg.js","names":[],"sources":["../src/ssr/ssr-collector-ref.ts","../src/ssr/format-property.ts","../src/ssr/format-rules.ts"],"sourcesContent":["/**\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\n | undefined;\n return getter ? getter() : null;\n}\n","/**\n * Format @property CSS rules for SSR output.\n *\n * Replicates the CSS construction from StyleInjector.property()\n * but returns a CSS string instead of inserting into the DOM.\n */\n\nimport type { PropertyDefinition } from '../injector/types';\nimport { getEffectiveDefinition } from '../properties';\nimport {\n colorInitialValueToComponents,\n getColorSpaceSuffix,\n getComponentPropertySyntax,\n} from '../utils/color-space';\nimport type { StyleValue } from '../utils/styles';\nimport { parseStyle } from '../utils/styles';\n\nexport interface FormatPropertyOptions {\n /**\n * Whether a CSS property name is already registered. The components companion\n * of a color property is skipped when it is — the caller registered it from\n * its own declaration, and a second rule with the default `<number>+` syntax\n * would come later in the sheet and override it.\n */\n isPropertyDefined?: (cssName: string) => boolean;\n}\n\n/**\n * Format a single @property rule as a CSS string.\n *\n * Returns the full `@property --name { ... }` text, or empty string\n * if the token is invalid. For color properties, also returns\n * the companion component property.\n */\nexport function formatPropertyCSS(\n token: string,\n definition: PropertyDefinition,\n options?: FormatPropertyOptions,\n): string {\n const result = getEffectiveDefinition(token, definition);\n if (!result.isValid) return '';\n\n const rules: string[] = [];\n\n rules.push(buildPropertyRule(result.cssName, result.definition));\n\n if (result.isColor) {\n const suffix = getColorSpaceSuffix();\n const componentCssName = `${result.cssName}-${suffix}`;\n\n if (!options?.isPropertyDefined?.(componentCssName)) {\n const componentInitial = colorInitialValueToComponents(\n result.definition.initialValue,\n );\n rules.push(\n buildPropertyRule(componentCssName, {\n syntax: getComponentPropertySyntax(),\n inherits: result.definition.inherits,\n initialValue: componentInitial,\n }),\n );\n }\n }\n\n return rules.join('\\n');\n}\n\nfunction buildPropertyRule(\n cssName: string,\n definition: PropertyDefinition,\n): string {\n const parts: string[] = [];\n\n if (definition.syntax != null) {\n let syntax = String(definition.syntax).trim();\n if (!/^['\"]/u.test(syntax)) syntax = `\"${syntax}\"`;\n parts.push(`syntax: ${syntax};`);\n }\n\n const inherits = definition.inherits ?? true;\n parts.push(`inherits: ${inherits ? 'true' : 'false'};`);\n\n if (definition.initialValue != null) {\n let initialValueStr: string;\n if (typeof definition.initialValue === 'number') {\n initialValueStr = String(definition.initialValue);\n } else {\n initialValueStr = parseStyle(\n definition.initialValue as StyleValue,\n ).output;\n }\n parts.push(`initial-value: ${initialValueStr};`);\n }\n\n const declarations = parts.join(' ').trim();\n return `@property ${cssName} { ${declarations} }`;\n}\n","/**\n * Shared CSS rule formatting utility.\n *\n * Extracted from SheetManager to allow both the DOM-based injector (client)\n * and the ServerStyleCollector (server) to produce identical CSS text\n * from StyleResult arrays.\n */\n\nimport type { StyleResult } from '../pipeline';\n\n/**\n * Resolve selectors for a rule, applying className-based specificity doubling\n * and rootPrefix handling. Mirrors the logic in StyleInjector.inject().\n */\nfunction resolveSelector(rule: StyleResult, className: string): string {\n let selector = rule.selector;\n\n if (rule.needsClassName) {\n const selectorParts = selector ? selector.split('|||') : [''];\n const classPrefix = `.${className}.${className}`;\n\n selector = selectorParts\n .map((part) => {\n const classSelector = part ? `${classPrefix}${part}` : classPrefix;\n\n if (rule.rootPrefix) {\n return `${rule.rootPrefix} ${classSelector}`;\n }\n return classSelector;\n })\n .join(', ');\n }\n\n return selector;\n}\n\ninterface GroupedRule {\n selector: string;\n declarations: string;\n atRules?: string[];\n startingStyle?: boolean;\n}\n\n/**\n * Group rules by selector + at-rules + startingStyle and merge their declarations.\n * Mirrors the grouping logic in SheetManager.insertRule().\n */\nfunction groupRules(rules: GroupedRule[]): GroupedRule[] {\n const groupMap = new Map<string, GroupedRule>();\n const order: string[] = [];\n\n const atKey = (at?: string[]) => (at && at.length ? at.join('|') : '');\n\n for (const r of rules) {\n const key = `${atKey(r.atRules)}||${r.selector}||${r.startingStyle ? '1' : '0'}`;\n const existing = groupMap.get(key);\n if (existing) {\n existing.declarations = existing.declarations\n ? `${existing.declarations} ${r.declarations}`\n : r.declarations;\n } else {\n groupMap.set(key, {\n selector: r.selector,\n atRules: r.atRules,\n startingStyle: r.startingStyle,\n declarations: r.declarations,\n });\n order.push(key);\n }\n }\n\n return order.map((key) => groupMap.get(key)!);\n}\n\n/**\n * Format an array of StyleResult rules into a CSS text string.\n *\n * Applies className-based specificity doubling (.cls.cls),\n * groups rules by selector + at-rules, and wraps with at-rule blocks.\n *\n * Produces the same CSS text as SheetManager.insertRule() would insert\n * into the DOM, but as a plain string suitable for SSR output.\n */\nexport function formatRules(rules: StyleResult[], className: string): string {\n if (rules.length === 0) return '';\n\n const resolvedRules = rules.map((rule) => ({\n selector: resolveSelector(rule, className),\n declarations: rule.declarations,\n atRules: rule.atRules,\n startingStyle: rule.startingStyle,\n }));\n\n const grouped = groupRules(resolvedRules);\n const cssRules: string[] = [];\n\n for (const rule of grouped) {\n const innerContent = rule.startingStyle\n ? `@starting-style { ${rule.declarations} }`\n : rule.declarations;\n const baseRule = `${rule.selector} { ${innerContent} }`;\n\n let fullRule = baseRule;\n if (rule.atRules && rule.atRules.length > 0) {\n fullRule = rule.atRules.reduce(\n (css, atRule) => `${atRule} { ${css} }`,\n baseRule,\n );\n }\n\n cssRules.push(fullRule);\n }\n\n return cssRules.join('\\n');\n}\n"],"mappings":";;AAsBA,MAAM,aAAa;AAEnB,IAAI,mBAA8C;;;;;AAMlD,SAAgB,2BAA2B,IAA8B;CACvE,mBAAmB;AACrB;;;;;AAMA,SAAgB,iCAAiC,IAA8B;CAC7E,WAAwC,cAAc;AACxD;;;;AAKA,SAAgB,4BAAyD;CACvE,IAAI,kBAAkB,OAAO,iBAAiB;CAC9C,MAAM,SAAU,WAAuC;CAGvD,OAAO,SAAS,OAAO,IAAI;AAC7B;;;;;;;;;;ACjBA,SAAgB,kBACd,OACA,YACA,SACQ;CACR,MAAM,SAAS,uBAAuB,OAAO,UAAU;CACvD,IAAI,CAAC,OAAO,SAAS,OAAO;CAE5B,MAAM,QAAkB,CAAC;CAEzB,MAAM,KAAK,kBAAkB,OAAO,SAAS,OAAO,UAAU,CAAC;CAE/D,IAAI,OAAO,SAAS;EAClB,MAAM,SAAS,oBAAoB;EACnC,MAAM,mBAAmB,GAAG,OAAO,QAAQ,GAAG;EAE9C,IAAI,CAAC,SAAS,oBAAoB,gBAAgB,GAAG;GACnD,MAAM,mBAAmB,8BACvB,OAAO,WAAW,YACpB;GACA,MAAM,KACJ,kBAAkB,kBAAkB;IAClC,QAAQ,2BAA2B;IACnC,UAAU,OAAO,WAAW;IAC5B,cAAc;GAChB,CAAC,CACH;EACF;CACF;CAEA,OAAO,MAAM,KAAK,IAAI;AACxB;AAEA,SAAS,kBACP,SACA,YACQ;CACR,MAAM,QAAkB,CAAC;CAEzB,IAAI,WAAW,UAAU,MAAM;EAC7B,IAAI,SAAS,OAAO,WAAW,MAAM,CAAC,CAAC,KAAK;EAC5C,IAAI,CAAC,SAAS,KAAK,MAAM,GAAG,SAAS,IAAI,OAAO;EAChD,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AE;IACZ,SAAS,EAAE;IACX,eAAe,EAAE;IACjB,cAAc,EAAE;GAClB,CAAC;GACD,MAAM,KAAK,GAAG;EAChB;CACF;CAEA,OAAO,MAAM,KAAK,QAAQ,SAAS,IAAI,GAAG,CAAE;AAC9C;;;;;;;;;;AAWA,SAAgB,YAAY,OAAsB,WAA2B;CAC3E,IAAI,MAAM,WAAW,GAAG,OAAO;CAS/B,MAAM,UAAU,WAPM,MAAM,KAAK,UAAU;EACzC,UAAU,gBAAgB,MAAM,SAAS;EACzC,cAAc,KAAK;EACnB,SAAS,KAAK;EACd,eAAe,KAAK;CACtB,EAEuC,CAAC;CACxC,MAAM,WAAqB,CAAC;CAE5B,KAAK,MAAM,QAAQ,SAAS;EAC1B,MAAM,eAAe,KAAK,gBACtB,qBAAqB,KAAK,aAAa,MACvC,KAAK;EACT,MAAM,WAAW,GAAG,KAAK,SAAS,KAAK,aAAa;EAEpD,IAAI,WAAW;EACf,IAAI,KAAK,WAAW,KAAK,QAAQ,SAAS,GACxC,WAAW,KAAK,QAAQ,QACrB,KAAK,WAAW,GAAG,OAAO,KAAK,IAAI,KACpC,QACF;EAGF,SAAS,KAAK,QAAQ;CACxB;CAEA,OAAO,SAAS,KAAK,IAAI;AAC3B"}
@@ -1,4 +1,4 @@
1
- import { c as getGlobalInjector } from "./config-CCcE_tqx.js";
1
+ import { c as getGlobalInjector } from "./config-CwQ-fAsp.js";
2
2
  //#region src/ssr/hydrate.ts
3
3
  /**
4
4
  * Client-side cache hydration for SSR/RSC.
@@ -34,4 +34,4 @@ function hydrateTastyClasses(classes) {
34
34
  //#endregion
35
35
  export { hydrateTastyClasses as t };
36
36
 
37
- //# sourceMappingURL=hydrate-CwALW3J9.js.map
37
+ //# sourceMappingURL=hydrate-uFv9kx7G.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hydrate-CwALW3J9.js","names":[],"sources":["../src/ssr/hydrate.ts"],"sourcesContent":["/**\n * Client-side cache hydration for SSR/RSC.\n *\n * Pre-populates the client injector's rules map with class names\n * rendered on the server. With hash-based naming, the client derives\n * the same class name from the same cache key, so only the class name\n * list needs to cross the wire — no cache keys or counters.\n */\n\nimport { getGlobalInjector } from '../config';\nimport { HYDRATED_RULE_INDEX } from '../injector/types';\n\n/**\n * Pre-populate the client-side style registry from the server's class name list.\n *\n * Call this before ReactDOM.hydrateRoot() or ensure it runs before\n * any tasty() component renders on the client.\n *\n * When called without arguments, reads the class list from `window.__TASTY__`\n * (populated by inline scripts emitted during SSR/RSC streaming).\n */\nexport function hydrateTastyClasses(classes?: string[]): void {\n if (typeof document === 'undefined') return;\n\n if (!classes) {\n classes = typeof window !== 'undefined' ? window.__TASTY__ : undefined;\n }\n\n if (!classes?.length) return;\n\n const injector = getGlobalInjector();\n const registry = injector._sheetManager.getRegistry(document);\n\n for (const cls of classes) {\n if (!registry.rules.has(cls)) {\n registry.rules.set(cls, {\n className: cls,\n ruleIndex: HYDRATED_RULE_INDEX,\n sheetIndex: HYDRATED_RULE_INDEX,\n });\n registry.refCounts.set(cls, 0);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,oBAAoB,SAA0B;CAC5D,IAAI,OAAO,aAAa,aAAa;CAErC,IAAI,CAAC,SACH,UAAU,OAAO,WAAW,cAAc,OAAO,YAAY,KAAA;CAG/D,IAAI,CAAC,SAAS,QAAQ;CAGtB,MAAM,WADW,kBACO,CAAC,CAAC,cAAc,YAAY,QAAQ;CAE5D,KAAK,MAAM,OAAO,SAChB,IAAI,CAAC,SAAS,MAAM,IAAI,GAAG,GAAG;EAC5B,SAAS,MAAM,IAAI,KAAK;GACtB,WAAW;GACX,WAAA;GACA,YAAA;EACF,CAAC;EACD,SAAS,UAAU,IAAI,KAAK,CAAC;CAC/B;AAEJ"}
1
+ {"version":3,"file":"hydrate-uFv9kx7G.js","names":[],"sources":["../src/ssr/hydrate.ts"],"sourcesContent":["/**\n * Client-side cache hydration for SSR/RSC.\n *\n * Pre-populates the client injector's rules map with class names\n * rendered on the server. With hash-based naming, the client derives\n * the same class name from the same cache key, so only the class name\n * list needs to cross the wire — no cache keys or counters.\n */\n\nimport { getGlobalInjector } from '../config';\nimport { HYDRATED_RULE_INDEX } from '../injector/types';\n\n/**\n * Pre-populate the client-side style registry from the server's class name list.\n *\n * Call this before ReactDOM.hydrateRoot() or ensure it runs before\n * any tasty() component renders on the client.\n *\n * When called without arguments, reads the class list from `window.__TASTY__`\n * (populated by inline scripts emitted during SSR/RSC streaming).\n */\nexport function hydrateTastyClasses(classes?: string[]): void {\n if (typeof document === 'undefined') return;\n\n if (!classes) {\n classes = typeof window !== 'undefined' ? window.__TASTY__ : undefined;\n }\n\n if (!classes?.length) return;\n\n const injector = getGlobalInjector();\n const registry = injector._sheetManager.getRegistry(document);\n\n for (const cls of classes) {\n if (!registry.rules.has(cls)) {\n registry.rules.set(cls, {\n className: cls,\n ruleIndex: HYDRATED_RULE_INDEX,\n sheetIndex: HYDRATED_RULE_INDEX,\n });\n registry.refCounts.set(cls, 0);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,SAAgB,oBAAoB,SAA0B;CAC5D,IAAI,OAAO,aAAa,aAAa;CAErC,IAAI,CAAC,SACH,UAAU,OAAO,WAAW,cAAc,OAAO,YAAY,KAAA;CAG/D,IAAI,CAAC,SAAS,QAAQ;CAGtB,MAAM,WADW,kBACO,CAAC,CAAC,cAAc,YAAY,QAAQ;CAE5D,KAAK,MAAM,OAAO,SAChB,IAAI,CAAC,SAAS,MAAM,IAAI,GAAG,GAAG;EAC5B,SAAS,MAAM,IAAI,KAAK;GACtB,WAAW;GACX,WAAA;GACA,YAAA;EACF,CAAC;EACD,SAAS,UAAU,IAAI,KAAK,CAAC;CAC/B;AAEJ"}
@@ -1,6 +1,6 @@
1
- import { _ as TastyPluginFactory, w as StyleInjector } from "./config-D2INrjr_.js";
2
- import { B as StyleValueStateMap, Ct as PropertyOptions, D as CSSMap, I as StyleHandlerResult, M as ResolvedStyleValue, Ot as StyleInjectorConfig, R as StylePropValue, at as CSSProperties$1, b as Styles, bt as KeyframesResult, dt as FunctionDefinition, gt as InjectResult, ht as GlobalInjectResult, j as RawStyleHandler, lt as FontFaceDescriptors, mt as GCOptions, n as StyleResult, nt as StyleDetails, ot as CacheMetrics, st as CounterStyleDescriptors, ut as FontFaceInput, x as StylesInterface, xt as KeyframesSteps, z as StyleValue } from "./index-l_NdJSUS.js";
3
- import { t as ServerStyleCollector } from "./collector-BPzZezAG.js";
1
+ import { _ as TastyPluginFactory, w as StyleInjector } from "./config-De8L9NWM.js";
2
+ import { B as StyleValueStateMap, Ct as PropertyOptions, D as CSSMap, I as StyleHandlerResult, M as ResolvedStyleValue, Ot as StyleInjectorConfig, R as StylePropValue, at as CSSProperties$1, b as Styles, bt as KeyframesResult, dt as FunctionDefinition, gt as InjectResult, ht as GlobalInjectResult, j as RawStyleHandler, lt as FontFaceDescriptors, mt as GCOptions, n as StyleResult, nt as StyleDetails, ot as CacheMetrics, st as CounterStyleDescriptors, ut as FontFaceInput, x as StylesInterface, xt as KeyframesSteps, z as StyleValue } from "./index-KUYya3x7.js";
3
+ import { t as ServerStyleCollector } from "./collector-D8o4Wdq-.js";
4
4
  import { AllHTMLAttributes, CSSProperties, ComponentType, ElementType, ForwardRefExoticComponent, JSX, PropsWithoutRef, RefAttributes } from "react";
5
5
 
6
6
  //#region src/utils/name-prefix.d.ts
@@ -1061,7 +1061,7 @@ declare function flowStyle({
1061
1061
  display?: string;
1062
1062
  flow?: string;
1063
1063
  }): {
1064
- [x: string]: string | undefined;
1064
+ [x: string]: string;
1065
1065
  } | null;
1066
1066
  declare namespace flowStyle {
1067
1067
  var __lookupStyles: string[];
@@ -1850,4 +1850,4 @@ declare const tastyDebug: {
1850
1850
  };
1851
1851
  //#endregion
1852
1852
  export { okhstFunction as $, TagName as $t, keyframes as A, TastyProps as At, ChunkInfo as B, BlockOuterStyleProps as Bt, getCSSTextForNode as C, ResolveTokenProps as Ct, injectRawCSS as D, TastyElementOptions as Dt, injectGlobal as E, TastyComponentPropsWithDefaults as Et, ComputeStylesOptions as F, AllBaseProps as Ft, DIMENSION_CHUNK_STYLES as G, ExtraBaseStyleProps as Gt, APPEARANCE_CHUNK_STYLES as H, ColorStyleProps as Ht, ComputeStylesResult as I, BaseProps as It, LAYOUT_CHUNK_STYLES as J, ModValue as Jt, DISPLAY_CHUNK_STYLES as K, FlowStyleProps as Kt, computeStyles as L, BasePropsWithoutChildren as Lt, touch as M, VariantMap as Mt, ChunkSheetRegistry as N, WithVariant as Nt, injector as O, TastyElementProps as Ot, chunkSheetRegistry as P, tasty as Pt, createColorFunc as Q, ShortGridStyles as Qt, defineHandler as R, BaseStyleProps as Rt, getCSSText as S, ResolveModProps as St, inject as T, SubElementProps as Tt, CHUNK_NAMES as U, ContainerStyleProps as Ut, categorizeStyleKeys as V, BlockStyleProps as Vt, ChunkName as W, DimensionStyleProps as Wt, STYLE_TO_CHUNK as X, OuterStyleProps as Xt, POSITION_CHUNK_STYLES as Y, Mods as Yt, resolveFunctionColor as Z, PositionStyleProps as Zt, createInjector as _, POSITION_STYLES as _n, ElementsDefinition as _t, DebugOptions as a, TokenValue as an, useFunction as at, func as b, DEFAULT_ZERO_NAME_PREFIX as bn, ResolveAsProps as bt, tastyDebug as c, BLOCK_INNER_STYLES as cn, UsePropertyOptions as ct, dotize as d, COLOR_STYLES as dn, useRawCSS as dt, TastyBaseStylePropNames as en, okhstPlugin as et, _modAttrs as f, CONTAINER_STYLES as fn, useGlobalStyles as ft, counterStyle as g, OUTER_STYLES as gn, Element$1 as gt, cleanup as h, INNER_STYLES as hn, AllBasePropsWithMods as ht, DebugChunkInfo as i, TextStyleProps as in, UseFunctionOptions as it, property as j, TokenPropsInput as jt, isPropertyDefined as k, TastyPolymorphicComponent as kt, processTokens as l, BLOCK_OUTER_STYLES as ln, useProperty as lt, filterBaseProps as m, FLOW_STYLES as mn, useStyles as mt, CacheStatus as n, TastyExtensionConfig as nn, okhslPlugin as nt, InspectResult as o, Tokens as on, useCounterStyle as ot, color$1 as p, DIMENSION_STYLES as pn, UseStylesResult as pt, FONT_CHUNK_STYLES as q, InnerStyleProps as qt, ChunkBreakdown as r, TastyThemeNames as rn, getDisplayName as rt, Summary as s, BASE_STYLES as sn, useFontFace as st, CSSOptions as t, TastyCustomProps as tn, okhslFunction as tt, resolveRecipes as u, BLOCK_STYLES as un, useKeyframes as ut, destroy as v, TEXT_STYLES as vn, ModPropDef as vt, getRawCSSText as w, SubElementDefinition as wt, gc as x, ResolveModPropDef as xt, fontFace as y, DEFAULT_NAME_PREFIX as yn, ModPropsInput as yt, styleHandlers as z, BlockInnerStyleProps as zt };
1853
- //# sourceMappingURL=index-BAAbdfRs.d.ts.map
1853
+ //# sourceMappingURL=index-DzGxoeyN.d.ts.map
@@ -811,6 +811,11 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
811
811
  * - `border="dotted #danger left right"` // left/right: 1bw dotted danger
812
812
  * - `border="1bw #red, 2bw #blue top"` // all sides red 1bw, top overridden to blue 2bw
813
813
  * - `border="1bw, dashed top bottom, #purple left right"` // base 1bw, dashed on top/bottom, purple on left/right
814
+ * - `border="1bw $my-style"` // custom property in the style slot
815
+ *
816
+ * A `$name` reference fills the first free slot — width, then style, then
817
+ * color. Colors are authored as `#name`; to point the color slot at a raw
818
+ * custom property directly, name it `$name-color`.
814
819
  */
815
820
  border?: CSSProperties['border'] | string | boolean;
816
821
  /**
@@ -929,6 +934,11 @@ interface StylesInterface extends Omit<CSSProperties, 'color' | 'fill' | 'font'
929
934
  * - `outline="2ow dashed #purple"` // 2ow dashed purple outline
930
935
  * - `outline="2ow #danger / 1x"` // 2ow solid danger outline, 1x offset
931
936
  * - `outline={true}` // default outline (1ow solid)
937
+ * - `outline="2ow $my-style"` // custom property in the style slot
938
+ *
939
+ * A `$name` reference fills the first free slot — width, then style, then
940
+ * color. Colors are authored as `#name`; to point the color slot at a raw
941
+ * custom property directly, name it `$name-color`.
932
942
  */
933
943
  outline?: string | boolean;
934
944
  /**
@@ -1403,4 +1413,4 @@ declare function renderStyles(styles?: Styles, classNameOrSelector?: undefined,
1403
1413
  declare function renderStyles(styles: Styles | undefined, classNameOrSelector: string, options?: RenderStylesOptions): StyleResult[];
1404
1414
  //#endregion
1405
1415
  export { StyleParser as $, ParsedColor as A, StyleUsage as At, StyleValueStateMap as B, SuffixForSelector as C, PropertyOptions as Ct, CSSMap as D, SheetInfo as Dt, AnyStyleHandler as E, RuleInfo as Et, StyleHandlerProps as F, parseColor as G, getGlobalParser as H, StyleHandlerResult as I, getNamedColorHex as J, parseStyle as K, StyleMap as L, ResolvedStyleValue as M, StyleHandler as N, CUSTOM_UNITS as O, StyleInjectorConfig as Ot, StyleHandlerDefinition as P, strToRgb as Q, StylePropValue as R, StylesWithoutSelectors as S, PropertyDefinition as St, TastyPresetNames as T, RootRegistry as Tt, getGlobalPredefinedTokens as U, filterMods as V, normalizeColorTokenValue as W, hexToRgb as X, getRgbValuesFromRgbaString as Y, hslToRgbValues as Z, NotSelector as _, InjectionMode as _t, ParseStateKeyOptions as a, CSSProperties as at, Styles as b, KeyframesResult as bt, ParsedAdvancedState as c, DisposeFunction as ct, getGlobalPredefinedStates as d, FunctionDefinition as dt, ParserOptions as et, setGlobalPredefinedStates as f, FunctionParameter as ft, NoType as g, InjectResult as gt, ConfigTokens as h, GlobalInjectResult as ht, renderStyles as i, UnitHandler as it, RawStyleHandler as j, DIRECTIONS as k, StyleRule as kt, StateParserContext as l, FontFaceDescriptors as lt, ConfigTokenValue as m, GCOptions as mt, StyleResult as n, StyleDetails as nt, parseStateKey as o, CacheMetrics as ot, ConditionNode as p, GCConfig as pt, stringifyStyles as q, isSelector as r, StyleDetailsPart as rt, AtRuleContext as s, CounterStyleDescriptors as st, RenderResult as t, ProcessedStyle as tt, createStateParserContext as u, FontFaceInput as ut, RecipeStyles as v, KeyframesCacheEntry as vt, TastyNamedColors as w, RawCSSResult as wt, StylesInterface as x, KeyframesSteps as xt, Selector as y, KeyframesInfo as yt, StyleValue as z };
1406
- //# sourceMappingURL=index-l_NdJSUS.d.ts.map
1416
+ //# sourceMappingURL=index-KUYya3x7.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as ParseFunction, D as PropHandlerDefinition, E as PropHandler, O as PropHandlerProps, S as FunctionsConfig, T as SheetManager, _ as TastyPluginFactory, a as getGlobalFontFaces, b as generateTypographyTokens, c as getGlobalRecipes, d as hasGlobalRecipes, f as hasStylesGenerated, g as TastyPlugin, h as resetConfig, i as getGlobalCounterStyles, l as getNamePrefix, m as isTestEnvironment, n as configure, o as getGlobalFunctions, p as isConfigLocked, r as getConfig, s as getGlobalKeyframes, t as TastyConfig, u as hasGlobalKeyframes, v as TypographyPreset, w as StyleInjector, x as ColorSpace, y as TypographyTokenValue } from "./config-D2INrjr_.js";
2
- import { $ as StyleParser, A as ParsedColor, At as StyleUsage, B as StyleValueStateMap, C as SuffixForSelector, Ct as PropertyOptions, D as CSSMap, Dt as SheetInfo, E as AnyStyleHandler, Et as RuleInfo, F as StyleHandlerProps, G as parseColor, H as getGlobalParser, I as StyleHandlerResult, J as getNamedColorHex, K as parseStyle, L as StyleMap, M as ResolvedStyleValue, N as StyleHandler, O as CUSTOM_UNITS, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, Q as strToRgb, R as StylePropValue, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RootRegistry, U as getGlobalPredefinedTokens, V as filterMods, W as normalizeColorTokenValue, X as hexToRgb, Y as getRgbValuesFromRgbaString, Z as hslToRgbValues, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as CSSProperties, b as Styles, bt as KeyframesResult, c as ParsedAdvancedState, ct as DisposeFunction, d as getGlobalPredefinedStates, dt as FunctionDefinition, et as ParserOptions, f as setGlobalPredefinedStates, ft as FunctionParameter, g as NoType, gt as InjectResult, h as ConfigTokens, i as renderStyles, it as UnitHandler, j as RawStyleHandler, k as DIRECTIONS, kt as StyleRule, l as StateParserContext, lt as FontFaceDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as StyleDetails, o as parseStateKey, ot as CacheMetrics, p as ConditionNode, pt as GCConfig, q as stringifyStyles, r as isSelector, rt as StyleDetailsPart, s as AtRuleContext, st as CounterStyleDescriptors, t as RenderResult, tt as ProcessedStyle, u as createStateParserContext, ut as FontFaceInput, v as RecipeStyles, vt as KeyframesCacheEntry, w as TastyNamedColors, wt as RawCSSResult, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as StyleValue } from "./index-l_NdJSUS.js";
3
- import { $ as okhstFunction, $t as TagName, A as keyframes, At as TastyProps, B as ChunkInfo, Bt as BlockOuterStyleProps, C as getCSSTextForNode, Ct as ResolveTokenProps, D as injectRawCSS, Dt as TastyElementOptions, E as injectGlobal, Et as TastyComponentPropsWithDefaults, F as ComputeStylesOptions, Ft as AllBaseProps, G as DIMENSION_CHUNK_STYLES, Gt as ExtraBaseStyleProps, H as APPEARANCE_CHUNK_STYLES, Ht as ColorStyleProps, I as ComputeStylesResult, It as BaseProps, J as LAYOUT_CHUNK_STYLES, Jt as ModValue, K as DISPLAY_CHUNK_STYLES, Kt as FlowStyleProps, L as computeStyles, Lt as BasePropsWithoutChildren, M as touch, Mt as VariantMap, N as ChunkSheetRegistry, Nt as WithVariant, O as injector, Ot as TastyElementProps, P as chunkSheetRegistry, Pt as tasty, Q as createColorFunc, Qt as ShortGridStyles, R as defineHandler, Rt as BaseStyleProps, S as getCSSText, St as ResolveModProps, T as inject, Tt as SubElementProps, U as CHUNK_NAMES, Ut as ContainerStyleProps, V as categorizeStyleKeys, Vt as BlockStyleProps, W as ChunkName, Wt as DimensionStyleProps, X as STYLE_TO_CHUNK, Xt as OuterStyleProps, Y as POSITION_CHUNK_STYLES, Yt as Mods, Z as resolveFunctionColor, Zt as PositionStyleProps, _ as createInjector, _n as POSITION_STYLES, _t as ElementsDefinition, a as DebugOptions, an as TokenValue, at as useFunction, b as func, bn as DEFAULT_ZERO_NAME_PREFIX, bt as ResolveAsProps, c as tastyDebug, cn as BLOCK_INNER_STYLES, ct as UsePropertyOptions, d as dotize, dn as COLOR_STYLES, dt as useRawCSS, en as TastyBaseStylePropNames, et as okhstPlugin, f as _modAttrs, fn as CONTAINER_STYLES, ft as useGlobalStyles, g as counterStyle, gn as OUTER_STYLES, gt as Element, h as cleanup, hn as INNER_STYLES, ht as AllBasePropsWithMods, i as DebugChunkInfo, in as TextStyleProps, it as UseFunctionOptions, j as property, jt as TokenPropsInput, k as isPropertyDefined, kt as TastyPolymorphicComponent, l as processTokens, ln as BLOCK_OUTER_STYLES, lt as useProperty, m as filterBaseProps, mn as FLOW_STYLES, mt as useStyles, n as CacheStatus, nn as TastyExtensionConfig, nt as okhslPlugin, o as InspectResult, on as Tokens, ot as useCounterStyle, p as color, pn as DIMENSION_STYLES, pt as UseStylesResult, q as FONT_CHUNK_STYLES, qt as InnerStyleProps, r as ChunkBreakdown, rn as TastyThemeNames, rt as getDisplayName, s as Summary, sn as BASE_STYLES, st as useFontFace, t as CSSOptions, tn as TastyCustomProps, tt as okhslFunction, u as resolveRecipes, un as BLOCK_STYLES, ut as useKeyframes, v as destroy, vn as TEXT_STYLES, vt as ModPropDef, w as getRawCSSText, wt as SubElementDefinition, x as gc, xt as ResolveModPropDef, y as fontFace, yn as DEFAULT_NAME_PREFIX, yt as ModPropsInput, z as styleHandlers, zt as BlockInnerStyleProps } from "./index-BAAbdfRs.js";
4
- import { t as mergeStyles } from "./merge-styles-NEvqayL_.js";
1
+ import { C as ParseFunction, D as PropHandlerDefinition, E as PropHandler, O as PropHandlerProps, S as FunctionsConfig, T as SheetManager, _ as TastyPluginFactory, a as getGlobalFontFaces, b as generateTypographyTokens, c as getGlobalRecipes, d as hasGlobalRecipes, f as hasStylesGenerated, g as TastyPlugin, h as resetConfig, i as getGlobalCounterStyles, l as getNamePrefix, m as isTestEnvironment, n as configure, o as getGlobalFunctions, p as isConfigLocked, r as getConfig, s as getGlobalKeyframes, t as TastyConfig, u as hasGlobalKeyframes, v as TypographyPreset, w as StyleInjector, x as ColorSpace, y as TypographyTokenValue } from "./config-De8L9NWM.js";
2
+ import { $ as StyleParser, A as ParsedColor, At as StyleUsage, B as StyleValueStateMap, C as SuffixForSelector, Ct as PropertyOptions, D as CSSMap, Dt as SheetInfo, E as AnyStyleHandler, Et as RuleInfo, F as StyleHandlerProps, G as parseColor, H as getGlobalParser, I as StyleHandlerResult, J as getNamedColorHex, K as parseStyle, L as StyleMap, M as ResolvedStyleValue, N as StyleHandler, O as CUSTOM_UNITS, Ot as StyleInjectorConfig, P as StyleHandlerDefinition, Q as strToRgb, R as StylePropValue, S as StylesWithoutSelectors, St as PropertyDefinition, T as TastyPresetNames, Tt as RootRegistry, U as getGlobalPredefinedTokens, V as filterMods, W as normalizeColorTokenValue, X as hexToRgb, Y as getRgbValuesFromRgbaString, Z as hslToRgbValues, _ as NotSelector, _t as InjectionMode, a as ParseStateKeyOptions, at as CSSProperties, b as Styles, bt as KeyframesResult, c as ParsedAdvancedState, ct as DisposeFunction, d as getGlobalPredefinedStates, dt as FunctionDefinition, et as ParserOptions, f as setGlobalPredefinedStates, ft as FunctionParameter, g as NoType, gt as InjectResult, h as ConfigTokens, i as renderStyles, it as UnitHandler, j as RawStyleHandler, k as DIRECTIONS, kt as StyleRule, l as StateParserContext, lt as FontFaceDescriptors, m as ConfigTokenValue, mt as GCOptions, n as StyleResult, nt as StyleDetails, o as parseStateKey, ot as CacheMetrics, p as ConditionNode, pt as GCConfig, q as stringifyStyles, r as isSelector, rt as StyleDetailsPart, s as AtRuleContext, st as CounterStyleDescriptors, t as RenderResult, tt as ProcessedStyle, u as createStateParserContext, ut as FontFaceInput, v as RecipeStyles, vt as KeyframesCacheEntry, w as TastyNamedColors, wt as RawCSSResult, x as StylesInterface, xt as KeyframesSteps, y as Selector, yt as KeyframesInfo, z as StyleValue } from "./index-KUYya3x7.js";
3
+ import { $ as okhstFunction, $t as TagName, A as keyframes, At as TastyProps, B as ChunkInfo, Bt as BlockOuterStyleProps, C as getCSSTextForNode, Ct as ResolveTokenProps, D as injectRawCSS, Dt as TastyElementOptions, E as injectGlobal, Et as TastyComponentPropsWithDefaults, F as ComputeStylesOptions, Ft as AllBaseProps, G as DIMENSION_CHUNK_STYLES, Gt as ExtraBaseStyleProps, H as APPEARANCE_CHUNK_STYLES, Ht as ColorStyleProps, I as ComputeStylesResult, It as BaseProps, J as LAYOUT_CHUNK_STYLES, Jt as ModValue, K as DISPLAY_CHUNK_STYLES, Kt as FlowStyleProps, L as computeStyles, Lt as BasePropsWithoutChildren, M as touch, Mt as VariantMap, N as ChunkSheetRegistry, Nt as WithVariant, O as injector, Ot as TastyElementProps, P as chunkSheetRegistry, Pt as tasty, Q as createColorFunc, Qt as ShortGridStyles, R as defineHandler, Rt as BaseStyleProps, S as getCSSText, St as ResolveModProps, T as inject, Tt as SubElementProps, U as CHUNK_NAMES, Ut as ContainerStyleProps, V as categorizeStyleKeys, Vt as BlockStyleProps, W as ChunkName, Wt as DimensionStyleProps, X as STYLE_TO_CHUNK, Xt as OuterStyleProps, Y as POSITION_CHUNK_STYLES, Yt as Mods, Z as resolveFunctionColor, Zt as PositionStyleProps, _ as createInjector, _n as POSITION_STYLES, _t as ElementsDefinition, a as DebugOptions, an as TokenValue, at as useFunction, b as func, bn as DEFAULT_ZERO_NAME_PREFIX, bt as ResolveAsProps, c as tastyDebug, cn as BLOCK_INNER_STYLES, ct as UsePropertyOptions, d as dotize, dn as COLOR_STYLES, dt as useRawCSS, en as TastyBaseStylePropNames, et as okhstPlugin, f as _modAttrs, fn as CONTAINER_STYLES, ft as useGlobalStyles, g as counterStyle, gn as OUTER_STYLES, gt as Element, h as cleanup, hn as INNER_STYLES, ht as AllBasePropsWithMods, i as DebugChunkInfo, in as TextStyleProps, it as UseFunctionOptions, j as property, jt as TokenPropsInput, k as isPropertyDefined, kt as TastyPolymorphicComponent, l as processTokens, ln as BLOCK_OUTER_STYLES, lt as useProperty, m as filterBaseProps, mn as FLOW_STYLES, mt as useStyles, n as CacheStatus, nn as TastyExtensionConfig, nt as okhslPlugin, o as InspectResult, on as Tokens, ot as useCounterStyle, p as color, pn as DIMENSION_STYLES, pt as UseStylesResult, q as FONT_CHUNK_STYLES, qt as InnerStyleProps, r as ChunkBreakdown, rn as TastyThemeNames, rt as getDisplayName, s as Summary, sn as BASE_STYLES, st as useFontFace, t as CSSOptions, tn as TastyCustomProps, tt as okhslFunction, u as resolveRecipes, un as BLOCK_STYLES, ut as useKeyframes, v as destroy, vn as TEXT_STYLES, vt as ModPropDef, w as getRawCSSText, wt as SubElementDefinition, x as gc, xt as ResolveModPropDef, y as fontFace, yn as DEFAULT_NAME_PREFIX, yt as ModPropsInput, z as styleHandlers, zt as BlockInnerStyleProps } from "./index-DzGxoeyN.js";
4
+ import { t as mergeStyles } from "./merge-styles-DLm4wdnb.js";
5
5
  export { APPEARANCE_CHUNK_STYLES, type AllBaseProps, type AllBasePropsWithMods, type AnyStyleHandler, type AtRuleContext, BASE_STYLES, BLOCK_INNER_STYLES, BLOCK_OUTER_STYLES, BLOCK_STYLES, type BaseProps, type BasePropsWithoutChildren, type BaseStyleProps, type BlockInnerStyleProps, type BlockOuterStyleProps, type BlockStyleProps, CHUNK_NAMES, COLOR_STYLES, CONTAINER_STYLES, type CSSMap, CSSOptions, type CSSProperties, CUSTOM_UNITS, type CacheMetrics, CacheStatus, ChunkBreakdown, type ChunkInfo, type ChunkName, ChunkSheetRegistry, type ColorSpace, type ColorStyleProps, type ComputeStylesOptions, type ComputeStylesResult, type ConditionNode, type ConfigTokenValue, type ConfigTokens, type ContainerStyleProps, type CounterStyleDescriptors, DEFAULT_NAME_PREFIX, DEFAULT_ZERO_NAME_PREFIX, DIMENSION_CHUNK_STYLES, DIMENSION_STYLES, DIRECTIONS, DISPLAY_CHUNK_STYLES, DebugChunkInfo, DebugOptions, type DimensionStyleProps, type DisposeFunction, Element, type ElementsDefinition, type ExtraBaseStyleProps, FLOW_STYLES, FONT_CHUNK_STYLES, type FlowStyleProps, type FontFaceDescriptors, type FontFaceInput, type FunctionDefinition, type FunctionParameter, type FunctionsConfig, type GCConfig, type GCOptions, INNER_STYLES, type InjectResult, type InjectionMode, type InnerStyleProps, InspectResult, type KeyframesCacheEntry, type KeyframesInfo, type KeyframesResult, type KeyframesSteps, LAYOUT_CHUNK_STYLES, type ModPropDef, type ModPropsInput, type ModValue, type Mods, type NoType, type NotSelector, OUTER_STYLES, type OuterStyleProps, POSITION_CHUNK_STYLES, POSITION_STYLES, type ParseFunction, type ParseStateKeyOptions, type ParsedAdvancedState, type ParsedColor, type ParserOptions, type PositionStyleProps, type ProcessedStyle, type PropHandler, type PropHandlerDefinition, type PropHandlerProps, type PropertyDefinition, type PropertyOptions, type RawCSSResult, type RawStyleHandler, type RecipeStyles, type RenderResult, type ResolveAsProps, type ResolveModPropDef, type ResolveModProps, type ResolveTokenProps, type ResolvedStyleValue, type RootRegistry, type RuleInfo, STYLE_TO_CHUNK, type Selector, type SheetInfo, SheetManager, type ShortGridStyles, type StateParserContext, type StyleDetails, type StyleDetailsPart, type StyleHandler, type StyleHandlerDefinition, type StyleHandlerProps, type StyleHandlerResult, StyleInjector, type StyleInjectorConfig, type StyleMap, StyleParser, type StylePropValue, type StyleResult, type StyleRule, type StyleUsage, type StyleValue, type StyleValueStateMap, type Styles, type StylesInterface, type StylesWithoutSelectors, type SubElementDefinition, type SubElementProps, type SuffixForSelector, Summary, TEXT_STYLES, type TagName, type TastyBaseStylePropNames, type TastyComponentPropsWithDefaults, type TastyConfig, type TastyCustomProps, type TastyElementOptions, type TastyElementProps, type TastyExtensionConfig, type TastyNamedColors, type TastyPlugin, type TastyPluginFactory, type TastyPolymorphicComponent, type TastyPresetNames, type TastyProps, type TastyThemeNames, type TextStyleProps, type TokenPropsInput, type TokenValue, type Tokens, TypographyPreset, TypographyTokenValue, type UnitHandler, type UseFunctionOptions, type UsePropertyOptions, type UseStylesResult, type VariantMap, type WithVariant, categorizeStyleKeys, chunkSheetRegistry, cleanup, color, computeStyles, configure, counterStyle, createColorFunc, createInjector, createStateParserContext, defineHandler, destroy, dotize, filterBaseProps, filterMods, fontFace, func, gc, generateTypographyTokens, getCSSText, getCSSTextForNode, getConfig, getDisplayName, getGlobalCounterStyles, getGlobalFontFaces, getGlobalFunctions, getGlobalKeyframes, getGlobalParser, getGlobalPredefinedStates, getGlobalPredefinedTokens, getGlobalRecipes, getNamePrefix, getNamedColorHex, getRawCSSText, getRgbValuesFromRgbaString, hasGlobalKeyframes, hasGlobalRecipes, hasStylesGenerated, hexToRgb, hslToRgbValues, inject, injectGlobal, injectRawCSS, injector, isConfigLocked, isPropertyDefined, isSelector, isTestEnvironment, keyframes, mergeStyles, _modAttrs as modAttrs, normalizeColorTokenValue, okhslFunction, okhslPlugin, okhstFunction, okhstPlugin, parseColor, parseStateKey, parseStyle, processTokens, property, renderStyles, resetConfig, resolveFunctionColor, resolveRecipes, setGlobalPredefinedStates, strToRgb, stringifyStyles, styleHandlers, tasty, tastyDebug, touch, useCounterStyle, useFontFace, useFunction, useGlobalStyles, useKeyframes, useProperty, useRawCSS, useStyles };
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- import { $ as SheetManager, $t as getNamedColorHex, A as FLOW_STYLES, At as registerFunctionPolyfill, B as createStateParserContext, Bt as stringifyStyles, C as BASE_STYLES, Ct as LAYOUT_CHUNK_STYLES, D as COLOR_STYLES, Dt as formatFunctionRule, E as BLOCK_STYLES, Ft as getGlobalParser, G as StyleInjector, Gt as createColorFunc, Ht as okhstPlugin, I as isSelector, It as getGlobalPredefinedTokens, L as renderStyles, Lt as normalizeColorTokenValue, M as OUTER_STYLES, Mt as CUSTOM_UNITS, N as POSITION_STYLES, Nt as DIRECTIONS, O as CONTAINER_STYLES, P as TEXT_STYLES, Pt as filterMods, R as parseStateKey, Rt as parseColor, S as baseStylePropsRegistry, St as FONT_CHUNK_STYLES, T as BLOCK_OUTER_STYLES, Tt as STYLE_TO_CHUNK, U as getGlobalPredefinedStates, Ut as okhslFunction, Vt as okhstFunction, W as setGlobalPredefinedStates, Wt as okhslPlugin, X as fontFaceContentHash, Z as formatFontFaceRule, _ as isFunctionsPolyfillEnabled, _t as propHandlerRegistry, a as getGlobalCounterStyles, at as DEFAULT_NAME_PREFIX, b as resetConfig, bt as DIMENSION_CHUNK_STYLES, c as getGlobalInjector, ct as makeCounterStyleName, en as getRgbValuesFromRgbaString, f as getNamePrefix, ft as hashString, g as isConfigLocked, h as hasStylesGenerated, in as resolveFunctionColor, j as INNER_STYLES, k as DIMENSION_STYLES, kt as parseFunctionName, l as getGlobalKeyframes, lt as makeKeyframeName, m as hasGlobalRecipes, n as getConfig, nn as hslToRgbValues, nt as styleHandlers, o as getGlobalFontFaces, ot as DEFAULT_ZERO_NAME_PREFIX, p as hasGlobalKeyframes, q as formatCounterStyleRule, qt as StyleParser, rn as strToRgb, s as getGlobalFunctions, t as configure, tn as hexToRgb, tt as defineHandler, u as getGlobalRecipes, v as isTestEnvironment, vt as APPEARANCE_CHUNK_STYLES, w as BLOCK_INNER_STYLES, wt as POSITION_CHUNK_STYLES, x as generateTypographyTokens, xt as DISPLAY_CHUNK_STYLES, yt as CHUNK_NAMES, zt as parseStyle } from "./config-CCcE_tqx.js";
2
- import { l as categorizeStyleKeys } from "./keyframes-B8M1FmtE.js";
3
- import { A as property, C as getRawCSSText, D as injector, E as injectRawCSS, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, S as getCSSTextForNode, T as injectGlobal, _ as destroy, a as color, b as gc, c as hasKeys, d as collectAutoInferredPropertiesRSC, f as getStyleTarget, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, l as formatKeyframesCSS, m as cleanup, n as processTokens, o as filterBaseProps, p as pushRSCCSS, r as dotize, s as computeStyles, t as tastyDebug, u as collectAutoInferredProperties, v as fontFace, w as inject, x as getCSSText, y as func } from "./core-B5d0IPi2.js";
4
- import { n as formatPropertyCSS } from "./format-rules-BbKDjsfO.js";
5
- import { t as mergeStyles } from "./merge-styles--1zOSFlS.js";
6
- import { t as resolveRecipes } from "./resolve-recipes-Caix5NnH.js";
1
+ import { $ as SheetManager, A as FLOW_STYLES, At as registerFunctionPolyfill, B as createStateParserContext, Bt as stringifyStyles, C as BASE_STYLES, Ct as LAYOUT_CHUNK_STYLES, D as COLOR_STYLES, Dt as formatFunctionRule, E as BLOCK_STYLES, Ft as getGlobalParser, G as StyleInjector, Gt as createColorFunc, Ht as okhstPlugin, I as isSelector, It as getGlobalPredefinedTokens, L as renderStyles, Lt as normalizeColorTokenValue, M as OUTER_STYLES, Mt as CUSTOM_UNITS, N as POSITION_STYLES, Nt as DIRECTIONS, O as CONTAINER_STYLES, P as TEXT_STYLES, Pt as filterMods, R as parseStateKey, Rt as parseColor, S as baseStylePropsRegistry, St as FONT_CHUNK_STYLES, T as BLOCK_OUTER_STYLES, Tt as STYLE_TO_CHUNK, U as getGlobalPredefinedStates, Ut as okhslFunction, Vt as okhstFunction, W as setGlobalPredefinedStates, Wt as okhslPlugin, X as fontFaceContentHash, Z as formatFontFaceRule, _ as isFunctionsPolyfillEnabled, _t as propHandlerRegistry, a as getGlobalCounterStyles, an as hslToRgbValues, at as DEFAULT_NAME_PREFIX, b as resetConfig, bt as DIMENSION_CHUNK_STYLES, c as getGlobalInjector, ct as makeCounterStyleName, en as resolveFunctionColor, f as getNamePrefix, ft as hashString, g as isConfigLocked, h as hasStylesGenerated, in as hexToRgb, j as INNER_STYLES, k as DIMENSION_STYLES, kt as parseFunctionName, l as getGlobalKeyframes, lt as makeKeyframeName, m as hasGlobalRecipes, n as getConfig, nn as getNamedColorHex, nt as styleHandlers, o as getGlobalFontFaces, on as strToRgb, ot as DEFAULT_ZERO_NAME_PREFIX, p as hasGlobalKeyframes, q as formatCounterStyleRule, qt as StyleParser, rn as getRgbValuesFromRgbaString, s as getGlobalFunctions, t as configure, tt as defineHandler, u as getGlobalRecipes, v as isTestEnvironment, vt as APPEARANCE_CHUNK_STYLES, w as BLOCK_INNER_STYLES, wt as POSITION_CHUNK_STYLES, x as generateTypographyTokens, xt as DISPLAY_CHUNK_STYLES, yt as CHUNK_NAMES, zt as parseStyle } from "./config-CwQ-fAsp.js";
2
+ import { l as categorizeStyleKeys } from "./keyframes-DaZhjqkd.js";
3
+ import { A as property, C as getRawCSSText, D as injector, E as injectRawCSS, M as ChunkSheetRegistry, N as chunkSheetRegistry, O as isPropertyDefined, S as getCSSTextForNode, T as injectGlobal, _ as destroy, a as color, b as gc, c as hasKeys, d as collectAutoInferredPropertiesRSC, f as getStyleTarget, g as createInjector, h as counterStyle, i as _modAttrs, j as touch, k as keyframes, l as formatKeyframesCSS, m as cleanup, n as processTokens, o as filterBaseProps, p as pushRSCCSS, r as dotize, s as computeStyles, t as tastyDebug, u as collectAutoInferredProperties, v as fontFace, w as inject, x as getCSSText, y as func } from "./core-CqSh853z.js";
4
+ import { n as formatPropertyCSS } from "./format-rules-CaW4lJGg.js";
5
+ import { t as mergeStyles } from "./merge-styles-H8LFJ5HY.js";
6
+ import { t as resolveRecipes } from "./resolve-recipes-aN94fjqS.js";
7
7
  import { t as getTastySSRContext } from "./context-CA8YKeMn.js";
8
8
  import { t as formatGlobalRules } from "./format-global-rules-DklyaXv-.js";
9
9
  import { Fragment, createElement, forwardRef, useContext } from "react";
@@ -1,4 +1,4 @@
1
- import { F as hasPipelineCacheEntry, H as extractPredefinedStateRefs, I as isSelector, L as renderStyles, Tt as STYLE_TO_CHUNK, V as extractLocalPredefinedStates, yt as CHUNK_NAMES } from "./config-CCcE_tqx.js";
1
+ import { F as hasPipelineCacheEntry, H as extractPredefinedStateRefs, I as isSelector, L as renderStyles, Tt as STYLE_TO_CHUNK, V as extractLocalPredefinedStates, yt as CHUNK_NAMES } from "./config-CwQ-fAsp.js";
2
2
  //#region src/chunks/definitions.ts
3
3
  /**
4
4
  * Style chunk definitions for CSS chunking optimization.
@@ -421,4 +421,4 @@ function filterUsedKeyframes(keyframes, usedNames) {
421
421
  //#endregion
422
422
  export { mergeKeyframes as a, generateChunkCacheKey as c, hasLocalKeyframes as i, categorizeStyleKeys as l, extractLocalKeyframes as n, replaceAnimationNames as o, filterUsedKeyframes as r, renderStylesForChunk as s, extractAnimationNamesFromStyles as t };
423
423
 
424
- //# sourceMappingURL=keyframes-B8M1FmtE.js.map
424
+ //# sourceMappingURL=keyframes-DaZhjqkd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyframes-B8M1FmtE.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 * For **custom** handlers registered through `configure({ handlers })` this is no\n * longer only a convention: `alignHandlerChunks()` in `styles/predefined.ts` pulls\n * any style name the lists below don't know into its handler's existing chunk, and\n * warns when a handler bridges two chunks defined here. The lists below are still\n * hand-maintained, so the constraint must be checked by hand when editing them.\n * ============================================================================\n */\n\nimport { isSelector } from '../pipeline';\n\nimport { CHUNK_NAMES, STYLE_TO_CHUNK } from './style-chunk-map';\nimport type { ChunkName } from './style-chunk-map';\n\n// ============================================================================\n// Chunk Style Lists\n// ============================================================================\n\n// The chunk style lists and the style→chunk map live in `style-chunk-map.ts` so\n// that the map is populated by importing *that* module, independent of whether\n// this one has been loaded. Re-exported here for the original import paths.\nexport {\n APPEARANCE_CHUNK_STYLES,\n DIMENSION_CHUNK_STYLES,\n DISPLAY_CHUNK_STYLES,\n FONT_CHUNK_STYLES,\n LAYOUT_CHUNK_STYLES,\n POSITION_CHUNK_STYLES,\n} from './style-chunk-map';\nexport { CHUNK_NAMES, STYLE_TO_CHUNK } from './style-chunk-map';\nexport type { ChunkName } from './style-chunk-map';\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 @property (processed separately in useStyles)\n // Skip recipe (resolved before pipeline by resolveRecipes)\n if (\n key === '$' ||\n key === '@keyframes' ||\n key === '@property' ||\n key === '@font-face' ||\n key === '@counter-style' ||\n key === '@function' ||\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,MAAM,cAAiC;CACrC,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;AACd;AAKwB,IAAI,IAC1B,YAAY,KAAK,MAAM,UAAU,CAAC,MAAM,KAAK,CAAC,CAChD;;;;;;;;;;AA0BA,SAAgB,oBACd,QACuB;CAEvB,MAAM,YAAsC,CAAC;CAC7C,MAAM,OAAO,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EACtB;CACF;CAEA,OAAO,WAAW,MAAM,KAAK,GAAG,IAAI;AACtC;;;;AAKA,SAAS,YAAY,KAAa,MAAc,aAA6B;CAC3E,IAAI,SAAS;CACb,IAAI,MAAM;CAEV,QAAQ,MAAM,OAAO,QAAQ,MAAM,GAAG,OAAO,IAAI;EAE/C,MAAM,SAAS,QAAQ,IAAI,MAAM,OAAO,MAAM;EAC9C,MAAM,QACJ,MAAM,KAAK,UAAU,OAAO,SAAS,MAAM,OAAO,MAAM,KAAK;EAE/D,MAAM,uBAAuB,CAAC,gBAAgB,KAAK,MAAM;EACzD,MAAM,sBAAsB,CAAC,gBAAgB,KAAK,KAAK;EAEvD,IAAI,wBAAwB,qBAAqB;GAC/C,SACE,OAAO,MAAM,GAAG,GAAG,IAAI,cAAc,OAAO,MAAM,MAAM,KAAK,MAAM;GACrE,OAAO,YAAY;EACrB,OACE,OAAO,KAAK;CAEhB;CAEA,OAAO;AACT;;;;;AAUA,SAAgB,oBACd,WACA,WACuC;CACvC,IAAI,CAAC,aAAa,UAAU,SAAS,GAAG,OAAO;CAE/C,MAAM,OAAuC,CAAC;CAC9C,IAAI,SAAS;CAEb,KAAK,MAAM,QAAQ,WACjB,IAAI,UAAU,OAAO;EACnB,KAAK,QAAQ,UAAU;EACvB,SAAS;CACX;CAGF,OAAO,SAAS,OAAO;AACzB"}
1
+ {"version":3,"file":"keyframes-DaZhjqkd.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 * For **custom** handlers registered through `configure({ handlers })` this is no\n * longer only a convention: `alignHandlerChunks()` in `styles/predefined.ts` pulls\n * any style name the lists below don't know into its handler's existing chunk, and\n * warns when a handler bridges two chunks defined here. The lists below are still\n * hand-maintained, so the constraint must be checked by hand when editing them.\n * ============================================================================\n */\n\nimport { isSelector } from '../pipeline';\n\nimport { CHUNK_NAMES, STYLE_TO_CHUNK } from './style-chunk-map';\nimport type { ChunkName } from './style-chunk-map';\n\n// ============================================================================\n// Chunk Style Lists\n// ============================================================================\n\n// The chunk style lists and the style→chunk map live in `style-chunk-map.ts` so\n// that the map is populated by importing *that* module, independent of whether\n// this one has been loaded. Re-exported here for the original import paths.\nexport {\n APPEARANCE_CHUNK_STYLES,\n DIMENSION_CHUNK_STYLES,\n DISPLAY_CHUNK_STYLES,\n FONT_CHUNK_STYLES,\n LAYOUT_CHUNK_STYLES,\n POSITION_CHUNK_STYLES,\n} from './style-chunk-map';\nexport { CHUNK_NAMES, STYLE_TO_CHUNK } from './style-chunk-map';\nexport type { ChunkName } from './style-chunk-map';\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 @property (processed separately in useStyles)\n // Skip recipe (resolved before pipeline by resolveRecipes)\n if (\n key === '$' ||\n key === '@keyframes' ||\n key === '@property' ||\n key === '@font-face' ||\n key === '@counter-style' ||\n key === '@function' ||\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8EA,MAAM,cAAiC;CACrC,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;CACZ,YAAY;AACd;AAKwB,IAAI,IAC1B,YAAY,KAAK,MAAM,UAAU,CAAC,MAAM,KAAK,CAAC,CAChD;;;;;;;;;;AA0BA,SAAgB,oBACd,QACuB;CAEvB,MAAM,YAAsC,CAAC;CAC7C,MAAM,OAAO,OAAO,KAAK,MAAM;CAE/B,KAAK,MAAM,OAAO,MAAM;EAItB,IACE,QAAQ,OACR,QAAQ,gBACR,QAAQ,eACR,QAAQ,gBACR,QAAQ,oBACR,QAAQ,eACR,QAAQ,UAER;EAGF,IAAI,WAAW,GAAG,GAAG;GAEnB,IAAI,CAAC,UAAU,YAAY,gBACzB,UAAU,YAAY,iBAAiB,CAAC;GAE1C,UAAU,YAAY,cAAc,CAAC,KAAK,GAAG;EAC/C,OAAO;GAEL,MAAM,YAAY,eAAe,IAAI,GAAG,KAAK,YAAY;GACzD,IAAI,CAAC,UAAU,YACb,UAAU,aAAa,CAAC;GAE1B,UAAU,UAAU,CAAC,KAAK,GAAG;EAC/B;CACF;CAGA,MAAM,gCAAgB,IAAI,IAAsB;CAGhD,KAAK,MAAM,aAAa,aACtB,IAAI,UAAU,cAAc,UAAU,UAAU,CAAC,SAAS,GAExD,cAAc,IAAI,WAAW,UAAU,UAAU,CAAC,KAAK,CAAC;CAK5D,KAAK,MAAM,aAAa,OAAO,KAAK,SAAS,GAC3C,IAAI,CAAC,cAAc,IAAI,SAAS,GAC9B,cAA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C9C,IAAI,SAAS;CAEb,KAAK,MAAM,QAAQ,WACjB,IAAI,UAAU,OAAO;EACnB,KAAK,QAAQ,UAAU;EACvB,SAAS;CACX;CAGF,OAAO,SAAS,OAAO;AACzB"}
@@ -1,7 +1,7 @@
1
- import { b as Styles } from "./index-l_NdJSUS.js";
1
+ import { b as Styles } from "./index-KUYya3x7.js";
2
2
 
3
3
  //#region src/utils/merge-styles.d.ts
4
4
  declare function mergeStyles(...objects: (Styles | undefined | null)[]): Styles;
5
5
  //#endregion
6
6
  export { mergeStyles as t };
7
- //# sourceMappingURL=merge-styles-NEvqayL_.d.ts.map
7
+ //# sourceMappingURL=merge-styles-DLm4wdnb.d.ts.map
@@ -1,4 +1,4 @@
1
- import { I as isSelector, Kt as isDevEnv } from "./config-CCcE_tqx.js";
1
+ import { I as isSelector, Kt as isDevEnv } from "./config-CwQ-fAsp.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--1zOSFlS.js.map
144
+ //# sourceMappingURL=merge-styles-H8LFJ5HY.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"merge-styles--1zOSFlS.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,SAAS;AAEzB,MAAM,gBAAgB;;;;AAKtB,SAAS,WAAW,OAAkD;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;AAQA,SAAS,oBAAoB,OAAgD;CAC3E,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,IAAI,SAAS,QAAQ,UAAU,OAAO,OAAO,EAAE,IAAI,MAAM;CACzD,OAAO;AACT;;;;;;;;;;;;;AAcA,SAAS,gBACP,aACA,UACyB;CACzB,MAAM,WAAW,EAAE,MAAM;CACzB,MAAM,YAAY,oBAAoB,WAAW;CAEjD,IAAI,CAAC,WAAW;EAEd,MAAM,SAAkC,CAAC;EACzC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GAA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,MAAM,OAAO,OAAO,KAAK,SAAS,GAAG;IACxC,IAAI,WAAW,GAAG,GAAG;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,QAAQ,GAC5B,aAA0C,OAAO,gBAC/C,OAAO,MACP,QACF;GAEJ;GAEA,SAAS;EACX;EAEA;CACF;CAEA,OAAO;AACT"}
1
+ {"version":3,"file":"merge-styles-H8LFJ5HY.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,SAAS;AAEzB,MAAM,gBAAgB;;;;AAKtB,SAAS,WAAW,OAAkD;CACpE,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAC5E;;;;;;;AAQA,SAAS,oBAAoB,OAAgD;CAC3E,IAAI,WAAW,KAAK,GAAG,OAAO;CAC9B,IAAI,SAAS,QAAQ,UAAU,OAAO,OAAO,EAAE,IAAI,MAAM;CACzD,OAAO;AACT;;;;;;;;;;;;;AAcA,SAAS,gBACP,aACA,UACyB;CACzB,MAAM,WAAW,EAAE,MAAM;CACzB,MAAM,YAAY,oBAAoB,WAAW;CAEjD,IAAI,CAAC,WAAW;EAEd,MAAM,SAAkC,CAAC;EACzC,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GAAG;GACvC,MAAM,MAAM,SAAS;GACrB,IAAI,QAAQ,QAAQ,QAAQ,eAAe;GAC3C,OAAO,OAAO;EAChB;EACA,OAAO;CACT;CAEA,IAAI,UACF,OAAO,kBAAkB,WAAW,QAAQ;CAG9C,OAAO,mBAAmB,WAAW,QAAQ;AAC/C;;;;AAKA,SAAS,kBACP,WACA,UACyB;CACzB,MAAM,8BAAc,IAAI,IAAY;CACpC,MAAM,6BAAa,IAAI,IAAY;CACnC,MAAM,+BAAe,IAAI,IAAqB;CAE9C,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GAAG;EACvC,MAAM,MAAM,SAAS;EACrB,IAAI,QAAQ;OACN,OAAO,WACT,YAAY,IAAI,GAAG;QACd,IAA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,GAAG,GACvB,OAAO,OAAO,gBACZ,SAAS,OAAO,OAAO,KAAA,GACvB,GACF;CAEJ;CAEA,OAAO;AACT;AAEA,SAAgB,YAAY,GAAG,SAAgD;CAC7E,IAAI,SAAiB,QAAQ,KAAK,EAAE,GAAG,QAAQ,GAAG,IAAI,CAAC;CACvD,IAAI,MAAM;CAEV,OAAO,OAAO,SAAS;EACrB,MAAM,eAAe,OAAO,KAAK,MAAM,CAAC,CAAC,QACtC,QAAQ,WAAW,GAAG,KAAK,OAAO,IACrC;EACA,MAAM,YAAY,QAAQ;EAE1B,IAAI,WAAW;GACb,MAAM,eAAe;IAAE,GAAG;IAAQ,GAAG;GAAU;GAG/C,MAAM,kBAAkB,OAAO,KAAK,SAAS,CAAC,CAAC,OAAO,UAAU;GAChE,MAAM,kBAAkB,IAAI,IAAI,CAAC,GAAG,cAAc,GAAG,eAAe,CAAC;GAErE,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,QACF;GAEJ;GAGA,KAAK,MAAM,OAAO,OAAO,KAAK,SAAS,GAAG;IACxC,IAAI,WAAW,GAAG,GAAG;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,QAAQ,GAC5B,aAA0C,OAAO,gBAC/C,OAAO,MACP,QACF;GAEJ;GAEA,SAAS;EACX;EAEA;CACF;CAEA,OAAO;AACT"}
@@ -1,5 +1,5 @@
1
- import { I as isSelector, Kt as isDevEnv, u as getGlobalRecipes } from "./config-CCcE_tqx.js";
2
- import { t as mergeStyles } from "./merge-styles--1zOSFlS.js";
1
+ import { I as isSelector, Kt as isDevEnv, u as getGlobalRecipes } from "./config-CwQ-fAsp.js";
2
+ import { t as mergeStyles } from "./merge-styles-H8LFJ5HY.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-Caix5NnH.js.map
144
+ //# sourceMappingURL=resolve-recipes-aN94fjqS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-recipes-Caix5NnH.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 ? (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C,CAAC;CAEjD,KAAK,MAAM,OAAO,OAAO,KAAK,OAAO,GACnC,IAAI,WAAW,GAAG,GAChB,eAAe,OAAO,QAAQ;MAE9B,WAAW,OAAO,QAAQ;CAI9B,IAAI,CAAC,QAAQ,CAAC,MACZ,OAAO;CAIT,IAAI;CAEJ,IAAI,MAEF,SAAS,YADU,oBAAoB,MAAM,OACf,GAAa,UAAoB;MAK/D,SAAS,EAAE,GAAG,WAAW;CAI3B,IAAI,MAAM;EACR,MAAM,aAAa,oBAAoB,MAAM,OAAO;EACpD,SAAS,YAAY,QAAkB,UAAoB;CAI7D;CAGA,KAAK,MAAM,OAAO,OAAO,KAAK,cAAc,GAC1C,OAAO,OAAO,eAAe;CAG/B,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,eAAe,QAAwB;CACrD,MAAM,UAAU,iBAAiB;CAGjC,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,UAAU;CAGd,MAAM,cAAc,uBAClB,QACA,OACF;CAEA,IAAI;CAEJ,IAAI,aAAa;EACf,UAAU;EACV,SAAS;CACX,OAEE,SAAS;CAIX,MAAM,OAAO,OAAO,KAAK,MAAM;CAE/B,KAAK,MAAM,OAAO,MAAM;EACtB,IAAI,CAAC,WAAW,GAAG,GAAG;EAEtB,MAAM,YAAY,OAAO;EAEzB,IACE,CAAC,aACD,OAAO,cAAc,YACrB,MAAM,QAAQ,SAAS,GAEvB;EAGF,MAAM,YAAY;EAElB,IAAI,EAAE,YAAY,YAAY;EAE9B,MAAM,cAAc,uBAAuB,WAAW,OAAO;EAE7D,IAAI,aAAa;GACf,IAAI,CAAC,SAAS;IAEZ,UAAU;IACV,SAAS,EAAE,GAAI,OAAmC;GACpD;GACA,OAAO,OAAO;EAChB;CACF;CAEA,OAAO,UAAW,SAAoB;AACxC"}
1
+ {"version":3,"file":"resolve-recipes-aN94fjqS.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,SAAS;;;;;;;;;;;;AAkBzB,SAAS,iBAAiB,OAAoC;CAC5D,MAAM,QAA4B;EAAE,MAAM;EAAM,MAAM;CAAK;CAE3D,IAAI,OAAO,UAAU,UAAU,OAAO;CACtC,MAAM,UAAU,MAAM,KAAK;CAC3B,IAAI,YAAY,IAAI,OAAO;CAE3B,MAAM,aAAa,QAAQ,QAAQ,GAAG;CAEtC,IAAI,eAAe,IAAI;EACrB,IAAI,YAAY,QAAQ,OAAO;EAE/B,OAAO;GAAE,MADK,WAAW,OACN;GAAG,MAAM;EAAK;CACnC;CAEA,MAAM,WAAW,QAAQ,MAAM,GAAG,U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;;;;;;;;;AAYA,SAAgB,eAAe,QAAwB;CACrD,MAAM,UAAU,iBAAiB;CAGjC,IAAI,CAAC,SAAS,OAAO;CAErB,IAAI,UAAU;CAGd,MAAM,cAAc,uBAClB,QACA,OACF;CAEA,IAAI;CAEJ,IAAI,aAAa;EACf,UAAU;EACV,SAAS;CACX,OAEE,SAAS;CAIX,MAAM,OAAO,OAAO,KAAK,MAAM;CAE/B,KAAK,MAAM,OAAO,MAAM;EACtB,IAAI,CAAC,WAAW,GAAG,GAAG;EAEtB,MAAM,YAAY,OAAO;EAEzB,IACE,CAAC,aACD,OAAO,cAAc,YACrB,MAAM,QAAQ,SAAS,GAEvB;EAGF,MAAM,YAAY;EAElB,IAAI,EAAE,YAAY,YAAY;EAE9B,MAAM,cAAc,uBAAuB,WAAW,OAAO;EAE7D,IAAI,aAAa;GACf,IAAI,CAAC,SAAS;IAEZ,UAAU;IACV,SAAS,EAAE,GAAI,OAAmC;GACpD;GACA,OAAO,OAAO;EAChB;CACF;CAEA,OAAO,UAAW,SAAoB;AACxC"}
@@ -1,4 +1,4 @@
1
- import { t as hydrateTastyClasses } from "../hydrate-CwALW3J9.js";
1
+ import { t as hydrateTastyClasses } from "../hydrate-uFv9kx7G.js";
2
2
  //#region src/ssr/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-CCcE_tqx.js";
2
- import { a as registerSSRCollectorGetterGlobal } from "../format-rules-BbKDjsfO.js";
3
- import { t as ServerStyleCollector } from "../collector-D14DcZx9.js";
1
+ import { n as getConfig } from "../config-CwQ-fAsp.js";
2
+ import { a as registerSSRCollectorGetterGlobal } from "../format-rules-CaW4lJGg.js";
3
+ import { t as ServerStyleCollector } from "../collector-D7yzmG5G.js";
4
4
  import { n as runWithCollector, t as getSSRCollector } from "../async-storage-DKK-wTD4.js";
5
5
  //#region src/ssr/astro.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-BPzZezAG.js";
1
+ import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-D8o4Wdq-.js";
2
2
 
3
3
  //#region src/ssr/async-storage.d.ts
4
4
  /**
package/dist/ssr/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as registerSSRCollectorGetterGlobal } from "../format-rules-BbKDjsfO.js";
2
- import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-D14DcZx9.js";
1
+ import { a as registerSSRCollectorGetterGlobal } from "../format-rules-CaW4lJGg.js";
2
+ import { n as createServerStyleCollector, t as ServerStyleCollector } from "../collector-D7yzmG5G.js";
3
3
  import { n as runWithCollector, t as getSSRCollector } from "../async-storage-DKK-wTD4.js";
4
- import { t as hydrateTastyClasses } from "../hydrate-CwALW3J9.js";
4
+ import { t as hydrateTastyClasses } from "../hydrate-uFv9kx7G.js";
5
5
  //#region src/ssr/index.ts
6
6
  registerSSRCollectorGetterGlobal(getSSRCollector);
7
7
  //#endregion
@@ -1,4 +1,4 @@
1
- import { t as ServerStyleCollector } from "../collector-BPzZezAG.js";
1
+ import { t as ServerStyleCollector } from "../collector-D8o4Wdq-.js";
2
2
  import { ReactNode } from "react";
3
3
 
4
4
  //#region src/ssr/next.d.ts