@tenphi/tasty 0.0.0-snapshot.167ce4e → 0.0.0-snapshot.16de432

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 (49) hide show
  1. package/dist/{collector-LuU1vZ68.d.ts → collector-BQHl-atL.d.ts} +12 -2
  2. package/dist/{collector-WUJKpM4q.js → collector-DROCOiaT.js} +24 -11
  3. package/dist/collector-DROCOiaT.js.map +1 -0
  4. package/dist/{config-vuCRkBWX.d.ts → config-CzzTHmtS.d.ts} +48 -4
  5. package/dist/{config-raGoEeGs.js → config-JokB1Lc8.js} +154 -30
  6. package/dist/config-JokB1Lc8.js.map +1 -0
  7. package/dist/core/index.d.ts +5 -5
  8. package/dist/core/index.js +6 -6
  9. package/dist/{core-CrPLif0D.js → core-CW4XEUFk.js} +18 -12
  10. package/dist/core-CW4XEUFk.js.map +1 -0
  11. package/dist/{css-writer-BaR8ywQm.js → css-writer-Jv468wSl.js} +28 -6
  12. package/dist/css-writer-Jv468wSl.js.map +1 -0
  13. package/dist/{format-rules-B_Cuw1ZS.js → format-rules-B0vbh8Qz.js} +2 -2
  14. package/dist/{format-rules-B_Cuw1ZS.js.map → format-rules-B0vbh8Qz.js.map} +1 -1
  15. package/dist/{hydrate-DmVyww8Y.js → hydrate-BO6nlAeD.js} +2 -2
  16. package/dist/{hydrate-DmVyww8Y.js.map → hydrate-BO6nlAeD.js.map} +1 -1
  17. package/dist/{index-dUtwpOux.d.ts → index-Dy74C11K.d.ts} +8 -1
  18. package/dist/{index-ZRxZWzlj.d.ts → index-mWACW3QW.d.ts} +32 -6
  19. package/dist/index.d.ts +5 -5
  20. package/dist/index.js +10 -10
  21. package/dist/index.js.map +1 -1
  22. package/dist/{keyframes-C9OD_9bX.js → keyframes-J_JNrpdh.js} +2 -2
  23. package/dist/{keyframes-C9OD_9bX.js.map → keyframes-J_JNrpdh.js.map} +1 -1
  24. package/dist/{merge-styles-CtDJMhpJ.d.ts → merge-styles-BS-mpcci.d.ts} +2 -2
  25. package/dist/{merge-styles-B57eQpFZ.js → merge-styles-Du-eC7zp.js} +2 -2
  26. package/dist/{merge-styles-B57eQpFZ.js.map → merge-styles-Du-eC7zp.js.map} +1 -1
  27. package/dist/{resolve-recipes-J9mdpVSZ.js → resolve-recipes-DPRT3FMM.js} +3 -3
  28. package/dist/{resolve-recipes-J9mdpVSZ.js.map → resolve-recipes-DPRT3FMM.js.map} +1 -1
  29. package/dist/ssr/astro-client.js +1 -1
  30. package/dist/ssr/astro.js +3 -3
  31. package/dist/ssr/index.d.ts +1 -1
  32. package/dist/ssr/index.js +3 -3
  33. package/dist/ssr/next.d.ts +1 -1
  34. package/dist/ssr/next.js +4 -4
  35. package/dist/static/index.d.ts +2 -2
  36. package/dist/static/index.js +1 -1
  37. package/dist/zero/babel.d.ts +1 -1
  38. package/dist/zero/babel.js +16 -8
  39. package/dist/zero/babel.js.map +1 -1
  40. package/dist/zero/index.d.ts +1 -1
  41. package/dist/zero/index.js +1 -1
  42. package/docs/configuration.md +44 -0
  43. package/docs/ssr.md +5 -3
  44. package/docs/tasty-static.md +15 -0
  45. package/package.json +1 -1
  46. package/dist/collector-WUJKpM4q.js.map +0 -1
  47. package/dist/config-raGoEeGs.js.map +0 -1
  48. package/dist/core-CrPLif0D.js.map +0 -1
  49. package/dist/css-writer-BaR8ywQm.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { n as StyleResult } from "./index-dUtwpOux.js";
1
+ import { n as StyleResult } from "./index-Dy74C11K.js";
2
2
 
3
3
  //#region src/ssr/collector.d.ts
4
4
  declare class ServerStyleCollector {
@@ -20,6 +20,16 @@ declare class ServerStyleCollector {
20
20
  private keyframesCounter;
21
21
  private counterStyleCounter;
22
22
  private internalsCollected;
23
+ private namePrefix;
24
+ /**
25
+ * @param namePrefix - Optional override for the configured prefix.
26
+ * Defaults to the value from `configure({ namePrefix })` (or `'t'`).
27
+ * Pass an explicit prefix when constructing a collector outside the
28
+ * normal configure() lifecycle (e.g. in tests). Validated eagerly
29
+ * so misconfiguration fails before any CSS is collected.
30
+ */
31
+ constructor(namePrefix?: string);
32
+ private generateClassName;
23
33
  /**
24
34
  * Collect internal @property rules and :root token defaults.
25
35
  * Mirrors markStylesGenerated() from the client-side injector.
@@ -95,4 +105,4 @@ declare class ServerStyleCollector {
95
105
  }
96
106
  //#endregion
97
107
  export { ServerStyleCollector as t };
98
- //# sourceMappingURL=collector-LuU1vZ68.d.ts.map
108
+ //# sourceMappingURL=collector-BQHl-atL.d.ts.map
@@ -1,5 +1,5 @@
1
- import { F as formatFontFaceRule, P as fontFaceContentHash, a as getGlobalCounterStyle, ct as hashString, i as getGlobalConfigTokens, j as formatCounterStyleRule, o as getGlobalFontFace, r as getEffectiveProperties, u as getGlobalStyles, x as renderStyles } from "./config-raGoEeGs.js";
2
- import { n as formatPropertyCSS, t as formatRules } from "./format-rules-B_Cuw1ZS.js";
1
+ import { F as fontFaceContentHash, I as formatFontFaceRule, M as formatCounterStyleRule, S as renderStyles, a as getGlobalCounterStyle, d as getNamePrefix, dt as makeCounterStyleName, ft as makeKeyframeName, gt as hashString, i as getGlobalConfigTokens, mt as validateNamePrefix, o as getGlobalFontFace, r as getEffectiveProperties, u as getGlobalStyles, ut as makeClassName } from "./config-JokB1Lc8.js";
2
+ import { n as formatPropertyCSS, t as formatRules } from "./format-rules-B0vbh8Qz.js";
3
3
  import { t as formatGlobalRules } from "./format-global-rules-Dbc_1tc3.js";
4
4
  //#region src/ssr/collector.ts
5
5
  /**
@@ -7,15 +7,13 @@ import { t as formatGlobalRules } from "./format-global-rules-Dbc_1tc3.js";
7
7
  *
8
8
  * Accumulates CSS rules and cache metadata during server rendering.
9
9
  * This is the server-side counterpart to StyleInjector: it allocates
10
- * hash-based class names (`t${hash}`), formats CSS rules into text,
11
- * and tracks rendered class names for lightweight client transfer.
10
+ * hash-based class names using the configured `namePrefix` (defaults
11
+ * to `'t'`), formats CSS rules into text, and tracks rendered class
12
+ * names for lightweight client transfer.
12
13
  *
13
14
  * One instance is created per HTTP request. Concurrent requests
14
15
  * each get their own collector (via AsyncLocalStorage or React context).
15
16
  */
16
- function generateClassName(cacheKey) {
17
- return `t${hashString(cacheKey)}`;
18
- }
19
17
  var ServerStyleCollector = class {
20
18
  chunks = /* @__PURE__ */ new Map();
21
19
  cacheKeyToClassName = /* @__PURE__ */ new Map();
@@ -35,6 +33,21 @@ var ServerStyleCollector = class {
35
33
  keyframesCounter = 0;
36
34
  counterStyleCounter = 0;
37
35
  internalsCollected = false;
36
+ namePrefix;
37
+ /**
38
+ * @param namePrefix - Optional override for the configured prefix.
39
+ * Defaults to the value from `configure({ namePrefix })` (or `'t'`).
40
+ * Pass an explicit prefix when constructing a collector outside the
41
+ * normal configure() lifecycle (e.g. in tests). Validated eagerly
42
+ * so misconfiguration fails before any CSS is collected.
43
+ */
44
+ constructor(namePrefix) {
45
+ if (namePrefix !== void 0) validateNamePrefix(namePrefix);
46
+ this.namePrefix = namePrefix ?? getNamePrefix();
47
+ }
48
+ generateClassName(cacheKey) {
49
+ return makeClassName(this.namePrefix, hashString(cacheKey));
50
+ }
38
51
  /**
39
52
  * Collect internal @property rules and :root token defaults.
40
53
  * Mirrors markStylesGenerated() from the client-side injector.
@@ -94,7 +107,7 @@ var ServerStyleCollector = class {
94
107
  className: existing,
95
108
  isNewAllocation: false
96
109
  };
97
- const className = generateClassName(cacheKey);
110
+ const className = this.generateClassName(cacheKey);
98
111
  this.cacheKeyToClassName.set(cacheKey, className);
99
112
  return {
100
113
  className,
@@ -126,7 +139,7 @@ var ServerStyleCollector = class {
126
139
  * Allocate a keyframe name for SSR. Uses provided name or generates one.
127
140
  */
128
141
  allocateKeyframeName(providedName) {
129
- return providedName ?? `k${this.keyframesCounter++}`;
142
+ return providedName ?? makeKeyframeName(this.namePrefix, String(this.keyframesCounter++));
130
143
  }
131
144
  /**
132
145
  * Record a @font-face rule. Deduplicated by key (content hash).
@@ -144,7 +157,7 @@ var ServerStyleCollector = class {
144
157
  * Allocate a counter-style name for SSR. Uses provided name or generates one.
145
158
  */
146
159
  allocateCounterStyleName(providedName) {
147
- return providedName ?? `cs${this.counterStyleCounter++}`;
160
+ return providedName ?? makeCounterStyleName(this.namePrefix, String(this.counterStyleCounter++));
148
161
  }
149
162
  /**
150
163
  * Record global styles (from useGlobalStyles). Deduplicated by key.
@@ -227,4 +240,4 @@ var ServerStyleCollector = class {
227
240
  //#endregion
228
241
  export { ServerStyleCollector as t };
229
242
 
230
- //# sourceMappingURL=collector-WUJKpM4q.js.map
243
+ //# sourceMappingURL=collector-DROCOiaT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collector-DROCOiaT.js","names":[],"sources":["../src/ssr/collector.ts"],"sourcesContent":["/**\n * ServerStyleCollector — server-safe style collector for SSR.\n *\n * Accumulates CSS rules and cache metadata during server rendering.\n * This is the server-side counterpart to StyleInjector: it allocates\n * hash-based class names using the configured `namePrefix` (defaults\n * to `'t'`), formats CSS rules into text, and tracks rendered class\n * names for lightweight client transfer.\n *\n * One instance is created per HTTP request. Concurrent requests\n * each get their own collector (via AsyncLocalStorage or React context).\n */\n\nimport {\n getEffectiveProperties,\n getGlobalStyles,\n getGlobalCounterStyle,\n getGlobalFontFace,\n getGlobalConfigTokens,\n getNamePrefix,\n} from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport { renderStyles } from '../pipeline';\nimport type { StyleResult } from '../pipeline';\nimport { hashString } from '../utils/hash';\nimport {\n makeClassName,\n makeCounterStyleName,\n makeKeyframeName,\n validateNamePrefix,\n} from '../utils/name-prefix';\nimport { formatPropertyCSS } from './format-property';\nimport { formatGlobalRules } from './format-global-rules';\nimport { formatRules } from './format-rules';\n\nexport class ServerStyleCollector {\n private chunks = new Map<string, string>();\n private cacheKeyToClassName = new Map<string, string>();\n private flushedKeys = new Set<string>();\n private propertyRules = new Map<string, string>();\n private flushedPropertyKeys = new Set<string>();\n private keyframeRules = new Map<string, string>();\n private flushedKeyframeKeys = new Set<string>();\n private globalStyles = new Map<string, string>();\n private flushedGlobalKeys = new Set<string>();\n private rawCSS = new Map<string, string>();\n private flushedRawKeys = new Set<string>();\n private fontFaceRules = new Map<string, string>();\n private flushedFontFaceKeys = new Set<string>();\n private counterStyleRules = new Map<string, string>();\n private flushedCounterStyleKeys = new Set<string>();\n private keyframesCounter = 0;\n private counterStyleCounter = 0;\n private internalsCollected = false;\n private namePrefix: string;\n\n /**\n * @param namePrefix - Optional override for the configured prefix.\n * Defaults to the value from `configure({ namePrefix })` (or `'t'`).\n * Pass an explicit prefix when constructing a collector outside the\n * normal configure() lifecycle (e.g. in tests). Validated eagerly\n * so misconfiguration fails before any CSS is collected.\n */\n constructor(namePrefix?: string) {\n if (namePrefix !== undefined) {\n validateNamePrefix(namePrefix);\n }\n this.namePrefix = namePrefix ?? getNamePrefix();\n }\n\n private generateClassName(cacheKey: string): string {\n return makeClassName(this.namePrefix, hashString(cacheKey));\n }\n\n /**\n * Collect internal @property rules and :root token defaults.\n * Mirrors markStylesGenerated() from the client-side injector.\n * Called automatically on first chunk collection; idempotent.\n *\n * Internals are always emitted here — the RSC path deliberately\n * defers to SSR so that tokens appear exactly once per page in\n * <style data-tasty-ssr> (avoiding duplication of large token sets).\n */\n collectInternals(): void {\n if (this.internalsCollected) return;\n this.internalsCollected = true;\n\n for (const [token, definition] of Object.entries(\n getEffectiveProperties(),\n )) {\n const css = formatPropertyCSS(token, definition);\n if (css) {\n this.collectProperty(`__prop:${token}`, css);\n }\n }\n\n const tokenStyles = getGlobalConfigTokens();\n if (tokenStyles && Object.keys(tokenStyles).length > 0) {\n const tokenRules = renderStyles(tokenStyles, ':root') as StyleResult[];\n if (tokenRules.length > 0) {\n const css = formatGlobalRules(tokenRules);\n if (css) {\n this.collectGlobalStyles('__global:tokens', css);\n }\n }\n }\n\n const globalFF = getGlobalFontFace();\n if (globalFF) {\n for (const [family, input] of Object.entries(globalFF)) {\n const descriptors = Array.isArray(input) ? input : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n this.collectFontFace(hash, css);\n }\n }\n }\n\n const globalCS = getGlobalCounterStyle();\n if (globalCS) {\n for (const [name, descriptors] of Object.entries(globalCS)) {\n const css = formatCounterStyleRule(name, descriptors);\n this.collectCounterStyle(name, css);\n }\n }\n\n const globalStyles = getGlobalStyles();\n if (globalStyles) {\n for (const [selector, styles] of Object.entries(globalStyles)) {\n if (Object.keys(styles).length > 0) {\n const rules = renderStyles(styles, selector) as StyleResult[];\n if (rules.length > 0) {\n const css = formatGlobalRules(rules);\n if (css) {\n this.collectGlobalStyles(`__global:styles:${selector}`, css);\n }\n }\n }\n }\n }\n }\n\n /**\n * Allocate a className for a cache key, server-side.\n * Mirrors StyleInjector.allocateClassName but without DOM access.\n */\n allocateClassName(cacheKey: string): {\n className: string;\n isNewAllocation: boolean;\n } {\n const existing = this.cacheKeyToClassName.get(cacheKey);\n if (existing) {\n return { className: existing, isNewAllocation: false };\n }\n\n const className = this.generateClassName(cacheKey);\n this.cacheKeyToClassName.set(cacheKey, className);\n\n return { className, isNewAllocation: true };\n }\n\n /**\n * Record CSS rules for a chunk.\n * Called by useStyles during server render.\n */\n collectChunk(\n cacheKey: string,\n className: string,\n rules: StyleResult[],\n ): void {\n if (this.chunks.has(cacheKey)) return;\n const css = formatRules(rules, className);\n if (css) {\n this.chunks.set(cacheKey, css);\n }\n }\n\n /**\n * Record a @property rule. Deduplicated by name.\n */\n collectProperty(name: string, css: string): void {\n if (!this.propertyRules.has(name)) {\n this.propertyRules.set(name, css);\n }\n }\n\n /**\n * Record a @keyframes rule. Deduplicated by name.\n */\n collectKeyframes(name: string, css: string): void {\n if (!this.keyframeRules.has(name)) {\n this.keyframeRules.set(name, css);\n }\n }\n\n /**\n * Allocate a keyframe name for SSR. Uses provided name or generates one.\n */\n allocateKeyframeName(providedName?: string): string {\n return (\n providedName ??\n makeKeyframeName(this.namePrefix, String(this.keyframesCounter++))\n );\n }\n\n /**\n * Record a @font-face rule. Deduplicated by key (content hash).\n */\n collectFontFace(key: string, css: string): void {\n if (!this.fontFaceRules.has(key)) {\n this.fontFaceRules.set(key, css);\n }\n }\n\n /**\n * Record a @counter-style rule. Deduplicated by name.\n */\n collectCounterStyle(name: string, css: string): void {\n if (!this.counterStyleRules.has(name)) {\n this.counterStyleRules.set(name, css);\n }\n }\n\n /**\n * Allocate a counter-style name for SSR. Uses provided name or generates one.\n */\n allocateCounterStyleName(providedName?: string): string {\n return (\n providedName ??\n makeCounterStyleName(this.namePrefix, String(this.counterStyleCounter++))\n );\n }\n\n /**\n * Record global styles (from useGlobalStyles). Deduplicated by key.\n */\n collectGlobalStyles(key: string, css: string): void {\n if (!this.globalStyles.has(key)) {\n this.globalStyles.set(key, css);\n }\n }\n\n /**\n * Record raw CSS text (from useRawCSS). Deduplicated by key.\n */\n collectRawCSS(key: string, css: string): void {\n if (!this.rawCSS.has(key)) {\n this.rawCSS.set(key, css);\n }\n }\n\n /**\n * Extract all CSS collected so far as a single string.\n * Includes @property and @keyframes rules.\n * Used for non-streaming SSR (renderToString).\n */\n getCSS(): string {\n const parts: string[] = [];\n\n for (const css of this.propertyRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.fontFaceRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.counterStyleRules.values()) {\n parts.push(css);\n }\n\n for (const css of this.rawCSS.values()) {\n parts.push(css);\n }\n\n for (const css of this.globalStyles.values()) {\n parts.push(css);\n }\n\n for (const css of this.chunks.values()) {\n parts.push(css);\n }\n\n for (const css of this.keyframeRules.values()) {\n parts.push(css);\n }\n\n return parts.join('\\n');\n }\n\n /**\n * Flush only newly collected CSS since the last flush.\n * Used for streaming SSR (renderToPipeableStream + useServerInsertedHTML).\n */\n flushCSS(): string {\n const parts: string[] = [];\n\n for (const [name, css] of this.propertyRules) {\n if (!this.flushedPropertyKeys.has(name)) {\n parts.push(css);\n this.flushedPropertyKeys.add(name);\n }\n }\n\n for (const [key, css] of this.fontFaceRules) {\n if (!this.flushedFontFaceKeys.has(key)) {\n parts.push(css);\n this.flushedFontFaceKeys.add(key);\n }\n }\n\n for (const [key, css] of this.counterStyleRules) {\n if (!this.flushedCounterStyleKeys.has(key)) {\n parts.push(css);\n this.flushedCounterStyleKeys.add(key);\n }\n }\n\n for (const [key, css] of this.rawCSS) {\n if (!this.flushedRawKeys.has(key)) {\n parts.push(css);\n this.flushedRawKeys.add(key);\n }\n }\n\n for (const [key, css] of this.globalStyles) {\n if (!this.flushedGlobalKeys.has(key)) {\n parts.push(css);\n this.flushedGlobalKeys.add(key);\n }\n }\n\n for (const [key, css] of this.chunks) {\n if (!this.flushedKeys.has(key)) {\n parts.push(css);\n this.flushedKeys.add(key);\n }\n }\n\n for (const [name, css] of this.keyframeRules) {\n if (!this.flushedKeyframeKeys.has(name)) {\n parts.push(css);\n this.flushedKeyframeKeys.add(name);\n }\n }\n\n return parts.join('\\n');\n }\n\n private flushedClassNames = new Set<string>();\n\n /**\n * Return class names rendered since the last call (for streaming).\n * Used to emit lightweight class-list scripts for client hydration.\n */\n getRenderedClassNames(): string[] {\n const names: string[] = [];\n for (const className of this.cacheKeyToClassName.values()) {\n if (!this.flushedClassNames.has(className)) {\n this.flushedClassNames.add(className);\n names.push(className);\n }\n }\n return names;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAoCA,IAAa,uBAAb,MAAkC;CAChC,yBAAiB,IAAI,KAAqB;CAC1C,sCAA8B,IAAI,KAAqB;CACvD,8BAAsB,IAAI,KAAa;CACvC,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,gCAAwB,IAAI,KAAqB;CACjD,sCAA8B,IAAI,KAAa;CAC/C,+BAAuB,IAAI,KAAqB;CAChD,oCAA4B,IAAI,KAAa;CAC7C,yBAAiB,IAAI,KAAqB;CAC1C,iCAAyB,IAAI,KAAa;CAC1C,gCAAwB,IAAI,KAAqB;CACjD,sC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IAAI;AACf,QAAK,oBAAoB,IAAI,IAAI;;AAIrC,OAAK,MAAM,CAAC,KAAK,QAAQ,KAAK,kBAC5B,KAAI,CAAC,KAAK,wBAAwB,IAAI,IAAI,EAAE;AAC1C,SAAM,KAAK,IAAI;AACf,QAAK,wBAAwB,IAAI,IAAI;;AAIzC,OAAK,MAAM,CAAC,KAAK,QAAQ,KAAK,OAC5B,KAAI,CAAC,KAAK,eAAe,IAAI,IAAI,EAAE;AACjC,SAAM,KAAK,IAAI;AACf,QAAK,eAAe,IAAI,IAAI;;AAIhC,OAAK,MAAM,CAAC,KAAK,QAAQ,KAAK,aAC5B,KAAI,CAAC,KAAK,kBAAkB,IAAI,IAAI,EAAE;AACpC,SAAM,KAAK,IAAI;AACf,QAAK,kBAAkB,IAAI,IAAI;;AAInC,OAAK,MAAM,CAAC,KAAK,QAAQ,KAAK,OAC5B,KAAI,CAAC,KAAK,YAAY,IAAI,IAAI,EAAE;AAC9B,SAAM,KAAK,IAAI;AACf,QAAK,YAAY,IAAI,IAAI;;AAI7B,OAAK,MAAM,CAAC,MAAM,QAAQ,KAAK,cAC7B,KAAI,CAAC,KAAK,oBAAoB,IAAI,KAAK,EAAE;AACvC,SAAM,KAAK,IAAI;AACf,QAAK,oBAAoB,IAAI,KAAK;;AAItC,SAAO,MAAM,KAAK,KAAK;;CAGzB,oCAA4B,IAAI,KAAa;;;;;CAM7C,wBAAkC;EAChC,MAAM,QAAkB,EAAE;AAC1B,OAAK,MAAM,aAAa,KAAK,oBAAoB,QAAQ,CACvD,KAAI,CAAC,KAAK,kBAAkB,IAAI,UAAU,EAAE;AAC1C,QAAK,kBAAkB,IAAI,UAAU;AACrC,SAAM,KAAK,UAAU;;AAGzB,SAAO"}
@@ -1,4 +1,4 @@
1
- import { Ct as RawCSSResult, Dt as StyleInjectorConfig, Et as SheetInfo, M as StyleHandlerDefinition, Ot as StyleRule, St as PropertyDefinition, Tt as RuleInfo, b as Styles, bt as KeyframesResult, ct as CacheMetrics, dt as FontFaceDescriptors, ft as FontFaceInput, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as StyleDetails, lt as CounterStyleDescriptors, mt as GCOptions, n as StyleResult, ot as UnitHandler, pt as GCConfig, v as RecipeStyles, wt as RootRegistry, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-dUtwpOux.js";
1
+ import { Ct as RawCSSResult, Dt as StyleInjectorConfig, Et as SheetInfo, M as StyleHandlerDefinition, Ot as StyleRule, St as PropertyDefinition, Tt as RuleInfo, b as Styles, bt as KeyframesResult, ct as CacheMetrics, dt as FontFaceDescriptors, ft as FontFaceInput, gt as InjectResult, h as ConfigTokens, ht as GlobalInjectResult, it as StyleDetails, lt as CounterStyleDescriptors, mt as GCOptions, n as StyleResult, ot as UnitHandler, pt as GCConfig, v as RecipeStyles, wt as RootRegistry, xt as KeyframesSteps, yt as KeyframesInfo } from "./index-Dy74C11K.js";
2
2
 
3
3
  //#region src/injector/sheet-manager.d.ts
4
4
  declare class SheetManager {
@@ -161,9 +161,18 @@ declare class StyleInjector {
161
161
  private config;
162
162
  private globalRuleCounter;
163
163
  private pendingGCHandle;
164
+ private namePrefix;
165
+ private classRegex;
166
+ private rscClassRegex;
164
167
  /** @internal — exposed for debug utilities only */
165
168
  get _sheetManager(): SheetManager;
166
169
  constructor(config?: StyleInjectorConfig);
170
+ /**
171
+ * Generate a deterministic class name from a cache key using content hash.
172
+ * The same cache key always produces the same class name across environments
173
+ * with the same `namePrefix`.
174
+ */
175
+ private generateClassName;
167
176
  /**
168
177
  * Check if `className` was hydrated from server-rendered styles and,
169
178
  * if so, wire the cacheKey mapping. Returns true on hit.
@@ -268,6 +277,11 @@ declare class StyleInjector {
268
277
  property(name: string, options?: PropertyDefinition & {
269
278
  root?: Document | ShadowRoot;
270
279
  }): void;
280
+ /**
281
+ * Build and insert a single `@property` rule into the given registry.
282
+ * No-op if the property was already injected.
283
+ */
284
+ private insertPropertyRule;
271
285
  /**
272
286
  * Check whether a given @property name was already injected by this injector.
273
287
  *
@@ -314,7 +328,6 @@ declare class StyleInjector {
314
328
  * Dispose keyframes
315
329
  */
316
330
  private disposeKeyframes;
317
- private static readonly TASTY_CLASS_RE;
318
331
  /**
319
332
  * Record a render-time usage hit for one or more classNames.
320
333
  * Handles space-separated multi-chunk classNames.
@@ -551,6 +564,28 @@ interface TastyConfig {
551
564
  * ```
552
565
  */
553
566
  gc?: GCConfig;
567
+ /**
568
+ * Prefix prepended to every generated identifier (class names,
569
+ * keyframe names, counter-style names). The hash is appended verbatim,
570
+ * so include any separator inside the prefix itself (e.g. `'myapp-'`).
571
+ *
572
+ * Discriminator letters are inserted between the prefix and the hash
573
+ * for non-class names so the three kinds stay visually distinct:
574
+ * - class: `${namePrefix}${hash}` — e.g. `t1a2b3`
575
+ * - keyframe: `${namePrefix}k${hash}` — e.g. `tk1a2b3`
576
+ * - counter-style: `${namePrefix}c${hash}` — e.g. `tc1a2b3`
577
+ *
578
+ * The runtime, SSR, and RSC paths must agree on this value or
579
+ * hydration will mismatch. The zero-runtime build path defaults to
580
+ * `'ts'` (overridable via the same option) so its classes can't
581
+ * collide with runtime classes when both are loaded on the same page.
582
+ *
583
+ * Must match `^[a-zA-Z][a-zA-Z0-9_-]{0,31}$`. Locked once styles
584
+ * have been generated.
585
+ *
586
+ * @default 't'
587
+ */
588
+ namePrefix?: string;
554
589
  /**
555
590
  * Plugins that extend tasty with custom functions, units, or states.
556
591
  * Plugins are processed in order, with later plugins overriding earlier ones.
@@ -874,11 +909,20 @@ declare function configure(config?: Partial<TastyConfig>): void;
874
909
  * If not configured, returns default configuration.
875
910
  */
876
911
  declare function getConfig(): TastyConfig;
912
+ /**
913
+ * Get the configured prefix used for every generated identifier
914
+ * (class names, keyframe names, counter-style names).
915
+ *
916
+ * Falls back to the default prefix (`'t'`) when `configure()` has not
917
+ * been called yet — this matches the auto-configuration behavior used
918
+ * by the rest of the system.
919
+ */
920
+ declare function getNamePrefix(): string;
877
921
  /**
878
922
  * Reset configuration (for testing only).
879
923
  * Clears the global injector and allows reconfiguration.
880
924
  */
881
925
  declare function resetConfig(): void;
882
926
  //#endregion
883
- export { TypographyTokenValue as _, getGlobalFontFace as a, StyleInjector as b, hasGlobalKeyframes as c, isConfigLocked as d, isTestEnvironment as f, TypographyPreset as g, TastyPluginFactory as h, getGlobalCounterStyle as i, hasGlobalRecipes as l, TastyPlugin as m, configure as n, getGlobalKeyframes as o, resetConfig as p, getConfig as r, getGlobalRecipes as s, TastyConfig as t, hasStylesGenerated as u, generateTypographyTokens as v, SheetManager as x, ColorSpace as y };
884
- //# sourceMappingURL=config-vuCRkBWX.d.ts.map
927
+ export { SheetManager as S, TypographyPreset as _, getGlobalFontFace as a, ColorSpace as b, getNamePrefix as c, hasStylesGenerated as d, isConfigLocked as f, TastyPluginFactory as g, TastyPlugin as h, getGlobalCounterStyle as i, hasGlobalKeyframes as l, resetConfig as m, configure as n, getGlobalKeyframes as o, isTestEnvironment as p, getConfig as r, getGlobalRecipes as s, TastyConfig as t, hasGlobalRecipes as u, TypographyTokenValue as v, StyleInjector as x, generateTypographyTokens as y };
928
+ //# sourceMappingURL=config-CzzTHmtS.d.ts.map
@@ -1374,6 +1374,93 @@ function isDevEnv() {
1374
1374
  return nodeEnv !== "test" && nodeEnv !== "production";
1375
1375
  }
1376
1376
  //#endregion
1377
+ //#region src/utils/name-prefix.ts
1378
+ /**
1379
+ * Name prefix utilities for generated identifiers.
1380
+ *
1381
+ * Tasty generates three kinds of identifiers from content hashes:
1382
+ * - class names (used in DOM `class` attribute)
1383
+ * - keyframe names (used in CSS `animation`)
1384
+ * - counter-style names (used in CSS `list-style-type`)
1385
+ *
1386
+ * All three derive from a single configurable prefix so that an app
1387
+ * can namespace every identifier under one string. Discriminator letters
1388
+ * (`k`, `c`) keep the three kinds visually distinct in devtools — they
1389
+ * are not required for correctness (CSS keeps these in separate
1390
+ * namespaces), only for readability.
1391
+ *
1392
+ * The runtime / SSR / RSC paths must agree on the prefix; otherwise the
1393
+ * client-side hash for a given style will not match the server-rendered
1394
+ * class and hydration breaks. The zero-runtime build path uses a
1395
+ * different default (`'ts'`) so its classes can't collide with runtime
1396
+ * (`'t'`) classes when both are loaded on the same page.
1397
+ */
1398
+ /** Default prefix used by the runtime / SSR / RSC paths. */
1399
+ const DEFAULT_NAME_PREFIX = "t";
1400
+ /** Default prefix used by the zero-runtime (`tastyStatic`) build path. */
1401
+ const DEFAULT_ZERO_NAME_PREFIX = "ts";
1402
+ /**
1403
+ * Allowed shape: starts with a letter or underscore, then letters/
1404
+ * digits/underscore/hyphen. Length capped at 32 to keep generated
1405
+ * names sane. Matches the CSS identifier rules for the common case
1406
+ * while keeping the surface conservative.
1407
+ */
1408
+ const NAME_PREFIX_PATTERN = /^[a-zA-Z_][a-zA-Z0-9_-]{0,31}$/;
1409
+ /**
1410
+ * Validate a `namePrefix` value.
1411
+ * Throws a TypeError with a descriptive message on invalid input so
1412
+ * misconfiguration fails loudly at `configure()` time rather than
1413
+ * surfacing later as broken hydration.
1414
+ */
1415
+ function validateNamePrefix(prefix) {
1416
+ if (typeof prefix !== "string") throw new TypeError(`[Tasty] namePrefix must be a string, got ${typeof prefix}.`);
1417
+ if (!NAME_PREFIX_PATTERN.test(prefix)) throw new TypeError(`[Tasty] namePrefix "${prefix}" is invalid. It must start with a letter (a-z, A-Z) or "_", contain only letters, digits, "_" or "-", and be 1-32 characters long. Examples: "t", "ts", "myapp-", "_foo".`);
1418
+ }
1419
+ /**
1420
+ * Build a class name: `${prefix}${hash}`.
1421
+ * The hash is appended verbatim — supply a separator inside the prefix
1422
+ * itself if you want one (e.g. `'myapp-'`).
1423
+ */
1424
+ function makeClassName(prefix, hash) {
1425
+ return `${prefix}${hash}`;
1426
+ }
1427
+ /**
1428
+ * Build a keyframe name: `${prefix}k${suffix}`.
1429
+ * The `k` discriminator keeps keyframe names visually distinct from
1430
+ * class names sharing the same prefix. `suffix` is typically a content
1431
+ * hash but may be a counter for ad-hoc allocation.
1432
+ */
1433
+ function makeKeyframeName(prefix, suffix) {
1434
+ return `${prefix}k${suffix}`;
1435
+ }
1436
+ /**
1437
+ * Build a counter-style name: `${prefix}c${suffix}`.
1438
+ * The `c` discriminator keeps counter-style names visually distinct
1439
+ * from class names sharing the same prefix.
1440
+ */
1441
+ function makeCounterStyleName(prefix, suffix) {
1442
+ return `${prefix}c${suffix}`;
1443
+ }
1444
+ /** Escape a string for safe inclusion in a regex literal. */
1445
+ function escapeRegex(str) {
1446
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1447
+ }
1448
+ /**
1449
+ * Regex matching any tasty class for the given prefix.
1450
+ * Used by the runtime GC's DOM scan and class-allocation bookkeeping.
1451
+ */
1452
+ function tastyClassRegex(prefix) {
1453
+ return new RegExp(`^${escapeRegex(prefix)}[a-z0-9]+$`);
1454
+ }
1455
+ /**
1456
+ * Global regex extracting tasty class names from RSC-inlined CSS.
1457
+ * Looks for the doubled-specificity pattern `.cls.cls` that
1458
+ * `formatRules()` always emits, which makes extraction reliable.
1459
+ */
1460
+ function rscClassRegexGlobal(prefix) {
1461
+ return new RegExp(`\\.(${escapeRegex(prefix)}[a-z0-9]+)\\.\\1`, "g");
1462
+ }
1463
+ //#endregion
1377
1464
  //#region src/parser/types.ts
1378
1465
  let Bucket = /* @__PURE__ */ function(Bucket) {
1379
1466
  Bucket[Bucket["Color"] = 0] = "Color";
@@ -4801,18 +4888,10 @@ function formatCounterStyleRule(name, descriptors) {
4801
4888
  //#endregion
4802
4889
  //#region src/injector/injector.ts
4803
4890
  /**
4804
- * Generate a deterministic class name from a cache key using content hash.
4805
- * The same cache key always produces the same class name across environments.
4806
- */
4807
- function generateClassName(cacheKey) {
4808
- return `t${hashString(cacheKey)}`;
4809
- }
4810
- const RSC_CLASS_RE = /\.(t[a-z0-9]+)\.\1/g;
4811
- /**
4812
4891
  * Extract class names from `<style data-tasty-rsc>` tags.
4813
4892
  * The doubled-specificity pattern `.tXXX.tXXX` makes extraction reliable.
4814
4893
  */
4815
- function extractRSCClassNames() {
4894
+ function extractRSCClassNames(rscClassRegex) {
4816
4895
  if (typeof document === "undefined") return [];
4817
4896
  const styles = document.querySelectorAll("style[data-tasty-rsc]");
4818
4897
  if (styles.length === 0) return [];
@@ -4821,8 +4900,8 @@ function extractRSCClassNames() {
4821
4900
  const text = style.textContent;
4822
4901
  if (!text) continue;
4823
4902
  let match;
4824
- RSC_CLASS_RE.lastIndex = 0;
4825
- while ((match = RSC_CLASS_RE.exec(text)) !== null) classSet.add(match[1]);
4903
+ rscClassRegex.lastIndex = 0;
4904
+ while ((match = rscClassRegex.exec(text)) !== null) classSet.add(match[1]);
4826
4905
  }
4827
4906
  return Array.from(classSet);
4828
4907
  }
@@ -4836,7 +4915,7 @@ function extractRSCClassNames() {
4836
4915
  * Called inside `inject()` / `allocateClassName()` to pick up
4837
4916
  * class names rendered on the server (including during SPA navigation).
4838
4917
  */
4839
- function syncServerClasses(registry) {
4918
+ function syncServerClasses(registry, rscClassRegex) {
4840
4919
  if (typeof window === "undefined") return;
4841
4920
  const classes = window.__TASTY__;
4842
4921
  if (classes && classes.length > registry.serverClassSyncIndex) {
@@ -4845,7 +4924,7 @@ function syncServerClasses(registry) {
4845
4924
  }
4846
4925
  if (!registry.rscStylesScanned) {
4847
4926
  registry.rscStylesScanned = true;
4848
- for (const cls of extractRSCClassNames()) registerHydratedClass(registry, cls);
4927
+ for (const cls of extractRSCClassNames(rscClassRegex)) registerHydratedClass(registry, cls);
4849
4928
  }
4850
4929
  }
4851
4930
  function registerHydratedClass(registry, className) {
@@ -4857,25 +4936,40 @@ function registerHydratedClass(registry, className) {
4857
4936
  });
4858
4937
  registry.refCounts.set(className, 0);
4859
4938
  }
4860
- var StyleInjector = class StyleInjector {
4939
+ var StyleInjector = class {
4861
4940
  sheetManager;
4862
4941
  config;
4863
4942
  globalRuleCounter = 0;
4864
4943
  pendingGCHandle = null;
4944
+ namePrefix;
4945
+ classRegex;
4946
+ rscClassRegex;
4865
4947
  /** @internal — exposed for debug utilities only */
4866
4948
  get _sheetManager() {
4867
4949
  return this.sheetManager;
4868
4950
  }
4869
4951
  constructor(config = {}) {
4952
+ if (config.namePrefix !== void 0) validateNamePrefix(config.namePrefix);
4870
4953
  this.config = config;
4871
4954
  this.sheetManager = new SheetManager(config);
4955
+ this.namePrefix = config.namePrefix ?? "t";
4956
+ this.classRegex = tastyClassRegex(this.namePrefix);
4957
+ this.rscClassRegex = rscClassRegexGlobal(this.namePrefix);
4958
+ }
4959
+ /**
4960
+ * Generate a deterministic class name from a cache key using content hash.
4961
+ * The same cache key always produces the same class name across environments
4962
+ * with the same `namePrefix`.
4963
+ */
4964
+ generateClassName(cacheKey) {
4965
+ return makeClassName(this.namePrefix, hashString(cacheKey));
4872
4966
  }
4873
4967
  /**
4874
4968
  * Check if `className` was hydrated from server-rendered styles and,
4875
4969
  * if so, wire the cacheKey mapping. Returns true on hit.
4876
4970
  */
4877
4971
  tryHydratedHit(registry, cacheKey, className) {
4878
- syncServerClasses(registry);
4972
+ syncServerClasses(registry, this.rscClassRegex);
4879
4973
  const rule = registry.rules.get(className);
4880
4974
  if (rule && rule.ruleIndex === -2 && rule.sheetIndex === -2) {
4881
4975
  registry.cacheKeyToClassName.set(cacheKey, className);
@@ -4894,7 +4988,7 @@ var StyleInjector = class StyleInjector {
4894
4988
  className: registry.cacheKeyToClassName.get(cacheKey),
4895
4989
  isNewAllocation: false
4896
4990
  };
4897
- const className = generateClassName(cacheKey);
4991
+ const className = this.generateClassName(cacheKey);
4898
4992
  if (this.tryHydratedHit(registry, cacheKey, className)) return {
4899
4993
  className,
4900
4994
  isNewAllocation: false
@@ -4946,7 +5040,7 @@ var StyleInjector = class StyleInjector {
4946
5040
  };
4947
5041
  }
4948
5042
  } else if (cacheKey) {
4949
- className = generateClassName(cacheKey);
5043
+ className = this.generateClassName(cacheKey);
4950
5044
  if (this.tryHydratedHit(registry, cacheKey, className)) {
4951
5045
  registry.refCounts.set(className, (registry.refCounts.get(className) || 0) + 1);
4952
5046
  if (registry.metrics) registry.metrics.hits++;
@@ -4955,7 +5049,10 @@ var StyleInjector = class StyleInjector {
4955
5049
  dispose: () => this.dispose(className, registry)
4956
5050
  };
4957
5051
  }
4958
- } else className = `t${hashString(rules.map((r) => `${r.selector}\0${r.declarations}`).join("\n"))}`;
5052
+ } else {
5053
+ const parts = rules.map((r) => `${r.selector}\0${r.declarations}`);
5054
+ className = makeClassName(this.namePrefix, hashString(parts.join("\n")));
5055
+ }
4959
5056
  const rulesToInsert = rules.map((rule) => {
4960
5057
  let newSelector = rule.selector;
4961
5058
  if (rule.needsClassName) {
@@ -5173,8 +5270,23 @@ var StyleInjector = class StyleInjector {
5173
5270
  }
5174
5271
  const cssName = effectiveResult.cssName;
5175
5272
  const definition = effectiveResult.definition;
5176
- const normalizedDef = normalizePropertyDefinition(definition);
5177
- if (registry.injectedProperties.get(cssName) !== void 0) return;
5273
+ this.insertPropertyRule(registry, root, cssName, definition, name);
5274
+ if (effectiveResult.isColor) {
5275
+ const companionCssName = `${cssName}-${getColorSpaceSuffix()}`;
5276
+ const companionDefinition = {
5277
+ syntax: getComponentPropertySyntax(),
5278
+ inherits: definition.inherits,
5279
+ initialValue: colorInitialValueToComponents(definition.initialValue)
5280
+ };
5281
+ this.insertPropertyRule(registry, root, companionCssName, companionDefinition, `${name}:components`);
5282
+ }
5283
+ }
5284
+ /**
5285
+ * Build and insert a single `@property` rule into the given registry.
5286
+ * No-op if the property was already injected.
5287
+ */
5288
+ insertPropertyRule(registry, root, cssName, definition, cacheKey) {
5289
+ if (registry.injectedProperties.has(cssName)) return;
5178
5290
  const parts = [];
5179
5291
  if (definition.syntax != null) {
5180
5292
  let syntax = String(definition.syntax).trim();
@@ -5194,8 +5306,8 @@ var StyleInjector = class StyleInjector {
5194
5306
  selector: `@property ${cssName}`,
5195
5307
  declarations
5196
5308
  };
5197
- if (!this.sheetManager.insertGlobalRule(registry, [rule], `property:${name}`, root)) return;
5198
- registry.injectedProperties.set(cssName, normalizedDef);
5309
+ if (!this.sheetManager.insertGlobalRule(registry, [rule], `property:${cacheKey}`, root)) return;
5310
+ registry.injectedProperties.set(cssName, normalizePropertyDefinition(definition));
5199
5311
  }
5200
5312
  /**
5201
5313
  * Check whether a given @property name was already injected by this injector.
@@ -5275,12 +5387,12 @@ var StyleInjector = class StyleInjector {
5275
5387
  let actualName;
5276
5388
  if (providedName) {
5277
5389
  const existingContentForName = registry.keyframesNameToContent.get(providedName);
5278
- if (existingContentForName && existingContentForName !== contentHash) actualName = `${providedName}-k${registry.keyframesCounter++}`;
5390
+ if (existingContentForName && existingContentForName !== contentHash) actualName = `${providedName}-${makeKeyframeName(this.namePrefix, String(registry.keyframesCounter++))}`;
5279
5391
  else {
5280
5392
  actualName = providedName;
5281
5393
  registry.keyframesNameToContent.set(providedName, contentHash);
5282
5394
  }
5283
- } else actualName = `k${registry.keyframesCounter++}`;
5395
+ } else actualName = makeKeyframeName(this.namePrefix, String(registry.keyframesCounter++));
5284
5396
  const result = this.sheetManager.insertKeyframes(registry, steps, actualName, root);
5285
5397
  if (!result) return {
5286
5398
  toString: () => "",
@@ -5329,7 +5441,6 @@ var StyleInjector = class StyleInjector {
5329
5441
  }
5330
5442
  }
5331
5443
  }
5332
- static TASTY_CLASS_RE = /^t[a-z0-9]+$/;
5333
5444
  /**
5334
5445
  * Record a render-time usage hit for one or more classNames.
5335
5446
  * Handles space-separated multi-chunk classNames.
@@ -5345,7 +5456,7 @@ var StyleInjector = class StyleInjector {
5345
5456
  const now = Date.now();
5346
5457
  const parts = className.indexOf(" ") === -1 ? [className] : className.split(" ");
5347
5458
  for (const cls of parts) {
5348
- if (!StyleInjector.TASTY_CLASS_RE.test(cls)) continue;
5459
+ if (!this.classRegex.test(cls)) continue;
5349
5460
  if (!registry.rules.has(cls)) continue;
5350
5461
  const entry = registry.usageMap.get(cls);
5351
5462
  if (entry) entry.lastTouchedAt = now;
@@ -5398,7 +5509,7 @@ var StyleInjector = class StyleInjector {
5398
5509
  if (registry.usageMap.size - activeCount <= capacity) return 0;
5399
5510
  }
5400
5511
  const liveClasses = /* @__PURE__ */ new Set();
5401
- for (const el of root.querySelectorAll("[class]")) for (const token of el.classList) if (StyleInjector.TASTY_CLASS_RE.test(token)) liveClasses.add(token);
5512
+ for (const el of root.querySelectorAll("[class]")) for (const token of el.classList) if (this.classRegex.test(token)) liveClasses.add(token);
5402
5513
  let swept = 0;
5403
5514
  if (force) for (const [className] of registry.usageMap) {
5404
5515
  if (liveClasses.has(className)) continue;
@@ -9796,7 +9907,8 @@ function createDefaultConfig(isTest) {
9796
9907
  return {
9797
9908
  maxRulesPerSheet: 8192,
9798
9909
  forceTextInjection: isTest ?? false,
9799
- devMode: isDevEnv()
9910
+ devMode: isDevEnv(),
9911
+ namePrefix: "t"
9800
9912
  };
9801
9913
  }
9802
9914
  /**
@@ -10038,6 +10150,7 @@ function configure(config = {}) {
10038
10150
  warnOnce("configure-after-styles", "[Tasty] Cannot call configure() after styles have been generated.\nConfiguration must be done before the first render. The configuration will be ignored.");
10039
10151
  return;
10040
10152
  }
10153
+ if (config.namePrefix !== void 0) validateNamePrefix(config.namePrefix);
10041
10154
  let mergedStates = {};
10042
10155
  let mergedUnits = {};
10043
10156
  let mergedFuncs = {};
@@ -10189,6 +10302,17 @@ function getConfig() {
10189
10302
  return currentConfig;
10190
10303
  }
10191
10304
  /**
10305
+ * Get the configured prefix used for every generated identifier
10306
+ * (class names, keyframe names, counter-style names).
10307
+ *
10308
+ * Falls back to the default prefix (`'t'`) when `configure()` has not
10309
+ * been called yet — this matches the auto-configuration behavior used
10310
+ * by the rest of the system.
10311
+ */
10312
+ function getNamePrefix() {
10313
+ return currentConfig?.namePrefix ?? "t";
10314
+ }
10315
+ /**
10192
10316
  * Get the global injector instance.
10193
10317
  * Auto-configures with defaults if not already configured.
10194
10318
  */
@@ -10222,6 +10346,6 @@ function resetConfig() {
10222
10346
  delete storage[GLOBAL_INJECTOR_KEY];
10223
10347
  }
10224
10348
  //#endregion
10225
- export { parseStyle as $, extractLocalCounterStyle as A, deprecationWarning as B, camelToKebab as C, Lru as Ct, getGlobalPredefinedStates as D, extractPredefinedStateRefs as E, formatFontFaceRule as F, DIRECTIONS as G, createStyle as H, hasLocalFontFace as I, getGlobalFuncs as J, customFunc as K, SheetManager as L, hasLocalCounterStyle as M, extractLocalFontFace as N, setGlobalPredefinedStates as O, fontFaceContentHash as P, parseColor as Q, STYLE_HANDLER_MAP as R, parseStateKey as S, strToRgb as St, extractLocalPredefinedStates as T, PropertyTypeResolver as U, warn as V, CUSTOM_UNITS as W, getGlobalPredefinedTokens as X, getGlobalParser as Y, normalizeColorTokenValue as Z, resetConfig as _, getComponentPropertySyntax as _t, getGlobalCounterStyle as a, StyleParser as at, isSelector as b, hexToRgb as bt, getGlobalKeyframes as c, hashString as ct, hasGlobalKeyframes as d, hasLocalProperties as dt, resetGlobalPredefinedTokens as et, hasGlobalRecipes as f, parsePropertyToken as ft, markStylesGenerated as g, getColorSpaceSuffix as gt, isTestEnvironment as h, getColorSpaceFunc as ht, getGlobalConfigTokens as i, okhslPlugin as it, formatCounterStyleRule as j, StyleInjector as k, getGlobalRecipes as l, extractLocalProperties as lt, isConfigLocked as m, getColorSpaceComponents as mt, getConfig as n, stringifyStyles as nt, getGlobalFontFace as o, Bucket as ot, hasStylesGenerated as p, colorInitialValueToComponents as pt, filterMods as q, getEffectiveProperties as r, okhslFunc as rt, getGlobalInjector as s, isDevEnv as st, configure as t, setGlobalPredefinedTokens as tt, getGlobalStyles as u, getEffectiveDefinition as ut, generateTypographyTokens as v, getNamedColorHex as vt, createStateParserContext as w, renderStyles as x, hslToRgbValues as xt, hasPipelineCacheEntry as y, getRgbValuesFromRgbaString as yt, styleHandlers as z };
10349
+ export { parseColor as $, StyleInjector as A, strToRgb as At, styleHandlers as B, parseStateKey as C, getColorSpaceFunc as Ct, extractPredefinedStateRefs as D, getRgbValuesFromRgbaString as Dt, extractLocalPredefinedStates as E, getNamedColorHex as Et, fontFaceContentHash as F, CUSTOM_UNITS as G, warn as H, formatFontFaceRule as I, filterMods as J, DIRECTIONS as K, hasLocalFontFace as L, formatCounterStyleRule as M, hasLocalCounterStyle as N, getGlobalPredefinedStates as O, hexToRgb as Ot, extractLocalFontFace as P, normalizeColorTokenValue as Q, SheetManager as R, renderStyles as S, getColorSpaceComponents as St, createStateParserContext as T, getComponentPropertySyntax as Tt, createStyle as U, deprecationWarning as V, PropertyTypeResolver as W, getGlobalParser as X, getGlobalFuncs as Y, getGlobalPredefinedTokens as Z, markStylesGenerated as _, extractLocalProperties as _t, getGlobalCounterStyle as a, okhslPlugin as at, hasPipelineCacheEntry as b, parsePropertyToken as bt, getGlobalKeyframes as c, DEFAULT_NAME_PREFIX as ct, getNamePrefix as d, makeCounterStyleName as dt, parseStyle as et, hasGlobalKeyframes as f, makeKeyframeName as ft, isTestEnvironment as g, hashString as gt, isConfigLocked as h, isDevEnv as ht, getGlobalConfigTokens as i, okhslFunc as it, extractLocalCounterStyle as j, Lru as jt, setGlobalPredefinedStates as k, hslToRgbValues as kt, getGlobalRecipes as l, DEFAULT_ZERO_NAME_PREFIX as lt, hasStylesGenerated as m, validateNamePrefix as mt, getConfig as n, setGlobalPredefinedTokens as nt, getGlobalFontFace as o, StyleParser as ot, hasGlobalRecipes as p, tastyClassRegex as pt, customFunc as q, getEffectiveProperties as r, stringifyStyles as rt, getGlobalInjector as s, Bucket as st, configure as t, resetGlobalPredefinedTokens as tt, getGlobalStyles as u, makeClassName as ut, resetConfig as v, getEffectiveDefinition as vt, camelToKebab as w, getColorSpaceSuffix as wt, isSelector as x, colorInitialValueToComponents as xt, generateTypographyTokens as y, hasLocalProperties as yt, STYLE_HANDLER_MAP as z };
10226
10350
 
10227
- //# sourceMappingURL=config-raGoEeGs.js.map
10351
+ //# sourceMappingURL=config-JokB1Lc8.js.map