clava 0.6.2 → 0.6.4
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/CHANGELOG.md +26 -0
- package/README.md +32 -11
- package/dist/index.d.ts +1 -1
- package/dist/index.js +586 -547
- package/dist/index.js.map +1 -1
- package/package.json +8 -7
- package/src/index.ts +1111 -1021
- package/src/refine-warning.ts +9 -5
- package/src/utils.ts +14 -0
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/utils.ts","../src/refine-warning.ts","../src/index.ts"],"sourcesContent":["import type { HTMLCSSProperties, StyleValue } from \"./types.ts\";\n\nexport const hasOwn = Object.hasOwn;\n\n// Keep this explicit so normalization does not depend on browser globals.\n// Vendor-prefixed variants are derived below instead of duplicating the list.\nconst unitlessNumberProperties = new Set([\n \"animationIterationCount\",\n \"aspectRatio\",\n \"borderImage\",\n \"borderImageOutset\",\n \"borderImageSlice\",\n \"borderImageWidth\",\n \"boxFlex\",\n \"boxFlexGroup\",\n \"boxOrdinalGroup\",\n \"columnCount\",\n \"columns\",\n \"fillOpacity\",\n \"flex\",\n \"flexGrow\",\n \"flexNegative\",\n \"flexOrder\",\n \"flexPositive\",\n \"flexShrink\",\n \"floodOpacity\",\n \"fontSizeAdjust\",\n \"fontWeight\",\n \"gridArea\",\n \"gridColumn\",\n \"gridColumnEnd\",\n \"gridColumnSpan\",\n \"gridColumnStart\",\n \"gridRow\",\n \"gridRowEnd\",\n \"gridRowSpan\",\n \"gridRowStart\",\n \"hyphenateLimitChars\",\n \"initialLetter\",\n \"lineClamp\",\n \"lineHeight\",\n \"maskBorder\",\n \"maskBorderOutset\",\n \"maskBorderSlice\",\n \"maskBorderWidth\",\n \"mathDepth\",\n \"maxLines\",\n \"opacity\",\n \"order\",\n \"orphans\",\n \"scale\",\n \"shapeImageThreshold\",\n \"stopOpacity\",\n \"strokeDasharray\",\n \"strokeDashoffset\",\n \"strokeMiterlimit\",\n \"strokeOpacity\",\n \"strokeWidth\",\n \"tabSize\",\n \"widows\",\n \"zIndex\",\n \"zoom\",\n]);\n\nfunction isCustomProperty(property: string) {\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45;\n}\n\n/**\n * Converts a hyphenated CSS property name to camelCase.\n * @example\n * hyphenToCamel(\"background-color\") // \"backgroundColor\"\n * hyphenToCamel(\"-ms-transition\") // \"msTransition\" (lowercase \"ms\" prefix)\n * hyphenToCamel(\"--custom-var\") // \"--custom-var\" (CSS variables are preserved)\n */\nexport function hyphenToCamel(str: string) {\n // CSS custom properties (variables) should not be converted\n if (isCustomProperty(str)) {\n return str;\n }\n // Fast path: no hyphen -> return as-is\n let hyphenIndex = str.indexOf(\"-\");\n if (hyphenIndex === -1) {\n return str;\n }\n\n let result = \"\";\n let lastIndex = 0;\n while (hyphenIndex !== -1) {\n result += str.slice(lastIndex, hyphenIndex);\n\n const nextIndex = hyphenIndex + 1;\n if (nextIndex >= str.length) {\n result += \"-\";\n lastIndex = nextIndex;\n break;\n }\n\n const code = str.charCodeAt(nextIndex);\n const isAsciiLetter =\n (code >= 65 && code <= 90) || (code >= 97 && code <= 122);\n if (isAsciiLetter) {\n const isMicrosoftPrefix = hyphenIndex === 0 && str.startsWith(\"ms-\", 1);\n result += isMicrosoftPrefix\n ? str[nextIndex]\n : str[nextIndex].toUpperCase();\n lastIndex = nextIndex + 1;\n } else {\n result += \"-\";\n lastIndex = nextIndex;\n }\n\n hyphenIndex = str.indexOf(\"-\", lastIndex);\n }\n\n return result + str.slice(lastIndex);\n}\n\n/**\n * Converts a camelCase CSS property name to hyphenated form.\n * @example\n * camelToHyphen(\"backgroundColor\") // \"background-color\"\n * camelToHyphen(\"msTransition\") // \"-ms-transition\" (lowercase \"ms\" prefix)\n * camelToHyphen(\"--customVar\") // \"--customVar\" (CSS variables are preserved)\n */\nexport function camelToHyphen(str: string) {\n // CSS custom properties (variables) should not be converted\n if (isCustomProperty(str)) {\n return str;\n }\n\n let result = \"\";\n let lastIndex = 0;\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n if (code < 65 || code > 90) continue;\n const isMicrosoftPrefix = i === 2 && str.startsWith(\"ms\");\n if (isMicrosoftPrefix) {\n result += \"-\";\n }\n result += str.slice(lastIndex, i);\n result += \"-\";\n result += str[i].toLowerCase();\n lastIndex = i + 1;\n }\n\n if (lastIndex === 0) {\n return str;\n }\n return result + str.slice(lastIndex);\n}\n\nfunction hasVendorPrefix(property: string, prefix: string) {\n const nextCode = property.charCodeAt(prefix.length);\n if (nextCode < 65 || nextCode > 90) return false;\n return property.startsWith(prefix);\n}\n\n// \"ms\" is used in JSX, while camelizing hyphenated properties produces \"Ms\".\nconst vendorPrefixes = [\"Webkit\", \"Moz\", \"ms\", \"Ms\", \"O\"];\n\nfunction isUnitlessNumberProperty(property: string) {\n if (unitlessNumberProperties.has(property)) return true;\n\n for (const prefix of vendorPrefixes) {\n if (!hasVendorPrefix(property, prefix)) continue;\n const firstCode = property.charCodeAt(prefix.length);\n const unprefixedProperty =\n String.fromCharCode(firstCode + 32) + property.slice(prefix.length + 1);\n return unitlessNumberProperties.has(unprefixedProperty);\n }\n return false;\n}\n\nfunction normalizeStyleValue(property: string, value: string | number) {\n if (typeof value === \"string\") {\n return value;\n }\n if (isCustomProperty(property)) {\n return value;\n }\n if (isUnitlessNumberProperty(property)) {\n return value;\n }\n return `${value}px`;\n}\n\n/**\n * Parses a CSS style string into a StyleValue object.\n * @example\n * htmlStyleToStyleValue(\"background-color: red; font-size: 16px;\");\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function htmlStyleToStyleValue(\n styleString: string,\n result: StyleValue = {},\n) {\n if (!styleString) return result;\n const len = styleString.length;\n let i = 0;\n while (i < len) {\n // Skip leading whitespace and stray semicolons\n while (i < len) {\n const c = styleString.charCodeAt(i);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13 && c !== 59) break;\n i++;\n }\n if (i >= len) break;\n // Read property name until ':' or ';'\n const propStart = i;\n while (i < len) {\n const c = styleString.charCodeAt(i);\n if (c === 58 || c === 59) break;\n i++;\n }\n if (i >= len || styleString.charCodeAt(i) === 59) {\n // No colon found - skip this declaration\n if (i < len) {\n // Skip ';'.\n i++;\n }\n continue;\n }\n let propEnd = i;\n // Trim trailing whitespace from property name\n while (propEnd > propStart) {\n const c = styleString.charCodeAt(propEnd - 1);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n propEnd--;\n }\n if (propEnd === propStart) {\n // Empty property - skip\n while (i < len && styleString.charCodeAt(i) !== 59) {\n i++;\n }\n if (i < len) {\n i++;\n }\n continue;\n }\n const property = styleString.slice(propStart, propEnd);\n // Skip ':'.\n i++;\n // Skip whitespace before value\n while (i < len) {\n const c = styleString.charCodeAt(i);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n i++;\n }\n const valStart = i;\n while (i < len && styleString.charCodeAt(i) !== 59) {\n i++;\n }\n let valEnd = i;\n while (valEnd > valStart) {\n const c = styleString.charCodeAt(valEnd - 1);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n valEnd--;\n }\n if (i < len) {\n // Skip ';'.\n i++;\n }\n if (valEnd === valStart) continue;\n const value = styleString.slice(valStart, valEnd);\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string>)[hyphenToCamel(property)] = value;\n }\n\n return result;\n}\n\n/**\n * Converts a hyphenated style object to a camelCase StyleValue object.\n * @example\n * htmlObjStyleToStyleValue({ \"background-color\": \"red\", \"font-size\": \"16px\" });\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function htmlObjStyleToStyleValue(\n style: object,\n result: StyleValue = {},\n): StyleValue {\n for (const key in style) {\n if (!hasOwn(style, key)) continue;\n const value = (style as Record<string, unknown>)[key];\n if (value == null) continue;\n const property = hyphenToCamel(key);\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string | number>)[property] = normalizeStyleValue(\n property,\n value as string | number,\n );\n }\n return result;\n}\n\n/**\n * Converts a StyleValue object to a CSS style string.\n * @example\n * styleValueToHTMLStyle({ backgroundColor: \"red\", fontSize: \"16px\" });\n * // \"background-color: red; font-size: 16px;\"\n */\nexport function styleValueToHTMLStyle(style: StyleValue): string {\n let result = \"\";\n for (const key in style) {\n if (!hasOwn(style, key)) continue;\n const value = (style as Record<string, unknown>)[key];\n if (value == null) continue;\n if (result) {\n result += \"; \";\n }\n result += camelToHyphen(key);\n result += \": \";\n result += value as string | number;\n }\n if (!result) return \"\";\n return `${result};`;\n}\n\n/**\n * Converts a StyleValue object to a hyphenated style object.\n * @example\n * styleValueToHTMLObjStyle({ backgroundColor: \"red\", fontSize: \"16px\" });\n * // { \"background-color\": \"red\", \"font-size\": \"16px\" }\n */\nexport function styleValueToHTMLObjStyle(style: StyleValue) {\n const result: HTMLCSSProperties = {};\n for (const key in style) {\n if (!hasOwn(style, key)) continue;\n const value = (style as Record<string, unknown>)[key];\n if (value == null) continue;\n (result as Record<string, unknown>)[camelToHyphen(key)] = value;\n }\n return result;\n}\n","import { hasOwn } from \"./utils.ts\";\n\nexport interface CreationFrame {\n stack?: string;\n}\n\nexport interface VariantChange {\n from: unknown;\n to: unknown;\n}\n\n// Once a refine loop is within this many iterations of the cap, start tracking\n// the latest value transition for every variant key that changes between\n// iterations so the warning can report every key that contributed to the\n// oscillation, not just the keys that happened to flip on the final step.\n// Convergent loops (the common case) exit well before this threshold and pay no\n// per-iteration tracking cost.\nexport const REFINE_UNSTABLE_TRACKING_WINDOW = 10;\n\n// Captures the call site of the function passed in `skipFn` so refine-limit\n// warnings can point developers at the originating `cv()` call. Returns\n// `undefined` in production so bundlers that replace `process.env.NODE_ENV` at\n// build time can drop the entire warning machinery. The underlying `.stack`\n// string is formatted lazily on first access in every major engine (V8,\n// SpiderMonkey, JavaScriptCore), so holding the captured frame for the\n// lifetime of the component is cheap when no warning fires.\nexport function captureCreationFrame(\n skipFn: Function,\n): CreationFrame | undefined {\n if (process.env.NODE_ENV === \"production\") return undefined;\n if (typeof Error.captureStackTrace === \"function\") {\n const holder: CreationFrame = {};\n Error.captureStackTrace(holder, skipFn);\n return holder;\n }\n // Engines without `Error.captureStackTrace` (SpiderMonkey, JavaScriptCore)\n // can't strip internal frames, but their `Error.stack` getter is still\n // lazy, so returning the Error instance defers the format cost. The\n // resulting trace includes 1–2 extra frames at the top from this helper and\n // `cv` itself.\n return new Error();\n}\n\nexport function formatCreationStack(frame: CreationFrame): string | undefined {\n let stack = frame.stack;\n if (!stack) return undefined;\n // V8 prefixes the stack with a leading \"Error\" / \"Error: message\" line that\n // isn't meaningful for a captured location — drop it.\n const newlineIdx = stack.indexOf(\"\\n\");\n if (newlineIdx > 0) {\n const firstLine = stack.slice(0, newlineIdx);\n if (firstLine === \"Error\" || firstLine.startsWith(\"Error:\")) {\n stack = stack.slice(newlineIdx + 1);\n }\n }\n const frames = stack.split(\"\\n\");\n for (let i = 0; i < frames.length; i++) {\n const line = frames[i]?.trim();\n if (!line) continue;\n if (isInternalCreationFrame(line)) continue;\n if (line.includes(\"/node_modules/\")) continue;\n if (line.includes(\"\\\\node_modules\\\\\")) continue;\n if (line.includes(\"node:internal\")) continue;\n return ` ${line}`;\n }\n return undefined;\n}\n\nfunction isInternalCreationFrame(line: string): boolean {\n if (line.includes(\"captureCreationFrame\")) return true;\n if (line.startsWith(\"at cv \")) return true;\n if (line.startsWith(\"at cv(\")) return true;\n if (line.startsWith(\"cv@\")) return true;\n return false;\n}\n\nfunction formatVariantValue(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\") {\n if (Number.isNaN(value)) return \"NaN\";\n return String(value);\n }\n if (typeof value === \"bigint\") return `${value}n`;\n if (value === undefined) return \"undefined\";\n if (value === null) return \"null\";\n if (typeof value === \"boolean\") return String(value);\n if (typeof value === \"symbol\") return String(value);\n if (typeof value === \"function\") return \"[function]\";\n return \"[object]\";\n}\n\nfunction setVariantChange(\n into: Map<string, VariantChange>,\n key: string,\n from: unknown,\n to: unknown,\n): void {\n into.set(key, { from, to });\n}\n\nexport function accumulateUnstableVariantChanges(\n into: Map<string, VariantChange>,\n prev: Record<string, unknown>,\n next: Record<string, unknown>,\n): void {\n for (const key in next) {\n if (!hasOwn(next, key)) continue;\n if (!Object.is(prev[key], next[key])) {\n setVariantChange(into, key, prev[key], next[key]);\n }\n }\n for (const key in prev) {\n if (!hasOwn(prev, key)) continue;\n if (hasOwn(next, key)) continue;\n setVariantChange(into, key, prev[key], undefined);\n }\n}\n\nfunction formatVariantChanges(changes: Map<string, VariantChange>): string {\n return Array.from(changes)\n .map(([key, { from, to }]) => {\n return `${key}: ${formatVariantValue(from)} -> ${formatVariantValue(to)}`;\n })\n .join(\", \");\n}\n\ninterface WarnRefineLimitParams {\n creationFrame: CreationFrame | undefined;\n unstableChanges: Map<string, VariantChange> | null;\n}\n\nexport function warnRefineLimit({\n creationFrame,\n unstableChanges,\n}: WarnRefineLimitParams): void {\n // Bundlers are expected to replace this branch with a production literal,\n // allowing warning-only code below to be removed from consumer bundles.\n if (process.env.NODE_ENV === \"production\") return;\n let message =\n \"Clava: Maximum refine iterations exceeded. This can happen when a \" +\n \"computed default variant or refine callback changes one of the \" +\n \"variants on every run.\";\n if (unstableChanges && unstableChanges.size > 0) {\n message += `\\nVariant(s) that did not stabilize: ${Array.from(unstableChanges.keys()).join(\", \")}.`;\n message += `\\nLatest variant changes before warning: ${formatVariantChanges(unstableChanges)}.`;\n }\n if (creationFrame) {\n const creationStack = formatCreationStack(creationFrame);\n if (creationStack) {\n message += `\\nComponent created at:\\n${creationStack}`;\n }\n }\n console.warn(message);\n}\n","import clsx, { type ClassValue as ClsxClassValue } from \"clsx\";\nimport {\n REFINE_UNSTABLE_TRACKING_WINDOW,\n type VariantChange,\n accumulateUnstableVariantChanges,\n captureCreationFrame,\n warnRefineLimit,\n} from \"./refine-warning.ts\";\nimport type {\n AnyComponent,\n CVComponent,\n ClassValue,\n ComponentProps,\n ComponentResult,\n DefaultVariants,\n ExtendableVariants,\n HTMLObjProps,\n HTMLProps,\n JSXProps,\n KeySourceComponent,\n MergeVariants,\n ModalComponent,\n Refine,\n SplitPropsFunction,\n StyleClassProps,\n StyleClassValue,\n StyleValue,\n VariantValues,\n Variants,\n} from \"./types.ts\";\nimport {\n hasOwn,\n htmlObjStyleToStyleValue,\n htmlStyleToStyleValue,\n styleValueToHTMLObjStyle,\n styleValueToHTMLStyle,\n} from \"./utils.ts\";\n\n// Internal compute path: pushes the variant classes contributed by this\n// component (and its extends chain) into `classesOut` and merges any styles\n// into `styleOut`. Base class is handled by callers via ComponentMeta.baseClass\n// to avoid string-parsing round trips. Both outputs are mutated in place to\n// avoid intermediate allocations.\ntype ComputeFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n skipKeys: Set<string> | null,\n skipValues: Record<string, Set<string>> | null,\n classesOut: ClsxClassValue[],\n styleOut: StyleValue,\n) => Record<string, unknown>;\n\ntype ComputeOnceFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n skipKeys: Set<string> | null,\n skipValues: Record<string, Set<string>> | null,\n classesOut: ClsxClassValue[],\n styleOut: StyleValue,\n protectedVariants?: Record<string, unknown> | null,\n protectedVariantKeys?: Set<string> | null,\n defaultResolved?: Record<string, unknown>,\n renderOnly?: boolean,\n) => Record<string, unknown>;\n\ntype ResolveRefineFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n filterOwnVariants?: boolean,\n) => Record<string, unknown>;\n\ntype ResolveRefineOnceFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n filterOwnVariants?: boolean,\n protectedVariants?: Record<string, unknown> | null,\n protectedVariantKeys?: Set<string> | null,\n defaultResolved?: Record<string, unknown>,\n) => Record<string, unknown>;\n\ntype ComputedDefaultVariantFn = (\n defaultValue: unknown,\n variants: Readonly<Record<string, unknown>>,\n) => unknown;\n\n// Internal metadata stored on components but hidden from public types.\ninterface ComponentMeta {\n baseClass: string;\n staticDefaults: Record<string, unknown>;\n // Performs a single compute pass for extending components, returning the\n // resolved variants while pushing classes and styles into the output values.\n compute: ComputeOnceFn;\n resolveRefine: ResolveRefineOnceFn | null;\n // Reference identity is used to detect mixed-factory `extend`. When a\n // component is extended by a parent from a different `create()` call, the\n // parent applies this transform to the extend's contribution before joining,\n // preserving each factory's transform boundary.\n transformClass: (className: string) => string;\n // Variant keys whose effective definition in this component's chain is a\n // function. An extending component that supplies a non-function variant for\n // the same key uses this to tell us to skip that key (matching the\n // type-level \"function variant is replaced by anything in the child\" rule).\n // Empty when no key in this chain is a function variant.\n functionVariantKeys: Set<string>;\n // Variant keys with computed defaults anywhere in this component's chain.\n // Child components use this to preserve inherited computed defaults through\n // `defaultValue` without preserving their own prior computed result.\n computedDefaultKeys: Set<string>;\n}\n\nconst META_KEY = \"__meta\";\n\ninterface ComponentWithMeta {\n [META_KEY]?: ComponentMeta;\n}\n\nconst EMPTY_DEFAULTS: Record<string, unknown> = {};\n\nconst MAX_REFINE_RUNS = 50;\n\nfunction areVariantsEqual(\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n): boolean {\n for (const key in a) {\n if (!hasOwn(a, key)) continue;\n if (!Object.is(a[key], b[key])) return false;\n }\n for (const key in b) {\n if (!hasOwn(b, key)) continue;\n if (!hasOwn(a, key)) return false;\n }\n return true;\n}\n\nfunction getExtUserVariantProps(\n userVariantProps: Record<string, unknown>,\n protectedVariants: Record<string, unknown> | null,\n): Record<string, unknown> {\n return Object.assign({}, userVariantProps, protectedVariants);\n}\n\nfunction mergeProtectedIntoBase(\n baseResolved: Record<string, unknown>,\n protectedVariants: Record<string, unknown>,\n protectedVariantKeys: Set<string>,\n): Record<string, unknown> {\n if (protectedVariantKeys.size === 0) return baseResolved;\n return Object.assign({}, baseResolved, protectedVariants);\n}\n\nexport type {\n ClassValue,\n StyleValue,\n StyleClassProps,\n StyleClassValue,\n JSXProps,\n HTMLProps,\n HTMLObjProps,\n CVComponent,\n};\n\n/**\n * Extracts the variant props inferred for a Clava component. Use it to add a\n * component's variant props to framework component props.\n *\n * @example\n * ```ts\n * import { type VariantProps, cv } from \"clava\";\n * import type { ComponentProps } from \"react\";\n *\n * const button = cv({\n * variants: {\n * size: { sm: \"button-sm\", lg: \"button-lg\" },\n * disabled: { true: \"button-disabled\", false: \"\" },\n * },\n * });\n *\n * interface ButtonProps\n * extends ComponentProps<\"button\">,\n * VariantProps<typeof button> {}\n *\n * const props: ButtonProps = {\n * size: \"lg\",\n * disabled: true,\n * };\n * ```\n */\nexport type VariantProps<T extends Pick<AnyComponent, \"getVariants\">> =\n ReturnType<T[\"getVariants\"]>;\n\n// Variant props expose booleans, but variant object keys are always strings.\ntype VariantKey<T> = T extends boolean ? \"true\" | \"false\" : Extract<T, string>;\n\n/**\n * Constrains a variant map to the same value keys as a variant on another\n * component. Boolean variants are represented with `\"true\"` and `\"false\"`\n * object keys.\n *\n * @example\n * ```ts\n * import { type Variant, cv } from \"clava\";\n *\n * const button = cv({\n * variants: {\n * size: { sm: \"button-sm\", lg: \"button-lg\" },\n * },\n * });\n *\n * const icon = cv({\n * extend: [button],\n * variants: {\n * size: {\n * sm: \"icon-sm\",\n * lg: \"icon-lg\",\n * } satisfies Variant<typeof button, \"size\">,\n * },\n * });\n * ```\n */\nexport type Variant<\n T extends Pick<AnyComponent, \"getVariants\">,\n K extends keyof VariantProps<T>,\n> = Record<\n VariantKey<NonNullable<VariantProps<T>[K]>>,\n ClassValue | StyleClassValue\n>;\n\n/**\n * The configuration object accepted by `cv()`. It defines base class/style\n * output, variants, default variants, component extensions, and refinement\n * logic.\n *\n * @example\n * ```ts\n * import { type CVConfig, cv } from \"clava\";\n *\n * const config: CVConfig<{\n * tone: { info: string; danger: string };\n * }> = {\n * variants: {\n * tone: {\n * info: \"alert-info\",\n * danger: \"alert-danger\",\n * },\n * },\n * defaultVariants: {\n * tone: \"info\",\n * },\n * };\n *\n * const alert = cv(config);\n * ```\n */\nexport interface CVConfig<\n V extends Variants = {},\n E extends AnyComponent[] = [],\n> {\n extend?: E;\n class?: ClassValue;\n style?: StyleValue;\n variants?: ExtendableVariants<V, E>;\n defaultVariants?: DefaultVariants<MergeVariants<V, E>>;\n refine?: Refine<MergeVariants<V, E>>;\n}\n\ninterface CreateParams {\n transformClass?: (className: string) => string;\n}\n\nfunction isRecordObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\") return false;\n if (value == null) return false;\n if (Array.isArray(value)) return false;\n return true;\n}\n\n/**\n * Converts any style input (string, JSX object, or HTML object) to a normalized\n * StyleValue.\n */\nfunction normalizeStyle(style: unknown): StyleValue {\n if (typeof style === \"string\") {\n return htmlStyleToStyleValue(style);\n }\n if (typeof style === \"object\" && style != null) {\n return htmlObjStyleToStyleValue(style);\n }\n return {};\n}\n\n/**\n * Pre-extracts the class and (normalized) style from a variant value once at\n * component creation time. Returns `null` if the value contributes nothing.\n */\ninterface PrebuiltValue {\n class: ClassValue;\n style: StyleValue | null;\n}\n\nfunction extractClassAndStylePrebuilt(value: unknown): PrebuiltValue {\n if (!isRecordObject(value)) {\n return { class: value as ClassValue, style: null };\n }\n if (!(\"style\" in value || \"class\" in value)) {\n return { class: null, style: null };\n }\n const styleClassValue = value as StyleClassValue;\n const style = normalizeStyle(styleClassValue.style);\n return {\n class: styleClassValue.class ?? null,\n style: Object.keys(style).length > 0 ? style : null,\n };\n}\n\nfunction getVariantValueKey(value: unknown): string | undefined {\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n if (typeof value === \"boolean\") {\n return String(value);\n }\n return undefined;\n}\n\nconst EMPTY_KEYS: readonly string[] = [];\n\nfunction isComponentKeySource(source: unknown): source is KeySourceComponent {\n if (!source) return false;\n if (typeof source !== \"object\" && typeof source !== \"function\") {\n return false;\n }\n const typed = source as Record<string, unknown>;\n if (typeof typed.getVariants !== \"function\") return false;\n if (!Array.isArray(typed.propKeys)) return false;\n return Array.isArray(typed.variantKeys);\n}\n\n/**\n * Splits props into multiple groups based on key sources. Only the first\n * component claims styling props (class/className/style). Subsequent components\n * only receive variant props. Arrays always receive their listed keys but don't\n * claim styling props.\n */\nfunction splitPropsImpl(\n selfKeys: readonly string[],\n selfIsComponent: boolean,\n props: Record<string, unknown>,\n sources: unknown[],\n): Record<string, unknown>[] {\n const sourcesLength = sources.length;\n const results: Record<string, unknown>[] = [];\n let stylingClaimed = selfIsComponent;\n\n const selfResult: Record<string, unknown> = {};\n const selfKeysLength = selfKeys.length;\n for (let i = 0; i < selfKeysLength; i++) {\n const key = selfKeys[i];\n if (key !== undefined && hasOwn(props, key)) {\n selfResult[key] = props[key];\n }\n }\n results.push(selfResult);\n\n // Track effective key arrays for the rest computation — for typical inputs\n // a linear scan beats building a Set up-front.\n const effectiveKeyArrays: Array<readonly string[]> = [selfKeys];\n\n for (let s = 0; s < sourcesLength; s++) {\n const source = sources[s];\n const sourceResult: Record<string, unknown> = {};\n let sourceIsComponent = false;\n let effectiveKeys: readonly string[];\n if (Array.isArray(source)) {\n effectiveKeys = source;\n } else if (isComponentKeySource(source)) {\n sourceIsComponent = true;\n effectiveKeys = stylingClaimed ? source.variantKeys : source.propKeys;\n } else {\n effectiveKeys = EMPTY_KEYS;\n }\n\n const effectiveKeysLength = effectiveKeys.length;\n for (let i = 0; i < effectiveKeysLength; i++) {\n const key = effectiveKeys[i];\n if (key !== undefined && hasOwn(props, key)) {\n sourceResult[key] = props[key];\n }\n }\n results.push(sourceResult);\n effectiveKeyArrays.push(effectiveKeys);\n\n if (sourceIsComponent && !stylingClaimed) {\n stylingClaimed = true;\n }\n }\n\n const rest: Record<string, unknown> = {};\n const propKeys = Object.keys(props);\n const propKeysLength = propKeys.length;\n const groupCount = sourcesLength + 1;\n outer: for (let i = 0; i < propKeysLength; i++) {\n const key = propKeys[i];\n if (key === undefined) continue;\n for (let g = 0; g < groupCount; g++) {\n const arr = effectiveKeyArrays[g];\n if (arr === undefined) continue;\n const arrLength = arr.length;\n for (let j = 0; j < arrLength; j++) {\n if (arr[j] === key) continue outer;\n }\n }\n rest[key] = props[key];\n }\n results.push(rest);\n\n return results;\n}\n\n/**\n * Splits props into multiple groups based on key sources. Each source gets its\n * own result object containing all its matching keys. The first component\n * source claims styling props (class/className/style). Subsequent components\n * only receive variant props. Arrays receive their listed keys but don't claim\n * styling props. The last element is always the \"rest\" containing keys not\n * claimed by any source.\n */\nexport const splitProps: SplitPropsFunction = ((\n props: Record<string, unknown>,\n source1: unknown,\n ...sources: unknown[]\n) => {\n if (Array.isArray(source1)) {\n return splitPropsImpl(source1, false, props, sources);\n }\n if (isComponentKeySource(source1)) {\n return splitPropsImpl(source1.propKeys, true, props, sources);\n }\n return splitPropsImpl(EMPTY_KEYS, false, props, sources);\n}) as SplitPropsFunction;\n\n/**\n * A pre-built variant. Maps variant value keys (or the literal \"true\"/\"false\"\n * strings for boolean variants) to PrebuiltValue. Includes a \"shorthand\"\n * fallback when the variant is a single class value (treated as `{ true: ... }`).\n */\ninterface PrebuiltVariant {\n // For object variants: map of value -> prebuilt class/style\n values: Record<string, PrebuiltValue> | null;\n // For shorthand variants: the value to use when selectedValue is true\n shorthand: PrebuiltValue | null;\n // Set of value keys that are disabled (value === null in the original variant\n // definition)\n disabledValues: Set<string> | null;\n}\n\nfunction buildPrebuiltVariant(variantDef: unknown): PrebuiltVariant {\n if (!isRecordObject(variantDef)) {\n return {\n values: null,\n shorthand: extractClassAndStylePrebuilt(variantDef),\n disabledValues: null,\n };\n }\n const values: Record<string, PrebuiltValue> = {};\n let disabledValues: Set<string> | null = null;\n for (const key in variantDef) {\n if (!hasOwn(variantDef, key)) continue;\n const value = variantDef[key];\n if (value === null) {\n if (!disabledValues) {\n disabledValues = new Set<string>();\n }\n disabledValues.add(key);\n continue;\n }\n values[key] = extractClassAndStylePrebuilt(value);\n }\n return {\n values,\n shorthand: null,\n disabledValues,\n };\n}\n\n/**\n * Creates the cv and cx functions.\n */\nexport function create({\n transformClass = (className) => className,\n}: CreateParams = {}) {\n const cx = (...classes: ClsxClassValue[]) => transformClass(clsx(classes));\n\n const cv = <V extends Variants = {}, const E extends AnyComponent[] = []>(\n config: CVConfig<V, E> = {},\n ): CVComponent<V, E> => {\n type MergedVariants = MergeVariants<V, E>;\n\n // ----- Pre-computed at creation time -----\n const extend = config.extend;\n const hasExtend = !!extend && extend.length > 0;\n const variants = config.variants;\n const refine = config.refine;\n const baseStyle = config.style;\n const hasBaseStyle = !!baseStyle;\n\n const variantKeySet = new Set<string>();\n const staticDefaults: Record<string, unknown> = {};\n\n // Pre-build extended component info, so the render path doesn't need to\n // read component metadata. Extends from a different `create()`\n // factory (different `transformClass` identity) need their contribution\n // transformed by their own `transformClass` before being joined into our\n // class string.\n const extMetas: ComponentMeta[] = [];\n const extBaseClassesArr: string[] = [];\n const extIsolated: boolean[] = [];\n let hasIsolatedExt = false;\n if (hasExtend) {\n for (const ext of extend) {\n const extKeys = ext.variantKeys as readonly string[];\n for (let i = 0; i < extKeys.length; i++) {\n const key = extKeys[i];\n if (key === undefined) continue;\n variantKeySet.add(key);\n }\n\n const meta = (ext as AnyComponent & ComponentWithMeta)[META_KEY];\n if (!meta) continue;\n extMetas.push(meta);\n Object.assign(staticDefaults, meta.staticDefaults);\n\n const isolated = meta.transformClass !== transformClass;\n extIsolated.push(isolated);\n if (isolated) {\n hasIsolatedExt = true;\n extBaseClassesArr.push(meta.transformClass(meta.baseClass));\n } else {\n extBaseClassesArr.push(meta.baseClass);\n }\n }\n }\n const extCount = extMetas.length;\n\n // Build all own variant metadata in one pass. Disabled value sets are\n // shared with their prebuilt variants instead of scanning and allocating\n // them twice.\n const disabledVariantKeys = new Set<string>();\n const disabledVariantValues: Record<string, Set<string>> = {};\n let hasDisabledVariantValues = false;\n const variantEntryNames: string[] = [];\n const variantEntryDefs: PrebuiltVariant[] = [];\n const functionVariantNames: string[] = [];\n const functionVariantFns: Array<(value: unknown) => unknown> = [];\n if (variants) {\n for (const name in variants) {\n if (!hasOwn(variants, name)) continue;\n const variant = (variants as Record<string, unknown>)[name];\n if (variant === null) {\n variantKeySet.delete(name);\n disabledVariantKeys.add(name);\n continue;\n }\n variantKeySet.add(name);\n if (typeof variant === \"function\") {\n functionVariantNames.push(name);\n functionVariantFns.push(variant as (value: unknown) => unknown);\n continue;\n }\n const prebuiltVariant = buildPrebuiltVariant(variant);\n variantEntryNames.push(name);\n variantEntryDefs.push(prebuiltVariant);\n if (prebuiltVariant.disabledValues) {\n disabledVariantValues[name] = prebuiltVariant.disabledValues;\n hasDisabledVariantValues = true;\n }\n if (\n prebuiltVariant.values &&\n hasOwn(prebuiltVariant.values, \"false\") &&\n staticDefaults[name] === undefined\n ) {\n staticDefaults[name] = false;\n }\n }\n }\n const variantKeys = Array.from(variantKeySet);\n const variantKeysLength = variantKeys.length;\n const variantEntryCount = variantEntryNames.length;\n const functionVariantCount = functionVariantNames.length;\n const hasDisabledVariantKeys = disabledVariantKeys.size > 0;\n const hasAnyDisabled = hasDisabledVariantKeys || hasDisabledVariantValues;\n\n const inputPropsKeys = [\"class\", \"className\", \"style\", ...variantKeys];\n\n const computedDefaultNames: string[] = [];\n const computedDefaultFns: ComputedDefaultVariantFn[] = [];\n const defaultVariants = config.defaultVariants as\n | Record<string, unknown>\n | undefined;\n\n // Pre-compute static defaults. Includes:\n // - extended components' static defaults\n // - implicit boolean defaults (variants with a `false` key default to false)\n // - this config's literal defaultVariants (overriding the above)\n //\n // Function entries in defaultVariants are computed defaults. They run in\n // the refine loop so they can react to setVariants updates.\n // Then filtered through disabled-variants.\n if (defaultVariants) {\n for (const name in defaultVariants) {\n if (!hasOwn(defaultVariants, name)) continue;\n const value = defaultVariants[name];\n if (typeof value === \"function\") {\n computedDefaultNames.push(name);\n computedDefaultFns.push(value as ComputedDefaultVariantFn);\n continue;\n }\n if (value === undefined) {\n delete staticDefaults[name];\n continue;\n }\n staticDefaults[name] = value;\n }\n }\n const computedDefaultCount = computedDefaultNames.length;\n if (hasAnyDisabled) {\n // Filter disabled variants in-place\n for (const key in staticDefaults) {\n if (!hasOwn(staticDefaults, key)) continue;\n if (disabledVariantKeys.has(key)) {\n delete staticDefaults[key];\n continue;\n }\n if (hasDisabledVariantValues) {\n const value = staticDefaults[key];\n const valueKey = getVariantValueKey(value);\n if (valueKey != null && disabledVariantValues[key]?.has(valueKey)) {\n delete staticDefaults[key];\n }\n }\n }\n }\n\n const inheritedComputedDefaultKeys = new Set<string>();\n for (let i = 0; i < extCount; i++) {\n const keys = extMetas[i].computedDefaultKeys;\n for (const key of keys) {\n inheritedComputedDefaultKeys.add(key);\n }\n }\n\n // Filter to only extends with computed default or refine work in their\n // chain. Those are the components that can change resolved variants across\n // fixed-point iterations.\n const extMetasWithRefine: ComponentMeta[] = [];\n for (let i = 0; i < extCount; i++) {\n const meta = extMetas[i];\n if (meta.resolveRefine) {\n extMetasWithRefine.push(meta);\n }\n }\n const extMetasWithRefineCount = extMetasWithRefine.length;\n\n // Call-site frame captured at the `cv()` call site so refine-limit warnings\n // can point developers at the component definition. Skipped entirely for\n // components that can never enter the refine loop, and stripped in\n // production via the NODE_ENV guard inside `captureCreationFrame`. The\n // frame is captured at creation time but the underlying `.stack` string is\n // formatted lazily on first access, so component creation stays cheap\n // unless the warning actually fires.\n const canTriggerRefineWarning =\n !!refine || computedDefaultCount > 0 || extMetasWithRefineCount > 0;\n const creationFrame =\n canTriggerRefineWarning && process.env.NODE_ENV !== \"production\"\n ? captureCreationFrame(cv)\n : undefined;\n\n // Function variant keys inherited from extends, filtered through this\n // component's own variants: a static (object/shorthand) variant in this\n // component replaces an inherited function variant for the same key.\n // The closure is exposed on `ComponentMeta` so any further extending\n // component can detect \"ancestor's effective variant for K is a function\"\n // and skip it when overriding K with a non-function.\n const functionVariantKeys = new Set<string>();\n for (let i = 0; i < extCount; i++) {\n const fnKeys = extMetas[i].functionVariantKeys;\n for (const k of fnKeys) {\n if (disabledVariantKeys.has(k)) continue;\n functionVariantKeys.add(k);\n }\n }\n for (let i = 0; i < functionVariantCount; i++) {\n functionVariantKeys.add(functionVariantNames[i]);\n }\n for (let i = 0; i < variantEntryCount; i++) {\n // A static variant in this component replaces an inherited function\n // variant for the same key; from this component onward, the key is no\n // longer a function variant.\n functionVariantKeys.delete(variantEntryNames[i]);\n }\n\n const computedDefaultKeys = new Set(inheritedComputedDefaultKeys);\n for (let i = 0; i < computedDefaultCount; i++) {\n computedDefaultKeys.add(computedDefaultNames[i]);\n }\n\n // Pre-compute static skip key/value sets to pass to extends. These never\n // change across calls — when caller passes no skip sets, we reuse the same\n // object and avoid Set allocation.\n let staticExtSkipKeys: Set<string> | null = null;\n if (hasDisabledVariantKeys || functionVariantCount > 0) {\n staticExtSkipKeys = new Set<string>();\n for (const k of disabledVariantKeys) {\n staticExtSkipKeys.add(k);\n }\n for (let i = 0; i < functionVariantCount; i++) {\n staticExtSkipKeys.add(functionVariantNames[i]);\n }\n }\n\n // A static variant in this component replaces an inherited function\n // variant, so the ancestor must skip that key.\n if (variantEntryCount > 0 && extCount > 0) {\n for (let i = 0; i < variantEntryCount; i++) {\n const name = variantEntryNames[i];\n for (let j = 0; j < extCount; j++) {\n if (extMetas[j].functionVariantKeys.has(name)) {\n staticExtSkipKeys ??= new Set<string>();\n staticExtSkipKeys.add(name);\n break;\n }\n }\n }\n }\n // Skip values are passed directly to extends. We can reuse the same object\n // when no caller-provided values need merging.\n const staticExtSkipValues: Record<string, Set<string>> | null =\n hasDisabledVariantValues ? disabledVariantValues : null;\n\n // Callers use this only when disabled keys or values exist.\n function filterDisabledInto(\n input: Record<string, unknown>,\n out: Record<string, unknown>,\n ): void {\n for (const key in input) {\n if (!hasOwn(input, key)) continue;\n if (disabledVariantKeys.has(key)) continue;\n const value = input[key];\n if (hasDisabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (valueKey != null && disabledVariantValues[key]?.has(valueKey)) {\n continue;\n }\n }\n out[key] = value;\n }\n }\n\n const isOwnDisabledValue = (key: string, value: unknown): boolean => {\n if (disabledVariantKeys.has(key)) {\n return true;\n }\n if (hasDisabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (valueKey != null && disabledVariantValues[key]?.has(valueKey)) {\n return true;\n }\n }\n return false;\n };\n\n const filterOwnDisabledVariants = (\n input: Record<string, unknown>,\n fallback: Record<string, unknown>,\n ): Record<string, unknown> => {\n if (!hasAnyDisabled) {\n return input;\n }\n\n let hasOwnDisabledValue = false;\n for (const key in input) {\n if (!hasOwn(input, key)) continue;\n const value = input[key];\n if (isOwnDisabledValue(key, value)) {\n hasOwnDisabledValue = true;\n break;\n }\n }\n if (!hasOwnDisabledValue) {\n return input;\n }\n\n const filtered: Record<string, unknown> = {};\n for (const key in input) {\n if (!hasOwn(input, key)) continue;\n const value = input[key];\n if (!isOwnDisabledValue(key, value)) {\n filtered[key] = value;\n continue;\n }\n const fallbackValue = fallback[key];\n if (\n fallbackValue !== undefined &&\n !isOwnDisabledValue(key, fallbackValue)\n ) {\n filtered[key] = fallbackValue;\n }\n }\n\n return filtered;\n };\n\n // Hot path: resolve variants by merging static defaults + extends'\n // static defaults + user-provided props.\n function resolveVariantsHot(\n propsVariants: Record<string, unknown>,\n ): Record<string, unknown> {\n // Start with static defaults\n const defaults = Object.assign({}, staticDefaults);\n\n // Apply propsVariants on top (filter undefined).\n for (let i = 0; i < variantKeysLength; i++) {\n const k = variantKeys[i];\n if (!hasOwn(propsVariants, k)) continue;\n const v = propsVariants[k];\n if (v === undefined) continue;\n defaults[k] = v;\n }\n\n if (!hasAnyDisabled) {\n return defaults;\n }\n\n // Filter disabled\n const result: Record<string, unknown> = {};\n filterDisabledInto(defaults, result);\n return result;\n }\n\n const runComputedDefaults = (\n resolved: Record<string, unknown>,\n defaultResolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n filterOwnVariants: boolean,\n protectedVariantKeys: Set<string> | null | undefined,\n ): Record<string, unknown> => {\n let ownVariants = filterOwnVariants ? null : resolved;\n const getOwnVariants = (): Record<string, unknown> => {\n if (ownVariants) {\n return ownVariants;\n }\n const filteredVariants: Record<string, unknown> = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (hasOwn(resolved, key)) {\n filteredVariants[key] = resolved[key];\n }\n }\n ownVariants = filteredVariants;\n return filteredVariants;\n };\n\n let updatedVariants: Record<string, unknown> | null = null;\n const ensureUpdated = (): Record<string, unknown> => {\n if (updatedVariants) {\n return updatedVariants;\n }\n const updated = Object.assign({}, resolved);\n updatedVariants = updated;\n return updated;\n };\n\n for (let i = 0; i < computedDefaultCount; i++) {\n const key = computedDefaultNames[i];\n if (hasOwn(userVariantProps, key)) {\n if (userVariantProps[key] !== undefined) continue;\n }\n if (protectedVariantKeys?.has(key)) continue;\n\n const variantSnapshot = getOwnVariants();\n const defaultValue = inheritedComputedDefaultKeys.has(key)\n ? variantSnapshot[key]\n : defaultResolved[key];\n const value = computedDefaultFns[i](defaultValue, variantSnapshot);\n if (hasAnyDisabled) {\n if (disabledVariantKeys.has(key)) continue;\n const valueKey = getVariantValueKey(value);\n if (valueKey != null && disabledVariantValues[key]?.has(valueKey)) {\n continue;\n }\n }\n\n if (value === undefined) {\n if (!hasOwn(variantSnapshot, key)) continue;\n delete ensureUpdated()[key];\n continue;\n }\n if (Object.is(variantSnapshot[key], value)) continue;\n ensureUpdated()[key] = value;\n }\n\n return updatedVariants ?? resolved;\n };\n\n const runRefineContext = (\n resolved: Record<string, unknown>,\n filterOwnVariants: boolean,\n collectOutput: boolean,\n applyVariantUpdates: boolean,\n protectedVariants: Record<string, unknown> | null | undefined,\n protectedVariantKeys: Set<string> | null | undefined,\n ): {\n workingResolved: Record<string, unknown>;\n classes: ClassValue[] | null;\n style: StyleValue | null;\n } => {\n let workingResolved = resolved;\n let cClasses: ClassValue[] | null = null;\n let cStyle: StyleValue | null = null;\n\n if (refine) {\n let ownVariants = resolved;\n if (filterOwnVariants) {\n // When this component is being extended, `resolved` is the parent's\n // workingResolved (a superset of our variant keys). Filter to our own\n // keys for `ctx.variants` so the user's `refine` callback sees the\n // shape declared by `VariantValues<V>` and not foreign parent keys.\n const filteredVariants: Record<string, unknown> = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const k = variantKeys[i];\n if (hasOwn(resolved, k)) {\n filteredVariants[k] = resolved[k];\n }\n }\n ownVariants = filteredVariants;\n }\n // Lazy-init updatedVariants — many refine callbacks only inspect\n // `variants`, so the copy is unnecessary in the common case.\n let updatedVariants: Record<string, unknown> | null = null;\n const localCClasses: ClassValue[] | null = collectOutput ? [] : null;\n let localCStyle: StyleValue | null = null;\n const ensureUpdated = (): Record<string, unknown> => {\n if (updatedVariants) {\n return updatedVariants;\n }\n const u = Object.assign({}, ownVariants);\n updatedVariants = u;\n return u;\n };\n const protectVariant = (key: string, value: unknown) => {\n if (protectedVariants) {\n protectedVariants[key] = value;\n protectedVariantKeys?.add(key);\n }\n };\n const ctx = {\n variants: ownVariants as VariantValues<Record<string, unknown>>,\n setVariants: (\n newVariants: VariantValues<Record<string, unknown>>,\n ) => {\n if (!applyVariantUpdates) {\n return;\n }\n if (!hasAnyDisabled) {\n for (const key in newVariants) {\n if (!hasOwn(newVariants, key)) continue;\n const value = (newVariants as Record<string, unknown>)[key];\n protectVariant(key, value);\n if (Object.is((updatedVariants ?? ownVariants)[key], value)) {\n continue;\n }\n ensureUpdated()[key] = value;\n }\n return;\n }\n for (const key in newVariants) {\n if (!hasOwn(newVariants, key)) continue;\n if (disabledVariantKeys.has(key)) continue;\n const value = (newVariants as Record<string, unknown>)[key];\n if (hasDisabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (\n valueKey != null &&\n disabledVariantValues[key]?.has(valueKey)\n ) {\n continue;\n }\n }\n protectVariant(key, value);\n if (Object.is((updatedVariants ?? ownVariants)[key], value)) {\n continue;\n }\n ensureUpdated()[key] = value;\n }\n },\n addClass: (className: ClassValue) => {\n localCClasses?.push(className);\n },\n addStyle: (newStyle: StyleValue) => {\n if (!collectOutput) return;\n if (!localCStyle) {\n localCStyle = {};\n }\n Object.assign(localCStyle, newStyle);\n },\n };\n const result = refine(ctx);\n if (collectOutput && result != null) {\n const r = extractClassAndStylePrebuilt(result);\n if (r.class != null) {\n localCClasses?.push(r.class);\n }\n if (r.style) {\n if (!localCStyle) {\n localCStyle = {};\n }\n Object.assign(localCStyle, r.style);\n }\n }\n cClasses = localCClasses;\n cStyle = localCStyle;\n if (updatedVariants) {\n const nextResolved = Object.assign({}, workingResolved);\n if (hasAnyDisabled) {\n filterDisabledInto(updatedVariants, nextResolved);\n } else {\n Object.assign(nextResolved, updatedVariants);\n }\n workingResolved = nextResolved;\n }\n }\n\n return {\n workingResolved,\n classes: cClasses,\n style: cStyle,\n };\n };\n\n // Core compute path. Called both for top-level rendering (via\n // `computeResult`) and recursively when this component is used as an\n // `extend` target by another component. Pushes variant classes (excluding\n // base class) into `classesOut` and merges styles into `styleOut`.\n const computeOnce: ComputeOnceFn = (\n resolved,\n userVariantProps,\n skipKeys,\n skipValues,\n classesOut,\n styleOut,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved = resolved,\n renderOnly = false,\n ) => {\n let workingResolved = resolved;\n let cClasses: ClassValue[] | null = null;\n let cStyle: StyleValue | null = null;\n\n // Run extends' contributions first (their full classes + styles) so our\n // own base style and variants apply on top, matching the original\n // ext1 → ext2 → … → current ordering.\n if (hasExtend) {\n // Build skip sets to pass to extends. Reuse precomputed values when no\n // caller-provided sets need merging.\n let extSkipKeys: Set<string> | null;\n if (skipKeys === null) {\n extSkipKeys = staticExtSkipKeys;\n } else if (staticExtSkipKeys === null) {\n extSkipKeys = skipKeys;\n } else {\n extSkipKeys = new Set(skipKeys);\n for (const k of staticExtSkipKeys) {\n extSkipKeys.add(k);\n }\n }\n\n let extSkipVals: Record<string, Set<string>> | null;\n if (skipValues === null) {\n extSkipVals = staticExtSkipValues;\n } else if (staticExtSkipValues === null) {\n extSkipVals = skipValues;\n } else {\n extSkipVals = {};\n for (const k in skipValues) {\n extSkipVals[k] = skipValues[k];\n }\n for (const k in staticExtSkipValues) {\n const existing = extSkipVals[k];\n if (existing) {\n const merged = new Set<string>(existing);\n for (const v of staticExtSkipValues[k]) {\n merged.add(v);\n }\n extSkipVals[k] = merged;\n } else {\n extSkipVals[k] = staticExtSkipValues[k];\n }\n }\n }\n\n const extUserVariantProps =\n extMetasWithRefineCount > 0\n ? getExtUserVariantProps(\n userVariantProps,\n protectedVariants ?? null,\n )\n : userVariantProps;\n for (let i = 0; i < extCount; i++) {\n if (hasIsolatedExt && extIsolated[i]) {\n // Isolated extend (different factory): gather its variant classes\n // into a scratch array, then push the joined string after applying\n // its own transformClass. Our outer transform applies on top.\n const extClasses: ClsxClassValue[] = [];\n workingResolved = extMetas[i].compute(\n workingResolved,\n extUserVariantProps,\n extSkipKeys,\n extSkipVals,\n extClasses,\n styleOut,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved,\n renderOnly,\n );\n if (extClasses.length > 0) {\n const joined = clsx(extClasses);\n if (joined.length > 0) {\n classesOut.push(extMetas[i].transformClass(joined));\n }\n }\n } else {\n workingResolved = extMetas[i].compute(\n workingResolved,\n extUserVariantProps,\n extSkipKeys,\n extSkipVals,\n classesOut,\n styleOut,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved,\n renderOnly,\n );\n }\n workingResolved = filterOwnDisabledVariants(\n workingResolved,\n defaultResolved,\n );\n // Only sync protected variants when a child refine resolver can\n // observe them. Otherwise extUserVariantProps may alias caller props.\n if (protectedVariants && extMetasWithRefineCount > 0) {\n Object.assign(extUserVariantProps, protectedVariants);\n }\n }\n }\n\n // Run own computed defaults after extended components so defaults resolve\n // from base to child. They still run before this component's `refine`.\n if (!renderOnly && computedDefaultCount > 0) {\n workingResolved = runComputedDefaults(\n workingResolved,\n defaultResolved,\n userVariantProps,\n true,\n protectedVariantKeys,\n );\n }\n\n // Run own `refine` (if any). May modify resolved variants and emit\n // classes and styles that are applied after this component's variants.\n if (refine) {\n const refineResult = runRefineContext(\n workingResolved,\n true,\n true,\n !renderOnly,\n protectedVariants,\n protectedVariantKeys,\n );\n workingResolved = refineResult.workingResolved;\n cClasses = refineResult.classes;\n cStyle = refineResult.style;\n }\n\n // Apply own base style (after extends' styles, matching original order).\n if (hasBaseStyle) {\n Object.assign(styleOut, baseStyle);\n }\n\n // Apply own variants. Skip keys/values come from caller (e.g., parent\n // wants its own function variant to override this variant).\n // `variantEntryNames` already excludes disabled keys (those with `null`\n // value in config) and function variants, so we don't re-check\n // `disabledVariantKeys` here.\n const ownSkipKeys = skipKeys;\n const ownSkipValues = skipValues;\n for (let i = 0; i < variantEntryCount; i++) {\n const variantName = variantEntryNames[i];\n if (ownSkipKeys && ownSkipKeys.has(variantName)) continue;\n const selectedValue = workingResolved[variantName];\n if (selectedValue === undefined) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n const variant = variantEntryDefs[i];\n if (\n variant.disabledValues &&\n selectedKey != null &&\n variant.disabledValues.has(selectedKey)\n ) {\n continue;\n }\n if (\n ownSkipValues &&\n selectedKey != null &&\n ownSkipValues[variantName]?.has(selectedKey)\n ) {\n continue;\n }\n\n let value: PrebuiltValue | null | undefined;\n if (variant.values) {\n if (selectedKey == null) continue;\n value = variant.values[selectedKey];\n } else if (selectedValue === true) {\n value = variant.shorthand;\n }\n if (!value) continue;\n if (value.class != null) {\n classesOut.push(value.class);\n }\n if (value.style) {\n Object.assign(styleOut, value.style);\n }\n }\n\n // Apply function variants — entries in `variants` whose value is a\n // function. They run after static variants and override any same-key\n // inherited variant via `staticExtSkipKeys`.\n for (let i = 0; i < functionVariantCount; i++) {\n const variantName = functionVariantNames[i];\n if (ownSkipKeys && ownSkipKeys.has(variantName)) continue;\n const selectedValue = workingResolved[variantName];\n if (selectedValue === undefined) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n if (\n ownSkipValues &&\n selectedKey != null &&\n ownSkipValues[variantName]?.has(selectedKey)\n ) {\n continue;\n }\n const fn = functionVariantFns[i];\n const computedResult = fn(selectedValue);\n if (computedResult == null) continue;\n const r = extractClassAndStylePrebuilt(computedResult);\n if (r.class != null) {\n classesOut.push(r.class);\n }\n if (r.style) {\n Object.assign(styleOut, r.style);\n }\n }\n\n // Apply `refine` results — must come after own variants (static and\n // function).\n if (cClasses) {\n for (let i = 0; i < cClasses.length; i++) {\n classesOut.push(cClasses[i] as ClsxClassValue);\n }\n }\n if (cStyle) {\n Object.assign(styleOut, cStyle);\n }\n\n return workingResolved;\n };\n\n const compute: ComputeFn =\n !refine && computedDefaultCount === 0 && extMetasWithRefineCount === 0\n ? computeOnce\n : (\n resolved,\n userVariantProps,\n skipKeys,\n skipValues,\n classesOut,\n styleOut,\n ) => {\n let remaining = MAX_REFINE_RUNS;\n const protectedVariants: Record<string, unknown> = {};\n const protectedVariantKeys = new Set<string>();\n const incomingDefaultResolved = resolved;\n let workingResolved = resolved;\n // Latest variant changes from non-converging iterations inside the\n // tracking window. Lazy-init keeps convergent loops allocation-free.\n let unstableChanges: Map<string, VariantChange> | null = null;\n let lastClasses: ClsxClassValue[] = [];\n let lastStyle: StyleValue = {};\n let isFirstRun = true;\n\n while (remaining > 0) {\n remaining -= 1;\n const useDirectOutput = isFirstRun;\n const classCount = classesOut.length;\n const nextClasses: ClsxClassValue[] = useDirectOutput\n ? classesOut\n : [];\n const nextStyle: StyleValue = useDirectOutput ? styleOut : {};\n const defaultResolved = mergeProtectedIntoBase(\n incomingDefaultResolved,\n protectedVariants,\n protectedVariantKeys,\n );\n const nextResolved = computeOnce(\n workingResolved,\n userVariantProps,\n skipKeys,\n skipValues,\n nextClasses,\n nextStyle,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved,\n );\n\n if (\n nextResolved === workingResolved ||\n areVariantsEqual(workingResolved, nextResolved)\n ) {\n if (nextResolved !== workingResolved) {\n if (useDirectOutput) {\n classesOut.length = classCount;\n for (const key in styleOut) {\n if (hasOwn(styleOut, key)) {\n Reflect.deleteProperty(styleOut, key);\n }\n }\n }\n computeOnce(\n nextResolved,\n userVariantProps,\n skipKeys,\n skipValues,\n classesOut,\n styleOut,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved,\n true,\n );\n } else if (!useDirectOutput) {\n for (let i = 0; i < nextClasses.length; i++) {\n classesOut.push(nextClasses[i]);\n }\n Object.assign(styleOut, nextStyle);\n }\n return nextResolved;\n }\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n remaining < REFINE_UNSTABLE_TRACKING_WINDOW\n ) {\n if (!unstableChanges) {\n unstableChanges = new Map<string, VariantChange>();\n }\n accumulateUnstableVariantChanges(\n unstableChanges,\n workingResolved,\n nextResolved,\n );\n }\n\n if (useDirectOutput) {\n classesOut.length = classCount;\n for (const key in styleOut) {\n if (hasOwn(styleOut, key)) {\n Reflect.deleteProperty(styleOut, key);\n }\n }\n } else {\n lastClasses = nextClasses;\n lastStyle = nextStyle;\n }\n\n workingResolved = nextResolved;\n isFirstRun = false;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n warnRefineLimit({\n creationFrame,\n unstableChanges,\n });\n }\n\n for (let i = 0; i < lastClasses.length; i++) {\n classesOut.push(lastClasses[i]);\n }\n Object.assign(styleOut, lastStyle);\n return workingResolved;\n };\n\n const resolveRefineOnce: ResolveRefineOnceFn = (\n resolved,\n userVariantProps,\n filterOwnVariants = true,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved = resolved,\n ) => {\n let workingResolved = resolved;\n\n if (extMetasWithRefineCount > 0) {\n const extUserVariantProps = getExtUserVariantProps(\n userVariantProps,\n protectedVariants ?? null,\n );\n for (let i = 0; i < extMetasWithRefineCount; i++) {\n const meta = extMetasWithRefine[i];\n const resolveRefine = meta.resolveRefine;\n if (!resolveRefine) continue;\n workingResolved = resolveRefine(\n workingResolved,\n extUserVariantProps,\n true,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved,\n );\n workingResolved = filterOwnDisabledVariants(\n workingResolved,\n defaultResolved,\n );\n if (protectedVariants) {\n Object.assign(extUserVariantProps, protectedVariants);\n }\n }\n }\n\n if (computedDefaultCount > 0) {\n workingResolved = runComputedDefaults(\n workingResolved,\n defaultResolved,\n userVariantProps,\n filterOwnVariants,\n protectedVariantKeys,\n );\n }\n if (refine) {\n const refineResult = runRefineContext(\n workingResolved,\n filterOwnVariants,\n false,\n true,\n protectedVariants,\n protectedVariantKeys,\n );\n workingResolved = refineResult.workingResolved;\n }\n\n return workingResolved;\n };\n\n const resolveRefine: ResolveRefineFn | null =\n refine || computedDefaultCount > 0 || extMetasWithRefineCount > 0\n ? (resolved, userVariantProps, filterOwnVariants = true) => {\n let remaining = MAX_REFINE_RUNS;\n const protectedVariants: Record<string, unknown> = {};\n const protectedVariantKeys = new Set<string>();\n const incomingDefaultResolved = resolved;\n let workingResolved = resolved;\n // Latest variant changes from non-converging iterations inside the\n // tracking window. See the compute loop above for the shared\n // rationale.\n let unstableChanges: Map<string, VariantChange> | null = null;\n\n while (remaining > 0) {\n remaining -= 1;\n const defaultResolved = mergeProtectedIntoBase(\n incomingDefaultResolved,\n protectedVariants,\n protectedVariantKeys,\n );\n const nextResolved = resolveRefineOnce(\n workingResolved,\n userVariantProps,\n filterOwnVariants,\n protectedVariants,\n protectedVariantKeys,\n defaultResolved,\n );\n\n if (\n nextResolved === workingResolved ||\n areVariantsEqual(workingResolved, nextResolved)\n ) {\n return nextResolved;\n }\n\n if (\n process.env.NODE_ENV !== \"production\" &&\n remaining < REFINE_UNSTABLE_TRACKING_WINDOW\n ) {\n if (!unstableChanges) {\n unstableChanges = new Map<string, VariantChange>();\n }\n accumulateUnstableVariantChanges(\n unstableChanges,\n workingResolved,\n nextResolved,\n );\n }\n workingResolved = nextResolved;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n warnRefineLimit({\n creationFrame,\n unstableChanges,\n });\n }\n\n return workingResolved;\n }\n : null;\n\n // Top-level: resolves variants from user props, calls compute, then\n // assembles className and style with user-provided class/style overrides.\n const computeResult = (\n props: ComponentProps<MergedVariants> = EMPTY_DEFAULTS as ComponentProps<MergedVariants>,\n ): { className: string; style: StyleValue } => {\n const propsRecord = props as Record<string, unknown>;\n\n let resolved: Record<string, unknown> = {};\n Object.assign(resolved, staticDefaults);\n\n let userVariantProps: Record<string, unknown>;\n if (refine || computedDefaultCount > 0 || extMetasWithRefineCount > 0) {\n const variantProps: Record<string, unknown> = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (hasOwn(propsRecord, key)) {\n variantProps[key] = propsRecord[key];\n }\n }\n for (const k in variantProps) {\n if (!hasOwn(variantProps, k)) continue;\n const v = variantProps[k];\n if (v === undefined) continue;\n resolved[k] = v;\n }\n userVariantProps = variantProps;\n } else {\n // Fast path: walk variantKeys directly against propsRecord.\n // Own-property checks ensure a polluted Object.prototype can't add\n // values the user didn't pass.\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (!hasOwn(propsRecord, key)) continue;\n const v = propsRecord[key];\n if (v === undefined) continue;\n resolved[key] = v;\n }\n userVariantProps = propsRecord;\n }\n\n if (hasAnyDisabled) {\n const filtered: Record<string, unknown> = {};\n filterDisabledInto(resolved, filtered);\n resolved = filtered;\n }\n\n // Build allClasses directly. computedBaseClass already has all extend\n // bases joined with config.class — `compute` only adds variant classes\n // on top.\n const allClasses: ClsxClassValue[] = [computedBaseClass];\n const style: StyleValue = {};\n compute(resolved, userVariantProps, null, null, allClasses, style);\n\n // Apply user-provided class / className.\n if (\"class\" in propsRecord) {\n allClasses.push(propsRecord.class as ClsxClassValue);\n }\n if (\"className\" in propsRecord) {\n allClasses.push(propsRecord.className as ClsxClassValue);\n }\n\n // Apply user-provided style.\n const psv = propsRecord.style;\n if (psv != null) {\n if (typeof psv === \"string\") {\n if (psv.length > 0) {\n htmlStyleToStyleValue(psv, style);\n }\n } else if (typeof psv === \"object\") {\n htmlObjStyleToStyleValue(psv, style);\n }\n }\n\n return {\n className: transformClass(clsx(allClasses)),\n style,\n };\n };\n\n const getVariants = (variants?: VariantValues<MergedVariants>) => {\n const variantsRecord = variants ?? EMPTY_DEFAULTS;\n let variantProps = variantsRecord;\n // Extended refinement copies user props, so filter before unknown\n // accessors or prototype keys can be observed by Object.assign.\n if (variants && extMetasWithRefineCount > 0) {\n variantProps = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (hasOwn(variantsRecord, key)) {\n variantProps[key] = variantsRecord[key];\n }\n }\n }\n let resolvedVariants = resolveVariantsHot(variantProps);\n if (resolveRefine) {\n resolvedVariants = resolveRefine(resolvedVariants, variantProps, false);\n }\n return resolvedVariants as VariantValues<MergedVariants>;\n };\n\n // Compute base class (without variants) — includes extended base classes.\n // Plain `clsx` (no `transformClass`): `meta.baseClass` flows back into\n // parent extends as `clsx` input and then through the single\n // `transformClass(clsx(allClasses))` at render time, so applying it here\n // would compound (double for own-render, triple+ for extend chains) and\n // misbehave for non-idempotent transforms.\n const computedBaseClass = hasExtend\n ? clsx(extBaseClassesArr, config.class as ClsxClassValue)\n : clsx(config.class as ClsxClassValue);\n\n // Shared closures across the default and modal components.\n const classFn = (props: ComponentProps<MergedVariants> = {}) => {\n return computeResult(props).className;\n };\n const meta: ComponentMeta = {\n baseClass: computedBaseClass,\n staticDefaults,\n compute: computeOnce,\n resolveRefine: resolveRefine ? resolveRefineOnce : null,\n transformClass,\n functionVariantKeys,\n computedDefaultKeys,\n };\n\n const initComponent = <\n R extends ComponentResult,\n T extends ModalComponent<MergedVariants, R>,\n >(\n c: T,\n propKeys: string[],\n style: T[\"style\"],\n ): T => {\n c.class = classFn;\n c.style = style;\n c.getVariants = getVariants;\n c.variantKeys = variantKeys;\n c.propKeys = propKeys;\n (c as AnyComponent & ComponentWithMeta)[META_KEY] = meta;\n return c;\n };\n\n // Default component\n const defaultComponent = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { class: className, style };\n }) as CVComponent<V, E>;\n initComponent(defaultComponent, inputPropsKeys, (props = {}) => {\n return computeResult(props).style;\n });\n\n // JSX component\n const jsxComponent = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { className, style };\n }) as ModalComponent<MergedVariants, JSXProps>;\n initComponent(\n jsxComponent,\n [\"className\", \"style\", ...variantKeys],\n (props = {}) => computeResult(props).style,\n );\n\n // HTML component\n const htmlComponent = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { class: className, style: styleValueToHTMLStyle(style) };\n }) as ModalComponent<MergedVariants, HTMLProps>;\n initComponent(\n htmlComponent,\n [\"class\", \"style\", ...variantKeys],\n (props = {}) => styleValueToHTMLStyle(computeResult(props).style),\n );\n\n // HTMLObj component\n const htmlObjComponent = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { class: className, style: styleValueToHTMLObjStyle(style) };\n }) as ModalComponent<MergedVariants, HTMLObjProps>;\n initComponent(\n htmlObjComponent,\n [\"class\", \"style\", ...variantKeys],\n (props = {}) => styleValueToHTMLObjStyle(computeResult(props).style),\n );\n\n defaultComponent.jsx = jsxComponent;\n defaultComponent.html = htmlComponent;\n defaultComponent.htmlObj = htmlObjComponent;\n\n return defaultComponent;\n };\n\n return { cv, cx };\n}\n\nexport const cv = /* @__PURE__ */ (() => create().cv)();\n\n/**\n * Joins class values without applying a class transform.\n *\n * This behaves like the `cx` function returned by `create()` with no options.\n */\nexport function cx(...classes: ClsxClassValue[]) {\n return clsx(classes);\n}\n"],"mappings":";;AAEA,MAAa,SAAS,OAAO;AAI7B,MAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,iBAAiB,UAAkB;CAC1C,OAAO,SAAS,WAAW,CAAC,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,cAAc,KAAK,CAAC,CAAC,KAAK,CACrE;EAEA,iBAAiB,MAAM;EACvB,iBAAiB,OAAO;EACxB,iBAAiB,UAAU;EAE3B,OAAO;CACT;CAEA,OAAO;EAAE;EAAI;CAAG;AAClB;AAEA,MAAa,KAAqB,uBAAO,OAAO,CAAC,CAAC,GAAA,CAAI;AAOtD,SAAgB,GAAG,GAAG,SAA2B;CAC/C,OAAO,KAAK,OAAO;AACrB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/utils.ts","../src/refine-warning.ts","../src/index.ts"],"sourcesContent":["import type { HTMLCSSProperties, StyleValue } from \"./types.ts\";\n\nexport const hasOwn = Object.hasOwn;\n\n/**\n * Reads a key that may be absent from a plain record. Variant, prop, and config\n * records are plain objects, so a key inherited from a polluted\n * `Object.prototype` would otherwise read back like a value the caller passed\n * or Clava itself resolved.\n */\nexport function getOwn<T extends object, K extends keyof T & string>(\n record: T,\n key: K,\n): T[K] | undefined {\n if (!hasOwn(record, key)) return undefined;\n return record[key];\n}\n\n// Keep this explicit so normalization does not depend on browser globals.\n// Vendor-prefixed variants are derived below instead of duplicating the list.\nconst unitlessNumberProperties = new Set([\n \"animationIterationCount\",\n \"aspectRatio\",\n \"borderImage\",\n \"borderImageOutset\",\n \"borderImageSlice\",\n \"borderImageWidth\",\n \"boxFlex\",\n \"boxFlexGroup\",\n \"boxOrdinalGroup\",\n \"columnCount\",\n \"columns\",\n \"fillOpacity\",\n \"flex\",\n \"flexGrow\",\n \"flexNegative\",\n \"flexOrder\",\n \"flexPositive\",\n \"flexShrink\",\n \"floodOpacity\",\n \"fontSizeAdjust\",\n \"fontWeight\",\n \"gridArea\",\n \"gridColumn\",\n \"gridColumnEnd\",\n \"gridColumnSpan\",\n \"gridColumnStart\",\n \"gridRow\",\n \"gridRowEnd\",\n \"gridRowSpan\",\n \"gridRowStart\",\n \"hyphenateLimitChars\",\n \"initialLetter\",\n \"lineClamp\",\n \"lineHeight\",\n \"maskBorder\",\n \"maskBorderOutset\",\n \"maskBorderSlice\",\n \"maskBorderWidth\",\n \"mathDepth\",\n \"maxLines\",\n \"opacity\",\n \"order\",\n \"orphans\",\n \"scale\",\n \"shapeImageThreshold\",\n \"stopOpacity\",\n \"strokeDasharray\",\n \"strokeDashoffset\",\n \"strokeMiterlimit\",\n \"strokeOpacity\",\n \"strokeWidth\",\n \"tabSize\",\n \"widows\",\n \"zIndex\",\n \"zoom\",\n]);\n\nfunction isCustomProperty(property: string) {\n return property.charCodeAt(0) === 45 && property.charCodeAt(1) === 45;\n}\n\n/**\n * Converts a hyphenated CSS property name to camelCase.\n * @example\n * hyphenToCamel(\"background-color\") // \"backgroundColor\"\n * hyphenToCamel(\"-ms-transition\") // \"msTransition\" (lowercase \"ms\" prefix)\n * hyphenToCamel(\"--custom-var\") // \"--custom-var\" (CSS variables are preserved)\n */\nexport function hyphenToCamel(str: string) {\n // CSS custom properties (variables) should not be converted\n if (isCustomProperty(str)) {\n return str;\n }\n // Fast path: no hyphen -> return as-is\n let hyphenIndex = str.indexOf(\"-\");\n if (hyphenIndex === -1) {\n return str;\n }\n\n let result = \"\";\n let lastIndex = 0;\n while (hyphenIndex !== -1) {\n result += str.slice(lastIndex, hyphenIndex);\n\n const nextIndex = hyphenIndex + 1;\n if (nextIndex >= str.length) {\n result += \"-\";\n lastIndex = nextIndex;\n break;\n }\n\n const code = str.charCodeAt(nextIndex);\n const isAsciiLetter =\n (code >= 65 && code <= 90) || (code >= 97 && code <= 122);\n if (isAsciiLetter) {\n const isMicrosoftPrefix = hyphenIndex === 0 && str.startsWith(\"ms-\", 1);\n result += isMicrosoftPrefix\n ? str[nextIndex]\n : str[nextIndex].toUpperCase();\n lastIndex = nextIndex + 1;\n } else {\n result += \"-\";\n lastIndex = nextIndex;\n }\n\n hyphenIndex = str.indexOf(\"-\", lastIndex);\n }\n\n return result + str.slice(lastIndex);\n}\n\n/**\n * Converts a camelCase CSS property name to hyphenated form.\n * @example\n * camelToHyphen(\"backgroundColor\") // \"background-color\"\n * camelToHyphen(\"msTransition\") // \"-ms-transition\" (lowercase \"ms\" prefix)\n * camelToHyphen(\"--customVar\") // \"--customVar\" (CSS variables are preserved)\n */\nexport function camelToHyphen(str: string) {\n // CSS custom properties (variables) should not be converted\n if (isCustomProperty(str)) {\n return str;\n }\n\n let result = \"\";\n let lastIndex = 0;\n for (let i = 0; i < str.length; i++) {\n const code = str.charCodeAt(i);\n if (code < 65 || code > 90) continue;\n const isMicrosoftPrefix = i === 2 && str.startsWith(\"ms\");\n if (isMicrosoftPrefix) {\n result += \"-\";\n }\n result += str.slice(lastIndex, i);\n result += \"-\";\n result += str[i].toLowerCase();\n lastIndex = i + 1;\n }\n\n if (lastIndex === 0) {\n return str;\n }\n return result + str.slice(lastIndex);\n}\n\nfunction hasVendorPrefix(property: string, prefix: string) {\n const nextCode = property.charCodeAt(prefix.length);\n if (nextCode < 65 || nextCode > 90) return false;\n return property.startsWith(prefix);\n}\n\n// \"ms\" is used in JSX, while camelizing hyphenated properties produces \"Ms\".\nconst vendorPrefixes = [\"Webkit\", \"Moz\", \"ms\", \"Ms\", \"O\"];\n\nfunction isUnitlessNumberProperty(property: string) {\n if (unitlessNumberProperties.has(property)) return true;\n\n for (const prefix of vendorPrefixes) {\n if (!hasVendorPrefix(property, prefix)) continue;\n const firstCode = property.charCodeAt(prefix.length);\n const unprefixedProperty =\n String.fromCharCode(firstCode + 32) + property.slice(prefix.length + 1);\n return unitlessNumberProperties.has(unprefixedProperty);\n }\n return false;\n}\n\nfunction normalizeStyleValue(property: string, value: string | number) {\n if (typeof value === \"string\") {\n return value;\n }\n if (isCustomProperty(property)) {\n return value;\n }\n if (isUnitlessNumberProperty(property)) {\n return value;\n }\n return `${value}px`;\n}\n\n/**\n * Parses a CSS style string into a StyleValue object.\n * @example\n * htmlStyleToStyleValue(\"background-color: red; font-size: 16px;\");\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function htmlStyleToStyleValue(\n styleString: string,\n result: StyleValue = {},\n) {\n if (!styleString) return result;\n const len = styleString.length;\n let i = 0;\n while (i < len) {\n // Skip leading whitespace and stray semicolons\n while (i < len) {\n const c = styleString.charCodeAt(i);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13 && c !== 59) break;\n i++;\n }\n if (i >= len) break;\n // Read property name until ':' or ';'\n const propStart = i;\n while (i < len) {\n const c = styleString.charCodeAt(i);\n if (c === 58 || c === 59) break;\n i++;\n }\n if (i >= len || styleString.charCodeAt(i) === 59) {\n // No colon found - skip this declaration\n if (i < len) {\n // Skip ';'.\n i++;\n }\n continue;\n }\n let propEnd = i;\n // Trim trailing whitespace from property name\n while (propEnd > propStart) {\n const c = styleString.charCodeAt(propEnd - 1);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n propEnd--;\n }\n if (propEnd === propStart) {\n // Empty property - skip\n while (i < len && styleString.charCodeAt(i) !== 59) {\n i++;\n }\n if (i < len) {\n i++;\n }\n continue;\n }\n const property = styleString.slice(propStart, propEnd);\n // Skip ':'.\n i++;\n // Skip whitespace before value\n while (i < len) {\n const c = styleString.charCodeAt(i);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n i++;\n }\n const valStart = i;\n while (i < len && styleString.charCodeAt(i) !== 59) {\n i++;\n }\n let valEnd = i;\n while (valEnd > valStart) {\n const c = styleString.charCodeAt(valEnd - 1);\n if (c !== 32 && c !== 9 && c !== 10 && c !== 13) break;\n valEnd--;\n }\n if (i < len) {\n // Skip ';'.\n i++;\n }\n if (valEnd === valStart) continue;\n const value = styleString.slice(valStart, valEnd);\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string>)[hyphenToCamel(property)] = value;\n }\n\n return result;\n}\n\n/**\n * Converts a hyphenated style object to a camelCase StyleValue object.\n * @example\n * htmlObjStyleToStyleValue({ \"background-color\": \"red\", \"font-size\": \"16px\" });\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function htmlObjStyleToStyleValue(\n style: object,\n result: StyleValue = {},\n): StyleValue {\n for (const key in style) {\n if (!hasOwn(style, key)) continue;\n const value = (style as Record<string, unknown>)[key];\n if (value == null) continue;\n const property = hyphenToCamel(key);\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string | number>)[property] = normalizeStyleValue(\n property,\n value as string | number,\n );\n }\n return result;\n}\n\n/**\n * Converts a StyleValue object to a CSS style string.\n * @example\n * styleValueToHTMLStyle({ backgroundColor: \"red\", fontSize: \"16px\" });\n * // \"background-color: red; font-size: 16px;\"\n */\nexport function styleValueToHTMLStyle(style: StyleValue): string {\n let result = \"\";\n for (const key in style) {\n if (!hasOwn(style, key)) continue;\n const value = (style as Record<string, unknown>)[key];\n if (value == null) continue;\n if (result) {\n result += \"; \";\n }\n result += camelToHyphen(key);\n result += \": \";\n result += value as string | number;\n }\n if (!result) return \"\";\n return `${result};`;\n}\n\n/**\n * Converts a StyleValue object to a hyphenated style object.\n * @example\n * styleValueToHTMLObjStyle({ backgroundColor: \"red\", fontSize: \"16px\" });\n * // { \"background-color\": \"red\", \"font-size\": \"16px\" }\n */\nexport function styleValueToHTMLObjStyle(style: StyleValue) {\n const result: HTMLCSSProperties = {};\n for (const key in style) {\n if (!hasOwn(style, key)) continue;\n const value = (style as Record<string, unknown>)[key];\n if (value == null) continue;\n (result as Record<string, unknown>)[camelToHyphen(key)] = value;\n }\n return result;\n}\n","import { getOwn, hasOwn } from \"./utils.ts\";\n\nexport interface CreationFrame {\n stack?: string;\n}\n\nexport interface VariantChange {\n from: unknown;\n to: unknown;\n}\n\n// Once a refine loop is within this many iterations of the cap, start tracking\n// the latest value transition for every variant key that changes between\n// iterations so the warning can report every key that contributed to the\n// oscillation, not just the keys that happened to flip on the final step.\n// Convergent loops (the common case) exit well before this threshold and pay no\n// per-iteration tracking cost.\nexport const REFINE_UNSTABLE_TRACKING_WINDOW = 10;\n\n// Captures the call site of the function passed in `skipFn` so refine-limit\n// warnings can point developers at the originating `cv()` call. Returns\n// `undefined` in production so bundlers that replace `process.env.NODE_ENV` at\n// build time can drop the entire warning machinery. The underlying `.stack`\n// string is formatted lazily on first access in every major engine (V8,\n// SpiderMonkey, JavaScriptCore), so holding the captured frame for the\n// lifetime of the component is cheap when no warning fires.\nexport function captureCreationFrame(\n skipFn: Function,\n): CreationFrame | undefined {\n if (process.env.NODE_ENV === \"production\") return undefined;\n if (typeof Error.captureStackTrace === \"function\") {\n const holder: CreationFrame = {};\n Error.captureStackTrace(holder, skipFn);\n return holder;\n }\n // Engines without `Error.captureStackTrace` (SpiderMonkey, JavaScriptCore)\n // can't strip internal frames, but their `Error.stack` getter is still\n // lazy, so returning the Error instance defers the format cost. The\n // resulting trace includes extra frames from this helper, `buildComponent`,\n // and `cv` itself.\n return new Error();\n}\n\nexport function formatCreationStack(frame: CreationFrame): string | undefined {\n let stack = frame.stack;\n if (!stack) return undefined;\n // V8 prefixes the stack with a leading \"Error\" / \"Error: message\" line that\n // isn't meaningful for a captured location — drop it.\n const newlineIdx = stack.indexOf(\"\\n\");\n if (newlineIdx > 0) {\n const firstLine = stack.slice(0, newlineIdx);\n if (firstLine === \"Error\" || firstLine.startsWith(\"Error:\")) {\n stack = stack.slice(newlineIdx + 1);\n }\n }\n const frames = stack.split(\"\\n\");\n for (let i = 0; i < frames.length; i++) {\n const line = frames[i]?.trim();\n if (!line) continue;\n if (isInternalCreationFrame(line)) continue;\n if (line.includes(\"/node_modules/\")) continue;\n if (line.includes(\"\\\\node_modules\\\\\")) continue;\n if (line.includes(\"node:internal\")) continue;\n return ` ${line}`;\n }\n return undefined;\n}\n\nfunction isInternalCreationFrame(line: string): boolean {\n if (line.includes(\"captureCreationFrame\")) return true;\n if (line.startsWith(\"at buildComponent \")) return true;\n if (line.startsWith(\"at buildComponent(\")) return true;\n if (line.startsWith(\"buildComponent@\")) return true;\n if (line.startsWith(\"at cv \")) return true;\n if (line.startsWith(\"at cv(\")) return true;\n if (line.startsWith(\"cv@\")) return true;\n return false;\n}\n\nfunction formatVariantValue(value: unknown): string {\n if (typeof value === \"string\") return JSON.stringify(value);\n if (typeof value === \"number\") {\n if (Number.isNaN(value)) return \"NaN\";\n return String(value);\n }\n if (typeof value === \"bigint\") return `${value}n`;\n if (value === undefined) return \"undefined\";\n if (value === null) return \"null\";\n if (typeof value === \"boolean\") return String(value);\n if (typeof value === \"symbol\") return String(value);\n if (typeof value === \"function\") return \"[function]\";\n return \"[object]\";\n}\n\nfunction setVariantChange(\n into: Map<string, VariantChange>,\n key: string,\n from: unknown,\n to: unknown,\n): void {\n into.set(key, { from, to });\n}\n\nexport function accumulateUnstableVariantChanges(\n into: Map<string, VariantChange>,\n prev: Record<string, unknown>,\n next: Record<string, unknown>,\n): void {\n for (const key in next) {\n if (!hasOwn(next, key)) continue;\n const from = getOwn(prev, key);\n if (!Object.is(from, next[key])) {\n setVariantChange(into, key, from, next[key]);\n }\n }\n for (const key in prev) {\n if (!hasOwn(prev, key)) continue;\n if (hasOwn(next, key)) continue;\n setVariantChange(into, key, prev[key], undefined);\n }\n}\n\nfunction formatVariantChanges(changes: Map<string, VariantChange>): string {\n return Array.from(changes)\n .map(([key, { from, to }]) => {\n return `${key}: ${formatVariantValue(from)} -> ${formatVariantValue(to)}`;\n })\n .join(\", \");\n}\n\ninterface WarnRefineLimitParams {\n creationFrame: CreationFrame | undefined;\n unstableChanges: Map<string, VariantChange> | null;\n}\n\nexport function warnRefineLimit({\n creationFrame,\n unstableChanges,\n}: WarnRefineLimitParams): void {\n // Bundlers are expected to replace this branch with a production literal,\n // allowing warning-only code below to be removed from consumer bundles.\n if (process.env.NODE_ENV === \"production\") return;\n let message =\n \"Clava: Maximum refine iterations exceeded. This can happen when a \" +\n \"computed default variant or refine callback changes one of the \" +\n \"variants on every run.\";\n if (unstableChanges && unstableChanges.size > 0) {\n message += `\\nVariant(s) that did not stabilize: ${Array.from(unstableChanges.keys()).join(\", \")}.`;\n message += `\\nLatest variant changes before warning: ${formatVariantChanges(unstableChanges)}.`;\n }\n if (creationFrame) {\n const creationStack = formatCreationStack(creationFrame);\n if (creationStack) {\n message += `\\nComponent created at:\\n${creationStack}`;\n }\n }\n console.warn(message);\n}\n","import clsx, { type ClassValue as ClsxClassValue } from \"clsx\";\nimport {\n REFINE_UNSTABLE_TRACKING_WINDOW,\n type VariantChange,\n accumulateUnstableVariantChanges,\n captureCreationFrame,\n warnRefineLimit,\n} from \"./refine-warning.ts\";\nimport type {\n AnyComponent,\n CVComponent,\n ClassValue,\n ComponentProps,\n ComponentResult,\n DefaultVariants,\n ExtendableVariants,\n HTMLObjProps,\n HTMLProps,\n JSXProps,\n KeySourceComponent,\n MergeVariants,\n ModalComponent,\n Refine,\n SplitPropsFunction,\n StyleClassProps,\n StyleClassValue,\n StyleValue,\n VariantValues,\n Variants,\n} from \"./types.ts\";\nimport {\n getOwn,\n hasOwn,\n htmlObjStyleToStyleValue,\n htmlStyleToStyleValue,\n styleValueToHTMLObjStyle,\n styleValueToHTMLStyle,\n} from \"./utils.ts\";\n\n// Internal compute path: pushes the variant classes contributed by this\n// component (and its extends chain) into `classesOut` and merges any styles\n// into `styleOut`. Base class is handled by callers via ComponentMeta.baseClass\n// to avoid string-parsing round trips. Both outputs are mutated in place to\n// avoid intermediate allocations.\ntype ComputeFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n skipKeys: Set<string> | null,\n skipValues: Record<string, Set<string>> | null,\n classesOut: ClsxClassValue[],\n styleOut: StyleValue,\n) => Record<string, unknown>;\n\ntype ComputeOnceFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n skipKeys: Set<string> | null,\n skipValues: Record<string, Set<string>> | null,\n classesOut: ClsxClassValue[],\n styleOut: StyleValue,\n protection?: RefineProtection | null,\n defaultResolved?: Record<string, unknown>,\n renderOnly?: boolean,\n) => Record<string, unknown>;\n\ntype ResolveRefineFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n filterOwnVariants?: boolean,\n) => Record<string, unknown>;\n\ntype ResolveRefineOnceFn = (\n resolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n filterOwnVariants?: boolean,\n protection?: RefineProtection | null,\n defaultResolved?: Record<string, unknown>,\n) => Record<string, unknown>;\n\ntype ComputedDefaultVariantFn = (\n defaultValue: unknown,\n variants: Readonly<Record<string, unknown>>,\n) => unknown;\n\n// Internal metadata stored on components but hidden from public types.\ninterface ComponentMeta {\n identity?: object;\n extends?: ComponentMeta[];\n rebuild?: (extensions: ComponentMeta[]) => ComponentMeta;\n baseClass: string;\n staticDefaults: Record<string, unknown>;\n // Performs a single compute pass for extending components, returning the\n // resolved variants while pushing classes and styles into the output values.\n compute: ComputeOnceFn;\n resolveRefine: ResolveRefineOnceFn | null;\n // Reference identity is used to detect mixed-factory `extend`. When a\n // component is extended by a parent from a different `create()` call, the\n // parent applies this transform to the extend's contribution before joining,\n // preserving each factory's transform boundary.\n transformClass: (className: string) => string;\n // Variant keys whose effective definition in this component's chain is a\n // function. An extending component that supplies a non-function variant for\n // the same key uses this to tell us to skip that key (matching the\n // type-level \"function variant is replaced by anything in the child\" rule).\n // Empty when no key in this chain is a function variant.\n functionVariantKeys: Set<string>;\n // Variant keys with computed defaults anywhere in this component's chain.\n // Child components use this to preserve inherited computed defaults through\n // `defaultValue` without preserving their own prior computed result.\n computedDefaultKeys: Set<string>;\n}\n\nconst META_KEY = \"__meta\";\n\ninterface ComponentWithMeta {\n [META_KEY]?: ComponentMeta;\n}\n\nconst EMPTY_DEFAULTS: Record<string, unknown> = {};\n\n// Prune shared recipes before compiling their parent's compute path. Keeping\n// the first path preserves its overrides and factory transform boundaries.\nfunction deduplicateExtensions(\n extensions: ComponentMeta[],\n seen = new Set<object>(),\n): ComponentMeta[] {\n if (extensions.length === 0) {\n return extensions;\n }\n const result: ComponentMeta[] = [];\n let changed = false;\n for (const meta of extensions) {\n const identity = getOwn(meta, \"identity\") ?? meta;\n if (seen.has(identity)) {\n changed = true;\n continue;\n }\n seen.add(identity);\n // Older Clava copies expose the compute metadata but not their graph.\n // Keep their contribution intact instead of traversing hidden ancestors.\n const inheritedExtensions = getOwn(meta, \"extends\");\n const rebuild = getOwn(meta, \"rebuild\");\n if (!inheritedExtensions || !rebuild) {\n result.push(meta);\n continue;\n }\n const children = deduplicateExtensions(inheritedExtensions, seen);\n if (children === inheritedExtensions) {\n result.push(meta);\n } else {\n result.push(rebuild(children));\n changed = true;\n }\n }\n return changed ? result : extensions;\n}\n\nconst MAX_REFINE_RUNS = 50;\n\nfunction areVariantsEqual(\n a: Record<string, unknown>,\n b: Record<string, unknown>,\n): boolean {\n // The first loop proves every own key of `a` is an own key of `b` with the\n // same value, so counting both sides is enough to prove the key sets match.\n // Counting keeps the total number of lookups the same as before the own-key\n // check was added to the first loop.\n let ownKeyDifference = 0;\n for (const key in a) {\n if (!hasOwn(a, key)) continue;\n if (!hasOwn(b, key)) return false;\n if (!Object.is(a[key], b[key])) return false;\n ownKeyDifference++;\n }\n for (const key in b) {\n if (!hasOwn(b, key)) continue;\n ownKeyDifference--;\n }\n return ownKeyDifference === 0;\n}\n\n// Variants that a `refine` callback assigned through `setVariants`. Two stages\n// read them: computed defaults skip a key that was assigned this way, and\n// `mergeProtectedIntoBase` folds them into the base each pass resolves from.\n// The record is created on the first `setVariants` call, because most callbacks\n// only read variants. The holder is shared so that a callback anywhere in the\n// chain can report its assignment back to the resolution that owns the pass.\ninterface RefineProtection {\n variants: Record<string, unknown> | null;\n}\n\nfunction mergeProtectedIntoBase(\n baseResolved: Record<string, unknown>,\n protection: RefineProtection | null,\n): Record<string, unknown> {\n const protectedVariants = protection?.variants;\n if (!protectedVariants) return baseResolved;\n return Object.assign({}, baseResolved, protectedVariants);\n}\n\nexport type {\n ClassValue,\n StyleValue,\n StyleClassProps,\n StyleClassValue,\n JSXProps,\n HTMLProps,\n HTMLObjProps,\n CVComponent,\n};\n\n/**\n * Extracts the variant props inferred for a Clava component. Use it to add a\n * component's variant props to framework component props.\n *\n * @example\n * ```ts\n * import { type VariantProps, cv } from \"clava\";\n * import type { ComponentProps } from \"react\";\n *\n * const button = cv({\n * variants: {\n * size: { sm: \"button-sm\", lg: \"button-lg\" },\n * disabled: { true: \"button-disabled\", false: \"\" },\n * },\n * });\n *\n * interface ButtonProps\n * extends ComponentProps<\"button\">,\n * VariantProps<typeof button> {}\n *\n * const props: ButtonProps = {\n * size: \"lg\",\n * disabled: true,\n * };\n * ```\n */\nexport type VariantProps<T extends Pick<AnyComponent, \"getVariants\">> =\n ReturnType<T[\"getVariants\"]>;\n\n// Variant props expose booleans, but variant object keys are always strings.\ntype VariantKey<T> = T extends boolean ? \"true\" | \"false\" : Extract<T, string>;\n\n/**\n * Constrains a variant map to the same value keys as a variant on another\n * component. Boolean variants are represented with `\"true\"` and `\"false\"`\n * object keys.\n *\n * @example\n * ```ts\n * import { type Variant, cv } from \"clava\";\n *\n * const button = cv({\n * variants: {\n * size: { sm: \"button-sm\", lg: \"button-lg\" },\n * },\n * });\n *\n * const icon = cv({\n * extend: [button],\n * variants: {\n * size: {\n * sm: \"icon-sm\",\n * lg: \"icon-lg\",\n * } satisfies Variant<typeof button, \"size\">,\n * },\n * });\n * ```\n */\nexport type Variant<\n T extends Pick<AnyComponent, \"getVariants\">,\n K extends keyof VariantProps<T>,\n> = Record<\n VariantKey<NonNullable<VariantProps<T>[K]>>,\n ClassValue | StyleClassValue\n>;\n\n/**\n * The configuration object accepted by `cv()`. It defines base class/style\n * output, variants, default variants, component extensions, and refinement\n * logic.\n *\n * @example\n * ```ts\n * import { type CVConfig, cv } from \"clava\";\n *\n * const config: CVConfig<{\n * tone: { info: string; danger: string };\n * }> = {\n * variants: {\n * tone: {\n * info: \"alert-info\",\n * danger: \"alert-danger\",\n * },\n * },\n * defaultVariants: {\n * tone: \"info\",\n * },\n * };\n *\n * const alert = cv(config);\n * ```\n */\nexport interface CVConfig<\n V extends Variants = {},\n E extends AnyComponent[] = [],\n> {\n extend?: E;\n class?: ClassValue;\n style?: StyleValue;\n variants?: ExtendableVariants<V, E>;\n defaultVariants?: DefaultVariants<MergeVariants<V, E>>;\n refine?: Refine<MergeVariants<V, E>>;\n}\n\ninterface CreateParams {\n transformClass?: (className: string) => string;\n}\n\nfunction identityClass(className: string) {\n return className;\n}\n\nfunction isRecordObject(value: unknown): value is Record<string, unknown> {\n if (typeof value !== \"object\") return false;\n if (value == null) return false;\n if (Array.isArray(value)) return false;\n return true;\n}\n\n/**\n * Converts any style input (string, JSX object, or HTML object) to a normalized\n * StyleValue.\n */\nfunction normalizeStyle(style: unknown): StyleValue {\n if (typeof style === \"string\") {\n return htmlStyleToStyleValue(style);\n }\n if (typeof style === \"object\" && style != null) {\n return htmlObjStyleToStyleValue(style);\n }\n return {};\n}\n\n/**\n * Pre-extracts the class and (normalized) style from a variant value once at\n * component creation time. Returns `null` if the value contributes nothing.\n */\ninterface PrebuiltValue {\n class: ClassValue;\n style: StyleValue | null;\n}\n\nfunction extractClassAndStylePrebuilt(value: unknown): PrebuiltValue {\n if (!isRecordObject(value)) {\n return { class: value as ClassValue, style: null };\n }\n // A value that owns neither key contributes nothing, and a value that owns\n // one of them must not pick up the other from a polluted `Object.prototype`.\n // Checked inline rather than through `getOwn`: this runs for every variant\n // value at creation time, where the call is worth about 3% of `cv()`.\n const styleClassValue = value as StyleClassValue;\n const classValue = hasOwn(value, \"class\") ? styleClassValue.class : undefined;\n const styleValue = hasOwn(value, \"style\") ? styleClassValue.style : undefined;\n if (classValue === undefined && styleValue === undefined) {\n return { class: null, style: null };\n }\n const style = normalizeStyle(styleValue);\n return {\n class: classValue ?? null,\n style: Object.keys(style).length > 0 ? style : null,\n };\n}\n\nfunction getVariantValueKey(value: unknown): string | undefined {\n if (typeof value === \"string\") {\n return value;\n }\n if (typeof value === \"number\") {\n return String(value);\n }\n if (typeof value === \"boolean\") {\n return String(value);\n }\n return undefined;\n}\n\nconst EMPTY_KEYS: readonly string[] = [];\n\nfunction isComponentKeySource(source: unknown): source is KeySourceComponent {\n if (!source) return false;\n if (typeof source !== \"object\" && typeof source !== \"function\") {\n return false;\n }\n const typed = source as Record<string, unknown>;\n if (typeof typed.getVariants !== \"function\") return false;\n if (!Array.isArray(typed.propKeys)) return false;\n return Array.isArray(typed.variantKeys);\n}\n\n/**\n * Splits props into multiple groups based on key sources. Only the first\n * component claims styling props (class/className/style). Subsequent components\n * only receive variant props. Arrays always receive their listed keys but don't\n * claim styling props.\n */\nfunction splitPropsImpl(\n selfKeys: readonly string[],\n selfIsComponent: boolean,\n props: Record<string, unknown>,\n sources: unknown[],\n): Record<string, unknown>[] {\n const sourcesLength = sources.length;\n const results: Record<string, unknown>[] = [];\n let stylingClaimed = selfIsComponent;\n\n const selfResult: Record<string, unknown> = {};\n const selfKeysLength = selfKeys.length;\n for (let i = 0; i < selfKeysLength; i++) {\n const key = selfKeys[i];\n if (key !== undefined && hasOwn(props, key)) {\n selfResult[key] = props[key];\n }\n }\n results.push(selfResult);\n\n // Track effective key arrays for the rest computation — for typical inputs\n // a linear scan beats building a Set up-front.\n const effectiveKeyArrays: Array<readonly string[]> = [selfKeys];\n\n for (let s = 0; s < sourcesLength; s++) {\n const source = sources[s];\n const sourceResult: Record<string, unknown> = {};\n let sourceIsComponent = false;\n let effectiveKeys: readonly string[];\n if (Array.isArray(source)) {\n effectiveKeys = source;\n } else if (isComponentKeySource(source)) {\n sourceIsComponent = true;\n effectiveKeys = stylingClaimed ? source.variantKeys : source.propKeys;\n } else {\n effectiveKeys = EMPTY_KEYS;\n }\n\n const effectiveKeysLength = effectiveKeys.length;\n for (let i = 0; i < effectiveKeysLength; i++) {\n const key = effectiveKeys[i];\n if (key !== undefined && hasOwn(props, key)) {\n sourceResult[key] = props[key];\n }\n }\n results.push(sourceResult);\n effectiveKeyArrays.push(effectiveKeys);\n\n if (sourceIsComponent && !stylingClaimed) {\n stylingClaimed = true;\n }\n }\n\n const rest: Record<string, unknown> = {};\n const propKeys = Object.keys(props);\n const propKeysLength = propKeys.length;\n const groupCount = sourcesLength + 1;\n outer: for (let i = 0; i < propKeysLength; i++) {\n const key = propKeys[i];\n if (key === undefined) continue;\n for (let g = 0; g < groupCount; g++) {\n const arr = effectiveKeyArrays[g];\n if (arr === undefined) continue;\n const arrLength = arr.length;\n for (let j = 0; j < arrLength; j++) {\n if (arr[j] === key) continue outer;\n }\n }\n rest[key] = props[key];\n }\n results.push(rest);\n\n return results;\n}\n\n/**\n * Splits props into multiple groups based on key sources. Each source gets its\n * own result object containing all its matching keys. The first component\n * source claims styling props (class/className/style). Subsequent components\n * only receive variant props. Arrays receive their listed keys but don't claim\n * styling props. The last element is always the \"rest\" containing keys not\n * claimed by any source.\n */\nexport const splitProps: SplitPropsFunction = ((\n props: Record<string, unknown>,\n source1: unknown,\n ...sources: unknown[]\n) => {\n if (Array.isArray(source1)) {\n return splitPropsImpl(source1, false, props, sources);\n }\n if (isComponentKeySource(source1)) {\n return splitPropsImpl(source1.propKeys, true, props, sources);\n }\n return splitPropsImpl(EMPTY_KEYS, false, props, sources);\n}) as SplitPropsFunction;\n\n/**\n * A pre-built variant. Maps variant value keys (or the literal \"true\"/\"false\"\n * strings for boolean variants) to PrebuiltValue. Includes a \"shorthand\"\n * fallback when the variant is a single class value (treated as `{ true: ... }`).\n */\ninterface PrebuiltVariant {\n // For object variants: map of value -> prebuilt class/style. A Map keeps the\n // lookup keyed by the caller's variant value out of reach of a polluted\n // `Object.prototype`.\n values: Map<string, PrebuiltValue> | null;\n // For shorthand variants: the value to use when selectedValue is true\n shorthand: PrebuiltValue | null;\n // Set of value keys that are disabled (value === null in the original variant\n // definition)\n disabledValues: Set<string> | null;\n}\n\nfunction buildPrebuiltVariant(variantDef: unknown): PrebuiltVariant {\n if (!isRecordObject(variantDef)) {\n return {\n values: null,\n shorthand: extractClassAndStylePrebuilt(variantDef),\n disabledValues: null,\n };\n }\n const values = new Map<string, PrebuiltValue>();\n let disabledValues: Set<string> | null = null;\n for (const key in variantDef) {\n if (!hasOwn(variantDef, key)) continue;\n const value = variantDef[key];\n if (value === null) {\n if (!disabledValues) {\n disabledValues = new Set<string>();\n }\n disabledValues.add(key);\n continue;\n }\n values.set(key, extractClassAndStylePrebuilt(value));\n }\n return {\n values,\n shorthand: null,\n disabledValues,\n };\n}\n\n/**\n * Creates the cv and cx functions.\n */\nexport function create(params: CreateParams = {}) {\n // Destructuring would read an inherited `transformClass`, which a polluted\n // `Object.prototype` could use to rewrite every class string this factory\n // produces, including those of the package-level `cv`.\n const transformClass = getOwn(params, \"transformClass\") ?? identityClass;\n\n const cx = (...classes: ClsxClassValue[]) => transformClass(clsx(classes));\n\n const buildComponent = <\n V extends Variants = {},\n const E extends AnyComponent[] = [],\n >(\n config: CVConfig<V, E> = {},\n ): { component: CVComponent<V, E>; meta: ComponentMeta } => {\n type MergedVariants = MergeVariants<V, E>;\n\n // Compile caller-owned configuration once. Rebuilding a pruned branch\n // reuses these values, including references that rendering already retains.\n const extend = getOwn(config, \"extend\");\n const variants = getOwn(config, \"variants\");\n const refine = getOwn(config, \"refine\");\n const baseStyle = getOwn(config, \"style\");\n const hasBaseStyle = !!baseStyle;\n const baseClassValue = getOwn(config, \"class\");\n const variantKeySet = new Set<string>();\n const inheritedComputedDefaultKeys = new Set<string>();\n const originalExtMetas: ComponentMeta[] = [];\n if (extend) {\n for (const ext of extend) {\n const extKeys = ext.variantKeys as readonly string[];\n for (let i = 0; i < extKeys.length; i++) {\n const key = extKeys[i];\n if (key === undefined) continue;\n variantKeySet.add(key);\n }\n const meta = (ext as AnyComponent & ComponentWithMeta)[META_KEY];\n if (!meta) continue;\n originalExtMetas.push(meta);\n // A later branch can read a computed default contributed by the first\n // path, even when that shared ancestor is pruned from this branch.\n for (const key of meta.computedDefaultKeys) {\n inheritedComputedDefaultKeys.add(key);\n }\n }\n }\n const initialExtensions =\n originalExtMetas.length > 1\n ? deduplicateExtensions(originalExtMetas)\n : originalExtMetas;\n\n // Keep own default operations separate from inherited values. An explicit\n // undefined must still clear a default when the retained extensions change.\n const ownStaticDefaults: Record<string, unknown> = {};\n const disabledVariantKeys = new Set<string>();\n let disabledValuesBuilder: Record<string, Set<string>> | null = null;\n const variantEntryNames: string[] = [];\n const variantEntryDefs: PrebuiltVariant[] = [];\n const functionVariantNames: string[] = [];\n const functionVariantFns: Array<(value: unknown) => unknown> = [];\n if (variants) {\n for (const name in variants) {\n if (!hasOwn(variants, name)) continue;\n const variant = (variants as Record<string, unknown>)[name];\n if (variant === null) {\n variantKeySet.delete(name);\n disabledVariantKeys.add(name);\n continue;\n }\n variantKeySet.add(name);\n if (typeof variant === \"function\") {\n functionVariantNames.push(name);\n functionVariantFns.push(variant as (value: unknown) => unknown);\n continue;\n }\n const prebuiltVariant = buildPrebuiltVariant(variant);\n variantEntryNames.push(name);\n variantEntryDefs.push(prebuiltVariant);\n if (prebuiltVariant.disabledValues) {\n disabledValuesBuilder ??= {};\n disabledValuesBuilder[name] = prebuiltVariant.disabledValues;\n }\n // Capture this decision before pruning can remove an inherited default.\n if (\n prebuiltVariant.values?.has(\"false\") &&\n !initialExtensions.some((meta) => hasOwn(meta.staticDefaults, name))\n ) {\n ownStaticDefaults[name] = false;\n }\n }\n }\n const variantKeys = Array.from(variantKeySet);\n const variantKeysLength = variantKeys.length;\n const variantEntryCount = variantEntryNames.length;\n const functionVariantCount = functionVariantNames.length;\n const hasDisabledVariantKeys = disabledVariantKeys.size > 0;\n const disabledVariantValues = disabledValuesBuilder;\n const hasAnyDisabled =\n hasDisabledVariantKeys || disabledVariantValues !== null;\n const inputPropsKeys = [\"class\", \"className\", \"style\", ...variantKeys];\n\n const computedDefaultNames: string[] = [];\n const computedDefaultFns: ComputedDefaultVariantFn[] = [];\n const defaultVariants = getOwn(config, \"defaultVariants\") as\n | Record<string, unknown>\n | undefined;\n if (defaultVariants) {\n for (const name in defaultVariants) {\n if (!hasOwn(defaultVariants, name)) continue;\n const value = defaultVariants[name];\n if (typeof value === \"function\") {\n computedDefaultNames.push(name);\n computedDefaultFns.push(value as ComputedDefaultVariantFn);\n } else {\n ownStaticDefaults[name] = value;\n }\n }\n }\n const computedDefaultCount = computedDefaultNames.length;\n const baseClass = clsx(baseClassValue as ClsxClassValue);\n const identity = {};\n const canTriggerRefineWarning =\n !!refine ||\n computedDefaultCount > 0 ||\n initialExtensions.some((meta) => meta.resolveRefine);\n const creationFrame =\n canTriggerRefineWarning && process.env.NODE_ENV !== \"production\"\n ? captureCreationFrame(cv)\n : undefined;\n\n // Only extension-dependent state is rebuilt. Own tables, callbacks,\n // inheritance visibility, and the creation frame stay shared and unchanged.\n const build = (\n extMetas: ComponentMeta[],\n ): {\n component: CVComponent<V, E>;\n meta: ComponentMeta;\n } => {\n const hasExtend = extMetas.length > 0;\n const extCount = extMetas.length;\n const staticDefaults: Record<string, unknown> = {};\n const extBaseClassesArr: string[] = [];\n const extIsolated: boolean[] = [];\n let hasIsolatedExt = false;\n for (const meta of extMetas) {\n Object.assign(staticDefaults, meta.staticDefaults);\n const isolated = meta.transformClass !== transformClass;\n extIsolated.push(isolated);\n if (isolated) {\n hasIsolatedExt = true;\n extBaseClassesArr.push(meta.transformClass(meta.baseClass));\n } else {\n extBaseClassesArr.push(meta.baseClass);\n }\n }\n for (const name in ownStaticDefaults) {\n if (!hasOwn(ownStaticDefaults, name)) continue;\n const value = ownStaticDefaults[name];\n if (value === undefined) {\n delete staticDefaults[name];\n } else {\n staticDefaults[name] = value;\n }\n }\n if (hasAnyDisabled) {\n for (const key in staticDefaults) {\n if (!hasOwn(staticDefaults, key)) continue;\n if (disabledVariantKeys.has(key)) {\n delete staticDefaults[key];\n continue;\n }\n if (disabledVariantValues) {\n const valueKey = getVariantValueKey(staticDefaults[key]);\n if (\n valueKey != null &&\n getOwn(disabledVariantValues, key)?.has(valueKey)\n ) {\n delete staticDefaults[key];\n }\n }\n }\n }\n\n // Filter to only extends with computed default or refine work in their\n // chain. Those are the components that can change resolved variants across\n // fixed-point iterations.\n const extMetasWithRefine: ComponentMeta[] = [];\n for (let i = 0; i < extCount; i++) {\n const meta = extMetas[i];\n if (meta.resolveRefine) {\n extMetasWithRefine.push(meta);\n }\n }\n const extMetasWithRefineCount = extMetasWithRefine.length;\n\n // Only a `refine` callback protects variants, through `setVariants`. This\n // over-approximates: `extMetasWithRefineCount` also counts extends that\n // only have computed defaults. Tightening it would mean tracking `refine`\n // separately in `ComponentMeta` to save one allocation. The record inside\n // the holder is created only when a callback assigns something.\n const canProtectVariants = !!refine || extMetasWithRefineCount > 0;\n\n // `userVariantProps` tells computed defaults which variants the user set\n // explicitly, and `runComputedDefaults` is its only reader anywhere in the\n // chain: a `refine` callback never receives it. `computedDefaultKeys` is\n // transitive, so an empty inherited set proves no extend runs computed\n // defaults either, and nothing reads the record. The record is then the\n // caller's own props object, which no stage may write to.\n const needsUserVariantProps =\n computedDefaultCount > 0 || inheritedComputedDefaultKeys.size > 0;\n\n // Function variant keys inherited from extends, filtered through this\n // component's own variants: a static (object/shorthand) variant in this\n // component replaces an inherited function variant for the same key.\n // The closure is exposed on `ComponentMeta` so any further extending\n // component can detect \"ancestor's effective variant for K is a function\"\n // and skip it when overriding K with a non-function.\n const functionVariantKeys = new Set<string>();\n for (let i = 0; i < extCount; i++) {\n const fnKeys = extMetas[i].functionVariantKeys;\n for (const k of fnKeys) {\n if (disabledVariantKeys.has(k)) continue;\n functionVariantKeys.add(k);\n }\n }\n for (let i = 0; i < functionVariantCount; i++) {\n functionVariantKeys.add(functionVariantNames[i]);\n }\n for (let i = 0; i < variantEntryCount; i++) {\n // A static variant in this component replaces an inherited function\n // variant for the same key; from this component onward, the key is no\n // longer a function variant.\n functionVariantKeys.delete(variantEntryNames[i]);\n }\n\n const computedDefaultKeys = new Set(inheritedComputedDefaultKeys);\n for (let i = 0; i < computedDefaultCount; i++) {\n computedDefaultKeys.add(computedDefaultNames[i]);\n }\n\n // Pre-compute static skip key/value sets to pass to extends. These never\n // change across calls — when caller passes no skip sets, we reuse the same\n // object and avoid Set allocation.\n let staticExtSkipKeys: Set<string> | null = null;\n if (hasDisabledVariantKeys || functionVariantCount > 0) {\n staticExtSkipKeys = new Set<string>();\n for (const k of disabledVariantKeys) {\n staticExtSkipKeys.add(k);\n }\n for (let i = 0; i < functionVariantCount; i++) {\n staticExtSkipKeys.add(functionVariantNames[i]);\n }\n }\n\n // A static variant in this component replaces an inherited function\n // variant, so the ancestor must skip that key.\n if (variantEntryCount > 0 && extCount > 0) {\n for (let i = 0; i < variantEntryCount; i++) {\n const name = variantEntryNames[i];\n for (let j = 0; j < extCount; j++) {\n if (extMetas[j].functionVariantKeys.has(name)) {\n staticExtSkipKeys ??= new Set<string>();\n staticExtSkipKeys.add(name);\n break;\n }\n }\n }\n }\n // Skip values are passed directly to extends. We can reuse the same object\n // when no caller-provided values need merging.\n const staticExtSkipValues = disabledVariantValues;\n\n // Callers use this only when disabled keys or values exist.\n function filterDisabledInto(\n input: Record<string, unknown>,\n out: Record<string, unknown>,\n ): void {\n for (const key in input) {\n if (!hasOwn(input, key)) continue;\n if (disabledVariantKeys.has(key)) continue;\n const value = input[key];\n if (disabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (\n valueKey != null &&\n getOwn(disabledVariantValues, key)?.has(valueKey)\n ) {\n continue;\n }\n }\n out[key] = value;\n }\n }\n\n const isOwnDisabledValue = (key: string, value: unknown): boolean => {\n if (disabledVariantKeys.has(key)) {\n return true;\n }\n if (disabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (\n valueKey != null &&\n getOwn(disabledVariantValues, key)?.has(valueKey)\n ) {\n return true;\n }\n }\n return false;\n };\n\n const filterOwnDisabledVariants = (\n input: Record<string, unknown>,\n fallback: Record<string, unknown>,\n ): Record<string, unknown> => {\n if (!hasAnyDisabled) {\n return input;\n }\n\n let hasOwnDisabledValue = false;\n for (const key in input) {\n if (!hasOwn(input, key)) continue;\n const value = input[key];\n if (isOwnDisabledValue(key, value)) {\n hasOwnDisabledValue = true;\n break;\n }\n }\n if (!hasOwnDisabledValue) {\n return input;\n }\n\n const filtered: Record<string, unknown> = {};\n for (const key in input) {\n if (!hasOwn(input, key)) continue;\n const value = input[key];\n if (!isOwnDisabledValue(key, value)) {\n filtered[key] = value;\n continue;\n }\n const fallbackValue = getOwn(fallback, key);\n if (\n fallbackValue !== undefined &&\n !isOwnDisabledValue(key, fallbackValue)\n ) {\n filtered[key] = fallbackValue;\n }\n }\n\n return filtered;\n };\n\n // Hot path: resolve variants by merging static defaults + extends'\n // static defaults + user-provided props.\n function resolveVariantsHot(\n propsVariants: Record<string, unknown>,\n ): Record<string, unknown> {\n // Start with static defaults\n const defaults = Object.assign({}, staticDefaults);\n\n // Apply propsVariants on top (filter undefined).\n for (let i = 0; i < variantKeysLength; i++) {\n const k = variantKeys[i];\n if (!hasOwn(propsVariants, k)) continue;\n const v = propsVariants[k];\n if (v === undefined) continue;\n defaults[k] = v;\n }\n\n if (!hasAnyDisabled) {\n return defaults;\n }\n\n // Filter disabled\n const result: Record<string, unknown> = {};\n filterDisabledInto(defaults, result);\n return result;\n }\n\n const runComputedDefaults = (\n resolved: Record<string, unknown>,\n defaultResolved: Record<string, unknown>,\n userVariantProps: Record<string, unknown>,\n filterOwnVariants: boolean,\n protection: RefineProtection | null | undefined,\n ): Record<string, unknown> => {\n const protectedVariants = protection?.variants;\n let ownVariants = filterOwnVariants ? null : resolved;\n const getOwnVariants = (): Record<string, unknown> => {\n if (ownVariants) {\n return ownVariants;\n }\n const filteredVariants: Record<string, unknown> = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (hasOwn(resolved, key)) {\n filteredVariants[key] = resolved[key];\n }\n }\n ownVariants = filteredVariants;\n return filteredVariants;\n };\n\n let updatedVariants: Record<string, unknown> | null = null;\n const ensureUpdated = (): Record<string, unknown> => {\n if (updatedVariants) {\n return updatedVariants;\n }\n const updated = Object.assign({}, resolved);\n updatedVariants = updated;\n return updated;\n };\n\n for (let i = 0; i < computedDefaultCount; i++) {\n const key = computedDefaultNames[i];\n if (hasOwn(userVariantProps, key)) {\n if (userVariantProps[key] !== undefined) continue;\n }\n if (protectedVariants && hasOwn(protectedVariants, key)) continue;\n\n const variantSnapshot = getOwnVariants();\n const defaultValue = inheritedComputedDefaultKeys.has(key)\n ? getOwn(variantSnapshot, key)\n : getOwn(defaultResolved, key);\n const value = computedDefaultFns[i](defaultValue, variantSnapshot);\n if (hasAnyDisabled) {\n if (disabledVariantKeys.has(key)) continue;\n if (disabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (\n valueKey != null &&\n getOwn(disabledVariantValues, key)?.has(valueKey)\n ) {\n continue;\n }\n }\n }\n\n if (value === undefined) {\n if (!hasOwn(variantSnapshot, key)) continue;\n delete ensureUpdated()[key];\n continue;\n }\n if (Object.is(getOwn(variantSnapshot, key), value)) continue;\n ensureUpdated()[key] = value;\n }\n\n return updatedVariants ?? resolved;\n };\n\n const runRefineContext = (\n resolved: Record<string, unknown>,\n filterOwnVariants: boolean,\n collectOutput: boolean,\n applyVariantUpdates: boolean,\n protection: RefineProtection | null | undefined,\n ): {\n workingResolved: Record<string, unknown>;\n classes: ClassValue[] | null;\n style: StyleValue | null;\n } => {\n let workingResolved = resolved;\n let cClasses: ClassValue[] | null = null;\n let cStyle: StyleValue | null = null;\n\n if (refine) {\n let ownVariants = resolved;\n if (filterOwnVariants) {\n // When this component is being extended, `resolved` is the parent's\n // workingResolved (a superset of our variant keys). Filter to our own\n // keys for `ctx.variants` so the user's `refine` callback sees the\n // shape declared by `VariantValues<V>` and not foreign parent keys.\n const filteredVariants: Record<string, unknown> = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const k = variantKeys[i];\n if (hasOwn(resolved, k)) {\n filteredVariants[k] = resolved[k];\n }\n }\n ownVariants = filteredVariants;\n }\n // `assignedVariants`, `localCClasses` and `localCStyle` are created on\n // first use, so a callback that only inspects `variants` allocates\n // none of them. The `setVariants` bookkeeping is inlined for the same\n // reason: helper closures would be allocated on every call, including\n // the calls that never assign anything.\n // `assignedVariants` holds only the changed keys, because copying all\n // of `ownVariants` into it would repeat values `workingResolved` has.\n let assignedVariants: Record<string, unknown> | null = null;\n let localCClasses: ClassValue[] | null = null;\n let localCStyle: StyleValue | null = null;\n const ctx = {\n variants: ownVariants as VariantValues<Record<string, unknown>>,\n setVariants: (\n newVariants: VariantValues<Record<string, unknown>>,\n ) => {\n if (!applyVariantUpdates) {\n return;\n }\n for (const key in newVariants) {\n if (!hasOwn(newVariants, key)) continue;\n // `disabledVariantKeys` is empty unless this component disables a\n // variant, so the lookup replaces a `hasAnyDisabled` branch. The\n // key is checked before the value is read, because reading it can\n // run a caller-defined accessor.\n if (disabledVariantKeys.has(key)) continue;\n const value = (newVariants as Record<string, unknown>)[key];\n if (disabledVariantValues) {\n const valueKey = getVariantValueKey(value);\n if (\n valueKey != null &&\n getOwn(disabledVariantValues, key)?.has(valueKey)\n ) {\n continue;\n }\n }\n if (protection) {\n const protectedVariants = (protection.variants ??= {});\n protectedVariants[key] = value;\n }\n // The record holds only assigned keys, so both halves matter: a\n // key it owns can hold a clear that `??` on the value would\n // discard, and a key it does not own must fall back to\n // `ownVariants`, or a clear compares against `undefined`.\n const current =\n assignedVariants && hasOwn(assignedVariants, key)\n ? assignedVariants[key]\n : getOwn(ownVariants, key);\n if (Object.is(current, value)) {\n continue;\n }\n assignedVariants ??= {};\n assignedVariants[key] = value;\n }\n },\n addClass: (className: ClassValue) => {\n if (!collectOutput) return;\n localCClasses ??= [];\n localCClasses.push(className);\n },\n addStyle: (newStyle: StyleValue) => {\n if (!collectOutput) return;\n localCStyle ??= {};\n Object.assign(localCStyle, newStyle);\n },\n };\n const result = refine(ctx);\n if (collectOutput && result != null) {\n const r = extractClassAndStylePrebuilt(result);\n if (r.class != null) {\n localCClasses ??= [];\n localCClasses.push(r.class);\n }\n if (r.style) {\n localCStyle ??= {};\n Object.assign(localCStyle, r.style);\n }\n }\n cClasses = localCClasses;\n cStyle = localCStyle;\n if (assignedVariants) {\n // No disabled filtering here: `setVariants` drops a disabled key or\n // value before it records one, so every assigned key already passed\n // the same two checks.\n workingResolved = Object.assign(\n {},\n workingResolved,\n assignedVariants,\n );\n }\n }\n\n return {\n workingResolved,\n classes: cClasses,\n style: cStyle,\n };\n };\n\n // Core compute path. Called both for top-level rendering (via\n // `computeResult`) and recursively when this component is used as an\n // `extend` target by another component. Pushes variant classes (excluding\n // base class) into `classesOut` and merges styles into `styleOut`.\n const computeOnce: ComputeOnceFn = (\n resolved,\n userVariantProps,\n skipKeys,\n skipValues,\n classesOut,\n styleOut,\n protection,\n defaultResolved = resolved,\n renderOnly = false,\n ) => {\n let workingResolved = resolved;\n let cClasses: ClassValue[] | null = null;\n let cStyle: StyleValue | null = null;\n\n // Run extends' contributions first (their full classes + styles) so our\n // own base style and variants apply on top, matching the original\n // ext1 → ext2 → … → current ordering.\n if (hasExtend) {\n // Build skip sets to pass to extends. Reuse precomputed values when no\n // caller-provided sets need merging.\n let extSkipKeys: Set<string> | null;\n if (skipKeys === null) {\n extSkipKeys = staticExtSkipKeys;\n } else if (staticExtSkipKeys === null) {\n extSkipKeys = skipKeys;\n } else {\n extSkipKeys = new Set(skipKeys);\n for (const k of staticExtSkipKeys) {\n extSkipKeys.add(k);\n }\n }\n\n let extSkipVals: Record<string, Set<string>> | null;\n if (skipValues === null) {\n extSkipVals = staticExtSkipValues;\n } else if (staticExtSkipValues === null) {\n extSkipVals = skipValues;\n } else {\n extSkipVals = {};\n for (const k in skipValues) {\n if (!hasOwn(skipValues, k)) continue;\n extSkipVals[k] = skipValues[k];\n }\n for (const k in staticExtSkipValues) {\n if (!hasOwn(staticExtSkipValues, k)) continue;\n const values = staticExtSkipValues[k];\n const existing = getOwn(extSkipVals, k);\n if (existing) {\n const merged = new Set<string>(existing);\n for (const v of values) {\n merged.add(v);\n }\n extSkipVals[k] = merged;\n } else {\n extSkipVals[k] = values;\n }\n }\n }\n\n for (let i = 0; i < extCount; i++) {\n if (hasIsolatedExt && extIsolated[i]) {\n // Isolated extend (different factory): gather its variant classes\n // into a scratch array, then push the joined string after applying\n // its own transformClass. Our outer transform applies on top.\n const extClasses: ClsxClassValue[] = [];\n workingResolved = extMetas[i].compute(\n workingResolved,\n userVariantProps,\n extSkipKeys,\n extSkipVals,\n extClasses,\n styleOut,\n protection,\n defaultResolved,\n renderOnly,\n );\n if (extClasses.length > 0) {\n const joined = clsx(extClasses);\n if (joined.length > 0) {\n classesOut.push(extMetas[i].transformClass(joined));\n }\n }\n } else {\n workingResolved = extMetas[i].compute(\n workingResolved,\n userVariantProps,\n extSkipKeys,\n extSkipVals,\n classesOut,\n styleOut,\n protection,\n defaultResolved,\n renderOnly,\n );\n }\n workingResolved = filterOwnDisabledVariants(\n workingResolved,\n defaultResolved,\n );\n }\n }\n\n // Run own computed defaults after extended components so defaults resolve\n // from base to child. They still run before this component's `refine`.\n if (!renderOnly && computedDefaultCount > 0) {\n workingResolved = runComputedDefaults(\n workingResolved,\n defaultResolved,\n userVariantProps,\n true,\n protection,\n );\n }\n\n // Run own `refine` (if any). May modify resolved variants and emit\n // classes and styles that are applied after this component's variants.\n if (refine) {\n const refineResult = runRefineContext(\n workingResolved,\n true,\n true,\n !renderOnly,\n protection,\n );\n workingResolved = refineResult.workingResolved;\n cClasses = refineResult.classes;\n cStyle = refineResult.style;\n }\n\n // Apply own base style (after extends' styles, matching original order).\n if (hasBaseStyle) {\n Object.assign(styleOut, baseStyle);\n }\n\n // Apply own variants. Skip keys/values come from caller (e.g., parent\n // wants its own function variant to override this variant).\n // `variantEntryNames` already excludes disabled keys (those with `null`\n // value in config) and function variants, so we don't re-check\n // `disabledVariantKeys` here.\n const ownSkipKeys = skipKeys;\n const ownSkipValues = skipValues;\n for (let i = 0; i < variantEntryCount; i++) {\n const variantName = variantEntryNames[i];\n if (ownSkipKeys && ownSkipKeys.has(variantName)) continue;\n // Read first: an inherited value that could change the output is\n // never `undefined`, so the own-property check only runs for the\n // variants that carry a value.\n const selectedValue = workingResolved[variantName];\n if (selectedValue === undefined) continue;\n if (!hasOwn(workingResolved, variantName)) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n const variant = variantEntryDefs[i];\n if (\n variant.disabledValues &&\n selectedKey != null &&\n variant.disabledValues.has(selectedKey)\n ) {\n continue;\n }\n if (\n ownSkipValues &&\n selectedKey != null &&\n getOwn(ownSkipValues, variantName)?.has(selectedKey)\n ) {\n continue;\n }\n\n let value: PrebuiltValue | null | undefined;\n if (variant.values) {\n if (selectedKey == null) continue;\n value = variant.values.get(selectedKey);\n } else if (selectedValue === true) {\n value = variant.shorthand;\n }\n if (!value) continue;\n if (value.class != null) {\n classesOut.push(value.class);\n }\n if (value.style) {\n Object.assign(styleOut, value.style);\n }\n }\n\n // Apply function variants — entries in `variants` whose value is a\n // function. They run after static variants and override any same-key\n // inherited variant via `staticExtSkipKeys`.\n for (let i = 0; i < functionVariantCount; i++) {\n const variantName = functionVariantNames[i];\n if (ownSkipKeys && ownSkipKeys.has(variantName)) continue;\n const selectedValue = workingResolved[variantName];\n if (selectedValue === undefined) continue;\n if (!hasOwn(workingResolved, variantName)) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n if (\n ownSkipValues &&\n selectedKey != null &&\n getOwn(ownSkipValues, variantName)?.has(selectedKey)\n ) {\n continue;\n }\n const fn = functionVariantFns[i];\n const computedResult = fn(selectedValue);\n if (computedResult == null) continue;\n const r = extractClassAndStylePrebuilt(computedResult);\n if (r.class != null) {\n classesOut.push(r.class);\n }\n if (r.style) {\n Object.assign(styleOut, r.style);\n }\n }\n\n // Apply `refine` results — must come after own variants (static and\n // function).\n if (cClasses) {\n for (let i = 0; i < cClasses.length; i++) {\n classesOut.push(cClasses[i] as ClsxClassValue);\n }\n }\n if (cStyle) {\n Object.assign(styleOut, cStyle);\n }\n\n return workingResolved;\n };\n\n const compute: ComputeFn =\n !refine && computedDefaultCount === 0 && extMetasWithRefineCount === 0\n ? computeOnce\n : (\n resolved,\n userVariantProps,\n skipKeys,\n skipValues,\n classesOut,\n styleOut,\n ) => {\n let remaining = MAX_REFINE_RUNS;\n const protection: RefineProtection | null = canProtectVariants\n ? { variants: null }\n : null;\n const incomingDefaultResolved = resolved;\n let workingResolved = resolved;\n // Latest variant changes from non-converging iterations inside the\n // tracking window. Lazy-init keeps convergent loops allocation-free.\n let unstableChanges: Map<string, VariantChange> | null = null;\n let lastClasses: ClsxClassValue[] = [];\n let lastStyle: StyleValue = {};\n let isFirstRun = true;\n\n while (remaining > 0) {\n remaining -= 1;\n const useDirectOutput = isFirstRun;\n const classCount = classesOut.length;\n const nextClasses: ClsxClassValue[] = useDirectOutput\n ? classesOut\n : [];\n const nextStyle: StyleValue = useDirectOutput ? styleOut : {};\n const defaultResolved = mergeProtectedIntoBase(\n incomingDefaultResolved,\n protection,\n );\n const nextResolved = computeOnce(\n workingResolved,\n userVariantProps,\n skipKeys,\n skipValues,\n nextClasses,\n nextStyle,\n protection,\n defaultResolved,\n );\n\n if (\n nextResolved === workingResolved ||\n areVariantsEqual(workingResolved, nextResolved)\n ) {\n if (nextResolved !== workingResolved) {\n if (useDirectOutput) {\n classesOut.length = classCount;\n for (const key in styleOut) {\n if (hasOwn(styleOut, key)) {\n Reflect.deleteProperty(styleOut, key);\n }\n }\n }\n computeOnce(\n nextResolved,\n userVariantProps,\n skipKeys,\n skipValues,\n classesOut,\n styleOut,\n protection,\n defaultResolved,\n true,\n );\n } else if (!useDirectOutput) {\n for (let i = 0; i < nextClasses.length; i++) {\n classesOut.push(nextClasses[i]);\n }\n Object.assign(styleOut, nextStyle);\n }\n return nextResolved;\n }\n\n // `remaining` is checked first: `process.env.NODE_ENV` is an\n // environment lookup in Node, not a property load, and only the\n // last `REFINE_UNSTABLE_TRACKING_WINDOW` passes need it. Bundlers\n // still inline it and drop the block.\n if (\n remaining < REFINE_UNSTABLE_TRACKING_WINDOW &&\n process.env.NODE_ENV !== \"production\"\n ) {\n if (!unstableChanges) {\n unstableChanges = new Map<string, VariantChange>();\n }\n accumulateUnstableVariantChanges(\n unstableChanges,\n workingResolved,\n nextResolved,\n );\n }\n\n if (useDirectOutput) {\n classesOut.length = classCount;\n for (const key in styleOut) {\n if (hasOwn(styleOut, key)) {\n Reflect.deleteProperty(styleOut, key);\n }\n }\n } else {\n lastClasses = nextClasses;\n lastStyle = nextStyle;\n }\n\n workingResolved = nextResolved;\n isFirstRun = false;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n warnRefineLimit({\n creationFrame,\n unstableChanges,\n });\n }\n\n for (let i = 0; i < lastClasses.length; i++) {\n classesOut.push(lastClasses[i]);\n }\n Object.assign(styleOut, lastStyle);\n return workingResolved;\n };\n\n const resolveRefineOnce: ResolveRefineOnceFn = (\n resolved,\n userVariantProps,\n filterOwnVariants = true,\n protection,\n defaultResolved = resolved,\n ) => {\n let workingResolved = resolved;\n\n for (let i = 0; i < extMetasWithRefineCount; i++) {\n const meta = extMetasWithRefine[i];\n const resolveRefine = meta.resolveRefine;\n if (!resolveRefine) continue;\n workingResolved = resolveRefine(\n workingResolved,\n userVariantProps,\n true,\n protection,\n defaultResolved,\n );\n workingResolved = filterOwnDisabledVariants(\n workingResolved,\n defaultResolved,\n );\n }\n\n if (computedDefaultCount > 0) {\n workingResolved = runComputedDefaults(\n workingResolved,\n defaultResolved,\n userVariantProps,\n filterOwnVariants,\n protection,\n );\n }\n if (refine) {\n const refineResult = runRefineContext(\n workingResolved,\n filterOwnVariants,\n false,\n true,\n protection,\n );\n workingResolved = refineResult.workingResolved;\n }\n\n return workingResolved;\n };\n\n const resolveRefine: ResolveRefineFn | null =\n refine || computedDefaultCount > 0 || extMetasWithRefineCount > 0\n ? (resolved, userVariantProps, filterOwnVariants = true) => {\n let remaining = MAX_REFINE_RUNS;\n const protection: RefineProtection | null = canProtectVariants\n ? { variants: null }\n : null;\n const incomingDefaultResolved = resolved;\n let workingResolved = resolved;\n // Latest variant changes from non-converging iterations inside the\n // tracking window. See the compute loop above for the shared\n // rationale.\n let unstableChanges: Map<string, VariantChange> | null = null;\n\n while (remaining > 0) {\n remaining -= 1;\n const defaultResolved = mergeProtectedIntoBase(\n incomingDefaultResolved,\n protection,\n );\n const nextResolved = resolveRefineOnce(\n workingResolved,\n userVariantProps,\n filterOwnVariants,\n protection,\n defaultResolved,\n );\n\n if (\n nextResolved === workingResolved ||\n areVariantsEqual(workingResolved, nextResolved)\n ) {\n return nextResolved;\n }\n\n // `remaining` is checked first for the reason given in the\n // compute loop above.\n if (\n remaining < REFINE_UNSTABLE_TRACKING_WINDOW &&\n process.env.NODE_ENV !== \"production\"\n ) {\n if (!unstableChanges) {\n unstableChanges = new Map<string, VariantChange>();\n }\n accumulateUnstableVariantChanges(\n unstableChanges,\n workingResolved,\n nextResolved,\n );\n }\n workingResolved = nextResolved;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n warnRefineLimit({\n creationFrame,\n unstableChanges,\n });\n }\n\n return workingResolved;\n }\n : null;\n\n // Top-level: resolves variants from user props, calls compute, then\n // assembles className and style with user-provided class/style overrides.\n const computeResult = (\n props: ComponentProps<MergedVariants> = EMPTY_DEFAULTS as ComponentProps<MergedVariants>,\n ): { className: string; style: StyleValue } => {\n const propsRecord = props as Record<string, unknown>;\n\n let resolved: Record<string, unknown> = {};\n Object.assign(resolved, staticDefaults);\n\n let userVariantProps: Record<string, unknown>;\n if (needsUserVariantProps) {\n const variantProps: Record<string, unknown> = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (!hasOwn(propsRecord, key)) continue;\n const value = propsRecord[key];\n variantProps[key] = value;\n if (value === undefined) continue;\n resolved[key] = value;\n }\n userVariantProps = variantProps;\n } else {\n // Fast path: walk variantKeys directly against propsRecord.\n // Own-property checks ensure a polluted Object.prototype can't add\n // values the user didn't pass.\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (!hasOwn(propsRecord, key)) continue;\n const v = propsRecord[key];\n if (v === undefined) continue;\n resolved[key] = v;\n }\n userVariantProps = propsRecord;\n }\n\n if (hasAnyDisabled) {\n const filtered: Record<string, unknown> = {};\n filterDisabledInto(resolved, filtered);\n resolved = filtered;\n }\n\n // Build allClasses directly. computedBaseClass already has all extend\n // bases joined with config.class — `compute` only adds variant classes\n // on top.\n const allClasses: ClsxClassValue[] = [computedBaseClass];\n const style: StyleValue = {};\n compute(resolved, userVariantProps, null, null, allClasses, style);\n\n // Apply user-provided class / className. Own-property checks keep these\n // consistent with the variant props read above: only what the caller\n // passed is applied, never a key inherited from Object.prototype.\n if (hasOwn(propsRecord, \"class\")) {\n allClasses.push(propsRecord.class as ClsxClassValue);\n }\n if (hasOwn(propsRecord, \"className\")) {\n allClasses.push(propsRecord.className as ClsxClassValue);\n }\n\n // Apply user-provided style, read before the own-property check for the\n // same reason as the variant loops above.\n const psv = propsRecord.style;\n if (psv != null && hasOwn(propsRecord, \"style\")) {\n if (typeof psv === \"string\") {\n if (psv.length > 0) {\n htmlStyleToStyleValue(psv, style);\n }\n } else if (typeof psv === \"object\") {\n htmlObjStyleToStyleValue(psv, style);\n }\n }\n\n return {\n className: transformClass(clsx(allClasses)),\n style,\n };\n };\n\n const getVariants = (variants?: VariantValues<MergedVariants>) => {\n const variantsRecord = variants ?? EMPTY_DEFAULTS;\n let variantProps = variantsRecord;\n // Copy to the declared variant keys, so the computed defaults that read\n // this record cannot see an undeclared key as an explicitly passed\n // variant, and cannot re-run a caller accessor once per refine pass. The\n // gate is narrower than that purpose: it misses a chain whose only\n // computed default is this component's own.\n // See https://github.com/ariakit/clava/issues/494\n if (variants && extMetasWithRefineCount > 0) {\n variantProps = {};\n for (let i = 0; i < variantKeysLength; i++) {\n const key = variantKeys[i];\n if (hasOwn(variantsRecord, key)) {\n variantProps[key] = variantsRecord[key];\n }\n }\n }\n let resolvedVariants = resolveVariantsHot(variantProps);\n if (resolveRefine) {\n resolvedVariants = resolveRefine(\n resolvedVariants,\n variantProps,\n false,\n );\n }\n return resolvedVariants as VariantValues<MergedVariants>;\n };\n\n // Compute base class (without variants) — includes extended base classes.\n // Plain `clsx` (no `transformClass`): `meta.baseClass` flows back into\n // parent extends as `clsx` input and then through the single\n // `transformClass(clsx(allClasses))` at render time, so applying it here\n // would compound (double for own-render, triple+ for extend chains) and\n // misbehave for non-idempotent transforms.\n const computedBaseClass = hasExtend\n ? clsx(extBaseClassesArr, baseClass)\n : baseClass;\n\n // Shared closures across the default and modal components.\n const classFn = (props: ComponentProps<MergedVariants> = {}) => {\n return computeResult(props).className;\n };\n const meta: ComponentMeta = {\n identity,\n extends: extMetas,\n rebuild: (extensions) => build(extensions).meta,\n baseClass: computedBaseClass,\n staticDefaults,\n compute: computeOnce,\n resolveRefine: resolveRefine ? resolveRefineOnce : null,\n transformClass,\n functionVariantKeys,\n computedDefaultKeys,\n };\n\n const initComponent = <\n R extends ComponentResult,\n T extends ModalComponent<MergedVariants, R>,\n >(\n c: T,\n propKeys: string[],\n style: T[\"style\"],\n ): T => {\n c.class = classFn;\n c.style = style;\n c.getVariants = getVariants;\n c.variantKeys = variantKeys;\n c.propKeys = propKeys;\n (c as AnyComponent & ComponentWithMeta)[META_KEY] = meta;\n return c;\n };\n\n // Default component\n const defaultComponent = ((\n props: ComponentProps<MergedVariants> = {},\n ) => {\n const { className, style } = computeResult(props);\n return { class: className, style };\n }) as CVComponent<V, E>;\n initComponent(defaultComponent, inputPropsKeys, (props = {}) => {\n return computeResult(props).style;\n });\n\n // JSX component\n const jsxComponent = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { className, style };\n }) as ModalComponent<MergedVariants, JSXProps>;\n initComponent(\n jsxComponent,\n [\"className\", \"style\", ...variantKeys],\n (props = {}) => computeResult(props).style,\n );\n\n // HTML component\n const htmlComponent = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { class: className, style: styleValueToHTMLStyle(style) };\n }) as ModalComponent<MergedVariants, HTMLProps>;\n initComponent(\n htmlComponent,\n [\"class\", \"style\", ...variantKeys],\n (props = {}) => styleValueToHTMLStyle(computeResult(props).style),\n );\n\n // HTMLObj component\n const htmlObjComponent = ((\n props: ComponentProps<MergedVariants> = {},\n ) => {\n const { className, style } = computeResult(props);\n return { class: className, style: styleValueToHTMLObjStyle(style) };\n }) as ModalComponent<MergedVariants, HTMLObjProps>;\n initComponent(\n htmlObjComponent,\n [\"class\", \"style\", ...variantKeys],\n (props = {}) => styleValueToHTMLObjStyle(computeResult(props).style),\n );\n\n defaultComponent.jsx = jsxComponent;\n defaultComponent.html = htmlComponent;\n defaultComponent.htmlObj = htmlObjComponent;\n\n return { component: defaultComponent, meta };\n };\n return build(initialExtensions);\n };\n\n const cv = <V extends Variants = {}, const E extends AnyComponent[] = []>(\n config: CVConfig<V, E> = {},\n ): CVComponent<V, E> => buildComponent(config).component;\n\n return { cv, cx };\n}\n\nexport const cv = /* @__PURE__ */ (() => create().cv)();\n\n/**\n * Joins class values without applying a class transform.\n *\n * This behaves like the `cx` function returned by `create()` with no options.\n */\nexport function cx(...classes: ClsxClassValue[]) {\n return clsx(classes);\n}\n"],"mappings":";;AAEA,MAAa,SAAS,OAAO;AAQ7B,SAAgB,OACd,QACA,KACkB;CAClB,IAAI,CAAC,OAAO,QAAQ,GAAG,GAAG,OAAO,KAAA;CACjC,OAAO,OAAO;AAChB;AAIA,MAAM,2CAA2B,IAAI,IAAI;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAS,iBAAiB,UAAkB;CAC1C,OAAO,SAAS,WAAW,CAAC,MAAM,MAAM,SAAS,WAAW,CAAC,MAAM;AACrE;AASA,SAAgB,cAAc,KAAa;CAEzC,IAAI,iBAAiB,GAAG,GACtB,OAAO;CAGT,IAAI,cAAc,IAAI,QAAQ,GAAG;CACjC,IAAI,gBAAgB,IAClB,OAAO;CAGT,IA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,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clava",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
4
4
|
"description": "Clava library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"class variance",
|
|
@@ -47,19 +47,20 @@
|
|
|
47
47
|
"csstype": "^3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/node": "25.9.
|
|
51
|
-
"@types/react": "19.
|
|
52
|
-
"
|
|
53
|
-
"rolldown
|
|
50
|
+
"@types/node": "25.9.6",
|
|
51
|
+
"@types/react": "19.3.0",
|
|
52
|
+
"clava-legacy": "npm:clava@0.6.3",
|
|
53
|
+
"rolldown": "1.2.8",
|
|
54
|
+
"rolldown-plugin-dts": "0.28.5",
|
|
54
55
|
"scripts": "0.0.0",
|
|
55
56
|
"solid-js": "1.9.15",
|
|
56
57
|
"test-utils": "0.0.0",
|
|
57
58
|
"typescript": "npm:@typescript/typescript6@6.0.2",
|
|
58
59
|
"vite": "8.2.2",
|
|
59
|
-
"vitest": "
|
|
60
|
+
"vitest": "5.0.0"
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"build": "rolldown -c",
|
|
63
|
-
"test": "vitest"
|
|
64
|
+
"test": "vitest --config ../../vitest.config.ts --dir ."
|
|
64
65
|
}
|
|
65
66
|
}
|