@tenphi/tasty 3.9.6 → 3.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{build-config-DB-9eGX_.js → build-config-iyzPTrZa.js} +4 -4
- package/dist/chunks/{build-config-DB-9eGX_.js.map → build-config-iyzPTrZa.js.map} +1 -1
- package/dist/chunks/{collector-mNzcxM8C.js → collector-C4ouIOgI.js} +4 -4
- package/dist/chunks/{collector-mNzcxM8C.js.map → collector-C4ouIOgI.js.map} +1 -1
- package/dist/chunks/{config-engine-B8UiiDM4.js → config-engine-BAldIMv7.js} +3 -3
- package/dist/chunks/{config-engine-B8UiiDM4.js.map → config-engine-BAldIMv7.js.map} +1 -1
- package/dist/chunks/{css-definitions-BuuRO6lZ.js → css-definitions-BIgGXRLz.js} +2 -2
- package/dist/chunks/{css-definitions-BuuRO6lZ.js.map → css-definitions-BIgGXRLz.js.map} +1 -1
- package/dist/chunks/{debug-ly4pmDts.js → debug-CUDFFYpM.js} +4 -4
- package/dist/chunks/{debug-ly4pmDts.js.map → debug-CUDFFYpM.js.map} +1 -1
- package/dist/chunks/{react-runtime-CSae5AVk.js → react-runtime-46TyXx9v.js} +4 -4
- package/dist/chunks/react-runtime-46TyXx9v.js.map +1 -0
- package/dist/chunks/{runtime-engine-W-Xescje.js → runtime-engine-B_4lx2DJ.js} +7 -37
- package/dist/chunks/runtime-engine-B_4lx2DJ.js.map +1 -0
- package/dist/chunks/{runtime-state-naRtKzmd.js → runtime-state-BMtykrat.js} +2 -2
- package/dist/chunks/{runtime-state-naRtKzmd.js.map → runtime-state-BMtykrat.js.map} +1 -1
- package/dist/chunks/{style-engine-CuWAOWn0.js → style-engine-BpgmapBp.js} +57 -12
- package/dist/chunks/style-engine-BpgmapBp.js.map +1 -0
- package/dist/chunks/{zero-engine-BHLB88ki.js → zero-engine-DcjMs3WX.js} +3 -3
- package/dist/chunks/{zero-engine-BHLB88ki.js.map → zero-engine-DcjMs3WX.js.map} +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +6 -6
- package/dist/{index-CmrdZ8ay.d.ts → index-lhkF3ln5.d.ts} +6 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/ssr/astro.js +2 -2
- package/dist/ssr/index.js +2 -2
- package/dist/ssr/next-config.js +3 -3
- package/dist/ssr/next.js +3 -3
- package/dist/zero/babel.js +4 -4
- package/dist/zero/index.js +1 -1
- package/docs/ai-agents.md +2 -0
- package/docs/configuration.md +17 -1
- package/docs/dsl.md +20 -0
- package/docs/react-api.md +2 -0
- package/package.json +1 -1
- package/dist/chunks/react-runtime-CSae5AVk.js.map +0 -1
- package/dist/chunks/runtime-engine-W-Xescje.js.map +0 -1
- package/dist/chunks/style-engine-CuWAOWn0.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debug-ly4pmDts.js","names":[],"sources":["../../src/debug.ts"],"sourcesContent":["/* 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 { 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 for (const element of elements) {\n const attribute = element.getAttribute('class');\n if (!attribute) continue;\n for (const className of attribute.split(/\\s+/)) {\n if (classRegex.test(className)) classes.add(className);\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 rules\n// ---------------------------------------------------------------------------\n\nfunction prettifyCSS(css: string): string {\n if (!css || !css.trim()) return '';\n\n const out: string[] = [];\n let depth = 0;\n\n const lines = css\n .replace(/\\s+/g, ' ')\n .trim()\n .replaceAll(' {', '{')\n .replaceAll('{', ' {\\n')\n .replaceAll('}', '\\n}\\n')\n .replaceAll(';', ';\\n')\n .split('\\n');\n\n for (let line of lines) {\n line = line.trim();\n if (!line) continue;\n\n if (line === '}') {\n const last = out.at(-1);\n if (last && !/[;{}]$/.test(last)) {\n out[out.length - 1] += ';';\n }\n depth = Math.max(0, depth - 1);\n }\n out.push(`${' '.repeat(depth)}${line}`);\n if (line.endsWith('{')) depth++;\n }\n\n return out.join('\\n');\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 const entry = (byChunk[chunk] ??= {\n classes: [],\n cssSize: 0,\n ruleCount: 0,\n });\n entry.classes.push(className);\n const css = cssTextForClasses([className], root);\n entry.cssSize += css.length;\n entry.ruleCount += countRules(css);\n }\n\n const entries = Object.values(byChunk);\n for (const entry of entries) {\n entry.classes = sortTastyClasses(entry.classes);\n }\n\n const totalClasses = entries.reduce((sum, entry) => {\n return sum + entry.classes.length;\n }, 0);\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 includeCSS = true,\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 const sheetManager = injector.instance._sheetManager;\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\n return {\n css: includeCSS ? 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 ss =\n sheetInfo && sheetManager ? sheetManager.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 ss =\n sheetInfo && sheetManager ? sheetManager.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 {\n css: includeCSS ? prettifyCSS(raw) : '',\n ruleCount: rc,\n size: raw.length,\n };\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\nfunction logChunkEntries(breakdown: ChunkBreakdown): void {\n for (const name of CHUNK_ORDER) {\n const data = breakdown.byChunk[name];\n if (data)\n console.log(\n ` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`,\n );\n }\n for (const [name, data] of Object.entries(breakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`,\n );\n }\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 = cssTextForClasses([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 = cssTextForClasses(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 = cssTextForClasses(active, root);\n } else if (target === 'unused') {\n const unused = getUnusedClasses(root);\n css = cssTextForClasses(unused, root);\n } else if (target === 'page') {\n css = getPageCSS(root);\n } else if (classRegex.test(target)) {\n css = cssTextForClasses([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 = cssTextForClasses(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, false);\n const rawData = getGlobalTypeCSS('raw', root, false);\n const kfData = getGlobalTypeCSS('keyframes', root, false);\n const propData = getGlobalTypeCSS('property', root, false);\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 (total, type) => {\n const data = getGlobalTypeCSS(type, root, false);\n total.ruleCount += data.ruleCount;\n total.size += data.size;\n return total;\n },\n { ruleCount: 0, size: 0 },\n );\n\n const hotRuleCount = countRules(hotCSS);\n const globalRuleCount = globalData.ruleCount + atRuleData.ruleCount;\n const globalCSSSize = globalData.size + atRuleData.size;\n\n const totalRuleCount =\n activeRuleCount +\n unusedRuleCount +\n hotRuleCount +\n globalRuleCount +\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,\n rawCSSSize: rawData.size,\n keyframesCSSSize: kfData.size,\n propertyCSSSize: propData.size,\n totalCSSSize: allCSS.length,\n activeRuleCount,\n unusedRuleCount,\n globalRuleCount,\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, ${hotRuleCount} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`,\n );\n console.log(\n `Global: ${globalRuleCount} rules, ${fmtSize(globalCSSSize)}`,\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 logChunkEntries(chunkBreakdown);\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 logChunkEntries(breakdown);\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"],"mappings":";;;;AAqGA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,OAAO,IAAI,QAAQ,KAAA,CAAM,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;AACpE;AAEA,SAAS,WAAW,KAAqB;CACvC,QAAQ,IAAI,MAAM,YAAY,KAAK,CAAC,EAAA,CAAG;AACzC;AAEA,SAAS,iBAAiB,SAAqC;CAE7D,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAC9D;AAcA,SAAS,cAAyB;CAChC,OAAO,OAAO,aAAa,cAAc,OAAO;AAClD;AAEA,IAAI,cAAc;AAGlB,SAAS,UAAU,KAAoB;CACrC,IAAI,OAAO,aAAa;CACxB,cAAc;CACd,QAAQ,KACN,4IAEF;AACF;AAWA,SAAS,YACP,OAAkB,YAAY,GACJ;CAC1B,IAAI,CAAC,MAAM,OAAO,KAAA;CAClB,YAAY;CAEZ,OAAO,SAAS,SAAS,eAAe,YAAY,IAAI;AAC1D;AAEA,SAAS,oBAAoB,OAAkB,YAAY,GAAa;CACtE,IAAI,CAAC,MAAM,OAAO,CAAC;CACnB,MAAM,0BAAU,IAAI,IAAY;CAChC,MAAM,WAAY,KAAkB,mBAAmB,SAAS,KAAK,CAAC;CACtE,MAAM,aAAa,gBAAgB,cAAc,CAAC;CAClD,KAAK,MAAM,WAAW,UAAU;EAC9B,MAAM,YAAY,QAAQ,aAAa,OAAO;EAC9C,IAAI,CAAC,WAAW;EAChB,KAAK,MAAM,aAAa,UAAU,MAAM,KAAK,GAC3C,IAAI,WAAW,KAAK,SAAS,GAAG,QAAQ,IAAI,SAAS;CAEzD;CACA,OAAO,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QAAQ,GAAG,gBAAgB,IAAI,CAAC,CAAC,CAIhB;GAAE;GAC/B;EACF;EAEA,IAAI,CAAC,KAAK;GACR,QAAQ,MAAM,OAAO;GACrB,QAAQ,IAAI,WAAW,OAAO,OAAO,YAAY,OAAO,QAAQ;GAChE,IAAI,SAAS;IACX,MAAM,QAAQ,QAAQ,OAAO,QAAQ;IACrC,MAAM,OAAO,QAAQ,KAAM,QAAQ,OAAO,QAAS,IAAA,CAAK,QAAQ,CAAC,IAAI;IACrE,QAAQ,IACN,SAAS,QAAQ,KAAK,YAAY,QAAQ,OAAO,UAAU,KAAK,EAClE;GACF;GACA,QAAQ,SAAS;EACnB;EAEA,OAAO;CACT;CAEA,QAAQ,MAA+C;EACrD,MAAM,OAAO,MAAM,QAAQ,YAAY;EACvC,IAAI,CAAC,MAAM;EACX,SAAS,SAAS,QAAQ,IAAI;CAChC;CAEA,OAAa;EACX,QAAQ,IAAI;;;;;;;;;;mFAUmE;CACjF;CAEA,UAAgB;EACd,IAAI,OAAO,WAAW,eAAe,OAAO,eAAe,YAAY;GACrE,OAAO,aAAa;GACpB,QAAQ,IAAI,2DAA2D;EACzE;CACF;AACF;AAMA,SAAS,WAAW,OAAkB,YAAY,GAAW;CAC3D,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,SAAmB,CAAC;CAC1B,IAAI;EACF,IAAI,iBAAiB,MACnB,KAAK,MAAM,SAAS,MAAM,KAAM,KAAkB,WAAW,GAC3D,IAAI;GACF,IAAI,MAAM,UACR,OAAO,KACL,MAAM,KAAK,MAAM,QAAQ,CAAC,CACvB,KAAK,MAAM,EAAE,OAAO,CAAC,CACrB,KAAK,IAAI,CACd;EACJ,QAAQ,CAER;CAGN,QAAQ,CAER;CACA,OAAO,OAAO,KAAK,IAAI;AACzB"}
|
|
1
|
+
{"version":3,"file":"debug-CUDFFYpM.js","names":[],"sources":["../../src/debug.ts"],"sourcesContent":["/* 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 { 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 for (const element of elements) {\n const attribute = element.getAttribute('class');\n if (!attribute) continue;\n for (const className of attribute.split(/\\s+/)) {\n if (classRegex.test(className)) classes.add(className);\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 rules\n// ---------------------------------------------------------------------------\n\nfunction prettifyCSS(css: string): string {\n if (!css || !css.trim()) return '';\n\n const out: string[] = [];\n let depth = 0;\n\n const lines = css\n .replace(/\\s+/g, ' ')\n .trim()\n .replaceAll(' {', '{')\n .replaceAll('{', ' {\\n')\n .replaceAll('}', '\\n}\\n')\n .replaceAll(';', ';\\n')\n .split('\\n');\n\n for (let line of lines) {\n line = line.trim();\n if (!line) continue;\n\n if (line === '}') {\n const last = out.at(-1);\n if (last && !/[;{}]$/.test(last)) {\n out[out.length - 1] += ';';\n }\n depth = Math.max(0, depth - 1);\n }\n out.push(`${' '.repeat(depth)}${line}`);\n if (line.endsWith('{')) depth++;\n }\n\n return out.join('\\n');\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 const entry = (byChunk[chunk] ??= {\n classes: [],\n cssSize: 0,\n ruleCount: 0,\n });\n entry.classes.push(className);\n const css = cssTextForClasses([className], root);\n entry.cssSize += css.length;\n entry.ruleCount += countRules(css);\n }\n\n const entries = Object.values(byChunk);\n for (const entry of entries) {\n entry.classes = sortTastyClasses(entry.classes);\n }\n\n const totalClasses = entries.reduce((sum, entry) => {\n return sum + entry.classes.length;\n }, 0);\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 includeCSS = true,\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 const sheetManager = injector.instance._sheetManager;\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\n return {\n css: includeCSS ? 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 ss =\n sheetInfo && sheetManager ? sheetManager.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 ss =\n sheetInfo && sheetManager ? sheetManager.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 {\n css: includeCSS ? prettifyCSS(raw) : '',\n ruleCount: rc,\n size: raw.length,\n };\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\nfunction logChunkEntries(breakdown: ChunkBreakdown): void {\n for (const name of CHUNK_ORDER) {\n const data = breakdown.byChunk[name];\n if (data)\n console.log(\n ` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`,\n );\n }\n for (const [name, data] of Object.entries(breakdown.byChunk)) {\n if (!CHUNK_ORDER.includes(name as (typeof CHUNK_ORDER)[number]))\n console.log(\n ` ${name}: ${data.classes.length} cls, ${data.ruleCount} rules, ${fmtSize(data.cssSize)}`,\n );\n }\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 = cssTextForClasses([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 = cssTextForClasses(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 = cssTextForClasses(active, root);\n } else if (target === 'unused') {\n const unused = getUnusedClasses(root);\n css = cssTextForClasses(unused, root);\n } else if (target === 'page') {\n css = getPageCSS(root);\n } else if (classRegex.test(target)) {\n css = cssTextForClasses([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 = cssTextForClasses(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, false);\n const rawData = getGlobalTypeCSS('raw', root, false);\n const kfData = getGlobalTypeCSS('keyframes', root, false);\n const propData = getGlobalTypeCSS('property', root, false);\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 (total, type) => {\n const data = getGlobalTypeCSS(type, root, false);\n total.ruleCount += data.ruleCount;\n total.size += data.size;\n return total;\n },\n { ruleCount: 0, size: 0 },\n );\n\n const hotRuleCount = countRules(hotCSS);\n const globalRuleCount = globalData.ruleCount + atRuleData.ruleCount;\n const globalCSSSize = globalData.size + atRuleData.size;\n\n const totalRuleCount =\n activeRuleCount +\n unusedRuleCount +\n hotRuleCount +\n globalRuleCount +\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,\n rawCSSSize: rawData.size,\n keyframesCSSSize: kfData.size,\n propertyCSSSize: propData.size,\n totalCSSSize: allCSS.length,\n activeRuleCount,\n unusedRuleCount,\n globalRuleCount,\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, ${hotRuleCount} rules, ${fmtSize(hotCSS.length)} (not rendered, not yet collectable)`,\n );\n console.log(\n `Global: ${globalRuleCount} rules, ${fmtSize(globalCSSSize)}`,\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 logChunkEntries(chunkBreakdown);\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 logChunkEntries(breakdown);\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"],"mappings":";;;;AAqGA,SAAS,QAAQ,OAAuB;CACtC,OAAO,QAAQ,OAAO,IAAI,QAAQ,KAAA,CAAM,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;AACpE;AAEA,SAAS,WAAW,KAAqB;CACvC,QAAQ,IAAI,MAAM,YAAY,KAAK,CAAC,EAAA,CAAG;AACzC;AAEA,SAAS,iBAAiB,SAAqC;CAE7D,OAAO,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAC;AAC9D;AAcA,SAAS,cAAyB;CAChC,OAAO,OAAO,aAAa,cAAc,OAAO;AAClD;AAEA,IAAI,cAAc;AAGlB,SAAS,UAAU,KAAoB;CACrC,IAAI,OAAO,aAAa;CACxB,cAA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AAY;GACrE,OAAO,aAAa;GACpB,QAAQ,IAAI,2DAA2D;EACzE;CACF;AACF;AAMA,SAAS,WAAW,OAAkB,YAAY,GAAW;CAC3D,IAAI,CAAC,MAAM,OAAO;CAClB,MAAM,SAAmB,CAAC;CAC1B,IAAI;EACF,IAAI,iBAAiB,MACnB,KAAK,MAAM,SAAS,MAAM,KAAM,KAAkB,WAAW,GAC3D,IAAI;GACF,IAAI,MAAM,UACR,OAAO,KACL,MAAM,KAAK,MAAM,QAAQ,CAAC,CACvB,KAAK,MAAM,EAAE,OAAO,CAAC,CACrB,KAAK,IAAI,CACd;EACJ,QAAQ,CAER;CAGN,QAAQ,CAER;CACA,OAAO,OAAO,KAAK,IAAI;AACzB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as isSelector, t as mergeStyles } from "./shared-utils-DWA4LjIa.js";
|
|
2
|
-
import { D as makeKeyframeName, E as makeCounterStyleName, U as parseFunctionName, V as formatFunctionRule, W as registerFunctionPolyfill, a as formatPropertyCSS, b as formatFontFaceRule, h as formatCounterStyleRule, i as formatKeyframesCSS, j as hashString, n as formatGlobalRules, v as fontFaceContentHash } from "./css-definitions-
|
|
3
|
-
import {
|
|
4
|
-
import { $ as propHandlerRegistry, B as getNamePrefix, E as injectRawCSS, I as getConfig, J as closeBatchWindow, L as getGlobalInjector, M as touch, T as injectGlobal, Z as openBatchWindow, c as hasKeys, d as getStyleTarget, f as pushRSCCSS, i as modAttrs, k as keyframes, l as collectAutoInferredProperties, n as createClientState, o as computeStyles, r as processTokens, s as resolveRecipes, t as depsEqual, u as collectAutoInferredPropertiesRSC } from "./runtime-engine-
|
|
2
|
+
import { D as makeKeyframeName, E as makeCounterStyleName, U as parseFunctionName, V as formatFunctionRule, W as registerFunctionPolyfill, a as formatPropertyCSS, b as formatFontFaceRule, h as formatCounterStyleRule, i as formatKeyframesCSS, j as hashString, n as formatGlobalRules, v as fontFaceContentHash } from "./css-definitions-BIgGXRLz.js";
|
|
3
|
+
import { W as isFunctionsPolyfillEnabled, b as renderStyles, i as baseStylePropsRegistry, s as BASE_STYLES } from "./style-engine-BpgmapBp.js";
|
|
4
|
+
import { $ as propHandlerRegistry, B as getNamePrefix, E as injectRawCSS, I as getConfig, J as closeBatchWindow, L as getGlobalInjector, M as touch, T as injectGlobal, Z as openBatchWindow, c as hasKeys, d as getStyleTarget, f as pushRSCCSS, i as modAttrs, k as keyframes, l as collectAutoInferredProperties, n as createClientState, o as computeStyles, r as processTokens, s as resolveRecipes, t as depsEqual, u as collectAutoInferredPropertiesRSC } from "./runtime-engine-B_4lx2DJ.js";
|
|
5
5
|
import { Fragment, createContext, createElement, forwardRef, useContext, useInsertionEffect } from "react";
|
|
6
6
|
//#region src/utils/get-display-name.ts
|
|
7
7
|
const DEFAULT_NAME = "Anonymous";
|
|
@@ -554,4 +554,4 @@ function TastyBatchProvider({ children }) {
|
|
|
554
554
|
//#endregion
|
|
555
555
|
export { useProperty as a, useGlobalStyles as c, Element as d, tasty as f, useFontFace as i, useStyles as l, useFunction as n, useKeyframes as o, getDisplayName as p, useCounterStyle as r, useRawCSS as s, TastyBatchProvider as t, getTastySSRContext as u };
|
|
556
556
|
|
|
557
|
-
//# sourceMappingURL=react-runtime-
|
|
557
|
+
//# sourceMappingURL=react-runtime-46TyXx9v.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-runtime-46TyXx9v.js","names":["getClientState"],"sources":["../../src/utils/get-display-name.ts","../../src/utils/is-valid-element-type.ts","../../src/tasty.tsx","../../src/ssr/context.ts","../../src/hooks/useStyles.ts","../../src/hooks/useGlobalStyles.ts","../../src/hooks/useRawCSS.ts","../../src/hooks/useKeyframes.ts","../../src/hooks/useProperty.ts","../../src/hooks/useFontFace.ts","../../src/hooks/useCounterStyle.ts","../../src/hooks/useFunction.ts","../../src/batch-provider.tsx"],"sourcesContent":["import type { ElementType } from 'react';\n\nconst DEFAULT_NAME = 'Anonymous';\n\nexport function getDisplayName<T>(\n Component: ElementType<T>,\n fallbackName = DEFAULT_NAME,\n): string {\n if (typeof Component === 'function') {\n return Component.displayName ?? Component.name ?? fallbackName;\n }\n\n return fallbackName;\n}\n","/**\n * Lightweight replacement for `react-is`'s isValidElementType.\n * Detects string tags, function/class components, and React exotic types\n * (forwardRef, memo, lazy, etc.) via their internal $$typeof symbol.\n */\nexport function isValidElementType(value: unknown): boolean {\n if (typeof value === 'string' || typeof value === 'function') {\n return true;\n }\n\n if (typeof value === 'object' && value !== null) {\n return typeof (value as { $$typeof?: unknown }).$$typeof === 'symbol';\n }\n\n return false;\n}\n","import type {\n AllHTMLAttributes,\n ComponentType,\n ElementType,\n ForwardRefExoticComponent,\n JSX,\n PropsWithoutRef,\n RefAttributes,\n} from 'react';\nimport { createElement, forwardRef, Fragment } from 'react';\nimport type { ComputeStylesOptions } from './compute-styles';\nimport { computeStyles } from './compute-styles';\nimport type { PropHandlerProps } from './prop-handlers';\nimport { propHandlerRegistry } from './prop-handlers';\nimport { baseStylePropsRegistry } from './styles/base-props';\nimport { BASE_STYLES } from './styles/list';\nimport type { Styles, StylesInterface } from './styles/types';\nimport type {\n AllBaseProps,\n BaseProps,\n BaseStyleProps,\n ExtraBaseStyleProps,\n ModValue,\n Mods,\n TastyCustomProps,\n TokenValue,\n Tokens,\n} from './types';\nimport { getDisplayName } from './utils/get-display-name';\nimport { hasKeys } from './utils/has-keys';\nimport { isValidElementType } from './utils/is-valid-element-type';\nimport { isSelector } from './utils/is-selector';\nimport { mergeStyles } from './utils/merge-styles';\nimport { modAttrs } from './utils/mod-attrs';\nimport { processTokens } from './utils/process-tokens';\nimport { getConfig } from './config';\nimport { touch } from './injector';\n\nimport type { StyleValue, StyleValueStateMap } from './utils/styles';\n\n/** Transform one is* prop to its HTML and matching data attributes. */\nfunction handleIsProperty(\n props: Record<string, unknown>,\n isProperty: string,\n targetAttribute: string,\n dataAttribute: string,\n) {\n if (isProperty in props) {\n props[targetAttribute] = props[isProperty];\n delete props[isProperty];\n }\n\n if (!(dataAttribute in props) && props[targetAttribute]) {\n props[dataAttribute] = '';\n }\n}\n\nfunction handleIsProperties(props: Record<string, unknown>) {\n handleIsProperty(props, 'isDisabled', 'disabled', 'data-disabled');\n handleIsProperty(props, 'isHidden', 'hidden', 'data-hidden');\n handleIsProperty(props, 'isChecked', 'checked', 'data-checked');\n}\n\n/**\n * Creates a sub-element component for compound component patterns.\n * Sub-elements are lightweight components with data-element attribute for CSS targeting.\n */\nfunction createSubElement<Tag extends keyof JSX.IntrinsicElements>(\n elementName: string,\n definition: SubElementDefinition<Tag>,\n): ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<Tag>> & RefAttributes<unknown>\n> {\n // Normalize definition to object form\n const config =\n typeof definition === 'string'\n ? { as: definition as Tag }\n : (definition as { as?: Tag; qa?: string; qaVal?: string | number });\n\n const tag = config.as ?? ('div' as Tag);\n const defaultQa = config.qa;\n const defaultQaVal = config.qaVal;\n\n const SubElement = forwardRef<unknown, SubElementProps<Tag>>((props, ref) => {\n const {\n qa,\n qaVal,\n mods,\n tokens,\n isDisabled,\n isHidden,\n isChecked,\n className,\n style,\n ...htmlProps\n } = props as SubElementProps<Tag> & {\n className?: string;\n style?: Record<string, unknown>;\n };\n\n // Build mod attributes\n let modDataAttrs: Record<string, unknown> | undefined;\n if (mods) {\n modDataAttrs = modAttrs(mods as Mods) as Record<string, unknown>;\n }\n\n // Process tokens into inline style properties\n const tokenStyle = tokens\n ? (processTokens(tokens) as Record<string, unknown>)\n : undefined;\n\n // Merge token styles with explicit style prop (style has priority)\n let mergedStyle: Record<string, unknown> | undefined;\n if (tokenStyle || style) {\n mergedStyle =\n tokenStyle && style\n ? { ...tokenStyle, ...style }\n : ((tokenStyle ?? style) as Record<string, unknown>);\n }\n\n const elementProps = {\n 'data-element': elementName,\n 'data-qa': qa ?? defaultQa,\n 'data-qaval': qaVal ?? defaultQaVal,\n ...(modDataAttrs || {}),\n ...htmlProps,\n className,\n style: mergedStyle,\n isDisabled: isDisabled ?? (htmlProps as Record<string, unknown>).disabled,\n isHidden: isHidden ?? (htmlProps as Record<string, unknown>).hidden,\n isChecked: isChecked ?? (htmlProps as Record<string, unknown>).checked,\n ref,\n } as Record<string, unknown>;\n\n // Handle is* properties (isDisabled -> disabled + data-disabled, etc.)\n handleIsProperties(elementProps);\n\n // Clean up undefined data attributes\n if (elementProps['data-qa'] === undefined) delete elementProps['data-qa'];\n if (elementProps['data-qaval'] === undefined)\n delete elementProps['data-qaval'];\n\n return createElement(tag, elementProps);\n });\n\n SubElement.displayName = `SubElement(${elementName})`;\n\n return SubElement as ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<Tag>> & RefAttributes<unknown>\n >;\n}\n\ntype StyleList = readonly (keyof {\n [key in keyof StylesInterface]: StylesInterface[key];\n})[];\n\n// ============================================================================\n// Mod props types — expose modifier keys as top-level component props\n// ============================================================================\n\n/** Type descriptor for a single mod prop: a JS constructor or an enum array. */\nexport type ModPropDef =\n | BooleanConstructor\n | StringConstructor\n | NumberConstructor\n | readonly string[];\n\n/** Array form: list of mod key names (types default to ModValue). */\ntype ModPropsList = readonly string[];\n\n/** Object form: map of mod key names to type descriptors. */\ntype ModPropsMap = Readonly<Record<string, ModPropDef>>;\n\n/** Either array or object form accepted by `modProps` option. */\nexport type ModPropsInput = ModPropsList | ModPropsMap;\n\n/** Resolve a single ModPropDef to its TypeScript type. */\nexport type ResolveModPropDef<T> = T extends BooleanConstructor\n ? boolean\n : T extends StringConstructor\n ? string\n : T extends NumberConstructor\n ? number\n : T extends readonly (infer U)[]\n ? U\n : ModValue;\n\n/** Resolve an entire `modProps` definition to the component prop types it adds. */\nexport type ResolveModProps<M extends ModPropsInput> =\n M extends readonly (infer K)[]\n ? Partial<Record<K & string, ModValue>>\n : M extends Record<string, ModPropDef>\n ? { [key in keyof M & string]?: ResolveModPropDef<M[key]> }\n : // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n {};\n\n// ============================================================================\n// Token props types — expose token keys as top-level component props\n// ============================================================================\n\n/** A token key with `$` or `#` prefix. */\ntype TokenPropKey = `$${string}` | `#${string}`;\n\n/** Array form: list of prop names. Names ending in `Color` map to `#` color tokens. */\ntype TokenPropsList = readonly string[];\n\n/** Object form: prop name -> token key with explicit `$`/`#` prefix. */\ntype TokenPropsMap = Readonly<Record<string, TokenPropKey>>;\n\n/** Either array or object form accepted by `tokenProps` option. */\nexport type TokenPropsInput = TokenPropsList | TokenPropsMap;\n\n/** Resolve a `tokenProps` definition to the component prop types it adds. */\nexport type ResolveTokenProps<TP extends TokenPropsInput> =\n TP extends readonly (infer K)[]\n ? Partial<Record<K & string, TokenValue>>\n : TP extends Record<string, TokenPropKey>\n ? Partial<Record<keyof TP & string, TokenValue>>\n : // eslint-disable-next-line @typescript-eslint/no-empty-object-type\n {};\n\n/**\n * Pre-compute the mapping from prop name to token key at component-creation time.\n * Array form: `'progress'` -> `'$progress'`, `'accentColor'` -> `'#accent'`.\n * Object form: entries used as-is.\n */\nfunction buildTokenPropsMapping(\n def: TokenPropsInput,\n): [propName: string, tokenKey: string][] {\n if (Array.isArray(def)) {\n return (def as string[]).map((propName) => {\n if (propName.endsWith('Color') && propName.length > 5) {\n return [propName, `#${propName.slice(0, -5)}`];\n }\n return [propName, `$${propName}`];\n });\n }\n return Object.entries(def);\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyProps = Record<string, any>;\n\ntype PropsWithStyles = {\n styles?: Styles;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n} & Omit<Record<string, any>, 'styles'>;\n\nexport type VariantMap = Record<string, Styles>;\n\nexport interface WithVariant<V extends VariantMap> {\n variant?: keyof V;\n}\n\n// ============================================================================\n// Sub-element types for compound components\n// ============================================================================\n\n/**\n * Definition for a sub-element. Can be either:\n * - A tag name string (e.g., 'div', 'span')\n * - An object with configuration options\n */\nexport type SubElementDefinition<\n Tag extends keyof JSX.IntrinsicElements = 'div',\n> =\n | Tag\n | {\n as?: Tag;\n qa?: string;\n qaVal?: string | number;\n };\n\n/**\n * Map of sub-element definitions.\n * Keys become the sub-component names (e.g., { Icon: 'span' } -> Component.Icon)\n */\nexport type ElementsDefinition = Record<\n string,\n SubElementDefinition<keyof JSX.IntrinsicElements>\n>;\n\n/**\n * Resolves the tag from a SubElementDefinition\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype ResolveElementTag<T extends SubElementDefinition<any>> = T extends string\n ? T\n : T extends { as?: infer Tag }\n ? Tag extends keyof JSX.IntrinsicElements\n ? Tag\n : 'div'\n : 'div';\n\n/**\n * Props for sub-element components.\n * Combines HTML attributes with tasty-specific props (qa, qaVal, mods, tokens, isDisabled, etc.)\n */\nexport type SubElementProps<Tag extends keyof JSX.IntrinsicElements = 'div'> =\n Omit<\n JSX.IntrinsicElements[Tag],\n 'ref' | 'color' | 'content' | 'translate'\n > & {\n qa?: string;\n qaVal?: string | number;\n mods?: Mods;\n tokens?: Tokens;\n isDisabled?: boolean;\n isHidden?: boolean;\n isChecked?: boolean;\n };\n\n/**\n * Generates the sub-element component types from an ElementsDefinition\n */\ntype SubElementComponents<E extends ElementsDefinition> = {\n [K in keyof E]: ForwardRefExoticComponent<\n PropsWithoutRef<SubElementProps<ResolveElementTag<E[K]>>> &\n RefAttributes<\n ResolveElementTag<E[K]> extends keyof HTMLElementTagNameMap\n ? HTMLElementTagNameMap[ResolveElementTag<E[K]>]\n : Element\n >\n >;\n};\n\n/**\n * Base type containing common properties shared between TastyProps and TastyElementOptions.\n * Separated to avoid code duplication while allowing different type constraints.\n */\ntype TastyBaseProps<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = {\n /** Default styles of the element. */\n styles?: Styles;\n /** The list of styles that can be provided by props */\n styleProps?: K;\n /** Modifier keys exposed as top-level component props (array or typed object form). */\n modProps?: M;\n /** Token keys exposed as top-level component props (array or typed object form). */\n tokenProps?: TP;\n element?: BaseProps['element'];\n variants?: V;\n /** Default tokens for inline CSS custom properties */\n tokens?: Tokens;\n /** Sub-element definitions for compound components */\n elements?: E;\n} & Pick<BaseProps, 'qa' | 'qaVal'> &\n WithVariant<V>;\n\nexport type TastyProps<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n DefaultProps = AnyProps,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = TastyBaseProps<K, V, E, M, TP> & {\n /** The tag name of the element or a React component. */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n as?: string | ComponentType<any>;\n} & Partial<\n Omit<\n DefaultProps,\n 'as' | 'styles' | 'styleProps' | 'modProps' | 'tokenProps' | 'tokens'\n >\n >;\n\n/**\n * Resolves the props of a polymorphic `as` value (intrinsic tag or component).\n * - For intrinsic tags (`'div'`, `'button'`, ...): returns `JSX.IntrinsicElements[Tag]`.\n * - For React component types: returns the component's own props.\n * - Falls back to an empty record for anything else.\n */\nexport type ResolveAsProps<AsType extends ElementType> =\n AsType extends keyof JSX.IntrinsicElements\n ? JSX.IntrinsicElements[AsType]\n : AsType extends ComponentType<infer P>\n ? P\n : Record<string, never>;\n\n/**\n * TastyElementOptions is used for the element-creation overload of tasty().\n * It includes an `AsType` generic that allows TypeScript to infer the correct\n * element type from the `as` prop — both for intrinsic tags and for React\n * components (so the wrapped component's prop API is preserved).\n *\n * Note: Uses a separate index signature with `unknown` instead of an `any`\n * record to ensure strict type checking for styles.\n */\nexport type TastyElementOptions<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n AsType extends ElementType = 'div',\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = TastyBaseProps<K, V, E, M, TP> & {\n /** The tag name of the element or a React component. */\n as?: AsType;\n} & Record<string, unknown>;\n\nexport type AllBasePropsWithMods<\n K extends StyleList,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = AllBaseProps & {\n [key in K[number]]?:\n StyleValue<StylesInterface[key]> | StyleValueStateMap<StylesInterface[key]>;\n} & BaseStyleProps &\n ExtraBaseStyleProps &\n Partial<TastyCustomProps> &\n ResolveModProps<M> &\n ResolveTokenProps<TP>;\n\n/**\n * Props consumed by Tasty rather than forwarded to the `as` component.\n * Event handlers are resolved from JSX.IntrinsicElements or the component's own props.\n */\ntype TastySpecificKeys =\n | keyof BaseStyleProps\n | 'as'\n | 'qa'\n | 'qaVal'\n | 'element'\n | 'styles'\n | 'mods'\n | 'isHidden'\n | 'isDisabled'\n | 'isChecked'\n | 'style'\n | 'theme'\n | 'tokens'\n | 'ref';\n\n/** Extract prop key names from a ModPropsInput (array elements or object keys). */\ntype ModPropsKeys<M extends ModPropsInput> = M extends readonly (infer K)[]\n ? K & string\n : keyof M & string;\n\n/** Extract prop key names from a TokenPropsInput (array elements or object keys). */\ntype TokenPropsKeys<TP extends TokenPropsInput> =\n TP extends readonly (infer K)[] ? K & string : keyof TP & string;\n\n/**\n * Props type for tasty elements that combines:\n * - AllBasePropsWithMods for style props with strict tokens type\n * - HTML attributes for flexibility (properly typed based on `as`)\n * - Variant support\n *\n * AllBasePropsWithMods carries generic AllHTMLAttributes which can conflict\n * with element-specific types (e.g. `src` is `string` in AllHTMLAttributes but\n * `string | Blob` in ImgHTMLAttributes, or the custom props on a third-party\n * component like Next.js `Link`). To avoid intersection-narrowing, we Omit\n * element-specific keys from AllBasePropsWithMods (keeping TastySpecificKeys,\n * style props, mod props, and token props) and let the resolved `as` props\n * supply the authoritative attribute types. The `AllHTMLAttributes<HTMLElement>`\n * baseline is preserved so generic HTML attributes still work even when `as`\n * is a component type with a narrower prop API.\n */\nexport type TastyElementProps<\n K extends StyleList,\n V extends VariantMap,\n AsType extends ElementType = 'div',\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n> = Omit<\n AllBasePropsWithMods<K, M, TP>,\n Exclude<\n keyof ResolveAsProps<AsType>,\n | TastySpecificKeys\n | keyof TastyCustomProps\n | keyof ExtraBaseStyleProps\n | K[number]\n | ModPropsKeys<M>\n | TokenPropsKeys<TP>\n >\n> &\n WithVariant<V> &\n Omit<\n Omit<AllHTMLAttributes<HTMLElement>, keyof ResolveAsProps<AsType>> &\n ResolveAsProps<AsType>,\n | TastySpecificKeys\n | keyof TastyCustomProps\n | keyof ExtraBaseStyleProps\n | K[number]\n | ModPropsKeys<M>\n | TokenPropsKeys<TP>\n >;\n\nexport type TastyComponentPropsWithDefaults<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props>,\n> = keyof DefaultProps extends never\n ? Props\n : {\n [key in Extract<keyof Props, keyof DefaultProps>]?: Props[key];\n } & {\n [key in keyof Omit<Props, keyof DefaultProps>]: Props[key];\n };\n\n/**\n * The component type returned by the `tasty(options)` element-factory overload.\n *\n * It's a regular React forward-ref component whose props are typed from the\n * factory-time `as` value. Polymorphism is at factory time: each call to\n * `tasty({ as: X })` produces a component whose prop API includes `X`'s own\n * props (so `tasty({ as: NextLink })` exposes `href`, `replace`, `prefetch`,\n * etc.) alongside the Tasty-specific props (`mods`, `tokens`, `styleProps`,\n * `modProps`, `tokenProps`).\n *\n * Note: a render-time `<X as={SomeComponent} />` does not re-infer props from\n * `SomeComponent`; create another `tasty({ as: SomeComponent })` for that.\n */\nexport type TastyPolymorphicComponent<\n DefaultAs extends ElementType,\n K extends StyleList,\n V extends VariantMap,\n M extends ModPropsInput,\n TP extends TokenPropsInput,\n> = ForwardRefExoticComponent<\n PropsWithoutRef<TastyElementProps<K, V, DefaultAs, M, TP>> &\n RefAttributes<unknown>\n>;\n\n// An omitted styleProps list must not infer the entire StyleList constraint:\n// that would claim every CSS name, including the `as` component's own props.\nexport function tasty<\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n AsType extends ElementType = 'div',\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n options: TastyElementOptions<K, V, E, AsType, M, TP>,\n secondArg?: never,\n): TastyPolymorphicComponent<AsType, K, V, M, TP> & SubElementComponents<E>;\nexport function tasty<\n Props extends PropsWithStyles,\n DefaultProps extends Partial<Props> = Partial<Props>,\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n Component: ComponentType<Props>,\n options?: TastyProps<K, V, E, Props, M, TP>,\n): ComponentType<TastyComponentPropsWithDefaults<Props, DefaultProps>>;\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n// Implementation\nexport function tasty<\n K extends StyleList,\n V extends VariantMap,\n _C = Record<string, unknown>,\n>(Component: any, options?: any) {\n if (isValidElementType(Component)) {\n return tastyWrap(Component as ComponentType<any>, options);\n }\n\n return tastyElement(Component as TastyProps<K, V>);\n}\n\nfunction tastyWrap<\n P extends PropsWithStyles,\n DefaultProps extends Partial<P> = Partial<P>,\n K extends StyleList = readonly never[],\n V extends VariantMap = VariantMap,\n E extends ElementsDefinition = Record<string, never>,\n M extends ModPropsInput = readonly never[],\n TP extends TokenPropsInput = readonly never[],\n>(\n Component: ComponentType<P>,\n options?: TastyProps<K, V, E, P, M, TP>,\n): ComponentType<TastyComponentPropsWithDefaults<P, DefaultProps>> {\n // The wrap path forwards default props + merges `styles`/`*Styles` props.\n // Factory-only options (`styleProps`, `modProps`, `tokenProps`, `variants`,\n // `elements`) are stripped here, not forwarded to the wrapped component.\n const {\n as: extendTag,\n element: extendElement,\n styleProps: _styleProps,\n modProps: _modProps,\n tokenProps: _tokenProps,\n variants: _variants,\n elements: _elements,\n ...defaultProps\n } = (options ?? {}) as TastyProps<K, V, E, P, M, TP>;\n\n const propsWithStyles = ['styles'];\n for (const prop of Object.keys(defaultProps)) {\n if (prop.endsWith('Styles')) propsWithStyles.push(prop);\n }\n\n const _WrappedComponent = forwardRef<any, any>((props, ref) => {\n const { as, element, ...restProps } = props as Record<string, unknown>;\n\n const mergedStylesMap: Record<string, unknown> = {};\n for (const prop of propsWithStyles) {\n const restValue = (restProps as any)[prop];\n const defaultValue = (defaultProps as any)[prop];\n\n mergedStylesMap[prop] =\n restValue != null && defaultValue != null\n ? mergeStyles(defaultValue, restValue)\n : (restValue ?? defaultValue);\n }\n\n const elementProps = {\n ...(defaultProps as unknown as Record<string, unknown>),\n ...(restProps as unknown as Record<string, unknown>),\n ...mergedStylesMap,\n as: (as as string | undefined) ?? extendTag,\n element: (element as string | undefined) || extendElement,\n ref,\n } as unknown as P;\n\n return createElement(Component as ComponentType<P>, elementProps);\n });\n\n _WrappedComponent.displayName = `TastyWrappedComponent(${getDisplayName(\n Component,\n (defaultProps as any).qa ?? (extendTag as any) ?? 'Anonymous',\n )})`;\n\n return _WrappedComponent as unknown as ComponentType<\n TastyComponentPropsWithDefaults<P, DefaultProps>\n >;\n}\n\nfunction tastyElement<\n K extends StyleList,\n V extends VariantMap,\n E extends ElementsDefinition,\n>(tastyOptions: TastyProps<K, V, E>) {\n const {\n as: originalAs = 'div',\n element: defaultElement,\n styles: defaultStyles,\n styleProps,\n modProps: modPropsDef,\n tokenProps: tokenPropsDef,\n variants,\n tokens: defaultTokens,\n elements,\n ...defaultProps\n } = tastyOptions;\n\n // Pre-compute merged styles for each variant (if variants are defined)\n // This avoids creating separate component instances per variant\n let variantStylesMap: Record<string, Styles | undefined> | undefined;\n if (variants) {\n // Split defaultStyles: extend-mode state maps (no '' key, non-selector)\n // are pulled out and applied AFTER variant merge so they survive\n // replace-mode maps in variants.\n let baseStyles = defaultStyles;\n let extensionStyles: Styles | undefined;\n\n if (defaultStyles) {\n for (const key of Object.keys(defaultStyles)) {\n if (isSelector(key)) continue;\n\n const value = (defaultStyles as Record<string, unknown>)[key];\n\n if (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value) &&\n !('' in value)\n ) {\n if (!extensionStyles) {\n baseStyles = { ...defaultStyles } as Styles;\n extensionStyles = {} as Styles;\n }\n (extensionStyles as Record<string, unknown>)[key] = value;\n delete (baseStyles as Record<string, unknown>)[key];\n }\n }\n }\n\n variantStylesMap = {};\n for (const [variant, variantStyles] of Object.entries(variants) as [\n string,\n Styles,\n ][]) {\n variantStylesMap[variant] = extensionStyles\n ? mergeStyles(baseStyles, variantStyles, extensionStyles)\n : mergeStyles(baseStyles, variantStyles);\n }\n // Ensure 'default' variant always exists\n if (!variantStylesMap['default']) {\n variantStylesMap['default'] = defaultStyles;\n }\n }\n\n const {\n qa: defaultQa,\n qaVal: defaultQaVal,\n ...otherDefaultProps\n } = defaultProps;\n\n // Fixed at factory-creation time — no dependency on global config.\n const ownPropsToCheck: readonly string[] = styleProps\n ? (styleProps as StyleList).concat(BASE_STYLES)\n : BASE_STYLES;\n\n // Resolved lazily and refreshed on registry version change. `configure()` can\n // run *after* this factory was created (module eval order — see `Element` at\n // the bottom of this file), and `resetConfig()` reopens configuration, so a\n // one-shot lazy init would go stale. Starts at -1 to force first resolution.\n let propsToCheck: readonly string[] = ownPropsToCheck;\n let propsToCheckVersion = -1;\n\n const modPropsKeys: string[] | undefined = modPropsDef\n ? ((Array.isArray(modPropsDef)\n ? modPropsDef\n : Object.keys(modPropsDef)) as string[])\n : undefined;\n\n const tokenPropsMapping: [string, string][] | undefined = tokenPropsDef\n ? buildTokenPropsMapping(tokenPropsDef as TokenPropsInput)\n : undefined;\n\n // Factory-level cache: maps stable style references to computed classNames.\n // For the common case (no instance overrides), this avoids recomputation.\n const classNameCache = new Map<Styles | undefined, string>();\n\n // Passed when the styles object handed to computeStyles() is the factory's\n // own AND computeStyles() will see it again — which is only true where\n // classNameCache is unavailable, i.e. the server. On the client that cache\n // answers every render after the first, so memoizing chunk keys during that\n // first render would write entries nothing ever reads back. Hoisted so the\n // hot path does not allocate it.\n const STABLE_STYLES: ComputeStylesOptions = { stableStyles: true };\n\n const _TastyComponent = forwardRef<\n unknown,\n AllBasePropsWithMods<K> & WithVariant<V>\n >((incomingProps, ref) => {\n // Global props middleware (`configure({ propHandlers })`). Runs before any\n // destructuring so a handler can rewrite every tasty prop — `styles`, `mods`,\n // `tokens`, `variant`, `as`, `element`, `qa` — and strip its own custom props\n // so they never reach the DOM. `ref` is out of reach: forwardRef separates it.\n // Fast path while nothing is registered: one property load and one branch.\n const applyPropHandlers = propHandlerRegistry.apply;\n const allProps = applyPropHandlers\n ? (applyPropHandlers(\n incomingProps as unknown as PropHandlerProps,\n ) as unknown as typeof incomingProps)\n : incomingProps;\n\n const {\n as,\n styles: rawStyles,\n variant,\n mods,\n element,\n qa,\n qaVal,\n className: userClassName,\n tokens,\n style,\n theme,\n ...otherProps\n } = allProps as Record<string, unknown> as AllBasePropsWithMods<K> &\n WithVariant<V> & {\n className?: string;\n tokens?: Tokens;\n style?: Record<string, unknown>;\n theme?: string;\n };\n\n const styles = rawStyles;\n\n let propStyles: Styles | null = null;\n\n if (propsToCheckVersion !== baseStylePropsRegistry.version) {\n const promoted = baseStylePropsRegistry.list;\n\n propsToCheck =\n promoted.length === 0\n ? ownPropsToCheck\n : ownPropsToCheck.concat(promoted);\n propsToCheckVersion = baseStylePropsRegistry.version;\n }\n\n for (const prop of propsToCheck) {\n const key = prop as unknown as string;\n\n if (key in otherProps) {\n if (!propStyles) propStyles = {};\n const value = (otherProps as any)[key];\n (propStyles as any)[key] = value;\n delete (otherProps as any)[key];\n }\n }\n\n let propMods: Record<string, ModValue> | undefined;\n if (modPropsKeys) {\n for (const key of modPropsKeys) {\n if (key in otherProps) {\n if (!propMods) propMods = {};\n propMods[key] = (otherProps as Record<string, unknown>)[\n key\n ] as ModValue;\n delete (otherProps as Record<string, unknown>)[key];\n }\n }\n }\n\n let propTokens: Tokens | undefined;\n if (tokenPropsMapping) {\n for (const [propName, tokenKey] of tokenPropsMapping) {\n if (propName in otherProps) {\n if (!propTokens) propTokens = {} as Tokens;\n (propTokens as Record<string, TokenValue>)[tokenKey] = (\n otherProps as Record<string, unknown>\n )[propName] as TokenValue;\n delete (otherProps as Record<string, unknown>)[propName];\n }\n }\n }\n\n const baseStyles = variantStylesMap\n ? (variantStylesMap[(variant as string) || 'default'] ??\n variantStylesMap['default'])\n : defaultStyles;\n\n const hasInstanceStyles =\n styles && hasKeys(styles as Record<string, unknown>);\n const hasPropStyles = !!propStyles;\n\n const allStyles =\n hasInstanceStyles || hasPropStyles\n ? mergeStyles(baseStyles, styles as Styles, propStyles as Styles)\n : baseStyles;\n\n // Use factory-level cache for stable style references (client only).\n // On the server the cache must be skipped: both the SSR collector and\n // the RSC inline-style paths are per-request, so every request must\n // call computeStyles() to ensure CSS is actually collected/emitted.\n const useFactoryCache = typeof document !== 'undefined';\n let generatedClassName =\n useFactoryCache && allStyles === baseStyles\n ? classNameCache.get(allStyles)\n : undefined;\n let rscCSS: string | undefined;\n\n if (generatedClassName !== undefined) {\n touch(generatedClassName);\n } else {\n const result = computeStyles(\n allStyles,\n !useFactoryCache && allStyles === baseStyles\n ? STABLE_STYLES\n : undefined,\n );\n generatedClassName = result.className;\n rscCSS = result.css;\n if (useFactoryCache && allStyles === baseStyles) {\n classNameCache.set(allStyles, generatedClassName);\n }\n }\n\n // Merge tokens: default -> instance -> tokenProps\n let mergedTokens: Tokens | undefined;\n if (defaultTokens || tokens || propTokens) {\n if (!defaultTokens && !propTokens) {\n mergedTokens = tokens as Tokens;\n } else if (!tokens && !propTokens) {\n mergedTokens = defaultTokens;\n } else {\n mergedTokens = {\n ...defaultTokens,\n ...(tokens as Tokens),\n ...propTokens,\n } as Tokens;\n }\n }\n\n const processedTokenStyle = processTokens(mergedTokens);\n\n let mergedStyle: Record<string, unknown> | undefined;\n if (processedTokenStyle || style) {\n if (!processedTokenStyle) {\n mergedStyle = style;\n } else if (!style) {\n mergedStyle = processedTokenStyle as Record<string, unknown>;\n } else {\n mergedStyle = {\n ...(processedTokenStyle as Record<string, unknown>),\n ...style,\n };\n }\n }\n\n const mergedMods = propMods\n ? { ...(mods as Record<string, ModValue>), ...propMods }\n : (mods as Record<string, ModValue> | undefined);\n\n let modDataAttrs: Record<string, unknown> | undefined;\n if (mergedMods) {\n modDataAttrs = modAttrs(mergedMods as unknown as Mods) as Record<\n string,\n unknown\n >;\n }\n\n let finalClassName = generatedClassName;\n if (userClassName) {\n finalClassName = finalClassName\n ? `${userClassName} ${finalClassName}`\n : userClassName;\n }\n\n const elementProps = {\n 'data-element': (element as string | undefined) || defaultElement,\n 'data-qa': (qa as string | undefined) || defaultQa,\n 'data-qaval': (qaVal as string | undefined) || defaultQaVal,\n 'data-theme': theme,\n ...(otherDefaultProps as unknown as Record<string, unknown>),\n ...(modDataAttrs || {}),\n ...(otherProps as unknown as Record<string, unknown>),\n className: finalClassName,\n style: mergedStyle,\n ref,\n } as Record<string, unknown>;\n\n handleIsProperties(elementProps);\n\n if (elementProps['data-theme'] === undefined) {\n delete elementProps['data-theme'];\n }\n\n const el = createElement(\n (as as string | 'div') ?? originalAs,\n elementProps,\n );\n\n // RSC mode: wrap element with inline <style> tag.\n // Class names are extracted from these tags on the client via\n // the doubled-specificity pattern (.tXXX.tXXX), so no <script> is needed.\n if (rscCSS) {\n const nonce = getConfig().nonce;\n\n return createElement(\n Fragment,\n null,\n createElement('style', {\n 'data-tasty-rsc': '',\n nonce,\n dangerouslySetInnerHTML: { __html: rscCSS },\n }),\n el,\n );\n }\n\n return el;\n });\n\n _TastyComponent.displayName = `TastyComponent(${\n (defaultProps as any).qa || originalAs\n })`;\n\n // Attach sub-element components if elements are defined\n if (elements) {\n const subElements: Record<string, ForwardRefExoticComponent<any>> = {};\n for (const [name, definition] of Object.entries(elements)) {\n subElements[name] = createSubElement(\n name,\n definition as SubElementDefinition<keyof JSX.IntrinsicElements>,\n );\n }\n\n return Object.assign(_TastyComponent, subElements);\n }\n\n return _TastyComponent;\n}\n\nexport const Element = /* @__PURE__ */ tasty({});\n","/**\n * React context for SSR collector discovery.\n *\n * Used by Next.js TastyRegistry to provide the ServerStyleCollector\n * to useStyles() via React context (the streaming-compatible path).\n *\n * This avoids relying on globalThis for cross-layer communication,\n * which leaks between RSC and SSR module graphs in Next.js App Router.\n *\n * The context is created lazily to avoid calling createContext() at\n * module evaluation time, which would break Server Components that\n * import from `@tenphi/tasty` without using any React hooks.\n */\n\nimport { createContext, type Context } from 'react';\n\nimport type { ServerStyleCollector } from './collector';\n\nlet _ctx: Context<ServerStyleCollector | null> | undefined;\n\nexport function getTastySSRContext(): Context<ServerStyleCollector | null> {\n if (!_ctx) {\n _ctx = createContext<ServerStyleCollector | null>(null);\n }\n return _ctx;\n}\n","import { useContext } from 'react';\n\nimport { computeStyles } from '../compute-styles';\nimport { getTastySSRContext } from '../ssr/context';\nimport type { Styles } from '../styles/types';\n\nexport interface UseStylesResult {\n /**\n * Generated className(s) to apply to the element.\n * Can be empty string if no styles are provided.\n * With chunking enabled, may contain multiple space-separated class names.\n */\n className: string;\n}\n\n/**\n * Hook to generate CSS classes from Tasty styles.\n * Thin wrapper around `computeStyles()` that adds React context-based\n * SSR collector discovery for backward compatibility with TastyRegistry.\n *\n * For hook-free usage (e.g. in server components), use `computeStyles()` directly.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { className } = useStyles({\n * padding: '2x',\n * fill: '#purple',\n * radius: '1r',\n * });\n *\n * return <div className={className}>Styled content</div>;\n * }\n * ```\n */\nexport function useStyles(\n styles: Styles | undefined,\n options?: { root?: Document | ShadowRoot },\n): UseStylesResult {\n return computeStyles(styles, {\n ssrCollector: useContext(getTastySSRContext()),\n root: options?.root,\n });\n}\n","import { getConfig } from '../config';\nimport { injectGlobal } from '../injector';\nimport type { StyleResult } from '../pipeline';\nimport { renderStyles } from '../pipeline';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport {\n collectAutoInferredProperties,\n collectAutoInferredPropertiesRSC,\n} from '../ssr/collect-auto-properties';\nimport { formatGlobalRules } from '../ssr/format-global-rules';\nimport type { Styles } from '../styles/types';\nimport { createClientState } from '../utils/client-state';\nimport { hashString } from '../utils/hash';\nimport { resolveRecipes } from '../utils/resolve-recipes';\n\ninterface UseGlobalStylesOptions {\n /**\n * Stable identifier for update tracking (client-only). When provided,\n * changing the styles will dispose the previous injection and inject the\n * new one. Without an id, the selector is used as the slot key.\n * In RSC mode, renders are single-pass so update tracking does not apply.\n */\n id?: string;\n /** Shadow root or document to inject into (client only). */\n root?: Document | ShadowRoot;\n}\n\ninterface ClientGlobalEntry {\n stylesKey: string;\n dispose: () => void;\n}\n\nconst getClientGlobalSlots = /* @__PURE__ */ createClientState(\n () => new Map<string, ClientGlobalEntry>(),\n);\n\nconst noop = () => {\n /* nothing to dispose */\n};\n\n/**\n * Inject global styles for a given selector.\n * Useful for styling elements by selector without generating classNames.\n *\n * SSR-aware: when a ServerStyleCollector is available, CSS is collected\n * during the render phase instead of being injected into the DOM.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * Injected styles are permanent — they are not cleaned up on component unmount.\n * Use the `id` option for update tracking when styles change over the\n * component lifecycle.\n *\n * Update tracking is per-slot and per-root: a slot (`id`, or the selector when\n * no `id` is given) holds exactly one injection per `root`. Changing the styles\n * replaces it; rendering styles that produce no CSS clears it.\n *\n * @param selector - CSS selector to apply styles to (e.g., '.my-class', ':root', 'body')\n * @param styles - Tasty styles object\n * @param options - Optional settings including `id` for update tracking\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * useGlobalStyles('.card', {\n * padding: '2x',\n * radius: '1r',\n * fill: '#white',\n * });\n *\n * return <div className=\"card\">Content</div>;\n * }\n * ```\n */\nexport function useGlobalStyles(\n selector: string,\n styles?: Styles,\n options?: UseGlobalStylesOptions,\n): void {\n if (!styles) return;\n\n if (!selector) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n '[Tasty] useGlobalStyles: selector is required and cannot be empty. ' +\n 'Styles will not be injected.',\n );\n }\n return;\n }\n\n const target = getStyleTarget();\n\n // Resolve the client slot once — both the fast path below and the injection\n // at the end need it.\n const slots =\n target.mode === 'client'\n ? getClientGlobalSlots(options?.root ?? document)\n : null;\n const slotKey = options?.id ?? selector;\n const stylesKey = slots ? JSON.stringify(styles) : '';\n const existing = slots?.get(slotKey);\n\n // Client fast path: skip resolveRecipes/renderStyles if styles haven't changed\n if (existing && existing.stylesKey === stylesKey) return;\n\n const resolvedStyles = resolveRecipes(styles);\n\n const styleResults = renderStyles(resolvedStyles, selector) as StyleResult[];\n\n if (styleResults.length === 0) {\n // An update that renders no CSS must still clear the slot's previous\n // injection, otherwise the stale rules keep applying to the selector.\n if (slots) {\n existing?.dispose();\n slots.set(slotKey, { stylesKey, dispose: noop });\n }\n return;\n }\n\n if (target.mode === 'ssr') {\n target.collector.collectInternals();\n\n const css = formatGlobalRules(styleResults);\n if (css) {\n // A slot key (explicit `id`) replaces, matching client update tracking;\n // content-hashed keys only dedup.\n const key = options?.id\n ? `global:${options.id}`\n : `global:${selector}:${hashString(css)}`;\n target.collector.collectGlobalStyles(key, css, options?.id != null);\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n collectAutoInferredProperties(\n styleResults,\n target.collector,\n resolvedStyles,\n );\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n const css = formatGlobalRules(styleResults);\n if (css) {\n const key = options?.id\n ? `__global:${options.id}`\n : `__global:${selector}:${hashString(css)}`;\n pushRSCCSS(target.cache, key, css, options?.id != null);\n }\n\n if (getConfig().autoPropertyTypes !== false) {\n collectAutoInferredPropertiesRSC(\n styleResults,\n target.cache,\n resolvedStyles,\n );\n }\n return;\n }\n\n // Client path\n if (slots) {\n existing?.dispose();\n\n const { dispose } = injectGlobal(styleResults, { root: options?.root });\n slots.set(slotKey, { stylesKey, dispose });\n }\n}\n","import { injectRawCSS } from '../injector';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { createClientState } from '../utils/client-state';\nimport { depsEqual } from '../utils/deps-equal';\nimport { hashString } from '../utils/hash';\n\ninterface UseRawCSSOptions {\n /**\n * Shadow root or document to inject into. Update tracking is per-root: the\n * same id in two roots holds a separate injection in each.\n */\n root?: Document | ShadowRoot;\n /**\n * Stable identifier for update tracking (client-only). When provided,\n * changing the CSS content will dispose the previous injection and inject\n * the new one. Without an id, deduplication is purely content-based (same\n * CSS is injected only once). In RSC mode, renders are single-pass so\n * update tracking does not apply.\n */\n id?: string;\n}\n\ninterface ClientEntry {\n css: string;\n dispose: () => void;\n}\n\ninterface ClientRawCSSState {\n /** id -> the single injection that slot currently owns */\n entries: Map<string, ClientEntry>;\n /** content hashes injected without an id (permanent, deduped) */\n dedup: Set<string>;\n /** id -> last factory deps, to skip re-evaluating the factory */\n deps: Map<string, readonly unknown[]>;\n}\n\nconst getClientState = /* @__PURE__ */ createClientState(\n (): ClientRawCSSState => ({\n entries: new Map(),\n dedup: new Set(),\n deps: new Map(),\n }),\n);\n\n// Overload 1: Static CSS string\nexport function useRawCSS(css: string, options?: UseRawCSSOptions): void;\n\n// Overload 2: Factory function with dependencies\nexport function useRawCSS(\n factory: () => string,\n deps: readonly unknown[],\n options?: UseRawCSSOptions,\n): void;\n\n/**\n * Inject raw CSS text directly without parsing.\n * This is a low-overhead alternative for injecting global CSS that doesn't need tasty processing.\n *\n * The CSS is inserted into a separate style element (data-tasty-raw) to avoid conflicts\n * with tasty's chunked style sheets.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * Injected styles are permanent — they are not cleaned up on component unmount.\n * Use the `id` option for update tracking when styles change over the\n * component lifecycle.\n *\n * @example Static CSS string\n * ```tsx\n * function GlobalStyles() {\n * useRawCSS(`\n * body {\n * margin: 0;\n * padding: 0;\n * font-family: sans-serif;\n * }\n * `);\n *\n * return null;\n * }\n * ```\n *\n * @example Factory function with dependencies\n * ```tsx\n * function ThemeStyles({ theme }: { theme: 'light' | 'dark' }) {\n * useRawCSS(() => `\n * :root {\n * --bg-color: ${theme === 'dark' ? '#1a1a1a' : '#ffffff'};\n * --text-color: ${theme === 'dark' ? '#ffffff' : '#1a1a1a'};\n * }\n * `, [theme], { id: 'theme-vars' });\n *\n * return null;\n * }\n * ```\n *\n * @example With options\n * ```tsx\n * function ShadowStyles({ shadowRoot }) {\n * useRawCSS(() => `.scoped { color: red; }`, [], { root: shadowRoot });\n * return null;\n * }\n * ```\n */\nexport function useRawCSS(\n cssOrFactory: string | (() => string),\n depsOrOptions?: readonly unknown[] | UseRawCSSOptions,\n options?: UseRawCSSOptions,\n): void {\n const isFactory = typeof cssOrFactory === 'function';\n\n const deps =\n isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : undefined;\n const opts = isFactory\n ? options\n : (depsOrOptions as UseRawCSSOptions | undefined);\n const id = opts?.id;\n\n const target = getStyleTarget();\n\n const state =\n target.mode === 'client' ? getClientState(opts?.root ?? document) : null;\n\n // Client deps cache: skip factory re-evaluation when deps haven't changed\n if (isFactory && deps && id && state) {\n const cachedDeps = state.deps.get(id);\n if (cachedDeps && depsEqual(cachedDeps, deps)) {\n return;\n }\n }\n\n const css = isFactory\n ? (cssOrFactory as () => string)()\n : (cssOrFactory as string);\n\n if (!css.trim()) return;\n\n if (target.mode !== 'client') {\n // A slot key (explicit `id`) replaces, matching client update tracking;\n // content-hashed keys only dedup.\n const key = `${target.mode === 'rsc' ? '__' : ''}raw:${id || hashString(css)}`;\n const replace = id != null;\n if (target.mode === 'ssr') {\n target.collector.collectRawCSS(key, css, replace);\n } else {\n pushRSCCSS(target.cache, key, css, replace);\n }\n return;\n }\n\n // Client path\n if (!state) return;\n\n if (id) {\n const existing = state.entries.get(id);\n if (existing) {\n if (existing.css === css) return;\n existing.dispose();\n }\n\n const { dispose } = injectRawCSS(css, opts);\n state.entries.set(id, { css, dispose });\n if (deps) state.deps.set(id, deps);\n } else {\n const contentKey = hashString(css);\n if (state.dedup.has(contentKey)) return;\n state.dedup.add(contentKey);\n injectRawCSS(css, opts);\n }\n}\n","import { getNamePrefix } from '../config';\nimport { keyframes } from '../injector';\nimport type { KeyframesSteps } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { formatKeyframesCSS } from '../ssr/format-keyframes';\nimport { createClientState } from '../utils/client-state';\nimport { depsEqual } from '../utils/deps-equal';\nimport { hashString } from '../utils/hash';\nimport { makeKeyframeName } from '../utils/name-prefix';\n\ninterface UseKeyframesOptions {\n name?: string;\n root?: Document | ShadowRoot;\n}\n\ninterface FactoryDepsEntry {\n deps: readonly unknown[];\n name: string;\n}\n\ninterface NamedSlotEntry {\n cacheKey: string;\n dispose: () => void;\n}\n\ninterface ClientKeyframesState {\n /** cacheKey (name + serialized steps) -> generated animation name */\n contentToName: Map<string, string>;\n /** provided name -> the single injection that slot currently owns */\n namedSlots: Map<string, NamedSlotEntry>;\n /** provided name -> last factory deps, to skip re-evaluating the factory */\n factoryDeps: Map<string, FactoryDepsEntry>;\n}\n\nconst getClientState = /* @__PURE__ */ createClientState(\n (): ClientKeyframesState => ({\n contentToName: new Map(),\n namedSlots: new Map(),\n factoryDeps: new Map(),\n }),\n);\n\n/**\n * Inject CSS @keyframes and return the generated animation name.\n * Deduplicates by content — identical steps always return the same name.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * Passing `name` claims a slot owned by that one call site (like `useRawCSS`'s\n * `id`): when its steps change, the previous injection is disposed and the name\n * is reused, so the rules don't accumulate. Anonymous keyframes are permanent\n * and shared by content.\n *\n * @example Basic usage - steps object is the dependency\n * ```tsx\n * function MyComponent() {\n * const bounce = useKeyframes({\n * '0%': { transform: 'scale(1)' },\n * '50%': { transform: 'scale(1.1)' },\n * '100%': { transform: 'scale(1)' },\n * });\n *\n * return <div style={{ animation: `${bounce} 1s infinite` }}>Bouncing</div>;\n * }\n * ```\n *\n * @example With custom name\n * ```tsx\n * function MyComponent() {\n * const fadeIn = useKeyframes(\n * { from: { opacity: 0 }, to: { opacity: 1 } },\n * { name: 'fadeIn' }\n * );\n *\n * return <div style={{ animation: `${fadeIn} 0.3s ease-out` }}>Fading in</div>;\n * }\n * ```\n *\n * @example Factory function with dependencies\n * ```tsx\n * function MyComponent({ scale }: { scale: number }) {\n * const pulse = useKeyframes(\n * () => ({\n * '0%': { transform: 'scale(1)' },\n * '100%': { transform: `scale(${scale})` },\n * }),\n * [scale]\n * );\n *\n * return <div style={{ animation: `${pulse} 1s infinite` }}>Pulsing</div>;\n * }\n * ```\n */\n\n// Overload 1: Static steps object\nexport function useKeyframes(\n steps: KeyframesSteps,\n options?: UseKeyframesOptions,\n): string;\n\n// Overload 2: Factory function with dependencies\nexport function useKeyframes(\n factory: () => KeyframesSteps,\n deps: readonly unknown[],\n options?: UseKeyframesOptions,\n): string;\n\n// Implementation\nexport function useKeyframes(\n stepsOrFactory: KeyframesSteps | (() => KeyframesSteps),\n depsOrOptions?: readonly unknown[] | UseKeyframesOptions,\n options?: UseKeyframesOptions,\n): string {\n const isFactory = typeof stepsOrFactory === 'function';\n\n const deps =\n isFactory && Array.isArray(depsOrOptions) ? depsOrOptions : undefined;\n const opts = isFactory\n ? options\n : (depsOrOptions as UseKeyframesOptions | undefined);\n\n const target = getStyleTarget();\n\n const clientState =\n target.mode === 'client' ? getClientState(opts?.root ?? document) : null;\n\n // Client deps cache: skip factory re-evaluation when deps haven't changed\n if (isFactory && deps && opts?.name && clientState) {\n const cached = clientState.factoryDeps.get(opts.name);\n if (cached && depsEqual(cached.deps, deps)) {\n return cached.name;\n }\n }\n\n const steps = isFactory\n ? (stepsOrFactory as () => KeyframesSteps)()\n : (stepsOrFactory as KeyframesSteps);\n\n if (!steps || Object.keys(steps).length === 0) {\n return '';\n }\n\n if (target.mode === 'ssr') {\n const actualName = target.collector.allocateKeyframeName(opts?.name);\n const css = formatKeyframesCSS(actualName, steps);\n target.collector.collectKeyframes(actualName, css);\n return actualName;\n }\n\n if (target.mode === 'rsc') {\n const serializedContent = JSON.stringify(steps);\n const key = `__kf:${opts?.name ?? ''}:${serializedContent}`;\n\n const existingName = target.cache.generatedNames.get(key);\n if (existingName) return existingName;\n\n const actualName =\n opts?.name ??\n makeKeyframeName(getNamePrefix(), hashString(serializedContent));\n const css = formatKeyframesCSS(actualName, steps);\n pushRSCCSS(target.cache, key, css);\n target.cache.generatedNames.set(key, actualName);\n return actualName;\n }\n\n // Client path: stable name via content-based dedup\n const state = clientState ?? getClientState(opts?.root ?? document);\n const serializedContent = JSON.stringify(steps);\n const cacheKey = `${opts?.name ?? ''}:${serializedContent}`;\n\n const cachedName = state.contentToName.get(cacheKey);\n if (cachedName) {\n return cachedName;\n }\n\n const providedName = opts?.name;\n\n // A named slot owns exactly one injection. When its content changes, drop the\n // previous one first: disposing frees the name so the new steps can reclaim\n // it, and it keeps old @keyframes rules from piling up in the sheet.\n if (providedName) {\n const slot = state.namedSlots.get(providedName);\n\n if (slot && slot.cacheKey !== cacheKey) {\n slot.dispose();\n // Forget the stale content too, so any other call site still passing the\n // old steps re-injects instead of pointing at a removed rule.\n state.contentToName.delete(slot.cacheKey);\n state.namedSlots.delete(providedName);\n }\n }\n\n const result = keyframes(steps, {\n name: providedName,\n root: opts?.root,\n });\n\n const name = result.toString();\n state.contentToName.set(cacheKey, name);\n\n if (providedName) {\n state.namedSlots.set(providedName, { cacheKey, dispose: result.dispose });\n\n if (deps) {\n state.factoryDeps.set(providedName, { deps, name });\n }\n }\n\n return name;\n}\n","import { getGlobalInjector } from '../config';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { formatPropertyCSS } from '../ssr/format-property';\nimport type { PropertyOptions } from '../injector/types';\n\n/**\n * Options for {@link useProperty}. Extends the shared {@link PropertyOptions}\n * (which is `PropertyDefinition` plus an optional injection `root`).\n */\nexport type UsePropertyOptions = PropertyOptions;\n\n/**\n * Register 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 * The function ensures the property is only registered once per root.\n *\n * Accepts tasty token syntax for the property name:\n * - `$name` → defines `--name`\n * - `#name` → defines `--name-color` (auto-sets syntax: '<color>', defaults initialValue: 'transparent')\n * - `--name` → defines `--name` (legacy format)\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @param name - The property token ($name, #name) or CSS property name (--name)\n * @param options - Property configuration\n *\n * @example Basic property with token syntax\n * ```tsx\n * function Spinner() {\n * useProperty('$rotation', {\n * syntax: '<angle>',\n * inherits: false,\n * initialValue: '0deg',\n * });\n *\n * return <div className=\"spinner\" />;\n * }\n * ```\n *\n * @example Color property with token syntax (auto-sets syntax)\n * ```tsx\n * function MyComponent() {\n * useProperty('#theme', {\n * initialValue: 'red', // syntax: '<color>' is auto-set\n * });\n *\n * // Now --theme-color can be animated with CSS transitions\n * return <div style={{ '--theme-color': 'blue' } as React.CSSProperties}>Colored</div>;\n * }\n * ```\n *\n * @example Legacy format (still supported)\n * ```tsx\n * function ResizableBox() {\n * useProperty('--box-size', {\n * syntax: '<length>',\n * initialValue: '100px',\n * });\n *\n * return <div style={{ width: 'var(--box-size)' }} />;\n * }\n * ```\n */\nexport function useProperty(name: string, options?: UsePropertyOptions): void {\n if (!name) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Tasty] useProperty: property name is required`);\n }\n return;\n }\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n target.collector.collectInternals();\n\n const css = formatPropertyCSS(name, {\n syntax: options?.syntax,\n inherits: options?.inherits,\n initialValue: options?.initialValue,\n });\n if (css) {\n target.collector.collectProperty(name, css);\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n const css = formatPropertyCSS(name, {\n syntax: options?.syntax,\n inherits: options?.inherits,\n initialValue: options?.initialValue,\n });\n if (css) {\n pushRSCCSS(target.cache, `__prop:${name}`, css);\n }\n return;\n }\n\n const injector = getGlobalInjector();\n\n if (injector.isPropertyDefined(name, { root: options?.root })) {\n return;\n }\n\n injector.property(name, {\n syntax: options?.syntax,\n inherits: options?.inherits,\n initialValue: options?.initialValue,\n root: options?.root,\n });\n}\n","import { getGlobalInjector } from '../config';\nimport { fontFaceContentHash, formatFontFaceRule } from '../font-face';\nimport type { FontFaceDescriptors, FontFaceInput } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\n\ninterface UseFontFaceOptions {\n root?: Document | ShadowRoot;\n}\n\n/**\n * Inject CSS @font-face rules.\n * Permanent — no cleanup on unmount. Deduplicates by content hash.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @param family - The font-family name\n * @param input - Single descriptor object or array of descriptors (for multiple weights/styles)\n * @param options - Optional settings (e.g. Shadow DOM root)\n *\n * @example Single weight\n * ```tsx\n * function App() {\n * useFontFace('Brand Sans', {\n * src: 'url(\"/fonts/brand-sans.woff2\") format(\"woff2\")',\n * fontWeight: '400 700',\n * fontDisplay: 'swap',\n * });\n *\n * return <div style={{ fontFamily: '\"Brand Sans\", sans-serif' }}>Hello</div>;\n * }\n * ```\n *\n * @example Multiple weights\n * ```tsx\n * function App() {\n * useFontFace('Brand Sans', [\n * { src: 'url(\"/fonts/brand-regular.woff2\") format(\"woff2\")', fontWeight: 400, fontDisplay: 'swap' },\n * { src: 'url(\"/fonts/brand-bold.woff2\") format(\"woff2\")', fontWeight: 700, fontDisplay: 'swap' },\n * ]);\n *\n * return <div style={{ fontFamily: '\"Brand Sans\", sans-serif' }}>Hello</div>;\n * }\n * ```\n */\nexport function useFontFace(\n family: string,\n input: FontFaceInput,\n options?: UseFontFaceOptions,\n): void {\n if (!family) return;\n\n const descriptors: FontFaceDescriptors[] = Array.isArray(input)\n ? input\n : [input];\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n target.collector.collectFontFace(hash, css);\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n for (const desc of descriptors) {\n const hash = fontFaceContentHash(family, desc);\n const css = formatFontFaceRule(family, desc);\n pushRSCCSS(target.cache, `__ff:${hash}`, css);\n }\n return;\n }\n\n const injector = getGlobalInjector();\n for (const desc of descriptors) {\n injector.fontFace(family, desc, { root: options?.root });\n }\n}\n","import { getGlobalInjector, getNamePrefix } from '../config';\nimport { formatCounterStyleRule } from '../counter-style';\nimport type { CounterStyleDescriptors } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\nimport { createClientState } from '../utils/client-state';\nimport { hashString } from '../utils/hash';\nimport { makeCounterStyleName } from '../utils/name-prefix';\n\ninterface UseCounterStyleOptions {\n name?: string;\n root?: Document | ShadowRoot;\n}\n\nlet clientCounterStyleCounter = 0;\n\nconst getClientContentToName = /* @__PURE__ */ createClientState(\n () => new Map<string, string>(),\n);\n\n/**\n * Inject a CSS @counter-style rule and return the generated name.\n * Permanent — no cleanup on unmount. Deduplicates by name.\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @example Basic usage\n * ```tsx\n * function EmojiList() {\n * const styleName = useCounterStyle({\n * system: 'cyclic',\n * symbols: '\"👍\"',\n * suffix: '\" \"',\n * }, { name: 'thumbs' });\n *\n * return (\n * <ol style={{ listStyleType: styleName }}>\n * <li>First</li>\n * <li>Second</li>\n * </ol>\n * );\n * }\n * ```\n *\n */\nexport function useCounterStyle(\n descriptors: CounterStyleDescriptors,\n options?: UseCounterStyleOptions,\n): string {\n if (!descriptors || !descriptors.system) {\n return '';\n }\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n const actualName = target.collector.allocateCounterStyleName(options?.name);\n const css = formatCounterStyleRule(actualName, descriptors);\n target.collector.collectCounterStyle(actualName, css);\n return actualName;\n }\n\n if (target.mode === 'rsc') {\n const serializedContent = JSON.stringify(descriptors);\n const key = `__cs:${options?.name ?? ''}:${serializedContent}`;\n\n const existingName = target.cache.generatedNames.get(key);\n if (existingName) return existingName;\n\n const actualName =\n options?.name ??\n makeCounterStyleName(getNamePrefix(), hashString(serializedContent));\n const css = formatCounterStyleRule(actualName, descriptors);\n pushRSCCSS(target.cache, key, css);\n target.cache.generatedNames.set(key, actualName);\n return actualName;\n }\n\n // Client path: stable name via content-based dedup\n const contentToName = getClientContentToName(options?.root ?? document);\n const serializedContent = JSON.stringify(descriptors);\n const cacheKey = `${options?.name ?? ''}:${serializedContent}`;\n\n const existingName = contentToName.get(cacheKey);\n if (existingName) {\n return existingName;\n }\n\n const name =\n options?.name ??\n makeCounterStyleName(getNamePrefix(), String(clientCounterStyleCounter++));\n contentToName.set(cacheKey, name);\n\n const injector = getGlobalInjector();\n injector.counterStyle(name, descriptors, { root: options?.root });\n\n return name;\n}\n","import { getGlobalInjector, isFunctionsPolyfillEnabled } from '../config';\nimport {\n formatFunctionRule,\n parseFunctionName,\n registerFunctionPolyfill,\n} from '../functions';\nimport type { FunctionDefinition } from '../injector/types';\nimport { getStyleTarget, pushRSCCSS } from '../rsc-cache';\n\nexport interface UseFunctionOptions {\n /** Shadow root or document to inject into. */\n root?: Document | ShadowRoot;\n}\n\n/**\n * Register a CSS @function (custom function).\n *\n * @function rules are global and persistent once defined. The hook ensures the\n * function is only registered once per root (deduplicated by function name).\n *\n * Accepts tasty token syntax for the function name:\n * - `$$name` → defines `--name` (matches the call site `$$name(...)`)\n * - `$name` / `--name` → also accepted\n *\n * Works in all environments: client, SSR with collector, and React Server Components.\n *\n * @param name - The function name token (`$$name`, `$name`, or `--name`)\n * @param definition - Function definition (args, returns, result, local vars)\n *\n * Call the function through the Tasty DSL, not a raw `style` prop: an inline\n * `style` value reaches the browser unparsed, so the `$$name(...)` sugar is never\n * expanded and `polyfills.functions` cannot rewrite it either.\n *\n * @example\n * ```tsx\n * const Box = tasty({ styles: { marginTop: '$$negative(10px)' } });\n *\n * function Layout() {\n * useFunction('$$negative', { args: ['$value'], result: '(-1 * $value)' });\n * return <Box />;\n * }\n * ```\n */\nexport function useFunction(\n name: string,\n definition: FunctionDefinition,\n options?: UseFunctionOptions,\n): void {\n if (!name) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`[Tasty] useFunction: function name is required`);\n }\n return;\n }\n\n // @function polyfill: register an inline closure so call sites are expanded\n // into plain CSS by the parser. No native @function rule is emitted.\n if (isFunctionsPolyfillEnabled()) {\n registerFunctionPolyfill(name, definition);\n return;\n }\n\n const target = getStyleTarget();\n\n if (target.mode === 'ssr') {\n target.collector.collectInternals();\n\n const css = formatFunctionRule(name, definition);\n if (css) {\n target.collector.collectFunction(parseFunctionName(name), css);\n }\n return;\n }\n\n if (target.mode === 'rsc') {\n const css = formatFunctionRule(name, definition);\n if (css) {\n pushRSCCSS(target.cache, `__func:${parseFunctionName(name)}`, css);\n }\n return;\n }\n\n getGlobalInjector().func(name, definition, { root: options?.root });\n}\n","import { useInsertionEffect } from 'react';\nimport type { ReactNode } from 'react';\n\nimport { closeBatchWindow, openBatchWindow } from './injector/batch';\n\nexport interface TastyBatchProviderProps {\n children?: ReactNode;\n}\n\n/**\n * Opens a *batch window* for the commit it renders in, so `batchInjection`\n * can defer stylesheet writes without ever letting a layout effect measure an\n * unstyled element.\n *\n * Every `insertRule()` on a live sheet invalidates style for that sheet's\n * scope. When components inject during React's render phase while others read\n * layout in the same pass, the two interleave and the browser recalculates\n * style between every injection. Batching collapses that into one invalidation\n * per flush — but only if the flush happens before anything can measure.\n *\n * ```\n * provider renders -> window OPEN\n * children render -> injections queued\n * provider insertionEffect -> FLUSH, window CLOSED\n * layout effects run -> rules are in the sheet\n * ```\n *\n * `useInsertionEffect` runs in React's mutation phase, after every render in\n * the commit and before any `useLayoutEffect` — which is exactly why React\n * added it for CSS-in-JS libraries. Effects fire child-first, so this\n * provider's runs after every descendant's and still before all layout\n * effects.\n *\n * A commit that does not re-render this provider gets no window, and those\n * injections are written synchronously instead. That is the point: turning\n * `batchInjection: true` on can only ever make injection cheaper, never make a\n * measurement wrong. It also means batching applies to commits this provider\n * takes part in, so mount it as high in the tree as you can.\n *\n * Requires `configure({ batchInjection: true })`; without it this component\n * only renders its children. `batchInjection: 'always'` does not need the\n * provider at all — see that option's docs for the trade-off it accepts.\n *\n * @example\n * ```tsx\n * configure({ batchInjection: true });\n *\n * createRoot(el).render(\n * <TastyBatchProvider>\n * <App />\n * </TastyBatchProvider>,\n * );\n * ```\n */\nexport function TastyBatchProvider({ children }: TastyBatchProviderProps) {\n // Opened during render on purpose: the window has to be open before children\n // render, and this is the only phase that precedes them. It is idempotent and\n // has no other side effect, so StrictMode's double render costs nothing. A\n // render that is thrown away (aborted or suspended) leaves the window open,\n // which the microtask backstop closes — and such a render mounts nothing, so\n // nothing can measure what it queued.\n openBatchWindow();\n\n // Fires in the mutation phase, before any layout effect. No dependency array:\n // it must run on every commit this provider is part of.\n useInsertionEffect(() => {\n closeBatchWindow();\n });\n\n return children;\n}\n"],"mappings":";;;;;;AAEA,MAAM,eAAe;AAErB,SAAgB,eACd,WACA,eAAe,cACP;CACR,IAAI,OAAO,cAAc,YACvB,OAAO,UAAU,eAAe,UAAU,QAAQ;CAGpD,OAAO;AACT;;;ACRA,SAAgB,mBAAmB,OAAyB;CAC1D,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,YAChD,OAAO;CAGT,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,OAAO,OAAQ,MAAiC,aAAa;CAG/D,OAAO;AACT;;;AC0BA,SAAS,iBACP,OACA,YACA,iBACA,eACA;CACA,IAAI,cAAc,OAAO;EACvB,MAAM,mBAAmB,MAAM;EAC/B,OAAO,MAAM;CACf;CAEA,IAAI,EAAE,iBAAiB,UAAU,MAAM,kBACrC,MAAM,iBAAiB;AAE3B;AAEA,SAAS,mBAAmB,OAAgC;CAC1D,iBAAiB,OAAO,cAAc,YAAY,eAAe;CACjE,iBAAiB,OAAO,YAAY,UAAU,aAAa;CAC3D,iBAAiB,OAAO,aAAa,WAAW,cAAc;AAChE;AAMA,SAAS,iBACP,aACA,YAGA;CAEA,MAAM,SACJ,OAAO,eAAe,WAClB,EAAE,IAAI,WAAkB,IACvB;CAEP,MAAM,MAAM,OAAO,MAAO;CAC1B,MAAM,YAAY,OAAO;CACzB,MAAM,eAAe,OAAO;CAE5B,MAAM,aAAa,YAA2C,OAAO,QAAQ;EAC3E,MAAM,EACJ,IACA,OACA,MACA,QACA,YACA,UACA,WACA,WACA,OACA,GAAG,cACD;EAMJ,IAAI;EACJ,IAAI,MAC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BAAmB,MAAM,UAAU;EAC/C,IAAI,KACF,WAAW,OAAO,OAAO,UAAU,kBAAkB,IAAI,KAAK,GAAG;EAEnE;CACF;CAEA,kBAAkB,CAAC,CAAC,KAAK,MAAM,YAAY,EAAE,MAAM,SAAS,KAAK,CAAC;AACpE;;;AC7BA,SAAgB,mBAAmB,EAAE,YAAqC;CAOxE,gBAAgB;CAIhB,yBAAyB;EACvB,iBAAiB;CACnB,CAAC;CAED,OAAO;AACT"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { f as parseStyle, j as normalizeDslName, m as resetGlobalPredefinedTokens, p as resetGlobalParseFunctions, u as normalizeColorTokenValue, w as Lru } from "./dsl-C5yuAn41.js";
|
|
2
2
|
import { i as warn, n as isSelector, o as isDevEnv, r as resetStyleWarnings } from "./shared-utils-DWA4LjIa.js";
|
|
3
|
-
import { A as validateNamePrefix, B as formatFunctionPrelude, D as makeKeyframeName, F as normalizePropertyDefinition, G as registerLocalFunctionPolyfills, I as parsePropertyToken, K as resetFunctionPolyfills, M as extractLocalProperties, N as getEffectiveDefinition, O as rscClassRegexGlobal, R as extractLocalFunctions, S as PropertyTypeResolver, T as makeClassName, U as parseFunctionName, V as formatFunctionRule, _ as extractLocalFontFace, a as formatPropertyCSS, b as formatFontFaceRule, c as filterUsedKeyframes, d as replaceAnimationNames, f as resolveKeyframesNames, h as formatCounterStyleRule, i as formatKeyframesCSS, j as hashString, k as tastyClassRegex, l as hasLocalKeyframes, m as formatCounterStyleDeclarations, o as extractAnimationNamesFromStyles, p as extractLocalCounterStyle, r as formatRules, s as extractLocalKeyframes, u as mergeKeyframes, v as fontFaceContentHash, y as formatFontFaceDeclarations, z as formatFunctionDeclarations } from "./css-definitions-
|
|
4
|
-
import {
|
|
5
|
-
import { n as applyStyleConfig, r as normalizeConfig, t as resolveRecipesWith } from "./config-engine-
|
|
6
|
-
import { _ as resetConfigResources, a as getGlobalConfigTokens, c as getGlobalFunctions, d as mergeGlobalConfigTokens, f as mergeGlobalCounterStyles, g as mergeGlobalStyles, h as mergeGlobalProperties, i as getEffectiveProperties, l as getGlobalStyles, m as mergeGlobalFunctions, o as getGlobalCounterStyles, p as mergeGlobalFontFaces, s as getGlobalFontFaces, t as getRegisteredSSRCollector, v as setRuntimeConfigState } from "./runtime-state-
|
|
3
|
+
import { A as validateNamePrefix, B as formatFunctionPrelude, D as makeKeyframeName, F as normalizePropertyDefinition, G as registerLocalFunctionPolyfills, I as parsePropertyToken, K as resetFunctionPolyfills, M as extractLocalProperties, N as getEffectiveDefinition, O as rscClassRegexGlobal, R as extractLocalFunctions, S as PropertyTypeResolver, T as makeClassName, U as parseFunctionName, V as formatFunctionRule, _ as extractLocalFontFace, a as formatPropertyCSS, b as formatFontFaceRule, c as filterUsedKeyframes, d as replaceAnimationNames, f as resolveKeyframesNames, h as formatCounterStyleRule, i as formatKeyframesCSS, j as hashString, k as tastyClassRegex, l as hasLocalKeyframes, m as formatCounterStyleDeclarations, o as extractAnimationNamesFromStyles, p as extractLocalCounterStyle, r as formatRules, s as extractLocalKeyframes, u as mergeKeyframes, v as fontFaceContentHash, y as formatFontFaceDeclarations, z as formatFunctionDeclarations } from "./css-definitions-BIgGXRLz.js";
|
|
4
|
+
import { A as createStyle, C as splitSelectorsSafely, G as markStylesGeneratedState, K as resetGlobalPolyfillsState, O as resetHandlers, S as camelToKebab, U as hasStylesGenerated, W as isFunctionsPolyfillEnabled, a as registerBaseStyleProps, b as renderStyles, n as generateChunkCacheKey, o as resetBaseStyleProps, q as resetStylesGeneratedState, r as categorizeStyleKeys, t as renderStylesForChunk, w as STYLE_HANDLER_MAP, y as clearPipelineCache, z as resetStyleChunks } from "./style-engine-BpgmapBp.js";
|
|
5
|
+
import { n as applyStyleConfig, r as normalizeConfig, t as resolveRecipesWith } from "./config-engine-BAldIMv7.js";
|
|
6
|
+
import { _ as resetConfigResources, a as getGlobalConfigTokens, c as getGlobalFunctions, d as mergeGlobalConfigTokens, f as mergeGlobalCounterStyles, g as mergeGlobalStyles, h as mergeGlobalProperties, i as getEffectiveProperties, l as getGlobalStyles, m as mergeGlobalFunctions, o as getGlobalCounterStyles, p as mergeGlobalFontFaces, s as getGlobalFontFaces, t as getRegisteredSSRCollector, v as setRuntimeConfigState } from "./runtime-state-BMtykrat.js";
|
|
7
7
|
import React from "react";
|
|
8
8
|
//#region src/prop-handlers.ts
|
|
9
9
|
const GTKEY = "__tasty_prop_handlers__";
|
|
@@ -188,38 +188,6 @@ const supportsConstructableSheets = typeof CSSStyleSheet !== "undefined" && (()
|
|
|
188
188
|
function wrapAtRules(css, atRules) {
|
|
189
189
|
return atRules?.reduce((wrapped, atRule) => `${atRule} { ${wrapped} }`, css) ?? css;
|
|
190
190
|
}
|
|
191
|
-
function splitSelectorsSafely(selectorList) {
|
|
192
|
-
const parts = [];
|
|
193
|
-
let buffer = "";
|
|
194
|
-
let squareDepth = 0;
|
|
195
|
-
let parenDepth = 0;
|
|
196
|
-
let quote = "";
|
|
197
|
-
for (let i = 0; i < selectorList.length; i++) {
|
|
198
|
-
const char = selectorList[i];
|
|
199
|
-
if (quote) {
|
|
200
|
-
if (char === quote && selectorList[i - 1] !== "\\") quote = "";
|
|
201
|
-
buffer += char;
|
|
202
|
-
continue;
|
|
203
|
-
}
|
|
204
|
-
if (char === "\"" || char === "'") {
|
|
205
|
-
quote = char;
|
|
206
|
-
buffer += char;
|
|
207
|
-
continue;
|
|
208
|
-
}
|
|
209
|
-
if (char === "[") squareDepth++;
|
|
210
|
-
else if (char === "]") squareDepth = Math.max(0, squareDepth - 1);
|
|
211
|
-
else if (char === "(") parenDepth++;
|
|
212
|
-
else if (char === ")") parenDepth = Math.max(0, parenDepth - 1);
|
|
213
|
-
if (char === "," && squareDepth === 0 && parenDepth === 0) {
|
|
214
|
-
const part = buffer.trim();
|
|
215
|
-
if (part) parts.push(part);
|
|
216
|
-
buffer = "";
|
|
217
|
-
} else buffer += char;
|
|
218
|
-
}
|
|
219
|
-
const tail = buffer.trim();
|
|
220
|
-
if (tail) parts.push(tail);
|
|
221
|
-
return parts;
|
|
222
|
-
}
|
|
223
191
|
function rulesToCSS(sheet) {
|
|
224
192
|
return Array.from(sheet.cssRules, (rule) => rule.cssText).join("\n");
|
|
225
193
|
}
|
|
@@ -2314,6 +2282,8 @@ function computeStyles(styles, options) {
|
|
|
2314
2282
|
//#region src/utils/filter-base-props.ts
|
|
2315
2283
|
const BasePropNames = new Set([
|
|
2316
2284
|
"role",
|
|
2285
|
+
"title",
|
|
2286
|
+
"inert",
|
|
2317
2287
|
"as",
|
|
2318
2288
|
"element",
|
|
2319
2289
|
"css",
|
|
@@ -2435,4 +2405,4 @@ function depsEqual(a, b) {
|
|
|
2435
2405
|
//#endregion
|
|
2436
2406
|
export { propHandlerRegistry as $, ownKeyframes as A, getNamePrefix as B, holdKeyframes as C, injector as D, injectRawCSS as E, configure as F, resetConfig as G, hasGlobalRecipes as H, getConfig as I, closeBatchWindow as J, StyleInjector as K, getGlobalInjector as L, touch as M, ChunkSheetRegistry as N, isPropertyDefined as O, chunkSheetRegistry as P, resetStyleBatch as Q, getGlobalKeyframes as R, getRawCSSText as S, injectGlobal as T, isConfigLocked as U, hasGlobalKeyframes as V, isTestEnvironment as W, hasPendingStyleWrites as X, flushStyles as Y, openBatchWindow as Z, fontFace as _, filterBaseProps as a, getCSSText as b, hasKeys as c, getStyleTarget as d, pushRSCCSS as f, destroy as g, createInjector as h, modAttrs as i, property as j, keyframes as k, collectAutoInferredProperties as l, counterStyle as m, createClientState as n, computeStyles as o, cleanup as p, SheetManager as q, processTokens as r, resolveRecipes as s, depsEqual as t, collectAutoInferredPropertiesRSC as u, func as v, inject as w, getCSSTextForNode as x, gc as y, getGlobalRecipes as z };
|
|
2437
2407
|
|
|
2438
|
-
//# sourceMappingURL=runtime-engine-
|
|
2408
|
+
//# sourceMappingURL=runtime-engine-B_4lx2DJ.js.map
|