@tenphi/tasty 3.5.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/{astro-ib7E7V4Y.js → astro-CeYENy2x.js} +61 -67
  2. package/dist/astro-CeYENy2x.js.map +1 -0
  3. package/dist/{collector-C6TtL8HJ.js → collector-B3OsM252.js} +2 -2
  4. package/dist/{collector-C6TtL8HJ.js.map → collector-B3OsM252.js.map} +1 -1
  5. package/dist/core/index.js +1 -1
  6. package/dist/{core-Bq7w2kti.js → core-DGm0CFHP.js} +76 -30
  7. package/dist/{core-Bq7w2kti.js.map → core-DGm0CFHP.js.map} +1 -1
  8. package/dist/css-resources-Cyl_axbI.js +149 -0
  9. package/dist/css-resources-Cyl_axbI.js.map +1 -0
  10. package/dist/{format-rules-rCZ37rqY.js → format-rules-XRw9u7d4.js} +2 -28
  11. package/dist/format-rules-XRw9u7d4.js.map +1 -0
  12. package/dist/index.js +2 -2
  13. package/dist/ssr/astro-middleware-extract-static.js +1 -1
  14. package/dist/ssr/astro-middleware-extract.js +1 -1
  15. package/dist/ssr/astro-middleware-static.js +1 -1
  16. package/dist/ssr/astro-middleware.js +1 -1
  17. package/dist/ssr/astro.d.ts +9 -1
  18. package/dist/ssr/astro.js +1 -1
  19. package/dist/ssr/index.js +2 -2
  20. package/dist/ssr/next-config.d.ts +66 -0
  21. package/dist/ssr/next-config.js +115 -0
  22. package/dist/ssr/next-config.js.map +1 -0
  23. package/dist/ssr/next.d.ts +8 -1
  24. package/dist/ssr/next.js +24 -7
  25. package/dist/ssr/next.js.map +1 -1
  26. package/dist/ssr-collector-ref-COs_ioWl.js +29 -0
  27. package/dist/ssr-collector-ref-COs_ioWl.js.map +1 -0
  28. package/docs/debug.md +13 -0
  29. package/docs/runtime-benchmarks.md +185 -12
  30. package/docs/ssr.md +151 -31
  31. package/package.json +9 -1
  32. package/dist/astro-ib7E7V4Y.js.map +0 -1
  33. package/dist/format-rules-rCZ37rqY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"core-Bq7w2kti.js","names":[],"sources":["../src/utils/function-color.ts","../src/injector/chunk-sheet-registry.ts","../src/injector/index.ts","../src/rsc-cache.ts","../src/ssr/collect-auto-properties.ts","../src/ssr/format-keyframes.ts","../src/utils/has-keys.ts","../src/compute-styles.ts","../src/utils/filter-base-props.ts","../src/utils/colors.ts","../src/utils/cache-wrapper.ts","../src/utils/mod-attrs.ts","../src/utils/dotize.ts","../src/utils/process-tokens.ts","../src/debug.ts"],"sourcesContent":["import { getGlobalParseFunctions, getGlobalParser } from './styles';\n\nconst RE_FUNC_NAME = /^([a-z][a-z0-9-]*)\\s*\\(/i;\nconst RE_COLOR_OUT =\n /^(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color)\\(|^#|^var\\(--/i;\n\n/**\n * Resolve a `name(...)` value produced by a registered custom parse function\n * into its concrete color output.\n *\n * A color function is just a `functions` entry whose output is an already\n * supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the\n * value to the global parser (which already runs the registered parse function)\n * and returns the result only when it looks like a color. Returns `null` when\n * `str` is not a registered custom function or its output is not a color.\n *\n * This is the generic replacement for the previously hardcoded okhsl/okhst\n * conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and\n * the `#token.alpha` injection path.\n */\nexport function resolveFunctionColor(str: string): string | null {\n const m = RE_FUNC_NAME.exec(str);\n if (!m) return null;\n\n const name = m[1].toLowerCase();\n // Ensure the global parser (and therefore the default color functions) is\n // initialized before consulting the function registry.\n getGlobalParser();\n const functions = getGlobalParseFunctions();\n if (!(name in functions)) return null;\n\n const out = getGlobalParser().process(str).output;\n if (!out || !RE_COLOR_OUT.test(out)) return null;\n\n return out;\n}\n","import { hashString } from '../utils/hash';\n\ninterface ChunkSheet {\n sheet: CSSStyleSheet;\n cssText: string;\n refCount: number;\n}\n\n/**\n * Global registry mapping CSS content hashes to shared constructable\n * CSSStyleSheet objects with reference counting.\n *\n * Multiple shadow roots adopting the same chunk share a single underlying\n * stylesheet object — parse once, adopt everywhere.\n */\nexport class ChunkSheetRegistry {\n private sheets = new Map<string, ChunkSheet>();\n private sheetToHash = new WeakMap<CSSStyleSheet, string>();\n\n /**\n * Get or create a CSSStyleSheet for the given CSS text.\n * Increments refCount. Uses content hash as the dedup key.\n */\n acquire(cssText: string): CSSStyleSheet {\n const hash = hashString(cssText);\n const existing = this.sheets.get(hash);\n\n if (existing) {\n existing.refCount++;\n return existing.sheet;\n }\n\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(cssText);\n\n const entry: ChunkSheet = { sheet, cssText, refCount: 1 };\n this.sheets.set(hash, entry);\n this.sheetToHash.set(sheet, hash);\n\n return sheet;\n }\n\n /**\n * Decrement refCount for a sheet. When refCount reaches 0,\n * the sheet is removed from the registry.\n */\n release(sheet: CSSStyleSheet): void {\n const hash = this.sheetToHash.get(sheet);\n if (!hash) return;\n\n const entry = this.sheets.get(hash);\n if (!entry) return;\n\n entry.refCount--;\n\n if (entry.refCount <= 0) {\n this.sheets.delete(hash);\n this.sheetToHash.delete(sheet);\n }\n }\n\n /**\n * Bulk acquire — returns an array of CSSStyleSheet in the same order.\n */\n acquireAll(cssTexts: string[]): CSSStyleSheet[] {\n return cssTexts.map((text) => this.acquire(text));\n }\n\n /**\n * Bulk release — decrements refCount for each sheet.\n */\n releaseAll(sheets: CSSStyleSheet[]): void {\n for (const sheet of sheets) {\n this.release(sheet);\n }\n }\n\n /** Number of unique sheets currently held. */\n get size(): number {\n return this.sheets.size;\n }\n}\n\n/** Module-level singleton shared across the entire application. */\nexport const chunkSheetRegistry = new ChunkSheetRegistry();\n","import {\n getConfig,\n getGlobalInjector,\n getNamePrefix,\n isTestEnvironment,\n markStylesGenerated,\n} from '../config';\nimport type { StyleResult } from '../pipeline';\nimport { tastyClassRegex } from '../utils/name-prefix';\n\nimport { StyleInjector } from './injector';\nimport type {\n CounterStyleDescriptors,\n FontFaceDescriptors,\n FunctionDefinition,\n GCOptions,\n GlobalInjectResult,\n InjectOptions,\n InjectResult,\n KeyframesResult,\n KeyframesSteps,\n PropertyOptions,\n StyleInjectorConfig,\n} from './types';\n\n/**\n * Inject styles and return className with dispose function\n */\nexport function inject(\n rules: StyleResult[],\n options?: InjectOptions,\n): InjectResult {\n const injector = getGlobalInjector();\n\n markStylesGenerated();\n\n return injector.inject(rules, options);\n}\n\n/**\n * Inject global rules that should not reserve tasty class names\n */\nexport function injectGlobal(\n rules: StyleResult[],\n options?: { root?: Document | ShadowRoot },\n): GlobalInjectResult {\n return getGlobalInjector().injectGlobal(rules, options);\n}\n\n/**\n * Inject raw CSS text directly without parsing\n * This is a low-overhead method for injecting raw CSS that doesn't need tasty processing.\n * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking.\n *\n * @example\n * ```tsx\n * // Inject raw CSS\n * const { dispose } = injectRawCSS(`\n * body { margin: 0; padding: 0; }\n * .my-class { color: red; }\n * `);\n *\n * // Later, remove the injected CSS\n * dispose();\n * ```\n */\nexport function injectRawCSS(\n css: string,\n options?: { root?: Document | ShadowRoot },\n): { dispose: () => void } {\n return getGlobalInjector().injectRawCSS(css, options);\n}\n\n/**\n * Get raw CSS text for SSR\n */\nexport function getRawCSSText(options?: {\n root?: Document | ShadowRoot;\n}): string {\n return getGlobalInjector().getRawCSSText(options);\n}\n\n/**\n * Inject keyframes and return object with toString() and dispose()\n */\nexport function keyframes(\n steps: KeyframesSteps,\n nameOrOptions?: string | { root?: Document | ShadowRoot; name?: string },\n): KeyframesResult {\n return getGlobalInjector().keyframes(steps, nameOrOptions);\n}\n\n/**\n * Define a CSS @property custom property.\n * This enables advanced features like animating custom properties.\n *\n * Note: @property rules are global and persistent once defined.\n * Re-registering the same property name is a no-op.\n *\n * @param name - The custom property name (must start with --)\n * @param options - Property configuration\n *\n * @example\n * ```ts\n * // Define a color property that can be animated\n * property('--my-color', {\n * syntax: '<color>',\n * initialValue: 'red',\n * });\n *\n * // Define an angle property\n * property('--rotation', {\n * syntax: '<angle>',\n * inherits: false,\n * initialValue: '0deg',\n * });\n * ```\n */\nexport function property(name: string, options?: PropertyOptions): void {\n return getGlobalInjector().property(name, options);\n}\n\n/**\n * Check if a CSS @property has already been defined\n *\n * @param name - The custom property name to check\n * @param options - Options including root\n */\nexport function isPropertyDefined(\n name: string,\n options?: { root?: Document | ShadowRoot },\n): boolean {\n return getGlobalInjector().isPropertyDefined(name, options);\n}\n\n/**\n * Inject a CSS @font-face rule.\n *\n * Permanent and global — no dispose or ref-counting.\n * Deduplicates by content hash (family + descriptors).\n */\nexport function fontFace(\n family: string,\n descriptors: FontFaceDescriptors,\n options?: { root?: Document | ShadowRoot },\n): void {\n return getGlobalInjector().fontFace(family, descriptors, options);\n}\n\n/**\n * Inject a CSS @counter-style rule.\n *\n * Permanent and global — no dispose or ref-counting. Deduplicates by name and\n * overrides an existing rule by default. Pass `weak: true` for global\n * `configure()` definitions, which never clobber an existing rule.\n */\nexport function counterStyle(\n name: string,\n descriptors: CounterStyleDescriptors,\n options?: { root?: Document | ShadowRoot; weak?: boolean },\n): void {\n return getGlobalInjector().counterStyle(name, descriptors, options);\n}\n\n/**\n * Inject a CSS @function rule (custom function).\n *\n * Permanent and global — no dispose or ref-counting. Deduplicates by function\n * name and overrides an existing rule by default. Pass `weak: true` for global\n * `configure()` definitions, which never clobber an existing rule.\n *\n * @param name - The function name (`$$name`, `$name`, or `--name`)\n * @param definition - Function definition (args, returns, result, local vars)\n *\n * @example\n * ```ts\n * func('$$negative', { args: ['$value'], result: '(-1 * $value)' });\n * ```\n */\nexport function func(\n name: string,\n definition: FunctionDefinition,\n options?: { root?: Document | ShadowRoot; weak?: boolean },\n): void {\n return getGlobalInjector().func(name, definition, options);\n}\n\n/**\n * Get CSS text from all sheets (for SSR)\n */\nexport function getCSSText(options?: { root?: Document | ShadowRoot }): string {\n return getGlobalInjector().getCSSText(options);\n}\n\n/**\n * Collect only CSS used by a rendered subtree (like jest-styled-components).\n * Pass the container returned by render(...).\n */\nexport function getCSSTextForNode(\n node: ParentNode | Element | DocumentFragment,\n options?: { root?: Document | ShadowRoot },\n): string {\n // Collect tasty-generated class names from the subtree using the\n // configured namePrefix (default `'t'`).\n const classRegex = tastyClassRegex(getNamePrefix());\n const classSet = new Set<string>();\n\n const readClasses = (el: Element) => {\n const cls = el.getAttribute('class');\n if (!cls) return;\n for (const token of cls.split(/\\s+/)) {\n if (classRegex.test(token)) classSet.add(token);\n }\n };\n\n // Include node itself if it's an Element\n if ((node as Element).getAttribute) {\n readClasses(node as Element);\n }\n // Walk descendants\n const elements = (node as ParentNode).querySelectorAll\n ? (node as ParentNode).querySelectorAll('[class]')\n : ([] as unknown as NodeListOf<Element>);\n if (elements) elements.forEach(readClasses);\n\n return getGlobalInjector().getCSSTextForClasses(classSet, options);\n}\n\n/**\n * Take a reference on local `@keyframes` under the deterministic names the\n * caller resolved, and report which entry holds each. Pair with\n * `ownKeyframes()` once the rules exist to inspect.\n */\nexport function holdKeyframes(\n steps: Record<string, KeyframesSteps>,\n names: Map<string, string>,\n options?: { root?: Document | ShadowRoot },\n): Map<string, string> {\n return getGlobalInjector().holdKeyframes(steps, names, options);\n}\n\n/**\n * Record that a class animates these keyframes, so the reference is released\n * when the last such class is collected.\n */\nexport function ownKeyframes(\n key: string,\n className: string,\n options?: { root?: Document | ShadowRoot },\n): void {\n getGlobalInjector().ownKeyframes(key, className, options);\n}\n\n/**\n * Remove every injected rule that is neither in the DOM nor held by an\n * outstanding `inject()` handle. Equivalent to `gc({ force: true })`.\n */\nexport function cleanup(root?: Document | ShadowRoot): void {\n return getGlobalInjector().cleanup(root);\n}\n\n/**\n * Count a render, so that a collection pass is scheduled every\n * `gc.touchInterval` of them. Used internally by computeStyles and tasty().\n *\n * @deprecated The class name is ignored — collection asks the DOM what is\n * rendered rather than recording usage per class. The argument is kept so\n * existing calls still compile.\n */\nexport function touch(\n className: string,\n options?: { root?: Document | ShadowRoot },\n): void {\n if (!getConfig().gc) return;\n getGlobalInjector().touch(className, options);\n}\n\n/**\n * Synchronous garbage collection of unused styles — those no element carries\n * and no `inject()` handle references. Evicts the oldest ones once they exceed\n * capacity. With `{ force: true }`, removes all of them regardless of capacity.\n *\n * @returns Number of styles evicted.\n */\nexport function gc(options?: GCOptions): number {\n return getGlobalInjector().gc(options);\n}\n\n/**\n * Get the global injector instance for debugging\n */\nexport const injector = {\n get instance() {\n return getGlobalInjector();\n },\n};\n\n/**\n * Destroy all resources and clean up\n */\nexport function destroy(root?: Document | ShadowRoot): void {\n return getGlobalInjector().destroy(root);\n}\n\n/**\n * Create a new isolated injector instance\n */\nexport function createInjector(\n config: Partial<StyleInjectorConfig> = {},\n): StyleInjector {\n const defaultConfig = getConfig();\n\n const fullConfig: StyleInjectorConfig = {\n ...defaultConfig,\n // Auto-enable forceTextInjection in test environments\n forceTextInjection: config.forceTextInjection ?? isTestEnvironment(),\n ...config,\n };\n\n return new StyleInjector(fullConfig);\n}\n\n// Re-export types\nexport type {\n StyleInjectorConfig,\n InjectionMode,\n InjectOptions,\n InjectResult,\n DisposeFunction,\n RuleInfo,\n SheetInfo,\n RootRegistry,\n StyleRule,\n StyleUsage,\n KeyframesInfo,\n KeyframesResult,\n KeyframesSteps,\n KeyframesCacheEntry,\n CacheMetrics,\n RawCSSResult,\n PropertyDefinition,\n PropertyOptions,\n FontFaceDescriptors,\n FontFaceInput,\n CounterStyleDescriptors,\n FunctionDefinition,\n FunctionParameter,\n GCConfig,\n GCOptions,\n} from './types';\n\nexport { flushStyles, hasPendingStyleWrites, resetStyleBatch } from './batch';\nexport type { QueuedWrite } from './batch';\nexport { StyleInjector } from './injector';\nexport { SheetManager } from './sheet-manager';\nexport { ChunkSheetRegistry, chunkSheetRegistry } from './chunk-sheet-registry';\n","/**\n * Shared RSC (React Server Components) inline style cache.\n *\n * Uses React.cache for per-request memoization in Server Components.\n * Both computeStyles() and standalone style functions (useGlobalStyles,\n * useRawCSS, useKeyframes, useProperty, useFontFace, useCounterStyle)\n * share this cache so that CSS accumulated by standalone functions is\n * flushed into inline <style> tags by the next tasty() component.\n */\n\nimport { cache } from 'react';\n\nimport { getNamePrefix } from './config';\nimport type { ServerStyleCollector } from './ssr/collector';\nimport { getRegisteredSSRCollector } from './ssr/ssr-collector-ref';\nimport { hashString } from './utils/hash';\nimport { makeClassName } from './utils/name-prefix';\n\nexport interface RSCStyleCache {\n cacheKeyToClassName: Map<string, string>;\n emittedKeys: Set<string>;\n internalsEmitted: boolean;\n pendingCSS: string[];\n /** Maps dedup key -> its slot in `pendingCSS`, so slot-keyed CSS can be replaced. */\n keyToIndex: Map<string, number>;\n /** Maps dedup key -> generated name for keyframes and counter-styles in RSC mode. */\n generatedNames: Map<string, string>;\n}\n\n/**\n * Per-request RSC style cache using React.cache.\n * React.cache provides per-request memoization in Server Components,\n * so each request gets its own isolated cache.\n */\nexport const getRSCCache = cache((): RSCStyleCache => ({\n cacheKeyToClassName: new Map(),\n emittedKeys: new Set(),\n internalsEmitted: false,\n pendingCSS: [],\n keyToIndex: new Map(),\n generatedNames: new Map(),\n}));\n\nexport function rscAllocateClassName(\n rscCache: RSCStyleCache,\n cacheKey: string,\n): { className: string; isNew: boolean } {\n const existing = rscCache.cacheKeyToClassName.get(cacheKey);\n if (existing) return { className: existing, isNew: false };\n\n // Content-hash ensures stable names across all environments (RSC, SSR, client),\n // enabling cross-environment dedup and preventing class collisions.\n const className = makeClassName(getNamePrefix(), hashString(cacheKey));\n rscCache.cacheKeyToClassName.set(cacheKey, className);\n return { className, isNew: true };\n}\n\n/**\n * Flush any pending CSS accumulated by standalone functions.\n * Returns the CSS string and clears the buffer.\n */\nexport function flushPendingCSS(rscCache: RSCStyleCache): string {\n if (rscCache.pendingCSS.length === 0) return '';\n const css = rscCache.pendingCSS.join('\\n');\n rscCache.pendingCSS.length = 0;\n // The slots are gone with the buffer; a later replace has to append instead.\n rscCache.keyToIndex.clear();\n return css;\n}\n\n/**\n * Push CSS into the RSC pending buffer with dedup via emittedKeys.\n * Returns true if the CSS was added, false if it was already emitted.\n *\n * Pass `replace` for slot-keyed entries (an explicit `id`), where the last write\n * must win to match the client's update-tracking behavior. If the slot has\n * already been flushed into a `<style>` tag the new CSS is appended instead,\n * which still wins by cascade order.\n */\nexport function pushRSCCSS(\n rscCache: RSCStyleCache,\n key: string,\n css: string,\n replace?: boolean,\n): boolean {\n if (replace) {\n const pendingIndex = rscCache.keyToIndex.get(key);\n\n if (pendingIndex !== undefined) {\n rscCache.pendingCSS[pendingIndex] = css;\n return true;\n }\n } else if (rscCache.emittedKeys.has(key)) {\n return false;\n }\n\n rscCache.emittedKeys.add(key);\n rscCache.keyToIndex.set(key, rscCache.pendingCSS.length);\n rscCache.pendingCSS.push(css);\n return true;\n}\n\ntype StyleTarget =\n | { mode: 'ssr'; collector: ServerStyleCollector }\n | { mode: 'rsc'; cache: RSCStyleCache }\n | { mode: 'client' };\n\n/**\n * Determine the current style injection target.\n * Centralizes the three-way detection (SSR collector / RSC cache / client DOM)\n * used by all style functions.\n */\nexport function getStyleTarget(): StyleTarget {\n const collector = getRegisteredSSRCollector();\n if (collector) return { mode: 'ssr', collector };\n if (typeof document === 'undefined')\n return { mode: 'rsc', cache: getRSCCache() };\n return { mode: 'client' };\n}\n","/**\n * SSR / RSC auto-property inference.\n *\n * Scans rendered CSS declarations for custom properties whose types\n * can be inferred from their values (e.g. `--angle: 30deg` → `<angle>`).\n * Mirrors the client-side auto-inference in StyleInjector.inject().\n */\n\nimport type { StyleResult } from '../pipeline';\nimport { parsePropertyToken } from '../properties';\nimport { PropertyTypeResolver } from '../properties/property-type-resolver';\nimport type { RSCStyleCache } from '../rsc-cache';\nimport { pushRSCCSS } from '../rsc-cache';\nimport type { Styles } from '../styles/types';\n\nimport type { ServerStyleCollector } from './collector';\nimport { formatPropertyCSS } from './format-property';\n\n/**\n * Scan rendered rules for auto-inferable custom properties and emit\n * @property CSS via the provided callback.\n */\nfunction scanAndEmitAutoProperties(\n rules: StyleResult[],\n styles: Styles | undefined,\n emit: (name: string, css: string) => void,\n): void {\n const registered = new Set<string>();\n\n if (styles) {\n const localProps = styles['@property'];\n if (localProps && typeof localProps === 'object') {\n for (const token of Object.keys(localProps as Record<string, unknown>)) {\n const parsed = parsePropertyToken(token);\n if (parsed.isValid) {\n registered.add(parsed.cssName);\n }\n }\n }\n }\n\n const resolver = new PropertyTypeResolver();\n\n for (const rule of rules) {\n if (!rule.declarations) continue;\n resolver.scanDeclarations(\n rule.declarations,\n (name) => registered.has(name),\n (name, syntax, initialValue) => {\n registered.add(name);\n const css = formatPropertyCSS(name, {\n syntax,\n inherits: true,\n initialValue,\n });\n if (css) {\n emit(name, css);\n }\n },\n );\n }\n}\n\n/**\n * Scan rendered rules for custom property declarations and collect\n * auto-inferred @property rules via the SSR collector.\n *\n * @param rules - Rendered style rules containing CSS declarations\n * @param collector - SSR collector to emit @property CSS into\n * @param styles - Original styles object (used to skip explicit @property)\n */\nexport function collectAutoInferredProperties(\n rules: StyleResult[],\n collector: ServerStyleCollector,\n styles?: Styles,\n): void {\n scanAndEmitAutoProperties(rules, styles, (name, css) => {\n collector.collectProperty(`__auto:${name}`, css);\n });\n}\n\n/**\n * RSC variant: scan rendered rules and push auto-inferred @property CSS\n * into the RSC pending buffer.\n */\nexport function collectAutoInferredPropertiesRSC(\n rules: StyleResult[],\n rscCache: RSCStyleCache,\n styles?: Styles,\n): void {\n scanAndEmitAutoProperties(rules, styles, (name, css) => {\n pushRSCCSS(rscCache, `__auto:${name}`, css);\n });\n}\n","/**\n * Format @keyframes CSS rules for SSR output.\n *\n * Replicates the stepsToCSS logic from SheetManager but as a\n * standalone function that doesn't need DOM access.\n */\n\nimport type { KeyframesSteps } from '../injector/types';\nimport { createStyle, STYLE_HANDLER_MAP } from '../styles';\nimport type { CSSMap, StyleHandler, StyleValueStateMap } from '../utils/styles';\n\n/**\n * Convert keyframes steps to a CSS string.\n * Replicates SheetManager.stepsToCSS() without the class instance.\n */\nfunction stepsToCSS(steps: KeyframesSteps): string {\n const rules: string[] = [];\n\n for (const [key, value] of Object.entries(steps)) {\n if (typeof value === 'string') {\n rules.push(`${key} { ${value.trim()} }`);\n continue;\n }\n\n const styleMap = (value || {}) as StyleValueStateMap;\n const styleNames = Object.keys(styleMap).sort();\n const handlerQueue: StyleHandler[] = [];\n const seenHandlers = new Set<StyleHandler>();\n\n styleNames.forEach((styleName) => {\n let handlers = STYLE_HANDLER_MAP[styleName];\n if (!handlers) {\n handlers = STYLE_HANDLER_MAP[styleName] = [createStyle(styleName)];\n }\n\n handlers.forEach((handler) => {\n if (!seenHandlers.has(handler)) {\n seenHandlers.add(handler);\n handlerQueue.push(handler);\n }\n });\n });\n\n const declarationPairs: { prop: string; value: string }[] = [];\n\n handlerQueue.forEach((handler) => {\n const lookup = handler.__lookupStyles;\n const filteredMap = lookup.reduce<StyleValueStateMap>((acc, name) => {\n const v = styleMap[name];\n if (v !== undefined) acc[name] = v;\n return acc;\n }, {});\n\n const result = handler(filteredMap);\n if (!result) return;\n\n const results = Array.isArray(result) ? result : [result];\n results.forEach((cssMap) => {\n if (!cssMap || typeof cssMap !== 'object') return;\n const { $: _$, ...props } = cssMap as CSSMap;\n\n Object.entries(props).forEach(([prop, val]) => {\n if (val == null || val === '') return;\n\n if (Array.isArray(val)) {\n val.forEach((v) => {\n if (v != null && v !== '') {\n declarationPairs.push({ prop, value: String(v) });\n }\n });\n } else {\n declarationPairs.push({ prop, value: String(val) });\n }\n });\n });\n });\n\n const declarations = declarationPairs\n .map((d) => `${d.prop}: ${d.value}`)\n .join('; ');\n\n rules.push(`${key} { ${declarations.trim()} }`);\n }\n\n return rules.join(' ');\n}\n\n/**\n * Format a @keyframes rule as a CSS string.\n */\nexport function formatKeyframesCSS(\n name: string,\n steps: KeyframesSteps,\n): string {\n const cssSteps = stepsToCSS(steps);\n return `@keyframes ${name} { ${cssSteps} }`;\n}\n","/**\n * Check if an object has any own enumerable keys.\n * Avoids the array allocation of Object.keys(obj).length > 0.\n */\nexport function hasKeys(obj: object): boolean {\n for (const _ in obj) return true;\n return false;\n}\n","/**\n * Hook-free, synchronous style computation.\n *\n * Extracts the core logic from useStyles() into a plain function that can\n * be called during React render without any hooks. Three code paths:\n *\n * 1. SSR collector — styles collected via ServerStyleCollector\n * 2. Client inject — styles injected synchronously into the DOM\n * 3. RSC inline — styles returned as CSS strings for inline <style> emission\n *\n * This enables tasty() components to work as React Server Components.\n */\n\nimport {\n categorizeStyleKeys,\n generateChunkCacheKey,\n renderStylesForChunk,\n} from './chunks';\nimport {\n getConfig,\n getGlobalKeyframes,\n hasGlobalKeyframes,\n isFunctionsPolyfillEnabled,\n} from './config';\nimport {\n counterStyle,\n fontFace,\n func,\n inject,\n holdKeyframes,\n ownKeyframes,\n property,\n touch,\n} from './injector';\nimport type { FontFaceDescriptors, KeyframesSteps } from './injector/types';\nimport {\n extractLocalCounterStyle,\n formatCounterStyleRule,\n hasLocalCounterStyle,\n} from './counter-style';\nimport {\n extractLocalFunctions,\n formatFunctionRule,\n hasLocalFunctions,\n parseFunctionName,\n registerLocalFunctionPolyfills,\n} from './functions';\nimport {\n extractLocalFontFace,\n fontFaceContentHash,\n formatFontFaceRule,\n hasLocalFontFace,\n} from './font-face';\nimport {\n extractAnimationNamesFromStyles,\n extractLocalKeyframes,\n filterUsedKeyframes,\n hasLocalKeyframes,\n mergeKeyframes,\n referencesAnimation,\n resolveKeyframesNames,\n replaceAnimationNames,\n} from './keyframes';\nimport type { RenderResult, StyleResult } from './pipeline';\nimport {\n flushPendingCSS,\n getRSCCache,\n rscAllocateClassName,\n} from './rsc-cache';\nimport type { RSCStyleCache } from './rsc-cache';\nimport { extractLocalProperties, hasLocalProperties } from './properties';\nimport { collectAutoInferredProperties } from './ssr/collect-auto-properties';\nimport type { ServerStyleCollector } from './ssr/collector';\nimport { formatKeyframesCSS } from './ssr/format-keyframes';\nimport { formatPropertyCSS } from './ssr/format-property';\nimport { formatRules } from './ssr/format-rules';\nimport { getRegisteredSSRCollector } from './ssr/ssr-collector-ref';\nimport type { Styles } from './styles/types';\nimport { hasKeys } from './utils/has-keys';\nimport { resolveRecipes } from './utils/resolve-recipes';\n\nexport interface ComputeStylesResult {\n className: string;\n /** CSS text to emit as an inline <style> tag (RSC mode only). */\n css?: string;\n}\n\nexport interface ComputeStylesOptions {\n ssrCollector?: ServerStyleCollector | null;\n /** Target root for style injection (client only). Defaults to `document`. */\n root?: Document | ShadowRoot;\n /**\n * Set when `styles` outlives this call and will be passed in again — a\n * `tasty()` factory's own styles object rather than a per-render merge.\n * It lets chunk cache keys be memoized on the object, which is worth the\n * bookkeeping only when there is a next render to spend it on.\n */\n stableStyles?: boolean;\n}\n\ninterface ProcessedChunk {\n name: string;\n styleKeys: string[];\n cacheKey: string;\n renderResult: RenderResult;\n className: string;\n /** Local animations this chunk runs, by their authored names. */\n animations?: string[];\n}\n\nconst EMPTY_RESULT: ComputeStylesResult = { className: '' };\n\n// ---------------------------------------------------------------------------\n// RSC (React Server Components) inline style support\n// ---------------------------------------------------------------------------\n\n/**\n * Mark internals as emitted for this RSC request.\n *\n * Internals (tokens, @property, @font-face, @counter-style) are emitted\n * exclusively by the SSR collector via ServerStyleCollector.collectInternals().\n * The SSR path is reliable because TastyRegistry is always present as a\n * client component in the root layout, guaranteeing SSR runs for every page.\n *\n * Previously this function also emitted internals and coordinated with SSR\n * via a globalThis flag, but that flag leaked across requests in the same\n * Node.js process, causing pages without RSC-rendered tasty components\n * (e.g. the playground route) to lose all token CSS.\n */\nfunction collectInternalsRSC(rscCache: RSCStyleCache): string {\n if (rscCache.internalsEmitted) return '';\n rscCache.internalsEmitted = true;\n\n return '';\n}\n\n/**\n * Collect per-component ancillary CSS (keyframes, @property, font-face,\n * counter-style) for RSC mode.\n */\nfunction collectAncillaryRSC(rscCache: RSCStyleCache, styles: Styles): string {\n const parts: string[] = [];\n\n const usedKf = getUsedKeyframes(styles);\n const rscKeyframeNames = usedKf ? resolveKeyframesNames(usedKf) : null;\n if (usedKf && rscKeyframeNames) {\n for (const [authored, steps] of Object.entries(usedKf)) {\n const name = rscKeyframeNames.get(authored) as string;\n const key = `__kf:${name}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatKeyframesCSS(name, steps));\n }\n }\n }\n\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n const key = `__prop:${token}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n const css = formatPropertyCSS(token, definition);\n if (css) parts.push(css);\n }\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const key = `__ff:${hash}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatFontFaceRule(family, desc));\n }\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n const key = `__cs:${name}:${JSON.stringify(descriptors)}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatCounterStyleRule(name, descriptors));\n }\n }\n }\n }\n\n if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {\n const localFunctions = extractLocalFunctions(styles);\n if (localFunctions) {\n for (const [name, definition] of Object.entries(localFunctions)) {\n const key = `__func:${parseFunctionName(name)}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatFunctionRule(name, definition));\n }\n }\n }\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Process all chunks in RSC mode: render CSS to strings, allocate classNames,\n * and return combined { className, css }.\n */\nfunction computeStylesRSC(\n styles: Styles,\n chunkMap: Map<string, string[]>,\n stableStyles: boolean,\n): ComputeStylesResult {\n const rscCache = getRSCCache();\n const cssParts: string[] = [];\n const classNames: string[] = [];\n const rscUsedKf = getUsedKeyframes(styles);\n const rscKeyframeNames = rscUsedKf ? resolveKeyframesNames(rscUsedKf) : null;\n\n // Flush CSS accumulated by standalone style functions\n const pendingCSS = flushPendingCSS(rscCache);\n if (pendingCSS) cssParts.push(pendingCSS);\n\n const internalsCSS = collectInternalsRSC(rscCache);\n if (internalsCSS) cssParts.push(internalsCSS);\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n if (chunkStyleKeys.length === 0) continue;\n\n const baseKey = generateChunkCacheKey(\n styles,\n chunkName,\n chunkStyleKeys,\n stableStyles,\n );\n\n // Rendered before the class is allocated, for the same reason as the other\n // two paths: the key has to carry which keyframes these rules animate.\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n chunkStyleKeys,\n );\n if (renderResult.rules.length === 0) continue;\n\n const { rules, cacheKey } = applyKeyframeNames(\n renderResult.rules,\n baseKey,\n rscKeyframeNames,\n );\n\n const { className, isNew } = rscAllocateClassName(rscCache, cacheKey);\n classNames.push(className);\n\n if (isNew) {\n const css = formatRules(rules, className);\n if (css) cssParts.push(css);\n }\n }\n\n const ancillaryCSS = collectAncillaryRSC(rscCache, styles);\n if (ancillaryCSS) cssParts.push(ancillaryCSS);\n\n if (classNames.length === 0) return EMPTY_RESULT;\n\n const css = cssParts.join('\\n');\n\n return {\n className: classNames.join(' '),\n css: css || undefined,\n };\n}\n\n/**\n * Get keyframes that are actually used in styles.\n * Returns null if no keyframes are used (fast path for zero overhead).\n */\nfunction getUsedKeyframes(\n styles: Styles,\n): Record<string, KeyframesSteps> | null {\n const hasLocal = hasLocalKeyframes(styles);\n const hasGlobal = hasGlobalKeyframes();\n if (!hasLocal && !hasGlobal) return null;\n\n const usedNames = extractAnimationNamesFromStyles(styles);\n if (usedNames.size === 0) return null;\n\n const local = hasLocal ? extractLocalKeyframes(styles) : null;\n const global = hasGlobal ? getGlobalKeyframes() : null;\n const allKeyframes = mergeKeyframes(local, global);\n\n return filterUsedKeyframes(allKeyframes, usedNames);\n}\n\n/**\n * Process a chunk on the SSR path: allocate via collector, render, collect CSS.\n */\nfunction processChunkSSR(\n collector: ServerStyleCollector,\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n stableStyles: boolean,\n keyframeNames?: Map<string, string> | null,\n): ProcessedChunk | null {\n if (styleKeys.length === 0) return null;\n\n const baseKey = generateChunkCacheKey(\n styles,\n chunkName,\n styleKeys,\n stableStyles,\n );\n\n // Rendered before the class is allocated: the key has to carry which\n // keyframes these rules animate, or two components authoring the same\n // shorthand over different definitions would share a class here and\n // disagree with the client, which does carry it.\n const renderResult = renderStylesForChunk(styles, chunkName, styleKeys);\n if (renderResult.rules.length === 0) return null;\n\n const { animations, rules, cacheKey } = applyKeyframeNames(\n renderResult.rules,\n baseKey,\n keyframeNames,\n );\n\n const { className, isNewAllocation } = collector.allocateClassName(cacheKey);\n\n if (isNewAllocation) {\n collector.collectChunk(cacheKey, className, rules);\n return {\n name: chunkName,\n styleKeys,\n cacheKey,\n renderResult: { ...renderResult, rules },\n className,\n animations,\n };\n }\n\n return {\n name: chunkName,\n styleKeys,\n cacheKey,\n renderResult: { rules: [] },\n className,\n };\n}\n\n/**\n * Point a chunk's rules at the resolved keyframe names, and fold those names\n * into its cache key.\n *\n * Both halves matter, and both have to happen before the rules are written\n * anywhere: the declarations have to name the animation that will exist, and\n * the key has to distinguish two components that authored the same shorthand\n * over different definitions. Shared by the client and the server so they\n * cannot disagree about either.\n */\nfunction applyKeyframeNames(\n ruleset: StyleResult[],\n baseKey: string,\n keyframeNames?: Map<string, string> | null,\n): { animations: string[]; rules: StyleResult[]; cacheKey: string } {\n if (!keyframeNames || keyframeNames.size === 0) {\n return { animations: [], rules: ruleset, cacheKey: baseKey };\n }\n\n // Whole tokens only, so `crossfade` is not a use of `fade`.\n const animations = [...keyframeNames.keys()].filter((authored) =>\n ruleset.some((rule) => referencesAnimation(rule.declarations, authored)),\n );\n\n if (animations.length === 0) {\n return { animations, rules: ruleset, cacheKey: baseKey };\n }\n\n const rules = ruleset.map((rule) => ({\n ...rule,\n declarations: replaceAnimationNames(rule.declarations, keyframeNames),\n }));\n\n const cacheKey = `${baseKey}\\u0000kf:${animations\n .map((authored) => `${authored}=${keyframeNames.get(authored)}`)\n .sort()\n .join(',')}`;\n\n return { animations, rules, cacheKey };\n}\n\n/**\n * Process a chunk on the client: render, allocate className, and inject\n * CSS synchronously. The injector's cache makes this idempotent.\n */\nfunction processChunkSync(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n stableStyles: boolean,\n root?: Document | ShadowRoot,\n keyframeNames?: Map<string, string> | null,\n): ProcessedChunk | null {\n if (styleKeys.length === 0) return null;\n\n const cacheKey = generateChunkCacheKey(\n styles,\n chunkName,\n styleKeys,\n stableStyles,\n );\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n styleKeys,\n cacheKey,\n );\n if (renderResult.rules.length === 0) return null;\n\n const {\n animations,\n rules,\n cacheKey: injectKey,\n } = applyKeyframeNames(renderResult.rules, cacheKey, keyframeNames);\n\n // `pin: false` — the render path keeps no dispose handle; the DOM is the\n // record of use, and `gc()` reclaims the class once no element carries it.\n const { className } = inject(rules, {\n cacheKey: injectKey,\n root,\n pin: false,\n });\n\n return {\n name: chunkName,\n styleKeys,\n cacheKey: injectKey,\n renderResult: { ...renderResult, rules },\n className,\n animations,\n };\n}\n\n/**\n * Inject all ancillary rules (properties, font-faces, counter-styles) synchronously.\n */\nfunction injectAncillarySync(\n styles: Styles,\n root?: Document | ShadowRoot,\n): void {\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n property(token, { ...definition, root });\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n fontFace(family, desc, { root });\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n counterStyle(name, descriptors, { root });\n }\n }\n }\n\n if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {\n const localFunctions = extractLocalFunctions(styles);\n if (localFunctions) {\n for (const [name, definition] of Object.entries(localFunctions)) {\n func(name, definition, { root });\n }\n }\n }\n}\n\n/**\n * Collect all ancillary rules into the SSR collector.\n */\nfunction collectAncillarySSR(\n collector: ServerStyleCollector,\n styles: Styles,\n chunks: ProcessedChunk[],\n): void {\n const usedKf = getUsedKeyframes(styles);\n if (usedKf) {\n // Emitted under the resolved name, so two different `fade` definitions are\n // two rules rather than one deduplicated by name — and so the client\n // agrees about which one a class animates.\n const names = resolveKeyframesNames(usedKf);\n for (const [authored, steps] of Object.entries(usedKf)) {\n const name = names.get(authored) as string;\n collector.collectKeyframes(name, formatKeyframesCSS(name, steps));\n }\n }\n\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n const css = formatPropertyCSS(token, definition);\n if (css) {\n collector.collectProperty(token, css);\n }\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n collector.collectFontFace(hash, css);\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n const css = formatCounterStyleRule(name, descriptors);\n collector.collectCounterStyle(name, css);\n }\n }\n }\n\n if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {\n const localFunctions = extractLocalFunctions(styles);\n if (localFunctions) {\n for (const [name, definition] of Object.entries(localFunctions)) {\n const css = formatFunctionRule(name, definition);\n collector.collectFunction(parseFunctionName(name), css);\n }\n }\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n const allRules = chunks.flatMap((c) => c.renderResult.rules);\n if (allRules.length > 0) {\n collectAutoInferredProperties(allRules, collector, styles);\n }\n }\n}\n\n/**\n * Synchronous, hook-free style computation.\n *\n * Resolves recipes, categorizes style keys into chunks, renders CSS rules,\n * allocates class names, and injects / collects / returns the CSS.\n *\n * Three code paths:\n * 1. SSR collector — discovered via ALS or passed explicitly; CSS collected\n * 2. RSC inline — no collector and no `document`; CSS returned as `result.css`\n * for the caller to emit as an inline `<style>` tag\n * 3. Client inject — CSS injected synchronously into the DOM (idempotent)\n *\n * @param styles - Tasty styles object (or undefined for no styles)\n * @param options - Optional SSR collector override\n */\nexport function computeStyles(\n styles: Styles | undefined,\n options?: ComputeStylesOptions,\n): ComputeStylesResult {\n if (!styles || !hasKeys(styles as Record<string, unknown>)) {\n return EMPTY_RESULT;\n }\n\n const resolved = resolveRecipes(styles);\n\n // Only the caller's own object can be declared reusable. When recipe\n // resolution rewrites it, `resolved` is a fresh per-render object and\n // memoizing on it would be pure overhead.\n const stableStyles = options?.stableStyles === true && resolved === styles;\n\n // @function polyfill: register local definitions as inline closures BEFORE\n // any chunk is rendered, so call sites in this component expand to plain CSS.\n if (isFunctionsPolyfillEnabled() && hasLocalFunctions(resolved)) {\n registerLocalFunctionPolyfills(resolved);\n }\n\n const chunkMap = categorizeStyleKeys(resolved as Record<string, unknown>);\n\n const collector =\n options?.ssrCollector !== undefined\n ? options.ssrCollector\n : getRegisteredSSRCollector();\n\n const chunks: ProcessedChunk[] = [];\n\n if (collector) {\n collector.collectInternals();\n\n const ssrKf = getUsedKeyframes(resolved);\n const ssrKeyframeNames = ssrKf ? resolveKeyframesNames(ssrKf) : null;\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n const chunk = processChunkSSR(\n collector,\n resolved,\n chunkName,\n chunkStyleKeys,\n stableStyles,\n ssrKeyframeNames,\n );\n if (chunk) chunks.push(chunk);\n }\n\n collectAncillarySSR(collector, resolved, chunks);\n } else if (typeof document === 'undefined') {\n // RSC path: render CSS to strings for inline <style> emission\n return computeStylesRSC(resolved, chunkMap, stableStyles);\n } else {\n const root = options?.root;\n\n injectAncillarySync(resolved, root);\n\n const usedKf = getUsedKeyframes(resolved);\n\n // Names first, and resolved the same way on every path: the rules that\n // animate them carry the name, and a rule written before it is known\n // cannot be corrected afterwards.\n const keyframeNames = usedKf ? resolveKeyframesNames(usedKf) : null;\n const keyframeKeys =\n usedKf && keyframeNames\n ? holdKeyframes(usedKf, keyframeNames, { root })\n : null;\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n const chunk = processChunkSync(\n resolved,\n chunkName,\n chunkStyleKeys,\n stableStyles,\n root,\n keyframeNames,\n );\n if (chunk) chunks.push(chunk);\n }\n\n // Only the classes whose rules actually name the animation own it — one\n // that merely rendered alongside would keep it alive for its own lifetime.\n // The reference is taken once however many times this renders, and released\n // when the last owner is collected.\n if (keyframeKeys) {\n for (const chunk of chunks) {\n for (const authored of chunk.animations ?? []) {\n const key = keyframeKeys.get(authored);\n if (key) ownKeyframes(key, chunk.className, { root });\n }\n }\n }\n\n for (const chunk of chunks) {\n touch(chunk.className, { root });\n }\n }\n\n if (chunks.length === 0) return EMPTY_RESULT;\n if (chunks.length === 1) return { className: chunks[0].className };\n\n return { className: chunks.map((c) => c.className).join(' ') };\n}\n","const DOMPropNames = new Set(['id']);\n\nconst BasePropNames = new Set([\n 'role',\n 'as',\n 'element',\n 'css',\n 'qa',\n 'mods',\n 'qaVal',\n 'hidden',\n 'isHidden',\n 'disabled',\n 'isDisabled',\n 'children',\n 'style',\n 'className',\n 'href',\n 'target',\n 'tabIndex',\n]);\n\nconst ignoreEventPropsNames = new Set([\n 'onPress',\n 'onHoverStart',\n 'onHoverEnd',\n 'onPressStart',\n 'onPressEnd',\n]);\n\nconst propRe = /^((data-).*)$/;\nconst eventRe = /^on[A-Z].+$/;\n\ninterface PropsFilterOptions {\n // @deprecated\n labelable?: boolean;\n propNames?: Set<string>;\n eventProps?: boolean;\n}\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterBaseProps<T extends object>(\n props: T,\n opts: PropsFilterOptions = {},\n): Partial<T> {\n const { propNames, eventProps } = opts;\n const filteredProps: Partial<T> = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) &&\n (DOMPropNames.has(prop) ||\n BasePropNames.has(prop) ||\n // Always preserve any ARIA attributes to maintain accessibility support.\n prop.startsWith('aria-') ||\n (eventProps &&\n eventRe.test(prop) &&\n !ignoreEventPropsNames.has(prop)) ||\n propNames?.has(prop) ||\n propRe.test(prop))\n ) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n","import { overrideColorAlpha } from './color-space';\n\nexport function color(name: string, opacity = 1) {\n if (opacity !== 1) {\n // The alpha slot takes a `<number>`, so the value goes in as authored —\n // no percentage conversion to introduce a float artifact.\n return overrideColorAlpha(`var(--${name}-color)`, String(opacity));\n }\n\n return `var(--${name}-color)`;\n}\n","import { Lru } from '../parser/lru';\n\n/**\n * Create a function that caches the result with LRU eviction.\n */\nexport function cacheWrapper<A, B, R>(\n handler: (firstArg: A, secondArg?: B) => R,\n limit = 1000,\n): (firstArg: A, secondArg?: B) => R {\n const cache = new Lru<string, R>(limit);\n\n return (firstArg: A, secondArg?: B) => {\n const key =\n typeof firstArg === 'string' && secondArg == null\n ? firstArg\n : JSON.stringify([firstArg, secondArg]);\n\n let result = cache.get(key);\n if (result === undefined) {\n result =\n secondArg == null ? handler(firstArg) : handler(firstArg, secondArg);\n cache.set(key, result);\n }\n return result;\n };\n}\n","/**\n * Generate data DOM attributes from modifier map.\n */\nimport type { AllBaseProps } from '../types';\n\nimport { cacheWrapper } from './cache-wrapper';\nimport { camelToKebab } from './case-converter';\n\nfunction modAttrs(map: AllBaseProps['mods']): Record<string, string> | null {\n return map\n ? Object.keys(map).reduce(\n (attrs, key) => {\n const value = map[key];\n\n // Skip null, undefined, false\n if (value == null || value === false) {\n return attrs;\n }\n\n const attrName = `data-${camelToKebab(key)}`;\n\n if (value === true) {\n // Boolean true: data-{name}=\"\"\n attrs[attrName] = '';\n } else if (typeof value === 'string') {\n // String value: data-{name}=\"value\"\n attrs[attrName] = value;\n } else if (typeof value === 'number') {\n // Number: convert to string\n attrs[attrName] = String(value);\n } else {\n // Reject other types (objects, arrays, functions)\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `[Tasty] Invalid mod value for \"${key}\". Expected boolean, string, or number, got ${typeof value}`,\n );\n }\n }\n\n return attrs;\n },\n {} as Record<string, string>,\n )\n : null;\n}\n\nconst _modAttrs = cacheWrapper(modAttrs);\n\nexport { _modAttrs as modAttrs };\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n// Convert complex js object to dot notation js object\n// url: https://github.com/vardars/dotize\n// author: vardars\n\nexport const dotize = {\n valTypes: {\n none: 'NONE',\n primitive: 'PRIM',\n object: 'OBJECT',\n array: 'ARRAY',\n },\n\n getValType: function (val) {\n if (!val || typeof val != 'object' || Array.isArray(val))\n return dotize.valTypes.primitive;\n if (typeof val == 'object') return dotize.valTypes.object;\n },\n\n getPathType: function (arrPath) {\n const arrPathTypes = [];\n for (const path in arrPath) {\n const pathVal = arrPath[path];\n if (!pathVal) arrPathTypes.push(dotize.valTypes.none);\n else if (dotize.isNumber(pathVal))\n arrPathTypes.push(dotize.valTypes.array);\n else arrPathTypes.push(dotize.valTypes.object);\n }\n return arrPathTypes;\n },\n\n isUndefined: function (obj) {\n return typeof obj == 'undefined';\n },\n\n isNumber: function (f) {\n return !isNaN(parseInt(f));\n },\n\n isEmptyObj: function (obj) {\n for (const prop in obj) {\n if (Object.hasOwnProperty.call(obj, prop)) return false;\n }\n\n return JSON.stringify(obj) === JSON.stringify({});\n },\n\n isPlainObject: function (obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n\n return Object.getPrototypeOf(obj) === Object.prototype;\n },\n\n isNotObject: function (obj) {\n return !obj || !this.isPlainObject(obj);\n },\n\n isEmptyArray: function (arr) {\n return Array.isArray(arr) && arr.length == 0;\n },\n\n isNotArray: function (arr) {\n return Array.isArray(arr) == false;\n },\n\n removeEmptyArrayItem: function (arr) {\n return arr.filter(function (el) {\n return el != null && el != '';\n });\n },\n\n getFieldName: function (field, prefix, isRoot, isArrayItem, isArray) {\n if (isArray)\n return (\n (prefix ? prefix : '') +\n (dotize.isNumber(field)\n ? '[' + field + ']'\n : (isRoot && !prefix ? '' : '.') + field)\n );\n else if (isArrayItem) return (prefix ? prefix : '') + '[' + field + ']';\n else return (prefix ? prefix + '.' : '') + field;\n },\n\n startsWith: function (val, valToSearch) {\n return val.indexOf(valToSearch) == 0;\n },\n\n convert: function (obj, prefix = '') {\n let newObj = {};\n\n // primitives\n if (dotize.isNotObject(obj)) {\n if (prefix) {\n newObj[prefix] = obj;\n return newObj;\n } else {\n return obj;\n }\n }\n\n return (function recurse(o, p, isRoot) {\n const isArrayItem = Array.isArray(o);\n for (const f in o) {\n const currentProp = o[f];\n if (\n currentProp &&\n typeof currentProp === 'object' &&\n !Array.isArray(currentProp) &&\n dotize.isPlainObject(currentProp)\n ) {\n if (isArrayItem && dotize.isEmptyObj(currentProp) == false) {\n newObj = recurse(\n currentProp,\n dotize.getFieldName(f, p, isRoot, true),\n ); // array item object\n } else if (dotize.isEmptyObj(currentProp) == false) {\n newObj = recurse(currentProp, dotize.getFieldName(f, p, isRoot)); // object\n } else if (dotize.isEmptyObj(currentProp)) {\n newObj[dotize.getFieldName(f, p, isRoot, isArrayItem)] =\n currentProp;\n }\n } else {\n if (isArrayItem || dotize.isNumber(f)) {\n newObj[dotize.getFieldName(f, p, isRoot, true)] = currentProp; // array item primitive\n } else {\n newObj[dotize.getFieldName(f, p, isRoot)] = currentProp; // primitive\n }\n }\n }\n\n return newObj;\n })(obj, prefix, true);\n },\n\n backward: function (obj, prefix) {\n let newObj = {};\n const arStartRegex = /\\[(\\d+)\\]/g;\n\n // primitives\n if (dotize.isNotObject(obj) && dotize.isNotArray(obj)) {\n if (prefix) {\n return obj[prefix];\n } else {\n return obj;\n }\n }\n\n for (let tProp in obj) {\n const tPropVal = obj[tProp];\n\n if (prefix) {\n const prefixRegex = new RegExp('^' + prefix);\n tProp = tProp.replace(prefixRegex, '');\n }\n\n tProp = tProp.replace(arStartRegex, '.$1');\n\n if (dotize.startsWith(tProp, '.')) tProp = tProp.replace(/^\\./, '');\n\n const arrPath = tProp.split('.');\n const arrPathTypes = dotize.getPathType(arrPath);\n\n // has array on root\n if (\n !dotize.isUndefined(arrPathTypes) &&\n arrPathTypes[0] == dotize.valTypes.array &&\n Array.isArray(newObj) == false\n ) {\n newObj = [];\n }\n\n (function recurse(rPropVal, rObj, rPropValPrev, rObjPrev) {\n let currentPath = arrPath.shift();\n const currentPathType = arrPathTypes.shift();\n\n if (typeof currentPath == 'undefined' || currentPath == '') {\n newObj = rPropVal;\n return;\n }\n\n const isArray = currentPathType == dotize.valTypes.array;\n\n if (dotize.isNumber(currentPath)) currentPath = parseInt(currentPath);\n\n // has multiple levels\n if (arrPath.length > 0) {\n // is not assigned before\n if (typeof rObj[currentPath] == 'undefined') {\n if (isArray) {\n rObj[currentPath] = [];\n } else {\n rObj[currentPath] = {};\n }\n }\n\n recurse(rPropVal, rObj[currentPath], currentPath, rObj);\n return;\n }\n\n if (\n currentPathType == dotize.valTypes.array &&\n rPropValPrev &&\n rObjPrev\n ) {\n if (Array.isArray(rObjPrev[rPropValPrev]) == false)\n rObjPrev[rPropValPrev] = [];\n rObjPrev[rPropValPrev].push(rPropVal);\n } else {\n rObj[currentPath] = rPropVal;\n }\n })(tPropVal, newObj);\n }\n\n return newObj;\n },\n};\n","import type { Tokens, TokenValue } from '../types';\n\nimport type { CSSProperties } from './css-types';\n\nimport { normalizeDslName } from './string';\nimport { normalizeColorTokenValue, parseStyle } from './styles';\n\nexport { hslToRgbValues } from './color-math';\n\nconst devMode = process.env.NODE_ENV !== 'production';\n\n/**\n * Check if a value is a valid token value (string, number, or boolean - not object).\n * Returns false for `false` values (they mean \"skip this token\").\n */\nfunction isValidTokenValue(\n value: unknown,\n): value is Exclude<TokenValue, undefined | null | false> {\n if (value === undefined || value === null || value === false) {\n return false;\n }\n\n if (typeof value === 'object') {\n if (devMode) {\n console.warn(\n '[Tasty] Object values are not allowed in tokens prop. ' +\n 'Tokens do not support state-based styling. Use a primitive value instead.',\n );\n }\n return false;\n }\n\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n}\n\n/**\n * Process a single token value through the tasty parser.\n * Numbers are converted to strings; 0 stays as \"0\".\n */\nfunction processTokenValue(value: string | number): string {\n if (typeof value === 'number') {\n // 0 should remain as \"0\", not converted to any unit\n if (value === 0) {\n return '0';\n }\n return parseStyle(String(value)).output;\n }\n return parseStyle(value).output;\n}\n\n/**\n * Resolve one `$name` / `#name` entry to the custom property it declares and\n * the value to declare, or `null` when the entry declares nothing.\n *\n * The two sigils differ only in the property name they build and in how `true`\n * is read: for a custom property it is the empty value, for a color it is\n * `transparent`.\n */\nfunction resolveTokenEntry(\n key: string,\n value: Exclude<TokenValue, undefined | null | false>,\n): [name: string, value: string] | null {\n const name = `--${normalizeDslName(key.slice(1))}`;\n\n if (key[0] === '$') {\n // Boolean true for custom properties converts to empty string (valid CSS value)\n return [name, processTokenValue(value === true ? '' : value)];\n }\n\n const colorValue = normalizeColorTokenValue(value);\n // Skip if normalized to null (shouldn't happen since false is filtered by isValidTokenValue)\n if (colorValue === null) return null;\n\n return [`${name}-color`, processTokenValue(colorValue)];\n}\n\n/**\n * Process tokens object into inline style properties.\n * - `$name` -> `--name` with the parsed value\n * - `#name` -> `--name-color` with the parsed value\n *\n * @param tokens - The tokens object to process\n * @returns CSSProperties object or undefined if no tokens to process\n */\nexport function processTokens(\n tokens: Tokens | undefined,\n): CSSProperties | undefined {\n if (!tokens) {\n return undefined;\n }\n\n const keys = Object.keys(tokens);\n if (keys.length === 0) {\n return undefined;\n }\n\n let result: Record<string, string> | undefined;\n\n for (const key of keys) {\n const value = tokens[key as keyof Tokens];\n\n // Skip undefined/null values\n if (!isValidTokenValue(value)) {\n continue;\n }\n\n if (key[0] !== '$' && key[0] !== '#') continue;\n\n const entry = resolveTokenEntry(key, value);\n if (!entry) continue;\n\n if (!result) result = {};\n result[entry[0]] = entry[1];\n }\n\n return result as CSSProperties | undefined;\n}\n","/* eslint-disable no-console */\nimport { CHUNK_NAMES } from './chunks/definitions';\nimport { getNamePrefix } from './config';\nimport { flushStyles, getCSSTextForNode, injector } from './injector';\nimport type { CacheMetrics, RootRegistry } from './injector/types';\nimport { isDevEnv } from './utils/is-dev-env';\nimport { tastyClassRegex } from './utils/name-prefix';\n\ndeclare global {\n interface Window {\n tastyDebug?: typeof tastyDebug;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype CSSTarget =\n 'all' | 'global' | 'active' | 'unused' | 'page' | string | string[] | Element;\n\nexport interface DebugOptions {\n root?: Document | ShadowRoot;\n /** Suppress console logging and return data only (default: false) */\n raw?: boolean;\n}\n\nexport interface CSSOptions extends DebugOptions {\n prettify?: boolean;\n /** Read from stored source CSS (dev-mode only) instead of live CSSOM */\n source?: boolean;\n}\n\nexport interface DebugChunkInfo {\n className: string;\n chunkName: string | null;\n}\n\nexport interface InspectResult {\n element?: Element | null;\n classes: string[];\n chunks: DebugChunkInfo[];\n css: string;\n size: number;\n rules: number;\n}\n\nexport interface CacheStatus {\n classes: {\n active: string[];\n unused: string[];\n all: string[];\n };\n metrics: CacheMetrics | null;\n}\n\nexport interface ChunkBreakdown {\n byChunk: Record<\n string,\n { classes: string[]; cssSize: number; ruleCount: number }\n >;\n totalChunkTypes: number;\n totalClasses: number;\n}\n\nexport interface Summary {\n activeClasses: string[];\n /** Classes `gc({ force: true })` would delete right now. */\n unusedClasses: string[];\n /**\n * Held but in neither list: nothing renders them, yet collection will not\n * take them — inside the grace window, or pinned by an `inject()` handle.\n */\n hotClasses: string[];\n totalStyledClasses: string[];\n\n activeCSSSize: number;\n unusedCSSSize: number;\n globalCSSSize: number;\n rawCSSSize: number;\n keyframesCSSSize: number;\n propertyCSSSize: number;\n totalCSSSize: number;\n\n activeRuleCount: number;\n unusedRuleCount: number;\n globalRuleCount: number;\n rawRuleCount: number;\n keyframesRuleCount: number;\n propertyRuleCount: number;\n totalRuleCount: number;\n\n metrics: CacheMetrics | null;\n definedProperties: string[];\n definedKeyframes: { name: string; refCount: number }[];\n chunkBreakdown: ChunkBreakdown;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction fmtSize(bytes: number): string {\n return bytes > 1024 ? `${(bytes / 1024).toFixed(1)}KB` : `${bytes}B`;\n}\n\nfunction countRules(css: string): number {\n return (css.match(/\\{[^}]*\\}/g) || []).length;\n}\n\nfunction sortTastyClasses(classes: Iterable<string>): string[] {\n // Class names use a base36 hash format (e.g. `t3a5f`), so sort lexicographically.\n return Array.from(classes).sort((a, b) => a.localeCompare(b));\n}\n\n/**\n * The registry for `root`, with every queued write landed first.\n *\n * Every injector read API is a flush point, and the reads below reach past\n * those APIs straight into the registry and the sheet manager. Without this\n * they would report a batch window's contents as absent — a rule that is\n * enqueued but not yet in a sheet is missing from `globalRules`, from the\n * sheets, and from anything counting either.\n */\nfunction getRegistry(\n root: Document | ShadowRoot = document,\n): RootRegistry | undefined {\n flushStyles();\n\n return injector.instance._sheetManager?.getRegistry(root);\n}\n\nfunction findDomTastyClasses(root: Document | ShadowRoot = document): string[] {\n const classes = new Set<string>();\n const elements = (root as Document).querySelectorAll?.('[class]') || [];\n const classRegex = tastyClassRegex(getNamePrefix());\n elements.forEach((el) => {\n const attr = el.getAttribute('class');\n if (attr) {\n for (const cls of attr.split(/\\s+/)) {\n if (classRegex.test(cls)) classes.add(cls);\n }\n }\n });\n return sortTastyClasses(classes);\n}\n\n/**\n * Everything this injector holds in `root`, in the order the engine applies it,\n * with the sources kept byte-for-byte — trimming would report a total smaller\n * than one of its own parts whenever raw CSS has edge whitespace.\n */\nfunction getAllCSS(root: Document | ShadowRoot = document): string {\n const registry = getRegistry(root);\n const sheetManager = injector.instance._sheetManager;\n if (!registry || !sheetManager) return '';\n\n return sheetManager.getOwnedCSSInOrder(registry, root).join('\\n');\n}\n\n/**\n * Injected classes that no element carries and nobody pinned — the exact set\n * `gc({ force: true })` would delete.\n *\n * Deliberately borrowed from the injector rather than recomputed here: the two\n * drifted apart once before, when this file still read \"unused\" off the pin\n * counts the render path had stopped maintaining.\n */\nfunction getUnusedClasses(root: Document | ShadowRoot = document): string[] {\n return sortTastyClasses(injector.instance.getUnusedClasses({ root }));\n}\n\n/** Every class this injector holds CSS for in `root`. */\nfunction getOwnedClasses(root: Document | ShadowRoot = document): string[] {\n const registry = getRegistry(root);\n if (!registry) return [];\n\n const owned: string[] = [];\n for (const [className, info] of registry.rules) {\n // A negative sheet index marks a class whose CSS this injector does not\n // hold: server-rendered, pre-allocated, or queued.\n if (info.sheetIndex >= 0) owned.push(className);\n }\n\n return sortTastyClasses(owned);\n}\n\n// ---------------------------------------------------------------------------\n// prettifyCSS — readable output for nested at-rules & comma selectors\n// ---------------------------------------------------------------------------\n\nfunction prettifyCSS(css: string): string {\n if (!css || !css.trim()) return '';\n\n const out: string[] = [];\n let depth = 0;\n const indent = () => ' '.repeat(depth);\n\n let normalized = css.replace(/\\s+/g, ' ').trim();\n // Ensure braces are surrounded by spaces for splitting\n normalized = normalized.replace(/\\s*\\{\\s*/g, ' { ');\n normalized = normalized.replace(/\\s*\\}\\s*/g, ' } ');\n normalized = normalized.replace(/;\\s*/g, '; ');\n\n const tokens = normalized.split(/\\s+/);\n let buf = '';\n\n for (const t of tokens) {\n if (t === '{') {\n // buf contains the selector / at-rule header\n const header = buf.trim();\n if (header) {\n // Split comma-separated selectors onto their own lines\n // but only if the comma is outside parentheses\n const parts = splitOutsideParens(header, ',');\n if (parts.length > 1) {\n out.push(\n parts\n .map((p, idx) =>\n idx === 0\n ? `${indent()}${p.trim()},`\n : `${indent()}${p.trim()}${idx < parts.length - 1 ? ',' : ''}`,\n )\n .join('\\n') + ' {',\n );\n } else {\n out.push(`${indent()}${header} {`);\n }\n } else {\n out.push(`${indent()}{`);\n }\n depth++;\n buf = '';\n } else if (t === '}') {\n // Flush any trailing declarations\n if (buf.trim()) {\n for (const decl of buf.split(';').filter((s) => s.trim())) {\n out.push(`${indent()}${decl.trim()};`);\n }\n buf = '';\n }\n depth = Math.max(0, depth - 1);\n out.push(`${indent()}}`);\n } else if (t.endsWith(';')) {\n buf += ` ${t}`;\n const full = buf.trim();\n if (full) out.push(`${indent()}${full}`);\n buf = '';\n } else {\n buf += ` ${t}`;\n }\n }\n if (buf.trim()) out.push(buf.trim());\n\n return out\n .filter((l) => l.trim())\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\n/** Split `str` by `sep` only when not inside parentheses */\nfunction splitOutsideParens(str: string, sep: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let i = 0; i < str.length; i++) {\n const ch = str[i];\n if (ch === '(') depth++;\n else if (ch === ')') depth--;\n else if (depth === 0 && str.startsWith(sep, i)) {\n parts.push(str.slice(start, i));\n start = i + sep.length;\n }\n }\n parts.push(str.slice(start));\n return parts;\n}\n\n// ---------------------------------------------------------------------------\n// Chunk helpers\n// ---------------------------------------------------------------------------\n\nfunction extractChunkName(cacheKey: string): string | null {\n for (const part of cacheKey.split('\\0')) {\n if (part.startsWith('[states:')) continue;\n if (!part.includes(':') && part.length > 0) return part;\n }\n return null;\n}\n\nfunction getChunkForClass(\n className: string,\n root: Document | ShadowRoot = document,\n): string | null {\n const registry = getRegistry(root);\n if (!registry) return null;\n for (const [key, cn] of registry.cacheKeyToClassName) {\n if (cn === className) return extractChunkName(key);\n }\n return null;\n}\n\nfunction buildChunkBreakdown(\n root: Document | ShadowRoot = document,\n): ChunkBreakdown {\n const registry = getRegistry(root);\n if (!registry) return { byChunk: {}, totalChunkTypes: 0, totalClasses: 0 };\n\n const byChunk: ChunkBreakdown['byChunk'] = {};\n for (const [cacheKey, className] of registry.cacheKeyToClassName) {\n const chunk = extractChunkName(cacheKey) || 'unknown';\n if (!byChunk[chunk])\n byChunk[chunk] = { classes: [], cssSize: 0, ruleCount: 0 };\n byChunk[chunk].classes.push(className);\n const css = injector.instance.getCSSTextForClasses([className], { root });\n byChunk[chunk].cssSize += css.length;\n byChunk[chunk].ruleCount += countRules(css);\n }\n\n for (const entry of Object.values(byChunk)) {\n entry.classes = sortTastyClasses(entry.classes);\n }\n\n const totalClasses = Object.values(byChunk).reduce(\n (s, e) => s + e.classes.length,\n 0,\n );\n return {\n byChunk,\n totalChunkTypes: Object.keys(byChunk).length,\n totalClasses,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Global-type CSS helper (internal only)\n// ---------------------------------------------------------------------------\n\n/**\n * Every prefix `registry.globalRules` is keyed by. Anything missing here is a\n * rule the summary would hold but never count, which is how the totals stopped\n * adding up the first time.\n */\nconst GLOBAL_RULE_PREFIXES = {\n global: 'global:',\n property: 'property:',\n fontFace: 'fontface:',\n counterStyle: 'counterstyle:',\n function: 'function:',\n} as const;\n\nfunction getGlobalTypeCSS(\n type: keyof typeof GLOBAL_RULE_PREFIXES | 'raw' | 'keyframes',\n root: Document | ShadowRoot = document,\n): { css: string; ruleCount: number; size: number } {\n const registry = getRegistry(root);\n if (!registry) return { css: '', ruleCount: 0, size: 0 };\n\n const chunks: string[] = [];\n let rc = 0;\n\n if (type === 'raw') {\n // Raw blocks are kept by the sheet manager, not in `globalRules`, so the\n // prefix scan below never sees them — and their rules are counted from the\n // parsed sheet, since one raw block is one string but any number of rules.\n const css = injector.instance.getRawCSSText({ root });\n const sheetManager = injector.instance._sheetManager;\n\n return {\n css: prettifyCSS(css),\n ruleCount: sheetManager?.getRawRuleCount(root) ?? 0,\n size: css.length,\n };\n }\n\n if (type === 'keyframes') {\n for (const [, entry] of registry.keyframesCache) {\n const info = entry.info;\n const sheetInfo = registry.sheets[info.sheetIndex];\n const sm = injector.instance._sheetManager;\n const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;\n if (ss && info.ruleIndex < ss.cssRules.length) {\n const rule = ss.cssRules[info.ruleIndex];\n if (rule) {\n chunks.push(rule.cssText);\n rc++;\n }\n } else if (info.cssText) {\n chunks.push(info.cssText);\n rc++;\n }\n }\n } else {\n const prefix = GLOBAL_RULE_PREFIXES[type];\n for (const [key, ri] of registry.globalRules) {\n if (!key.startsWith(prefix)) continue;\n const sheetInfo = registry.sheets[ri.sheetIndex];\n const sm = injector.instance._sheetManager;\n const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;\n if (ss) {\n const start = Math.max(0, ri.ruleIndex);\n const end = Math.min(\n ss.cssRules.length - 1,\n (ri.endRuleIndex as number) ?? ri.ruleIndex,\n );\n if (start >= 0 && end >= start && start < ss.cssRules.length) {\n for (let i = start; i <= end; i++) {\n const rule = ss.cssRules[i];\n if (rule) {\n chunks.push(rule.cssText);\n rc++;\n }\n }\n }\n } else if (ri.cssText?.length) {\n chunks.push(...ri.cssText);\n rc += ri.cssText.length;\n }\n }\n }\n\n const raw = chunks.join('\\n');\n return { css: prettifyCSS(raw), ruleCount: rc, size: raw.length };\n}\n\n// ---------------------------------------------------------------------------\n// Source CSS (dev-mode RuleInfo.cssText)\n// ---------------------------------------------------------------------------\n\nfunction getSourceCssForClasses(\n classNames: string[],\n root: Document | ShadowRoot = document,\n): string | null {\n const registry = getRegistry(root);\n if (!registry) return null;\n\n const chunks: string[] = [];\n let found = false;\n for (const cls of classNames) {\n const info = registry.rules.get(cls);\n if (info?.cssText?.length) {\n chunks.push(...info.cssText);\n found = true;\n }\n }\n return found ? chunks.join('\\n') : null;\n}\n\n// ---------------------------------------------------------------------------\n// Definitions helper (internal)\n// ---------------------------------------------------------------------------\n\nfunction getDefs(root: Document | ShadowRoot = document) {\n const registry = getRegistry(root);\n let properties: string[] = [];\n if (registry?.injectedProperties) {\n properties = Array.from(\n (registry.injectedProperties as Map<string, string>).keys(),\n ).sort();\n }\n\n const keyframes: { name: string; refCount: number }[] = [];\n if (registry) {\n for (const entry of registry.keyframesCache.values()) {\n keyframes.push({ name: entry.name, refCount: entry.refCount });\n }\n keyframes.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n return { properties, keyframes };\n}\n\n// ---------------------------------------------------------------------------\n// Chunk display order\n// ---------------------------------------------------------------------------\n\nconst CHUNK_ORDER = [\n CHUNK_NAMES.COMBINED,\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];\n\n// ---------------------------------------------------------------------------\n// tastyDebug API\n// ---------------------------------------------------------------------------\n\nexport const tastyDebug = {\n css(target: CSSTarget, opts?: CSSOptions): string {\n const {\n root = document,\n prettify = true,\n raw = false,\n source = false,\n } = opts || {};\n let css = '';\n\n const classRegex = tastyClassRegex(getNamePrefix());\n if (source && typeof target === 'string' && classRegex.test(target)) {\n const src = getSourceCssForClasses([target], root);\n if (src) {\n css = src;\n } else {\n if (!raw) {\n console.warn(\n '[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.',\n );\n }\n css = injector.instance.getCSSTextForClasses([target], { root });\n }\n } else if (source && Array.isArray(target)) {\n const src = getSourceCssForClasses(target, root);\n if (src) {\n css = src;\n } else {\n if (!raw) {\n console.warn(\n '[Tasty] source CSS not available. Falling back to live CSSOM.',\n );\n }\n css = injector.instance.getCSSTextForClasses(target, { root });\n }\n } else if (typeof target === 'string') {\n if (target === 'all') {\n // Documented as component + global + raw, and raw has its own sheet.\n css = getAllCSS(root);\n } else if (target === 'global') {\n css = getGlobalTypeCSS('global', root).css;\n return css; // already prettified\n } else if (target === 'active') {\n const active = findDomTastyClasses(root);\n css = injector.instance.getCSSTextForClasses(active, { root });\n } else if (target === 'unused') {\n const unused = getUnusedClasses(root);\n css = injector.instance.getCSSTextForClasses(unused, { root });\n } else if (target === 'page') {\n css = getPageCSS(root);\n } else if (classRegex.test(target)) {\n css = injector.instance.getCSSTextForClasses([target], { root });\n } else {\n const el = (root as Document).querySelector?.(target);\n if (el) css = getCSSTextForNode(el, { root });\n }\n } else if (Array.isArray(target)) {\n css = injector.instance.getCSSTextForClasses(target, { root });\n } else if (target instanceof Element) {\n css = getCSSTextForNode(target, { root });\n }\n\n const result = prettify ? prettifyCSS(css) : css;\n\n if (!raw) {\n const label = Array.isArray(target) ? `[${target.join(', ')}]` : target;\n const rc = countRules(css);\n console.group(`CSS for ${label} (${rc} rules, ${fmtSize(css.length)})`);\n console.log(result || '(empty)');\n console.groupEnd();\n }\n\n return result;\n },\n\n inspect(target: string | Element, opts?: DebugOptions): InspectResult {\n const { root = document, raw = false } = opts || {};\n const element =\n typeof target === 'string'\n ? (root as Document).querySelector?.(target)\n : target;\n\n if (!element) {\n const empty: InspectResult = {\n element: null,\n classes: [],\n chunks: [],\n css: '',\n size: 0,\n rules: 0,\n };\n if (!raw) console.warn('[Tasty] debug.inspect: element not found');\n return empty;\n }\n\n const classList = element.getAttribute('class') || '';\n const classRegex = tastyClassRegex(getNamePrefix());\n const tastyClasses = classList\n .split(/\\s+/)\n .filter((cls) => classRegex.test(cls));\n\n const chunks: DebugChunkInfo[] = tastyClasses.map((className) => ({\n className,\n chunkName: getChunkForClass(className, root),\n }));\n\n const css = getCSSTextForNode(element, { root });\n const rules = countRules(css);\n\n const result: InspectResult = {\n element,\n classes: tastyClasses,\n chunks,\n css: prettifyCSS(css),\n size: css.length,\n rules,\n };\n\n if (!raw) {\n const tag = element.tagName.toLowerCase();\n const id = element.id ? `#${element.id}` : '';\n console.group(\n `inspect ${tag}${id} — ${tastyClasses.length} classes, ${rules} rules, ${fmtSize(css.length)}`,\n );\n if (chunks.length) {\n console.log(\n 'Chunks:',\n chunks.map((c) => `${c.className}→${c.chunkName || '?'}`).join(', '),\n );\n }\n console.groupCollapsed('CSS');\n console.log(result.css || '(empty)');\n console.groupEnd();\n console.groupEnd();\n }\n\n return result;\n },\n\n summary(opts?: DebugOptions): Summary {\n const { root = document, raw = false } = opts || {};\n\n const activeClasses = findDomTastyClasses(root);\n const unusedClasses = getUnusedClasses(root);\n // Everything, not just the two bands above: a class that went cold a\n // moment ago is in neither, and dropping it here is the accounting failure\n // this whole change started from.\n const ownedClasses = getOwnedClasses(root);\n const totalStyledClasses = sortTastyClasses(\n new Set([...activeClasses, ...ownedClasses]),\n );\n const unusedSet = new Set(unusedClasses);\n const activeSet = new Set(activeClasses);\n const hotClasses = ownedClasses.filter(\n (className) => !activeSet.has(className) && !unusedSet.has(className),\n );\n const hotCSS = injector.instance.getCSSTextForClasses(hotClasses, { root });\n\n const activeCSS = injector.instance.getCSSTextForClasses(activeClasses, {\n root,\n });\n const unusedCSS = injector.instance.getCSSTextForClasses(unusedClasses, {\n root,\n });\n const allCSS = getAllCSS(root);\n\n const activeRuleCount = countRules(activeCSS);\n const unusedRuleCount = countRules(unusedCSS);\n\n const globalData = getGlobalTypeCSS('global', root);\n const rawData = getGlobalTypeCSS('raw', root);\n const kfData = getGlobalTypeCSS('keyframes', root);\n const propData = getGlobalTypeCSS('property', root);\n // Folded into the global line rather than given their own: they are all\n // at-rules injected once and kept forever, and leaving them out of the\n // total is what made it not a total.\n const atRuleData = (\n ['fontFace', 'counterStyle', 'function'] as const\n ).reduce(\n (all, type) => {\n const data = getGlobalTypeCSS(type, root);\n return {\n css: data.css ? `${all.css}\\n${data.css}`.trim() : all.css,\n ruleCount: all.ruleCount + data.ruleCount,\n size: all.size + data.size,\n };\n },\n { css: '', ruleCount: 0, size: 0 },\n );\n\n const totalRuleCount =\n activeRuleCount +\n unusedRuleCount +\n countRules(hotCSS) +\n globalData.ruleCount +\n atRuleData.ruleCount +\n rawData.ruleCount +\n kfData.ruleCount +\n propData.ruleCount;\n\n const metrics = injector.instance.getMetrics({ root });\n const defs = getDefs(root);\n const chunkBreakdown = buildChunkBreakdown(root);\n\n const summary: Summary = {\n activeClasses,\n unusedClasses,\n hotClasses,\n totalStyledClasses,\n activeCSSSize: activeCSS.length,\n unusedCSSSize: unusedCSS.length,\n globalCSSSize: globalData.size + atRuleData.size,\n rawCSSSize: rawData.size,\n keyframesCSSSize: kfData.size,\n propertyCSSSize: propData.size,\n totalCSSSize: allCSS.length,\n activeRuleCount,\n unusedRuleCount,\n globalRuleCount: globalData.ruleCount + atRuleData.ruleCount,\n rawRuleCount: rawData.ruleCount,\n keyframesRuleCount: kfData.ruleCount,\n propertyRuleCount: propData.ruleCount,\n totalRuleCount,\n metrics,\n definedProperties: defs.properties,\n definedKeyframes: defs.keyframes,\n chunkBreakdown,\n };\n\n if (!raw) {\n console.group('Tasty Summary');\n console.log(\n `Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`,\n );\n console.log(\n `Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`,\n );\n if (hotClasses.length)\n console.log(\n `Held: ${hotClasses.length} classes, ${countRules(hotCSS)} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`,\n );\n console.log(\n `Global: ${globalData.ruleCount + atRuleData.ruleCount} rules, ${fmtSize(globalData.size + atRuleData.size)}`,\n );\n if (rawData.ruleCount)\n console.log(\n `Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`,\n );\n if (kfData.ruleCount)\n console.log(\n `Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`,\n );\n if (propData.ruleCount)\n console.log(\n `@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`,\n );\n console.log(\n `Total: ${totalStyledClasses.length} classes, ${totalRuleCount} rules, ${fmtSize(allCSS.length)}`,\n );\n\n if (metrics) {\n const total = metrics.hits + metrics.misses;\n const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;\n console.log(`Cache: ${rate}% hit rate (${total} lookups)`);\n }\n\n if (chunkBreakdown.totalChunkTypes > 0) {\n console.groupCollapsed(\n `Chunks (${chunkBreakdown.totalChunkTypes} types, ${chunkBreakdown.totalClasses} classes)`,\n );\n for (const name of CHUNK_ORDER) {\n const d = chunkBreakdown.byChunk[name];\n if (d)\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n for (const [name, d] of Object.entries(chunkBreakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n console.groupEnd();\n }\n\n if (defs.properties.length || defs.keyframes.length) {\n console.log(\n `Defs: ${defs.properties.length} @property, ${defs.keyframes.length} @keyframes`,\n );\n }\n\n console.groupEnd();\n }\n\n return summary;\n },\n\n chunks(opts?: DebugOptions): ChunkBreakdown {\n const { root = document, raw = false } = opts || {};\n const breakdown = buildChunkBreakdown(root);\n\n if (!raw) {\n console.group(\n `Chunks (${breakdown.totalChunkTypes} types, ${breakdown.totalClasses} classes)`,\n );\n for (const name of CHUNK_ORDER) {\n const d = breakdown.byChunk[name];\n if (d)\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n for (const [name, d] of Object.entries(breakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n console.groupEnd();\n }\n\n return breakdown;\n },\n\n cache(opts?: DebugOptions): CacheStatus {\n const { root = document, raw = false } = opts || {};\n const active = findDomTastyClasses(root);\n const unused = getUnusedClasses(root);\n const metrics = injector.instance.getMetrics({ root });\n\n // `all` is everything held, not the two bands above: a class that went cold\n // a moment ago is in neither, and it is still taking up a sheet.\n const all = sortTastyClasses(\n new Set([...active, ...getOwnedClasses(root)]),\n );\n\n const status: CacheStatus = {\n classes: { active, unused, all },\n metrics,\n };\n\n if (!raw) {\n console.group('Cache');\n console.log(`Active: ${active.length}, Unused: ${unused.length}`);\n if (metrics) {\n const total = metrics.hits + metrics.misses;\n const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;\n console.log(\n `Hits: ${metrics.hits}, Misses: ${metrics.misses}, Rate: ${rate}%`,\n );\n }\n console.groupEnd();\n }\n\n return status;\n },\n\n cleanup(opts?: { root?: Document | ShadowRoot }): void {\n injector.instance.cleanup(opts?.root);\n },\n\n help(): void {\n console.log(`tastyDebug API:\n .summary() — overview (classes, rules, sizes)\n .css(\"active\") — CSS for classes in DOM\n .css(\"t42\") — CSS for a specific class\n .css(\"t42\",{source:1})— original CSS before browser parsing (dev only)\n .css(\".selector\") — CSS for a DOM element\n .inspect(\".selector\") — element details (classes, chunks, rules)\n .chunks() — style chunk breakdown\n .cache() — cache status and metrics\n .cleanup() — force unused style cleanup\nOptions: { raw: true } suppresses logging, { root: shadowRoot } targets Shadow DOM`);\n },\n\n install(): void {\n if (typeof window !== 'undefined' && window.tastyDebug !== tastyDebug) {\n window.tastyDebug = tastyDebug;\n console.log('tastyDebug installed. Run tastyDebug.help() for commands.');\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// Page CSS (minimal, kept internal)\n// ---------------------------------------------------------------------------\n\nfunction getPageCSS(root: Document | ShadowRoot = document): string {\n const chunks: string[] = [];\n try {\n if ('styleSheets' in root) {\n for (const sheet of Array.from((root as Document).styleSheets)) {\n try {\n if (sheet.cssRules)\n chunks.push(\n Array.from(sheet.cssRules)\n .map((r) => r.cssText)\n .join('\\n'),\n );\n } catch {\n /* cross-origin */\n }\n }\n }\n } catch {\n /* ignore */\n }\n return chunks.join('\\n');\n}\n\n// ---------------------------------------------------------------------------\n// Auto-install in development\n// ---------------------------------------------------------------------------\n\nif (typeof window !== 'undefined' && isDevEnv()) {\n tastyDebug.install();\n}\n"],"mappings":";;;;;;AAEA,MAAM,eAAe;AACrB,MAAM,eACJ;;;;;;;;;;;;;;;AAgBF,SAAgB,qBAAqB,KAA4B;CAC/D,MAAM,IAAI,aAAa,KAAK,GAAG;CAC/B,IAAI,CAAC,GAAG,OAAO;CAEf,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY;CAG9B,gBAAgB;CAEhB,IAAI,EAAE,QADY,wBACI,IAAI,OAAO;CAEjC,MAAM,MAAM,gBAAgB,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC;CAC3C,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,GAAG,GAAG,OAAO;CAE5C,OAAO;AACT;;;;;;;;;;ACpBA,IAAa,qBAAb,MAAgC;CAC9B,yBAAiB,IAAI,IAAwB;CAC7C,8BAAsB,IAAI,QAA+B;;;;;CAMzD,QAAQ,SAAgC;EACtC,MAAM,OAAO,WAAW,OAAO;EAC/B,MAAM,WAAW,KAAK,OAAO,IAAI,IAAI;EAErC,IAAI,UAAU;GACZ,SAAS;GACT,OAAO,SAAS;EAClB;EAEA,MAAM,QAAQ,IAAI,cAAc;EAChC,MAAM,YAAY,OAAO;EAEzB,MAAM,QAAoB;GAAE;GAAO;GAAS,UAAU;EAAE;EACxD,KAAK,OAAO,IAAI,MAAM,KAAK;EAC3B,KAAK,YAAY,IAAI,OAAO,IAAI;EAEhC,OAAO;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,IAAI,OAAO,WAAW,eAAe,SAAS,GAC5C,WAAW,QAAQ"}
1
+ {"version":3,"file":"core-DGm0CFHP.js","names":[],"sources":["../src/utils/function-color.ts","../src/injector/chunk-sheet-registry.ts","../src/injector/index.ts","../src/rsc-cache.ts","../src/ssr/collect-auto-properties.ts","../src/ssr/format-keyframes.ts","../src/utils/has-keys.ts","../src/compute-styles.ts","../src/utils/filter-base-props.ts","../src/utils/colors.ts","../src/utils/cache-wrapper.ts","../src/utils/mod-attrs.ts","../src/utils/dotize.ts","../src/utils/process-tokens.ts","../src/debug.ts"],"sourcesContent":["import { getGlobalParseFunctions, getGlobalParser } from './styles';\n\nconst RE_FUNC_NAME = /^([a-z][a-z0-9-]*)\\s*\\(/i;\nconst RE_COLOR_OUT =\n /^(?:rgb|hsl|hwb|lab|lch|oklab|oklch|color)\\(|^#|^var\\(--/i;\n\n/**\n * Resolve a `name(...)` value produced by a registered custom parse function\n * into its concrete color output.\n *\n * A color function is just a `functions` entry whose output is an already\n * supported color (`rgb`, `hsl`, `#…`, `oklch`, …). This helper delegates the\n * value to the global parser (which already runs the registered parse function)\n * and returns the result only when it looks like a color. Returns `null` when\n * `str` is not a registered custom function or its output is not a color.\n *\n * This is the generic replacement for the previously hardcoded okhsl/okhst\n * conversion branches scattered across `strToRgb`, `resolveToRgbaValues`, and\n * the `#token.alpha` injection path.\n */\nexport function resolveFunctionColor(str: string): string | null {\n const m = RE_FUNC_NAME.exec(str);\n if (!m) return null;\n\n const name = m[1].toLowerCase();\n // Ensure the global parser (and therefore the default color functions) is\n // initialized before consulting the function registry.\n getGlobalParser();\n const functions = getGlobalParseFunctions();\n if (!(name in functions)) return null;\n\n const out = getGlobalParser().process(str).output;\n if (!out || !RE_COLOR_OUT.test(out)) return null;\n\n return out;\n}\n","import { hashString } from '../utils/hash';\n\ninterface ChunkSheet {\n sheet: CSSStyleSheet;\n cssText: string;\n refCount: number;\n}\n\n/**\n * Global registry mapping CSS content hashes to shared constructable\n * CSSStyleSheet objects with reference counting.\n *\n * Multiple shadow roots adopting the same chunk share a single underlying\n * stylesheet object — parse once, adopt everywhere.\n */\nexport class ChunkSheetRegistry {\n private sheets = new Map<string, ChunkSheet>();\n private sheetToHash = new WeakMap<CSSStyleSheet, string>();\n\n /**\n * Get or create a CSSStyleSheet for the given CSS text.\n * Increments refCount. Uses content hash as the dedup key.\n */\n acquire(cssText: string): CSSStyleSheet {\n const hash = hashString(cssText);\n const existing = this.sheets.get(hash);\n\n if (existing) {\n existing.refCount++;\n return existing.sheet;\n }\n\n const sheet = new CSSStyleSheet();\n sheet.replaceSync(cssText);\n\n const entry: ChunkSheet = { sheet, cssText, refCount: 1 };\n this.sheets.set(hash, entry);\n this.sheetToHash.set(sheet, hash);\n\n return sheet;\n }\n\n /**\n * Decrement refCount for a sheet. When refCount reaches 0,\n * the sheet is removed from the registry.\n */\n release(sheet: CSSStyleSheet): void {\n const hash = this.sheetToHash.get(sheet);\n if (!hash) return;\n\n const entry = this.sheets.get(hash);\n if (!entry) return;\n\n entry.refCount--;\n\n if (entry.refCount <= 0) {\n this.sheets.delete(hash);\n this.sheetToHash.delete(sheet);\n }\n }\n\n /**\n * Bulk acquire — returns an array of CSSStyleSheet in the same order.\n */\n acquireAll(cssTexts: string[]): CSSStyleSheet[] {\n return cssTexts.map((text) => this.acquire(text));\n }\n\n /**\n * Bulk release — decrements refCount for each sheet.\n */\n releaseAll(sheets: CSSStyleSheet[]): void {\n for (const sheet of sheets) {\n this.release(sheet);\n }\n }\n\n /** Number of unique sheets currently held. */\n get size(): number {\n return this.sheets.size;\n }\n}\n\n/** Module-level singleton shared across the entire application. */\nexport const chunkSheetRegistry = new ChunkSheetRegistry();\n","import {\n getConfig,\n getGlobalInjector,\n getNamePrefix,\n isTestEnvironment,\n markStylesGenerated,\n} from '../config';\nimport type { StyleResult } from '../pipeline';\nimport { tastyClassRegex } from '../utils/name-prefix';\n\nimport { StyleInjector } from './injector';\nimport type {\n CounterStyleDescriptors,\n FontFaceDescriptors,\n FunctionDefinition,\n GCOptions,\n GlobalInjectResult,\n InjectOptions,\n InjectResult,\n KeyframesResult,\n KeyframesSteps,\n PropertyOptions,\n StyleInjectorConfig,\n} from './types';\n\n/**\n * Inject styles and return className with dispose function\n */\nexport function inject(\n rules: StyleResult[],\n options?: InjectOptions,\n): InjectResult {\n const injector = getGlobalInjector();\n\n markStylesGenerated();\n\n return injector.inject(rules, options);\n}\n\n/**\n * Inject global rules that should not reserve tasty class names\n */\nexport function injectGlobal(\n rules: StyleResult[],\n options?: { root?: Document | ShadowRoot },\n): GlobalInjectResult {\n return getGlobalInjector().injectGlobal(rules, options);\n}\n\n/**\n * Inject raw CSS text directly without parsing\n * This is a low-overhead method for injecting raw CSS that doesn't need tasty processing.\n * The CSS is inserted into a separate style element to avoid conflicts with tasty's chunking.\n *\n * @example\n * ```tsx\n * // Inject raw CSS\n * const { dispose } = injectRawCSS(`\n * body { margin: 0; padding: 0; }\n * .my-class { color: red; }\n * `);\n *\n * // Later, remove the injected CSS\n * dispose();\n * ```\n */\nexport function injectRawCSS(\n css: string,\n options?: { root?: Document | ShadowRoot },\n): { dispose: () => void } {\n return getGlobalInjector().injectRawCSS(css, options);\n}\n\n/**\n * Get raw CSS text for SSR\n */\nexport function getRawCSSText(options?: {\n root?: Document | ShadowRoot;\n}): string {\n return getGlobalInjector().getRawCSSText(options);\n}\n\n/**\n * Inject keyframes and return object with toString() and dispose()\n */\nexport function keyframes(\n steps: KeyframesSteps,\n nameOrOptions?: string | { root?: Document | ShadowRoot; name?: string },\n): KeyframesResult {\n return getGlobalInjector().keyframes(steps, nameOrOptions);\n}\n\n/**\n * Define a CSS @property custom property.\n * This enables advanced features like animating custom properties.\n *\n * Note: @property rules are global and persistent once defined.\n * Re-registering the same property name is a no-op.\n *\n * @param name - The custom property name (must start with --)\n * @param options - Property configuration\n *\n * @example\n * ```ts\n * // Define a color property that can be animated\n * property('--my-color', {\n * syntax: '<color>',\n * initialValue: 'red',\n * });\n *\n * // Define an angle property\n * property('--rotation', {\n * syntax: '<angle>',\n * inherits: false,\n * initialValue: '0deg',\n * });\n * ```\n */\nexport function property(name: string, options?: PropertyOptions): void {\n return getGlobalInjector().property(name, options);\n}\n\n/**\n * Check if a CSS @property has already been defined\n *\n * @param name - The custom property name to check\n * @param options - Options including root\n */\nexport function isPropertyDefined(\n name: string,\n options?: { root?: Document | ShadowRoot },\n): boolean {\n return getGlobalInjector().isPropertyDefined(name, options);\n}\n\n/**\n * Inject a CSS @font-face rule.\n *\n * Permanent and global — no dispose or ref-counting.\n * Deduplicates by content hash (family + descriptors).\n */\nexport function fontFace(\n family: string,\n descriptors: FontFaceDescriptors,\n options?: { root?: Document | ShadowRoot },\n): void {\n return getGlobalInjector().fontFace(family, descriptors, options);\n}\n\n/**\n * Inject a CSS @counter-style rule.\n *\n * Permanent and global — no dispose or ref-counting. Deduplicates by name and\n * overrides an existing rule by default. Pass `weak: true` for global\n * `configure()` definitions, which never clobber an existing rule.\n */\nexport function counterStyle(\n name: string,\n descriptors: CounterStyleDescriptors,\n options?: { root?: Document | ShadowRoot; weak?: boolean },\n): void {\n return getGlobalInjector().counterStyle(name, descriptors, options);\n}\n\n/**\n * Inject a CSS @function rule (custom function).\n *\n * Permanent and global — no dispose or ref-counting. Deduplicates by function\n * name and overrides an existing rule by default. Pass `weak: true` for global\n * `configure()` definitions, which never clobber an existing rule.\n *\n * @param name - The function name (`$$name`, `$name`, or `--name`)\n * @param definition - Function definition (args, returns, result, local vars)\n *\n * @example\n * ```ts\n * func('$$negative', { args: ['$value'], result: '(-1 * $value)' });\n * ```\n */\nexport function func(\n name: string,\n definition: FunctionDefinition,\n options?: { root?: Document | ShadowRoot; weak?: boolean },\n): void {\n return getGlobalInjector().func(name, definition, options);\n}\n\n/**\n * Get CSS text from all sheets (for SSR)\n */\nexport function getCSSText(options?: { root?: Document | ShadowRoot }): string {\n return getGlobalInjector().getCSSText(options);\n}\n\n/**\n * Collect only CSS used by a rendered subtree (like jest-styled-components).\n * Pass the container returned by render(...).\n */\nexport function getCSSTextForNode(\n node: ParentNode | Element | DocumentFragment,\n options?: { root?: Document | ShadowRoot },\n): string {\n // Collect tasty-generated class names from the subtree using the\n // configured namePrefix (default `'t'`).\n const classRegex = tastyClassRegex(getNamePrefix());\n const classSet = new Set<string>();\n\n const readClasses = (el: Element) => {\n const cls = el.getAttribute('class');\n if (!cls) return;\n for (const token of cls.split(/\\s+/)) {\n if (classRegex.test(token)) classSet.add(token);\n }\n };\n\n // Include node itself if it's an Element\n if ((node as Element).getAttribute) {\n readClasses(node as Element);\n }\n // Walk descendants\n const elements = (node as ParentNode).querySelectorAll\n ? (node as ParentNode).querySelectorAll('[class]')\n : ([] as unknown as NodeListOf<Element>);\n if (elements) elements.forEach(readClasses);\n\n return getGlobalInjector().getCSSTextForClasses(classSet, options);\n}\n\n/**\n * Take a reference on local `@keyframes` under the deterministic names the\n * caller resolved, and report which entry holds each. Pair with\n * `ownKeyframes()` once the rules exist to inspect.\n */\nexport function holdKeyframes(\n steps: Record<string, KeyframesSteps>,\n names: Map<string, string>,\n options?: { root?: Document | ShadowRoot },\n): Map<string, string> {\n return getGlobalInjector().holdKeyframes(steps, names, options);\n}\n\n/**\n * Record that a class animates these keyframes, so the reference is released\n * when the last such class is collected.\n */\nexport function ownKeyframes(\n key: string,\n className: string,\n options?: { root?: Document | ShadowRoot },\n): void {\n getGlobalInjector().ownKeyframes(key, className, options);\n}\n\n/**\n * Remove every injected rule that is neither in the DOM nor held by an\n * outstanding `inject()` handle. Equivalent to `gc({ force: true })`.\n */\nexport function cleanup(root?: Document | ShadowRoot): void {\n return getGlobalInjector().cleanup(root);\n}\n\n/**\n * Count a render, so that a collection pass is scheduled every\n * `gc.touchInterval` of them. Used internally by computeStyles and tasty().\n *\n * @deprecated The class name is ignored — collection asks the DOM what is\n * rendered rather than recording usage per class. The argument is kept so\n * existing calls still compile.\n */\nexport function touch(\n className: string,\n options?: { root?: Document | ShadowRoot },\n): void {\n if (!getConfig().gc) return;\n getGlobalInjector().touch(className, options);\n}\n\n/**\n * Synchronous garbage collection of unused styles — those no element carries\n * and no `inject()` handle references. Evicts the oldest ones once they exceed\n * capacity. With `{ force: true }`, removes all of them regardless of capacity.\n *\n * @returns Number of styles evicted.\n */\nexport function gc(options?: GCOptions): number {\n return getGlobalInjector().gc(options);\n}\n\n/**\n * Get the global injector instance for debugging\n */\nexport const injector = {\n get instance() {\n return getGlobalInjector();\n },\n};\n\n/**\n * Destroy all resources and clean up\n */\nexport function destroy(root?: Document | ShadowRoot): void {\n return getGlobalInjector().destroy(root);\n}\n\n/**\n * Create a new isolated injector instance\n */\nexport function createInjector(\n config: Partial<StyleInjectorConfig> = {},\n): StyleInjector {\n const defaultConfig = getConfig();\n\n const fullConfig: StyleInjectorConfig = {\n ...defaultConfig,\n // Auto-enable forceTextInjection in test environments\n forceTextInjection: config.forceTextInjection ?? isTestEnvironment(),\n ...config,\n };\n\n return new StyleInjector(fullConfig);\n}\n\n// Re-export types\nexport type {\n StyleInjectorConfig,\n InjectionMode,\n InjectOptions,\n InjectResult,\n DisposeFunction,\n RuleInfo,\n SheetInfo,\n RootRegistry,\n StyleRule,\n StyleUsage,\n KeyframesInfo,\n KeyframesResult,\n KeyframesSteps,\n KeyframesCacheEntry,\n CacheMetrics,\n RawCSSResult,\n PropertyDefinition,\n PropertyOptions,\n FontFaceDescriptors,\n FontFaceInput,\n CounterStyleDescriptors,\n FunctionDefinition,\n FunctionParameter,\n GCConfig,\n GCOptions,\n} from './types';\n\nexport { flushStyles, hasPendingStyleWrites, resetStyleBatch } from './batch';\nexport type { QueuedWrite } from './batch';\nexport { StyleInjector } from './injector';\nexport { SheetManager } from './sheet-manager';\nexport { ChunkSheetRegistry, chunkSheetRegistry } from './chunk-sheet-registry';\n","/**\n * Shared RSC (React Server Components) inline style cache.\n *\n * Uses React.cache for per-request memoization in Server Components.\n * Both computeStyles() and standalone style functions (useGlobalStyles,\n * useRawCSS, useKeyframes, useProperty, useFontFace, useCounterStyle)\n * share this cache so that CSS accumulated by standalone functions is\n * flushed into inline <style> tags by the next tasty() component.\n */\n\nimport { cache } from 'react';\n\nimport { getNamePrefix } from './config';\nimport type { ServerStyleCollector } from './ssr/collector';\nimport { getRegisteredSSRCollector } from './ssr/ssr-collector-ref';\nimport { hashString } from './utils/hash';\nimport { makeClassName } from './utils/name-prefix';\n\nexport interface RSCStyleCache {\n cacheKeyToClassName: Map<string, string>;\n emittedKeys: Set<string>;\n internalsEmitted: boolean;\n pendingCSS: string[];\n /** Maps dedup key -> its slot in `pendingCSS`, so slot-keyed CSS can be replaced. */\n keyToIndex: Map<string, number>;\n /** Maps dedup key -> generated name for keyframes and counter-styles in RSC mode. */\n generatedNames: Map<string, string>;\n}\n\n/**\n * Per-request RSC style cache using React.cache.\n * React.cache provides per-request memoization in Server Components,\n * so each request gets its own isolated cache.\n */\nexport const getRSCCache = cache((): RSCStyleCache => ({\n cacheKeyToClassName: new Map(),\n emittedKeys: new Set(),\n internalsEmitted: false,\n pendingCSS: [],\n keyToIndex: new Map(),\n generatedNames: new Map(),\n}));\n\nexport function rscAllocateClassName(\n rscCache: RSCStyleCache,\n cacheKey: string,\n): { className: string; isNew: boolean } {\n const existing = rscCache.cacheKeyToClassName.get(cacheKey);\n if (existing) return { className: existing, isNew: false };\n\n // Content-hash ensures stable names across all environments (RSC, SSR, client),\n // enabling cross-environment dedup and preventing class collisions.\n const className = makeClassName(getNamePrefix(), hashString(cacheKey));\n rscCache.cacheKeyToClassName.set(cacheKey, className);\n return { className, isNew: true };\n}\n\n/**\n * Flush any pending CSS accumulated by standalone functions.\n * Returns the CSS string and clears the buffer.\n */\nexport function flushPendingCSS(rscCache: RSCStyleCache): string {\n if (rscCache.pendingCSS.length === 0) return '';\n const css = rscCache.pendingCSS.join('\\n');\n rscCache.pendingCSS.length = 0;\n // The slots are gone with the buffer; a later replace has to append instead.\n rscCache.keyToIndex.clear();\n return css;\n}\n\n/**\n * Push CSS into the RSC pending buffer with dedup via emittedKeys.\n * Returns true if the CSS was added, false if it was already emitted.\n *\n * Pass `replace` for slot-keyed entries (an explicit `id`), where the last write\n * must win to match the client's update-tracking behavior. If the slot has\n * already been flushed into a `<style>` tag the new CSS is appended instead,\n * which still wins by cascade order.\n */\nexport function pushRSCCSS(\n rscCache: RSCStyleCache,\n key: string,\n css: string,\n replace?: boolean,\n): boolean {\n if (replace) {\n const pendingIndex = rscCache.keyToIndex.get(key);\n\n if (pendingIndex !== undefined) {\n rscCache.pendingCSS[pendingIndex] = css;\n return true;\n }\n } else if (rscCache.emittedKeys.has(key)) {\n return false;\n }\n\n rscCache.emittedKeys.add(key);\n rscCache.keyToIndex.set(key, rscCache.pendingCSS.length);\n rscCache.pendingCSS.push(css);\n return true;\n}\n\ntype StyleTarget =\n | { mode: 'ssr'; collector: ServerStyleCollector }\n | { mode: 'rsc'; cache: RSCStyleCache }\n | { mode: 'client' };\n\n/**\n * Determine the current style injection target.\n * Centralizes the three-way detection (SSR collector / RSC cache / client DOM)\n * used by all style functions.\n */\nexport function getStyleTarget(): StyleTarget {\n const collector = getRegisteredSSRCollector();\n if (collector) return { mode: 'ssr', collector };\n if (typeof document === 'undefined')\n return { mode: 'rsc', cache: getRSCCache() };\n return { mode: 'client' };\n}\n","/**\n * SSR / RSC auto-property inference.\n *\n * Scans rendered CSS declarations for custom properties whose types\n * can be inferred from their values (e.g. `--angle: 30deg` → `<angle>`).\n * Mirrors the client-side auto-inference in StyleInjector.inject().\n */\n\nimport type { StyleResult } from '../pipeline';\nimport { parsePropertyToken } from '../properties';\nimport { PropertyTypeResolver } from '../properties/property-type-resolver';\nimport type { RSCStyleCache } from '../rsc-cache';\nimport { pushRSCCSS } from '../rsc-cache';\nimport type { Styles } from '../styles/types';\n\nimport type { ServerStyleCollector } from './collector';\nimport { formatPropertyCSS } from './format-property';\n\n/**\n * Scan rendered rules for auto-inferable custom properties and emit\n * @property CSS via the provided callback.\n */\nfunction scanAndEmitAutoProperties(\n rules: StyleResult[],\n styles: Styles | undefined,\n emit: (name: string, css: string) => void,\n): void {\n const registered = new Set<string>();\n\n if (styles) {\n const localProps = styles['@property'];\n if (localProps && typeof localProps === 'object') {\n for (const token of Object.keys(localProps as Record<string, unknown>)) {\n const parsed = parsePropertyToken(token);\n if (parsed.isValid) {\n registered.add(parsed.cssName);\n }\n }\n }\n }\n\n const resolver = new PropertyTypeResolver();\n\n for (const rule of rules) {\n if (!rule.declarations) continue;\n resolver.scanDeclarations(\n rule.declarations,\n (name) => registered.has(name),\n (name, syntax, initialValue) => {\n registered.add(name);\n const css = formatPropertyCSS(name, {\n syntax,\n inherits: true,\n initialValue,\n });\n if (css) {\n emit(name, css);\n }\n },\n );\n }\n}\n\n/**\n * Scan rendered rules for custom property declarations and collect\n * auto-inferred @property rules via the SSR collector.\n *\n * @param rules - Rendered style rules containing CSS declarations\n * @param collector - SSR collector to emit @property CSS into\n * @param styles - Original styles object (used to skip explicit @property)\n */\nexport function collectAutoInferredProperties(\n rules: StyleResult[],\n collector: ServerStyleCollector,\n styles?: Styles,\n): void {\n scanAndEmitAutoProperties(rules, styles, (name, css) => {\n collector.collectProperty(`__auto:${name}`, css);\n });\n}\n\n/**\n * RSC variant: scan rendered rules and push auto-inferred @property CSS\n * into the RSC pending buffer.\n */\nexport function collectAutoInferredPropertiesRSC(\n rules: StyleResult[],\n rscCache: RSCStyleCache,\n styles?: Styles,\n): void {\n scanAndEmitAutoProperties(rules, styles, (name, css) => {\n pushRSCCSS(rscCache, `__auto:${name}`, css);\n });\n}\n","/**\n * Format @keyframes CSS rules for SSR output.\n *\n * Replicates the stepsToCSS logic from SheetManager but as a\n * standalone function that doesn't need DOM access.\n */\n\nimport type { KeyframesSteps } from '../injector/types';\nimport { createStyle, STYLE_HANDLER_MAP } from '../styles';\nimport type { CSSMap, StyleHandler, StyleValueStateMap } from '../utils/styles';\n\n/**\n * Convert keyframes steps to a CSS string.\n * Replicates SheetManager.stepsToCSS() without the class instance.\n */\nfunction stepsToCSS(steps: KeyframesSteps): string {\n const rules: string[] = [];\n\n for (const [key, value] of Object.entries(steps)) {\n if (typeof value === 'string') {\n rules.push(`${key} { ${value.trim()} }`);\n continue;\n }\n\n const styleMap = (value || {}) as StyleValueStateMap;\n const styleNames = Object.keys(styleMap).sort();\n const handlerQueue: StyleHandler[] = [];\n const seenHandlers = new Set<StyleHandler>();\n\n styleNames.forEach((styleName) => {\n let handlers = STYLE_HANDLER_MAP[styleName];\n if (!handlers) {\n handlers = STYLE_HANDLER_MAP[styleName] = [createStyle(styleName)];\n }\n\n handlers.forEach((handler) => {\n if (!seenHandlers.has(handler)) {\n seenHandlers.add(handler);\n handlerQueue.push(handler);\n }\n });\n });\n\n const declarationPairs: { prop: string; value: string }[] = [];\n\n handlerQueue.forEach((handler) => {\n const lookup = handler.__lookupStyles;\n const filteredMap = lookup.reduce<StyleValueStateMap>((acc, name) => {\n const v = styleMap[name];\n if (v !== undefined) acc[name] = v;\n return acc;\n }, {});\n\n const result = handler(filteredMap);\n if (!result) return;\n\n const results = Array.isArray(result) ? result : [result];\n results.forEach((cssMap) => {\n if (!cssMap || typeof cssMap !== 'object') return;\n const { $: _$, ...props } = cssMap as CSSMap;\n\n Object.entries(props).forEach(([prop, val]) => {\n if (val == null || val === '') return;\n\n if (Array.isArray(val)) {\n val.forEach((v) => {\n if (v != null && v !== '') {\n declarationPairs.push({ prop, value: String(v) });\n }\n });\n } else {\n declarationPairs.push({ prop, value: String(val) });\n }\n });\n });\n });\n\n const declarations = declarationPairs\n .map((d) => `${d.prop}: ${d.value}`)\n .join('; ');\n\n rules.push(`${key} { ${declarations.trim()} }`);\n }\n\n return rules.join(' ');\n}\n\n/**\n * Format a @keyframes rule as a CSS string.\n */\nexport function formatKeyframesCSS(\n name: string,\n steps: KeyframesSteps,\n): string {\n const cssSteps = stepsToCSS(steps);\n return `@keyframes ${name} { ${cssSteps} }`;\n}\n","/**\n * Check if an object has any own enumerable keys.\n * Avoids the array allocation of Object.keys(obj).length > 0.\n */\nexport function hasKeys(obj: object): boolean {\n for (const _ in obj) return true;\n return false;\n}\n","/**\n * Hook-free, synchronous style computation.\n *\n * Extracts the core logic from useStyles() into a plain function that can\n * be called during React render without any hooks. Three code paths:\n *\n * 1. SSR collector — styles collected via ServerStyleCollector\n * 2. Client inject — styles injected synchronously into the DOM\n * 3. RSC inline — styles returned as CSS strings for inline <style> emission\n *\n * This enables tasty() components to work as React Server Components.\n */\n\nimport {\n categorizeStyleKeys,\n generateChunkCacheKey,\n renderStylesForChunk,\n} from './chunks';\nimport {\n getConfig,\n getGlobalKeyframes,\n hasGlobalKeyframes,\n isFunctionsPolyfillEnabled,\n} from './config';\nimport {\n counterStyle,\n fontFace,\n func,\n inject,\n holdKeyframes,\n ownKeyframes,\n property,\n touch,\n} from './injector';\nimport type { FontFaceDescriptors, KeyframesSteps } from './injector/types';\nimport {\n extractLocalCounterStyle,\n formatCounterStyleRule,\n hasLocalCounterStyle,\n} from './counter-style';\nimport {\n extractLocalFunctions,\n formatFunctionRule,\n hasLocalFunctions,\n parseFunctionName,\n registerLocalFunctionPolyfills,\n} from './functions';\nimport {\n extractLocalFontFace,\n fontFaceContentHash,\n formatFontFaceRule,\n hasLocalFontFace,\n} from './font-face';\nimport {\n extractAnimationNamesFromStyles,\n extractLocalKeyframes,\n filterUsedKeyframes,\n hasLocalKeyframes,\n mergeKeyframes,\n referencesAnimation,\n resolveKeyframesNames,\n replaceAnimationNames,\n} from './keyframes';\nimport type { RenderResult, StyleResult } from './pipeline';\nimport {\n flushPendingCSS,\n getRSCCache,\n rscAllocateClassName,\n} from './rsc-cache';\nimport type { RSCStyleCache } from './rsc-cache';\nimport { extractLocalProperties, hasLocalProperties } from './properties';\nimport { collectAutoInferredProperties } from './ssr/collect-auto-properties';\nimport type { ServerStyleCollector } from './ssr/collector';\nimport { formatKeyframesCSS } from './ssr/format-keyframes';\nimport { formatPropertyCSS } from './ssr/format-property';\nimport { formatRules } from './ssr/format-rules';\nimport { getRegisteredSSRCollector } from './ssr/ssr-collector-ref';\nimport type { Styles } from './styles/types';\nimport { hasKeys } from './utils/has-keys';\nimport { resolveRecipes } from './utils/resolve-recipes';\n\nexport interface ComputeStylesResult {\n className: string;\n /** CSS text to emit as an inline <style> tag (RSC mode only). */\n css?: string;\n}\n\nexport interface ComputeStylesOptions {\n ssrCollector?: ServerStyleCollector | null;\n /** Target root for style injection (client only). Defaults to `document`. */\n root?: Document | ShadowRoot;\n /**\n * Set when `styles` outlives this call and will be passed in again — a\n * `tasty()` factory's own styles object rather than a per-render merge.\n * It lets chunk cache keys be memoized on the object, which is worth the\n * bookkeeping only when there is a next render to spend it on.\n */\n stableStyles?: boolean;\n}\n\ninterface ProcessedChunk {\n name: string;\n styleKeys: string[];\n cacheKey: string;\n renderResult: RenderResult;\n className: string;\n /** Local animations this chunk runs, by their authored names. */\n animations?: string[];\n}\n\nconst EMPTY_RESULT: ComputeStylesResult = { className: '' };\n\n// ---------------------------------------------------------------------------\n// RSC (React Server Components) inline style support\n// ---------------------------------------------------------------------------\n\n/**\n * Mark internals as emitted for this RSC request.\n *\n * Internals (tokens, @property, @font-face, @counter-style) are emitted\n * exclusively by the SSR collector via ServerStyleCollector.collectInternals().\n * The SSR path is reliable because TastyRegistry is always present as a\n * client component in the root layout, guaranteeing SSR runs for every page.\n *\n * Previously this function also emitted internals and coordinated with SSR\n * via a globalThis flag, but that flag leaked across requests in the same\n * Node.js process, causing pages without RSC-rendered tasty components\n * (e.g. the playground route) to lose all token CSS.\n */\nfunction collectInternalsRSC(rscCache: RSCStyleCache): string {\n if (rscCache.internalsEmitted) return '';\n rscCache.internalsEmitted = true;\n\n return '';\n}\n\n/**\n * Collect per-component ancillary CSS (keyframes, @property, font-face,\n * counter-style) for RSC mode.\n */\nfunction collectAncillaryRSC(rscCache: RSCStyleCache, styles: Styles): string {\n const parts: string[] = [];\n\n const usedKf = getUsedKeyframes(styles);\n const rscKeyframeNames = usedKf ? resolveKeyframesNames(usedKf) : null;\n if (usedKf && rscKeyframeNames) {\n for (const [authored, steps] of Object.entries(usedKf)) {\n const name = rscKeyframeNames.get(authored) as string;\n const key = `__kf:${name}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatKeyframesCSS(name, steps));\n }\n }\n }\n\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n const key = `__prop:${token}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n const css = formatPropertyCSS(token, definition);\n if (css) parts.push(css);\n }\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const key = `__ff:${hash}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatFontFaceRule(family, desc));\n }\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n const key = `__cs:${name}:${JSON.stringify(descriptors)}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatCounterStyleRule(name, descriptors));\n }\n }\n }\n }\n\n if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {\n const localFunctions = extractLocalFunctions(styles);\n if (localFunctions) {\n for (const [name, definition] of Object.entries(localFunctions)) {\n const key = `__func:${parseFunctionName(name)}`;\n if (!rscCache.emittedKeys.has(key)) {\n rscCache.emittedKeys.add(key);\n parts.push(formatFunctionRule(name, definition));\n }\n }\n }\n }\n\n return parts.join('\\n');\n}\n\n/**\n * Process all chunks in RSC mode: render CSS to strings, allocate classNames,\n * and return combined { className, css }.\n */\nfunction computeStylesRSC(\n styles: Styles,\n chunkMap: Map<string, string[]>,\n stableStyles: boolean,\n): ComputeStylesResult {\n const rscCache = getRSCCache();\n const cssParts: string[] = [];\n const classNames: string[] = [];\n const rscUsedKf = getUsedKeyframes(styles);\n const rscKeyframeNames = rscUsedKf ? resolveKeyframesNames(rscUsedKf) : null;\n\n // Flush CSS accumulated by standalone style functions\n const pendingCSS = flushPendingCSS(rscCache);\n if (pendingCSS) cssParts.push(pendingCSS);\n\n const internalsCSS = collectInternalsRSC(rscCache);\n if (internalsCSS) cssParts.push(internalsCSS);\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n if (chunkStyleKeys.length === 0) continue;\n\n const baseKey = generateChunkCacheKey(\n styles,\n chunkName,\n chunkStyleKeys,\n stableStyles,\n );\n\n // Rendered before the class is allocated, for the same reason as the other\n // two paths: the key has to carry which keyframes these rules animate.\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n chunkStyleKeys,\n );\n if (renderResult.rules.length === 0) continue;\n\n const { rules, cacheKey } = applyKeyframeNames(\n renderResult.rules,\n baseKey,\n rscKeyframeNames,\n );\n\n const { className, isNew } = rscAllocateClassName(rscCache, cacheKey);\n classNames.push(className);\n\n if (isNew) {\n const css = formatRules(rules, className);\n if (css) cssParts.push(css);\n }\n }\n\n const ancillaryCSS = collectAncillaryRSC(rscCache, styles);\n if (ancillaryCSS) cssParts.push(ancillaryCSS);\n\n if (classNames.length === 0) return EMPTY_RESULT;\n\n const css = cssParts.join('\\n');\n\n return {\n className: classNames.join(' '),\n css: css || undefined,\n };\n}\n\n/**\n * Get keyframes that are actually used in styles.\n * Returns null if no keyframes are used (fast path for zero overhead).\n */\nfunction getUsedKeyframes(\n styles: Styles,\n): Record<string, KeyframesSteps> | null {\n const hasLocal = hasLocalKeyframes(styles);\n const hasGlobal = hasGlobalKeyframes();\n if (!hasLocal && !hasGlobal) return null;\n\n const usedNames = extractAnimationNamesFromStyles(styles);\n if (usedNames.size === 0) return null;\n\n const local = hasLocal ? extractLocalKeyframes(styles) : null;\n const global = hasGlobal ? getGlobalKeyframes() : null;\n const allKeyframes = mergeKeyframes(local, global);\n\n return filterUsedKeyframes(allKeyframes, usedNames);\n}\n\n/**\n * Process a chunk on the SSR path: allocate via collector, render, collect CSS.\n */\nfunction processChunkSSR(\n collector: ServerStyleCollector,\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n stableStyles: boolean,\n keyframeNames?: Map<string, string> | null,\n): ProcessedChunk | null {\n if (styleKeys.length === 0) return null;\n\n const baseKey = generateChunkCacheKey(\n styles,\n chunkName,\n styleKeys,\n stableStyles,\n );\n\n // Rendered before the class is allocated: the key has to carry which\n // keyframes these rules animate, or two components authoring the same\n // shorthand over different definitions would share a class here and\n // disagree with the client, which does carry it.\n const renderResult = renderStylesForChunk(styles, chunkName, styleKeys);\n if (renderResult.rules.length === 0) return null;\n\n const { animations, rules, cacheKey } = applyKeyframeNames(\n renderResult.rules,\n baseKey,\n keyframeNames,\n );\n\n const { className, isNewAllocation } = collector.allocateClassName(cacheKey);\n\n if (isNewAllocation) {\n collector.collectChunk(cacheKey, className, rules);\n return {\n name: chunkName,\n styleKeys,\n cacheKey,\n renderResult: { ...renderResult, rules },\n className,\n animations,\n };\n }\n\n return {\n name: chunkName,\n styleKeys,\n cacheKey,\n renderResult: { rules: [] },\n className,\n };\n}\n\n/**\n * Point a chunk's rules at the resolved keyframe names, and fold those names\n * into its cache key.\n *\n * Both halves matter, and both have to happen before the rules are written\n * anywhere: the declarations have to name the animation that will exist, and\n * the key has to distinguish two components that authored the same shorthand\n * over different definitions. Shared by the client and the server so they\n * cannot disagree about either.\n */\nfunction applyKeyframeNames(\n ruleset: StyleResult[],\n baseKey: string,\n keyframeNames?: Map<string, string> | null,\n): { animations: string[]; rules: StyleResult[]; cacheKey: string } {\n if (!keyframeNames || keyframeNames.size === 0) {\n return { animations: [], rules: ruleset, cacheKey: baseKey };\n }\n\n // Whole tokens only, so `crossfade` is not a use of `fade`.\n const animations = [...keyframeNames.keys()].filter((authored) =>\n ruleset.some((rule) => referencesAnimation(rule.declarations, authored)),\n );\n\n if (animations.length === 0) {\n return { animations, rules: ruleset, cacheKey: baseKey };\n }\n\n const rules = ruleset.map((rule) => ({\n ...rule,\n declarations: replaceAnimationNames(rule.declarations, keyframeNames),\n }));\n\n const cacheKey = `${baseKey}\\u0000kf:${animations\n .map((authored) => `${authored}=${keyframeNames.get(authored)}`)\n .sort()\n .join(',')}`;\n\n return { animations, rules, cacheKey };\n}\n\n/**\n * Process a chunk on the client: render, allocate className, and inject\n * CSS synchronously. The injector's cache makes this idempotent.\n */\nfunction processChunkSync(\n styles: Styles,\n chunkName: string,\n styleKeys: string[],\n stableStyles: boolean,\n root?: Document | ShadowRoot,\n keyframeNames?: Map<string, string> | null,\n): ProcessedChunk | null {\n if (styleKeys.length === 0) return null;\n\n const cacheKey = generateChunkCacheKey(\n styles,\n chunkName,\n styleKeys,\n stableStyles,\n );\n const renderResult = renderStylesForChunk(\n styles,\n chunkName,\n styleKeys,\n cacheKey,\n );\n if (renderResult.rules.length === 0) return null;\n\n const {\n animations,\n rules,\n cacheKey: injectKey,\n } = applyKeyframeNames(renderResult.rules, cacheKey, keyframeNames);\n\n // `pin: false` — the render path keeps no dispose handle; the DOM is the\n // record of use, and `gc()` reclaims the class once no element carries it.\n const { className } = inject(rules, {\n cacheKey: injectKey,\n root,\n pin: false,\n });\n\n return {\n name: chunkName,\n styleKeys,\n cacheKey: injectKey,\n renderResult: { ...renderResult, rules },\n className,\n animations,\n };\n}\n\n/**\n * Inject all ancillary rules (properties, font-faces, counter-styles) synchronously.\n */\nfunction injectAncillarySync(\n styles: Styles,\n root?: Document | ShadowRoot,\n): void {\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n property(token, { ...definition, root });\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n fontFace(family, desc, { root });\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n counterStyle(name, descriptors, { root });\n }\n }\n }\n\n if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {\n const localFunctions = extractLocalFunctions(styles);\n if (localFunctions) {\n for (const [name, definition] of Object.entries(localFunctions)) {\n func(name, definition, { root });\n }\n }\n }\n}\n\n/**\n * Collect all ancillary rules into the SSR collector.\n */\nfunction collectAncillarySSR(\n collector: ServerStyleCollector,\n styles: Styles,\n chunks: ProcessedChunk[],\n): void {\n const usedKf = getUsedKeyframes(styles);\n if (usedKf) {\n // Emitted under the resolved name, so two different `fade` definitions are\n // two rules rather than one deduplicated by name — and so the client\n // agrees about which one a class animates.\n const names = resolveKeyframesNames(usedKf);\n for (const [authored, steps] of Object.entries(usedKf)) {\n const name = names.get(authored) as string;\n collector.collectKeyframes(name, formatKeyframesCSS(name, steps));\n }\n }\n\n if (hasLocalProperties(styles)) {\n const localProperties = extractLocalProperties(styles);\n if (localProperties) {\n for (const [token, definition] of Object.entries(localProperties)) {\n const css = formatPropertyCSS(token, definition);\n if (css) {\n collector.collectProperty(token, css);\n }\n }\n }\n }\n\n if (hasLocalFontFace(styles)) {\n const localFontFace = extractLocalFontFace(styles);\n if (localFontFace) {\n for (const [family, input] of Object.entries(localFontFace)) {\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n collector.collectFontFace(hash, css);\n }\n }\n }\n }\n\n if (hasLocalCounterStyle(styles)) {\n const localCounterStyle = extractLocalCounterStyle(styles);\n if (localCounterStyle) {\n for (const [name, descriptors] of Object.entries(localCounterStyle)) {\n const css = formatCounterStyleRule(name, descriptors);\n collector.collectCounterStyle(name, css);\n }\n }\n }\n\n if (!isFunctionsPolyfillEnabled() && hasLocalFunctions(styles)) {\n const localFunctions = extractLocalFunctions(styles);\n if (localFunctions) {\n for (const [name, definition] of Object.entries(localFunctions)) {\n const css = formatFunctionRule(name, definition);\n collector.collectFunction(parseFunctionName(name), css);\n }\n }\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n const allRules = chunks.flatMap((c) => c.renderResult.rules);\n if (allRules.length > 0) {\n collectAutoInferredProperties(allRules, collector, styles);\n }\n }\n}\n\n/**\n * Synchronous, hook-free style computation.\n *\n * Resolves recipes, categorizes style keys into chunks, renders CSS rules,\n * allocates class names, and injects / collects / returns the CSS.\n *\n * Three code paths:\n * 1. SSR collector — discovered via ALS or passed explicitly; CSS collected\n * 2. RSC inline — no collector and no `document`; CSS returned as `result.css`\n * for the caller to emit as an inline `<style>` tag\n * 3. Client inject — CSS injected synchronously into the DOM (idempotent)\n *\n * @param styles - Tasty styles object (or undefined for no styles)\n * @param options - Optional SSR collector override\n */\nexport function computeStyles(\n styles: Styles | undefined,\n options?: ComputeStylesOptions,\n): ComputeStylesResult {\n if (!styles || !hasKeys(styles as Record<string, unknown>)) {\n return EMPTY_RESULT;\n }\n\n const resolved = resolveRecipes(styles);\n\n // Only the caller's own object can be declared reusable. When recipe\n // resolution rewrites it, `resolved` is a fresh per-render object and\n // memoizing on it would be pure overhead.\n const stableStyles = options?.stableStyles === true && resolved === styles;\n\n // @function polyfill: register local definitions as inline closures BEFORE\n // any chunk is rendered, so call sites in this component expand to plain CSS.\n if (isFunctionsPolyfillEnabled() && hasLocalFunctions(resolved)) {\n registerLocalFunctionPolyfills(resolved);\n }\n\n const chunkMap = categorizeStyleKeys(resolved as Record<string, unknown>);\n\n const collector =\n options?.ssrCollector !== undefined\n ? options.ssrCollector\n : getRegisteredSSRCollector();\n\n const chunks: ProcessedChunk[] = [];\n\n if (collector) {\n collector.collectInternals();\n\n const ssrKf = getUsedKeyframes(resolved);\n const ssrKeyframeNames = ssrKf ? resolveKeyframesNames(ssrKf) : null;\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n const chunk = processChunkSSR(\n collector,\n resolved,\n chunkName,\n chunkStyleKeys,\n stableStyles,\n ssrKeyframeNames,\n );\n if (chunk) chunks.push(chunk);\n }\n\n collectAncillarySSR(collector, resolved, chunks);\n } else if (typeof document === 'undefined') {\n // RSC path: render CSS to strings for inline <style> emission\n return computeStylesRSC(resolved, chunkMap, stableStyles);\n } else {\n const root = options?.root;\n\n injectAncillarySync(resolved, root);\n\n const usedKf = getUsedKeyframes(resolved);\n\n // Names first, and resolved the same way on every path: the rules that\n // animate them carry the name, and a rule written before it is known\n // cannot be corrected afterwards.\n const keyframeNames = usedKf ? resolveKeyframesNames(usedKf) : null;\n const keyframeKeys =\n usedKf && keyframeNames\n ? holdKeyframes(usedKf, keyframeNames, { root })\n : null;\n\n for (const [chunkName, chunkStyleKeys] of chunkMap) {\n const chunk = processChunkSync(\n resolved,\n chunkName,\n chunkStyleKeys,\n stableStyles,\n root,\n keyframeNames,\n );\n if (chunk) chunks.push(chunk);\n }\n\n // Only the classes whose rules actually name the animation own it — one\n // that merely rendered alongside would keep it alive for its own lifetime.\n // The reference is taken once however many times this renders, and released\n // when the last owner is collected.\n if (keyframeKeys) {\n for (const chunk of chunks) {\n for (const authored of chunk.animations ?? []) {\n const key = keyframeKeys.get(authored);\n if (key) ownKeyframes(key, chunk.className, { root });\n }\n }\n }\n\n for (const chunk of chunks) {\n touch(chunk.className, { root });\n }\n }\n\n if (chunks.length === 0) return EMPTY_RESULT;\n if (chunks.length === 1) return { className: chunks[0].className };\n\n return { className: chunks.map((c) => c.className).join(' ') };\n}\n","const DOMPropNames = new Set(['id']);\n\nconst BasePropNames = new Set([\n 'role',\n 'as',\n 'element',\n 'css',\n 'qa',\n 'mods',\n 'qaVal',\n 'hidden',\n 'isHidden',\n 'disabled',\n 'isDisabled',\n 'children',\n 'style',\n 'className',\n 'href',\n 'target',\n 'tabIndex',\n]);\n\nconst ignoreEventPropsNames = new Set([\n 'onPress',\n 'onHoverStart',\n 'onHoverEnd',\n 'onPressStart',\n 'onPressEnd',\n]);\n\nconst propRe = /^((data-).*)$/;\nconst eventRe = /^on[A-Z].+$/;\n\ninterface PropsFilterOptions {\n // @deprecated\n labelable?: boolean;\n propNames?: Set<string>;\n eventProps?: boolean;\n}\n\n/**\n * Filters out all props that aren't valid DOM props or defined via override prop obj.\n * @param props - The component props to be filtered.\n * @param opts - Props to override.\n */\nexport function filterBaseProps<T extends object>(\n props: T,\n opts: PropsFilterOptions = {},\n): Partial<T> {\n const { propNames, eventProps } = opts;\n const filteredProps: Partial<T> = {};\n\n for (const prop in props) {\n if (\n Object.prototype.hasOwnProperty.call(props, prop) &&\n (DOMPropNames.has(prop) ||\n BasePropNames.has(prop) ||\n // Always preserve any ARIA attributes to maintain accessibility support.\n prop.startsWith('aria-') ||\n (eventProps &&\n eventRe.test(prop) &&\n !ignoreEventPropsNames.has(prop)) ||\n propNames?.has(prop) ||\n propRe.test(prop))\n ) {\n filteredProps[prop] = props[prop];\n }\n }\n\n return filteredProps;\n}\n","import { overrideColorAlpha } from './color-space';\n\nexport function color(name: string, opacity = 1) {\n if (opacity !== 1) {\n // The alpha slot takes a `<number>`, so the value goes in as authored —\n // no percentage conversion to introduce a float artifact.\n return overrideColorAlpha(`var(--${name}-color)`, String(opacity));\n }\n\n return `var(--${name}-color)`;\n}\n","import { Lru } from '../parser/lru';\n\n/**\n * Create a function that caches the result with LRU eviction.\n */\nexport function cacheWrapper<A, B, R>(\n handler: (firstArg: A, secondArg?: B) => R,\n limit = 1000,\n): (firstArg: A, secondArg?: B) => R {\n const cache = new Lru<string, R>(limit);\n\n return (firstArg: A, secondArg?: B) => {\n const key =\n typeof firstArg === 'string' && secondArg == null\n ? firstArg\n : JSON.stringify([firstArg, secondArg]);\n\n let result = cache.get(key);\n if (result === undefined) {\n result =\n secondArg == null ? handler(firstArg) : handler(firstArg, secondArg);\n cache.set(key, result);\n }\n return result;\n };\n}\n","/**\n * Generate data DOM attributes from modifier map.\n */\nimport type { AllBaseProps } from '../types';\n\nimport { cacheWrapper } from './cache-wrapper';\nimport { camelToKebab } from './case-converter';\n\nfunction modAttrs(map: AllBaseProps['mods']): Record<string, string> | null {\n return map\n ? Object.keys(map).reduce(\n (attrs, key) => {\n const value = map[key];\n\n // Skip null, undefined, false\n if (value == null || value === false) {\n return attrs;\n }\n\n const attrName = `data-${camelToKebab(key)}`;\n\n if (value === true) {\n // Boolean true: data-{name}=\"\"\n attrs[attrName] = '';\n } else if (typeof value === 'string') {\n // String value: data-{name}=\"value\"\n attrs[attrName] = value;\n } else if (typeof value === 'number') {\n // Number: convert to string\n attrs[attrName] = String(value);\n } else {\n // Reject other types (objects, arrays, functions)\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `[Tasty] Invalid mod value for \"${key}\". Expected boolean, string, or number, got ${typeof value}`,\n );\n }\n }\n\n return attrs;\n },\n {} as Record<string, string>,\n )\n : null;\n}\n\nconst _modAttrs = cacheWrapper(modAttrs);\n\nexport { _modAttrs as modAttrs };\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n// Convert complex js object to dot notation js object\n// url: https://github.com/vardars/dotize\n// author: vardars\n\nexport const dotize = {\n valTypes: {\n none: 'NONE',\n primitive: 'PRIM',\n object: 'OBJECT',\n array: 'ARRAY',\n },\n\n getValType: function (val) {\n if (!val || typeof val != 'object' || Array.isArray(val))\n return dotize.valTypes.primitive;\n if (typeof val == 'object') return dotize.valTypes.object;\n },\n\n getPathType: function (arrPath) {\n const arrPathTypes = [];\n for (const path in arrPath) {\n const pathVal = arrPath[path];\n if (!pathVal) arrPathTypes.push(dotize.valTypes.none);\n else if (dotize.isNumber(pathVal))\n arrPathTypes.push(dotize.valTypes.array);\n else arrPathTypes.push(dotize.valTypes.object);\n }\n return arrPathTypes;\n },\n\n isUndefined: function (obj) {\n return typeof obj == 'undefined';\n },\n\n isNumber: function (f) {\n return !isNaN(parseInt(f));\n },\n\n isEmptyObj: function (obj) {\n for (const prop in obj) {\n if (Object.hasOwnProperty.call(obj, prop)) return false;\n }\n\n return JSON.stringify(obj) === JSON.stringify({});\n },\n\n isPlainObject: function (obj) {\n if (typeof obj !== 'object' || obj === null) return false;\n\n return Object.getPrototypeOf(obj) === Object.prototype;\n },\n\n isNotObject: function (obj) {\n return !obj || !this.isPlainObject(obj);\n },\n\n isEmptyArray: function (arr) {\n return Array.isArray(arr) && arr.length == 0;\n },\n\n isNotArray: function (arr) {\n return Array.isArray(arr) == false;\n },\n\n removeEmptyArrayItem: function (arr) {\n return arr.filter(function (el) {\n return el != null && el != '';\n });\n },\n\n getFieldName: function (field, prefix, isRoot, isArrayItem, isArray) {\n if (isArray)\n return (\n (prefix ? prefix : '') +\n (dotize.isNumber(field)\n ? '[' + field + ']'\n : (isRoot && !prefix ? '' : '.') + field)\n );\n else if (isArrayItem) return (prefix ? prefix : '') + '[' + field + ']';\n else return (prefix ? prefix + '.' : '') + field;\n },\n\n startsWith: function (val, valToSearch) {\n return val.indexOf(valToSearch) == 0;\n },\n\n convert: function (obj, prefix = '') {\n let newObj = {};\n\n // primitives\n if (dotize.isNotObject(obj)) {\n if (prefix) {\n newObj[prefix] = obj;\n return newObj;\n } else {\n return obj;\n }\n }\n\n return (function recurse(o, p, isRoot) {\n const isArrayItem = Array.isArray(o);\n for (const f in o) {\n const currentProp = o[f];\n if (\n currentProp &&\n typeof currentProp === 'object' &&\n !Array.isArray(currentProp) &&\n dotize.isPlainObject(currentProp)\n ) {\n if (isArrayItem && dotize.isEmptyObj(currentProp) == false) {\n newObj = recurse(\n currentProp,\n dotize.getFieldName(f, p, isRoot, true),\n ); // array item object\n } else if (dotize.isEmptyObj(currentProp) == false) {\n newObj = recurse(currentProp, dotize.getFieldName(f, p, isRoot)); // object\n } else if (dotize.isEmptyObj(currentProp)) {\n newObj[dotize.getFieldName(f, p, isRoot, isArrayItem)] =\n currentProp;\n }\n } else {\n if (isArrayItem || dotize.isNumber(f)) {\n newObj[dotize.getFieldName(f, p, isRoot, true)] = currentProp; // array item primitive\n } else {\n newObj[dotize.getFieldName(f, p, isRoot)] = currentProp; // primitive\n }\n }\n }\n\n return newObj;\n })(obj, prefix, true);\n },\n\n backward: function (obj, prefix) {\n let newObj = {};\n const arStartRegex = /\\[(\\d+)\\]/g;\n\n // primitives\n if (dotize.isNotObject(obj) && dotize.isNotArray(obj)) {\n if (prefix) {\n return obj[prefix];\n } else {\n return obj;\n }\n }\n\n for (let tProp in obj) {\n const tPropVal = obj[tProp];\n\n if (prefix) {\n const prefixRegex = new RegExp('^' + prefix);\n tProp = tProp.replace(prefixRegex, '');\n }\n\n tProp = tProp.replace(arStartRegex, '.$1');\n\n if (dotize.startsWith(tProp, '.')) tProp = tProp.replace(/^\\./, '');\n\n const arrPath = tProp.split('.');\n const arrPathTypes = dotize.getPathType(arrPath);\n\n // has array on root\n if (\n !dotize.isUndefined(arrPathTypes) &&\n arrPathTypes[0] == dotize.valTypes.array &&\n Array.isArray(newObj) == false\n ) {\n newObj = [];\n }\n\n (function recurse(rPropVal, rObj, rPropValPrev, rObjPrev) {\n let currentPath = arrPath.shift();\n const currentPathType = arrPathTypes.shift();\n\n if (typeof currentPath == 'undefined' || currentPath == '') {\n newObj = rPropVal;\n return;\n }\n\n const isArray = currentPathType == dotize.valTypes.array;\n\n if (dotize.isNumber(currentPath)) currentPath = parseInt(currentPath);\n\n // has multiple levels\n if (arrPath.length > 0) {\n // is not assigned before\n if (typeof rObj[currentPath] == 'undefined') {\n if (isArray) {\n rObj[currentPath] = [];\n } else {\n rObj[currentPath] = {};\n }\n }\n\n recurse(rPropVal, rObj[currentPath], currentPath, rObj);\n return;\n }\n\n if (\n currentPathType == dotize.valTypes.array &&\n rPropValPrev &&\n rObjPrev\n ) {\n if (Array.isArray(rObjPrev[rPropValPrev]) == false)\n rObjPrev[rPropValPrev] = [];\n rObjPrev[rPropValPrev].push(rPropVal);\n } else {\n rObj[currentPath] = rPropVal;\n }\n })(tPropVal, newObj);\n }\n\n return newObj;\n },\n};\n","import type { Tokens, TokenValue } from '../types';\n\nimport type { CSSProperties } from './css-types';\n\nimport { normalizeDslName } from './string';\nimport { normalizeColorTokenValue, parseStyle } from './styles';\n\nexport { hslToRgbValues } from './color-math';\n\nconst devMode = process.env.NODE_ENV !== 'production';\n\n/**\n * Check if a value is a valid token value (string, number, or boolean - not object).\n * Returns false for `false` values (they mean \"skip this token\").\n */\nfunction isValidTokenValue(\n value: unknown,\n): value is Exclude<TokenValue, undefined | null | false> {\n if (value === undefined || value === null || value === false) {\n return false;\n }\n\n if (typeof value === 'object') {\n if (devMode) {\n console.warn(\n '[Tasty] Object values are not allowed in tokens prop. ' +\n 'Tokens do not support state-based styling. Use a primitive value instead.',\n );\n }\n return false;\n }\n\n return (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n}\n\n/**\n * Process a single token value through the tasty parser.\n * Numbers are converted to strings; 0 stays as \"0\".\n */\nfunction processTokenValue(value: string | number): string {\n if (typeof value === 'number') {\n // 0 should remain as \"0\", not converted to any unit\n if (value === 0) {\n return '0';\n }\n return parseStyle(String(value)).output;\n }\n return parseStyle(value).output;\n}\n\n/**\n * Resolve one `$name` / `#name` entry to the custom property it declares and\n * the value to declare, or `null` when the entry declares nothing.\n *\n * The two sigils differ only in the property name they build and in how `true`\n * is read: for a custom property it is the empty value, for a color it is\n * `transparent`.\n */\nfunction resolveTokenEntry(\n key: string,\n value: Exclude<TokenValue, undefined | null | false>,\n): [name: string, value: string] | null {\n const name = `--${normalizeDslName(key.slice(1))}`;\n\n if (key[0] === '$') {\n // Boolean true for custom properties converts to empty string (valid CSS value)\n return [name, processTokenValue(value === true ? '' : value)];\n }\n\n const colorValue = normalizeColorTokenValue(value);\n // Skip if normalized to null (shouldn't happen since false is filtered by isValidTokenValue)\n if (colorValue === null) return null;\n\n return [`${name}-color`, processTokenValue(colorValue)];\n}\n\n/**\n * Process tokens object into inline style properties.\n * - `$name` -> `--name` with the parsed value\n * - `#name` -> `--name-color` with the parsed value\n *\n * @param tokens - The tokens object to process\n * @returns CSSProperties object or undefined if no tokens to process\n */\nexport function processTokens(\n tokens: Tokens | undefined,\n): CSSProperties | undefined {\n if (!tokens) {\n return undefined;\n }\n\n const keys = Object.keys(tokens);\n if (keys.length === 0) {\n return undefined;\n }\n\n let result: Record<string, string> | undefined;\n\n for (const key of keys) {\n const value = tokens[key as keyof Tokens];\n\n // Skip undefined/null values\n if (!isValidTokenValue(value)) {\n continue;\n }\n\n if (key[0] !== '$' && key[0] !== '#') continue;\n\n const entry = resolveTokenEntry(key, value);\n if (!entry) continue;\n\n if (!result) result = {};\n result[entry[0]] = entry[1];\n }\n\n return result as CSSProperties | undefined;\n}\n","/* eslint-disable no-console */\nimport { CHUNK_NAMES } from './chunks/definitions';\nimport { getNamePrefix } from './config';\nimport { flushStyles, getCSSTextForNode, injector } from './injector';\nimport type { CacheMetrics, RootRegistry } from './injector/types';\nimport { isDevEnv } from './utils/is-dev-env';\nimport { tastyClassRegex } from './utils/name-prefix';\n\ndeclare global {\n interface Window {\n tastyDebug?: typeof tastyDebug;\n }\n}\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype CSSTarget =\n 'all' | 'global' | 'active' | 'unused' | 'page' | string | string[] | Element;\n\nexport interface DebugOptions {\n root?: Document | ShadowRoot;\n /** Suppress console logging and return data only (default: false) */\n raw?: boolean;\n}\n\nexport interface CSSOptions extends DebugOptions {\n prettify?: boolean;\n /** Read from stored source CSS (dev-mode only) instead of live CSSOM */\n source?: boolean;\n}\n\nexport interface DebugChunkInfo {\n className: string;\n chunkName: string | null;\n}\n\nexport interface InspectResult {\n element?: Element | null;\n classes: string[];\n chunks: DebugChunkInfo[];\n css: string;\n size: number;\n rules: number;\n}\n\nexport interface CacheStatus {\n classes: {\n active: string[];\n unused: string[];\n all: string[];\n };\n metrics: CacheMetrics | null;\n}\n\nexport interface ChunkBreakdown {\n byChunk: Record<\n string,\n { classes: string[]; cssSize: number; ruleCount: number }\n >;\n totalChunkTypes: number;\n totalClasses: number;\n}\n\nexport interface Summary {\n activeClasses: string[];\n /** Classes `gc({ force: true })` would delete right now. */\n unusedClasses: string[];\n /**\n * Held but in neither list: nothing renders them, yet collection will not\n * take them — inside the grace window, or pinned by an `inject()` handle.\n */\n hotClasses: string[];\n totalStyledClasses: string[];\n\n activeCSSSize: number;\n unusedCSSSize: number;\n globalCSSSize: number;\n rawCSSSize: number;\n keyframesCSSSize: number;\n propertyCSSSize: number;\n totalCSSSize: number;\n\n activeRuleCount: number;\n unusedRuleCount: number;\n globalRuleCount: number;\n rawRuleCount: number;\n keyframesRuleCount: number;\n propertyRuleCount: number;\n totalRuleCount: number;\n\n metrics: CacheMetrics | null;\n definedProperties: string[];\n definedKeyframes: { name: string; refCount: number }[];\n chunkBreakdown: ChunkBreakdown;\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\nfunction fmtSize(bytes: number): string {\n return bytes > 1024 ? `${(bytes / 1024).toFixed(1)}KB` : `${bytes}B`;\n}\n\nfunction countRules(css: string): number {\n return (css.match(/\\{[^}]*\\}/g) || []).length;\n}\n\nfunction sortTastyClasses(classes: Iterable<string>): string[] {\n // Class names use a base36 hash format (e.g. `t3a5f`), so sort lexicographically.\n return Array.from(classes).sort((a, b) => a.localeCompare(b));\n}\n\n/** A DOM root to read, or `null` when the environment has no DOM at all. */\ntype DebugRoot = Document | ShadowRoot | null;\n\n/**\n * The root these helpers read, or `null` where there is no DOM.\n *\n * `document` used to be a default parameter value, and a default is evaluated\n * at the call site — so every read below threw a bare `ReferenceError` under\n * Node, taking out five of the eight public methods. A debug utility must not\n * be able to fail an SSR render because a call was left in, so the DOM-less\n * case reports an empty result and says why.\n */\nfunction defaultRoot(): DebugRoot {\n return typeof document === 'undefined' ? null : document;\n}\n\nlet warnedNoDom = false;\n\n/** Say once why the numbers are empty. Silent under `{ raw: true }`. */\nfunction warnNoDom(raw: boolean): void {\n if (raw || warnedNoDom) return;\n warnedNoDom = true;\n console.warn(\n '[Tasty] tastyDebug reads the DOM and this environment has none, so the ' +\n 'result is empty. During SSR, read the ServerStyleCollector instead.',\n );\n}\n\n/**\n * The registry for `root`, with every queued write landed first.\n *\n * Every injector read API is a flush point, and the reads below reach past\n * those APIs straight into the registry and the sheet manager. Without this\n * they would report a batch window's contents as absent — a rule that is\n * enqueued but not yet in a sheet is missing from `globalRules`, from the\n * sheets, and from anything counting either.\n */\nfunction getRegistry(\n root: DebugRoot = defaultRoot(),\n): RootRegistry | undefined {\n if (!root) return undefined;\n flushStyles();\n\n return injector.instance._sheetManager?.getRegistry(root);\n}\n\nfunction findDomTastyClasses(root: DebugRoot = defaultRoot()): string[] {\n if (!root) return [];\n const classes = new Set<string>();\n const elements = (root as Document).querySelectorAll?.('[class]') || [];\n const classRegex = tastyClassRegex(getNamePrefix());\n elements.forEach((el) => {\n const attr = el.getAttribute('class');\n if (attr) {\n for (const cls of attr.split(/\\s+/)) {\n if (classRegex.test(cls)) classes.add(cls);\n }\n }\n });\n return sortTastyClasses(classes);\n}\n\n/**\n * Everything this injector holds in `root`, in the order the engine applies it,\n * with the sources kept byte-for-byte — trimming would report a total smaller\n * than one of its own parts whenever raw CSS has edge whitespace.\n */\nfunction getAllCSS(root: DebugRoot = defaultRoot()): string {\n const registry = getRegistry(root);\n const sheetManager = injector.instance._sheetManager;\n // `getRegistry` already returns nothing for a null root; the `!root` is what\n // narrows the type for the call below.\n if (!root || !registry || !sheetManager) return '';\n\n return sheetManager.getOwnedCSSInOrder(registry, root).join('\\n');\n}\n\n/**\n * The injector's own readers fall back to `document` when `root` is omitted, so\n * they have to be reached with a real root or not at all.\n */\nfunction cssTextForClasses(classNames: string[], root: DebugRoot): string {\n if (!root) return '';\n\n return injector.instance.getCSSTextForClasses(classNames, { root });\n}\n\nfunction getInjectorMetrics(root: DebugRoot): CacheMetrics | null {\n if (!root) return null;\n\n return injector.instance.getMetrics({ root });\n}\n\n/**\n * Injected classes that no element carries and nobody pinned — the exact set\n * `gc({ force: true })` would delete.\n *\n * Deliberately borrowed from the injector rather than recomputed here: the two\n * drifted apart once before, when this file still read \"unused\" off the pin\n * counts the render path had stopped maintaining.\n */\nfunction getUnusedClasses(root: DebugRoot = defaultRoot()): string[] {\n if (!root) return [];\n\n return sortTastyClasses(injector.instance.getUnusedClasses({ root }));\n}\n\n/** Every class this injector holds CSS for in `root`. */\nfunction getOwnedClasses(root: DebugRoot = defaultRoot()): string[] {\n const registry = getRegistry(root);\n if (!registry) return [];\n\n const owned: string[] = [];\n for (const [className, info] of registry.rules) {\n // A negative sheet index marks a class whose CSS this injector does not\n // hold: server-rendered, pre-allocated, or queued.\n if (info.sheetIndex >= 0) owned.push(className);\n }\n\n return sortTastyClasses(owned);\n}\n\n// ---------------------------------------------------------------------------\n// prettifyCSS — readable output for nested at-rules & comma selectors\n// ---------------------------------------------------------------------------\n\nfunction prettifyCSS(css: string): string {\n if (!css || !css.trim()) return '';\n\n const out: string[] = [];\n let depth = 0;\n const indent = () => ' '.repeat(depth);\n\n let normalized = css.replace(/\\s+/g, ' ').trim();\n // Ensure braces are surrounded by spaces for splitting\n normalized = normalized.replace(/\\s*\\{\\s*/g, ' { ');\n normalized = normalized.replace(/\\s*\\}\\s*/g, ' } ');\n normalized = normalized.replace(/;\\s*/g, '; ');\n\n const tokens = normalized.split(/\\s+/);\n let buf = '';\n\n for (const t of tokens) {\n if (t === '{') {\n // buf contains the selector / at-rule header\n const header = buf.trim();\n if (header) {\n // Split comma-separated selectors onto their own lines\n // but only if the comma is outside parentheses\n const parts = splitOutsideParens(header, ',');\n if (parts.length > 1) {\n out.push(\n parts\n .map((p, idx) =>\n idx === 0\n ? `${indent()}${p.trim()},`\n : `${indent()}${p.trim()}${idx < parts.length - 1 ? ',' : ''}`,\n )\n .join('\\n') + ' {',\n );\n } else {\n out.push(`${indent()}${header} {`);\n }\n } else {\n out.push(`${indent()}{`);\n }\n depth++;\n buf = '';\n } else if (t === '}') {\n // Flush any trailing declarations\n if (buf.trim()) {\n for (const decl of buf.split(';').filter((s) => s.trim())) {\n out.push(`${indent()}${decl.trim()};`);\n }\n buf = '';\n }\n depth = Math.max(0, depth - 1);\n out.push(`${indent()}}`);\n } else if (t.endsWith(';')) {\n buf += ` ${t}`;\n const full = buf.trim();\n if (full) out.push(`${indent()}${full}`);\n buf = '';\n } else {\n buf += ` ${t}`;\n }\n }\n if (buf.trim()) out.push(buf.trim());\n\n return out\n .filter((l) => l.trim())\n .join('\\n')\n .replace(/\\n{3,}/g, '\\n\\n')\n .trim();\n}\n\n/** Split `str` by `sep` only when not inside parentheses */\nfunction splitOutsideParens(str: string, sep: string): string[] {\n const parts: string[] = [];\n let depth = 0;\n let start = 0;\n for (let i = 0; i < str.length; i++) {\n const ch = str[i];\n if (ch === '(') depth++;\n else if (ch === ')') depth--;\n else if (depth === 0 && str.startsWith(sep, i)) {\n parts.push(str.slice(start, i));\n start = i + sep.length;\n }\n }\n parts.push(str.slice(start));\n return parts;\n}\n\n// ---------------------------------------------------------------------------\n// Chunk helpers\n// ---------------------------------------------------------------------------\n\nfunction extractChunkName(cacheKey: string): string | null {\n for (const part of cacheKey.split('\\0')) {\n if (part.startsWith('[states:')) continue;\n if (!part.includes(':') && part.length > 0) return part;\n }\n return null;\n}\n\nfunction getChunkForClass(\n className: string,\n root: DebugRoot = defaultRoot(),\n): string | null {\n const registry = getRegistry(root);\n if (!registry) return null;\n for (const [key, cn] of registry.cacheKeyToClassName) {\n if (cn === className) return extractChunkName(key);\n }\n return null;\n}\n\nfunction buildChunkBreakdown(root: DebugRoot = defaultRoot()): ChunkBreakdown {\n const registry = getRegistry(root);\n if (!root || !registry)\n return { byChunk: {}, totalChunkTypes: 0, totalClasses: 0 };\n\n const byChunk: ChunkBreakdown['byChunk'] = {};\n for (const [cacheKey, className] of registry.cacheKeyToClassName) {\n const chunk = extractChunkName(cacheKey) || 'unknown';\n if (!byChunk[chunk])\n byChunk[chunk] = { classes: [], cssSize: 0, ruleCount: 0 };\n byChunk[chunk].classes.push(className);\n const css = injector.instance.getCSSTextForClasses([className], { root });\n byChunk[chunk].cssSize += css.length;\n byChunk[chunk].ruleCount += countRules(css);\n }\n\n for (const entry of Object.values(byChunk)) {\n entry.classes = sortTastyClasses(entry.classes);\n }\n\n const totalClasses = Object.values(byChunk).reduce(\n (s, e) => s + e.classes.length,\n 0,\n );\n return {\n byChunk,\n totalChunkTypes: Object.keys(byChunk).length,\n totalClasses,\n };\n}\n\n// ---------------------------------------------------------------------------\n// Global-type CSS helper (internal only)\n// ---------------------------------------------------------------------------\n\n/**\n * Every prefix `registry.globalRules` is keyed by. Anything missing here is a\n * rule the summary would hold but never count, which is how the totals stopped\n * adding up the first time.\n */\nconst GLOBAL_RULE_PREFIXES = {\n global: 'global:',\n property: 'property:',\n fontFace: 'fontface:',\n counterStyle: 'counterstyle:',\n function: 'function:',\n} as const;\n\nfunction getGlobalTypeCSS(\n type: keyof typeof GLOBAL_RULE_PREFIXES | 'raw' | 'keyframes',\n root: DebugRoot = defaultRoot(),\n): { css: string; ruleCount: number; size: number } {\n const registry = getRegistry(root);\n if (!root || !registry) return { css: '', ruleCount: 0, size: 0 };\n\n const chunks: string[] = [];\n let rc = 0;\n\n if (type === 'raw') {\n // Raw blocks are kept by the sheet manager, not in `globalRules`, so the\n // prefix scan below never sees them — and their rules are counted from the\n // parsed sheet, since one raw block is one string but any number of rules.\n const css = injector.instance.getRawCSSText({ root });\n const sheetManager = injector.instance._sheetManager;\n\n return {\n css: prettifyCSS(css),\n ruleCount: sheetManager?.getRawRuleCount(root) ?? 0,\n size: css.length,\n };\n }\n\n if (type === 'keyframes') {\n for (const [, entry] of registry.keyframesCache) {\n const info = entry.info;\n const sheetInfo = registry.sheets[info.sheetIndex];\n const sm = injector.instance._sheetManager;\n const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;\n if (ss && info.ruleIndex < ss.cssRules.length) {\n const rule = ss.cssRules[info.ruleIndex];\n if (rule) {\n chunks.push(rule.cssText);\n rc++;\n }\n } else if (info.cssText) {\n chunks.push(info.cssText);\n rc++;\n }\n }\n } else {\n const prefix = GLOBAL_RULE_PREFIXES[type];\n for (const [key, ri] of registry.globalRules) {\n if (!key.startsWith(prefix)) continue;\n const sheetInfo = registry.sheets[ri.sheetIndex];\n const sm = injector.instance._sheetManager;\n const ss = sheetInfo && sm ? sm.getCSSSheet(sheetInfo) : null;\n if (ss) {\n const start = Math.max(0, ri.ruleIndex);\n const end = Math.min(\n ss.cssRules.length - 1,\n (ri.endRuleIndex as number) ?? ri.ruleIndex,\n );\n if (start >= 0 && end >= start && start < ss.cssRules.length) {\n for (let i = start; i <= end; i++) {\n const rule = ss.cssRules[i];\n if (rule) {\n chunks.push(rule.cssText);\n rc++;\n }\n }\n }\n } else if (ri.cssText?.length) {\n chunks.push(...ri.cssText);\n rc += ri.cssText.length;\n }\n }\n }\n\n const raw = chunks.join('\\n');\n return { css: prettifyCSS(raw), ruleCount: rc, size: raw.length };\n}\n\n// ---------------------------------------------------------------------------\n// Source CSS (dev-mode RuleInfo.cssText)\n// ---------------------------------------------------------------------------\n\nfunction getSourceCssForClasses(\n classNames: string[],\n root: DebugRoot = defaultRoot(),\n): string | null {\n const registry = getRegistry(root);\n if (!registry) return null;\n\n const chunks: string[] = [];\n let found = false;\n for (const cls of classNames) {\n const info = registry.rules.get(cls);\n if (info?.cssText?.length) {\n chunks.push(...info.cssText);\n found = true;\n }\n }\n return found ? chunks.join('\\n') : null;\n}\n\n// ---------------------------------------------------------------------------\n// Definitions helper (internal)\n// ---------------------------------------------------------------------------\n\nfunction getDefs(root: DebugRoot = defaultRoot()) {\n const registry = getRegistry(root);\n let properties: string[] = [];\n if (registry?.injectedProperties) {\n properties = Array.from(\n (registry.injectedProperties as Map<string, string>).keys(),\n ).sort();\n }\n\n const keyframes: { name: string; refCount: number }[] = [];\n if (registry) {\n for (const entry of registry.keyframesCache.values()) {\n keyframes.push({ name: entry.name, refCount: entry.refCount });\n }\n keyframes.sort((a, b) => a.name.localeCompare(b.name));\n }\n\n return { properties, keyframes };\n}\n\n// ---------------------------------------------------------------------------\n// Chunk display order\n// ---------------------------------------------------------------------------\n\nconst CHUNK_ORDER = [\n CHUNK_NAMES.COMBINED,\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];\n\n// ---------------------------------------------------------------------------\n// tastyDebug API\n// ---------------------------------------------------------------------------\n\nexport const tastyDebug = {\n css(target: CSSTarget, opts?: CSSOptions): string {\n const {\n root = defaultRoot(),\n prettify = true,\n raw = false,\n source = false,\n } = opts || {};\n if (!root) {\n warnNoDom(raw);\n\n return '';\n }\n let css = '';\n\n const classRegex = tastyClassRegex(getNamePrefix());\n if (source && typeof target === 'string' && classRegex.test(target)) {\n const src = getSourceCssForClasses([target], root);\n if (src) {\n css = src;\n } else {\n if (!raw) {\n console.warn(\n '[Tasty] source CSS not available (requires dev mode or TASTY_DEBUG=true). Falling back to live CSSOM.',\n );\n }\n css = injector.instance.getCSSTextForClasses([target], { root });\n }\n } else if (source && Array.isArray(target)) {\n const src = getSourceCssForClasses(target, root);\n if (src) {\n css = src;\n } else {\n if (!raw) {\n console.warn(\n '[Tasty] source CSS not available. Falling back to live CSSOM.',\n );\n }\n css = injector.instance.getCSSTextForClasses(target, { root });\n }\n } else if (typeof target === 'string') {\n if (target === 'all') {\n // Documented as component + global + raw, and raw has its own sheet.\n css = getAllCSS(root);\n } else if (target === 'global') {\n css = getGlobalTypeCSS('global', root).css;\n return css; // already prettified\n } else if (target === 'active') {\n const active = findDomTastyClasses(root);\n css = injector.instance.getCSSTextForClasses(active, { root });\n } else if (target === 'unused') {\n const unused = getUnusedClasses(root);\n css = injector.instance.getCSSTextForClasses(unused, { root });\n } else if (target === 'page') {\n css = getPageCSS(root);\n } else if (classRegex.test(target)) {\n css = injector.instance.getCSSTextForClasses([target], { root });\n } else {\n const el = (root as Document).querySelector?.(target);\n if (el) css = getCSSTextForNode(el, { root });\n }\n } else if (Array.isArray(target)) {\n css = injector.instance.getCSSTextForClasses(target, { root });\n } else if (target instanceof Element) {\n css = getCSSTextForNode(target, { root });\n }\n\n const result = prettify ? prettifyCSS(css) : css;\n\n if (!raw) {\n const label = Array.isArray(target) ? `[${target.join(', ')}]` : target;\n const rc = countRules(css);\n console.group(`CSS for ${label} (${rc} rules, ${fmtSize(css.length)})`);\n console.log(result || '(empty)');\n console.groupEnd();\n }\n\n return result;\n },\n\n inspect(target: string | Element, opts?: DebugOptions): InspectResult {\n const { root = defaultRoot(), raw = false } = opts || {};\n const element = !root\n ? null\n : typeof target === 'string'\n ? (root as Document).querySelector?.(target)\n : target;\n if (!root) warnNoDom(raw);\n\n if (!element) {\n const empty: InspectResult = {\n element: null,\n classes: [],\n chunks: [],\n css: '',\n size: 0,\n rules: 0,\n };\n // With no DOM at all, `warnNoDom` above already said why; \"element not\n // found\" would only misdirect.\n if (!raw && root)\n console.warn('[Tasty] debug.inspect: element not found');\n return empty;\n }\n\n const classList = element.getAttribute('class') || '';\n const classRegex = tastyClassRegex(getNamePrefix());\n const tastyClasses = classList\n .split(/\\s+/)\n .filter((cls) => classRegex.test(cls));\n\n const chunks: DebugChunkInfo[] = tastyClasses.map((className) => ({\n className,\n chunkName: getChunkForClass(className, root),\n }));\n\n const css = getCSSTextForNode(element, { root: root ?? undefined });\n const rules = countRules(css);\n\n const result: InspectResult = {\n element,\n classes: tastyClasses,\n chunks,\n css: prettifyCSS(css),\n size: css.length,\n rules,\n };\n\n if (!raw) {\n const tag = element.tagName.toLowerCase();\n const id = element.id ? `#${element.id}` : '';\n console.group(\n `inspect ${tag}${id} — ${tastyClasses.length} classes, ${rules} rules, ${fmtSize(css.length)}`,\n );\n if (chunks.length) {\n console.log(\n 'Chunks:',\n chunks.map((c) => `${c.className}→${c.chunkName || '?'}`).join(', '),\n );\n }\n console.groupCollapsed('CSS');\n console.log(result.css || '(empty)');\n console.groupEnd();\n console.groupEnd();\n }\n\n return result;\n },\n\n summary(opts?: DebugOptions): Summary {\n const { root = defaultRoot(), raw = false } = opts || {};\n if (!root) warnNoDom(raw);\n\n const activeClasses = findDomTastyClasses(root);\n const unusedClasses = getUnusedClasses(root);\n // Everything, not just the two bands above: a class that went cold a\n // moment ago is in neither, and dropping it here is the accounting failure\n // this whole change started from.\n const ownedClasses = getOwnedClasses(root);\n const totalStyledClasses = sortTastyClasses(\n new Set([...activeClasses, ...ownedClasses]),\n );\n const unusedSet = new Set(unusedClasses);\n const activeSet = new Set(activeClasses);\n const hotClasses = ownedClasses.filter(\n (className) => !activeSet.has(className) && !unusedSet.has(className),\n );\n const hotCSS = cssTextForClasses(hotClasses, root);\n\n const activeCSS = cssTextForClasses(activeClasses, root);\n const unusedCSS = cssTextForClasses(unusedClasses, root);\n const allCSS = getAllCSS(root);\n\n const activeRuleCount = countRules(activeCSS);\n const unusedRuleCount = countRules(unusedCSS);\n\n const globalData = getGlobalTypeCSS('global', root);\n const rawData = getGlobalTypeCSS('raw', root);\n const kfData = getGlobalTypeCSS('keyframes', root);\n const propData = getGlobalTypeCSS('property', root);\n // Folded into the global line rather than given their own: they are all\n // at-rules injected once and kept forever, and leaving them out of the\n // total is what made it not a total.\n const atRuleData = (\n ['fontFace', 'counterStyle', 'function'] as const\n ).reduce(\n (all, type) => {\n const data = getGlobalTypeCSS(type, root);\n return {\n css: data.css ? `${all.css}\\n${data.css}`.trim() : all.css,\n ruleCount: all.ruleCount + data.ruleCount,\n size: all.size + data.size,\n };\n },\n { css: '', ruleCount: 0, size: 0 },\n );\n\n const totalRuleCount =\n activeRuleCount +\n unusedRuleCount +\n countRules(hotCSS) +\n globalData.ruleCount +\n atRuleData.ruleCount +\n rawData.ruleCount +\n kfData.ruleCount +\n propData.ruleCount;\n\n const metrics = getInjectorMetrics(root);\n const defs = getDefs(root);\n const chunkBreakdown = buildChunkBreakdown(root);\n\n const summary: Summary = {\n activeClasses,\n unusedClasses,\n hotClasses,\n totalStyledClasses,\n activeCSSSize: activeCSS.length,\n unusedCSSSize: unusedCSS.length,\n globalCSSSize: globalData.size + atRuleData.size,\n rawCSSSize: rawData.size,\n keyframesCSSSize: kfData.size,\n propertyCSSSize: propData.size,\n totalCSSSize: allCSS.length,\n activeRuleCount,\n unusedRuleCount,\n globalRuleCount: globalData.ruleCount + atRuleData.ruleCount,\n rawRuleCount: rawData.ruleCount,\n keyframesRuleCount: kfData.ruleCount,\n propertyRuleCount: propData.ruleCount,\n totalRuleCount,\n metrics,\n definedProperties: defs.properties,\n definedKeyframes: defs.keyframes,\n chunkBreakdown,\n };\n\n if (!raw) {\n console.group('Tasty Summary');\n console.log(\n `Active: ${activeClasses.length} classes, ${activeRuleCount} rules, ${fmtSize(activeCSS.length)}`,\n );\n console.log(\n `Unused: ${unusedClasses.length} classes, ${unusedRuleCount} rules, ${fmtSize(unusedCSS.length)}`,\n );\n if (hotClasses.length)\n console.log(\n `Held: ${hotClasses.length} classes, ${countRules(hotCSS)} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`,\n );\n console.log(\n `Global: ${globalData.ruleCount + atRuleData.ruleCount} rules, ${fmtSize(globalData.size + atRuleData.size)}`,\n );\n if (rawData.ruleCount)\n console.log(\n `Raw: ${rawData.ruleCount} rules, ${fmtSize(rawData.size)}`,\n );\n if (kfData.ruleCount)\n console.log(\n `Keyframes: ${kfData.ruleCount} rules, ${fmtSize(kfData.size)}`,\n );\n if (propData.ruleCount)\n console.log(\n `@property: ${propData.ruleCount} rules, ${fmtSize(propData.size)}`,\n );\n console.log(\n `Total: ${totalStyledClasses.length} classes, ${totalRuleCount} rules, ${fmtSize(allCSS.length)}`,\n );\n\n if (metrics) {\n const total = metrics.hits + metrics.misses;\n const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;\n console.log(`Cache: ${rate}% hit rate (${total} lookups)`);\n }\n\n if (chunkBreakdown.totalChunkTypes > 0) {\n console.groupCollapsed(\n `Chunks (${chunkBreakdown.totalChunkTypes} types, ${chunkBreakdown.totalClasses} classes)`,\n );\n for (const name of CHUNK_ORDER) {\n const d = chunkBreakdown.byChunk[name];\n if (d)\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n for (const [name, d] of Object.entries(chunkBreakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n console.groupEnd();\n }\n\n if (defs.properties.length || defs.keyframes.length) {\n console.log(\n `Defs: ${defs.properties.length} @property, ${defs.keyframes.length} @keyframes`,\n );\n }\n\n console.groupEnd();\n }\n\n return summary;\n },\n\n chunks(opts?: DebugOptions): ChunkBreakdown {\n const { root = defaultRoot(), raw = false } = opts || {};\n if (!root) warnNoDom(raw);\n const breakdown = buildChunkBreakdown(root);\n\n if (!raw) {\n console.group(\n `Chunks (${breakdown.totalChunkTypes} types, ${breakdown.totalClasses} classes)`,\n );\n for (const name of CHUNK_ORDER) {\n const d = breakdown.byChunk[name];\n if (d)\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n for (const [name, d] of Object.entries(breakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${d.classes.length} cls, ${d.ruleCount} rules, ${fmtSize(d.cssSize)}`,\n );\n }\n console.groupEnd();\n }\n\n return breakdown;\n },\n\n cache(opts?: DebugOptions): CacheStatus {\n const { root = defaultRoot(), raw = false } = opts || {};\n if (!root) warnNoDom(raw);\n const active = findDomTastyClasses(root);\n const unused = getUnusedClasses(root);\n const metrics = getInjectorMetrics(root);\n\n // `all` is everything held, not the two bands above: a class that went cold\n // a moment ago is in neither, and it is still taking up a sheet.\n const all = sortTastyClasses(\n new Set([...active, ...getOwnedClasses(root)]),\n );\n\n const status: CacheStatus = {\n classes: { active, unused, all },\n metrics,\n };\n\n if (!raw) {\n console.group('Cache');\n console.log(`Active: ${active.length}, Unused: ${unused.length}`);\n if (metrics) {\n const total = metrics.hits + metrics.misses;\n const rate = total > 0 ? ((metrics.hits / total) * 100).toFixed(1) : 0;\n console.log(\n `Hits: ${metrics.hits}, Misses: ${metrics.misses}, Rate: ${rate}%`,\n );\n }\n console.groupEnd();\n }\n\n return status;\n },\n\n cleanup(opts?: { root?: Document | ShadowRoot }): void {\n const root = opts?.root ?? defaultRoot();\n if (!root) return;\n injector.instance.cleanup(root);\n },\n\n help(): void {\n console.log(`tastyDebug API:\n .summary() — overview (classes, rules, sizes)\n .css(\"active\") — CSS for classes in DOM\n .css(\"t42\") — CSS for a specific class\n .css(\"t42\",{source:1})— original CSS before browser parsing (dev only)\n .css(\".selector\") — CSS for a DOM element\n .inspect(\".selector\") — element details (classes, chunks, rules)\n .chunks() — style chunk breakdown\n .cache() — cache status and metrics\n .cleanup() — force unused style cleanup\nOptions: { raw: true } suppresses logging, { root: shadowRoot } targets Shadow DOM`);\n },\n\n install(): void {\n if (typeof window !== 'undefined' && window.tastyDebug !== tastyDebug) {\n window.tastyDebug = tastyDebug;\n console.log('tastyDebug installed. Run tastyDebug.help() for commands.');\n }\n },\n};\n\n// ---------------------------------------------------------------------------\n// Page CSS (minimal, kept internal)\n// ---------------------------------------------------------------------------\n\nfunction getPageCSS(root: DebugRoot = defaultRoot()): string {\n if (!root) return '';\n const chunks: string[] = [];\n try {\n if ('styleSheets' in root) {\n for (const sheet of Array.from((root as Document).styleSheets)) {\n try {\n if (sheet.cssRules)\n chunks.push(\n Array.from(sheet.cssRules)\n .map((r) => r.cssText)\n .join('\\n'),\n );\n } catch {\n /* cross-origin */\n }\n }\n }\n } catch {\n /* ignore */\n }\n return chunks.join('\\n');\n}\n\n// ---------------------------------------------------------------------------\n// Auto-install in development\n// ---------------------------------------------------------------------------\n\nif (typeof window !== 'undefined' && isDevEnv()) {\n tastyDebug.install();\n}\n"],"mappings":";;;;;;;AAEA,MAAM,eAAe;AACrB,MAAM,eACJ;;;;;;;;;;;;;;;AAgBF,SAAgB,qBAAqB,KAA4B;CAC/D,MAAM,IAAI,aAAa,KAAK,GAAG;CAC/B,IAAI,CAAC,GAAG,OAAO;CAEf,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY;CAG9B,gBAAgB;CAEhB,IAAI,EAAE,QADY,wBACI,IAAI,OAAO;CAEjC,MAAM,MAAM,gBAAgB,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC;CAC3C,IAAI,CAAC,OAAO,CAAC,aAAa,KAAK,GAAG,GAAG,OAAO;CAE5C,OAAO;AACT;;;;;;;;;;ACpBA,IAAa,qBAAb,MAAgC;CAC9B,yBAAiB,IAAI,IAAwB;CAC7C,8BAAsB,IAAI,QAA+B;;;;;CAMzD,QAAQ,SAAgC;EACtC,MAAM,OAAO,WAAW,OAAO;EAC/B,MAAM,WAAW,KAAK,OAAO,IAAI,IAAI;EAErC,IAAI,UAAU;GACZ,SAAS;GACT,OAAO,SAAS;EAClB;EAEA,MAAM,QAAQ,IAAI,cAAc;EAChC,MAAM,YAAY,OAAO;EAEzB,MAAM,QAAoB;GAAE;GAAO;GAAS,UAAU;EAAE;EACxD,KAAK,OAAO,IAAI,MAAM,KAAK;EAC3B,KAAK,YAAY,IAAI,OAAO,IAAI;EAEhC,OAAO;CACT;;;;;CAMA,QAAQ,OAA4B;EAClC,MAAM,OAAO,KAAK,YAAY,IAAI,KAAK;EACvC,IAAI,CAAC,MAAM;EAEX,MAAM,QAAQ,KAAK,OAAO,IAAI,IA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