@yaredfall/class-variants 0.7.0 → 0.7.1
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/build/cn.d.ts +9 -6
- package/build/cn.js +9 -2
- package/build/cv.d.ts +45 -3
- package/build/cv.js +64 -2
- package/build/define.d.ts +13 -12
- package/build/define.js +20 -2
- package/build/extend.d.ts +21 -19
- package/build/extend.js +29 -2
- package/build/index.d.ts +8 -5
- package/build/index.js +4 -2
- package/build/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.ts +6 -0
- package/build/node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/array-or-single/index.d.ts +4 -0
- package/build/node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/merge/index.d.ts +6 -0
- package/build/node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/opaque/index.d.ts +9 -0
- package/build/node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/prettify/index.d.ts +4 -0
- package/build/std.d.ts +7 -9
- package/build/std.js +7 -2
- package/build/tokens.d.ts +19 -3
- package/build/tokens.js +19 -2
- package/build/utils.d.ts +19 -3
- package/build/utils.js +40 -2
- package/build/vue.d.ts +7 -8
- package/build/vue.js +7 -2
- package/package.json +7 -8
- package/build/chunk-5EH72RDS.js +0 -2
- package/build/chunk-5EH72RDS.js.map +0 -1
- package/build/chunk-C577IOC7.js +0 -2
- package/build/chunk-C577IOC7.js.map +0 -1
- package/build/chunk-CRH3RFJH.js +0 -2
- package/build/chunk-CRH3RFJH.js.map +0 -1
- package/build/chunk-N3ZCNVFV.js +0 -2
- package/build/chunk-N3ZCNVFV.js.map +0 -1
- package/build/chunk-O5WYIZI3.js +0 -2
- package/build/chunk-O5WYIZI3.js.map +0 -1
- package/build/chunk-QZQFLP4L.js +0 -2
- package/build/chunk-QZQFLP4L.js.map +0 -1
- package/build/cn.js.map +0 -1
- package/build/cv-zY1EPoUz.d.ts +0 -90
- package/build/cv.js.map +0 -1
- package/build/define.js.map +0 -1
- package/build/extend.js.map +0 -1
- package/build/index.js.map +0 -1
- package/build/std.js.map +0 -1
- package/build/tokens.js.map +0 -1
- package/build/utils.js.map +0 -1
- package/build/vue.js.map +0 -1
package/build/cn.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { ClassValue } from
|
|
1
|
+
import { ClassValue } from "./node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.js";
|
|
2
2
|
|
|
3
|
+
//#region src/cn.d.ts
|
|
3
4
|
interface CNOptions {
|
|
4
|
-
|
|
5
|
+
merge?: (className: string) => string;
|
|
5
6
|
}
|
|
6
7
|
interface CN {
|
|
7
|
-
|
|
8
|
+
(...inputs: ClassValue[]): string;
|
|
8
9
|
}
|
|
9
|
-
declare function _cn({
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
declare function _cn({
|
|
11
|
+
merge
|
|
12
|
+
}: CNOptions): CN;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CN, CNOptions, _cn };
|
package/build/cn.js
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
|
|
3
|
+
//#region src/cn.ts
|
|
4
|
+
function _cn({ merge = (className) => className }) {
|
|
5
|
+
return (...inputs) => merge(clsx(...inputs));
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { _cn };
|
package/build/cv.d.ts
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
1
|
+
import { ClassValue } from "./node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.js";
|
|
2
|
+
import { CN } from "./cn.js";
|
|
3
|
+
import { ArrayOrSingle } from "./node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/array-or-single/index.js";
|
|
4
|
+
import { CVToken } from "./tokens.js";
|
|
5
|
+
import { CVUtils } from "./utils.js";
|
|
6
|
+
|
|
7
|
+
//#region src/cv.d.ts
|
|
8
|
+
type VariantProps<CVR extends (props?: any) => string> = CVR extends CVReturn<infer _V> ? CVR["$inferProps"] : never;
|
|
9
|
+
type BooleanStringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
10
|
+
type VariantKey = string | number;
|
|
11
|
+
type Variant = Record<VariantKey, ClassValue>;
|
|
12
|
+
type VariantsSchema = Record<string, Variant>;
|
|
13
|
+
type EmptySchema = Record<never, never>;
|
|
14
|
+
type CVVariant<V extends VariantsSchema = EmptySchema> = { [K in keyof V]?: BooleanStringToBoolean<keyof V[K] & VariantKey> };
|
|
15
|
+
type CVCompoundVariant<V extends VariantsSchema = EmptySchema> = { [K in keyof V]?: ArrayOrSingle<BooleanStringToBoolean<keyof V[K] & VariantKey>> | CVToken } & {
|
|
16
|
+
class: ClassValue;
|
|
17
|
+
};
|
|
18
|
+
type CompoundVariantsSchema<V extends VariantsSchema = EmptySchema> = CVCompoundVariant<V>[];
|
|
19
|
+
type CompoundVariantsSchemaFunction<V extends VariantsSchema = EmptySchema> = (utils: CVUtils<V>) => CompoundVariantsSchema<V>;
|
|
20
|
+
interface CVConfig<V extends VariantsSchema = EmptySchema> {
|
|
21
|
+
base: ClassValue;
|
|
22
|
+
variants: V;
|
|
23
|
+
compoundVariants: CompoundVariantsSchema<V> | CompoundVariantsSchemaFunction<V>;
|
|
24
|
+
defaultVariants: CVVariant<V>;
|
|
25
|
+
}
|
|
26
|
+
interface ResolvedCVConfig<V extends VariantsSchema = EmptySchema> extends CVConfig<V> {
|
|
27
|
+
compoundVariants: CompoundVariantsSchema<V>;
|
|
28
|
+
}
|
|
29
|
+
interface CVReturn<V extends VariantsSchema = EmptySchema> extends CVUtils<V> {
|
|
30
|
+
(props?: CVVariant<V>, ...classNames: ClassValue[]): string;
|
|
31
|
+
config: ResolvedCVConfig<V>;
|
|
32
|
+
$inferProps: CVVariant<V>;
|
|
33
|
+
}
|
|
34
|
+
interface CV {
|
|
35
|
+
<V extends VariantsSchema = EmptySchema>(config: Partial<CVConfig<V>>): CVReturn<V>;
|
|
36
|
+
}
|
|
37
|
+
interface CVOptions {
|
|
38
|
+
cn: CN;
|
|
39
|
+
}
|
|
40
|
+
declare function _cv(options: CVOptions): CV;
|
|
41
|
+
type CVPropsValue = VariantKey | boolean | undefined;
|
|
42
|
+
declare function resolveConfig<V extends VariantsSchema = EmptySchema>(config: Partial<CVConfig<V>>): [ResolvedCVConfig<V>, CVUtils<V>];
|
|
43
|
+
declare function resolveCompoundVariants<V extends VariantsSchema = EmptySchema>(compoundVariants: CVConfig<V>["compoundVariants"], utils: CVUtils<V>): CompoundVariantsSchema<V>;
|
|
44
|
+
//#endregion
|
|
45
|
+
export { BooleanStringToBoolean, CV, CVCompoundVariant, CVConfig, CVPropsValue, CVReturn, CVVariant, CompoundVariantsSchema, CompoundVariantsSchemaFunction, ResolvedCVConfig, Variant, VariantKey, VariantProps, VariantsSchema, _cv, resolveCompoundVariants, resolveConfig };
|
package/build/cv.js
CHANGED
|
@@ -1,2 +1,64 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { isCVToken, shouldApplySelectorByToken } from "./tokens.js";
|
|
2
|
+
import { cvUtils } from "./utils.js";
|
|
3
|
+
|
|
4
|
+
//#region src/cv.ts
|
|
5
|
+
function _cv(options) {
|
|
6
|
+
return (config) => {
|
|
7
|
+
const [resolvedConfig, utils] = resolveConfig(config);
|
|
8
|
+
const { base, variants, compoundVariants, defaultVariants } = resolvedConfig;
|
|
9
|
+
const getVariantsClassNames = (props) => {
|
|
10
|
+
const defaultedProps = utils.getVariantProps(props);
|
|
11
|
+
const classNames = new Array();
|
|
12
|
+
for (const key in variants) {
|
|
13
|
+
const variant = defaultedProps[key]?.toString();
|
|
14
|
+
if (variant) classNames.push(variants?.[key]?.[variant]);
|
|
15
|
+
}
|
|
16
|
+
return classNames;
|
|
17
|
+
};
|
|
18
|
+
const getCompoundVariantsClassNames = (props) => {
|
|
19
|
+
return compoundVariants?.reduce((acc, compoundVariant) => {
|
|
20
|
+
if (shouldApplyCompoundVariant(props, compoundVariant, defaultVariants)) acc.push(compoundVariant.class);
|
|
21
|
+
return acc;
|
|
22
|
+
}, new Array());
|
|
23
|
+
};
|
|
24
|
+
const getVariant = (props, ...classNames) => {
|
|
25
|
+
const variantClassNames = getVariantsClassNames(props);
|
|
26
|
+
const compoundVariantClassNames = getCompoundVariantsClassNames(props);
|
|
27
|
+
return options.cn(base, variantClassNames, compoundVariantClassNames, ...classNames);
|
|
28
|
+
};
|
|
29
|
+
return Object.assign(Object.assign(getVariant, utils), {
|
|
30
|
+
config: resolvedConfig,
|
|
31
|
+
$inferProps: void 0
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function shouldApplyCompoundVariant(props, matcher, defaults) {
|
|
36
|
+
return Object.keys(matcher).every((cvKey) => {
|
|
37
|
+
if (cvKey === "class") return true;
|
|
38
|
+
const cvSelector = matcher[cvKey];
|
|
39
|
+
const defaultsSelector = defaults?.[cvKey];
|
|
40
|
+
const propsSelector = props?.[cvKey];
|
|
41
|
+
if (isCVToken(cvSelector)) return shouldApplySelectorByToken(cvSelector, propsSelector);
|
|
42
|
+
const selector = propsSelector ?? defaultsSelector;
|
|
43
|
+
return Array.isArray(cvSelector) ? cvSelector.some((cvSelector$1) => compareSelectors(selector, cvSelector$1)) : compareSelectors(selector, cvSelector);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function compareSelectors(selector1, selector2) {
|
|
47
|
+
return selector1?.toString() === selector2?.toString();
|
|
48
|
+
}
|
|
49
|
+
function resolveConfig(config) {
|
|
50
|
+
const defaultedConfig = {
|
|
51
|
+
variants: {},
|
|
52
|
+
compoundVariants: [],
|
|
53
|
+
defaultVariants: {},
|
|
54
|
+
...config
|
|
55
|
+
};
|
|
56
|
+
const utils = cvUtils(defaultedConfig);
|
|
57
|
+
return [Object.assign(defaultedConfig, { compoundVariants: resolveCompoundVariants(defaultedConfig.compoundVariants, utils) }), utils];
|
|
58
|
+
}
|
|
59
|
+
function resolveCompoundVariants(compoundVariants, utils) {
|
|
60
|
+
return typeof compoundVariants === "function" ? compoundVariants(utils) : compoundVariants;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { _cv, resolveCompoundVariants, resolveConfig };
|
package/build/define.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { CVExtend } from
|
|
4
|
-
import 'clsx';
|
|
1
|
+
import { CN, CNOptions } from "./cn.js";
|
|
2
|
+
import { CV } from "./cv.js";
|
|
3
|
+
import { CVExtend } from "./extend.js";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare function defineCV({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
//#region src/define.d.ts
|
|
6
|
+
interface DefineCVOptions extends CNOptions {}
|
|
7
|
+
declare function defineCV({
|
|
8
|
+
merge
|
|
9
|
+
}?: DefineCVOptions): {
|
|
10
|
+
readonly cn: CN;
|
|
11
|
+
readonly cv: CV;
|
|
12
|
+
readonly extend: CVExtend;
|
|
12
13
|
};
|
|
13
|
-
|
|
14
|
-
export {
|
|
14
|
+
//#endregion
|
|
15
|
+
export { DefineCVOptions, defineCV };
|
package/build/define.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { _cn } from "./cn.js";
|
|
2
|
+
import { _cv } from "./cv.js";
|
|
3
|
+
import { _extend } from "./extend.js";
|
|
4
|
+
|
|
5
|
+
//#region src/define.ts
|
|
6
|
+
function defineCV({ merge } = {}) {
|
|
7
|
+
const cn = _cn({ merge });
|
|
8
|
+
const cv = _cv({ cn });
|
|
9
|
+
return {
|
|
10
|
+
cn,
|
|
11
|
+
cv,
|
|
12
|
+
extend: _extend({
|
|
13
|
+
cn,
|
|
14
|
+
cv
|
|
15
|
+
})
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { defineCV };
|
package/build/extend.d.ts
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
import { ClassValue } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { ClassValue } from "./node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.js";
|
|
2
|
+
import { CN } from "./cn.js";
|
|
3
|
+
import { Prettify } from "./node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/prettify/index.js";
|
|
4
|
+
import { Merge } from "./node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/merge/index.js";
|
|
5
|
+
import { CV, CVReturn, CVVariant, CompoundVariantsSchema, CompoundVariantsSchemaFunction, Variant, VariantsSchema } from "./cv.js";
|
|
6
6
|
|
|
7
|
+
//#region src/extend.d.ts
|
|
7
8
|
type MergeVariant<V1 extends Variant, V2 extends Variant> = Prettify<Record<keyof V1 | keyof V2, ClassValue>>;
|
|
8
|
-
type MergeVariantsSchemas<V1 extends VariantsSchema, V2 extends VariantsSchema> = Merge<V1 & V2, {
|
|
9
|
-
[K in keyof V1 & keyof V2]: MergeVariant<V1[K], V2[K]>;
|
|
10
|
-
}>;
|
|
9
|
+
type MergeVariantsSchemas<V1 extends VariantsSchema, V2 extends VariantsSchema> = Merge<V1 & V2, { [K in keyof V1 & keyof V2]: MergeVariant<V1[K], V2[K]> }>;
|
|
11
10
|
interface ExtensionConfig<V extends VariantsSchema, NewV extends VariantsSchema> {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
base?: ClassValue;
|
|
12
|
+
variants?: NewV;
|
|
13
|
+
compoundVariants?: CompoundVariantsSchema<MergeVariantsSchemas<V, NewV>> | CompoundVariantsSchemaFunction<MergeVariantsSchemas<V, NewV>>;
|
|
14
|
+
defaultVariants?: CVVariant<MergeVariantsSchemas<V, NewV>>;
|
|
16
15
|
}
|
|
17
16
|
interface CVExtend {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
<V extends VariantsSchema, NewV extends VariantsSchema | (V & {})>(component: CVReturn<V>, extension: ExtensionConfig<V, NewV>): CVReturn<MergeVariantsSchemas<V, NewV>>;
|
|
18
|
+
<V extends VariantsSchema, NewV extends VariantsSchema | (V & {})>(component: CVReturn<V>, extension: CVReturn<NewV>): CVReturn<MergeVariantsSchemas<V, NewV>>;
|
|
20
19
|
}
|
|
21
20
|
interface CVExtendOptions {
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
cn: CN;
|
|
22
|
+
cv: CV;
|
|
24
23
|
}
|
|
25
|
-
declare function _extend({
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
declare function _extend({
|
|
25
|
+
cn,
|
|
26
|
+
cv
|
|
27
|
+
}: CVExtendOptions): CVExtend;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { CVExtend, _extend };
|
package/build/extend.js
CHANGED
|
@@ -1,2 +1,29 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { resolveCompoundVariants } from "./cv.js";
|
|
2
|
+
|
|
3
|
+
//#region src/extend.ts
|
|
4
|
+
function _extend({ cn, cv }) {
|
|
5
|
+
const extendVariants = (variants, newVariants) => {
|
|
6
|
+
const extendedVariants = structuredClone(variants);
|
|
7
|
+
for (const key in newVariants) {
|
|
8
|
+
extendedVariants[key] ??= {};
|
|
9
|
+
for (const variant in newVariants[key]) extendedVariants[key][variant] = cn(variants[key]?.[variant], newVariants[key][variant]);
|
|
10
|
+
}
|
|
11
|
+
return extendedVariants;
|
|
12
|
+
};
|
|
13
|
+
return (component, extension) => {
|
|
14
|
+
const { config } = component;
|
|
15
|
+
const extensionConfig = "config" in extension ? extension.config : extension;
|
|
16
|
+
return cv({
|
|
17
|
+
base: cn(config.base, extensionConfig.base),
|
|
18
|
+
variants: extendVariants(config.variants, extensionConfig.variants),
|
|
19
|
+
compoundVariants: (utils) => resolveCompoundVariants(config.compoundVariants, component).concat(resolveCompoundVariants(extensionConfig.compoundVariants ?? [], utils)),
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
...config.defaultVariants,
|
|
22
|
+
...extensionConfig.defaultVariants
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { _extend };
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
1
|
+
import { ClassValue } from "./node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.js";
|
|
2
|
+
import { CN } from "./cn.js";
|
|
3
|
+
import { CVToken, onlyWhenDefined, onlyWhenUndefined } from "./tokens.js";
|
|
4
|
+
import { CVUtils } from "./utils.js";
|
|
5
|
+
import { CV, CVCompoundVariant, CVReturn, CVVariant, CompoundVariantsSchema, VariantProps, VariantsSchema } from "./cv.js";
|
|
6
|
+
import { CVExtend } from "./extend.js";
|
|
7
|
+
import { defineCV } from "./define.js";
|
|
8
|
+
export { type CN, type CV, type CVCompoundVariant, type CVExtend, type CVReturn, type CVToken, type CVUtils, type CVVariant, type ClassValue, type CompoundVariantsSchema, type VariantProps, type VariantsSchema, defineCV, onlyWhenDefined, onlyWhenUndefined };
|
package/build/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { onlyWhenDefined, onlyWhenUndefined } from "./tokens.js";
|
|
2
|
+
import { defineCV } from "./define.js";
|
|
3
|
+
|
|
4
|
+
export { defineCV, onlyWhenDefined, onlyWhenUndefined };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/clsx.d.mts
|
|
2
|
+
type ClassValue = ClassArray | ClassDictionary | string | number | bigint | null | boolean | undefined;
|
|
3
|
+
type ClassDictionary = Record<string, any>;
|
|
4
|
+
type ClassArray = ClassValue[];
|
|
5
|
+
//#endregion
|
|
6
|
+
export { ClassValue };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Prettify } from "../prettify/index.js";
|
|
2
|
+
|
|
3
|
+
//#region ../../node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/merge/index.d.ts
|
|
4
|
+
type Merge<Object1, Object2> = Prettify<Omit<Object1, keyof Object2> & Object2>;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { Merge };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/opaque/index.d.ts
|
|
2
|
+
type StringLiteral<Type> = Type extends string ? (string extends Type ? never : Type) : never;
|
|
3
|
+
declare const __OPAQUE_TYPE__: unique symbol;
|
|
4
|
+
type WithOpaque<Token extends string> = {
|
|
5
|
+
readonly [__OPAQUE_TYPE__]: Token;
|
|
6
|
+
};
|
|
7
|
+
type Opaque<Type, Token extends string> = Token extends StringLiteral<Token> ? Type & WithOpaque<Token> : never;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { Opaque };
|
package/build/std.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import 'clsx';
|
|
1
|
+
import { CN } from "./cn.js";
|
|
2
|
+
import { CV } from "./cv.js";
|
|
3
|
+
import { CVExtend } from "./extend.js";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
declare const cv: CV;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export { cn, cv, extend };
|
|
5
|
+
//#region src/std.d.ts
|
|
6
|
+
declare const cn: CN, cv: CV, extend: CVExtend;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { cn, cv, extend };
|
package/build/std.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import{
|
|
2
|
-
|
|
1
|
+
import { defineCV } from "./define.js";
|
|
2
|
+
|
|
3
|
+
//#region src/std.ts
|
|
4
|
+
const { cn, cv, extend } = defineCV();
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { cn, cv, extend };
|
package/build/tokens.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { Opaque } from "./node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/opaque/index.js";
|
|
2
|
+
import { CVPropsValue } from "./cv.js";
|
|
3
|
+
|
|
4
|
+
//#region src/tokens.d.ts
|
|
5
|
+
type OnlyWhenDefined = Opaque<{
|
|
6
|
+
__token: string;
|
|
7
|
+
}, "OnlyWhenDefined">;
|
|
8
|
+
type OnlyWhenUndefined = Opaque<{
|
|
9
|
+
__token: string;
|
|
10
|
+
}, "OnlyWhenUndefined">;
|
|
11
|
+
type CVToken = OnlyWhenDefined | OnlyWhenUndefined;
|
|
12
|
+
/** Apply compound variant only if prop **is** specified */
|
|
13
|
+
declare const onlyWhenDefined: OnlyWhenDefined;
|
|
14
|
+
/** Apply compound variant only if prop **is not** specified */
|
|
15
|
+
declare const onlyWhenUndefined: OnlyWhenUndefined;
|
|
16
|
+
declare function isCVToken(token: unknown): token is CVToken;
|
|
17
|
+
declare function shouldApplySelectorByToken(token: CVToken, selector: CVPropsValue): boolean;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { CVToken, isCVToken, onlyWhenDefined, onlyWhenUndefined, shouldApplySelectorByToken };
|
package/build/tokens.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/tokens.ts
|
|
2
|
+
/** Apply compound variant only if prop **is** specified */
|
|
3
|
+
const onlyWhenDefined = { __token: "OnlyWhenDefined" };
|
|
4
|
+
/** Apply compound variant only if prop **is not** specified */
|
|
5
|
+
const onlyWhenUndefined = { __token: "OnlyWhenUndefined" };
|
|
6
|
+
function isCVToken(token) {
|
|
7
|
+
return token ? typeof token === "object" && "__token" in token : false;
|
|
8
|
+
}
|
|
9
|
+
function isSpecificCVToken(token, reference) {
|
|
10
|
+
return token.__token === reference.__token;
|
|
11
|
+
}
|
|
12
|
+
function shouldApplySelectorByToken(token, selector) {
|
|
13
|
+
if (isSpecificCVToken(token, onlyWhenDefined)) return selector !== void 0;
|
|
14
|
+
else if (isSpecificCVToken(token, onlyWhenUndefined)) return selector === void 0;
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
export { isCVToken, onlyWhenDefined, onlyWhenUndefined, shouldApplySelectorByToken };
|
package/build/utils.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { Prettify } from "./node_modules/.pnpm/ts-essentials@10.1.1_typescript@5.8.3/node_modules/ts-essentials/dist/prettify/index.js";
|
|
2
|
+
import { BooleanStringToBoolean, CVConfig, CVVariant, VariantKey, VariantsSchema } from "./cv.js";
|
|
3
|
+
|
|
4
|
+
//#region src/utils.d.ts
|
|
5
|
+
declare function getKeys<O extends Record<string, unknown>>(obj: O): (keyof O & VariantKey)[];
|
|
6
|
+
type EntriesOf<O extends Record<string, unknown>> = { [K in keyof O]: [K, O[K]] };
|
|
7
|
+
declare function getEntries<O extends Record<string, unknown>>(obj: O): EntriesOf<O>[keyof EntriesOf<O>][];
|
|
8
|
+
type VariantMap<V extends VariantsSchema> = { [K in keyof V]: BooleanStringToBoolean<keyof V[K] & VariantKey>[] };
|
|
9
|
+
declare function getVariantMap<V extends VariantsSchema>(variants: V): VariantMap<V>;
|
|
10
|
+
declare function splitProps<TProps>(props: TProps, shouldSplit: (key: keyof TProps) => boolean): readonly [Partial<Record<keyof TProps, unknown>>, Partial<Record<keyof TProps, unknown>>];
|
|
11
|
+
interface CVUtils<V extends VariantsSchema> {
|
|
12
|
+
variantKeys: (keyof V & string)[];
|
|
13
|
+
variantMap: Prettify<VariantMap<V>>;
|
|
14
|
+
splitVariantProps: <TProps extends CVVariant<V>>(props?: TProps) => [CVVariant<V>, Prettify<Omit<TProps, keyof CVVariant<V>>>];
|
|
15
|
+
getVariantProps: (props?: CVVariant<V>) => Exclude<CVVariant<V>, void>;
|
|
16
|
+
}
|
|
17
|
+
declare function cvUtils<V extends VariantsSchema>(config: CVConfig<V>): CVUtils<V>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export { CVUtils, EntriesOf, VariantMap, cvUtils, getEntries, getKeys, getVariantMap, splitProps };
|
package/build/utils.js
CHANGED
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/utils.ts
|
|
2
|
+
function getKeys(obj) {
|
|
3
|
+
return Object.keys(obj);
|
|
4
|
+
}
|
|
5
|
+
function getEntries(obj) {
|
|
6
|
+
return Object.entries(obj);
|
|
7
|
+
}
|
|
8
|
+
function getVariantMap(variants) {
|
|
9
|
+
return Object.fromEntries(getEntries(variants).map(([cvKey, cvVal]) => [cvKey, getKeys(cvVal)]));
|
|
10
|
+
}
|
|
11
|
+
function splitProps(props, shouldSplit) {
|
|
12
|
+
const splittedProps = {};
|
|
13
|
+
const otherProps = {};
|
|
14
|
+
if (!props) return [splittedProps, otherProps];
|
|
15
|
+
for (const propKey in props) {
|
|
16
|
+
const key = propKey;
|
|
17
|
+
if (shouldSplit(key)) splittedProps[key] = props[key];
|
|
18
|
+
else otherProps[key] = props[key];
|
|
19
|
+
}
|
|
20
|
+
return [splittedProps, otherProps];
|
|
21
|
+
}
|
|
22
|
+
function cvUtils(config) {
|
|
23
|
+
const variantKeys = getKeys(config.variants);
|
|
24
|
+
const variantMap = getVariantMap(config.variants);
|
|
25
|
+
const splitVariantProps = (props) => splitProps(props, (key) => key in variantMap);
|
|
26
|
+
const getVariantProps = (props) => {
|
|
27
|
+
const defaultedProps = structuredClone(config.defaultVariants);
|
|
28
|
+
for (const key in props) if (props[key] !== void 0) defaultedProps[key] = props[key];
|
|
29
|
+
return defaultedProps;
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
variantKeys,
|
|
33
|
+
variantMap,
|
|
34
|
+
splitVariantProps,
|
|
35
|
+
getVariantProps
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { cvUtils, getEntries, getKeys, getVariantMap, splitProps };
|
package/build/vue.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import 'clsx';
|
|
4
|
-
import './cn.js';
|
|
1
|
+
import { CVReturn, VariantsSchema } from "./cv.js";
|
|
2
|
+
import { PropType } from "vue";
|
|
5
3
|
|
|
4
|
+
//#region src/vue.d.ts
|
|
6
5
|
declare function getPropsDeclaration<V extends VariantsSchema>(cv: CVReturn<V>): { [K in keyof V]: {
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { getPropsDeclaration };
|
|
6
|
+
type: PropType<keyof V[K]>;
|
|
7
|
+
} };
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getPropsDeclaration };
|
package/build/vue.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/vue.ts
|
|
2
|
+
function getPropsDeclaration(cv) {
|
|
3
|
+
return Object.fromEntries(cv.variantKeys.map((key) => [key, { type: null }]));
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
//#endregion
|
|
7
|
+
export { getPropsDeclaration };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaredfall/class-variants",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "yaredfall",
|
|
6
6
|
"type": "module",
|
|
@@ -44,10 +44,9 @@
|
|
|
44
44
|
"types": "./build/vue.d.cts",
|
|
45
45
|
"default": "./build/vue.cjs"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
48
|
-
"./package.json": "./package.json"
|
|
47
|
+
}
|
|
49
48
|
},
|
|
50
|
-
"main": "build/index.
|
|
49
|
+
"main": "build/index.js",
|
|
51
50
|
"module": "build/index.js",
|
|
52
51
|
"types": "build/index.d.ts",
|
|
53
52
|
"files": [
|
|
@@ -57,15 +56,15 @@
|
|
|
57
56
|
"clsx": "^2.1.1"
|
|
58
57
|
},
|
|
59
58
|
"devDependencies": {
|
|
60
|
-
"
|
|
59
|
+
"ts-essentials": "^10.0.0",
|
|
60
|
+
"tsdown": "^0.18.2",
|
|
61
61
|
"typescript": "^5.8.3",
|
|
62
|
-
"vue": "^3.5.16"
|
|
63
|
-
"ts-essentials": "^10.0.0"
|
|
62
|
+
"vue": "^3.5.16"
|
|
64
63
|
},
|
|
65
64
|
"publishConfig": {
|
|
66
65
|
"access": "public"
|
|
67
66
|
},
|
|
68
67
|
"scripts": {
|
|
69
|
-
"build": "tsc &&
|
|
68
|
+
"build": "tsc && tsdown"
|
|
70
69
|
}
|
|
71
70
|
}
|
package/build/chunk-5EH72RDS.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-O5WYIZI3.js";import{a as i}from"./chunk-CRH3RFJH.js";import{a as o}from"./chunk-QZQFLP4L.js";function m({merge:r}={}){let n=e({merge:r}),t=o({cn:n}),c=i({cn:n,cv:t});return{cn:n,cv:t,extend:c}}export{m as a};
|
|
2
|
-
//# sourceMappingURL=chunk-5EH72RDS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/define.ts"],"sourcesContent":["import { _cn, type CNOptions } from \"./cn\";\r\nimport { _cv } from \"./cv\";\r\nimport { _extend } from \"./extend\";\r\n\r\nexport interface DefineCVOptions extends CNOptions {}\r\n\r\nexport function defineCV({ merge }: DefineCVOptions = {}) {\r\n const cn = _cn({ merge });\r\n\r\n const cv = _cv({ cn });\r\n\r\n const extend = _extend({ cn, cv });\r\n\r\n return { cn, cv, extend } as const;\r\n}\r\n"],"mappings":"wHAMO,SAASA,EAAS,CAAE,MAAAC,CAAM,EAAqB,CAAC,EAAG,CACtD,IAAMC,EAAKC,EAAI,CAAE,MAAAF,CAAM,CAAC,EAElBG,EAAKC,EAAI,CAAE,GAAAH,CAAG,CAAC,EAEfI,EAASC,EAAQ,CAAE,GAAAL,EAAI,GAAAE,CAAG,CAAC,EAEjC,MAAO,CAAE,GAAAF,EAAI,GAAAE,EAAI,OAAAE,CAAO,CAC5B","names":["defineCV","merge","cn","_cn","cv","_cv","extend","_extend"]}
|
package/build/chunk-C577IOC7.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function V(t){return Object.keys(t)}function p(t){return Object.entries(t)}function f(t){return Object.fromEntries(p(t).map(([r,e])=>[r,V(e)]))}function c(t,r){let e={},a={};if(!t)return[e,a];for(let i in t){let n=i;r(n)?e[n]=t[n]:a[n]=t[n]}return[e,a]}function y(t){let r=V(t.variants),e=f(t.variants);return{variantKeys:r,variantMap:e,splitVariantProps:n=>c(n,o=>o in e),getVariantProps:n=>{let o=structuredClone(t.defaultVariants);for(let s in n)n[s]!==void 0&&(o[s]=n[s]);return o}}}export{V as a,p as b,f as c,c as d,y as e};
|
|
2
|
-
//# sourceMappingURL=chunk-C577IOC7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts"],"sourcesContent":["import type { Prettify } from \"ts-essentials\";\nimport type { BooleanStringToBoolean, CVConfig, CVVariant, VariantKey, VariantsSchema } from \"./cv\";\n\nexport function getKeys<O extends Record<string, unknown>>(obj: O) {\n return Object.keys(obj) as (keyof O & VariantKey)[];\n}\n\nexport type EntriesOf<O extends Record<string, unknown>> = { [K in keyof O]: [K, O[K]] };\nexport function getEntries<O extends Record<string, unknown>>(obj: O) {\n return Object.entries(obj) as EntriesOf<O>[keyof EntriesOf<O>][];\n}\n\nexport type VariantMap<V extends VariantsSchema> = {\n [K in keyof V]: BooleanStringToBoolean<keyof V[K] & VariantKey>[];\n};\nexport function getVariantMap<V extends VariantsSchema>(variants: V) {\n return Object.fromEntries(getEntries(variants).map(([cvKey, cvVal]) => [cvKey, getKeys(cvVal)])) as VariantMap<V>;\n}\n\nexport function splitProps<TProps>(props: TProps, shouldSplit: (key: keyof TProps) => boolean) {\n const splittedProps = {} as Partial<Record<keyof TProps, unknown>>;\n const otherProps = {} as Partial<Record<keyof TProps, unknown>>;\n if (!props) return [splittedProps, otherProps] as const;\n for (const propKey in props) {\n const key = propKey as keyof TProps;\n if (shouldSplit(key)) splittedProps[key] = props[key];\n else otherProps[key] = props[key];\n }\n return [splittedProps, otherProps] as const;\n}\n\nexport interface CVUtils<V extends VariantsSchema> {\n variantKeys: (keyof V & string)[];\n variantMap: Prettify<VariantMap<V>>;\n splitVariantProps: <TProps extends CVVariant<V>>(\n props?: TProps,\n ) => [CVVariant<V>, Prettify<Omit<TProps, keyof CVVariant<V>>>];\n getVariantProps: (props?: CVVariant<V>) => Exclude<CVVariant<V>, void>;\n}\n\nexport function cvUtils<V extends VariantsSchema>(config: CVConfig<V>): CVUtils<V> {\n const variantKeys = getKeys(config.variants);\n const variantMap = getVariantMap(config.variants);\n const splitVariantProps = (props?: CVVariant<V>) => splitProps(props, (key) => key in variantMap);\n const getVariantProps = (props?: CVVariant<V>) => {\n const defaultedProps = structuredClone(config.defaultVariants);\n for (const key in props) {\n if (props[key] !== undefined) defaultedProps[key] = props[key];\n }\n return defaultedProps;\n };\n\n return { variantKeys, variantMap, splitVariantProps, getVariantProps } as CVUtils<V>;\n}\n"],"mappings":"AAGO,SAASA,EAA2CC,EAAQ,CAC/D,OAAO,OAAO,KAAKA,CAAG,CAC1B,CAGO,SAASC,EAA8CD,EAAQ,CAClE,OAAO,OAAO,QAAQA,CAAG,CAC7B,CAKO,SAASE,EAAwCC,EAAa,CACjE,OAAO,OAAO,YAAYF,EAAWE,CAAQ,EAAE,IAAI,CAAC,CAACC,EAAOC,CAAK,IAAM,CAACD,EAAOL,EAAQM,CAAK,CAAC,CAAC,CAAC,CACnG,CAEO,SAASC,EAAmBC,EAAeC,EAA6C,CAC3F,IAAMC,EAAgB,CAAC,EACjBC,EAAa,CAAC,EACpB,GAAI,CAACH,EAAO,MAAO,CAACE,EAAeC,CAAU,EAC7C,QAAWC,KAAWJ,EAAO,CACzB,IAAMK,EAAMD,EACRH,EAAYI,CAAG,EAAGH,EAAcG,CAAG,EAAIL,EAAMK,CAAG,EAC/CF,EAAWE,CAAG,EAAIL,EAAMK,CAAG,CACpC,CACA,MAAO,CAACH,EAAeC,CAAU,CACrC,CAWO,SAASG,EAAkCC,EAAiC,CAC/E,IAAMC,EAAchB,EAAQe,EAAO,QAAQ,EACrCE,EAAad,EAAcY,EAAO,QAAQ,EAUhD,MAAO,CAAE,YAAAC,EAAa,WAAAC,EAAY,kBATPT,GAAyBD,EAAWC,EAAQK,GAAQA,KAAOI,CAAU,EAS3C,gBAR5BT,GAAyB,CAC9C,IAAMU,EAAiB,gBAAgBH,EAAO,eAAe,EAC7D,QAAWF,KAAOL,EACVA,EAAMK,CAAG,IAAM,SAAWK,EAAeL,CAAG,EAAIL,EAAMK,CAAG,GAEjE,OAAOK,CACX,CAEqE,CACzE","names":["getKeys","obj","getEntries","getVariantMap","variants","cvKey","cvVal","splitProps","props","shouldSplit","splittedProps","otherProps","propKey","key","cvUtils","config","variantKeys","variantMap","defaultedProps"]}
|
package/build/chunk-CRH3RFJH.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as r}from"./chunk-QZQFLP4L.js";function m({cn:s,cv:i}){let o=(t,n)=>{let a=structuredClone(t);for(let e in n){a[e]??(a[e]={});for(let V in n[e])a[e][V]=s(t[e]?.[V],n[e][V])}return a};return(t,n)=>{let{config:a}=t,e="config"in n?n.config:n;return i({base:s(a.base,e.base),variants:o(a.variants,e.variants),compoundVariants:V=>r(a.compoundVariants,t).concat(r(e.compoundVariants??[],V)),defaultVariants:{...a.defaultVariants,...e.defaultVariants}})}}export{m as a};
|
|
2
|
-
//# sourceMappingURL=chunk-CRH3RFJH.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/extend.ts"],"sourcesContent":["import type { ClassValue } from \"clsx\";\r\nimport type { Merge, Prettify } from \"ts-essentials\";\r\nimport type { CN } from \"./cn\";\r\nimport {\r\n resolveCompoundVariants,\r\n type CompoundVariantsSchema,\r\n type CompoundVariantsSchemaFunction,\r\n type CV,\r\n type CVConfig,\r\n type CVReturn,\r\n type CVVariant,\r\n type Variant,\r\n type VariantsSchema,\r\n} from \"./cv\";\r\n\r\ntype MergeVariant<V1 extends Variant, V2 extends Variant> = Prettify<Record<keyof V1 | keyof V2, ClassValue>>;\r\ntype MergeVariantsSchemas<V1 extends VariantsSchema, V2 extends VariantsSchema> = Merge<\r\n V1 & V2,\r\n {\r\n [K in keyof V1 & keyof V2]: MergeVariant<V1[K], V2[K]>;\r\n }\r\n>;\r\n\r\ninterface ExtensionConfig<V extends VariantsSchema, NewV extends VariantsSchema> {\r\n base?: ClassValue;\r\n variants?: NewV;\r\n compoundVariants?:\r\n | CompoundVariantsSchema<MergeVariantsSchemas<V, NewV>>\r\n | CompoundVariantsSchemaFunction<MergeVariantsSchemas<V, NewV>>;\r\n defaultVariants?: CVVariant<MergeVariantsSchemas<V, NewV>>;\r\n}\r\n\r\nexport interface CVExtend {\r\n <V extends VariantsSchema, NewV extends VariantsSchema | (V & {})>(\r\n component: CVReturn<V>,\r\n extension: ExtensionConfig<V, NewV>,\r\n ): CVReturn<MergeVariantsSchemas<V, NewV>>;\r\n <V extends VariantsSchema, NewV extends VariantsSchema | (V & {})>(\r\n component: CVReturn<V>,\r\n extension: CVReturn<NewV>,\r\n ): CVReturn<MergeVariantsSchemas<V, NewV>>;\r\n}\r\n\r\ninterface CVExtendOptions {\r\n cn: CN;\r\n cv: CV;\r\n}\r\nexport function _extend({ cn, cv }: CVExtendOptions): CVExtend {\r\n const extendVariants = <V extends VariantsSchema, NewV extends VariantsSchema>(variants: V, newVariants?: NewV) => {\r\n const extendedVariants: VariantsSchema = structuredClone(variants);\r\n for (const key in newVariants) {\r\n extendedVariants[key] ??= {};\r\n for (const variant in newVariants[key]) {\r\n extendedVariants[key][variant] = cn(variants[key]?.[variant], newVariants[key][variant]);\r\n }\r\n }\r\n return extendedVariants as MergeVariantsSchemas<V, NewV>;\r\n };\r\n\r\n return <V extends VariantsSchema, NewV extends VariantsSchema | (V & {})>(\r\n component: CVReturn<V>,\r\n extension: ExtensionConfig<V, NewV> | CVReturn<NewV>,\r\n ) => {\r\n const { config } = component;\r\n\r\n const extensionConfig = (\"config\" in extension ? extension.config : extension) as ExtensionConfig<V, NewV>;\r\n\r\n return cv({\r\n base: cn(config.base, extensionConfig.base),\r\n variants: extendVariants(config.variants, extensionConfig.variants),\r\n compoundVariants: (utils) =>\r\n resolveCompoundVariants(config.compoundVariants, component).concat(\r\n resolveCompoundVariants(extensionConfig.compoundVariants ?? [], utils),\r\n ),\r\n defaultVariants: { ...config.defaultVariants, ...extensionConfig.defaultVariants },\r\n } as CVConfig<MergeVariantsSchemas<V, NewV>>);\r\n };\r\n}\r\n"],"mappings":"wCA+CO,SAASA,EAAQ,CAAE,GAAAC,EAAI,GAAAC,CAAG,EAA8B,CAC3D,IAAMC,EAAiB,CAAwDC,EAAaC,IAAuB,CAC/G,IAAMC,EAAmC,gBAAgBF,CAAQ,EACjE,QAAWG,KAAOF,EAAa,CAC3BC,EAAAC,KAAAD,EAAAC,GAA0B,CAAC,GAC3B,QAAWC,KAAWH,EAAYE,CAAG,EACjCD,EAAiBC,CAAG,EAAEC,CAAO,EAAIP,EAAGG,EAASG,CAAG,IAAIC,CAAO,EAAGH,EAAYE,CAAG,EAAEC,CAAO,CAAC,CAE/F,CACA,OAAOF,CACX,EAEA,MAAO,CACHG,EACAC,IACC,CACD,GAAM,CAAE,OAAAC,CAAO,EAAIF,EAEbG,EAAmB,WAAYF,EAAYA,EAAU,OAASA,EAEpE,OAAOR,EAAG,CACN,KAAMD,EAAGU,EAAO,KAAMC,EAAgB,IAAI,EAC1C,SAAUT,EAAeQ,EAAO,SAAUC,EAAgB,QAAQ,EAClE,iBAAmBC,GACfC,EAAwBH,EAAO,iBAAkBF,CAAS,EAAE,OACxDK,EAAwBF,EAAgB,kBAAoB,CAAC,EAAGC,CAAK,CACzE,EACJ,gBAAiB,CAAE,GAAGF,EAAO,gBAAiB,GAAGC,EAAgB,eAAgB,CACrF,CAA4C,CAChD,CACJ","names":["_extend","cn","cv","extendVariants","variants","newVariants","extendedVariants","key","variant","component","extension","config","extensionConfig","utils","resolveCompoundVariants"]}
|
package/build/chunk-N3ZCNVFV.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var t={__token:"OnlyWhenDefined"},i={__token:"OnlyWhenUndefined"};function f(e){return e?typeof e=="object"&&"__token"in e:!1}function o(e,n){return e.__token===n.__token}function r(e,n){return o(e,t)?n!==void 0:o(e,i)?n===void 0:!1}export{t as a,i as b,f as c,r as d};
|
|
2
|
-
//# sourceMappingURL=chunk-N3ZCNVFV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tokens.ts"],"sourcesContent":["import type { Opaque } from \"ts-essentials\";\nimport type { CVPropsValue } from \"./cv\";\n\ntype OnlyWhenDefined = Opaque<{ __token: string }, \"OnlyWhenDefined\">;\ntype OnlyWhenUndefined = Opaque<{ __token: string }, \"OnlyWhenUndefined\">;\n\nexport type CVToken = OnlyWhenDefined | OnlyWhenUndefined;\n\n/** Apply compound variant only if prop **is** specified */\nexport const onlyWhenDefined = { __token: \"OnlyWhenDefined\" } as OnlyWhenDefined;\n/** Apply compound variant only if prop **is not** specified */\nexport const onlyWhenUndefined = { __token: \"OnlyWhenUndefined\" } as OnlyWhenUndefined;\n\nexport function isCVToken(token: unknown): token is CVToken {\n return token ? typeof token === \"object\" && \"__token\" in token : false;\n}\nfunction isSpecificCVToken<TReference extends CVToken>(token: CVToken, reference: TReference): token is TReference {\n return token.__token === reference.__token;\n}\n\nexport function shouldApplySelectorByToken(token: CVToken, selector: CVPropsValue) {\n if (isSpecificCVToken(token, onlyWhenDefined)) return selector !== undefined;\n else if (isSpecificCVToken(token, onlyWhenUndefined)) return selector === undefined;\n\n return false;\n}\n"],"mappings":"AASO,IAAMA,EAAkB,CAAE,QAAS,iBAAkB,EAE/CC,EAAoB,CAAE,QAAS,mBAAoB,EAEzD,SAASC,EAAUC,EAAkC,CACxD,OAAOA,EAAQ,OAAOA,GAAU,UAAY,YAAaA,EAAQ,EACrE,CACA,SAASC,EAA8CD,EAAgBE,EAA4C,CAC/G,OAAOF,EAAM,UAAYE,EAAU,OACvC,CAEO,SAASC,EAA2BH,EAAgBI,EAAwB,CAC/E,OAAIH,EAAkBD,EAAOH,CAAe,EAAUO,IAAa,OAC1DH,EAAkBD,EAAOF,CAAiB,EAAUM,IAAa,OAEnE,EACX","names":["onlyWhenDefined","onlyWhenUndefined","isCVToken","token","isSpecificCVToken","reference","shouldApplySelectorByToken","selector"]}
|
package/build/chunk-O5WYIZI3.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cn.ts"],"sourcesContent":["import clsx, { type ClassValue } from \"clsx\";\n\nexport interface CNOptions {\n merge?: (className: string) => string;\n}\n\nexport interface CN {\n (...inputs: ClassValue[]): string;\n}\n\nexport function _cn({ merge = (className) => className }: CNOptions): CN {\n return (...inputs) => merge(clsx(...inputs));\n}\n"],"mappings":"AAAA,OAAOA,MAA+B,OAU/B,SAASC,EAAI,CAAE,MAAAC,EAASC,GAAcA,CAAU,EAAkB,CACrE,MAAO,IAAIC,IAAWF,EAAMF,EAAK,GAAGI,CAAM,CAAC,CAC/C","names":["clsx","_cn","merge","className","inputs"]}
|
package/build/chunk-QZQFLP4L.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as u,d as f}from"./chunk-N3ZCNVFV.js";import{e as d}from"./chunk-C577IOC7.js";function P(t){return e=>{let[a,n]=h(e),{base:r,variants:i,compoundVariants:p,defaultVariants:c}=a,m=s=>{let V=n.getVariantProps(s),o=new Array;for(let C in i){let l=V[C]?.toString();l&&o.push(i?.[C]?.[l])}return o},S=s=>p?.reduce((V,o)=>(g(s,o,c)&&V.push(o.class),V),new Array);return Object.assign(Object.assign((s,...V)=>{let o=m(s),C=S(s);return t.cn(r,o,C,...V)},n),{config:a,$inferProps:void 0})}}function g(t,e,a){return Object.keys(e).every(n=>{if(n==="class")return!0;let r=e[n],i=a?.[n],p=t?.[n];if(u(r))return f(r,p);let c=p??i;return Array.isArray(r)?r.some(m=>y(c,m)):y(c,r)})}function y(t,e){return t?.toString()===e?.toString()}function h(t){let e={variants:{},compoundVariants:[],defaultVariants:{},...t},a=d(e);return[Object.assign(e,{compoundVariants:x(e.compoundVariants,a)}),a]}function x(t,e){return typeof t=="function"?t(e):t}export{P as a,h as b,x as c};
|
|
2
|
-
//# sourceMappingURL=chunk-QZQFLP4L.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cv.ts"],"sourcesContent":["import type { ClassValue } from \"clsx\";\nimport type { ArrayOrSingle } from \"ts-essentials\";\nimport { type CN } from \"./cn\";\nimport { isCVToken, shouldApplySelectorByToken, type CVToken } from \"./tokens\";\nimport { cvUtils, type CVUtils } from \"./utils\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type VariantProps<CVR extends (props?: any) => string> =\n CVR extends CVReturn<infer _V> ? CVR[\"$inferProps\"] : never;\n\nexport type BooleanStringToBoolean<T> = T extends \"true\" | \"false\" ? boolean : T;\n\nexport type VariantKey = string | number;\n\nexport type Variant = Record<VariantKey, ClassValue>;\nexport type VariantsSchema = Record<string, Variant>;\n\ntype EmptySchema = Record<never, never>;\n\nexport type CVVariant<V extends VariantsSchema = EmptySchema> = {\n [K in keyof V]?: BooleanStringToBoolean<keyof V[K] & VariantKey>;\n};\n\nexport type CVCompoundVariant<V extends VariantsSchema = EmptySchema> = {\n [K in keyof V]?: ArrayOrSingle<BooleanStringToBoolean<keyof V[K] & VariantKey>> | CVToken;\n} & { class: ClassValue };\n\nexport type CompoundVariantsSchema<V extends VariantsSchema = EmptySchema> = CVCompoundVariant<V>[];\nexport type CompoundVariantsSchemaFunction<V extends VariantsSchema = EmptySchema> = (\n utils: CVUtils<V>,\n) => CompoundVariantsSchema<V>;\n\nexport interface CVConfig<V extends VariantsSchema = EmptySchema> {\n base: ClassValue;\n variants: V;\n compoundVariants: CompoundVariantsSchema<V> | CompoundVariantsSchemaFunction<V>;\n defaultVariants: CVVariant<V>;\n}\n\nexport interface ResolvedCVConfig<V extends VariantsSchema = EmptySchema> extends CVConfig<V> {\n compoundVariants: CompoundVariantsSchema<V>;\n}\n\nexport interface CVReturn<V extends VariantsSchema = EmptySchema> extends CVUtils<V> {\n (props?: CVVariant<V>, ...classNames: ClassValue[]): string;\n config: ResolvedCVConfig<V>;\n\n $inferProps: CVVariant<V>;\n}\n\nexport interface CV {\n <V extends VariantsSchema = EmptySchema>(config: Partial<CVConfig<V>>): CVReturn<V>;\n}\n\ninterface CVOptions {\n cn: CN;\n}\nexport function _cv(options: CVOptions): CV {\n return <V extends VariantsSchema = EmptySchema>(config: Partial<CVConfig<V>>) => {\n const [resolvedConfig, utils] = resolveConfig(config);\n\n const { base, variants, compoundVariants, defaultVariants } = resolvedConfig;\n\n const getVariantsClassNames = (props?: CVVariant<V>) => {\n const defaultedProps = utils.getVariantProps(props);\n\n const classNames = new Array<ClassValue>();\n for (const key in variants) {\n const variant = defaultedProps[key]?.toString();\n if (variant) classNames.push(variants?.[key]?.[variant]);\n }\n return classNames;\n };\n\n const getCompoundVariantsClassNames = (props?: CVVariant<V>) => {\n return compoundVariants?.reduce((acc, compoundVariant) => {\n if (shouldApplyCompoundVariant(props, compoundVariant, defaultVariants))\n acc.push(compoundVariant.class);\n return acc;\n }, new Array<ClassValue>());\n };\n\n const getVariant = (props?: CVVariant<V>, ...classNames: ClassValue[]) => {\n const variantClassNames = getVariantsClassNames(props);\n\n const compoundVariantClassNames = getCompoundVariantsClassNames(props);\n\n return options.cn(base, variantClassNames, compoundVariantClassNames, ...classNames);\n };\n\n return Object.assign(Object.assign(getVariant, utils), { config: resolvedConfig, $inferProps: undefined! });\n };\n}\n\nfunction shouldApplyCompoundVariant<V extends VariantsSchema = EmptySchema>(\n props: CVVariant<V> | undefined,\n matcher: CVCompoundVariant<V>,\n defaults: CVVariant<V> | undefined,\n) {\n return Object.keys(matcher).every((cvKey) => {\n if (cvKey === \"class\") return true;\n\n const cvSelector = matcher[cvKey];\n\n const defaultsSelector = defaults?.[cvKey as keyof typeof defaults];\n const propsSelector = props?.[cvKey as keyof typeof props];\n\n if (isCVToken(cvSelector)) return shouldApplySelectorByToken(cvSelector, propsSelector);\n\n const selector = propsSelector ?? defaultsSelector;\n\n return Array.isArray(cvSelector)\n ? cvSelector.some((cvSelector) => compareSelectors(selector, cvSelector))\n : compareSelectors(selector, cvSelector);\n });\n}\n\nexport type CVPropsValue = VariantKey | boolean | undefined;\nfunction compareSelectors(selector1: CVPropsValue, selector2: CVPropsValue) {\n return selector1?.toString() === selector2?.toString();\n}\n\nexport function resolveConfig<V extends VariantsSchema = EmptySchema>(\n config: Partial<CVConfig<V>>,\n): [ResolvedCVConfig<V>, CVUtils<V>] {\n const defaultedConfig = {\n variants: {},\n compoundVariants: [],\n defaultVariants: {},\n ...config,\n } as CVConfig<V>;\n\n const utils = cvUtils(defaultedConfig);\n\n return [\n Object.assign(defaultedConfig, {\n compoundVariants: resolveCompoundVariants(defaultedConfig.compoundVariants, utils),\n }),\n utils,\n ] as const;\n}\n\nexport function resolveCompoundVariants<V extends VariantsSchema = EmptySchema>(\n compoundVariants: CVConfig<V>[\"compoundVariants\"],\n utils: CVUtils<V>,\n) {\n return typeof compoundVariants === \"function\" ? compoundVariants(utils) : compoundVariants;\n}\n"],"mappings":"uFAyDO,SAASA,EAAIC,EAAwB,CACxC,OAAgDC,GAAiC,CAC7E,GAAM,CAACC,EAAgBC,CAAK,EAAIC,EAAcH,CAAM,EAE9C,CAAE,KAAAI,EAAM,SAAAC,EAAU,iBAAAC,EAAkB,gBAAAC,CAAgB,EAAIN,EAExDO,EAAyBC,GAAyB,CACpD,IAAMC,EAAiBR,EAAM,gBAAgBO,CAAK,EAE5CE,EAAa,IAAI,MACvB,QAAWC,KAAOP,EAAU,CACxB,IAAMQ,EAAUH,EAAeE,CAAG,GAAG,SAAS,EAC1CC,GAASF,EAAW,KAAKN,IAAWO,CAAG,IAAIC,CAAO,CAAC,CAC3D,CACA,OAAOF,CACX,EAEMG,EAAiCL,GAC5BH,GAAkB,OAAO,CAACS,EAAKC,KAC9BC,EAA2BR,EAAOO,EAAiBT,CAAe,GAClEQ,EAAI,KAAKC,EAAgB,KAAK,EAC3BD,GACR,IAAI,KAAmB,EAW9B,OAAO,OAAO,OAAO,OAAO,OART,CAACN,KAAyBE,IAA6B,CACtE,IAAMO,EAAoBV,EAAsBC,CAAK,EAE/CU,EAA4BL,EAA8BL,CAAK,EAErE,OAAOV,EAAQ,GAAGK,EAAMc,EAAmBC,EAA2B,GAAGR,CAAU,CACvF,EAE+CT,CAAK,EAAG,CAAE,OAAQD,EAAgB,YAAa,MAAW,CAAC,CAC9G,CACJ,CAEA,SAASgB,EACLR,EACAW,EACAC,EACF,CACE,OAAO,OAAO,KAAKD,CAAO,EAAE,MAAOE,GAAU,CACzC,GAAIA,IAAU,QAAS,MAAO,GAE9B,IAAMC,EAAaH,EAAQE,CAAK,EAE1BE,EAAmBH,IAAWC,CAA8B,EAC5DG,EAAgBhB,IAAQa,CAA2B,EAEzD,GAAII,EAAUH,CAAU,EAAG,OAAOI,EAA2BJ,EAAYE,CAAa,EAEtF,IAAMG,EAAWH,GAAiBD,EAElC,OAAO,MAAM,QAAQD,CAAU,EACzBA,EAAW,KAAMA,GAAeM,EAAiBD,EAAUL,CAAU,CAAC,EACtEM,EAAiBD,EAAUL,CAAU,CAC/C,CAAC,CACL,CAGA,SAASM,EAAiBC,EAAyBC,EAAyB,CACxE,OAAOD,GAAW,SAAS,IAAMC,GAAW,SAAS,CACzD,CAEO,SAAS5B,EACZH,EACiC,CACjC,IAAMgC,EAAkB,CACpB,SAAU,CAAC,EACX,iBAAkB,CAAC,EACnB,gBAAiB,CAAC,EAClB,GAAGhC,CACP,EAEME,EAAQ+B,EAAQD,CAAe,EAErC,MAAO,CACH,OAAO,OAAOA,EAAiB,CAC3B,iBAAkBE,EAAwBF,EAAgB,iBAAkB9B,CAAK,CACrF,CAAC,EACDA,CACJ,CACJ,CAEO,SAASgC,EACZ5B,EACAJ,EACF,CACE,OAAO,OAAOI,GAAqB,WAAaA,EAAiBJ,CAAK,EAAII,CAC9E","names":["_cv","options","config","resolvedConfig","utils","resolveConfig","base","variants","compoundVariants","defaultVariants","getVariantsClassNames","props","defaultedProps","classNames","key","variant","getCompoundVariantsClassNames","acc","compoundVariant","shouldApplyCompoundVariant","variantClassNames","compoundVariantClassNames","matcher","defaults","cvKey","cvSelector","defaultsSelector","propsSelector","isCVToken","shouldApplySelectorByToken","selector","compareSelectors","selector1","selector2","defaultedConfig","cvUtils","resolveCompoundVariants"]}
|
package/build/cn.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/cv-zY1EPoUz.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { ClassValue } from 'clsx';
|
|
2
|
-
import { CN } from './cn.js';
|
|
3
|
-
|
|
4
|
-
type Prettify<Type> = Type extends Function ? Type : Extract<{
|
|
5
|
-
[Key in keyof Type]: Type[Key];
|
|
6
|
-
}, Type>;
|
|
7
|
-
|
|
8
|
-
type StringLiteral<Type> = Type extends string ? (string extends Type ? never : Type) : never;
|
|
9
|
-
declare const __OPAQUE_TYPE__: unique symbol;
|
|
10
|
-
type WithOpaque<Token extends string> = {
|
|
11
|
-
readonly [__OPAQUE_TYPE__]: Token;
|
|
12
|
-
};
|
|
13
|
-
type Opaque<Type, Token extends string> = Token extends StringLiteral<Token> ? Type & WithOpaque<Token> : never;
|
|
14
|
-
|
|
15
|
-
type ArrayOrSingle<Type> = Type | Type[];
|
|
16
|
-
|
|
17
|
-
type OnlyWhenDefined = Opaque<{
|
|
18
|
-
__token: string;
|
|
19
|
-
}, "OnlyWhenDefined">;
|
|
20
|
-
type OnlyWhenUndefined = Opaque<{
|
|
21
|
-
__token: string;
|
|
22
|
-
}, "OnlyWhenUndefined">;
|
|
23
|
-
type CVToken = OnlyWhenDefined | OnlyWhenUndefined;
|
|
24
|
-
/** Apply compound variant only if prop **is** specified */
|
|
25
|
-
declare const onlyWhenDefined: OnlyWhenDefined;
|
|
26
|
-
/** Apply compound variant only if prop **is not** specified */
|
|
27
|
-
declare const onlyWhenUndefined: OnlyWhenUndefined;
|
|
28
|
-
declare function isCVToken(token: unknown): token is CVToken;
|
|
29
|
-
declare function shouldApplySelectorByToken(token: CVToken, selector: CVPropsValue): boolean;
|
|
30
|
-
|
|
31
|
-
declare function getKeys<O extends Record<string, unknown>>(obj: O): (keyof O & VariantKey)[];
|
|
32
|
-
type EntriesOf<O extends Record<string, unknown>> = {
|
|
33
|
-
[K in keyof O]: [K, O[K]];
|
|
34
|
-
};
|
|
35
|
-
declare function getEntries<O extends Record<string, unknown>>(obj: O): EntriesOf<O>[keyof EntriesOf<O>][];
|
|
36
|
-
type VariantMap<V extends VariantsSchema> = {
|
|
37
|
-
[K in keyof V]: BooleanStringToBoolean<keyof V[K] & VariantKey>[];
|
|
38
|
-
};
|
|
39
|
-
declare function getVariantMap<V extends VariantsSchema>(variants: V): VariantMap<V>;
|
|
40
|
-
declare function splitProps<TProps>(props: TProps, shouldSplit: (key: keyof TProps) => boolean): readonly [Partial<Record<keyof TProps, unknown>>, Partial<Record<keyof TProps, unknown>>];
|
|
41
|
-
interface CVUtils<V extends VariantsSchema> {
|
|
42
|
-
variantKeys: (keyof V & string)[];
|
|
43
|
-
variantMap: Prettify<VariantMap<V>>;
|
|
44
|
-
splitVariantProps: <TProps extends CVVariant<V>>(props?: TProps) => [CVVariant<V>, Prettify<Omit<TProps, keyof CVVariant<V>>>];
|
|
45
|
-
getVariantProps: (props?: CVVariant<V>) => Exclude<CVVariant<V>, void>;
|
|
46
|
-
}
|
|
47
|
-
declare function cvUtils<V extends VariantsSchema>(config: CVConfig<V>): CVUtils<V>;
|
|
48
|
-
|
|
49
|
-
type VariantProps<CVR extends (props?: any) => string> = CVR extends CVReturn<infer _V> ? CVR["$inferProps"] : never;
|
|
50
|
-
type BooleanStringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
51
|
-
type VariantKey = string | number;
|
|
52
|
-
type Variant = Record<VariantKey, ClassValue>;
|
|
53
|
-
type VariantsSchema = Record<string, Variant>;
|
|
54
|
-
type EmptySchema = Record<never, never>;
|
|
55
|
-
type CVVariant<V extends VariantsSchema = EmptySchema> = {
|
|
56
|
-
[K in keyof V]?: BooleanStringToBoolean<keyof V[K] & VariantKey>;
|
|
57
|
-
};
|
|
58
|
-
type CVCompoundVariant<V extends VariantsSchema = EmptySchema> = {
|
|
59
|
-
[K in keyof V]?: ArrayOrSingle<BooleanStringToBoolean<keyof V[K] & VariantKey>> | CVToken;
|
|
60
|
-
} & {
|
|
61
|
-
class: ClassValue;
|
|
62
|
-
};
|
|
63
|
-
type CompoundVariantsSchema<V extends VariantsSchema = EmptySchema> = CVCompoundVariant<V>[];
|
|
64
|
-
type CompoundVariantsSchemaFunction<V extends VariantsSchema = EmptySchema> = (utils: CVUtils<V>) => CompoundVariantsSchema<V>;
|
|
65
|
-
interface CVConfig<V extends VariantsSchema = EmptySchema> {
|
|
66
|
-
base: ClassValue;
|
|
67
|
-
variants: V;
|
|
68
|
-
compoundVariants: CompoundVariantsSchema<V> | CompoundVariantsSchemaFunction<V>;
|
|
69
|
-
defaultVariants: CVVariant<V>;
|
|
70
|
-
}
|
|
71
|
-
interface ResolvedCVConfig<V extends VariantsSchema = EmptySchema> extends CVConfig<V> {
|
|
72
|
-
compoundVariants: CompoundVariantsSchema<V>;
|
|
73
|
-
}
|
|
74
|
-
interface CVReturn<V extends VariantsSchema = EmptySchema> extends CVUtils<V> {
|
|
75
|
-
(props?: CVVariant<V>, ...classNames: ClassValue[]): string;
|
|
76
|
-
config: ResolvedCVConfig<V>;
|
|
77
|
-
$inferProps: CVVariant<V>;
|
|
78
|
-
}
|
|
79
|
-
interface CV {
|
|
80
|
-
<V extends VariantsSchema = EmptySchema>(config: Partial<CVConfig<V>>): CVReturn<V>;
|
|
81
|
-
}
|
|
82
|
-
interface CVOptions {
|
|
83
|
-
cn: CN;
|
|
84
|
-
}
|
|
85
|
-
declare function _cv(options: CVOptions): CV;
|
|
86
|
-
type CVPropsValue = VariantKey | boolean | undefined;
|
|
87
|
-
declare function resolveConfig<V extends VariantsSchema = EmptySchema>(config: Partial<CVConfig<V>>): [ResolvedCVConfig<V>, CVUtils<V>];
|
|
88
|
-
declare function resolveCompoundVariants<V extends VariantsSchema = EmptySchema>(compoundVariants: CVConfig<V>["compoundVariants"], utils: CVUtils<V>): CompoundVariantsSchema<V>;
|
|
89
|
-
|
|
90
|
-
export { type BooleanStringToBoolean as B, type CV as C, type EntriesOf as E, type Prettify as P, type ResolvedCVConfig as R, type VariantsSchema as V, _cv as _, type CVReturn as a, type CompoundVariantsSchema as b, type Variant as c, type CompoundVariantsSchemaFunction as d, type CVVariant as e, onlyWhenUndefined as f, type CVCompoundVariant as g, type CVToken as h, type CVUtils as i, type VariantProps as j, isCVToken as k, getKeys as l, getEntries as m, type VariantMap as n, onlyWhenDefined as o, getVariantMap as p, splitProps as q, cvUtils as r, shouldApplySelectorByToken as s, type VariantKey as t, type CVConfig as u, type CVPropsValue as v, resolveConfig as w, resolveCompoundVariants as x };
|
package/build/cv.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/define.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/extend.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/std.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/std.ts"],"sourcesContent":["import { defineCV } from \"./define\";\r\n\r\nexport const { cn, cv, extend } = defineCV();\r\n"],"mappings":"oLAEO,GAAM,CAAE,GAAAA,EAAI,GAAAC,EAAI,OAAAC,CAAO,EAAIC,EAAS","names":["cn","cv","extend","defineCV"]}
|
package/build/tokens.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/build/vue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vue.ts"],"sourcesContent":["import { type PropType } from \"vue\";\nimport { type CVReturn, type VariantsSchema } from \"./cv\";\n\nexport function getPropsDeclaration<V extends VariantsSchema /* , R extends keyof V = never */>(cv: CVReturn<V>) {\n return Object.fromEntries(\n cv.variantKeys.map((key) => [key, { type: null /* , required: cv.requiredVariants[key as R] */ }]),\n ) as unknown as { [K in keyof V]: { type: PropType<keyof V[K]> /* ; required: K extends R ? true : false */ } };\n}\n"],"mappings":"AAGO,SAASA,EAAgFC,EAAiB,CAC7G,OAAO,OAAO,YACVA,EAAG,YAAY,IAAKC,GAAQ,CAACA,EAAK,CAAE,KAAM,IAAqD,CAAC,CAAC,CACrG,CACJ","names":["getPropsDeclaration","cv","key"]}
|