tailwind-variants 0.0.7 → 0.0.8

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 (2) hide show
  1. package/dist/index.d.ts +13 -14
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,28 +1,25 @@
1
1
  import {TVConfig} from "./config";
2
- import {
3
- ClassValue,
4
- ClassProp,
5
- OmitUndefined,
6
- StringToBoolean,
7
- StringArrayToFunctions,
8
- AddItemToArray,
9
- } from "./utils";
2
+ import {ClassValue, ClassProp, OmitUndefined, StringToBoolean, AddItemToArray} from "./utils";
10
3
 
11
4
  type TVDefaultSlot = "";
12
5
  type TVBaseName = "base";
13
6
 
7
+ type SlotsWithBase<S extends string[]> = AddItemToArray<S, TVBaseName>;
8
+
9
+ type SlotsClassValue<S extends string[]> = {
10
+ [K in SlotsWithBase<S>[number]]: ClassValue;
11
+ };
12
+
14
13
  export declare type TVVariants<S extends string[]> = {
15
14
  [key: string]: {
16
- [key: string]: S extends TVDefaultSlot
17
- ? ClassValue
18
- : {[P in S[number]]?: ClassValue} | ClassValue;
15
+ [key: string]: S extends TVDefaultSlot ? ClassValue : SlotsClassValue<S> | ClassValue;
19
16
  };
20
17
  };
21
18
 
22
19
  export declare type TVCompoundVariants<V extends TVVariants<S>, S extends string[]> = Array<
23
20
  {
24
21
  [K in keyof V]?: StringToBoolean<keyof V[K]>;
25
- } & ClassProp<{[K in S[number]]?: ClassValue} | ClassValue>
22
+ } & ClassProp<SlotsClassValue<S> | ClassValue>
26
23
  >;
27
24
 
28
25
  export declare type TVDefaultVariants<V extends TVVariants<S>, S extends string[]> = {
@@ -37,12 +34,14 @@ export declare type TVReturnType<V extends TVVariants<S>, S extends string> = (
37
34
  props?: TVProps<V, S[]>,
38
35
  ) => S extends TVDefaultSlot
39
36
  ? string
40
- : StringArrayToFunctions<AddItemToArray<S[], TVBaseName>, ClassProp>;
37
+ : {
38
+ [K in SlotsWithBase<S[]>[number]]: (props?: ClassProp) => string;
39
+ };
41
40
 
42
41
  export declare function tv<
43
42
  V extends TVVariants<S[]>,
44
- CV extends TVCompoundVariants<V, S[]>,
45
43
  DV extends TVDefaultVariants<V, S[]>,
44
+ CV extends TVCompoundVariants<V, S[]>,
46
45
  C extends TVConfig,
47
46
  S extends string = TVDefaultSlot,
48
47
  >(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-variants",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "🦄 Tailwindcss first-class variant API",
5
5
  "author": "Junior Garcia <jrgarciadev@gmail.com>",
6
6
  "license": "MIT",