@yaredfall/class-variants 0.5.0-rc → 0.6.0-rc.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/chunk-77XW3WZ4.js +2 -0
- package/build/chunk-77XW3WZ4.js.map +1 -0
- package/build/chunk-AQKDS5WX.js +2 -0
- package/build/chunk-AQKDS5WX.js.map +1 -0
- package/build/chunk-UUT6STP6.js +2 -0
- package/build/chunk-UUT6STP6.js.map +1 -0
- package/build/chunk-XWAQU5O6.js +2 -0
- package/build/chunk-XWAQU5O6.js.map +1 -0
- package/build/cv--G8-bDtP.d.ts +78 -0
- package/build/cv-gIK0IznJ.d.cts +78 -0
- package/build/cv.cjs +1 -1
- package/build/cv.cjs.map +1 -1
- package/build/cv.d.cts +1 -1
- package/build/cv.d.ts +1 -1
- package/build/cv.js +1 -1
- package/build/define.cjs +1 -1
- package/build/define.cjs.map +1 -1
- package/build/define.d.cts +9 -5
- package/build/define.d.ts +9 -5
- package/build/define.js +1 -1
- package/build/extend.cjs +2 -0
- package/build/extend.cjs.map +1 -0
- package/build/extend.d.cts +21 -0
- package/build/extend.d.ts +21 -0
- package/build/extend.js +2 -0
- package/build/index.cjs +1 -1
- package/build/index.cjs.map +1 -1
- package/build/index.d.cts +11 -7
- package/build/index.d.ts +11 -7
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/tokens.d.cts +1 -1
- package/build/tokens.d.ts +1 -1
- package/build/utils.cjs +1 -1
- package/build/utils.cjs.map +1 -1
- package/build/utils.d.cts +1 -1
- package/build/utils.d.ts +1 -1
- package/build/utils.js +1 -1
- package/build/vue.cjs +1 -1
- package/build/vue.cjs.map +1 -1
- package/build/vue.d.cts +4 -18
- package/build/vue.d.ts +4 -18
- package/build/vue.js +1 -1
- package/build/vue.js.map +1 -1
- package/package.json +1 -1
- package/build/chunk-6DFTYFKO.js +0 -2
- package/build/chunk-6DFTYFKO.js.map +0 -1
- package/build/chunk-6Y37KLAC.js +0 -2
- package/build/chunk-6Y37KLAC.js.map +0 -1
- package/build/chunk-BSA7R4NK.js +0 -2
- package/build/chunk-BSA7R4NK.js.map +0 -1
- package/build/chunk-RNIIXHL2.js +0 -2
- package/build/chunk-RNIIXHL2.js.map +0 -1
- package/build/compose.cjs +0 -2
- package/build/compose.cjs.map +0 -1
- package/build/compose.d.cts +0 -20
- package/build/compose.d.ts +0 -20
- package/build/compose.js +0 -2
- package/build/cv-BWSJNbxE.d.cts +0 -84
- package/build/cv-WFZM6Df-.d.ts +0 -84
- /package/build/{compose.js.map → extend.js.map} +0 -0
package/build/cv-BWSJNbxE.d.cts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { ClassValue } from 'clsx';
|
|
2
|
-
import { Opaque, Prettify, MarkRequired } from 'ts-essentials';
|
|
3
|
-
import { CN } from './cn.cjs';
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
declare function getKeys<O extends Record<string, unknown>>(obj: O): (keyof O)[];
|
|
20
|
-
type EntriesOf<O extends Record<string, unknown>> = {
|
|
21
|
-
[K in keyof O]: [K, O[K]];
|
|
22
|
-
};
|
|
23
|
-
declare function getEntries<O extends Record<string, unknown>>(obj: O): EntriesOf<O>[keyof EntriesOf<O>][];
|
|
24
|
-
type VariantMap<V extends CVVariantsSchema> = {
|
|
25
|
-
[K in keyof V]: BooleanStringToBoolean<keyof V[K] & CVVariantKey>[];
|
|
26
|
-
};
|
|
27
|
-
declare function getVariantMap<V extends CVVariantsSchema>(variants: V): VariantMap<V>;
|
|
28
|
-
interface CVUtils<V extends CVVariantsSchema, R extends keyof V = never> {
|
|
29
|
-
variantKeys: (keyof V & CVVariantKey)[];
|
|
30
|
-
variantMap: Prettify<VariantMap<V>>;
|
|
31
|
-
defaultVariants: Prettify<CVVariant<V>>;
|
|
32
|
-
requiredVariants: Prettify<Record<R, boolean>>;
|
|
33
|
-
}
|
|
34
|
-
interface AnyCVUtils {
|
|
35
|
-
variantKeys: string[];
|
|
36
|
-
variantMap: Record<string, CVPropsValue[]>;
|
|
37
|
-
defaultVariants: Record<string, CVPropsValue>;
|
|
38
|
-
requiredVariants: Record<string, boolean>;
|
|
39
|
-
}
|
|
40
|
-
declare function cvUtils<V extends CVVariantsSchema, R extends keyof V>({ variants, defaultVariants, requiredVariants, }: CVConfig<V, R>): CVUtils<V, R>;
|
|
41
|
-
|
|
42
|
-
type VariantProps<CVR extends AnyCVReturn> = CVR extends CVReturn<infer V, infer R> ? CVProps<V, R> : never;
|
|
43
|
-
type ClassProp = {
|
|
44
|
-
class?: ClassValue;
|
|
45
|
-
className?: never;
|
|
46
|
-
} | {
|
|
47
|
-
class?: never;
|
|
48
|
-
className?: ClassValue;
|
|
49
|
-
};
|
|
50
|
-
type WithClassProp<T extends object> = T & ClassProp;
|
|
51
|
-
type BooleanStringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
52
|
-
type CVVariantKey = string | number;
|
|
53
|
-
type CVVariantsSchema = Record<string, Record<CVVariantKey, ClassValue>>;
|
|
54
|
-
type CVVariant<V extends CVVariantsSchema> = {
|
|
55
|
-
[K in keyof V]?: BooleanStringToBoolean<keyof V[K] & CVVariantKey>;
|
|
56
|
-
};
|
|
57
|
-
type CVProps<V extends CVVariantsSchema, R extends keyof V = never> = MarkRequired<CVVariant<V>, R>;
|
|
58
|
-
type CVCompoundVariant<V extends CVVariantsSchema> = WithClassProp<{
|
|
59
|
-
[K in keyof V]?: BooleanStringToBoolean<keyof V[K] & CVVariantKey> | BooleanStringToBoolean<keyof V[K] & CVVariantKey>[] | CVToken;
|
|
60
|
-
}>;
|
|
61
|
-
type CVCompoundVariantsSchema<V extends CVVariantsSchema> = CVCompoundVariant<V>[];
|
|
62
|
-
interface CVConfig<V extends CVVariantsSchema, R extends keyof V> {
|
|
63
|
-
base?: ClassValue;
|
|
64
|
-
variants?: V;
|
|
65
|
-
compoundVariants?: CVCompoundVariantsSchema<V> | ((arg: CVUtils<V, R>) => CVCompoundVariantsSchema<V>);
|
|
66
|
-
defaultVariants?: CVVariant<V>;
|
|
67
|
-
requiredVariants?: Record<R, boolean>;
|
|
68
|
-
}
|
|
69
|
-
type CVReturnProps<V extends CVVariantsSchema, R extends keyof V = never> = WithClassProp<CVProps<V, R>> | ([R] extends [never] ? void : never);
|
|
70
|
-
interface CVReturn<V extends CVVariantsSchema, R extends keyof V = never> extends CVUtils<V, R> {
|
|
71
|
-
(props: CVReturnProps<V, R>): string;
|
|
72
|
-
}
|
|
73
|
-
interface AnyCVReturn extends AnyCVUtils {
|
|
74
|
-
(props: any): string;
|
|
75
|
-
}
|
|
76
|
-
interface CV {
|
|
77
|
-
<V extends CVVariantsSchema, R extends keyof V = never>(config: CVConfig<V, R>): CVReturn<V, R>;
|
|
78
|
-
}
|
|
79
|
-
declare function _cv({ cn }: {
|
|
80
|
-
cn: CN;
|
|
81
|
-
}): CV;
|
|
82
|
-
type CVPropsValue = CVVariantKey | boolean | undefined;
|
|
83
|
-
|
|
84
|
-
export { type AnyCVReturn as A, type BooleanStringToBoolean as B, type CV as C, type EntriesOf as E, type VariantProps as V, type WithClassProp as W, _cv as _, onlyWhenUndefined as a, type CVUtils as b, type CVReturn as c, type CVVariantsSchema as d, type CVCompoundVariantsSchema as e, type CVVariant as f, type CVCompoundVariant as g, type ClassProp as h, type CVToken as i, type AnyCVUtils as j, type CVConfig as k, isCVToken as l, getKeys as m, getEntries as n, onlyWhenDefined as o, type VariantMap as p, getVariantMap as q, cvUtils as r, shouldApplySelectorByToken as s, type CVVariantKey as t, type CVProps as u, type CVReturnProps as v, type CVPropsValue as w };
|
package/build/cv-WFZM6Df-.d.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { ClassValue } from 'clsx';
|
|
2
|
-
import { Opaque, Prettify, MarkRequired } from 'ts-essentials';
|
|
3
|
-
import { CN } from './cn.js';
|
|
4
|
-
|
|
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
|
-
|
|
19
|
-
declare function getKeys<O extends Record<string, unknown>>(obj: O): (keyof O)[];
|
|
20
|
-
type EntriesOf<O extends Record<string, unknown>> = {
|
|
21
|
-
[K in keyof O]: [K, O[K]];
|
|
22
|
-
};
|
|
23
|
-
declare function getEntries<O extends Record<string, unknown>>(obj: O): EntriesOf<O>[keyof EntriesOf<O>][];
|
|
24
|
-
type VariantMap<V extends CVVariantsSchema> = {
|
|
25
|
-
[K in keyof V]: BooleanStringToBoolean<keyof V[K] & CVVariantKey>[];
|
|
26
|
-
};
|
|
27
|
-
declare function getVariantMap<V extends CVVariantsSchema>(variants: V): VariantMap<V>;
|
|
28
|
-
interface CVUtils<V extends CVVariantsSchema, R extends keyof V = never> {
|
|
29
|
-
variantKeys: (keyof V & CVVariantKey)[];
|
|
30
|
-
variantMap: Prettify<VariantMap<V>>;
|
|
31
|
-
defaultVariants: Prettify<CVVariant<V>>;
|
|
32
|
-
requiredVariants: Prettify<Record<R, boolean>>;
|
|
33
|
-
}
|
|
34
|
-
interface AnyCVUtils {
|
|
35
|
-
variantKeys: string[];
|
|
36
|
-
variantMap: Record<string, CVPropsValue[]>;
|
|
37
|
-
defaultVariants: Record<string, CVPropsValue>;
|
|
38
|
-
requiredVariants: Record<string, boolean>;
|
|
39
|
-
}
|
|
40
|
-
declare function cvUtils<V extends CVVariantsSchema, R extends keyof V>({ variants, defaultVariants, requiredVariants, }: CVConfig<V, R>): CVUtils<V, R>;
|
|
41
|
-
|
|
42
|
-
type VariantProps<CVR extends AnyCVReturn> = CVR extends CVReturn<infer V, infer R> ? CVProps<V, R> : never;
|
|
43
|
-
type ClassProp = {
|
|
44
|
-
class?: ClassValue;
|
|
45
|
-
className?: never;
|
|
46
|
-
} | {
|
|
47
|
-
class?: never;
|
|
48
|
-
className?: ClassValue;
|
|
49
|
-
};
|
|
50
|
-
type WithClassProp<T extends object> = T & ClassProp;
|
|
51
|
-
type BooleanStringToBoolean<T> = T extends "true" | "false" ? boolean : T;
|
|
52
|
-
type CVVariantKey = string | number;
|
|
53
|
-
type CVVariantsSchema = Record<string, Record<CVVariantKey, ClassValue>>;
|
|
54
|
-
type CVVariant<V extends CVVariantsSchema> = {
|
|
55
|
-
[K in keyof V]?: BooleanStringToBoolean<keyof V[K] & CVVariantKey>;
|
|
56
|
-
};
|
|
57
|
-
type CVProps<V extends CVVariantsSchema, R extends keyof V = never> = MarkRequired<CVVariant<V>, R>;
|
|
58
|
-
type CVCompoundVariant<V extends CVVariantsSchema> = WithClassProp<{
|
|
59
|
-
[K in keyof V]?: BooleanStringToBoolean<keyof V[K] & CVVariantKey> | BooleanStringToBoolean<keyof V[K] & CVVariantKey>[] | CVToken;
|
|
60
|
-
}>;
|
|
61
|
-
type CVCompoundVariantsSchema<V extends CVVariantsSchema> = CVCompoundVariant<V>[];
|
|
62
|
-
interface CVConfig<V extends CVVariantsSchema, R extends keyof V> {
|
|
63
|
-
base?: ClassValue;
|
|
64
|
-
variants?: V;
|
|
65
|
-
compoundVariants?: CVCompoundVariantsSchema<V> | ((arg: CVUtils<V, R>) => CVCompoundVariantsSchema<V>);
|
|
66
|
-
defaultVariants?: CVVariant<V>;
|
|
67
|
-
requiredVariants?: Record<R, boolean>;
|
|
68
|
-
}
|
|
69
|
-
type CVReturnProps<V extends CVVariantsSchema, R extends keyof V = never> = WithClassProp<CVProps<V, R>> | ([R] extends [never] ? void : never);
|
|
70
|
-
interface CVReturn<V extends CVVariantsSchema, R extends keyof V = never> extends CVUtils<V, R> {
|
|
71
|
-
(props: CVReturnProps<V, R>): string;
|
|
72
|
-
}
|
|
73
|
-
interface AnyCVReturn extends AnyCVUtils {
|
|
74
|
-
(props: any): string;
|
|
75
|
-
}
|
|
76
|
-
interface CV {
|
|
77
|
-
<V extends CVVariantsSchema, R extends keyof V = never>(config: CVConfig<V, R>): CVReturn<V, R>;
|
|
78
|
-
}
|
|
79
|
-
declare function _cv({ cn }: {
|
|
80
|
-
cn: CN;
|
|
81
|
-
}): CV;
|
|
82
|
-
type CVPropsValue = CVVariantKey | boolean | undefined;
|
|
83
|
-
|
|
84
|
-
export { type AnyCVReturn as A, type BooleanStringToBoolean as B, type CV as C, type EntriesOf as E, type VariantProps as V, type WithClassProp as W, _cv as _, onlyWhenUndefined as a, type CVUtils as b, type CVReturn as c, type CVVariantsSchema as d, type CVCompoundVariantsSchema as e, type CVVariant as f, type CVCompoundVariant as g, type ClassProp as h, type CVToken as i, type AnyCVUtils as j, type CVConfig as k, isCVToken as l, getKeys as m, getEntries as n, onlyWhenDefined as o, type VariantMap as p, getVariantMap as q, cvUtils as r, shouldApplySelectorByToken as s, type CVVariantKey as t, type CVProps as u, type CVReturnProps as v, type CVPropsValue as w };
|
|
File without changes
|