@tenphi/tasty 2.11.0 → 2.11.2
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.
- package/README.md +1 -0
- package/dist/{collector-CW4jZxLo.js → collector-D0cgyN6N.js} +13 -7
- package/dist/collector-D0cgyN6N.js.map +1 -0
- package/dist/{collector-DYA5AOwr.d.ts → collector-yqgjGje7.d.ts} +10 -4
- package/dist/{config-BtK9fUaz.d.ts → config-V0XC9iz_.d.ts} +15 -2
- package/dist/{config-DxBPtu-V.js → config-_cYm9LPl.js} +89 -36
- package/dist/config-_cYm9LPl.js.map +1 -0
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +5 -5
- package/dist/{core-BakA5V89.js → core-DdjoZG0r.js} +26 -12
- package/dist/core-DdjoZG0r.js.map +1 -0
- package/dist/{css-writer-w6bzEFb-.js → css-writer-DTUwLjgD.js} +3 -3
- package/dist/{css-writer-w6bzEFb-.js.map → css-writer-DTUwLjgD.js.map} +1 -1
- package/dist/{format-rules-BAJyIyAZ.js → format-rules-Bu_qoamZ.js} +2 -2
- package/dist/{format-rules-BAJyIyAZ.js.map → format-rules-Bu_qoamZ.js.map} +1 -1
- package/dist/{hydrate-B2BwrnYb.js → hydrate-CKk-rgmY.js} +2 -2
- package/dist/{hydrate-B2BwrnYb.js.map → hydrate-CKk-rgmY.js.map} +1 -1
- package/dist/{index-BYtnj_gA.d.ts → index-BjnGYI5D.d.ts} +15 -7
- package/dist/{index-B9ih23uv.d.ts → index-tRick_JW.d.ts} +12 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +122 -51
- package/dist/index.js.map +1 -1
- package/dist/{keyframes-oSX5T5lm.js → keyframes-5LJYS8_P.js} +2 -2
- package/dist/{keyframes-oSX5T5lm.js.map → keyframes-5LJYS8_P.js.map} +1 -1
- package/dist/{merge-styles-RmK1DOSt.js → merge-styles-Blrs8kLM.js} +2 -2
- package/dist/{merge-styles-RmK1DOSt.js.map → merge-styles-Blrs8kLM.js.map} +1 -1
- package/dist/{merge-styles-BZV-XAwX.d.ts → merge-styles-DDss7wRH.d.ts} +2 -2
- package/dist/{resolve-recipes-CxyDLx9x.js → resolve-recipes-DR5cSG3X.js} +3 -3
- package/dist/{resolve-recipes-CxyDLx9x.js.map → resolve-recipes-DR5cSG3X.js.map} +1 -1
- package/dist/ssr/astro-client.js +1 -1
- package/dist/ssr/astro.js +3 -3
- package/dist/ssr/index.d.ts +1 -1
- package/dist/ssr/index.js +3 -3
- package/dist/ssr/next.d.ts +1 -1
- package/dist/ssr/next.js +4 -4
- package/dist/static/index.d.ts +2 -2
- package/dist/static/index.js +4 -4
- package/dist/static/index.js.map +1 -1
- package/dist/zero/babel.d.ts +1 -1
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.d.ts +1 -1
- package/dist/zero/index.js +1 -1
- package/docs/README.md +1 -0
- package/docs/ai-agents.md +206 -0
- package/docs/injector.md +15 -0
- package/docs/react-api.md +21 -2
- package/package.json +5 -4
- package/dist/collector-CW4jZxLo.js.map +0 -1
- package/dist/config-DxBPtu-V.js.map +0 -1
- package/dist/core-BakA5V89.js.map +0 -1
package/README.md
CHANGED
|
@@ -619,6 +619,7 @@ Start from the docs hub if you want the shortest path to the right guide for you
|
|
|
619
619
|
- **[React API](docs/react-api.md)** — React-specific API: `tasty()` factory, component props, variants, sub-elements, and style functions
|
|
620
620
|
- **[Configuration](docs/configuration.md)** — Global configuration: tokens, recipes, custom units, style handlers, and TypeScript extensions
|
|
621
621
|
- **[Style Properties](docs/styles.md)** — Complete reference for all enhanced style properties: syntax, values, modifiers, and recommendations
|
|
622
|
+
- **[Style Rules for AI Agents](docs/ai-agents.md)** — Condensed, rule-based brief for AI coding agents: correct value syntax, state maps, and property choices in one short page
|
|
622
623
|
|
|
623
624
|
### Rendering modes
|
|
624
625
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as fontFaceContentHash, I as formatFontFaceRule, M as formatCounterStyleRule, S as renderStyles, a as getGlobalCounterStyle, d as getNamePrefix, ft as makeClassName, gt as validateNamePrefix, i as getGlobalConfigTokens, mt as makeKeyframeName, o as getGlobalFontFace, pt as makeCounterStyleName, r as getEffectiveProperties, u as getGlobalStyles, vt as hashString } from "./config-
|
|
2
|
-
import { n as formatPropertyCSS, t as formatRules } from "./format-rules-
|
|
1
|
+
import { F as fontFaceContentHash, I as formatFontFaceRule, M as formatCounterStyleRule, S as renderStyles, a as getGlobalCounterStyle, d as getNamePrefix, ft as makeClassName, gt as validateNamePrefix, i as getGlobalConfigTokens, mt as makeKeyframeName, o as getGlobalFontFace, pt as makeCounterStyleName, r as getEffectiveProperties, u as getGlobalStyles, vt as hashString } from "./config-_cYm9LPl.js";
|
|
2
|
+
import { n as formatPropertyCSS, t as formatRules } from "./format-rules-Bu_qoamZ.js";
|
|
3
3
|
import { t as formatGlobalRules } from "./format-global-rules-DklyaXv-.js";
|
|
4
4
|
//#region src/ssr/collector.ts
|
|
5
5
|
/**
|
|
@@ -161,15 +161,21 @@ var ServerStyleCollector = class {
|
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Record global styles (from useGlobalStyles). Deduplicated by key.
|
|
164
|
+
*
|
|
165
|
+
* Pass `replace` for slot-keyed entries (an explicit `id`), where the last
|
|
166
|
+
* write must win to match the client's update-tracking behavior.
|
|
164
167
|
*/
|
|
165
|
-
collectGlobalStyles(key, css) {
|
|
166
|
-
if (!this.globalStyles.has(key)) this.globalStyles.set(key, css);
|
|
168
|
+
collectGlobalStyles(key, css, replace) {
|
|
169
|
+
if (replace || !this.globalStyles.has(key)) this.globalStyles.set(key, css);
|
|
167
170
|
}
|
|
168
171
|
/**
|
|
169
172
|
* Record raw CSS text (from useRawCSS). Deduplicated by key.
|
|
173
|
+
*
|
|
174
|
+
* Pass `replace` for slot-keyed entries (an explicit `id`), where the last
|
|
175
|
+
* write must win to match the client's update-tracking behavior.
|
|
170
176
|
*/
|
|
171
|
-
collectRawCSS(key, css) {
|
|
172
|
-
if (!this.rawCSS.has(key)) this.rawCSS.set(key, css);
|
|
177
|
+
collectRawCSS(key, css, replace) {
|
|
178
|
+
if (replace || !this.rawCSS.has(key)) this.rawCSS.set(key, css);
|
|
173
179
|
}
|
|
174
180
|
/**
|
|
175
181
|
* Extract all CSS collected so far as a single string.
|
|
@@ -240,4 +246,4 @@ var ServerStyleCollector = class {
|
|
|
240
246
|
//#endregion
|
|
241
247
|
export { ServerStyleCollector as t };
|
|
242
248
|
|
|
243
|
-
//# sourceMappingURL=collector-
|
|
249
|
+
//# sourceMappingURL=collector-D0cgyN6N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector-D0cgyN6N.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 * Pass `replace` for slot-keyed entries (an explicit `id`), where the last\n * write must win to match the client's update-tracking behavior.\n */\n collectGlobalStyles(key: string, css: string, replace?: boolean): void {\n if (replace || !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 * Pass `replace` for slot-keyed entries (an explicit `id`), where the last\n * write must win to match the client's update-tracking behavior.\n */\n collectRawCSS(key: string, css: string, replace?: boolean): void {\n if (replace || !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,IAAoB;CACzC,sCAA8B,IAAI,IAAoB;CACtD,8BAAsB,IAAI,IAAY;CACtC,gCAAwB,IAAI,IAAoB;CAChD,sCAA8B,IAAI,IAAY;CAC9C,gCAAwB,IAAI,IAAoB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AAkB,CAAC;EACzB,KAAK,MAAM,aAAa,KAAK,oBAAoB,OAAO,GACtD,IAAI,CAAC,KAAK,kBAAkB,IAAI,SAAS,GAAG;GAC1C,KAAK,kBAAkB,IAAI,SAAS;GACpC,MAAM,KAAK,SAAS;EACtB;EAEF,OAAO;CACT;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as StyleResult } from "./index-
|
|
1
|
+
import { n as StyleResult } from "./index-tRick_JW.js";
|
|
2
2
|
|
|
3
3
|
//#region src/ssr/collector.d.ts
|
|
4
4
|
declare class ServerStyleCollector {
|
|
@@ -79,12 +79,18 @@ declare class ServerStyleCollector {
|
|
|
79
79
|
allocateCounterStyleName(providedName?: string): string;
|
|
80
80
|
/**
|
|
81
81
|
* Record global styles (from useGlobalStyles). Deduplicated by key.
|
|
82
|
+
*
|
|
83
|
+
* Pass `replace` for slot-keyed entries (an explicit `id`), where the last
|
|
84
|
+
* write must win to match the client's update-tracking behavior.
|
|
82
85
|
*/
|
|
83
|
-
collectGlobalStyles(key: string, css: string): void;
|
|
86
|
+
collectGlobalStyles(key: string, css: string, replace?: boolean): void;
|
|
84
87
|
/**
|
|
85
88
|
* Record raw CSS text (from useRawCSS). Deduplicated by key.
|
|
89
|
+
*
|
|
90
|
+
* Pass `replace` for slot-keyed entries (an explicit `id`), where the last
|
|
91
|
+
* write must win to match the client's update-tracking behavior.
|
|
86
92
|
*/
|
|
87
|
-
collectRawCSS(key: string, css: string): void;
|
|
93
|
+
collectRawCSS(key: string, css: string, replace?: boolean): void;
|
|
88
94
|
/**
|
|
89
95
|
* Extract all CSS collected so far as a single string.
|
|
90
96
|
* Includes @property and @keyframes rules.
|
|
@@ -105,4 +111,4 @@ declare class ServerStyleCollector {
|
|
|
105
111
|
}
|
|
106
112
|
//#endregion
|
|
107
113
|
export { ServerStyleCollector as t };
|
|
108
|
-
//# sourceMappingURL=collector-
|
|
114
|
+
//# sourceMappingURL=collector-yqgjGje7.d.ts.map
|
|
@@ -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-
|
|
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-tRick_JW.js";
|
|
2
2
|
|
|
3
3
|
//#region src/injector/sheet-manager.d.ts
|
|
4
4
|
declare class SheetManager {
|
|
@@ -20,6 +20,19 @@ declare class SheetManager {
|
|
|
20
20
|
* abstracting away adopted vs style-element modes.
|
|
21
21
|
*/
|
|
22
22
|
getCSSSheet(sheetInfo: SheetInfo): CSSStyleSheet | null;
|
|
23
|
+
/**
|
|
24
|
+
* Record an inserted rule text at its rule index (text mode only).
|
|
25
|
+
*
|
|
26
|
+
* `textRules` mirrors the sheet's rule order. `textContent` cannot be edited
|
|
27
|
+
* rule-by-rule the way CSSOM can, so keeping the texts is what makes
|
|
28
|
+
* deletion possible at all in this mode.
|
|
29
|
+
*/
|
|
30
|
+
private trackTextRule;
|
|
31
|
+
/**
|
|
32
|
+
* Remove rule indices from a text-mode sheet and rewrite the element's text.
|
|
33
|
+
* Returns the indices that were actually removed.
|
|
34
|
+
*/
|
|
35
|
+
private deleteTextRules;
|
|
23
36
|
/**
|
|
24
37
|
* Determine the injection mode for a root.
|
|
25
38
|
* ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
|
|
@@ -942,4 +955,4 @@ declare function getNamePrefix(): string;
|
|
|
942
955
|
declare function resetConfig(): void;
|
|
943
956
|
//#endregion
|
|
944
957
|
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 };
|
|
945
|
-
//# sourceMappingURL=config-
|
|
958
|
+
//# sourceMappingURL=config-V0XC9iz_.d.ts.map
|
|
@@ -1725,7 +1725,7 @@ function classify(raw, opts, recurse) {
|
|
|
1725
1725
|
else if (ch === ")") depth = Math.max(0, depth - 1);
|
|
1726
1726
|
}
|
|
1727
1727
|
if (depth !== 0) {
|
|
1728
|
-
console.warn("
|
|
1728
|
+
console.warn("[Tasty] skipped invalid function token with unmatched parentheses:", token);
|
|
1729
1729
|
return {
|
|
1730
1730
|
bucket: 2,
|
|
1731
1731
|
processed: ""
|
|
@@ -2409,7 +2409,7 @@ function setGlobalPredefinedTokens(tokens) {
|
|
|
2409
2409
|
const lowerKey = key.toLowerCase();
|
|
2410
2410
|
const lowerValue = value.toLowerCase();
|
|
2411
2411
|
if (lowerKey.startsWith("#") && lowerValue === "#current") {
|
|
2412
|
-
console.warn(`Tasty
|
|
2412
|
+
console.warn(`[Tasty] Using #current to define color token "${key}" is not supported. The #current token represents currentcolor which cannot be used as a base for other tokens.`);
|
|
2413
2413
|
continue;
|
|
2414
2414
|
}
|
|
2415
2415
|
normalizedTokens[lowerKey] = value;
|
|
@@ -2464,9 +2464,9 @@ function parseColor(val, ignoreError = false) {
|
|
|
2464
2464
|
const extractedColor = parseStyle(val).groups.find((g) => g.colors.length)?.colors[0];
|
|
2465
2465
|
if (!extractedColor) {
|
|
2466
2466
|
if (!ignoreError && colorWarningCount < MAX_COLOR_WARNINGS) {
|
|
2467
|
-
console.warn("Tasty
|
|
2467
|
+
console.warn("[Tasty] unable to parse color:", val);
|
|
2468
2468
|
colorWarningCount++;
|
|
2469
|
-
if (colorWarningCount === MAX_COLOR_WARNINGS) console.warn("Tasty
|
|
2469
|
+
if (colorWarningCount === MAX_COLOR_WARNINGS) console.warn("[Tasty] color parsing warnings will be suppressed from now on");
|
|
2470
2470
|
}
|
|
2471
2471
|
return {};
|
|
2472
2472
|
}
|
|
@@ -3782,13 +3782,13 @@ scrollMarginStyle.__lookupStyles = [
|
|
|
3782
3782
|
];
|
|
3783
3783
|
//#endregion
|
|
3784
3784
|
//#region src/utils/warnings.ts
|
|
3785
|
-
const PREFIX = "Tasty";
|
|
3785
|
+
const PREFIX = "[Tasty]";
|
|
3786
3786
|
function warn(...args) {
|
|
3787
|
-
console.warn(
|
|
3787
|
+
console.warn(PREFIX, ...args);
|
|
3788
3788
|
}
|
|
3789
3789
|
function deprecationWarning(condition, { property, name, betterAlternative, reason }) {
|
|
3790
3790
|
if (condition) return;
|
|
3791
|
-
console.group(`⚠️ ${PREFIX}
|
|
3791
|
+
console.group(`⚠️ ${PREFIX} Deprecation in ${name}`);
|
|
3792
3792
|
warn(`"${property}" is deprecated, consider better alternative: ${typeof betterAlternative === "function" ? betterAlternative() : betterAlternative}`);
|
|
3793
3793
|
if (reason) warn(`Reason: ${typeof reason === "function" ? reason() : reason}`);
|
|
3794
3794
|
console.groupEnd();
|
|
@@ -3821,7 +3821,7 @@ function scrollbarStyle({ scrollbar, overflow }) {
|
|
|
3821
3821
|
...values,
|
|
3822
3822
|
...colors
|
|
3823
3823
|
];
|
|
3824
|
-
if (ignored.length) warn(`scrollbar="none" hides the scrollbar; other tokens are ignored: ${ignored.join(", ")}`);
|
|
3824
|
+
if (ignored.length && true) warn(`scrollbar="none" hides the scrollbar; other tokens are ignored: ${ignored.join(", ")}`);
|
|
3825
3825
|
style["scrollbar-width"] = "none";
|
|
3826
3826
|
return style;
|
|
3827
3827
|
}
|
|
@@ -4060,7 +4060,7 @@ function defineCustomStyle(names, handler) {
|
|
|
4060
4060
|
names = handlerWithLookup.__lookupStyles;
|
|
4061
4061
|
} else if (handler) handlerWithLookup = Object.assign(handler, { __lookupStyles: names });
|
|
4062
4062
|
else {
|
|
4063
|
-
console.warn("Tasty
|
|
4063
|
+
console.warn("[Tasty] incorrect custom style definition:", names);
|
|
4064
4064
|
return;
|
|
4065
4065
|
}
|
|
4066
4066
|
if (Array.isArray(names)) names.forEach((name) => {
|
|
@@ -4275,6 +4275,31 @@ var SheetManager = class {
|
|
|
4275
4275
|
return sheetInfo.sheet?.sheet ?? null;
|
|
4276
4276
|
}
|
|
4277
4277
|
/**
|
|
4278
|
+
* Record an inserted rule text at its rule index (text mode only).
|
|
4279
|
+
*
|
|
4280
|
+
* `textRules` mirrors the sheet's rule order. `textContent` cannot be edited
|
|
4281
|
+
* rule-by-rule the way CSSOM can, so keeping the texts is what makes
|
|
4282
|
+
* deletion possible at all in this mode.
|
|
4283
|
+
*/
|
|
4284
|
+
trackTextRule(sheet, ruleIndex, ruleText) {
|
|
4285
|
+
if (!sheet.textMode) return;
|
|
4286
|
+
const rules = sheet.textRules ??= [];
|
|
4287
|
+
while (rules.length < ruleIndex) rules.push("");
|
|
4288
|
+
rules[ruleIndex] = ruleText;
|
|
4289
|
+
}
|
|
4290
|
+
/**
|
|
4291
|
+
* Remove rule indices from a text-mode sheet and rewrite the element's text.
|
|
4292
|
+
* Returns the indices that were actually removed.
|
|
4293
|
+
*/
|
|
4294
|
+
deleteTextRules(sheet, indices) {
|
|
4295
|
+
const rules = sheet.textRules;
|
|
4296
|
+
if (!rules) return [];
|
|
4297
|
+
const removed = [...new Set(indices)].filter((idx) => idx >= 0 && idx < rules.length).sort((a, b) => b - a);
|
|
4298
|
+
for (const idx of removed) rules.splice(idx, 1);
|
|
4299
|
+
if (removed.length > 0 && sheet.sheet) sheet.sheet.textContent = rules.length ? "\n" + rules.join("\n") : "";
|
|
4300
|
+
return removed;
|
|
4301
|
+
}
|
|
4302
|
+
/**
|
|
4278
4303
|
* Determine the injection mode for a root.
|
|
4279
4304
|
* ShadowRoot uses adopted stylesheets when supported; Document uses <style> elements.
|
|
4280
4305
|
*/
|
|
@@ -4356,10 +4381,14 @@ var SheetManager = class {
|
|
|
4356
4381
|
registry.sheets.push(sheetInfo);
|
|
4357
4382
|
return sheetInfo;
|
|
4358
4383
|
}
|
|
4384
|
+
const sheet = this.createStyleElement(root);
|
|
4385
|
+
const textMode = this.config.forceTextInjection === true || sheet.sheet == null;
|
|
4359
4386
|
const sheetInfo = {
|
|
4360
|
-
sheet
|
|
4387
|
+
sheet,
|
|
4361
4388
|
ruleCount: 0,
|
|
4362
|
-
holes: []
|
|
4389
|
+
holes: [],
|
|
4390
|
+
textMode,
|
|
4391
|
+
...textMode ? { textRules: [] } : {}
|
|
4363
4392
|
};
|
|
4364
4393
|
registry.sheets.push(sheetInfo);
|
|
4365
4394
|
return sheetInfo;
|
|
@@ -4374,7 +4403,7 @@ var SheetManager = class {
|
|
|
4374
4403
|
if ("head" in root && root.head) root.head.appendChild(style);
|
|
4375
4404
|
else if ("appendChild" in root) root.appendChild(style);
|
|
4376
4405
|
else document.head.appendChild(style);
|
|
4377
|
-
if (!style.isConnected && !this.config.forceTextInjection) console.error("SheetManager:
|
|
4406
|
+
if (!style.isConnected && !this.config.forceTextInjection) console.error("[Tasty] SheetManager: style element failed to connect to the DOM.", {
|
|
4378
4407
|
parentNode: style.parentNode?.nodeName,
|
|
4379
4408
|
isConnected: style.isConnected
|
|
4380
4409
|
});
|
|
@@ -4427,7 +4456,7 @@ var SheetManager = class {
|
|
|
4427
4456
|
if (rule.atRules && rule.atRules.length > 0) fullRule = rule.atRules.reduce((css, atRule) => `${atRule} { ${css} }`, baseRule);
|
|
4428
4457
|
const styleElement = targetSheet.sheet;
|
|
4429
4458
|
const styleSheet = this.getCSSSheet(targetSheet);
|
|
4430
|
-
if (
|
|
4459
|
+
if (!targetSheet.textMode && styleSheet) {
|
|
4431
4460
|
const maxIndex = styleSheet.cssRules.length;
|
|
4432
4461
|
const atomicRuleIndex = this.findAvailableRuleIndex(targetSheet);
|
|
4433
4462
|
const safeIndex = Math.min(Math.max(0, atomicRuleIndex), maxIndex);
|
|
@@ -4490,14 +4519,15 @@ var SheetManager = class {
|
|
|
4490
4519
|
currentRuleIndex = idx + 1;
|
|
4491
4520
|
anyInserted = true;
|
|
4492
4521
|
} catch (singleErr) {
|
|
4493
|
-
console.warn("[
|
|
4522
|
+
console.warn("[Tasty] Browser rejected CSS rule:", singleRule, singleErr);
|
|
4494
4523
|
}
|
|
4495
4524
|
}
|
|
4496
4525
|
if (!anyInserted) {}
|
|
4497
|
-
} else if (!(fullRule.startsWith("@property ") && !this.engineSupportsAtProperty(registry, styleSheet))) console.warn("[
|
|
4526
|
+
} else if (!(fullRule.startsWith("@property ") && !this.engineSupportsAtProperty(registry, styleSheet))) console.warn("[Tasty] Browser rejected CSS rule:", fullRule, e);
|
|
4498
4527
|
}
|
|
4499
4528
|
} else if (styleElement) {
|
|
4500
4529
|
const atomicRuleIndex = this.findAvailableRuleIndex(targetSheet);
|
|
4530
|
+
this.trackTextRule(targetSheet, atomicRuleIndex, fullRule);
|
|
4501
4531
|
styleElement.textContent = (styleElement.textContent || "") + "\n" + fullRule;
|
|
4502
4532
|
targetSheet.ruleCount++;
|
|
4503
4533
|
insertedIndices.push(atomicRuleIndex);
|
|
@@ -4505,7 +4535,7 @@ var SheetManager = class {
|
|
|
4505
4535
|
lastInsertedIndex = atomicRuleIndex;
|
|
4506
4536
|
currentRuleIndex = atomicRuleIndex + 1;
|
|
4507
4537
|
}
|
|
4508
|
-
if (styleElement && !styleElement.parentNode && !this.config.forceTextInjection) console.error("SheetManager:
|
|
4538
|
+
if (styleElement && !styleElement.parentNode && !this.config.forceTextInjection) console.error("[Tasty] SheetManager: style element is not attached to the DOM; rules will not apply.", {
|
|
4509
4539
|
className,
|
|
4510
4540
|
ruleIndex: currentRuleIndex
|
|
4511
4541
|
});
|
|
@@ -4526,7 +4556,7 @@ var SheetManager = class {
|
|
|
4526
4556
|
indices: insertedIndices
|
|
4527
4557
|
};
|
|
4528
4558
|
} catch (error) {
|
|
4529
|
-
console.warn("Failed to insert CSS rules:", error, {
|
|
4559
|
+
console.warn("[Tasty] Failed to insert CSS rules:", error, {
|
|
4530
4560
|
flattenedRules,
|
|
4531
4561
|
className
|
|
4532
4562
|
});
|
|
@@ -4596,7 +4626,21 @@ var SheetManager = class {
|
|
|
4596
4626
|
try {
|
|
4597
4627
|
const texts = this.config.devMode && Array.isArray(ruleInfo.cssText) ? ruleInfo.cssText.slice() : [];
|
|
4598
4628
|
const styleSheet = this.getCSSSheet(sheet);
|
|
4599
|
-
if (
|
|
4629
|
+
if (sheet.textMode) {
|
|
4630
|
+
let targetIndices;
|
|
4631
|
+
if (ruleInfo.indices && ruleInfo.indices.length > 0) targetIndices = ruleInfo.indices;
|
|
4632
|
+
else {
|
|
4633
|
+
const startIdx = Math.max(0, ruleInfo.ruleIndex);
|
|
4634
|
+
const endIdx = Math.min((sheet.textRules?.length ?? 0) - 1, Number.isFinite(ruleInfo.endRuleIndex) ? ruleInfo.endRuleIndex : startIdx);
|
|
4635
|
+
targetIndices = [];
|
|
4636
|
+
for (let idx = startIdx; idx <= endIdx; idx++) targetIndices.push(idx);
|
|
4637
|
+
}
|
|
4638
|
+
const deletedIndices = this.deleteTextRules(sheet, targetIndices);
|
|
4639
|
+
if (deletedIndices.length > 0) {
|
|
4640
|
+
sheet.ruleCount = Math.max(0, sheet.ruleCount - deletedIndices.length);
|
|
4641
|
+
this.adjustIndicesAfterDeletion(registry, ruleInfo.sheetIndex, Math.min(...deletedIndices), Math.max(...deletedIndices), deletedIndices.length, ruleInfo, deletedIndices);
|
|
4642
|
+
}
|
|
4643
|
+
} else if (styleSheet) {
|
|
4600
4644
|
const rules = styleSheet.cssRules;
|
|
4601
4645
|
if (ruleInfo.indices && ruleInfo.indices.length > 0) {
|
|
4602
4646
|
const sortedIndices = [...ruleInfo.indices].sort((a, b) => b - a);
|
|
@@ -4605,7 +4649,7 @@ var SheetManager = class {
|
|
|
4605
4649
|
styleSheet.deleteRule(idx);
|
|
4606
4650
|
deletedIndices.push(idx);
|
|
4607
4651
|
} catch (e) {
|
|
4608
|
-
console.warn(`Failed to delete rule at index ${idx}:`, e);
|
|
4652
|
+
console.warn(`[Tasty] Failed to delete rule at index ${idx}:`, e);
|
|
4609
4653
|
}
|
|
4610
4654
|
sheet.ruleCount = Math.max(0, sheet.ruleCount - deletedIndices.length);
|
|
4611
4655
|
if (deletedIndices.length > 0) this.adjustIndicesAfterDeletion(registry, ruleInfo.sheetIndex, Math.min(...deletedIndices), Math.max(...deletedIndices), deletedIndices.length, ruleInfo, deletedIndices);
|
|
@@ -4627,7 +4671,7 @@ var SheetManager = class {
|
|
|
4627
4671
|
for (const text of texts) registry.ruleTextSet.delete(text);
|
|
4628
4672
|
} catch {}
|
|
4629
4673
|
} catch (error) {
|
|
4630
|
-
console.warn("Failed to delete CSS rule:", error);
|
|
4674
|
+
console.warn("[Tasty] Failed to delete CSS rule:", error);
|
|
4631
4675
|
}
|
|
4632
4676
|
}
|
|
4633
4677
|
/**
|
|
@@ -4721,8 +4765,8 @@ var SheetManager = class {
|
|
|
4721
4765
|
const sheetInfo = registry.sheets[ruleInfo.sheetIndex];
|
|
4722
4766
|
if (!sheetInfo || !sheetInfo.sheet && !sheetInfo.constructableSheet) continue;
|
|
4723
4767
|
const styleSheet = this.getCSSSheet(sheetInfo);
|
|
4724
|
-
if (!styleSheet) continue;
|
|
4725
|
-
const maxRuleIndex = styleSheet
|
|
4768
|
+
if (!sheetInfo.textMode && !styleSheet) continue;
|
|
4769
|
+
const maxRuleIndex = (sheetInfo.textMode ? sheetInfo.textRules?.length ?? 0 : styleSheet?.cssRules.length ?? 0) - 1;
|
|
4726
4770
|
const startIdx = ruleInfo.ruleIndex;
|
|
4727
4771
|
const endIdx = ruleInfo.endRuleIndex ?? ruleInfo.ruleIndex;
|
|
4728
4772
|
if (startIdx < 0 || endIdx > maxRuleIndex || startIdx > endIdx) continue;
|
|
@@ -4770,7 +4814,7 @@ var SheetManager = class {
|
|
|
4770
4814
|
}
|
|
4771
4815
|
}
|
|
4772
4816
|
} catch (error) {
|
|
4773
|
-
console.warn("Failed to read CSS from sheet:", error);
|
|
4817
|
+
console.warn("[Tasty] Failed to read CSS from sheet:", error);
|
|
4774
4818
|
}
|
|
4775
4819
|
return cssChunks.join("\n");
|
|
4776
4820
|
}
|
|
@@ -4876,10 +4920,13 @@ var SheetManager = class {
|
|
|
4876
4920
|
const { css: cssSteps, declarations } = this.stepsToCSS(steps);
|
|
4877
4921
|
const fullRule = `@keyframes ${name} { ${cssSteps} }`;
|
|
4878
4922
|
const styleSheet = this.getCSSSheet(targetSheet);
|
|
4879
|
-
if (
|
|
4923
|
+
if (!targetSheet.textMode && styleSheet) {
|
|
4880
4924
|
const safeIndex = Math.min(Math.max(0, ruleIndex), styleSheet.cssRules.length);
|
|
4881
4925
|
styleSheet.insertRule(fullRule, safeIndex);
|
|
4882
|
-
} else if (targetSheet.sheet)
|
|
4926
|
+
} else if (targetSheet.sheet) {
|
|
4927
|
+
this.trackTextRule(targetSheet, ruleIndex, fullRule);
|
|
4928
|
+
targetSheet.sheet.textContent = (targetSheet.sheet.textContent || "") + "\n" + fullRule;
|
|
4929
|
+
}
|
|
4883
4930
|
targetSheet.ruleCount++;
|
|
4884
4931
|
return {
|
|
4885
4932
|
info: {
|
|
@@ -4891,7 +4938,7 @@ var SheetManager = class {
|
|
|
4891
4938
|
declarations
|
|
4892
4939
|
};
|
|
4893
4940
|
} catch (error) {
|
|
4894
|
-
console.warn("Failed to insert keyframes:", error);
|
|
4941
|
+
console.warn("[Tasty] Failed to insert keyframes:", error);
|
|
4895
4942
|
return null;
|
|
4896
4943
|
}
|
|
4897
4944
|
}
|
|
@@ -4903,19 +4950,25 @@ var SheetManager = class {
|
|
|
4903
4950
|
if (!sheet) return;
|
|
4904
4951
|
try {
|
|
4905
4952
|
const styleSheet = this.getCSSSheet(sheet);
|
|
4906
|
-
|
|
4953
|
+
const adjustIndices = () => this.adjustIndicesAfterDeletion(registry, info.sheetIndex, info.ruleIndex, info.ruleIndex, 1, {
|
|
4954
|
+
className: "",
|
|
4955
|
+
ruleIndex: info.ruleIndex,
|
|
4956
|
+
sheetIndex: info.sheetIndex
|
|
4957
|
+
}, [info.ruleIndex]);
|
|
4958
|
+
if (sheet.textMode) {
|
|
4959
|
+
if (this.deleteTextRules(sheet, [info.ruleIndex]).length > 0) {
|
|
4960
|
+
sheet.ruleCount = Math.max(0, sheet.ruleCount - 1);
|
|
4961
|
+
adjustIndices();
|
|
4962
|
+
}
|
|
4963
|
+
} else if (styleSheet) {
|
|
4907
4964
|
if (info.ruleIndex >= 0 && info.ruleIndex < styleSheet.cssRules.length) {
|
|
4908
4965
|
styleSheet.deleteRule(info.ruleIndex);
|
|
4909
4966
|
sheet.ruleCount = Math.max(0, sheet.ruleCount - 1);
|
|
4910
|
-
|
|
4911
|
-
className: "",
|
|
4912
|
-
ruleIndex: info.ruleIndex,
|
|
4913
|
-
sheetIndex: info.sheetIndex
|
|
4914
|
-
}, [info.ruleIndex]);
|
|
4967
|
+
adjustIndices();
|
|
4915
4968
|
}
|
|
4916
4969
|
}
|
|
4917
4970
|
} catch (error) {
|
|
4918
|
-
console.warn("Failed to delete keyframes:", error);
|
|
4971
|
+
console.warn("[Tasty] Failed to delete keyframes:", error);
|
|
4919
4972
|
}
|
|
4920
4973
|
}
|
|
4921
4974
|
/**
|
|
@@ -4939,7 +4992,7 @@ var SheetManager = class {
|
|
|
4939
4992
|
const styleElement = sheet.sheet;
|
|
4940
4993
|
if (styleElement?.parentNode) styleElement.parentNode.removeChild(styleElement);
|
|
4941
4994
|
} catch (error) {
|
|
4942
|
-
console.warn("Failed to cleanup sheet:", error);
|
|
4995
|
+
console.warn("[Tasty] Failed to cleanup sheet:", error);
|
|
4943
4996
|
}
|
|
4944
4997
|
const rawStyleElement = this.rawStyleElements.get(root);
|
|
4945
4998
|
if (rawStyleElement?.parentNode) rawStyleElement.parentNode.removeChild(rawStyleElement);
|
|
@@ -5303,7 +5356,7 @@ var StyleInjector = class {
|
|
|
5303
5356
|
isNewAllocation: false
|
|
5304
5357
|
};
|
|
5305
5358
|
if (registry.rules.get(className)) {
|
|
5306
|
-
if (isDevEnv()) console.warn(`[
|
|
5359
|
+
if (isDevEnv()) console.warn(`[Tasty] Hash collision: cache keys produce the same class "${className}". Styles may be incorrect.`);
|
|
5307
5360
|
registry.cacheKeyToClassName.set(cacheKey, className);
|
|
5308
5361
|
return {
|
|
5309
5362
|
className,
|
|
@@ -10978,4 +11031,4 @@ function resetConfig() {
|
|
|
10978
11031
|
//#endregion
|
|
10979
11032
|
export { parseColor as $, StyleInjector as A, extractLocalProperties as At, styleHandlers as B, parseStateKey as C, getComponentPropertySyntax as Ct, extractPredefinedStateRefs as D, hslToRgbValues as Dt, extractLocalPredefinedStates as E, hexToRgb 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, hasLocalProperties as Mt, hasLocalCounterStyle as N, parsePropertyToken as Nt, getGlobalPredefinedStates as O, strToRgb as Ot, extractLocalFontFace as P, normalizeColorTokenValue as Q, SheetManager as R, renderStyles as S, getColorSpaceSuffix as St, createStateParserContext as T, getRgbValuesFromRgbaString as Tt, createStyle as U, deprecationWarning as V, PropertyTypeResolver as W, getGlobalParser as X, getGlobalFuncs as Y, getGlobalPredefinedTokens as Z, markStylesGenerated as _, isDevEnv as _t, getGlobalCounterStyle as a, okhstPlugin as at, hasPipelineCacheEntry as b, getColorSpaceComponents as bt, getGlobalKeyframes as c, StyleParser as ct, getNamePrefix as d, DEFAULT_ZERO_NAME_PREFIX as dt, parseStyle as et, hasGlobalKeyframes as f, makeClassName as ft, isTestEnvironment as g, validateNamePrefix as gt, isConfigLocked as h, tastyClassRegex as ht, getGlobalConfigTokens as i, okhstFunc as it, extractLocalCounterStyle as j, getEffectiveDefinition as jt, setGlobalPredefinedStates as k, Lru as kt, getGlobalRecipes as l, Bucket as lt, hasStylesGenerated as m, makeKeyframeName as mt, getConfig as n, setGlobalPredefinedTokens as nt, getGlobalFontFace as o, okhslFunc as ot, hasGlobalRecipes as p, makeCounterStyleName as pt, customFunc as q, getEffectiveProperties as r, stringifyStyles as rt, getGlobalInjector as s, okhslPlugin as st, configure as t, resetGlobalPredefinedTokens as tt, getGlobalStyles as u, DEFAULT_NAME_PREFIX as ut, resetConfig as v, hashString as vt, camelToKebab as w, getNamedColorHex as wt, isSelector as x, getColorSpaceFunc as xt, generateTypographyTokens as y, colorInitialValueToComponents as yt, STYLE_HANDLER_MAP as z };
|
|
10980
11033
|
|
|
10981
|
-
//# sourceMappingURL=config-
|
|
11034
|
+
//# sourceMappingURL=config-_cYm9LPl.js.map
|