tailwind-to-style 3.3.0 → 4.0.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/README.md +208 -1118
- package/dist/animations/index.cjs +9391 -0
- package/dist/animations/index.d.ts +58 -0
- package/dist/animations/index.esm.js +9385 -0
- package/dist/animations/index.esm.js.map +1 -0
- package/dist/className/index.cjs +2241 -4181
- package/dist/className/index.esm.js +2241 -4181
- package/dist/className/index.esm.js.map +1 -1
- package/dist/core/tws.cjs +136 -114
- package/dist/core/tws.cjs.map +1 -0
- package/dist/core/tws.esm.js +136 -114
- package/dist/core/tws.esm.js.map +1 -1
- package/dist/core/twsx.cjs +1971 -3970
- package/dist/core/twsx.esm.js +1971 -3970
- package/dist/core/twsx.esm.js.map +1 -1
- package/dist/core/twsxVariants.cjs +1997 -3986
- package/dist/core/twsxVariants.esm.js +1997 -3986
- package/dist/core/twsxVariants.esm.js.map +1 -1
- package/dist/cx.cjs +2 -2
- package/dist/cx.cjs.map +1 -0
- package/dist/cx.esm.js +2 -2
- package/dist/index.cjs +5253 -9252
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.esm.js +5251 -9201
- package/dist/index.esm.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/react/index.cjs +10177 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.ts +69 -0
- package/dist/react/index.esm.js +10173 -0
- package/dist/react/index.esm.js.map +1 -0
- package/dist/styled/index.cjs +9094 -0
- package/dist/styled/index.cjs.map +1 -0
- package/dist/styled/index.d.ts +17 -0
- package/dist/styled/index.esm.js +9087 -0
- package/dist/styled/index.esm.js.map +1 -0
- package/dist/tokens/index.cjs +359 -0
- package/dist/tokens/index.d.ts +33 -0
- package/dist/tokens/index.esm.js +355 -0
- package/dist/tokens/index.esm.js.map +1 -0
- package/dist/utils/index.cjs +219 -270
- package/dist/utils/index.esm.js +219 -270
- package/dist/utils/index.esm.js.map +1 -1
- package/package.json +33 -24
- package/types/animations/index.d.ts +58 -0
- package/types/index.d.ts +4 -1
- package/types/react/index.d.ts +69 -0
- package/types/tokens/index.d.ts +33 -0
- package/types/v4.d.ts +191 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Type definitions for tailwind-to-style/react
|
|
2
|
+
|
|
3
|
+
import { ComponentType, ForwardRefExoticComponent, PropsWithoutRef, RefAttributes } from 'react';
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// styled()
|
|
7
|
+
// ============================================================================
|
|
8
|
+
|
|
9
|
+
type IntrinsicElement = keyof JSX.IntrinsicElements;
|
|
10
|
+
|
|
11
|
+
interface StyledConfig<V extends Record<string, Record<string, string>> = {}> {
|
|
12
|
+
name?: string;
|
|
13
|
+
base?: string;
|
|
14
|
+
variants?: V;
|
|
15
|
+
defaultVariants?: { [K in keyof V]?: keyof V[K] };
|
|
16
|
+
compoundVariants?: Array<{ class?: string; className?: string; [key: string]: any }>;
|
|
17
|
+
slots?: Record<string, string>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type VariantProps<V extends Record<string, Record<string, string>>> = {
|
|
21
|
+
[K in keyof V]?: keyof V[K];
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type StyledComponent<
|
|
25
|
+
T extends IntrinsicElement | ComponentType<any>,
|
|
26
|
+
V extends Record<string, Record<string, string>>
|
|
27
|
+
> = ForwardRefExoticComponent<
|
|
28
|
+
PropsWithoutRef<
|
|
29
|
+
(T extends IntrinsicElement ? JSX.IntrinsicElements[T] : T extends ComponentType<infer P> ? P : never) &
|
|
30
|
+
VariantProps<V> & { className?: string }
|
|
31
|
+
> &
|
|
32
|
+
RefAttributes<T extends IntrinsicElement ? HTMLElement : any>
|
|
33
|
+
> & {
|
|
34
|
+
variants: any;
|
|
35
|
+
raw: StyledConfig<V>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export declare function styled<
|
|
39
|
+
T extends IntrinsicElement | ComponentType<any>,
|
|
40
|
+
V extends Record<string, Record<string, string>> = {}
|
|
41
|
+
>(
|
|
42
|
+
element: T,
|
|
43
|
+
config?: StyledConfig<V>
|
|
44
|
+
): StyledComponent<T, V>;
|
|
45
|
+
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// ThemeProvider & useTheme
|
|
48
|
+
// ============================================================================
|
|
49
|
+
|
|
50
|
+
interface ThemeProviderProps {
|
|
51
|
+
theme: Record<string, any>;
|
|
52
|
+
name?: string;
|
|
53
|
+
children: React.ReactNode;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface ThemeContextValue {
|
|
57
|
+
theme: Record<string, any>;
|
|
58
|
+
setTheme: (newTheme: Record<string, any>) => void;
|
|
59
|
+
tokens: Record<string, any>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare function ThemeProvider(props: ThemeProviderProps): JSX.Element;
|
|
63
|
+
export declare function useTheme(): ThemeContextValue;
|
|
64
|
+
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// useTws
|
|
67
|
+
// ============================================================================
|
|
68
|
+
|
|
69
|
+
export declare function useTws(classes: string): Record<string, string>;
|