clava 0.1.19 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/index.d.ts +13 -20
- package/dist/index.js +49 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +79 -53
- package/src/types.ts +13 -4
- package/tests/_utils.ts +176 -0
- package/tests/class-style-test.ts +341 -0
- package/tests/component-api-test.ts +214 -0
- package/tests/computed-test.ts +800 -0
- package/tests/computed-variants-test.ts +298 -0
- package/tests/extend-test.ts +253 -0
- package/{src/test-language-service.ts → tests/language-service-test.ts} +3 -2
- package/{src/test-react.ts → tests/react-test.ts} +3 -3
- package/{src/test-solid.ts → tests/solid-test.ts} +3 -5
- package/tests/split-props-test.ts +590 -0
- package/tests/variants-test.ts +380 -0
- package/tsconfig.json +1 -1
- package/src/test.ts +0 -2873
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# clava
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2d99317: Removed the `defaultMode` option from `create()` and changed the default callable Clava component result to return normalized `{ class, style }` props.
|
|
8
|
+
|
|
9
|
+
Calling a component directly now always returns Clava's definition-compatible shape, with camelCase style keys. Use `.jsx`, `.html`, or `.htmlObj` when a framework- or renderer-specific prop shape is needed.
|
|
10
|
+
|
|
11
|
+
Before:
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
const { cv } = create({ defaultMode: "htmlObj" });
|
|
15
|
+
const button = cv({ style: { fontSize: "16px" } });
|
|
16
|
+
|
|
17
|
+
button();
|
|
18
|
+
// { class: "", style: { "font-size": "16px" } }
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
After:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
const { cv } = create();
|
|
25
|
+
const button = cv({ style: { fontSize: "16px" } });
|
|
26
|
+
|
|
27
|
+
button();
|
|
28
|
+
// { class: "", style: { fontSize: "16px" } }
|
|
29
|
+
|
|
30
|
+
button.htmlObj();
|
|
31
|
+
// { class: "", style: { "font-size": "16px" } }
|
|
32
|
+
```
|
|
33
|
+
|
|
3
34
|
## 0.1.19
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -18,12 +18,11 @@ interface HTMLObjProps {
|
|
|
18
18
|
class: string;
|
|
19
19
|
style: HTMLCSSProperties;
|
|
20
20
|
}
|
|
21
|
-
interface
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
htmlObj: HTMLObjProps;
|
|
21
|
+
interface StyleClassProps {
|
|
22
|
+
class: string;
|
|
23
|
+
style: StyleValue;
|
|
25
24
|
}
|
|
26
|
-
type ComponentResult = JSXProps | HTMLProps | HTMLObjProps;
|
|
25
|
+
type ComponentResult = JSXProps | HTMLProps | HTMLObjProps | StyleClassProps;
|
|
27
26
|
type AllComponentResultKeys = keyof JSXProps | keyof HTMLProps | keyof HTMLObjProps;
|
|
28
27
|
type ComponentResultValue<K extends AllComponentResultKeys> = K extends "style" ? StyleProperty : K extends "className" ? string : K extends "class" ? string : never;
|
|
29
28
|
type NullableComponentResult = { [K in AllComponentResultKeys]?: ComponentResultValue<K> | null };
|
|
@@ -58,11 +57,11 @@ interface ModalComponent<V, R extends ComponentResult> {
|
|
|
58
57
|
class: (props?: ComponentProps<V>) => string;
|
|
59
58
|
style: (props?: ComponentProps<V>) => R["style"];
|
|
60
59
|
getVariants: GetVariants<V>;
|
|
61
|
-
keys: (keyof V | keyof
|
|
60
|
+
keys: (keyof V | keyof NullableComponentResult)[];
|
|
62
61
|
variantKeys: (keyof V)[];
|
|
63
|
-
propKeys: (keyof V | keyof
|
|
62
|
+
propKeys: (keyof V | keyof NullableComponentResult)[];
|
|
64
63
|
}
|
|
65
|
-
interface CVComponent<V extends Variants = {}, CV extends ComputedVariants = {}, E extends AnyComponent[] = [], R extends ComponentResult =
|
|
64
|
+
interface CVComponent<V extends Variants = {}, CV extends ComputedVariants = {}, E extends AnyComponent[] = [], R extends ComponentResult = StyleClassProps> extends ModalComponent<MergeVariants<V, CV, E>, R> {
|
|
66
65
|
jsx: ModalComponent<MergeVariants<V, CV, E>, JSXProps>;
|
|
67
66
|
html: ModalComponent<MergeVariants<V, CV, E>, HTMLProps>;
|
|
68
67
|
htmlObj: ModalComponent<MergeVariants<V, CV, E>, HTMLObjProps>;
|
|
@@ -105,10 +104,6 @@ type ExtendedVariants<E extends AnyComponent[]> = MergeExtendedVariants<E> & Mer
|
|
|
105
104
|
type NullablePartial<T> = T extends Record<string, any> ? { [K in keyof T]?: T[K] | null } : T | null;
|
|
106
105
|
type ExtendableVariants<V extends Variants, E extends AnyComponent[]> = V & { [K in keyof ExtendedVariants<E>]?: NullablePartial<ExtendedVariants<E>[K]> | Variant$1 };
|
|
107
106
|
//#endregion
|
|
108
|
-
//#region src/utils.d.ts
|
|
109
|
-
declare const MODES: readonly ["jsx", "html", "htmlObj"];
|
|
110
|
-
type Mode = (typeof MODES)[number];
|
|
111
|
-
//#endregion
|
|
112
107
|
//#region src/index.d.ts
|
|
113
108
|
type VariantProps<T extends Pick<AnyComponent, "getVariants">> = ReturnType<T["getVariants"]>;
|
|
114
109
|
type VariantKey<T> = T extends boolean ? "true" | "false" : Extract<T, string>;
|
|
@@ -122,8 +117,7 @@ interface CVConfig<V extends Variants = {}, CV extends ComputedVariants = {}, E
|
|
|
122
117
|
defaultVariants?: VariantValues<MergeVariants<V, CV, E>>;
|
|
123
118
|
computed?: Computed<MergeVariants<V, CV, E>>;
|
|
124
119
|
}
|
|
125
|
-
interface CreateParams
|
|
126
|
-
defaultMode?: M;
|
|
120
|
+
interface CreateParams {
|
|
127
121
|
transformClass?: (className: string) => string;
|
|
128
122
|
}
|
|
129
123
|
/**
|
|
@@ -148,14 +142,13 @@ declare const splitProps: SplitPropsFunction;
|
|
|
148
142
|
/**
|
|
149
143
|
* Creates the cv and cx functions.
|
|
150
144
|
*/
|
|
151
|
-
declare function create
|
|
152
|
-
defaultMode,
|
|
145
|
+
declare function create({
|
|
153
146
|
transformClass
|
|
154
|
-
}?: CreateParams
|
|
155
|
-
cv: <V extends Variants = {}, CV extends ComputedVariants = {}, const E extends AnyComponent[] = []>(config?: CVConfig<V, CV, E>) => CVComponent<V, CV, E
|
|
147
|
+
}?: CreateParams): {
|
|
148
|
+
cv: <V extends Variants = {}, CV extends ComputedVariants = {}, const E extends AnyComponent[] = []>(config?: CVConfig<V, CV, E>) => CVComponent<V, CV, E>;
|
|
156
149
|
cx: (...classes: ClassValue$1[]) => string;
|
|
157
150
|
};
|
|
158
|
-
declare const cv: <V extends Variants = {}, CV extends ComputedVariants = {}, const E extends AnyComponent[] = []>(config?: CVConfig<V, CV, E>) => CVComponent<V, CV, E
|
|
151
|
+
declare const cv: <V extends Variants = {}, CV extends ComputedVariants = {}, const E extends AnyComponent[] = []>(config?: CVConfig<V, CV, E>) => CVComponent<V, CV, E>, cx: (...classes: ClassValue$1[]) => string;
|
|
159
152
|
//#endregion
|
|
160
|
-
export { type CVComponent, CVConfig, type ClassValue, type HTMLObjProps, type HTMLProps, type JSXProps, type StyleClassValue, type StyleValue, Variant, VariantProps, create, cv, cx, splitProps };
|
|
153
|
+
export { type CVComponent, CVConfig, type ClassValue, type HTMLObjProps, type HTMLProps, type JSXProps, type StyleClassProps, type StyleClassValue, type StyleValue, Variant, VariantProps, create, cv, cx, splitProps };
|
|
161
154
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -586,12 +586,18 @@ function createResolveDefaults(config) {
|
|
|
586
586
|
/**
|
|
587
587
|
* Creates the cv and cx functions.
|
|
588
588
|
*/
|
|
589
|
-
function create({
|
|
589
|
+
function create({ transformClass = (className) => className } = {}) {
|
|
590
590
|
const cx = (...classes) => transformClass(clsx(...classes));
|
|
591
591
|
const cv = (config = {}) => {
|
|
592
592
|
const variantKeys = collectVariantKeys(config);
|
|
593
593
|
const disabledVariantKeys = collectDisabledVariantKeys(config);
|
|
594
594
|
const disabledVariantValues = collectDisabledVariantValues(config);
|
|
595
|
+
const inputPropsKeys = [
|
|
596
|
+
"class",
|
|
597
|
+
"className",
|
|
598
|
+
"style",
|
|
599
|
+
...variantKeys
|
|
600
|
+
];
|
|
595
601
|
const getPropsKeys = (mode) => [
|
|
596
602
|
getClassPropertyName(mode),
|
|
597
603
|
"style",
|
|
@@ -631,6 +637,46 @@ function create({ defaultMode = "jsx", transformClass = (className) => className
|
|
|
631
637
|
style: allStyle
|
|
632
638
|
};
|
|
633
639
|
};
|
|
640
|
+
const getVariants = (variants) => {
|
|
641
|
+
const variantProps = variants ?? {};
|
|
642
|
+
const { updatedVariants } = runComputedFunction(config, resolveVariants(config, variantProps), variantProps);
|
|
643
|
+
return updatedVariants;
|
|
644
|
+
};
|
|
645
|
+
const extendedBaseClasses = [];
|
|
646
|
+
if (config.extend) for (const ext of config.extend) {
|
|
647
|
+
const meta = getComponentMeta(ext);
|
|
648
|
+
extendedBaseClasses.push(meta?.baseClass ?? "");
|
|
649
|
+
}
|
|
650
|
+
const baseClass = cx(...extendedBaseClasses, config.class);
|
|
651
|
+
const staticDefaults = collectStaticDefaults(config);
|
|
652
|
+
const initializeComponent = (component, propsKeys) => {
|
|
653
|
+
component.class = (props = {}) => {
|
|
654
|
+
return computeResult(props).className;
|
|
655
|
+
};
|
|
656
|
+
component.getVariants = getVariants;
|
|
657
|
+
component.keys = propsKeys;
|
|
658
|
+
component.variantKeys = variantKeys;
|
|
659
|
+
component.propKeys = propsKeys;
|
|
660
|
+
setComponentMeta(component, {
|
|
661
|
+
baseClass,
|
|
662
|
+
staticDefaults,
|
|
663
|
+
resolveDefaults: createResolveDefaults(config)
|
|
664
|
+
});
|
|
665
|
+
return component;
|
|
666
|
+
};
|
|
667
|
+
const createDefaultComponent = () => {
|
|
668
|
+
const component = ((props = {}) => {
|
|
669
|
+
const { className, style } = computeResult(props);
|
|
670
|
+
return {
|
|
671
|
+
class: className,
|
|
672
|
+
style
|
|
673
|
+
};
|
|
674
|
+
});
|
|
675
|
+
component.style = (props = {}) => {
|
|
676
|
+
return computeResult(props).style;
|
|
677
|
+
};
|
|
678
|
+
return initializeComponent(component, inputPropsKeys);
|
|
679
|
+
};
|
|
634
680
|
const createModalComponent = (mode) => {
|
|
635
681
|
const propsKeys = getPropsKeys(mode);
|
|
636
682
|
const component = ((props = {}) => {
|
|
@@ -657,27 +703,9 @@ function create({ defaultMode = "jsx", transformClass = (className) => className
|
|
|
657
703
|
if (mode === "html") return styleValueToHTMLStyle(style);
|
|
658
704
|
return styleValueToHTMLObjStyle(style);
|
|
659
705
|
};
|
|
660
|
-
component
|
|
661
|
-
const variantProps = variants ?? {};
|
|
662
|
-
const { updatedVariants } = runComputedFunction(config, resolveVariants(config, variantProps), variantProps);
|
|
663
|
-
return updatedVariants;
|
|
664
|
-
};
|
|
665
|
-
component.keys = propsKeys;
|
|
666
|
-
component.variantKeys = variantKeys;
|
|
667
|
-
component.propKeys = propsKeys;
|
|
668
|
-
const extendedBaseClasses = [];
|
|
669
|
-
if (config.extend) for (const ext of config.extend) {
|
|
670
|
-
const meta = getComponentMeta(ext);
|
|
671
|
-
extendedBaseClasses.push(meta?.baseClass ?? "");
|
|
672
|
-
}
|
|
673
|
-
setComponentMeta(component, {
|
|
674
|
-
baseClass: cx(...extendedBaseClasses, config.class),
|
|
675
|
-
staticDefaults: collectStaticDefaults(config),
|
|
676
|
-
resolveDefaults: createResolveDefaults(config)
|
|
677
|
-
});
|
|
678
|
-
return component;
|
|
706
|
+
return initializeComponent(component, propsKeys);
|
|
679
707
|
};
|
|
680
|
-
const defaultComponent =
|
|
708
|
+
const defaultComponent = createDefaultComponent();
|
|
681
709
|
const jsxComponent = createModalComponent("jsx");
|
|
682
710
|
const htmlComponent = createModalComponent("html");
|
|
683
711
|
const htmlObjComponent = createModalComponent("htmlObj");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/utils.ts","../src/index.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type {\n HTMLCSSProperties,\n JSXCSSProperties,\n StyleValue,\n} from \"./types.ts\";\n\nexport const MODES = [\"jsx\", \"html\", \"htmlObj\"] as const;\nexport type Mode = (typeof MODES)[number];\n\n/**\n * Returns the appropriate class property name based on the mode.\n * @example\n * getClassPropertyName(\"jsx\") // \"className\"\n * getClassPropertyName(\"html\") // \"class\"\n */\nexport function getClassPropertyName(mode: Mode) {\n return mode === \"jsx\" ? \"className\" : \"class\";\n}\n\n/**\n * Converts a hyphenated CSS property name to camelCase.\n * @example\n * hyphenToCamel(\"background-color\") // \"backgroundColor\"\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 (str.startsWith(\"--\")) {\n return str;\n }\n return str.replace(/-([a-z])/gi, (_, letter) => letter.toUpperCase());\n}\n\n/**\n * Converts a camelCase CSS property name to hyphenated form.\n * @example\n * camelToHyphen(\"backgroundColor\") // \"background-color\"\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 (str.startsWith(\"--\")) {\n return str;\n }\n return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n/**\n * Parses a length value, adding \"px\" if it's a number.\n * @example\n * parseLengthValue(16); // \"16px\"\n * parseLengthValue(\"2em\"); // \"2em\"\n */\nexport function parseLengthValue(value: string | number) {\n if (typeof value === \"string\") return value;\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(styleString: string) {\n if (!styleString) return {};\n\n const result: StyleValue = {};\n const declarations = styleString.split(\";\");\n\n for (const declaration of declarations) {\n const trimmed = declaration.trim();\n if (!trimmed) continue;\n\n const colonIndex = trimmed.indexOf(\":\");\n if (colonIndex === -1) continue;\n\n const property = trimmed.slice(0, colonIndex).trim();\n const value = trimmed.slice(colonIndex + 1).trim();\n if (!property) continue;\n if (!value) continue;\n\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(style: HTMLCSSProperties) {\n const result: StyleValue = {};\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string>)[hyphenToCamel(key)] =\n parseLengthValue(value);\n }\n return result;\n}\n\n/**\n * Converts a camelCase style object to a StyleValue object.\n * @example\n * jsxStyleToStyleValue({ backgroundColor: \"red\", fontSize: 16 });\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function jsxStyleToStyleValue(style: JSXCSSProperties) {\n const result: StyleValue = {};\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string>)[key] = parseLengthValue(value);\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 const parts: string[] = [];\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n parts.push(`${camelToHyphen(key)}: ${value}`);\n }\n if (!parts.length) return \"\";\n return `${parts.join(\"; \")};`;\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: CSS.PropertiesHyphen = {};\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n const property = camelToHyphen(key) as keyof HTMLCSSProperties;\n result[property] = value;\n }\n return result;\n}\n\n/**\n * Converts a StyleValue object to a camelCase style object.\n * @example\n * styleValueToJSXStyle({ backgroundColor: \"red\", fontSize: \"16px\" });\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function styleValueToJSXStyle(style: StyleValue) {\n return style as JSXCSSProperties;\n}\n\n/**\n * Type guard to check if a style object has hyphenated keys.\n * @example\n * isHTMLObjStyle({ \"background-color\": \"red\" }); // true\n * isHTMLObjStyle({ backgroundColor: \"red\" }); // false\n */\nexport function isHTMLObjStyle(\n style: CSS.Properties<any> | CSS.PropertiesHyphen<any>,\n): style is CSS.PropertiesHyphen {\n return Object.keys(style).some(\n (key) => key.includes(\"-\") && !key.startsWith(\"--\"),\n );\n}\n","import clsx, { type ClassValue as ClsxClassValue } from \"clsx\";\nimport type {\n AnyComponent,\n CVComponent,\n ClassValue,\n ComponentProps,\n ComponentResult,\n Computed,\n ComputedVariants,\n ExtendableVariants,\n HTMLObjProps,\n HTMLProps,\n JSXProps,\n MergeVariants,\n ModalComponent,\n SplitPropsFunction,\n StyleClassValue,\n StyleProps,\n StyleValue,\n VariantValues,\n Variants,\n} from \"./types.ts\";\nimport {\n type Mode,\n getClassPropertyName,\n htmlObjStyleToStyleValue,\n htmlStyleToStyleValue,\n isHTMLObjStyle,\n jsxStyleToStyleValue,\n styleValueToHTMLObjStyle,\n styleValueToHTMLStyle,\n styleValueToJSXStyle,\n} from \"./utils.ts\";\n\n// Internal metadata stored on components but hidden from public types\ninterface ComponentMeta {\n baseClass: string;\n staticDefaults: Record<string, unknown>;\n resolveDefaults: (\n childDefaults: Record<string, unknown>,\n userProps?: Record<string, unknown>,\n ) => Record<string, unknown>;\n}\n\nconst META_KEY = \"__meta\";\n\n// Symbol property used to pass skip keys through the props object without\n// polluting the actual variant values. This allows the computed function to\n// see actual variant values while still skipping styling for overridden keys.\nconst SKIP_STYLE_KEYS = Symbol(\"skipStyleKeys\");\nconst SKIP_STYLE_VARIANT_VALUES = Symbol(\"skipStyleVariantValues\");\n\n// Dynamic property access on function requires cast through unknown\nfunction getComponentMeta(component: AnyComponent): ComponentMeta | undefined {\n return (component as unknown as Record<string, unknown>)[META_KEY] as\n | ComponentMeta\n | undefined;\n}\n\nfunction setComponentMeta(component: AnyComponent, meta: ComponentMeta): void {\n (component as unknown as Record<string, unknown>)[META_KEY] = meta;\n}\n\n/**\n * Mutates target by assigning all properties from source. Avoids object spread\n * overhead in hot paths where we're building up a result object.\n */\nfunction assign<T extends object>(target: T, source: T): void {\n for (const key in source) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) continue;\n (target as Record<string, unknown>)[key] = (\n source as Record<string, unknown>\n )[key];\n }\n}\n\nexport type {\n ClassValue,\n StyleValue,\n StyleClassValue,\n JSXProps,\n HTMLProps,\n HTMLObjProps,\n CVComponent,\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\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\nexport interface CVConfig<\n V extends Variants = {},\n CV extends ComputedVariants = {},\n E extends AnyComponent[] = [],\n> {\n extend?: E;\n class?: ClassValue;\n style?: StyleValue;\n variants?: ExtendableVariants<V, E>;\n computedVariants?: CV;\n defaultVariants?: VariantValues<MergeVariants<V, CV, E>>;\n computed?: Computed<MergeVariants<V, CV, E>>;\n}\n\ninterface CreateParams<M extends Mode> {\n defaultMode?: M;\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 * Checks if a value is a style-class object (`{ style, class? }`).\n */\nfunction isStyleClassValue(value: unknown): value is StyleClassValue {\n if (!isRecordObject(value)) return false;\n return \"style\" in value || \"class\" in value;\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 if (isHTMLObjStyle(style as Record<string, unknown>)) {\n return htmlObjStyleToStyleValue(style as Record<string, string | number>);\n }\n return jsxStyleToStyleValue(style as Record<string, string | number>);\n }\n return {};\n}\n\n/**\n * Extracts class and style from a style-class value object.\n */\nfunction extractStyleClass(value: StyleClassValue): {\n class: ClassValue;\n style: StyleValue;\n} {\n return { class: value.class, style: normalizeStyle(value.style) };\n}\n\n/**\n * Extracts class and style from a variant value (either a class value or a\n * style-class object).\n */\nfunction extractClassAndStyle(value: unknown): {\n class: ClassValue;\n style: StyleValue;\n} {\n if (isStyleClassValue(value)) {\n return extractStyleClass(value);\n }\n if (isRecordObject(value)) {\n return { class: null, style: {} };\n }\n return { class: value as ClassValue, style: {} };\n}\n\n/**\n * Gets all variant keys from a component's config, including extended\n * components.\n */\nfunction collectVariantKeys(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): string[] {\n const keys = new Set<string>();\n\n // Collect from extended components\n if (config.extend) {\n for (const ext of config.extend) {\n for (const key of ext.variantKeys) {\n keys.add(key as string);\n }\n }\n }\n\n // Collect from variants\n if (config.variants) {\n for (const [key, variant] of Object.entries(config.variants)) {\n if (variant === null) {\n keys.delete(key);\n continue;\n }\n keys.add(key);\n }\n }\n\n // Collect from computedVariants\n if (config.computedVariants) {\n for (const key of Object.keys(config.computedVariants)) {\n keys.add(key);\n }\n }\n\n return Array.from(keys);\n}\n\nfunction isVariantDisabled(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n key: string,\n): boolean {\n return config.variants?.[key] === null;\n}\n\nfunction getVariantValueKey(value: unknown): string | undefined {\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\") return String(value);\n if (typeof value === \"boolean\") return String(value);\n return undefined;\n}\n\nfunction isVariantValueDisabled(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n key: string,\n value: unknown,\n): boolean {\n const valueKey = getVariantValueKey(value);\n if (valueKey == null) return false;\n const variant = config.variants?.[key];\n if (!isRecordObject(variant)) return false;\n return variant[valueKey] === null;\n}\n\nfunction filterDisabledVariants(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n variants: Record<string, unknown>,\n): Record<string, unknown> {\n const filtered: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(variants)) {\n if (isVariantDisabled(config, key)) continue;\n if (isVariantValueDisabled(config, key, value)) continue;\n filtered[key] = value;\n }\n return filtered;\n}\n\nfunction collectDisabledVariantKeys(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): Set<string> {\n const keys = new Set<string>();\n if (!config.variants) return keys;\n for (const [key, value] of Object.entries(config.variants)) {\n if (value === null) {\n keys.add(key);\n }\n }\n return keys;\n}\n\nfunction collectDisabledVariantValues(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): Record<string, Set<string>> {\n const values: Record<string, Set<string>> = {};\n if (!config.variants) return values;\n for (const [key, variant] of Object.entries(config.variants)) {\n if (!isRecordObject(variant)) continue;\n for (const [variantValue, variantEntry] of Object.entries(variant)) {\n if (variantEntry !== null) continue;\n if (!values[key]) {\n values[key] = new Set<string>();\n }\n values[key].add(variantValue);\n }\n }\n return values;\n}\n\nfunction mergeDisabledVariantValues(\n base: Record<string, Set<string>>,\n override: Record<string, Set<string>>,\n): Record<string, Set<string>> {\n const merged: Record<string, Set<string>> = {};\n for (const [key, values] of Object.entries(base)) {\n merged[key] = new Set(values);\n }\n for (const [key, values] of Object.entries(override)) {\n if (!merged[key]) {\n merged[key] = new Set<string>();\n }\n for (const value of values) {\n merged[key].add(value);\n }\n }\n return merged;\n}\n\n/**\n * Collects static default variants from extended components and the current\n * config. Also handles implicit boolean defaults (when only `false` key\n * exists). This does NOT trigger computed functions - use collectDefaultVariants\n * for that.\n */\nfunction collectStaticDefaults(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): Record<string, unknown> {\n const defaults: Record<string, unknown> = {};\n\n // Collect static defaults from extended components (via metadata to avoid\n // triggering computed functions)\n if (config.extend) {\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n if (meta) {\n Object.assign(defaults, meta.staticDefaults);\n }\n }\n }\n\n // Handle implicit boolean defaults from variants\n // If a variant has a `false` key, default to false when no value is provided\n if (config.variants) {\n for (const [variantName, variantDef] of Object.entries(config.variants)) {\n if (!isRecordObject(variantDef)) continue;\n const keys = Object.keys(variantDef);\n const hasFalse = keys.includes(\"false\");\n if (hasFalse && !defaults[variantName]) {\n defaults[variantName] = false;\n }\n }\n }\n\n // Override with current config's static defaults\n if (config.defaultVariants) {\n Object.assign(defaults, config.defaultVariants);\n }\n\n return filterDisabledVariants(config, defaults);\n}\n\n/**\n * Collects default variants from extended components and the current config.\n * This includes both static defaults and computed defaults (from\n * setDefaultVariants in extended components' computed functions). Priority:\n * parent static < child static < parent computed < child computed.\n */\nfunction collectDefaultVariants(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n propsVariants: Record<string, unknown> = {},\n): Record<string, unknown> {\n // Start with static defaults (parent static < child static)\n const defaults = collectStaticDefaults(config);\n\n // Apply computed defaults from extended components\n // Parent's setDefaultVariants should override child's static defaults\n if (!config.extend) return defaults;\n\n // Pass full static defaults (not just this config's defaultVariants)\n // so that intermediate components' defaults are visible to ancestors\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n if (!meta) continue;\n Object.assign(defaults, meta.resolveDefaults(defaults, propsVariants));\n }\n\n return filterDisabledVariants(config, defaults);\n}\n\n/**\n * Filters out keys with undefined values from an object.\n */\nfunction filterUndefined(\n obj: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value === undefined) continue;\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Resolves variant values by merging defaults with provided props. Props with\n * undefined values are filtered out so they don't override defaults.\n */\nfunction resolveVariants(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n props: Record<string, unknown> = {},\n): Record<string, unknown> {\n const defaults = collectDefaultVariants(config, props);\n return filterDisabledVariants(config, {\n ...defaults,\n ...filterUndefined(props),\n });\n}\n\n/**\n * Gets the value for a single variant based on the variant definition and the\n * selected value.\n */\nfunction getVariantResult(\n variantDef: unknown,\n selectedValue: unknown,\n): { class: ClassValue; style: StyleValue } {\n // Shorthand variant: `disabled: \"disabled-class\"` means { true: \"...\" }\n if (!isRecordObject(variantDef)) {\n if (selectedValue === true) {\n return extractClassAndStyle(variantDef);\n }\n return { class: null, style: {} };\n }\n\n // Object variant: { sm: \"...\", lg: \"...\" }\n const key = String(selectedValue);\n const value = variantDef[key];\n if (value === undefined) return { class: null, style: {} };\n\n return extractClassAndStyle(value);\n}\n\n/**\n * Extracts classes from fullClass that are not in baseClass. Uses string\n * comparison optimization: if fullClass starts with baseClass, just take the\n * suffix.\n */\nfunction extractVariantClasses(fullClass: string, baseClass: string): string {\n if (!fullClass) return \"\";\n if (!baseClass) return fullClass;\n\n // Fast path: fullClass starts with baseClass (common case)\n if (fullClass.startsWith(baseClass)) {\n return fullClass.slice(baseClass.length).trim();\n }\n\n // Slow path: need to diff the class sets\n const baseClassSet = new Set(baseClass.split(\" \").filter(Boolean));\n return fullClass\n .split(\" \")\n .filter((c) => c && !baseClassSet.has(c))\n .join(\" \");\n}\n\nfunction computeExtendedStyles(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n resolvedVariants: Record<string, unknown>,\n overrideVariantKeys: Set<string> = new Set(),\n overrideVariantValues: Record<string, Set<string>> = {},\n): {\n baseClasses: ClassValue[];\n variantClasses: ClassValue[];\n style: StyleValue;\n} {\n const baseClasses: ClassValue[] = [];\n const variantClasses: ClassValue[] = [];\n const style: StyleValue = {};\n\n if (!config.extend) return { baseClasses, variantClasses, style };\n const hasOverrideVariantKeys = overrideVariantKeys.size > 0;\n const hasOverrideVariantValues =\n Object.keys(overrideVariantValues).length > 0;\n\n for (const ext of config.extend) {\n // Pass actual variant values but mark which keys should skip styling.\n // Using a Symbol property keeps variant values clean for computed functions\n // while still allowing us to skip styling for overridden keys.\n const propsForExt: Record<string | symbol, unknown> = {\n ...resolvedVariants,\n };\n if (hasOverrideVariantKeys) {\n propsForExt[SKIP_STYLE_KEYS] = overrideVariantKeys;\n }\n if (hasOverrideVariantValues) {\n propsForExt[SKIP_STYLE_VARIANT_VALUES] = overrideVariantValues;\n }\n\n const extResult = ext(\n propsForExt as ComponentProps<Record<string, unknown>>,\n );\n assign(style, normalizeStyle(extResult.style));\n\n // Get base class from internal metadata (no variants)\n const meta = getComponentMeta(ext);\n const baseClass = meta?.baseClass ?? \"\";\n baseClasses.push(baseClass);\n\n // Get full class with variants\n const fullClass =\n \"className\" in extResult ? extResult.className : extResult.class;\n\n const variantPortion = extractVariantClasses(fullClass, baseClass);\n if (variantPortion) {\n variantClasses.push(variantPortion);\n }\n }\n\n return { baseClasses, variantClasses, style };\n}\n\n/**\n * Computes class and style from the component's own variants and\n * computedVariants (not extended components).\n */\nfunction computeVariantStyles(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n resolvedVariants: Record<string | symbol, unknown>,\n skipStyleKeys: Set<string> = new Set(),\n skipVariantValues: Record<string, Set<string>> = {},\n): { classes: ClassValue[]; style: StyleValue } {\n const classes: ClassValue[] = [];\n const style: StyleValue = {};\n\n // Process current component's variants\n if (config.variants) {\n for (const [variantName, variantDef] of Object.entries(config.variants)) {\n // Skip styling for variants that are overridden by child's computedVariants\n if (skipStyleKeys.has(variantName)) continue;\n\n const selectedValue = resolvedVariants[variantName];\n if (selectedValue === undefined) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n if (selectedKey && skipVariantValues[variantName]?.has(selectedKey)) {\n continue;\n }\n\n const result = getVariantResult(variantDef, selectedValue);\n classes.push(result.class);\n assign(style, result.style);\n }\n }\n\n // Process computedVariants\n if (config.computedVariants) {\n for (const [variantName, computeFn] of Object.entries(\n config.computedVariants,\n )) {\n // Skip styling for variants that are overridden by child's computedVariants\n if (skipStyleKeys.has(variantName)) continue;\n\n const selectedValue = resolvedVariants[variantName];\n if (selectedValue === undefined) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n if (selectedKey && skipVariantValues[variantName]?.has(selectedKey)) {\n continue;\n }\n\n const computedResult = computeFn(selectedValue);\n const result = extractClassAndStyle(computedResult);\n classes.push(result.class);\n assign(style, result.style);\n }\n }\n\n return { classes, style };\n}\n\n/**\n * Runs the computed function if present, returning classes, styles, and updated\n * variants.\n */\nfunction runComputedFunction(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n resolvedVariants: Record<string, unknown>,\n propsVariants: Record<string, unknown>,\n): {\n classes: ClassValue[];\n style: StyleValue;\n updatedVariants: Record<string, unknown>;\n} {\n const classes: ClassValue[] = [];\n const style: StyleValue = {};\n const updatedVariants = { ...resolvedVariants };\n\n if (!config.computed) {\n return { classes, style, updatedVariants };\n }\n\n const context = {\n variants: resolvedVariants,\n setVariants: (newVariants: VariantValues<Record<string, unknown>>) => {\n Object.assign(\n updatedVariants,\n filterDisabledVariants(config, newVariants),\n );\n },\n setDefaultVariants: (\n newDefaults: VariantValues<Record<string, unknown>>,\n ) => {\n // Only apply defaults for variants not explicitly set in props\n for (const [key, value] of Object.entries(newDefaults)) {\n if (propsVariants[key] === undefined) {\n if (isVariantDisabled(config, key)) continue;\n if (isVariantValueDisabled(config, key, value)) continue;\n updatedVariants[key] = value;\n }\n }\n },\n addClass: (className: ClassValue) => {\n classes.push(className);\n },\n addStyle: (newStyle: StyleValue) => {\n assign(style, newStyle);\n },\n };\n\n const computedResult = config.computed(context);\n if (computedResult != null) {\n const result = extractClassAndStyle(computedResult);\n classes.push(result.class);\n assign(style, result.style);\n }\n\n return {\n classes,\n style,\n updatedVariants: filterDisabledVariants(config, updatedVariants),\n };\n}\n\ninterface NormalizedSource {\n keys: string[];\n variantKeys: string[];\n defaults: Record<string, unknown>;\n isComponent: boolean;\n}\n\nconst EMPTY_SOURCE: NormalizedSource = {\n keys: [],\n variantKeys: [],\n defaults: {},\n isComponent: false,\n};\n\n/**\n * Normalizes a key source (array or component) to an object with keys,\n * variantKeys, defaults, and isComponent flag.\n */\nfunction normalizeKeySource(source: unknown): NormalizedSource {\n if (Array.isArray(source)) {\n return {\n keys: source as string[],\n variantKeys: source as string[],\n defaults: {},\n isComponent: false,\n };\n }\n\n if (!source) return EMPTY_SOURCE;\n if (typeof source !== \"object\" && typeof source !== \"function\") {\n return EMPTY_SOURCE;\n }\n if (!(\"keys\" in source)) return EMPTY_SOURCE;\n if (!(\"variantKeys\" in source)) return EMPTY_SOURCE;\n\n // Source is a component with keys and variantKeys properties\n const typed = source as {\n keys: string[];\n variantKeys: string[];\n getVariants?: () => Record<string, unknown>;\n };\n return {\n keys: [...typed.keys],\n variantKeys: [...typed.variantKeys],\n defaults: typed.getVariants?.() ?? {},\n isComponent: true,\n };\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: string[],\n selfIsComponent: boolean,\n props: Record<string, unknown>,\n sources: NormalizedSource[],\n): Record<string, unknown>[] {\n const allUsedKeys = new Set<string>(selfKeys);\n const results: Record<string, unknown>[] = [];\n\n // Track if styling has been claimed by a component\n let stylingClaimed = selfIsComponent;\n\n // Self result\n const selfResult: Record<string, unknown> = {};\n for (const key of selfKeys) {\n if (key in props) {\n selfResult[key] = props[key];\n }\n }\n results.push(selfResult);\n\n // Process each source\n for (const source of sources) {\n const sourceResult: Record<string, unknown> = {};\n\n // Determine which keys this source should use\n // Components use variantKeys if styling has already been claimed\n // Arrays always use their listed keys\n const effectiveKeys =\n source.isComponent && stylingClaimed ? source.variantKeys : source.keys;\n\n for (const key of effectiveKeys) {\n allUsedKeys.add(key);\n if (key in props) {\n sourceResult[key] = props[key];\n }\n }\n results.push(sourceResult);\n\n // If this is a component that hasn't claimed styling yet, mark styling as claimed\n if (source.isComponent && !stylingClaimed) {\n stylingClaimed = true;\n }\n }\n\n // Rest - keys not used by anyone\n const rest: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n if (!allUsedKeys.has(key)) {\n rest[key] = value;\n }\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 * @example\n * ```ts\n * const [buttonProps, inputProps, rest] = splitProps(\n * props,\n * buttonComponent,\n * inputComponent,\n * );\n * // buttonProps has class/style + button variants\n * // inputProps has only input variants (no class/style)\n * ```\n */\nexport const splitProps: SplitPropsFunction = ((\n props: Record<string, unknown>,\n source1: unknown,\n ...sources: unknown[]\n) => {\n const normalizedSource1 = normalizeKeySource(source1);\n const normalizedSources = sources.map(normalizeKeySource);\n return splitPropsImpl(\n normalizedSource1.keys,\n normalizedSource1.isComponent,\n props,\n normalizedSources,\n );\n}) as SplitPropsFunction;\n\n/**\n * Creates the resolveDefaults function for a component. This function returns\n * only the variants set via setDefaultVariants in the computed function. Used\n * by child components to get parent's computed defaults.\n */\nfunction createResolveDefaults(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): ComponentMeta[\"resolveDefaults\"] {\n return (childDefaults, userProps = {}) => {\n // Get static defaults (including from extended components)\n const staticDefaults = collectStaticDefaults(config);\n\n // Merge: parent static < child static < user props\n // This is what parent's computed will see in `variants`\n const resolvedVariants = {\n ...staticDefaults,\n ...filterUndefined(childDefaults),\n ...filterUndefined(userProps),\n };\n\n // Track which keys are set via setDefaultVariants\n const computedDefaults: Record<string, unknown> = {};\n\n // Propagate to extended components so their computed functions can run\n // This allows grandparent computed functions to see grandchild defaults\n if (config.extend) {\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n if (!meta) continue;\n Object.assign(\n computedDefaults,\n meta.resolveDefaults(childDefaults, userProps),\n );\n }\n }\n\n if (config.computed) {\n config.computed({\n variants: resolvedVariants as VariantValues<Record<string, unknown>>,\n setVariants: () => {\n // Not relevant for collecting defaults\n },\n setDefaultVariants: (newDefaults) => {\n // Only apply defaults for variants not explicitly set by user\n // (child's static defaults should not block setDefaultVariants)\n for (const [key, value] of Object.entries(newDefaults)) {\n if (userProps[key] !== undefined) continue;\n if (isVariantDisabled(config, key)) continue;\n if (isVariantValueDisabled(config, key, value)) continue;\n computedDefaults[key] = value;\n }\n },\n addClass: () => {\n // Not relevant for collecting defaults\n },\n addStyle: () => {\n // Not relevant for collecting defaults\n },\n });\n }\n\n return computedDefaults;\n };\n}\n\n/**\n * Creates the cv and cx functions.\n */\nexport function create<M extends Mode = \"jsx\">({\n defaultMode = \"jsx\" as M,\n transformClass = (className) => className,\n}: CreateParams<M> = {}) {\n const cx = (...classes: ClsxClassValue[]) => transformClass(clsx(...classes));\n\n const cv = <\n V extends Variants = {},\n CV extends ComputedVariants = {},\n const E extends AnyComponent[] = [],\n >(\n config: CVConfig<V, CV, E> = {},\n ): CVComponent<V, CV, E, StyleProps[M]> => {\n type MergedVariants = MergeVariants<V, CV, E>;\n\n const variantKeys = collectVariantKeys(config);\n const disabledVariantKeys = collectDisabledVariantKeys(config);\n const disabledVariantValues = collectDisabledVariantValues(config);\n\n const getPropsKeys = (mode: Mode) => [\n getClassPropertyName(mode),\n \"style\",\n ...variantKeys,\n ];\n\n const computeResult = (\n props: ComponentProps<MergedVariants> = {},\n ): { className: string; style: StyleValue } => {\n const allClasses: ClassValue[] = [];\n const allStyle: StyleValue = {};\n\n // Extract skip style keys from props (set by child's computedVariants)\n const skipStyleKeys =\n ((props as Record<symbol, unknown>)[SKIP_STYLE_KEYS] as\n | Set<string>\n | undefined) ?? new Set<string>();\n const skipStyleVariantValues =\n ((props as Record<symbol, unknown>)[SKIP_STYLE_VARIANT_VALUES] as\n | Record<string, Set<string>>\n | undefined) ?? {};\n\n // Extract variant props from input\n const variantProps: Record<string, unknown> = {};\n for (const key of variantKeys) {\n if (key in props) {\n variantProps[key] = props[key];\n }\n }\n // Resolve variants with defaults\n let resolvedVariants = resolveVariants(config, variantProps);\n // Process computed first to potentially update variants\n const computedResult = runComputedFunction(\n config,\n resolvedVariants,\n variantProps,\n );\n resolvedVariants = computedResult.updatedVariants;\n\n // Collect computedVariants keys that will override extended variants.\n // Combine with incoming skip keys to propagate through the extend chain.\n const currentVariantKeys = new Set<string>(skipStyleKeys);\n for (const key of disabledVariantKeys) {\n currentVariantKeys.add(key);\n }\n const computedVariantKeys = new Set<string>(currentVariantKeys);\n if (config.computedVariants) {\n for (const key of Object.keys(config.computedVariants)) {\n computedVariantKeys.add(key);\n }\n }\n const computedVariantValues = mergeDisabledVariantValues(\n skipStyleVariantValues,\n disabledVariantValues,\n );\n\n // Process extended components (separates base and variant classes)\n const extendedResult = computeExtendedStyles(\n config,\n resolvedVariants,\n computedVariantKeys,\n computedVariantValues,\n );\n\n // 1. Extended base classes first\n allClasses.push(...extendedResult.baseClasses);\n assign(allStyle, extendedResult.style);\n\n // 2. Current component's base class\n allClasses.push(config.class);\n\n // 3. Add base style\n if (config.style) {\n assign(allStyle, config.style);\n }\n\n // 4. Extended variant classes\n allClasses.push(...extendedResult.variantClasses);\n\n // 5. Current component's variants (skip keys that are overridden)\n const variantsResult = computeVariantStyles(\n config,\n resolvedVariants,\n currentVariantKeys,\n computedVariantValues,\n );\n allClasses.push(...variantsResult.classes);\n assign(allStyle, variantsResult.style);\n\n // Add computed results\n allClasses.push(...computedResult.classes);\n assign(allStyle, computedResult.style);\n\n // Merge class from props\n if (\"class\" in props) {\n allClasses.push(props.class);\n }\n if (\"className\" in props) {\n allClasses.push(props.className);\n }\n\n // Merge style from props\n if (props.style != null) {\n assign(allStyle, normalizeStyle(props.style));\n }\n\n return {\n className: cx(...(allClasses as ClsxClassValue[])),\n style: allStyle,\n };\n };\n\n const createModalComponent = <R extends ComponentResult>(\n mode: Mode,\n ): ModalComponent<MergedVariants, R> => {\n const propsKeys = getPropsKeys(mode);\n\n const component = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n\n if (mode === \"jsx\") {\n return { className, style: styleValueToJSXStyle(style) };\n }\n if (mode === \"html\") {\n return { class: className, style: styleValueToHTMLStyle(style) };\n }\n // htmlObj\n return { class: className, style: styleValueToHTMLObjStyle(style) };\n }) as ModalComponent<MergedVariants, R>;\n\n component.class = (props: ComponentProps<MergedVariants> = {}) => {\n return computeResult(props).className;\n };\n\n component.style = (props: ComponentProps<MergedVariants> = {}) => {\n const { style } = computeResult(props);\n if (mode === \"jsx\") return styleValueToJSXStyle(style);\n if (mode === \"html\") return styleValueToHTMLStyle(style);\n return styleValueToHTMLObjStyle(style);\n };\n\n component.getVariants = (variants?: VariantValues<MergedVariants>) => {\n const variantProps = variants ?? {};\n const resolvedVariants = resolveVariants(config, variantProps);\n // Run computed function to get variants set via setVariants and\n // setDefaultVariants\n const { updatedVariants } = runComputedFunction(\n config,\n resolvedVariants,\n variantProps,\n );\n return updatedVariants as VariantValues<MergedVariants>;\n };\n\n component.keys = propsKeys;\n component.variantKeys = variantKeys;\n component.propKeys = propsKeys;\n\n // Compute base class (without variants) - includes extended base classes\n const extendedBaseClasses: ClassValue[] = [];\n if (config.extend) {\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n extendedBaseClasses.push(meta?.baseClass ?? \"\");\n }\n }\n const baseClass = cx(\n ...(extendedBaseClasses as ClsxClassValue[]),\n config.class as ClsxClassValue,\n );\n\n // Compute static defaults once at creation time (without triggering\n // computed functions)\n const staticDefaults = collectStaticDefaults(config);\n\n // Store internal metadata hidden from public types\n setComponentMeta(component, {\n baseClass,\n staticDefaults,\n resolveDefaults: createResolveDefaults(config),\n });\n\n return component;\n };\n\n // Create the default modal component\n const defaultComponent = createModalComponent<StyleProps[M]>(defaultMode);\n\n // Create all modal variants\n const jsxComponent = createModalComponent<JSXProps>(\"jsx\");\n const htmlComponent = createModalComponent<HTMLProps>(\"html\");\n const htmlObjComponent = createModalComponent<HTMLObjProps>(\"htmlObj\");\n\n // Build the final component\n const component = defaultComponent as CVComponent<V, CV, E, StyleProps[M]>;\n component.jsx = jsxComponent;\n component.html = htmlComponent;\n component.htmlObj = htmlObjComponent;\n\n return component;\n };\n\n return { cv, cx };\n}\n\nexport const { cv, cx } = create();\n"],"mappings":";;;;;;;;AAgBA,SAAgB,qBAAqB,MAAY;AAC/C,QAAO,SAAS,QAAQ,cAAc;;;;;;;;AASxC,SAAgB,cAAc,KAAa;AAEzC,KAAI,IAAI,WAAW,KAAK,CACtB,QAAO;AAET,QAAO,IAAI,QAAQ,eAAe,GAAG,WAAW,OAAO,aAAa,CAAC;;;;;;;;AASvE,SAAgB,cAAc,KAAa;AAEzC,KAAI,IAAI,WAAW,KAAK,CACtB,QAAO;AAET,QAAO,IAAI,QAAQ,WAAW,WAAW,IAAI,OAAO,aAAa,GAAG;;;;;;;;AAStE,SAAgB,iBAAiB,OAAwB;AACvD,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAO,GAAG,MAAM;;;;;;;;AASlB,SAAgB,sBAAsB,aAAqB;AACzD,KAAI,CAAC,YAAa,QAAO,EAAE;CAE3B,MAAM,SAAqB,EAAE;CAC7B,MAAM,eAAe,YAAY,MAAM,IA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,aAAU,WAAW;GAGrB,MAAM,sBAAoC,EAAE;AAC5C,OAAI,OAAO,OACT,MAAK,MAAM,OAAO,OAAO,QAAQ;IAC/B,MAAM,OAAO,iBAAiB,IAAI;AAClC,wBAAoB,KAAK,MAAM,aAAa,GAAG;;AAanD,oBAAiB,WAAW;IAC1B,WAXgB,GAChB,GAAI,qBACJ,OAAO,MACR;IASC,gBALqB,sBAAsB,OAAO;IAMlD,iBAAiB,sBAAsB,OAAO;IAC/C,CAAC;AAEF,UAAO;;EAIT,MAAM,mBAAmB,qBAAoC,YAAY;EAGzE,MAAM,eAAe,qBAA+B,MAAM;EAC1D,MAAM,gBAAgB,qBAAgC,OAAO;EAC7D,MAAM,mBAAmB,qBAAmC,UAAU;EAGtE,MAAM,YAAY;AAClB,YAAU,MAAM;AAChB,YAAU,OAAO;AACjB,YAAU,UAAU;AAEpB,SAAO;;AAGT,QAAO;EAAE;EAAI;EAAI;;AAGnB,MAAa,EAAE,IAAI,OAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/utils.ts","../src/index.ts"],"sourcesContent":["import type * as CSS from \"csstype\";\nimport type {\n HTMLCSSProperties,\n JSXCSSProperties,\n StyleValue,\n} from \"./types.ts\";\n\nexport const MODES = [\"jsx\", \"html\", \"htmlObj\"] as const;\nexport type Mode = (typeof MODES)[number];\n\n/**\n * Returns the appropriate class property name based on the mode.\n * @example\n * getClassPropertyName(\"jsx\") // \"className\"\n * getClassPropertyName(\"html\") // \"class\"\n */\nexport function getClassPropertyName(mode: Mode) {\n return mode === \"jsx\" ? \"className\" : \"class\";\n}\n\n/**\n * Converts a hyphenated CSS property name to camelCase.\n * @example\n * hyphenToCamel(\"background-color\") // \"backgroundColor\"\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 (str.startsWith(\"--\")) {\n return str;\n }\n return str.replace(/-([a-z])/gi, (_, letter) => letter.toUpperCase());\n}\n\n/**\n * Converts a camelCase CSS property name to hyphenated form.\n * @example\n * camelToHyphen(\"backgroundColor\") // \"background-color\"\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 (str.startsWith(\"--\")) {\n return str;\n }\n return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n}\n\n/**\n * Parses a length value, adding \"px\" if it's a number.\n * @example\n * parseLengthValue(16); // \"16px\"\n * parseLengthValue(\"2em\"); // \"2em\"\n */\nexport function parseLengthValue(value: string | number) {\n if (typeof value === \"string\") return value;\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(styleString: string) {\n if (!styleString) return {};\n\n const result: StyleValue = {};\n const declarations = styleString.split(\";\");\n\n for (const declaration of declarations) {\n const trimmed = declaration.trim();\n if (!trimmed) continue;\n\n const colonIndex = trimmed.indexOf(\":\");\n if (colonIndex === -1) continue;\n\n const property = trimmed.slice(0, colonIndex).trim();\n const value = trimmed.slice(colonIndex + 1).trim();\n if (!property) continue;\n if (!value) continue;\n\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(style: HTMLCSSProperties) {\n const result: StyleValue = {};\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string>)[hyphenToCamel(key)] =\n parseLengthValue(value);\n }\n return result;\n}\n\n/**\n * Converts a camelCase style object to a StyleValue object.\n * @example\n * jsxStyleToStyleValue({ backgroundColor: \"red\", fontSize: 16 });\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function jsxStyleToStyleValue(style: JSXCSSProperties) {\n const result: StyleValue = {};\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n // CSS property names and values are dynamic - cast required for index access\n (result as Record<string, string>)[key] = parseLengthValue(value);\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 const parts: string[] = [];\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n parts.push(`${camelToHyphen(key)}: ${value}`);\n }\n if (!parts.length) return \"\";\n return `${parts.join(\"; \")};`;\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: CSS.PropertiesHyphen = {};\n for (const [key, value] of Object.entries(style)) {\n if (value == null) continue;\n const property = camelToHyphen(key) as keyof HTMLCSSProperties;\n result[property] = value;\n }\n return result;\n}\n\n/**\n * Converts a StyleValue object to a camelCase style object.\n * @example\n * styleValueToJSXStyle({ backgroundColor: \"red\", fontSize: \"16px\" });\n * // { backgroundColor: \"red\", fontSize: \"16px\" }\n */\nexport function styleValueToJSXStyle(style: StyleValue) {\n return style as JSXCSSProperties;\n}\n\n/**\n * Type guard to check if a style object has hyphenated keys.\n * @example\n * isHTMLObjStyle({ \"background-color\": \"red\" }); // true\n * isHTMLObjStyle({ backgroundColor: \"red\" }); // false\n */\nexport function isHTMLObjStyle(\n style: CSS.Properties<any> | CSS.PropertiesHyphen<any>,\n): style is CSS.PropertiesHyphen {\n return Object.keys(style).some(\n (key) => key.includes(\"-\") && !key.startsWith(\"--\"),\n );\n}\n","import clsx, { type ClassValue as ClsxClassValue } from \"clsx\";\nimport type {\n AnyComponent,\n CVComponent,\n ClassValue,\n ComponentProps,\n ComponentResult,\n Computed,\n ComputedVariants,\n ExtendableVariants,\n HTMLObjProps,\n HTMLProps,\n JSXProps,\n MergeVariants,\n ModalComponent,\n SplitPropsFunction,\n StyleClassProps,\n StyleClassValue,\n StyleValue,\n VariantValues,\n Variants,\n} from \"./types.ts\";\nimport {\n type Mode,\n getClassPropertyName,\n htmlObjStyleToStyleValue,\n htmlStyleToStyleValue,\n isHTMLObjStyle,\n jsxStyleToStyleValue,\n styleValueToHTMLObjStyle,\n styleValueToHTMLStyle,\n styleValueToJSXStyle,\n} from \"./utils.ts\";\n\n// Internal metadata stored on components but hidden from public types\ninterface ComponentMeta {\n baseClass: string;\n staticDefaults: Record<string, unknown>;\n resolveDefaults: (\n childDefaults: Record<string, unknown>,\n userProps?: Record<string, unknown>,\n ) => Record<string, unknown>;\n}\n\nconst META_KEY = \"__meta\";\n\n// Symbol property used to pass skip keys through the props object without\n// polluting the actual variant values. This allows the computed function to\n// see actual variant values while still skipping styling for overridden keys.\nconst SKIP_STYLE_KEYS = Symbol(\"skipStyleKeys\");\nconst SKIP_STYLE_VARIANT_VALUES = Symbol(\"skipStyleVariantValues\");\n\n// Dynamic property access on function requires cast through unknown\nfunction getComponentMeta(component: AnyComponent): ComponentMeta | undefined {\n return (component as unknown as Record<string, unknown>)[META_KEY] as\n | ComponentMeta\n | undefined;\n}\n\nfunction setComponentMeta(component: AnyComponent, meta: ComponentMeta): void {\n (component as unknown as Record<string, unknown>)[META_KEY] = meta;\n}\n\n/**\n * Mutates target by assigning all properties from source. Avoids object spread\n * overhead in hot paths where we're building up a result object.\n */\nfunction assign<T extends object>(target: T, source: T): void {\n for (const key in source) {\n if (!Object.prototype.hasOwnProperty.call(source, key)) continue;\n (target as Record<string, unknown>)[key] = (\n source as Record<string, unknown>\n )[key];\n }\n}\n\nexport type {\n ClassValue,\n StyleValue,\n StyleClassProps,\n StyleClassValue,\n JSXProps,\n HTMLProps,\n HTMLObjProps,\n CVComponent,\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\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\nexport interface CVConfig<\n V extends Variants = {},\n CV extends ComputedVariants = {},\n E extends AnyComponent[] = [],\n> {\n extend?: E;\n class?: ClassValue;\n style?: StyleValue;\n variants?: ExtendableVariants<V, E>;\n computedVariants?: CV;\n defaultVariants?: VariantValues<MergeVariants<V, CV, E>>;\n computed?: Computed<MergeVariants<V, CV, 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 * Checks if a value is a style-class object (`{ style, class? }`).\n */\nfunction isStyleClassValue(value: unknown): value is StyleClassValue {\n if (!isRecordObject(value)) return false;\n return \"style\" in value || \"class\" in value;\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 if (isHTMLObjStyle(style as Record<string, unknown>)) {\n return htmlObjStyleToStyleValue(style as Record<string, string | number>);\n }\n return jsxStyleToStyleValue(style as Record<string, string | number>);\n }\n return {};\n}\n\n/**\n * Extracts class and style from a style-class value object.\n */\nfunction extractStyleClass(value: StyleClassValue): {\n class: ClassValue;\n style: StyleValue;\n} {\n return { class: value.class, style: normalizeStyle(value.style) };\n}\n\n/**\n * Extracts class and style from a variant value (either a class value or a\n * style-class object).\n */\nfunction extractClassAndStyle(value: unknown): {\n class: ClassValue;\n style: StyleValue;\n} {\n if (isStyleClassValue(value)) {\n return extractStyleClass(value);\n }\n if (isRecordObject(value)) {\n return { class: null, style: {} };\n }\n return { class: value as ClassValue, style: {} };\n}\n\n/**\n * Gets all variant keys from a component's config, including extended\n * components.\n */\nfunction collectVariantKeys(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): string[] {\n const keys = new Set<string>();\n\n // Collect from extended components\n if (config.extend) {\n for (const ext of config.extend) {\n for (const key of ext.variantKeys) {\n keys.add(key as string);\n }\n }\n }\n\n // Collect from variants\n if (config.variants) {\n for (const [key, variant] of Object.entries(config.variants)) {\n if (variant === null) {\n keys.delete(key);\n continue;\n }\n keys.add(key);\n }\n }\n\n // Collect from computedVariants\n if (config.computedVariants) {\n for (const key of Object.keys(config.computedVariants)) {\n keys.add(key);\n }\n }\n\n return Array.from(keys);\n}\n\nfunction isVariantDisabled(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n key: string,\n): boolean {\n return config.variants?.[key] === null;\n}\n\nfunction getVariantValueKey(value: unknown): string | undefined {\n if (typeof value === \"string\") return value;\n if (typeof value === \"number\") return String(value);\n if (typeof value === \"boolean\") return String(value);\n return undefined;\n}\n\nfunction isVariantValueDisabled(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n key: string,\n value: unknown,\n): boolean {\n const valueKey = getVariantValueKey(value);\n if (valueKey == null) return false;\n const variant = config.variants?.[key];\n if (!isRecordObject(variant)) return false;\n return variant[valueKey] === null;\n}\n\nfunction filterDisabledVariants(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n variants: Record<string, unknown>,\n): Record<string, unknown> {\n const filtered: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(variants)) {\n if (isVariantDisabled(config, key)) continue;\n if (isVariantValueDisabled(config, key, value)) continue;\n filtered[key] = value;\n }\n return filtered;\n}\n\nfunction collectDisabledVariantKeys(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): Set<string> {\n const keys = new Set<string>();\n if (!config.variants) return keys;\n for (const [key, value] of Object.entries(config.variants)) {\n if (value === null) {\n keys.add(key);\n }\n }\n return keys;\n}\n\nfunction collectDisabledVariantValues(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): Record<string, Set<string>> {\n const values: Record<string, Set<string>> = {};\n if (!config.variants) return values;\n for (const [key, variant] of Object.entries(config.variants)) {\n if (!isRecordObject(variant)) continue;\n for (const [variantValue, variantEntry] of Object.entries(variant)) {\n if (variantEntry !== null) continue;\n if (!values[key]) {\n values[key] = new Set<string>();\n }\n values[key].add(variantValue);\n }\n }\n return values;\n}\n\nfunction mergeDisabledVariantValues(\n base: Record<string, Set<string>>,\n override: Record<string, Set<string>>,\n): Record<string, Set<string>> {\n const merged: Record<string, Set<string>> = {};\n for (const [key, values] of Object.entries(base)) {\n merged[key] = new Set(values);\n }\n for (const [key, values] of Object.entries(override)) {\n if (!merged[key]) {\n merged[key] = new Set<string>();\n }\n for (const value of values) {\n merged[key].add(value);\n }\n }\n return merged;\n}\n\n/**\n * Collects static default variants from extended components and the current\n * config. Also handles implicit boolean defaults (when only `false` key\n * exists). This does NOT trigger computed functions - use collectDefaultVariants\n * for that.\n */\nfunction collectStaticDefaults(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): Record<string, unknown> {\n const defaults: Record<string, unknown> = {};\n\n // Collect static defaults from extended components (via metadata to avoid\n // triggering computed functions)\n if (config.extend) {\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n if (meta) {\n Object.assign(defaults, meta.staticDefaults);\n }\n }\n }\n\n // Handle implicit boolean defaults from variants\n // If a variant has a `false` key, default to false when no value is provided\n if (config.variants) {\n for (const [variantName, variantDef] of Object.entries(config.variants)) {\n if (!isRecordObject(variantDef)) continue;\n const keys = Object.keys(variantDef);\n const hasFalse = keys.includes(\"false\");\n if (hasFalse && !defaults[variantName]) {\n defaults[variantName] = false;\n }\n }\n }\n\n // Override with current config's static defaults\n if (config.defaultVariants) {\n Object.assign(defaults, config.defaultVariants);\n }\n\n return filterDisabledVariants(config, defaults);\n}\n\n/**\n * Collects default variants from extended components and the current config.\n * This includes both static defaults and computed defaults (from\n * setDefaultVariants in extended components' computed functions). Priority:\n * parent static < child static < parent computed < child computed.\n */\nfunction collectDefaultVariants(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n propsVariants: Record<string, unknown> = {},\n): Record<string, unknown> {\n // Start with static defaults (parent static < child static)\n const defaults = collectStaticDefaults(config);\n\n // Apply computed defaults from extended components\n // Parent's setDefaultVariants should override child's static defaults\n if (!config.extend) return defaults;\n\n // Pass full static defaults (not just this config's defaultVariants)\n // so that intermediate components' defaults are visible to ancestors\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n if (!meta) continue;\n Object.assign(defaults, meta.resolveDefaults(defaults, propsVariants));\n }\n\n return filterDisabledVariants(config, defaults);\n}\n\n/**\n * Filters out keys with undefined values from an object.\n */\nfunction filterUndefined(\n obj: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value === undefined) continue;\n result[key] = value;\n }\n return result;\n}\n\n/**\n * Resolves variant values by merging defaults with provided props. Props with\n * undefined values are filtered out so they don't override defaults.\n */\nfunction resolveVariants(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n props: Record<string, unknown> = {},\n): Record<string, unknown> {\n const defaults = collectDefaultVariants(config, props);\n return filterDisabledVariants(config, {\n ...defaults,\n ...filterUndefined(props),\n });\n}\n\n/**\n * Gets the value for a single variant based on the variant definition and the\n * selected value.\n */\nfunction getVariantResult(\n variantDef: unknown,\n selectedValue: unknown,\n): { class: ClassValue; style: StyleValue } {\n // Shorthand variant: `disabled: \"disabled-class\"` means { true: \"...\" }\n if (!isRecordObject(variantDef)) {\n if (selectedValue === true) {\n return extractClassAndStyle(variantDef);\n }\n return { class: null, style: {} };\n }\n\n // Object variant: { sm: \"...\", lg: \"...\" }\n const key = String(selectedValue);\n const value = variantDef[key];\n if (value === undefined) return { class: null, style: {} };\n\n return extractClassAndStyle(value);\n}\n\n/**\n * Extracts classes from fullClass that are not in baseClass. Uses string\n * comparison optimization: if fullClass starts with baseClass, just take the\n * suffix.\n */\nfunction extractVariantClasses(fullClass: string, baseClass: string): string {\n if (!fullClass) return \"\";\n if (!baseClass) return fullClass;\n\n // Fast path: fullClass starts with baseClass (common case)\n if (fullClass.startsWith(baseClass)) {\n return fullClass.slice(baseClass.length).trim();\n }\n\n // Slow path: need to diff the class sets\n const baseClassSet = new Set(baseClass.split(\" \").filter(Boolean));\n return fullClass\n .split(\" \")\n .filter((c) => c && !baseClassSet.has(c))\n .join(\" \");\n}\n\nfunction computeExtendedStyles(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n resolvedVariants: Record<string, unknown>,\n overrideVariantKeys: Set<string> = new Set(),\n overrideVariantValues: Record<string, Set<string>> = {},\n): {\n baseClasses: ClassValue[];\n variantClasses: ClassValue[];\n style: StyleValue;\n} {\n const baseClasses: ClassValue[] = [];\n const variantClasses: ClassValue[] = [];\n const style: StyleValue = {};\n\n if (!config.extend) return { baseClasses, variantClasses, style };\n const hasOverrideVariantKeys = overrideVariantKeys.size > 0;\n const hasOverrideVariantValues =\n Object.keys(overrideVariantValues).length > 0;\n\n for (const ext of config.extend) {\n // Pass actual variant values but mark which keys should skip styling.\n // Using a Symbol property keeps variant values clean for computed functions\n // while still allowing us to skip styling for overridden keys.\n const propsForExt: Record<string | symbol, unknown> = {\n ...resolvedVariants,\n };\n if (hasOverrideVariantKeys) {\n propsForExt[SKIP_STYLE_KEYS] = overrideVariantKeys;\n }\n if (hasOverrideVariantValues) {\n propsForExt[SKIP_STYLE_VARIANT_VALUES] = overrideVariantValues;\n }\n\n const extResult = ext(\n propsForExt as ComponentProps<Record<string, unknown>>,\n );\n assign(style, normalizeStyle(extResult.style));\n\n // Get base class from internal metadata (no variants)\n const meta = getComponentMeta(ext);\n const baseClass = meta?.baseClass ?? \"\";\n baseClasses.push(baseClass);\n\n // Get full class with variants\n const fullClass =\n \"className\" in extResult ? extResult.className : extResult.class;\n\n const variantPortion = extractVariantClasses(fullClass, baseClass);\n if (variantPortion) {\n variantClasses.push(variantPortion);\n }\n }\n\n return { baseClasses, variantClasses, style };\n}\n\n/**\n * Computes class and style from the component's own variants and\n * computedVariants (not extended components).\n */\nfunction computeVariantStyles(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n resolvedVariants: Record<string | symbol, unknown>,\n skipStyleKeys: Set<string> = new Set(),\n skipVariantValues: Record<string, Set<string>> = {},\n): { classes: ClassValue[]; style: StyleValue } {\n const classes: ClassValue[] = [];\n const style: StyleValue = {};\n\n // Process current component's variants\n if (config.variants) {\n for (const [variantName, variantDef] of Object.entries(config.variants)) {\n // Skip styling for variants that are overridden by child's computedVariants\n if (skipStyleKeys.has(variantName)) continue;\n\n const selectedValue = resolvedVariants[variantName];\n if (selectedValue === undefined) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n if (selectedKey && skipVariantValues[variantName]?.has(selectedKey)) {\n continue;\n }\n\n const result = getVariantResult(variantDef, selectedValue);\n classes.push(result.class);\n assign(style, result.style);\n }\n }\n\n // Process computedVariants\n if (config.computedVariants) {\n for (const [variantName, computeFn] of Object.entries(\n config.computedVariants,\n )) {\n // Skip styling for variants that are overridden by child's computedVariants\n if (skipStyleKeys.has(variantName)) continue;\n\n const selectedValue = resolvedVariants[variantName];\n if (selectedValue === undefined) continue;\n const selectedKey = getVariantValueKey(selectedValue);\n if (selectedKey && skipVariantValues[variantName]?.has(selectedKey)) {\n continue;\n }\n\n const computedResult = computeFn(selectedValue);\n const result = extractClassAndStyle(computedResult);\n classes.push(result.class);\n assign(style, result.style);\n }\n }\n\n return { classes, style };\n}\n\n/**\n * Runs the computed function if present, returning classes, styles, and updated\n * variants.\n */\nfunction runComputedFunction(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n resolvedVariants: Record<string, unknown>,\n propsVariants: Record<string, unknown>,\n): {\n classes: ClassValue[];\n style: StyleValue;\n updatedVariants: Record<string, unknown>;\n} {\n const classes: ClassValue[] = [];\n const style: StyleValue = {};\n const updatedVariants = { ...resolvedVariants };\n\n if (!config.computed) {\n return { classes, style, updatedVariants };\n }\n\n const context = {\n variants: resolvedVariants,\n setVariants: (newVariants: VariantValues<Record<string, unknown>>) => {\n Object.assign(\n updatedVariants,\n filterDisabledVariants(config, newVariants),\n );\n },\n setDefaultVariants: (\n newDefaults: VariantValues<Record<string, unknown>>,\n ) => {\n // Only apply defaults for variants not explicitly set in props\n for (const [key, value] of Object.entries(newDefaults)) {\n if (propsVariants[key] === undefined) {\n if (isVariantDisabled(config, key)) continue;\n if (isVariantValueDisabled(config, key, value)) continue;\n updatedVariants[key] = value;\n }\n }\n },\n addClass: (className: ClassValue) => {\n classes.push(className);\n },\n addStyle: (newStyle: StyleValue) => {\n assign(style, newStyle);\n },\n };\n\n const computedResult = config.computed(context);\n if (computedResult != null) {\n const result = extractClassAndStyle(computedResult);\n classes.push(result.class);\n assign(style, result.style);\n }\n\n return {\n classes,\n style,\n updatedVariants: filterDisabledVariants(config, updatedVariants),\n };\n}\n\ninterface NormalizedSource {\n keys: string[];\n variantKeys: string[];\n defaults: Record<string, unknown>;\n isComponent: boolean;\n}\n\nconst EMPTY_SOURCE: NormalizedSource = {\n keys: [],\n variantKeys: [],\n defaults: {},\n isComponent: false,\n};\n\n/**\n * Normalizes a key source (array or component) to an object with keys,\n * variantKeys, defaults, and isComponent flag.\n */\nfunction normalizeKeySource(source: unknown): NormalizedSource {\n if (Array.isArray(source)) {\n return {\n keys: source as string[],\n variantKeys: source as string[],\n defaults: {},\n isComponent: false,\n };\n }\n\n if (!source) return EMPTY_SOURCE;\n if (typeof source !== \"object\" && typeof source !== \"function\") {\n return EMPTY_SOURCE;\n }\n if (!(\"keys\" in source)) return EMPTY_SOURCE;\n if (!(\"variantKeys\" in source)) return EMPTY_SOURCE;\n\n // Source is a component with keys and variantKeys properties\n const typed = source as {\n keys: string[];\n variantKeys: string[];\n getVariants?: () => Record<string, unknown>;\n };\n return {\n keys: [...typed.keys],\n variantKeys: [...typed.variantKeys],\n defaults: typed.getVariants?.() ?? {},\n isComponent: true,\n };\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: string[],\n selfIsComponent: boolean,\n props: Record<string, unknown>,\n sources: NormalizedSource[],\n): Record<string, unknown>[] {\n const allUsedKeys = new Set<string>(selfKeys);\n const results: Record<string, unknown>[] = [];\n\n // Track if styling has been claimed by a component\n let stylingClaimed = selfIsComponent;\n\n // Self result\n const selfResult: Record<string, unknown> = {};\n for (const key of selfKeys) {\n if (key in props) {\n selfResult[key] = props[key];\n }\n }\n results.push(selfResult);\n\n // Process each source\n for (const source of sources) {\n const sourceResult: Record<string, unknown> = {};\n\n // Determine which keys this source should use\n // Components use variantKeys if styling has already been claimed\n // Arrays always use their listed keys\n const effectiveKeys =\n source.isComponent && stylingClaimed ? source.variantKeys : source.keys;\n\n for (const key of effectiveKeys) {\n allUsedKeys.add(key);\n if (key in props) {\n sourceResult[key] = props[key];\n }\n }\n results.push(sourceResult);\n\n // If this is a component that hasn't claimed styling yet, mark styling as claimed\n if (source.isComponent && !stylingClaimed) {\n stylingClaimed = true;\n }\n }\n\n // Rest - keys not used by anyone\n const rest: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(props)) {\n if (!allUsedKeys.has(key)) {\n rest[key] = value;\n }\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 * @example\n * ```ts\n * const [buttonProps, inputProps, rest] = splitProps(\n * props,\n * buttonComponent,\n * inputComponent,\n * );\n * // buttonProps has class/style + button variants\n * // inputProps has only input variants (no class/style)\n * ```\n */\nexport const splitProps: SplitPropsFunction = ((\n props: Record<string, unknown>,\n source1: unknown,\n ...sources: unknown[]\n) => {\n const normalizedSource1 = normalizeKeySource(source1);\n const normalizedSources = sources.map(normalizeKeySource);\n return splitPropsImpl(\n normalizedSource1.keys,\n normalizedSource1.isComponent,\n props,\n normalizedSources,\n );\n}) as SplitPropsFunction;\n\n/**\n * Creates the resolveDefaults function for a component. This function returns\n * only the variants set via setDefaultVariants in the computed function. Used\n * by child components to get parent's computed defaults.\n */\nfunction createResolveDefaults(\n config: CVConfig<Variants, ComputedVariants, AnyComponent[]>,\n): ComponentMeta[\"resolveDefaults\"] {\n return (childDefaults, userProps = {}) => {\n // Get static defaults (including from extended components)\n const staticDefaults = collectStaticDefaults(config);\n\n // Merge: parent static < child static < user props\n // This is what parent's computed will see in `variants`\n const resolvedVariants = {\n ...staticDefaults,\n ...filterUndefined(childDefaults),\n ...filterUndefined(userProps),\n };\n\n // Track which keys are set via setDefaultVariants\n const computedDefaults: Record<string, unknown> = {};\n\n // Propagate to extended components so their computed functions can run\n // This allows grandparent computed functions to see grandchild defaults\n if (config.extend) {\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n if (!meta) continue;\n Object.assign(\n computedDefaults,\n meta.resolveDefaults(childDefaults, userProps),\n );\n }\n }\n\n if (config.computed) {\n config.computed({\n variants: resolvedVariants as VariantValues<Record<string, unknown>>,\n setVariants: () => {\n // Not relevant for collecting defaults\n },\n setDefaultVariants: (newDefaults) => {\n // Only apply defaults for variants not explicitly set by user\n // (child's static defaults should not block setDefaultVariants)\n for (const [key, value] of Object.entries(newDefaults)) {\n if (userProps[key] !== undefined) continue;\n if (isVariantDisabled(config, key)) continue;\n if (isVariantValueDisabled(config, key, value)) continue;\n computedDefaults[key] = value;\n }\n },\n addClass: () => {\n // Not relevant for collecting defaults\n },\n addStyle: () => {\n // Not relevant for collecting defaults\n },\n });\n }\n\n return computedDefaults;\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 = <\n V extends Variants = {},\n CV extends ComputedVariants = {},\n const E extends AnyComponent[] = [],\n >(\n config: CVConfig<V, CV, E> = {},\n ): CVComponent<V, CV, E> => {\n type MergedVariants = MergeVariants<V, CV, E>;\n\n const variantKeys = collectVariantKeys(config);\n const disabledVariantKeys = collectDisabledVariantKeys(config);\n const disabledVariantValues = collectDisabledVariantValues(config);\n const inputPropsKeys = [\"class\", \"className\", \"style\", ...variantKeys];\n\n const getPropsKeys = (mode: Mode) => [\n getClassPropertyName(mode),\n \"style\",\n ...variantKeys,\n ];\n\n const computeResult = (\n props: ComponentProps<MergedVariants> = {},\n ): { className: string; style: StyleValue } => {\n const allClasses: ClassValue[] = [];\n const allStyle: StyleValue = {};\n\n // Extract skip style keys from props (set by child's computedVariants)\n const skipStyleKeys =\n ((props as Record<symbol, unknown>)[SKIP_STYLE_KEYS] as\n | Set<string>\n | undefined) ?? new Set<string>();\n const skipStyleVariantValues =\n ((props as Record<symbol, unknown>)[SKIP_STYLE_VARIANT_VALUES] as\n | Record<string, Set<string>>\n | undefined) ?? {};\n\n // Extract variant props from input\n const variantProps: Record<string, unknown> = {};\n for (const key of variantKeys) {\n if (key in props) {\n variantProps[key] = props[key];\n }\n }\n // Resolve variants with defaults\n let resolvedVariants = resolveVariants(config, variantProps);\n // Process computed first to potentially update variants\n const computedResult = runComputedFunction(\n config,\n resolvedVariants,\n variantProps,\n );\n resolvedVariants = computedResult.updatedVariants;\n\n // Collect computedVariants keys that will override extended variants.\n // Combine with incoming skip keys to propagate through the extend chain.\n const currentVariantKeys = new Set<string>(skipStyleKeys);\n for (const key of disabledVariantKeys) {\n currentVariantKeys.add(key);\n }\n const computedVariantKeys = new Set<string>(currentVariantKeys);\n if (config.computedVariants) {\n for (const key of Object.keys(config.computedVariants)) {\n computedVariantKeys.add(key);\n }\n }\n const computedVariantValues = mergeDisabledVariantValues(\n skipStyleVariantValues,\n disabledVariantValues,\n );\n\n // Process extended components (separates base and variant classes)\n const extendedResult = computeExtendedStyles(\n config,\n resolvedVariants,\n computedVariantKeys,\n computedVariantValues,\n );\n\n // 1. Extended base classes first\n allClasses.push(...extendedResult.baseClasses);\n assign(allStyle, extendedResult.style);\n\n // 2. Current component's base class\n allClasses.push(config.class);\n\n // 3. Add base style\n if (config.style) {\n assign(allStyle, config.style);\n }\n\n // 4. Extended variant classes\n allClasses.push(...extendedResult.variantClasses);\n\n // 5. Current component's variants (skip keys that are overridden)\n const variantsResult = computeVariantStyles(\n config,\n resolvedVariants,\n currentVariantKeys,\n computedVariantValues,\n );\n allClasses.push(...variantsResult.classes);\n assign(allStyle, variantsResult.style);\n\n // Add computed results\n allClasses.push(...computedResult.classes);\n assign(allStyle, computedResult.style);\n\n // Merge class from props\n if (\"class\" in props) {\n allClasses.push(props.class);\n }\n if (\"className\" in props) {\n allClasses.push(props.className);\n }\n\n // Merge style from props\n if (props.style != null) {\n assign(allStyle, normalizeStyle(props.style));\n }\n\n return {\n className: cx(...(allClasses as ClsxClassValue[])),\n style: allStyle,\n };\n };\n\n const getVariants = (variants?: VariantValues<MergedVariants>) => {\n const variantProps = variants ?? {};\n const resolvedVariants = resolveVariants(config, variantProps);\n // Run computed function to get variants set via setVariants and\n // setDefaultVariants\n const { updatedVariants } = runComputedFunction(\n config,\n resolvedVariants,\n variantProps,\n );\n return updatedVariants as VariantValues<MergedVariants>;\n };\n\n // Compute base class (without variants) - includes extended base classes\n const extendedBaseClasses: ClassValue[] = [];\n if (config.extend) {\n for (const ext of config.extend) {\n const meta = getComponentMeta(ext);\n extendedBaseClasses.push(meta?.baseClass ?? \"\");\n }\n }\n const baseClass = cx(\n ...(extendedBaseClasses as ClsxClassValue[]),\n config.class as ClsxClassValue,\n );\n\n // Compute static defaults once at creation time (without triggering\n // computed functions)\n const staticDefaults = collectStaticDefaults(config);\n\n const initializeComponent = <\n R extends ComponentResult,\n T extends ModalComponent<MergedVariants, R>,\n >(\n component: T,\n propsKeys: string[],\n ): T => {\n component.class = (props: ComponentProps<MergedVariants> = {}) => {\n return computeResult(props).className;\n };\n\n component.getVariants = getVariants;\n component.keys = propsKeys;\n component.variantKeys = variantKeys;\n component.propKeys = propsKeys;\n\n // Store internal metadata hidden from public types\n setComponentMeta(component, {\n baseClass,\n staticDefaults,\n resolveDefaults: createResolveDefaults(config),\n });\n\n return component;\n };\n\n const createDefaultComponent = (): CVComponent<V, CV, E> => {\n const component = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n return { class: className, style };\n }) as CVComponent<V, CV, E>;\n\n component.style = (props: ComponentProps<MergedVariants> = {}) => {\n return computeResult(props).style;\n };\n\n return initializeComponent(component, inputPropsKeys);\n };\n\n const createModalComponent = <R extends ComponentResult>(\n mode: Mode,\n ): ModalComponent<MergedVariants, R> => {\n const propsKeys = getPropsKeys(mode);\n\n const component = ((props: ComponentProps<MergedVariants> = {}) => {\n const { className, style } = computeResult(props);\n\n if (mode === \"jsx\") {\n return { className, style: styleValueToJSXStyle(style) };\n }\n if (mode === \"html\") {\n return { class: className, style: styleValueToHTMLStyle(style) };\n }\n // htmlObj\n return { class: className, style: styleValueToHTMLObjStyle(style) };\n }) as ModalComponent<MergedVariants, R>;\n\n component.class = (props: ComponentProps<MergedVariants> = {}) => {\n return computeResult(props).className;\n };\n\n component.style = (props: ComponentProps<MergedVariants> = {}) => {\n const { style } = computeResult(props);\n if (mode === \"jsx\") return styleValueToJSXStyle(style);\n if (mode === \"html\") return styleValueToHTMLStyle(style);\n return styleValueToHTMLObjStyle(style);\n };\n return initializeComponent(component, propsKeys);\n };\n\n const defaultComponent = createDefaultComponent();\n\n // Create all modal variants\n const jsxComponent = createModalComponent<JSXProps>(\"jsx\");\n const htmlComponent = createModalComponent<HTMLProps>(\"html\");\n const htmlObjComponent = createModalComponent<HTMLObjProps>(\"htmlObj\");\n\n // Build the final component\n const component = defaultComponent;\n component.jsx = jsxComponent;\n component.html = htmlComponent;\n component.htmlObj = htmlObjComponent;\n\n return component;\n };\n\n return { cv, cx };\n}\n\nexport const { cv, cx } = create();\n"],"mappings":";;;;;;;;AAgBA,SAAgB,qBAAqB,MAAY;AAC/C,QAAO,SAAS,QAAQ,cAAc;;;;;;;;AASxC,SAAgB,cAAc,KAAa;AAEzC,KAAI,IAAI,WAAW,KAAK,CACtB,QAAO;AAET,QAAO,IAAI,QAAQ,eAAe,GAAG,WAAW,OAAO,aAAa,CAAC;;;;;;;;AASvE,SAAgB,cAAc,KAAa;AAEzC,KAAI,IAAI,WAAW,KAAK,CACtB,QAAO;AAET,QAAO,IAAI,QAAQ,WAAW,WAAW,IAAI,OAAO,aAAa,GAAG;;;;;;;;AAStE,SAAgB,iBAAiB,OAAwB;AACvD,KAAI,OAAO,UAAU,SAAU,QAAO;AACtC,QAAO,GAAG,MAAM;;;;;;;;AASlB,SAAgB,sBAAsB,aAAqB;AACzD,KAAI,CAAC,YAAa,QAAO,EAAE;CAE3B,MAAM,SAAqB,EAAE;CAC7B,MAAM,eAAe,YAAY,MAAM,IAAI;AAE3C,MAAK,MAAM,eAAe,cAAc;EACtC,MAAM,UAAU,YAAY,MAAM;AAClC,MAAI,CAAC,QAAS;EAEd,MAAM,aAAa,QAAQ,QAAQ,IAAI;AACvC,MAAI,eAAe,GAAI;EAEvB,MAAM,WAAW,QAAQ,MAAM,GAAG,WAAW,CAAC,MAAM;EACpD,MAAM,QAAQ,QAAQ,MAAM,aAAa,EAAE,CAAC,MAAM;AAClD,MAAI,CAAC,SAAU;AACf,MAAI,CAAC,MAAO;A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