@yaredfall/class-variants 0.6.0-rc.3 → 0.6.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.
Files changed (64) hide show
  1. package/LICENSE +1 -1
  2. package/build/chunk-36Z7UYAL.js +2 -0
  3. package/build/chunk-36Z7UYAL.js.map +1 -0
  4. package/build/chunk-BO7CCVZY.js +2 -0
  5. package/build/chunk-BO7CCVZY.js.map +1 -0
  6. package/build/chunk-LLMR7HCR.js +2 -0
  7. package/build/chunk-LLMR7HCR.js.map +1 -0
  8. package/build/{chunk-IMTFPGTY.js → chunk-N3ZCNVFV.js} +1 -1
  9. package/build/chunk-N3ZCNVFV.js.map +1 -0
  10. package/build/{chunk-FIET564E.js → chunk-O5WYIZI3.js} +1 -1
  11. package/build/chunk-O5WYIZI3.js.map +1 -0
  12. package/build/{chunk-32VQFSFZ.js → chunk-SJ6AQKOA.js} +1 -1
  13. package/build/chunk-SJ6AQKOA.js.map +1 -0
  14. package/build/cn.cjs.map +1 -1
  15. package/build/cn.js +1 -1
  16. package/build/cv-BA68QNCx.d.ts +79 -0
  17. package/build/cv-C4LDfd1S.d.cts +79 -0
  18. package/build/cv.cjs +1 -1
  19. package/build/cv.cjs.map +1 -1
  20. package/build/cv.d.cts +1 -1
  21. package/build/cv.d.ts +1 -1
  22. package/build/cv.js +1 -1
  23. package/build/define.cjs +1 -1
  24. package/build/define.cjs.map +1 -1
  25. package/build/define.d.cts +1 -1
  26. package/build/define.d.ts +1 -1
  27. package/build/define.js +1 -1
  28. package/build/extend.cjs +1 -1
  29. package/build/extend.cjs.map +1 -1
  30. package/build/extend.d.cts +5 -5
  31. package/build/extend.d.ts +5 -5
  32. package/build/extend.js +1 -1
  33. package/build/index.cjs +1 -1
  34. package/build/index.cjs.map +1 -1
  35. package/build/index.d.cts +2 -2
  36. package/build/index.d.ts +2 -2
  37. package/build/index.js +1 -1
  38. package/build/index.js.map +1 -1
  39. package/build/tokens.cjs.map +1 -1
  40. package/build/tokens.d.cts +1 -1
  41. package/build/tokens.d.ts +1 -1
  42. package/build/tokens.js +1 -1
  43. package/build/utils.cjs +1 -1
  44. package/build/utils.cjs.map +1 -1
  45. package/build/utils.d.cts +1 -1
  46. package/build/utils.d.ts +1 -1
  47. package/build/utils.js +1 -1
  48. package/build/vue.cjs +1 -1
  49. package/build/vue.cjs.map +1 -1
  50. package/build/vue.d.cts +2 -2
  51. package/build/vue.d.ts +2 -2
  52. package/build/vue.js.map +1 -1
  53. package/package.json +13 -13
  54. package/build/chunk-32VQFSFZ.js.map +0 -1
  55. package/build/chunk-FIET564E.js.map +0 -1
  56. package/build/chunk-FNDRMHIF.js +0 -2
  57. package/build/chunk-FNDRMHIF.js.map +0 -1
  58. package/build/chunk-G3WOK6WL.js +0 -2
  59. package/build/chunk-G3WOK6WL.js.map +0 -1
  60. package/build/chunk-IMTFPGTY.js.map +0 -1
  61. package/build/chunk-NDMNWVIC.js +0 -2
  62. package/build/chunk-NDMNWVIC.js.map +0 -1
  63. package/build/cv-B7zWq-Wg.d.cts +0 -78
  64. package/build/cv-BdqZkdFD.d.ts +0 -78
@@ -1,78 +0,0 @@
1
- import { ClassValue } from 'clsx';
2
- import { Opaque, Prettify, ArrayOrSingle } 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 & CVVariantKey)[];
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
- declare function splitProps<TProps>(props: TProps, shouldSplit: (key: keyof TProps) => boolean): readonly [Partial<Record<keyof TProps, unknown>>, Partial<Record<keyof TProps, unknown>>];
29
- interface CVUtils<V extends CVVariantsSchema> {
30
- variantKeys: (keyof V & string)[];
31
- variantMap: Prettify<VariantMap<V>>;
32
- splitVariantProps: <TProps extends CVReturnProps<V>>(props?: TProps) => [CVReturnProps<V>, Prettify<Omit<TProps, keyof CVReturnProps<V>>>];
33
- getVariantProps: (props?: CVReturnProps<V>) => Exclude<CVReturnProps<V>, void>;
34
- }
35
- declare function cvUtils<V extends CVVariantsSchema>(config: CVConfig<V>): CVUtils<V>;
36
-
37
- type VariantProps<CVR extends (props?: any) => string> = CVR extends CVReturn<infer V> ? CVProps<V> : never;
38
- type BooleanStringToBoolean<T> = T extends "true" | "false" ? boolean : T;
39
- type CVVariantKey = string | number;
40
- type CVVariantSchema = Record<CVVariantKey, ClassValue>;
41
- type CVVariantsSchema = Record<string, CVVariantSchema>;
42
- type CVVariant<V extends CVVariantsSchema> = {
43
- [K in keyof V]?: BooleanStringToBoolean<keyof V[K] & CVVariantKey>;
44
- };
45
- type CVProps<V extends CVVariantsSchema> = CVVariant<V>;
46
- type CVCompoundVariant<V extends CVVariantsSchema> = {
47
- [K in keyof V]?: ArrayOrSingle<BooleanStringToBoolean<keyof V[K] & CVVariantKey>> | CVToken;
48
- } & {
49
- class: ClassValue;
50
- };
51
- type CVCompoundVariantsSchema<V extends CVVariantsSchema> = CVCompoundVariant<V>[];
52
- type CVCompoundVariantsSchemaFunction<V extends CVVariantsSchema> = (utils: CVUtils<V>) => CVCompoundVariantsSchema<V>;
53
- interface CVConfig<V extends CVVariantsSchema> {
54
- base: ClassValue;
55
- variants: V;
56
- compoundVariants: CVCompoundVariantsSchema<V> | CVCompoundVariantsSchemaFunction<V>;
57
- defaultVariants: CVVariant<V>;
58
- }
59
- interface ResolvedCVConfig<V extends CVVariantsSchema> extends CVConfig<V> {
60
- compoundVariants: CVCompoundVariantsSchema<V>;
61
- }
62
- type CVReturnProps<V extends CVVariantsSchema> = CVProps<V>;
63
- interface CVReturn<V extends CVVariantsSchema> extends CVUtils<V> {
64
- (props?: CVReturnProps<V>, additionalClassName?: ClassValue): string;
65
- config: ResolvedCVConfig<V>;
66
- }
67
- interface CV {
68
- <V extends CVVariantsSchema>(config: Partial<CVConfig<V>>): CVReturn<V>;
69
- }
70
- interface CVOptions {
71
- cn: CN;
72
- }
73
- declare function _cv(options: CVOptions): CV;
74
- type CVPropsValue = CVVariantKey | boolean | undefined;
75
- declare function resolveConfig<V extends CVVariantsSchema>(config: Partial<CVConfig<V>>): [ResolvedCVConfig<V>, CVUtils<V>];
76
- declare function resolveCompoundVariants<V extends CVVariantsSchema>(compoundVariants: CVConfig<V>["compoundVariants"], utils: CVUtils<V>): CVCompoundVariantsSchema<V>;
77
-
78
- export { type BooleanStringToBoolean as B, type CV as C, type EntriesOf as E, type ResolvedCVConfig as R, type VariantProps as V, _cv as _, onlyWhenUndefined as a, type CVCompoundVariant as b, type CVCompoundVariantsSchema as c, type CVReturn as d, type CVToken as e, type CVUtils as f, type CVVariant as g, type CVVariantsSchema as h, type CVVariantSchema as i, type CVCompoundVariantsSchemaFunction 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 CVVariantKey as t, type CVProps as u, type CVConfig as v, type CVReturnProps as w, type CVPropsValue as x, resolveConfig as y, resolveCompoundVariants as z };
@@ -1,78 +0,0 @@
1
- import { ClassValue } from 'clsx';
2
- import { Opaque, Prettify, ArrayOrSingle } 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 & CVVariantKey)[];
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
- declare function splitProps<TProps>(props: TProps, shouldSplit: (key: keyof TProps) => boolean): readonly [Partial<Record<keyof TProps, unknown>>, Partial<Record<keyof TProps, unknown>>];
29
- interface CVUtils<V extends CVVariantsSchema> {
30
- variantKeys: (keyof V & string)[];
31
- variantMap: Prettify<VariantMap<V>>;
32
- splitVariantProps: <TProps extends CVReturnProps<V>>(props?: TProps) => [CVReturnProps<V>, Prettify<Omit<TProps, keyof CVReturnProps<V>>>];
33
- getVariantProps: (props?: CVReturnProps<V>) => Exclude<CVReturnProps<V>, void>;
34
- }
35
- declare function cvUtils<V extends CVVariantsSchema>(config: CVConfig<V>): CVUtils<V>;
36
-
37
- type VariantProps<CVR extends (props?: any) => string> = CVR extends CVReturn<infer V> ? CVProps<V> : never;
38
- type BooleanStringToBoolean<T> = T extends "true" | "false" ? boolean : T;
39
- type CVVariantKey = string | number;
40
- type CVVariantSchema = Record<CVVariantKey, ClassValue>;
41
- type CVVariantsSchema = Record<string, CVVariantSchema>;
42
- type CVVariant<V extends CVVariantsSchema> = {
43
- [K in keyof V]?: BooleanStringToBoolean<keyof V[K] & CVVariantKey>;
44
- };
45
- type CVProps<V extends CVVariantsSchema> = CVVariant<V>;
46
- type CVCompoundVariant<V extends CVVariantsSchema> = {
47
- [K in keyof V]?: ArrayOrSingle<BooleanStringToBoolean<keyof V[K] & CVVariantKey>> | CVToken;
48
- } & {
49
- class: ClassValue;
50
- };
51
- type CVCompoundVariantsSchema<V extends CVVariantsSchema> = CVCompoundVariant<V>[];
52
- type CVCompoundVariantsSchemaFunction<V extends CVVariantsSchema> = (utils: CVUtils<V>) => CVCompoundVariantsSchema<V>;
53
- interface CVConfig<V extends CVVariantsSchema> {
54
- base: ClassValue;
55
- variants: V;
56
- compoundVariants: CVCompoundVariantsSchema<V> | CVCompoundVariantsSchemaFunction<V>;
57
- defaultVariants: CVVariant<V>;
58
- }
59
- interface ResolvedCVConfig<V extends CVVariantsSchema> extends CVConfig<V> {
60
- compoundVariants: CVCompoundVariantsSchema<V>;
61
- }
62
- type CVReturnProps<V extends CVVariantsSchema> = CVProps<V>;
63
- interface CVReturn<V extends CVVariantsSchema> extends CVUtils<V> {
64
- (props?: CVReturnProps<V>, additionalClassName?: ClassValue): string;
65
- config: ResolvedCVConfig<V>;
66
- }
67
- interface CV {
68
- <V extends CVVariantsSchema>(config: Partial<CVConfig<V>>): CVReturn<V>;
69
- }
70
- interface CVOptions {
71
- cn: CN;
72
- }
73
- declare function _cv(options: CVOptions): CV;
74
- type CVPropsValue = CVVariantKey | boolean | undefined;
75
- declare function resolveConfig<V extends CVVariantsSchema>(config: Partial<CVConfig<V>>): [ResolvedCVConfig<V>, CVUtils<V>];
76
- declare function resolveCompoundVariants<V extends CVVariantsSchema>(compoundVariants: CVConfig<V>["compoundVariants"], utils: CVUtils<V>): CVCompoundVariantsSchema<V>;
77
-
78
- export { type BooleanStringToBoolean as B, type CV as C, type EntriesOf as E, type ResolvedCVConfig as R, type VariantProps as V, _cv as _, onlyWhenUndefined as a, type CVCompoundVariant as b, type CVCompoundVariantsSchema as c, type CVReturn as d, type CVToken as e, type CVUtils as f, type CVVariant as g, type CVVariantsSchema as h, type CVVariantSchema as i, type CVCompoundVariantsSchemaFunction 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 CVVariantKey as t, type CVProps as u, type CVConfig as v, type CVReturnProps as w, type CVPropsValue as x, resolveConfig as y, resolveCompoundVariants as z };