native-variants 0.1.63 → 0.1.69
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/LICENSE +21 -21
- package/README.md +125 -125
- package/dist/example.js +1 -0
- package/dist/index.d.ts +17 -8
- package/dist/index.js +72 -22
- package/dist/index.js.map +1 -1
- package/dist/lib/cn.d.ts +82 -2
- package/dist/lib/cn.js +138 -8
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/create-nva.d.ts +209 -6
- package/dist/lib/create-nva.js +460 -47
- package/dist/lib/create-nva.js.map +1 -1
- package/dist/lib/media-query.d.ts +84 -2
- package/dist/lib/media-query.js +103 -9
- package/dist/lib/media-query.js.map +1 -1
- package/dist/provider/create-provider.d.ts +44 -4
- package/dist/provider/create-provider.js +1 -1
- package/dist/provider/create-provider.jsx +110 -9
- package/dist/provider/create-provider.jsx.map +1 -1
- package/dist/provider/theme-provider.d.ts +266 -0
- package/dist/provider/theme-provider.js +1 -0
- package/dist/provider/theme-provider.jsx +328 -0
- package/dist/provider/theme-provider.jsx.map +1 -0
- package/dist/tokens/default-tokens.d.ts +2737 -0
- package/dist/tokens/default-tokens.js +1067 -0
- package/dist/tokens/default-tokens.js.map +1 -0
- package/dist/types.d.ts +318 -3
- package/dist/utils/alpha.d.ts +68 -0
- package/dist/utils/alpha.js +147 -4
- package/dist/utils/alpha.js.map +1 -1
- package/dist/utils/compose-text.d.ts +64 -2
- package/dist/utils/compose-text.js +103 -3
- package/dist/utils/compose-text.js.map +1 -1
- package/package.json +1 -1
- package/dist/utils/compose-refs.d.ts +0 -4
- package/dist/utils/compose-refs.js +0 -39
- package/dist/utils/compose-refs.js.map +0 -1
package/dist/lib/cn.js
CHANGED
|
@@ -1,21 +1,151 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.cn = cn;
|
|
4
|
+
exports.cnView = cnView;
|
|
5
|
+
exports.cnText = cnText;
|
|
6
|
+
exports.cnImage = cnImage;
|
|
7
|
+
/**
|
|
8
|
+
* Flattens a potentially nested style into an array of style objects.
|
|
9
|
+
* Handles arrays, nested arrays, and single style objects.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The style type
|
|
12
|
+
* @param style - The style to flatten
|
|
13
|
+
* @returns An array of flattened style objects
|
|
14
|
+
*/
|
|
4
15
|
function flattenStyle(style) {
|
|
5
16
|
if (!style)
|
|
6
17
|
return [];
|
|
7
18
|
if (Array.isArray(style)) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
19
|
+
const result = [];
|
|
20
|
+
for (let i = 0; i < style.length; i++) {
|
|
21
|
+
const item = style[i];
|
|
22
|
+
if (item) {
|
|
23
|
+
if (Array.isArray(item)) {
|
|
24
|
+
// Handle nested arrays
|
|
25
|
+
const nested = flattenStyle(item);
|
|
26
|
+
for (let j = 0; j < nested.length; j++) {
|
|
27
|
+
result.push(nested[j]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
result.push(item);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
11
36
|
}
|
|
12
|
-
// @ts-ignore
|
|
13
37
|
return [style];
|
|
14
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Merges multiple style objects into a single style object.
|
|
41
|
+
* Optimized for performance with early returns and efficient iteration.
|
|
42
|
+
*
|
|
43
|
+
* @template T - The output style type
|
|
44
|
+
* @param styles - Array of styles to merge
|
|
45
|
+
* @returns A single merged style object
|
|
46
|
+
*/
|
|
47
|
+
function mergeStyles(styles) {
|
|
48
|
+
if (styles.length === 0)
|
|
49
|
+
return {};
|
|
50
|
+
if (styles.length === 1 && styles[0] && typeof styles[0] === "object") {
|
|
51
|
+
return styles[0];
|
|
52
|
+
}
|
|
53
|
+
const result = {};
|
|
54
|
+
for (let i = 0; i < styles.length; i++) {
|
|
55
|
+
const style = styles[i];
|
|
56
|
+
if (!style || typeof style !== "object")
|
|
57
|
+
continue;
|
|
58
|
+
const keys = Object.keys(style);
|
|
59
|
+
for (let j = 0; j < keys.length; j++) {
|
|
60
|
+
const key = keys[j];
|
|
61
|
+
const value = style[key];
|
|
62
|
+
if (value !== undefined) {
|
|
63
|
+
result[key] = value;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Combines multiple style objects into a single merged style.
|
|
71
|
+
* Supports React Native StyleProp, animated styles from react-native-reanimated,
|
|
72
|
+
* and regular style objects.
|
|
73
|
+
*
|
|
74
|
+
* Features:
|
|
75
|
+
* - Handles nested style arrays
|
|
76
|
+
* - Compatible with react-native-reanimated animated styles
|
|
77
|
+
* - Filters out null/undefined values
|
|
78
|
+
* - Returns a properly typed style object
|
|
79
|
+
*
|
|
80
|
+
* @param styles - Variable number of style inputs to merge
|
|
81
|
+
* @returns A single merged style object
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* // Basic usage
|
|
86
|
+
* const style = cn(styles.root, { padding: 16 });
|
|
87
|
+
*
|
|
88
|
+
* // With animated styles (react-native-reanimated)
|
|
89
|
+
* const animatedStyle = useAnimatedStyle(() => ({
|
|
90
|
+
* transform: [{ translateX: translateX.value }],
|
|
91
|
+
* }));
|
|
92
|
+
* const style = cn(styles.wrapper, animatedStyle);
|
|
93
|
+
*
|
|
94
|
+
* // Multiple styles
|
|
95
|
+
* const style = cn(
|
|
96
|
+
* baseStyles,
|
|
97
|
+
* conditionalStyles,
|
|
98
|
+
* { opacity: isVisible ? 1 : 0 }
|
|
99
|
+
* );
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
15
102
|
function cn(...styles) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
103
|
+
const flattened = [];
|
|
104
|
+
for (let i = 0; i < styles.length; i++) {
|
|
105
|
+
const style = styles[i];
|
|
106
|
+
if (!style)
|
|
107
|
+
continue;
|
|
108
|
+
if (Array.isArray(style)) {
|
|
109
|
+
const nested = flattenStyle(style);
|
|
110
|
+
for (let j = 0; j < nested.length; j++) {
|
|
111
|
+
if (nested[j])
|
|
112
|
+
flattened.push(nested[j]);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else if (typeof style === "object") {
|
|
116
|
+
flattened.push(style);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return mergeStyles(flattened);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Type-safe version of cn specifically for ViewStyle.
|
|
123
|
+
* Use this when you need explicit ViewStyle typing.
|
|
124
|
+
*
|
|
125
|
+
* @param styles - Variable number of style inputs to merge
|
|
126
|
+
* @returns A merged ViewStyle object
|
|
127
|
+
*/
|
|
128
|
+
function cnView(...styles) {
|
|
129
|
+
return cn(...styles);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Type-safe version of cn specifically for TextStyle.
|
|
133
|
+
* Use this when you need explicit TextStyle typing.
|
|
134
|
+
*
|
|
135
|
+
* @param styles - Variable number of style inputs to merge
|
|
136
|
+
* @returns A merged TextStyle object
|
|
137
|
+
*/
|
|
138
|
+
function cnText(...styles) {
|
|
139
|
+
return cn(...styles);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Type-safe version of cn specifically for ImageStyle.
|
|
143
|
+
* Use this when you need explicit ImageStyle typing.
|
|
144
|
+
*
|
|
145
|
+
* @param styles - Variable number of style inputs to merge
|
|
146
|
+
* @returns A merged ImageStyle object
|
|
147
|
+
*/
|
|
148
|
+
function cnImage(...styles) {
|
|
149
|
+
return cn(...styles);
|
|
20
150
|
}
|
|
21
151
|
//# sourceMappingURL=cn.js.map
|
package/dist/lib/cn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cn.js","sourceRoot":"","sources":["../../src/lib/cn.ts"],"names":[],"mappings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,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,IAAI,MAAM,CAAC,CAAC,CAAC;oBAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,WAAW,CAAI,SAAS,CAAC,CAAC;AACnC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM,CAAC,GAAG,MAAoB;IAC5C,OAAO,EAAE,CAAY,GAAG,MAAM,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,MAAM,CAAC,GAAG,MAAoB;IAC5C,OAAO,EAAE,CAAY,GAAG,MAAM,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAC,GAAG,MAAoB;IAC7C,OAAO,EAAE,CAAa,GAAG,MAAM,CAAC,CAAC;AACnC,CAAC"}
|
package/dist/lib/create-nva.d.ts
CHANGED
|
@@ -1,11 +1,214 @@
|
|
|
1
|
-
import type { Base, Config, DefaultVariants,
|
|
1
|
+
import type { Base, ColorSchemeConfig, Config, ConfigWithUtils, DefaultVariants, DefaultVariantsWithUtils, UtilsConfig, Variants, VariantsWithUtils } from "../types.js";
|
|
2
|
+
import { tailwindColors, tailwindSpacing, tailwindFontSizes, tailwindRadii, tailwindShadows, tailwindZIndex, tailwindOpacity, tailwindLineHeights, tailwindFontWeights, tailwindLetterSpacing, tailwindBorderWidths, tailwindDurations } from "../tokens/default-tokens.js";
|
|
3
|
+
/**
|
|
4
|
+
* Creates a styled component function with variant support.
|
|
5
|
+
* Provides caching for optimal performance in React Native.
|
|
6
|
+
*
|
|
7
|
+
* @template S - Union type of slot names
|
|
8
|
+
* @template V - Variants configuration type
|
|
9
|
+
*
|
|
10
|
+
* @param config - The styled component configuration
|
|
11
|
+
* @returns A function that computes styles based on variant props
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const buttonStyles = styled({
|
|
16
|
+
* slots: ["root", "text"],
|
|
17
|
+
* base: {
|
|
18
|
+
* root: { padding: 16 },
|
|
19
|
+
* text: { fontSize: 14 }
|
|
20
|
+
* },
|
|
21
|
+
* variants: {
|
|
22
|
+
* size: {
|
|
23
|
+
* small: { root: { padding: 8 } },
|
|
24
|
+
* large: { root: { padding: 24 } }
|
|
25
|
+
* }
|
|
26
|
+
* },
|
|
27
|
+
* defaultVariants: {
|
|
28
|
+
* size: "small"
|
|
29
|
+
* }
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* // Usage
|
|
33
|
+
* const styles = buttonStyles({ size: "large" });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
2
36
|
export declare function styled<const S extends string, V extends Variants<S>>(config: Config<S, V>): (props?: DefaultVariants<S, V>) => Base<S>;
|
|
3
|
-
|
|
4
|
-
|
|
37
|
+
/**
|
|
38
|
+
* Validates that two record types have the same keys.
|
|
39
|
+
* Returns true type if valid, error message type if not.
|
|
40
|
+
*/
|
|
41
|
+
type ValidateColorKeys<D extends Record<string, string>, K extends Record<string, string>> = Exclude<keyof K, keyof D> extends never ? Exclude<keyof D, keyof K> extends never ? true : {
|
|
42
|
+
_error: "⚠️ 'dark' is missing colors that exist in 'default'";
|
|
43
|
+
missingInDark: Exclude<keyof D, keyof K>;
|
|
44
|
+
} : {
|
|
45
|
+
_error: "⚠️ 'default' is missing colors that exist in 'dark'";
|
|
46
|
+
missingInDefault: Exclude<keyof K, keyof D>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Theme configuration input for createNVA.
|
|
50
|
+
* Colors must have matching keys in default and dark.
|
|
51
|
+
*/
|
|
52
|
+
interface CreateNVATheme<D extends Record<string, string>, K extends Record<string, string>> {
|
|
53
|
+
colors: {
|
|
54
|
+
/** Light theme colors (default) */
|
|
55
|
+
default: D;
|
|
56
|
+
/** Dark theme colors - must have exactly the same keys as default */
|
|
57
|
+
dark: ValidateColorKeys<D, K> extends true ? K : ValidateColorKeys<D, K>;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Creates a themed NVA (Native Variants API) instance.
|
|
62
|
+
* Provides a styled function with access to theme tokens and custom utils.
|
|
63
|
+
*
|
|
64
|
+
* Colors support light/dark mode via `default` and `dark` keys.
|
|
65
|
+
* Both must have the same color keys for type safety - TypeScript will
|
|
66
|
+
* error if dark is missing any keys from default or vice versa.
|
|
67
|
+
*
|
|
68
|
+
* Utils are style shortcuts that expand to multiple CSS properties.
|
|
69
|
+
* They work like Stitches utils - you define them once and use them
|
|
70
|
+
* throughout your styles.
|
|
71
|
+
*
|
|
72
|
+
* Tailwind CSS tokens (spacing, fontSizes, radii, etc.) are included by default.
|
|
73
|
+
*
|
|
74
|
+
* @template D - Default colors type (inferred from colors.default)
|
|
75
|
+
* @template K - Dark colors type (must have same keys as D)
|
|
76
|
+
* @template U - Utils configuration type
|
|
77
|
+
*
|
|
78
|
+
* @param options - Configuration options
|
|
79
|
+
* @param options.theme - Theme configuration with colors (default/dark)
|
|
80
|
+
* @param options.utils - Custom style utilities (like Stitches)
|
|
81
|
+
* @returns An object containing the flattened theme, styled function, and utils
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const { styled, theme, colorScheme, utils } = createNVA({
|
|
86
|
+
* theme: {
|
|
87
|
+
* colors: {
|
|
88
|
+
* default: {
|
|
89
|
+
* primary: "#007AFF",
|
|
90
|
+
* background: "#FFFFFF",
|
|
91
|
+
* },
|
|
92
|
+
* dark: {
|
|
93
|
+
* primary: "#0A84FF",
|
|
94
|
+
* background: "#000000",
|
|
95
|
+
* },
|
|
96
|
+
* },
|
|
97
|
+
* },
|
|
98
|
+
* utils: {
|
|
99
|
+
* // Margin shortcuts
|
|
100
|
+
* mx: (value) => ({ marginLeft: value, marginRight: value }),
|
|
101
|
+
* my: (value) => ({ marginTop: value, marginBottom: value }),
|
|
102
|
+
* // Padding shortcuts
|
|
103
|
+
* px: (value) => ({ paddingLeft: value, paddingRight: value }),
|
|
104
|
+
* py: (value) => ({ paddingTop: value, paddingBottom: value }),
|
|
105
|
+
* // Size shortcut
|
|
106
|
+
* size: (value) => ({ width: value, height: value }),
|
|
107
|
+
* },
|
|
108
|
+
* });
|
|
109
|
+
*
|
|
110
|
+
* // Use utils in your styles!
|
|
111
|
+
* const buttonStyles = styled((ctx, t) => ctx({
|
|
112
|
+
* slots: ["root"],
|
|
113
|
+
* base: {
|
|
114
|
+
* root: {
|
|
115
|
+
* backgroundColor: t.colors.primary,
|
|
116
|
+
* px: 16, // → paddingLeft: 16, paddingRight: 16
|
|
117
|
+
* py: 12, // → paddingTop: 12, paddingBottom: 12
|
|
118
|
+
* },
|
|
119
|
+
* },
|
|
120
|
+
* }));
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
export declare function createNVA<D extends Record<string, string>, K extends Record<string, string> = D, U extends UtilsConfig = {}>(options?: {
|
|
124
|
+
theme?: CreateNVATheme<D, K>;
|
|
125
|
+
utils?: U;
|
|
5
126
|
}): {
|
|
6
|
-
|
|
127
|
+
/**
|
|
128
|
+
* The resolved theme object with flattened colors.
|
|
129
|
+
* Colors use the default (light) scheme.
|
|
130
|
+
* Use ThemeProvider to access dark mode colors.
|
|
131
|
+
*/
|
|
132
|
+
theme: {
|
|
133
|
+
/**
|
|
134
|
+
* Colors: User-defined semantic colors merged with Tailwind palette.
|
|
135
|
+
* User colors override Tailwind colors if keys conflict.
|
|
136
|
+
*/
|
|
137
|
+
colors: typeof tailwindColors & D;
|
|
138
|
+
/** Spacing scale (0, px, 0.5, 1, 2, 4, 8, etc.) */
|
|
139
|
+
spacing: typeof tailwindSpacing;
|
|
140
|
+
/** Font size scale (xs, sm, base, lg, xl, 2xl, etc.) */
|
|
141
|
+
fontSizes: typeof tailwindFontSizes;
|
|
142
|
+
/** Border radius scale (none, sm, md, lg, xl, full, etc.) */
|
|
143
|
+
radii: typeof tailwindRadii;
|
|
144
|
+
/** Shadow definitions for iOS and Android */
|
|
145
|
+
shadows: typeof tailwindShadows;
|
|
146
|
+
/** Z-index scale (0, 10, 20, 30, 40, 50) */
|
|
147
|
+
zIndex: typeof tailwindZIndex;
|
|
148
|
+
/** Opacity scale (0, 5, 10, ..., 95, 100) */
|
|
149
|
+
opacity: typeof tailwindOpacity;
|
|
150
|
+
/** Line height scale (3, 4, ..., 10, none, tight, normal, etc.) */
|
|
151
|
+
lineHeights: typeof tailwindLineHeights;
|
|
152
|
+
/** Font weight scale (thin, light, normal, medium, bold, etc.) */
|
|
153
|
+
fontWeights: typeof tailwindFontWeights;
|
|
154
|
+
/** Letter spacing scale (tighter, tight, normal, wide, wider, widest) */
|
|
155
|
+
letterSpacing: typeof tailwindLetterSpacing;
|
|
156
|
+
/** Border width scale (0, DEFAULT, 2, 4, 8) */
|
|
157
|
+
borderWidths: typeof tailwindBorderWidths;
|
|
158
|
+
/** Animation duration scale (0, 75, 100, 150, 200, 300, 500, 700, 1000) */
|
|
159
|
+
durations: typeof tailwindDurations;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* The color scheme configuration with both default and dark colors.
|
|
163
|
+
* Pass this to ThemeProvider for dark mode support.
|
|
164
|
+
*/
|
|
165
|
+
colorScheme: ColorSchemeConfig<D> | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Creates styled components with variant support and theme access.
|
|
168
|
+
* Utils defined in createNVA are automatically expanded in styles.
|
|
169
|
+
*/
|
|
7
170
|
styled: {
|
|
8
|
-
<S extends string, V extends
|
|
9
|
-
<const S extends string, V extends
|
|
171
|
+
<const S extends string, const V extends VariantsWithUtils<S, U>>(config: ConfigWithUtils<S, V, U>): (props?: DefaultVariantsWithUtils<S, V, U>) => Base<S>;
|
|
172
|
+
<const S extends string, const V extends VariantsWithUtils<S, U>>(configFactory: (defineConfig: <const S_1 extends string, const V_1 extends VariantsWithUtils<S_1, U>>(config: ConfigWithUtils<S_1, V_1, U>) => ConfigWithUtils<S_1, V_1, U>, theme: {
|
|
173
|
+
/**
|
|
174
|
+
* Colors: User-defined semantic colors merged with Tailwind palette.
|
|
175
|
+
* User colors override Tailwind colors if keys conflict.
|
|
176
|
+
*/
|
|
177
|
+
colors: typeof tailwindColors & D;
|
|
178
|
+
/** Spacing scale (0, px, 0.5, 1, 2, 4, 8, etc.) */
|
|
179
|
+
spacing: typeof tailwindSpacing;
|
|
180
|
+
/** Font size scale (xs, sm, base, lg, xl, 2xl, etc.) */
|
|
181
|
+
fontSizes: typeof tailwindFontSizes;
|
|
182
|
+
/** Border radius scale (none, sm, md, lg, xl, full, etc.) */
|
|
183
|
+
radii: typeof tailwindRadii;
|
|
184
|
+
/** Shadow definitions for iOS and Android */
|
|
185
|
+
shadows: typeof tailwindShadows;
|
|
186
|
+
/** Z-index scale (0, 10, 20, 30, 40, 50) */
|
|
187
|
+
zIndex: typeof tailwindZIndex;
|
|
188
|
+
/** Opacity scale (0, 5, 10, ..., 95, 100) */
|
|
189
|
+
opacity: typeof tailwindOpacity;
|
|
190
|
+
/** Line height scale (3, 4, ..., 10, none, tight, normal, etc.) */
|
|
191
|
+
lineHeights: typeof tailwindLineHeights;
|
|
192
|
+
/** Font weight scale (thin, light, normal, medium, bold, etc.) */
|
|
193
|
+
fontWeights: typeof tailwindFontWeights;
|
|
194
|
+
/** Letter spacing scale (tighter, tight, normal, wide, wider, widest) */
|
|
195
|
+
letterSpacing: typeof tailwindLetterSpacing;
|
|
196
|
+
/** Border width scale (0, DEFAULT, 2, 4, 8) */
|
|
197
|
+
borderWidths: typeof tailwindBorderWidths;
|
|
198
|
+
/** Animation duration scale (0, 75, 100, 150, 200, 300, 500, 700, 1000) */
|
|
199
|
+
durations: typeof tailwindDurations;
|
|
200
|
+
}) => ConfigWithUtils<S, V, U>): (props?: DefaultVariantsWithUtils<S, V, U>) => Base<S>;
|
|
10
201
|
};
|
|
202
|
+
/**
|
|
203
|
+
* The utils configuration for use outside of styled.
|
|
204
|
+
* Useful for applying utils to inline styles.
|
|
205
|
+
*/
|
|
206
|
+
utils: U;
|
|
11
207
|
};
|
|
208
|
+
/**
|
|
209
|
+
* Clears all style caches. Useful for testing or hot reloading scenarios.
|
|
210
|
+
* Note: This only clears the primitive cache. WeakMap entries are
|
|
211
|
+
* automatically garbage collected when their keys are no longer referenced.
|
|
212
|
+
*/
|
|
213
|
+
export declare function clearStyleCache(): void;
|
|
214
|
+
export {};
|