@mgcrea/react-native-tailwind 0.8.1 → 0.9.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/README.md +152 -0
- package/dist/babel/config-loader.ts +2 -0
- package/dist/babel/index.cjs +205 -17
- package/dist/babel/plugin.d.ts +4 -1
- package/dist/babel/plugin.test.ts +327 -0
- package/dist/babel/plugin.ts +194 -14
- package/dist/babel/utils/platformModifierProcessing.d.ts +30 -0
- package/dist/babel/utils/platformModifierProcessing.ts +80 -0
- package/dist/babel/utils/styleInjection.d.ts +5 -1
- package/dist/babel/utils/styleInjection.ts +52 -7
- package/dist/babel/utils/styleTransforms.ts +1 -0
- package/dist/parser/aspectRatio.js +1 -1
- package/dist/parser/aspectRatio.test.js +1 -1
- package/dist/parser/index.d.ts +2 -2
- package/dist/parser/index.js +1 -1
- package/dist/parser/modifiers.d.ts +20 -2
- package/dist/parser/modifiers.js +1 -1
- package/dist/parser/spacing.d.ts +1 -1
- package/dist/parser/spacing.js +1 -1
- package/dist/parser/spacing.test.js +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.cjs.map +4 -4
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +4 -4
- package/dist/runtime.test.js +1 -1
- package/dist/stubs/tw.test.js +1 -0
- package/package.json +7 -7
- package/src/babel/config-loader.ts +2 -0
- package/src/babel/plugin.test.ts +327 -0
- package/src/babel/plugin.ts +194 -14
- package/src/babel/utils/platformModifierProcessing.ts +80 -0
- package/src/babel/utils/styleInjection.ts +52 -7
- package/src/babel/utils/styleTransforms.ts +1 -0
- package/src/parser/aspectRatio.test.ts +25 -2
- package/src/parser/aspectRatio.ts +4 -3
- package/src/parser/borders.ts +2 -0
- package/src/parser/colors.ts +2 -0
- package/src/parser/index.ts +9 -2
- package/src/parser/layout.ts +2 -0
- package/src/parser/modifiers.ts +38 -4
- package/src/parser/placeholder.ts +1 -0
- package/src/parser/sizing.ts +1 -0
- package/src/parser/spacing.test.ts +63 -0
- package/src/parser/spacing.ts +11 -6
- package/src/parser/transforms.ts +5 -0
- package/src/parser/typography.ts +2 -0
- package/src/runtime.test.ts +27 -0
- package/src/runtime.ts +2 -1
- package/src/stubs/tw.test.ts +27 -0
- package/dist/babel/index.test.ts +0 -481
- package/dist/config/palettes.d.ts +0 -302
- package/dist/config/palettes.js +0 -1
- package/dist/parser/__snapshots__/aspectRatio.test.js.snap +0 -9
- package/dist/parser/__snapshots__/borders.test.js.snap +0 -23
- package/dist/parser/__snapshots__/colors.test.js.snap +0 -251
- package/dist/parser/__snapshots__/shadows.test.js.snap +0 -76
- package/dist/parser/__snapshots__/sizing.test.js.snap +0 -61
- package/dist/parser/__snapshots__/spacing.test.js.snap +0 -40
- package/dist/parser/__snapshots__/transforms.test.js.snap +0 -58
- package/dist/parser/__snapshots__/typography.test.js.snap +0 -30
- package/dist/parser/aspectRatio.test.d.ts +0 -1
- package/dist/parser/borders.test.d.ts +0 -1
- package/dist/parser/colors.test.d.ts +0 -1
- package/dist/parser/layout.test.d.ts +0 -1
- package/dist/parser/modifiers.test.d.ts +0 -1
- package/dist/parser/shadows.test.d.ts +0 -1
- package/dist/parser/sizing.test.d.ts +0 -1
- package/dist/parser/spacing.test.d.ts +0 -1
- package/dist/parser/typography.test.d.ts +0 -1
- package/dist/types.d.ts +0 -42
- package/dist/types.js +0 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility functions for processing platform modifiers (ios:, android:, web:)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type * as BabelTypes from "@babel/types";
|
|
6
|
+
import type { ParsedModifier, PlatformModifierType } from "../../parser/index.js";
|
|
7
|
+
import type { StyleObject } from "../../types/core.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Plugin state interface (subset needed for platform modifier processing)
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
13
|
+
export interface PlatformModifierProcessingState {
|
|
14
|
+
styleRegistry: Map<string, StyleObject>;
|
|
15
|
+
customColors: Record<string, string>;
|
|
16
|
+
stylesIdentifier: string;
|
|
17
|
+
needsPlatformImport: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Process platform modifiers and generate Platform.select() expression
|
|
22
|
+
*
|
|
23
|
+
* @param platformModifiers - Array of parsed platform modifiers
|
|
24
|
+
* @param state - Plugin state
|
|
25
|
+
* @param parseClassName - Function to parse class names into style objects
|
|
26
|
+
* @param generateStyleKey - Function to generate unique style keys
|
|
27
|
+
* @param t - Babel types
|
|
28
|
+
* @returns AST node for Platform.select() call
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* Input: [{ modifier: "ios", baseClass: "shadow-lg" }, { modifier: "android", baseClass: "elevation-4" }]
|
|
32
|
+
* Output: Platform.select({ ios: styles._ios_shadow_lg, android: styles._android_elevation_4 })
|
|
33
|
+
*/
|
|
34
|
+
export function processPlatformModifiers(
|
|
35
|
+
platformModifiers: ParsedModifier[],
|
|
36
|
+
state: PlatformModifierProcessingState,
|
|
37
|
+
parseClassName: (className: string, customColors: Record<string, string>) => StyleObject,
|
|
38
|
+
generateStyleKey: (className: string) => string,
|
|
39
|
+
t: typeof BabelTypes,
|
|
40
|
+
): BabelTypes.Expression {
|
|
41
|
+
// Mark that we need Platform import
|
|
42
|
+
state.needsPlatformImport = true;
|
|
43
|
+
|
|
44
|
+
// Group modifiers by platform
|
|
45
|
+
const modifiersByPlatform = new Map<PlatformModifierType, ParsedModifier[]>();
|
|
46
|
+
|
|
47
|
+
for (const mod of platformModifiers) {
|
|
48
|
+
const platform = mod.modifier as PlatformModifierType;
|
|
49
|
+
if (!modifiersByPlatform.has(platform)) {
|
|
50
|
+
modifiersByPlatform.set(platform, []);
|
|
51
|
+
}
|
|
52
|
+
const platformGroup = modifiersByPlatform.get(platform);
|
|
53
|
+
if (platformGroup) {
|
|
54
|
+
platformGroup.push(mod);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Build Platform.select() object properties
|
|
59
|
+
const selectProperties: BabelTypes.ObjectProperty[] = [];
|
|
60
|
+
|
|
61
|
+
for (const [platform, modifiers] of modifiersByPlatform) {
|
|
62
|
+
// Parse all classes for this platform together
|
|
63
|
+
const classNames = modifiers.map((m) => m.baseClass).join(" ");
|
|
64
|
+
const styleObject = parseClassName(classNames, state.customColors);
|
|
65
|
+
const styleKey = generateStyleKey(`${platform}_${classNames}`);
|
|
66
|
+
|
|
67
|
+
// Register style in the registry
|
|
68
|
+
state.styleRegistry.set(styleKey, styleObject);
|
|
69
|
+
|
|
70
|
+
// Create property: ios: styles._ios_shadow_lg
|
|
71
|
+
const styleReference = t.memberExpression(t.identifier(state.stylesIdentifier), t.identifier(styleKey));
|
|
72
|
+
|
|
73
|
+
selectProperties.push(t.objectProperty(t.identifier(platform), styleReference));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Create Platform.select({ ios: ..., android: ... })
|
|
77
|
+
return t.callExpression(t.memberExpression(t.identifier("Platform"), t.identifier("select")), [
|
|
78
|
+
t.objectExpression(selectProperties),
|
|
79
|
+
]);
|
|
80
|
+
}
|
|
@@ -5,9 +5,13 @@ import type { NodePath } from "@babel/core";
|
|
|
5
5
|
import type * as BabelTypes from "@babel/types";
|
|
6
6
|
import type { StyleObject } from "../../types/core.js";
|
|
7
7
|
/**
|
|
8
|
-
* Add StyleSheet import to the file
|
|
8
|
+
* Add StyleSheet import to the file or merge with existing react-native import
|
|
9
9
|
*/
|
|
10
10
|
export declare function addStyleSheetImport(path: NodePath<BabelTypes.Program>, t: typeof BabelTypes): void;
|
|
11
|
+
/**
|
|
12
|
+
* Add Platform import to the file or merge with existing react-native import
|
|
13
|
+
*/
|
|
14
|
+
export declare function addPlatformImport(path: NodePath<BabelTypes.Program>, t: typeof BabelTypes): void;
|
|
11
15
|
/**
|
|
12
16
|
* Inject StyleSheet.create with all collected styles at the top of the file
|
|
13
17
|
* This ensures the styles object is defined before any code that references it
|
|
@@ -7,16 +7,61 @@ import type * as BabelTypes from "@babel/types";
|
|
|
7
7
|
import type { StyleObject } from "../../types/core.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Add StyleSheet import to the file
|
|
10
|
+
* Add StyleSheet import to the file or merge with existing react-native import
|
|
11
11
|
*/
|
|
12
12
|
export function addStyleSheetImport(path: NodePath<BabelTypes.Program>, t: typeof BabelTypes): void {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
// Check if there's already a react-native import
|
|
14
|
+
const body = path.node.body;
|
|
15
|
+
let reactNativeImport: BabelTypes.ImportDeclaration | null = null;
|
|
16
|
+
|
|
17
|
+
for (const statement of body) {
|
|
18
|
+
if (t.isImportDeclaration(statement) && statement.source.value === "react-native") {
|
|
19
|
+
reactNativeImport = statement;
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
if (reactNativeImport) {
|
|
25
|
+
// Add StyleSheet to existing react-native import
|
|
26
|
+
reactNativeImport.specifiers.push(
|
|
27
|
+
t.importSpecifier(t.identifier("StyleSheet"), t.identifier("StyleSheet")),
|
|
28
|
+
);
|
|
29
|
+
} else {
|
|
30
|
+
// Create new react-native import with StyleSheet
|
|
31
|
+
const importDeclaration = t.importDeclaration(
|
|
32
|
+
[t.importSpecifier(t.identifier("StyleSheet"), t.identifier("StyleSheet"))],
|
|
33
|
+
t.stringLiteral("react-native"),
|
|
34
|
+
);
|
|
35
|
+
path.unshiftContainer("body", importDeclaration);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Add Platform import to the file or merge with existing react-native import
|
|
41
|
+
*/
|
|
42
|
+
export function addPlatformImport(path: NodePath<BabelTypes.Program>, t: typeof BabelTypes): void {
|
|
43
|
+
// Check if there's already a react-native import
|
|
44
|
+
const body = path.node.body;
|
|
45
|
+
let reactNativeImport: BabelTypes.ImportDeclaration | null = null;
|
|
46
|
+
|
|
47
|
+
for (const statement of body) {
|
|
48
|
+
if (t.isImportDeclaration(statement) && statement.source.value === "react-native") {
|
|
49
|
+
reactNativeImport = statement;
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (reactNativeImport) {
|
|
55
|
+
// Add Platform to existing react-native import
|
|
56
|
+
reactNativeImport.specifiers.push(t.importSpecifier(t.identifier("Platform"), t.identifier("Platform")));
|
|
57
|
+
} else {
|
|
58
|
+
// Create new react-native import with Platform
|
|
59
|
+
const importDeclaration = t.importDeclaration(
|
|
60
|
+
[t.importSpecifier(t.identifier("Platform"), t.identifier("Platform"))],
|
|
61
|
+
t.stringLiteral("react-native"),
|
|
62
|
+
);
|
|
63
|
+
path.unshiftContainer("body", importDeclaration);
|
|
64
|
+
}
|
|
20
65
|
}
|
|
21
66
|
|
|
22
67
|
/**
|
|
@@ -242,6 +242,7 @@ export function addOrMergePlaceholderTextColorProp(
|
|
|
242
242
|
if (existingProp) {
|
|
243
243
|
// If explicit prop exists, don't override it (explicit props take precedence)
|
|
244
244
|
// This matches the behavior of style prop precedence
|
|
245
|
+
/* v8 ignore next 5 */
|
|
245
246
|
if (process.env.NODE_ENV !== "production") {
|
|
246
247
|
console.warn(
|
|
247
248
|
`[react-native-tailwind] placeholderTextColor prop will be overridden by className placeholder: modifier. ` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.ASPECT_RATIO_PRESETS=void 0;exports.parseAspectRatio=parseAspectRatio;var ASPECT_RATIO_PRESETS=exports.ASPECT_RATIO_PRESETS={"aspect-auto":undefined,"aspect-square":1,"aspect-video":16/9};function parseArbitraryAspectRatio(value){var match=value.match(/^\[(\d+)\/(\d+)\]$/);if(match){var numerator=Number.parseInt(match[1],10);var denominator=Number.parseInt(match[2],10);if(denominator===0){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Invalid aspect ratio: ${value}. Denominator cannot be zero.`);}return null;}return numerator/denominator;}return null;}function parseAspectRatio(cls){if(!cls.startsWith("aspect-")){return null;}if(cls in ASPECT_RATIO_PRESETS){var _aspectRatio=ASPECT_RATIO_PRESETS[cls];if(_aspectRatio===undefined){return{};}return{aspectRatio:_aspectRatio};}var arbitraryValue=cls.substring(7);var aspectRatio=parseArbitraryAspectRatio(arbitraryValue);if(aspectRatio!==null){return{aspectRatio:aspectRatio};}return null;}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.ASPECT_RATIO_PRESETS=void 0;exports.parseAspectRatio=parseAspectRatio;var ASPECT_RATIO_PRESETS=exports.ASPECT_RATIO_PRESETS={"aspect-auto":undefined,"aspect-square":1,"aspect-video":16/9};function parseArbitraryAspectRatio(value){var match=value.match(/^\[(\d+)\/(\d+)\]$/);if(match){var numerator=Number.parseInt(match[1],10);var denominator=Number.parseInt(match[2],10);if(denominator===0){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Invalid aspect ratio: ${value}. Denominator cannot be zero.`);}return null;}return numerator/denominator;}return null;}function parseAspectRatio(cls){if(!cls.startsWith("aspect-")){return null;}if(cls in ASPECT_RATIO_PRESETS){var _aspectRatio=ASPECT_RATIO_PRESETS[cls];if(_aspectRatio===undefined){return{aspectRatio:undefined};}return{aspectRatio:_aspectRatio};}var arbitraryValue=cls.substring(7);var aspectRatio=parseArbitraryAspectRatio(arbitraryValue);if(aspectRatio!==null){return{aspectRatio:aspectRatio};}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vitest=require("vitest");var _aspectRatio=require("./aspectRatio");(0,_vitest.describe)("ASPECT_RATIO_PRESETS",function(){(0,_vitest.it)("should export aspect ratio presets",function(){(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toMatchSnapshot();});(0,_vitest.it)("should have all preset values",function(){(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toHaveProperty("aspect-auto");(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toHaveProperty("aspect-square");(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toHaveProperty("aspect-video");});(0,_vitest.it)("should have correct preset values",function(){(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS["aspect-auto"]).toBeUndefined();(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS["aspect-square"]).toBe(1);(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS["aspect-video"]).toBe(16/9);});});(0,_vitest.describe)("parseAspectRatio - preset values",function(){(0,_vitest.it)("should parse aspect-square",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-square")).toEqual({aspectRatio:1});});(0,_vitest.it)("should parse aspect-video",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-video")).toEqual({aspectRatio:16/9});});(0,_vitest.it)("should parse aspect-auto",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-auto")).toEqual({});});});(0,_vitest.describe)("parseAspectRatio - arbitrary values",function(){(0,_vitest.it)("should parse arbitrary aspect ratio values",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3]")).toEqual({aspectRatio:4/3});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[16/9]")).toEqual({aspectRatio:16/9});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[21/9]")).toEqual({aspectRatio:21/9});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[1/1]")).toEqual({aspectRatio:1});});(0,_vitest.it)("should handle arbitrary ratios with different aspect values",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[2/1]")).toEqual({aspectRatio:2});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[3/2]")).toEqual({aspectRatio:1.5});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[9/16]")).toEqual({aspectRatio:9/16});});(0,_vitest.it)("should handle arbitrary ratios with large numbers",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[100/50]")).toEqual({aspectRatio:2});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[1920/1080]")).toEqual({aspectRatio:1920/1080});});(0,_vitest.it)("should calculate correct aspect ratio values",function(){var result=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");(0,_vitest.expect)(result==null?void 0:result.aspectRatio).toBeCloseTo(1.333,3);var result2=(0,_aspectRatio.parseAspectRatio)("aspect-[16/9]");(0,_vitest.expect)(result2==null?void 0:result2.aspectRatio).toBeCloseTo(1.778,3);});});(0,_vitest.describe)("parseAspectRatio - edge cases",function(){(0,_vitest.it)("should return null for division by zero",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/0]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[16/0]")).toBeNull();});(0,_vitest.it)("should return null for invalid arbitrary values",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3/2]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[abc/def]")).toBeNull();});(0,_vitest.it)("should return null for malformed brackets",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-4/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-4/3")).toBeNull();});(0,_vitest.it)("should return null for invalid class prefixes",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("ratio-[4/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("ar-[4/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspectRatio-[4/3]")).toBeNull();});});(0,_vitest.describe)("parseAspectRatio - invalid classes",function(){(0,_vitest.it)("should return null for non-aspect classes",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("bg-blue-500")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("p-4")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("text-white")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("w-full")).toBeNull();});(0,_vitest.it)("should return null for invalid aspect class names",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-invalid")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-16-9")).toBeNull();});(0,_vitest.it)("should return null for empty or whitespace input",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)(" ")).toBeNull();});});(0,_vitest.describe)("parseAspectRatio - type validation",function(){(0,_vitest.it)("should return objects with correct property types",function(){var square=(0,_aspectRatio.parseAspectRatio)("aspect-square");(0,_vitest.expect)(typeof(square==null?void 0:square.aspectRatio)).toBe("number");var video=(0,_aspectRatio.parseAspectRatio)("aspect-video");(0,_vitest.expect)(typeof(video==null?void 0:video.aspectRatio)).toBe("number");var arbitrary=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");(0,_vitest.expect)(typeof(arbitrary==null?void 0:arbitrary.aspectRatio)).toBe("number");});(0,_vitest.it)("should return null or object, never undefined",function(){var valid=(0,_aspectRatio.parseAspectRatio)("aspect-square");(0,_vitest.expect)(valid).not.toBeUndefined();(0,_vitest.expect)(typeof valid).toBe("object");var invalid=(0,_aspectRatio.parseAspectRatio)("invalid");(0,_vitest.expect)(invalid).toBeNull();});});(0,_vitest.describe)("parseAspectRatio - comprehensive coverage",function(){(0,_vitest.it)("should parse all preset variants without errors",function(){var presets=["aspect-auto","aspect-square","aspect-video"];presets.forEach(function(preset){var result=(0,_aspectRatio.parseAspectRatio)(preset);(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(typeof result).toBe("object");});});(0,_vitest.it)("should return consistent results for same input",function(){var result1=(0,_aspectRatio.parseAspectRatio)("aspect-square");var result2=(0,_aspectRatio.parseAspectRatio)("aspect-square");(0,_vitest.expect)(result1).toEqual(result2);var result3=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");var result4=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");(0,_vitest.expect)(result3).toEqual(result4);});(0,_vitest.it)("should handle case-sensitive class names",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("ASPECT-square")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("Aspect-video")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-SQUARE")).toBeNull();});(0,_vitest.it)("should handle common aspect ratios",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[1/1]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[16/9]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[21/9]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[9/16]")).toBeTruthy();});(0,_vitest.it)("should differentiate between preset and arbitrary values",function(){var preset=(0,_aspectRatio.parseAspectRatio)("aspect-video");(0,_vitest.expect)(preset).toEqual({aspectRatio:16/9});var arbitrary=(0,_aspectRatio.parseAspectRatio)("aspect-[16/9]");(0,_vitest.expect)(arbitrary).toEqual({aspectRatio:16/9});(0,_vitest.expect)(preset).toEqual(arbitrary);});(0,_vitest.it)("should handle fractional results correctly",function(){var result=(0,_aspectRatio.parseAspectRatio)("aspect-[5/7]");(0,_vitest.expect)(result==null?void 0:result.aspectRatio).toBeCloseTo(0.714,3);var result2=(0,_aspectRatio.parseAspectRatio)("aspect-[3/4]");(0,_vitest.expect)(result2==null?void 0:result2.aspectRatio).toBe(0.75);});});
|
|
1
|
+
var _vitest=require("vitest");var _aspectRatio=require("./aspectRatio");var _index=require("./index");(0,_vitest.describe)("ASPECT_RATIO_PRESETS",function(){(0,_vitest.it)("should export aspect ratio presets",function(){(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toMatchSnapshot();});(0,_vitest.it)("should have all preset values",function(){(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toHaveProperty("aspect-auto");(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toHaveProperty("aspect-square");(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS).toHaveProperty("aspect-video");});(0,_vitest.it)("should have correct preset values",function(){(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS["aspect-auto"]).toBeUndefined();(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS["aspect-square"]).toBe(1);(0,_vitest.expect)(_aspectRatio.ASPECT_RATIO_PRESETS["aspect-video"]).toBe(16/9);});});(0,_vitest.describe)("parseAspectRatio - preset values",function(){(0,_vitest.it)("should parse aspect-square",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-square")).toEqual({aspectRatio:1});});(0,_vitest.it)("should parse aspect-video",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-video")).toEqual({aspectRatio:16/9});});(0,_vitest.it)("should parse aspect-auto",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-auto")).toEqual({aspectRatio:undefined});});});(0,_vitest.describe)("parseAspectRatio - arbitrary values",function(){(0,_vitest.it)("should parse arbitrary aspect ratio values",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3]")).toEqual({aspectRatio:4/3});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[16/9]")).toEqual({aspectRatio:16/9});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[21/9]")).toEqual({aspectRatio:21/9});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[1/1]")).toEqual({aspectRatio:1});});(0,_vitest.it)("should handle arbitrary ratios with different aspect values",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[2/1]")).toEqual({aspectRatio:2});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[3/2]")).toEqual({aspectRatio:1.5});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[9/16]")).toEqual({aspectRatio:9/16});});(0,_vitest.it)("should handle arbitrary ratios with large numbers",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[100/50]")).toEqual({aspectRatio:2});(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[1920/1080]")).toEqual({aspectRatio:1920/1080});});(0,_vitest.it)("should calculate correct aspect ratio values",function(){var result=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");(0,_vitest.expect)(result==null?void 0:result.aspectRatio).toBeCloseTo(1.333,3);var result2=(0,_aspectRatio.parseAspectRatio)("aspect-[16/9]");(0,_vitest.expect)(result2==null?void 0:result2.aspectRatio).toBeCloseTo(1.778,3);});});(0,_vitest.describe)("parseAspectRatio - edge cases",function(){(0,_vitest.it)("should return null for division by zero",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/0]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[16/0]")).toBeNull();});(0,_vitest.it)("should return null for invalid arbitrary values",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3/2]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[abc/def]")).toBeNull();});(0,_vitest.it)("should return null for malformed brackets",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-4/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-4/3")).toBeNull();});(0,_vitest.it)("should return null for invalid class prefixes",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("ratio-[4/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("ar-[4/3]")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspectRatio-[4/3]")).toBeNull();});});(0,_vitest.describe)("parseAspectRatio - invalid classes",function(){(0,_vitest.it)("should return null for non-aspect classes",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("bg-blue-500")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("p-4")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("text-white")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("w-full")).toBeNull();});(0,_vitest.it)("should return null for invalid aspect class names",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-invalid")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-16-9")).toBeNull();});(0,_vitest.it)("should return null for empty or whitespace input",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)(" ")).toBeNull();});});(0,_vitest.describe)("parseAspectRatio - type validation",function(){(0,_vitest.it)("should return objects with correct property types",function(){var square=(0,_aspectRatio.parseAspectRatio)("aspect-square");(0,_vitest.expect)(typeof(square==null?void 0:square.aspectRatio)).toBe("number");var video=(0,_aspectRatio.parseAspectRatio)("aspect-video");(0,_vitest.expect)(typeof(video==null?void 0:video.aspectRatio)).toBe("number");var arbitrary=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");(0,_vitest.expect)(typeof(arbitrary==null?void 0:arbitrary.aspectRatio)).toBe("number");});(0,_vitest.it)("should return null or object, never undefined",function(){var valid=(0,_aspectRatio.parseAspectRatio)("aspect-square");(0,_vitest.expect)(valid).not.toBeUndefined();(0,_vitest.expect)(typeof valid).toBe("object");var invalid=(0,_aspectRatio.parseAspectRatio)("invalid");(0,_vitest.expect)(invalid).toBeNull();});});(0,_vitest.describe)("parseAspectRatio - override behavior",function(){(0,_vitest.it)("should allow aspect-auto to override previously set aspect ratios",function(){var result=(0,_index.parseClassName)("aspect-square aspect-auto");(0,_vitest.expect)(result).toEqual({aspectRatio:undefined});});(0,_vitest.it)("should allow aspect ratios to override aspect-auto",function(){var result=(0,_index.parseClassName)("aspect-auto aspect-square");(0,_vitest.expect)(result).toEqual({aspectRatio:1});});(0,_vitest.it)("should apply last aspect ratio in sequence",function(){var result=(0,_index.parseClassName)("aspect-square aspect-video aspect-auto");(0,_vitest.expect)(result).toEqual({aspectRatio:undefined});var result2=(0,_index.parseClassName)("aspect-auto aspect-square aspect-video");(0,_vitest.expect)(result2).toEqual({aspectRatio:16/9});});});(0,_vitest.describe)("parseAspectRatio - comprehensive coverage",function(){(0,_vitest.it)("should parse all preset variants without errors",function(){var presets=["aspect-auto","aspect-square","aspect-video"];presets.forEach(function(preset){var result=(0,_aspectRatio.parseAspectRatio)(preset);(0,_vitest.expect)(result).toBeTruthy();(0,_vitest.expect)(typeof result).toBe("object");});});(0,_vitest.it)("should return consistent results for same input",function(){var result1=(0,_aspectRatio.parseAspectRatio)("aspect-square");var result2=(0,_aspectRatio.parseAspectRatio)("aspect-square");(0,_vitest.expect)(result1).toEqual(result2);var result3=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");var result4=(0,_aspectRatio.parseAspectRatio)("aspect-[4/3]");(0,_vitest.expect)(result3).toEqual(result4);});(0,_vitest.it)("should handle case-sensitive class names",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("ASPECT-square")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("Aspect-video")).toBeNull();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-SQUARE")).toBeNull();});(0,_vitest.it)("should handle common aspect ratios",function(){(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[1/1]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[4/3]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[16/9]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[21/9]")).toBeTruthy();(0,_vitest.expect)((0,_aspectRatio.parseAspectRatio)("aspect-[9/16]")).toBeTruthy();});(0,_vitest.it)("should differentiate between preset and arbitrary values",function(){var preset=(0,_aspectRatio.parseAspectRatio)("aspect-video");(0,_vitest.expect)(preset).toEqual({aspectRatio:16/9});var arbitrary=(0,_aspectRatio.parseAspectRatio)("aspect-[16/9]");(0,_vitest.expect)(arbitrary).toEqual({aspectRatio:16/9});(0,_vitest.expect)(preset).toEqual(arbitrary);});(0,_vitest.it)("should handle fractional results correctly",function(){var result=(0,_aspectRatio.parseAspectRatio)("aspect-[5/7]");(0,_vitest.expect)(result==null?void 0:result.aspectRatio).toBeCloseTo(0.714,3);var result2=(0,_aspectRatio.parseAspectRatio)("aspect-[3/4]");(0,_vitest.expect)(result2==null?void 0:result2.aspectRatio).toBe(0.75);});});
|
package/dist/parser/index.d.ts
CHANGED
|
@@ -27,5 +27,5 @@ export { parseSizing } from "./sizing";
|
|
|
27
27
|
export { parseSpacing } from "./spacing";
|
|
28
28
|
export { parseTransform } from "./transforms";
|
|
29
29
|
export { parseTypography } from "./typography";
|
|
30
|
-
export { hasModifier, parseModifier, splitModifierClasses } from "./modifiers";
|
|
31
|
-
export type { ModifierType, ParsedModifier } from "./modifiers";
|
|
30
|
+
export { hasModifier, isPlatformModifier, isStateModifier, parseModifier, splitModifierClasses, } from "./modifiers";
|
|
31
|
+
export type { ModifierType, ParsedModifier, PlatformModifierType, StateModifierType } from "./modifiers";
|
package/dist/parser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"hasModifier",{enumerable:true,get:function get(){return _modifiers.hasModifier;}});Object.defineProperty(exports,"parseAspectRatio",{enumerable:true,get:function get(){return _aspectRatio.parseAspectRatio;}});Object.defineProperty(exports,"parseBorder",{enumerable:true,get:function get(){return _borders.parseBorder;}});exports.parseClass=parseClass;exports.parseClassName=parseClassName;Object.defineProperty(exports,"parseColor",{enumerable:true,get:function get(){return _colors.parseColor;}});Object.defineProperty(exports,"parseLayout",{enumerable:true,get:function get(){return _layout.parseLayout;}});Object.defineProperty(exports,"parseModifier",{enumerable:true,get:function get(){return _modifiers.parseModifier;}});Object.defineProperty(exports,"parsePlaceholderClass",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClass;}});Object.defineProperty(exports,"parsePlaceholderClasses",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClasses;}});Object.defineProperty(exports,"parseShadow",{enumerable:true,get:function get(){return _shadows.parseShadow;}});Object.defineProperty(exports,"parseSizing",{enumerable:true,get:function get(){return _sizing.parseSizing;}});Object.defineProperty(exports,"parseSpacing",{enumerable:true,get:function get(){return _spacing.parseSpacing;}});Object.defineProperty(exports,"parseTransform",{enumerable:true,get:function get(){return _transforms.parseTransform;}});Object.defineProperty(exports,"parseTypography",{enumerable:true,get:function get(){return _typography.parseTypography;}});Object.defineProperty(exports,"splitModifierClasses",{enumerable:true,get:function get(){return _modifiers.splitModifierClasses;}});var _aspectRatio=require("./aspectRatio");var _borders=require("./borders");var _colors=require("./colors");var _layout=require("./layout");var _shadows=require("./shadows");var _sizing=require("./sizing");var _spacing=require("./spacing");var _transforms=require("./transforms");var _typography=require("./typography");var _placeholder=require("./placeholder");var _modifiers=require("./modifiers");function parseClassName(className,customColors){var classes=className.split(/\s+/).filter(Boolean);var style={};for(var cls of classes){var parsedStyle=parseClass(cls,customColors);Object.assign(style,parsedStyle);}return style;}function parseClass(cls,customColors){var parsers=[_spacing.parseSpacing,_borders.parseBorder,function(cls){return(0,_colors.parseColor)(cls,customColors);},_layout.parseLayout,_typography.parseTypography,_sizing.parseSizing,_shadows.parseShadow,_aspectRatio.parseAspectRatio,_transforms.parseTransform];for(var parser of parsers){var result=parser(cls);if(result!==null){return result;}}if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unknown class: "${cls}"`);}return{};}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"hasModifier",{enumerable:true,get:function get(){return _modifiers.hasModifier;}});Object.defineProperty(exports,"isPlatformModifier",{enumerable:true,get:function get(){return _modifiers.isPlatformModifier;}});Object.defineProperty(exports,"isStateModifier",{enumerable:true,get:function get(){return _modifiers.isStateModifier;}});Object.defineProperty(exports,"parseAspectRatio",{enumerable:true,get:function get(){return _aspectRatio.parseAspectRatio;}});Object.defineProperty(exports,"parseBorder",{enumerable:true,get:function get(){return _borders.parseBorder;}});exports.parseClass=parseClass;exports.parseClassName=parseClassName;Object.defineProperty(exports,"parseColor",{enumerable:true,get:function get(){return _colors.parseColor;}});Object.defineProperty(exports,"parseLayout",{enumerable:true,get:function get(){return _layout.parseLayout;}});Object.defineProperty(exports,"parseModifier",{enumerable:true,get:function get(){return _modifiers.parseModifier;}});Object.defineProperty(exports,"parsePlaceholderClass",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClass;}});Object.defineProperty(exports,"parsePlaceholderClasses",{enumerable:true,get:function get(){return _placeholder.parsePlaceholderClasses;}});Object.defineProperty(exports,"parseShadow",{enumerable:true,get:function get(){return _shadows.parseShadow;}});Object.defineProperty(exports,"parseSizing",{enumerable:true,get:function get(){return _sizing.parseSizing;}});Object.defineProperty(exports,"parseSpacing",{enumerable:true,get:function get(){return _spacing.parseSpacing;}});Object.defineProperty(exports,"parseTransform",{enumerable:true,get:function get(){return _transforms.parseTransform;}});Object.defineProperty(exports,"parseTypography",{enumerable:true,get:function get(){return _typography.parseTypography;}});Object.defineProperty(exports,"splitModifierClasses",{enumerable:true,get:function get(){return _modifiers.splitModifierClasses;}});var _aspectRatio=require("./aspectRatio");var _borders=require("./borders");var _colors=require("./colors");var _layout=require("./layout");var _shadows=require("./shadows");var _sizing=require("./sizing");var _spacing=require("./spacing");var _transforms=require("./transforms");var _typography=require("./typography");var _placeholder=require("./placeholder");var _modifiers=require("./modifiers");function parseClassName(className,customColors){var classes=className.split(/\s+/).filter(Boolean);var style={};for(var cls of classes){var parsedStyle=parseClass(cls,customColors);Object.assign(style,parsedStyle);}return style;}function parseClass(cls,customColors){var parsers=[_spacing.parseSpacing,_borders.parseBorder,function(cls){return(0,_colors.parseColor)(cls,customColors);},_layout.parseLayout,_typography.parseTypography,_sizing.parseSizing,_shadows.parseShadow,_aspectRatio.parseAspectRatio,_transforms.parseTransform];for(var parser of parsers){var result=parser(cls);if(result!==null){return result;}}if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unknown class: "${cls}"`);}return{};}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Modifier parsing utilities for state-based class names
|
|
2
|
+
* Modifier parsing utilities for state-based and platform-specific class names
|
|
3
|
+
* - State modifiers: active:, hover:, focus:, disabled:, placeholder:
|
|
4
|
+
* - Platform modifiers: ios:, android:, web:
|
|
3
5
|
*/
|
|
4
|
-
export type
|
|
6
|
+
export type StateModifierType = "active" | "hover" | "focus" | "disabled" | "placeholder";
|
|
7
|
+
export type PlatformModifierType = "ios" | "android" | "web";
|
|
8
|
+
export type ModifierType = StateModifierType | PlatformModifierType;
|
|
5
9
|
export type ParsedModifier = {
|
|
6
10
|
modifier: ModifierType;
|
|
7
11
|
baseClass: string;
|
|
@@ -25,6 +29,20 @@ export declare function parseModifier(cls: string): ParsedModifier | null;
|
|
|
25
29
|
* @returns true if class has a supported modifier prefix
|
|
26
30
|
*/
|
|
27
31
|
export declare function hasModifier(cls: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Check if a modifier is a state modifier (active, hover, focus, disabled, placeholder)
|
|
34
|
+
*
|
|
35
|
+
* @param modifier - Modifier type to check
|
|
36
|
+
* @returns true if modifier is a state modifier
|
|
37
|
+
*/
|
|
38
|
+
export declare function isStateModifier(modifier: ModifierType): modifier is StateModifierType;
|
|
39
|
+
/**
|
|
40
|
+
* Check if a modifier is a platform modifier (ios, android, web)
|
|
41
|
+
*
|
|
42
|
+
* @param modifier - Modifier type to check
|
|
43
|
+
* @returns true if modifier is a platform modifier
|
|
44
|
+
*/
|
|
45
|
+
export declare function isPlatformModifier(modifier: ModifierType): modifier is PlatformModifierType;
|
|
28
46
|
/**
|
|
29
47
|
* Split a space-separated className string into base and modifier classes
|
|
30
48
|
*
|
package/dist/parser/modifiers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.hasModifier=hasModifier;exports.parseModifier=parseModifier;exports.splitModifierClasses=splitModifierClasses;var
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.hasModifier=hasModifier;exports.isPlatformModifier=isPlatformModifier;exports.isStateModifier=isStateModifier;exports.parseModifier=parseModifier;exports.splitModifierClasses=splitModifierClasses;var STATE_MODIFIERS=["active","hover","focus","disabled","placeholder"];var PLATFORM_MODIFIERS=["ios","android","web"];var SUPPORTED_MODIFIERS=[].concat(STATE_MODIFIERS,PLATFORM_MODIFIERS);function parseModifier(cls){var colonIndex=cls.indexOf(":");if(colonIndex===-1){return null;}var potentialModifier=cls.slice(0,colonIndex);var baseClass=cls.slice(colonIndex+1);if(!SUPPORTED_MODIFIERS.includes(potentialModifier)){return null;}if(baseClass.includes(":")){return null;}if(!baseClass){return null;}return{modifier:potentialModifier,baseClass:baseClass};}function hasModifier(cls){return parseModifier(cls)!==null;}function isStateModifier(modifier){return STATE_MODIFIERS.includes(modifier);}function isPlatformModifier(modifier){return PLATFORM_MODIFIERS.includes(modifier);}function splitModifierClasses(className){var classes=className.trim().split(/\s+/).filter(Boolean);var baseClasses=[];var modifierClasses=[];for(var cls of classes){var parsed=parseModifier(cls);if(parsed){modifierClasses.push(parsed);}else{baseClasses.push(cls);}}return{baseClasses:baseClasses,modifierClasses:modifierClasses};}
|
package/dist/parser/spacing.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import type { StyleObject } from "../types";
|
|
|
5
5
|
export declare const SPACING_SCALE: Record<string, number>;
|
|
6
6
|
/**
|
|
7
7
|
* Parse spacing classes (margin, padding, gap)
|
|
8
|
-
* Examples: m-4, mx-2, mt-8, p-4, px-2, pt-8, gap-4, m-[16px]
|
|
8
|
+
* Examples: m-4, mx-2, mt-8, p-4, px-2, pt-8, gap-4, m-[16px], -m-4, -mt-[10px]
|
|
9
9
|
*/
|
|
10
10
|
export declare function parseSpacing(cls: string): StyleObject | null;
|
package/dist/parser/spacing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SPACING_SCALE=void 0;exports.parseSpacing=parseSpacing;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var SPACING_SCALE=exports.SPACING_SCALE={0:0,0.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384};function parseArbitrarySpacing(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary spacing value: ${value}. Only px values are supported (e.g., [16px] or [16]).`);}return null;}return null;}function parseSpacing(cls){var marginMatch=cls.match(/^m([xytrbls]?)-(.+)$/);if(marginMatch){var _marginMatch=(0,_slicedToArray2.default)(marginMatch,
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.SPACING_SCALE=void 0;exports.parseSpacing=parseSpacing;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var SPACING_SCALE=exports.SPACING_SCALE={0:0,0.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384};function parseArbitrarySpacing(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary spacing value: ${value}. Only px values are supported (e.g., [16px] or [16]).`);}return null;}return null;}function parseSpacing(cls){var marginMatch=cls.match(/^(-?)m([xytrbls]?)-(.+)$/);if(marginMatch){var _marginMatch=(0,_slicedToArray2.default)(marginMatch,4),negativePrefix=_marginMatch[1],dir=_marginMatch[2],valueStr=_marginMatch[3];var isNegative=negativePrefix==="-";var arbitraryValue=parseArbitrarySpacing(valueStr);if(arbitraryValue!==null){var finalValue=isNegative?-arbitraryValue:arbitraryValue;return getMarginStyle(dir,finalValue);}var scaleValue=SPACING_SCALE[valueStr];if(scaleValue!==undefined){var _finalValue=isNegative?-scaleValue:scaleValue;return getMarginStyle(dir,_finalValue);}}var paddingMatch=cls.match(/^p([xytrbls]?)-(.+)$/);if(paddingMatch){var _paddingMatch=(0,_slicedToArray2.default)(paddingMatch,3),_dir=_paddingMatch[1],_valueStr=_paddingMatch[2];var _arbitraryValue=parseArbitrarySpacing(_valueStr);if(_arbitraryValue!==null){return getPaddingStyle(_dir,_arbitraryValue);}var _scaleValue=SPACING_SCALE[_valueStr];if(_scaleValue!==undefined){return getPaddingStyle(_dir,_scaleValue);}}var gapMatch=cls.match(/^gap-(.+)$/);if(gapMatch){var _valueStr2=gapMatch[1];var _arbitraryValue2=parseArbitrarySpacing(_valueStr2);if(_arbitraryValue2!==null){return{gap:_arbitraryValue2};}var _scaleValue2=SPACING_SCALE[_valueStr2];if(_scaleValue2!==undefined){return{gap:_scaleValue2};}}return null;}function getMarginStyle(dir,value){switch(dir){case"":return{margin:value};case"x":return{marginHorizontal:value};case"y":return{marginVertical:value};case"t":return{marginTop:value};case"r":return{marginRight:value};case"b":return{marginBottom:value};case"l":return{marginLeft:value};default:return{};}}function getPaddingStyle(dir,value){switch(dir){case"":return{padding:value};case"x":return{paddingHorizontal:value};case"y":return{paddingVertical:value};case"t":return{paddingTop:value};case"r":return{paddingRight:value};case"b":return{paddingBottom:value};case"l":return{paddingLeft:value};default:return{};}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vitest=require("vitest");var _spacing=require("./spacing");(0,_vitest.describe)("SPACING_SCALE",function(){(0,_vitest.it)("should export complete spacing scale",function(){(0,_vitest.expect)(_spacing.SPACING_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("parseSpacing - margin",function(){(0,_vitest.it)("should parse margin all sides",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-0")).toEqual({margin:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-4")).toEqual({margin:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-8")).toEqual({margin:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-96")).toEqual({margin:384});});(0,_vitest.it)("should parse margin with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-0.5")).toEqual({margin:2});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-1.5")).toEqual({margin:6});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-2.5")).toEqual({margin:10});});(0,_vitest.it)("should parse margin horizontal",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-0")).toEqual({marginHorizontal:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-4")).toEqual({marginHorizontal:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-8")).toEqual({marginHorizontal:32});});(0,_vitest.it)("should parse margin vertical",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("my-0")).toEqual({marginVertical:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-4")).toEqual({marginVertical:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-8")).toEqual({marginVertical:32});});(0,_vitest.it)("should parse margin directional",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-4")).toEqual({marginTop:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-4")).toEqual({marginRight:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-4")).toEqual({marginBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-4")).toEqual({marginLeft:16});});(0,_vitest.it)("should parse margin with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16px]")).toEqual({margin:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16]")).toEqual({margin:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[100px]")).toEqual({margin:100});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[100]")).toEqual({margin:100});});(0,_vitest.it)("should parse margin directional with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-[24px]")).toEqual({marginTop:24});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-[32]")).toEqual({marginRight:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-[16px]")).toEqual({marginBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-[48]")).toEqual({marginLeft:48});});(0,_vitest.it)("should parse margin horizontal/vertical with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-[20px]")).toEqual({marginHorizontal:20});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-[30]")).toEqual({marginVertical:30});});});(0,_vitest.describe)("parseSpacing - padding",function(){(0,_vitest.it)("should parse padding all sides",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-0")).toEqual({padding:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-4")).toEqual({padding:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-8")).toEqual({padding:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-96")).toEqual({padding:384});});(0,_vitest.it)("should parse padding with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-0.5")).toEqual({padding:2});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-1.5")).toEqual({padding:6});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-2.5")).toEqual({padding:10});});(0,_vitest.it)("should parse padding horizontal",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("px-0")).toEqual({paddingHorizontal:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-4")).toEqual({paddingHorizontal:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-8")).toEqual({paddingHorizontal:32});});(0,_vitest.it)("should parse padding vertical",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("py-0")).toEqual({paddingVertical:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-4")).toEqual({paddingVertical:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-8")).toEqual({paddingVertical:32});});(0,_vitest.it)("should parse padding directional",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-4")).toEqual({paddingTop:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-4")).toEqual({paddingRight:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-4")).toEqual({paddingBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-4")).toEqual({paddingLeft:16});});(0,_vitest.it)("should parse padding with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[16px]")).toEqual({padding:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[16]")).toEqual({padding:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[100px]")).toEqual({padding:100});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[100]")).toEqual({padding:100});});(0,_vitest.it)("should parse padding directional with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-[24px]")).toEqual({paddingTop:24});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-[32]")).toEqual({paddingRight:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-[16px]")).toEqual({paddingBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-[48]")).toEqual({paddingLeft:48});});(0,_vitest.it)("should parse padding horizontal/vertical with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("px-[20px]")).toEqual({paddingHorizontal:20});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-[30]")).toEqual({paddingVertical:30});});});(0,_vitest.describe)("parseSpacing - gap",function(){(0,_vitest.it)("should parse gap",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-0")).toEqual({gap:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-4")).toEqual({gap:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-8")).toEqual({gap:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-96")).toEqual({gap:384});});(0,_vitest.it)("should parse gap with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-0.5")).toEqual({gap:2});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-1.5")).toEqual({gap:6});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-2.5")).toEqual({gap:10});});(0,_vitest.it)("should parse gap with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[16px]")).toEqual({gap:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[16]")).toEqual({gap:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[100px]")).toEqual({gap:100});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[100]")).toEqual({gap:100});});});(0,_vitest.describe)("parseSpacing - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("invalid")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("m")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("margin-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("padding-4")).toBeNull();});(0,_vitest.it)("should return null for invalid spacing values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-invalid")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p-999")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-abc")).toBeNull();});(0,_vitest.it)("should return null for arbitrary values with unsupported units",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16rem]")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[2em]")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[50%]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p-16]")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[]")).toBeNull();});(0,_vitest.it)("should handle edge case spacing values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-0")).toEqual({margin:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-0")).toEqual({padding:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-0")).toEqual({gap:0});});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("sm-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("margin-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("padding-4")).toBeNull();});});(0,_vitest.describe)("parseSpacing - comprehensive coverage",function(){(0,_vitest.it)("should parse all margin directions with same value",function(){var value=16;(0,_vitest.expect)((0,_spacing.parseSpacing)("m-4")).toEqual({margin:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-4")).toEqual({marginHorizontal:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-4")).toEqual({marginVertical:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-4")).toEqual({marginTop:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-4")).toEqual({marginRight:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-4")).toEqual({marginBottom:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-4")).toEqual({marginLeft:value});});(0,_vitest.it)("should parse all padding directions with same value",function(){var value=16;(0,_vitest.expect)((0,_spacing.parseSpacing)("p-4")).toEqual({padding:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-4")).toEqual({paddingHorizontal:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-4")).toEqual({paddingVertical:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-4")).toEqual({paddingTop:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-4")).toEqual({paddingRight:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-4")).toEqual({paddingBottom:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-4")).toEqual({paddingLeft:value});});(0,_vitest.it)("should handle large spacing values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-96")).toEqual({margin:384});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-96")).toEqual({padding:384});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-96")).toEqual({gap:384});});(0,_vitest.it)("should handle arbitrary values across all margin directions",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[50px]")).toEqual({margin:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-[50px]")).toEqual({marginHorizontal:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-[50px]")).toEqual({marginVertical:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-[50px]")).toEqual({marginTop:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-[50px]")).toEqual({marginRight:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-[50px]")).toEqual({marginBottom:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-[50px]")).toEqual({marginLeft:50});});(0,_vitest.it)("should handle arbitrary values across all padding directions",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[50px]")).toEqual({padding:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-[50px]")).toEqual({paddingHorizontal:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-[50px]")).toEqual({paddingVertical:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-[50px]")).toEqual({paddingTop:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-[50px]")).toEqual({paddingRight:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-[50px]")).toEqual({paddingBottom:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-[50px]")).toEqual({paddingLeft:50});});});
|
|
1
|
+
var _vitest=require("vitest");var _spacing=require("./spacing");(0,_vitest.describe)("SPACING_SCALE",function(){(0,_vitest.it)("should export complete spacing scale",function(){(0,_vitest.expect)(_spacing.SPACING_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("parseSpacing - margin",function(){(0,_vitest.it)("should parse margin all sides",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-0")).toEqual({margin:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-4")).toEqual({margin:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-8")).toEqual({margin:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-96")).toEqual({margin:384});});(0,_vitest.it)("should parse margin with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-0.5")).toEqual({margin:2});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-1.5")).toEqual({margin:6});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-2.5")).toEqual({margin:10});});(0,_vitest.it)("should parse margin horizontal",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-0")).toEqual({marginHorizontal:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-4")).toEqual({marginHorizontal:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-8")).toEqual({marginHorizontal:32});});(0,_vitest.it)("should parse margin vertical",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("my-0")).toEqual({marginVertical:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-4")).toEqual({marginVertical:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-8")).toEqual({marginVertical:32});});(0,_vitest.it)("should parse margin directional",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-4")).toEqual({marginTop:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-4")).toEqual({marginRight:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-4")).toEqual({marginBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-4")).toEqual({marginLeft:16});});(0,_vitest.it)("should parse margin with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16px]")).toEqual({margin:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16]")).toEqual({margin:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[100px]")).toEqual({margin:100});(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[100]")).toEqual({margin:100});});(0,_vitest.it)("should parse margin directional with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-[24px]")).toEqual({marginTop:24});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-[32]")).toEqual({marginRight:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-[16px]")).toEqual({marginBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-[48]")).toEqual({marginLeft:48});});(0,_vitest.it)("should parse margin horizontal/vertical with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-[20px]")).toEqual({marginHorizontal:20});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-[30]")).toEqual({marginVertical:30});});});(0,_vitest.describe)("parseSpacing - negative margin",function(){(0,_vitest.it)("should parse negative margin all sides",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-0")).toEqual({margin:-0});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-4")).toEqual({margin:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-8")).toEqual({margin:-32});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-96")).toEqual({margin:-384});});(0,_vitest.it)("should parse negative margin with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-0.5")).toEqual({margin:-2});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-1.5")).toEqual({margin:-6});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-2.5")).toEqual({margin:-10});});(0,_vitest.it)("should parse negative margin horizontal",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-mx-4")).toEqual({marginHorizontal:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-mx-8")).toEqual({marginHorizontal:-32});});(0,_vitest.it)("should parse negative margin vertical",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-my-4")).toEqual({marginVertical:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-my-8")).toEqual({marginVertical:-32});});(0,_vitest.it)("should parse negative margin directional",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-mt-4")).toEqual({marginTop:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-mr-4")).toEqual({marginRight:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-mb-4")).toEqual({marginBottom:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-ml-4")).toEqual({marginLeft:-16});});(0,_vitest.it)("should parse negative margin with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-[16px]")).toEqual({margin:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-[16]")).toEqual({margin:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-[100px]")).toEqual({margin:-100});(0,_vitest.expect)((0,_spacing.parseSpacing)("-m-[100]")).toEqual({margin:-100});});(0,_vitest.it)("should parse negative margin directional with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-mt-[24px]")).toEqual({marginTop:-24});(0,_vitest.expect)((0,_spacing.parseSpacing)("-mr-[32]")).toEqual({marginRight:-32});(0,_vitest.expect)((0,_spacing.parseSpacing)("-mb-[16px]")).toEqual({marginBottom:-16});(0,_vitest.expect)((0,_spacing.parseSpacing)("-ml-[48]")).toEqual({marginLeft:-48});});(0,_vitest.it)("should parse negative margin horizontal/vertical with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-mx-[20px]")).toEqual({marginHorizontal:-20});(0,_vitest.expect)((0,_spacing.parseSpacing)("-my-[30]")).toEqual({marginVertical:-30});});(0,_vitest.it)("should not parse negative padding (invalid)",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-p-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("-px-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("-pt-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("-p-[16px]")).toBeNull();});(0,_vitest.it)("should not parse negative gap (invalid)",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("-gap-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("-gap-[16px]")).toBeNull();});});(0,_vitest.describe)("parseSpacing - padding",function(){(0,_vitest.it)("should parse padding all sides",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-0")).toEqual({padding:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-4")).toEqual({padding:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-8")).toEqual({padding:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-96")).toEqual({padding:384});});(0,_vitest.it)("should parse padding with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-0.5")).toEqual({padding:2});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-1.5")).toEqual({padding:6});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-2.5")).toEqual({padding:10});});(0,_vitest.it)("should parse padding horizontal",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("px-0")).toEqual({paddingHorizontal:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-4")).toEqual({paddingHorizontal:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-8")).toEqual({paddingHorizontal:32});});(0,_vitest.it)("should parse padding vertical",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("py-0")).toEqual({paddingVertical:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-4")).toEqual({paddingVertical:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-8")).toEqual({paddingVertical:32});});(0,_vitest.it)("should parse padding directional",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-4")).toEqual({paddingTop:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-4")).toEqual({paddingRight:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-4")).toEqual({paddingBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-4")).toEqual({paddingLeft:16});});(0,_vitest.it)("should parse padding with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[16px]")).toEqual({padding:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[16]")).toEqual({padding:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[100px]")).toEqual({padding:100});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[100]")).toEqual({padding:100});});(0,_vitest.it)("should parse padding directional with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-[24px]")).toEqual({paddingTop:24});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-[32]")).toEqual({paddingRight:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-[16px]")).toEqual({paddingBottom:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-[48]")).toEqual({paddingLeft:48});});(0,_vitest.it)("should parse padding horizontal/vertical with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("px-[20px]")).toEqual({paddingHorizontal:20});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-[30]")).toEqual({paddingVertical:30});});});(0,_vitest.describe)("parseSpacing - gap",function(){(0,_vitest.it)("should parse gap",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-0")).toEqual({gap:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-4")).toEqual({gap:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-8")).toEqual({gap:32});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-96")).toEqual({gap:384});});(0,_vitest.it)("should parse gap with fractional values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-0.5")).toEqual({gap:2});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-1.5")).toEqual({gap:6});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-2.5")).toEqual({gap:10});});(0,_vitest.it)("should parse gap with arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[16px]")).toEqual({gap:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[16]")).toEqual({gap:16});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[100px]")).toEqual({gap:100});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[100]")).toEqual({gap:100});});});(0,_vitest.describe)("parseSpacing - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("invalid")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("m")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("margin-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("padding-4")).toBeNull();});(0,_vitest.it)("should return null for invalid spacing values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-invalid")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p-999")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-abc")).toBeNull();});(0,_vitest.it)("should return null for arbitrary values with unsupported units",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16rem]")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[2em]")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[50%]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[16")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("p-16]")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-[]")).toBeNull();});(0,_vitest.it)("should handle edge case spacing values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-0")).toEqual({margin:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-0")).toEqual({padding:0});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-0")).toEqual({gap:0});});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("sm-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("margin-4")).toBeNull();(0,_vitest.expect)((0,_spacing.parseSpacing)("padding-4")).toBeNull();});});(0,_vitest.describe)("parseSpacing - comprehensive coverage",function(){(0,_vitest.it)("should parse all margin directions with same value",function(){var value=16;(0,_vitest.expect)((0,_spacing.parseSpacing)("m-4")).toEqual({margin:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-4")).toEqual({marginHorizontal:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-4")).toEqual({marginVertical:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-4")).toEqual({marginTop:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-4")).toEqual({marginRight:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-4")).toEqual({marginBottom:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-4")).toEqual({marginLeft:value});});(0,_vitest.it)("should parse all padding directions with same value",function(){var value=16;(0,_vitest.expect)((0,_spacing.parseSpacing)("p-4")).toEqual({padding:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-4")).toEqual({paddingHorizontal:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-4")).toEqual({paddingVertical:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-4")).toEqual({paddingTop:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-4")).toEqual({paddingRight:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-4")).toEqual({paddingBottom:value});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-4")).toEqual({paddingLeft:value});});(0,_vitest.it)("should handle large spacing values",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-96")).toEqual({margin:384});(0,_vitest.expect)((0,_spacing.parseSpacing)("p-96")).toEqual({padding:384});(0,_vitest.expect)((0,_spacing.parseSpacing)("gap-96")).toEqual({gap:384});});(0,_vitest.it)("should handle arbitrary values across all margin directions",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("m-[50px]")).toEqual({margin:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mx-[50px]")).toEqual({marginHorizontal:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("my-[50px]")).toEqual({marginVertical:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mt-[50px]")).toEqual({marginTop:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mr-[50px]")).toEqual({marginRight:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("mb-[50px]")).toEqual({marginBottom:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("ml-[50px]")).toEqual({marginLeft:50});});(0,_vitest.it)("should handle arbitrary values across all padding directions",function(){(0,_vitest.expect)((0,_spacing.parseSpacing)("p-[50px]")).toEqual({padding:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("px-[50px]")).toEqual({paddingHorizontal:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("py-[50px]")).toEqual({paddingVertical:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pt-[50px]")).toEqual({paddingTop:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pr-[50px]")).toEqual({paddingRight:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pb-[50px]")).toEqual({paddingBottom:50});(0,_vitest.expect)((0,_spacing.parseSpacing)("pl-[50px]")).toEqual({paddingLeft:50});});});
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var E=Object.defineProperty,ut=Object.defineProperties,dt=Object.getOwnPropertyDescriptor,pt=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var H=(t,e,r)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U=(t,e)=>{for(var r in e||(e={}))B.call(e,r)&&H(t,r,e[r]);if(F)for(var r of F(e))bt.call(e,r)&&H(t,r,e[r]);return t},G=(t,e)=>ut(t,pt(e));var ht=(t,e)=>{for(var r in e)E(t,r,{get:e[r],enumerable:!0})},yt=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of gt(e))!B.call(t,n)&&n!==r&&E(t,n,{get:()=>e[n],enumerable:!(i=dt(e,n))||i.enumerable});return t};var mt=t=>yt(E({},"__esModule",{value:!0}),t);var se={};ht(se,{clearCache:()=>ee,getCacheStats:()=>re,getCustomColors:()=>te,setConfig:()=>Qt,tw:()=>ne,twStyle:()=>ie});module.exports=mt(se);var X={"aspect-auto":void 0,"aspect-square":1,"aspect-video":1.7777777777777777};function xt(t){let e=t.match(/^\[(\d+)\/(\d+)\]$/);if(e){let r=Number.parseInt(e[1],10),i=Number.parseInt(e[2],10);return i===0?(process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid aspect ratio: ${t}. Denominator cannot be zero.`),null):r/i}return null}function _(t){if(!t.startsWith("aspect-"))return null;if(t in X){let i=X[t];return i===void 0?{}:{aspectRatio:i}}let e=t.substring(7),r=xt(e);return r!==null?{aspectRatio:r}:null}var Y={"":1,0:0,2:2,4:4,8:8},T={none:0,sm:2,"":4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999},Z={t:"borderTopWidth",r:"borderRightWidth",b:"borderBottomWidth",l:"borderLeftWidth"},q={tl:"borderTopLeftRadius",tr:"borderTopRightRadius",bl:"borderBottomLeftRadius",br:"borderBottomRightRadius"},St={t:["borderTopLeftRadius","borderTopRightRadius"],r:["borderTopRightRadius","borderBottomRightRadius"],b:["borderBottomLeftRadius","borderBottomRightRadius"],l:["borderTopLeftRadius","borderBottomLeftRadius"]};function J(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary border width value: ${t}. Only px values are supported (e.g., [8px] or [8]).`),null)}function M(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary border radius value: ${t}. Only px values are supported (e.g., [12px] or [12]).`),null)}function v(t){return t==="border-solid"?{borderStyle:"solid"}:t==="border-dotted"?{borderStyle:"dotted"}:t==="border-dashed"?{borderStyle:"dashed"}:t.startsWith("border-")?wt(t):t==="border"?{borderWidth:1}:t.startsWith("rounded")?Ot(t):null}function wt(t){let e=t.match(/^border-([trbl])(?:-(.+))?$/);if(e){let n=e[1],s=e[2]||"";if(s.startsWith("[")){let a=J(s);return a!==null?{[Z[n]]:a}:null}let o=Y[s];return o!==void 0?{[Z[n]]:o}:null}let r=t.match(/^border-(\d+)$/);if(r){let n=Y[r[1]];if(n!==void 0)return{borderWidth:n}}let i=t.match(/^border-(\[.+\])$/);if(i){let n=J(i[1]);if(n!==null)return{borderWidth:n}}return null}function Ot(t){let e=t.substring(7);if(e==="")return{borderRadius:T[""]};if(!e.startsWith("-"))return null;let r=e.substring(1);if(r==="")return null;let i=r.match(/^(tl|tr|bl|br)(?:-(.+))?$/);if(i){let o=i[1],a=i[2]||"";if(a.startsWith("[")){let d=M(a);return d!==null?{[q[o]]:d}:null}let f=T[a];return f!==void 0?{[q[o]]:f}:null}let n=r.match(/^([trbl])(?:-(.+))?$/);if(n){let o=n[1],a=n[2]||"",f;if(a.startsWith("[")){let d=M(a);if(d!==null)f=d;else return null}else f=T[a];if(f!==void 0){let d={};return St[o].forEach(p=>d[p]=f),d}return null}if(r.startsWith("[")){let o=M(r);return o!==null?{borderRadius:o}:null}let s=T[r];return s!==void 0?{borderRadius:s}:null}var Q={red:{50:"#fef2f2",100:"#ffe2e2",200:"#ffc9c9",300:"#ffa2a2",400:"#ff6467",500:"#fb2c36",600:"#e7000b",700:"#c10007",800:"#9f0712",900:"#82181a",950:"#460809"},orange:{50:"#fff7ed",100:"#ffedd4",200:"#ffd6a7",300:"#ffb86a",400:"#ff8904",500:"#ff6900",600:"#f54900",700:"#ca3500",800:"#9f2d00",900:"#7e2a0c",950:"#441306"},amber:{50:"#fffbeb",100:"#fef3c6",200:"#fee685",300:"#ffd230",400:"#ffb900",500:"#fe9a00",600:"#e17100",700:"#bb4d00",800:"#973c00",900:"#7b3306",950:"#461901"},yellow:{50:"#fefce8",100:"#fef9c2",200:"#fff085",300:"#ffdf20",400:"#fdc700",500:"#f0b100",600:"#d08700",700:"#a65f00",800:"#894b00",900:"#733e0a",950:"#432004"},lime:{50:"#f7fee7",100:"#ecfcca",200:"#d8f999",300:"#bbf451",400:"#9ae600",500:"#7ccf00",600:"#5ea500",700:"#497d00",800:"#3c6300",900:"#35530e",950:"#192e03"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#b9f8cf",300:"#7bf1a8",400:"#05df72",500:"#00c950",600:"#00a63e",700:"#008236",800:"#016630",900:"#0d542b",950:"#032e15"},emerald:{50:"#ecfdf5",100:"#d0fae5",200:"#a4f4cf",300:"#5ee9b5",400:"#00d492",500:"#00bc7d",600:"#009966",700:"#007a55",800:"#006045",900:"#004f3b",950:"#002c22"},teal:{50:"#f0fdfa",100:"#cbfbf1",200:"#96f7e4",300:"#46ecd5",400:"#00d5be",500:"#00bba7",600:"#009689",700:"#00786f",800:"#005f5a",900:"#0b4f4a",950:"#022f2e"},cyan:{50:"#ecfeff",100:"#cefafe",200:"#a2f4fd",300:"#53eafd",400:"#00d3f2",500:"#00b8db",600:"#0092b8",700:"#007595",800:"#005f78",900:"#104e64",950:"#053345"},sky:{50:"#f0f9ff",100:"#dff2fe",200:"#b8e6fe",300:"#74d4ff",400:"#00bcff",500:"#00a6f4",600:"#0084d1",700:"#0069a8",800:"#00598a",900:"#024a70",950:"#052f4a"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bedbff",300:"#8ec5ff",400:"#51a2ff",500:"#2b7fff",600:"#155dfc",700:"#1447e6",800:"#193cb8",900:"#1c398e",950:"#162456"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c6d2ff",300:"#a3b3ff",400:"#7c86ff",500:"#615fff",600:"#4f39f6",700:"#432dd7",800:"#372aac",900:"#312c85",950:"#1e1a4d"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6ff",300:"#c4b4ff",400:"#a684ff",500:"#8e51ff",600:"#7f22fe",700:"#7008e7",800:"#5d0ec0",900:"#4d179a",950:"#2f0d68"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d4ff",300:"#dab2ff",400:"#c27aff",500:"#ad46ff",600:"#9810fa",700:"#8200db",800:"#6e11b0",900:"#59168b",950:"#3c0366"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f6cfff",300:"#f4a8ff",400:"#ed6aff",500:"#e12afb",600:"#c800de",700:"#a800b7",800:"#8a0194",900:"#721378",950:"#4b004f"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fccee8",300:"#fda5d5",400:"#fb64b6",500:"#f6339a",600:"#e60076",700:"#c6005c",800:"#a3004c",900:"#861043",950:"#510424"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#ffccd3",300:"#ffa1ad",400:"#ff637e",500:"#ff2056",600:"#ec003f",700:"#c70036",800:"#a50036",900:"#8b0836",950:"#4d0218"},slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cad5e2",400:"#90a1b9",500:"#62748e",600:"#45556c",700:"#314158",800:"#1d293d",900:"#0f172b",950:"#020618"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5dc",400:"#99a1af",500:"#6a7282",600:"#4a5565",700:"#364153",800:"#1e2939",900:"#101828",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#9f9fa9",500:"#71717b",600:"#52525c",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a1a1a1",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a6a09b",500:"#79716b",600:"#57534d",700:"#44403b",800:"#292524",900:"#1c1917",950:"#0c0a09"}};function C(t,e=""){let r={};for(let[i,n]of Object.entries(t)){let s=i==="DEFAULT"&&e?e:e?`${e}-${i}`:i;typeof n=="string"?r[s]=n:typeof n=="object"&&n!==null&&Object.assign(r,C(n,s))}return r}var Rt=G(U({},C(Q)),{white:"#FFFFFF",black:"#000000",transparent:"transparent"});function tt(t,e){if(t==="transparent")return"transparent";let r=t.replace(/^#/,""),i=r.length===3?r.split("").map(o=>o+o).join(""):r,s=Math.round(e/100*255).toString(16).padStart(2,"0").toUpperCase();return`#${i.toUpperCase()}${s}`}function et(t){let e=t.match(/^\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\]$/);if(e){let r=e[1];return r.length===3?`#${r.split("").map(n=>n+n).join("")}`:`#${r}`}return t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary color value: ${t}. Only hex colors are supported (e.g., [#ff0000], [#f00], or [#ff0000aa]).`),null}function A(t,e){let r=n=>{var s;return(s=e==null?void 0:e[n])!=null?s:Rt[n]},i=n=>{var a;let s=n.match(/^(.+)\/(\d+)$/);if(s){let f=s[1],d=Number.parseInt(s[2],10);if(d<0||d>100)return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid opacity value: ${d}. Opacity must be between 0 and 100.`),null;let p=et(f);if(p!==null)return tt(p,d);let g=r(f);return g?tt(g,d):null}let o=et(n);return o!==null?o:(a=r(n))!=null?a:null};if(t.startsWith("bg-")){let n=t.substring(3);if(n.startsWith("[")&&!n.startsWith("[#"))return null;let s=i(n);if(s)return{backgroundColor:s}}if(t.startsWith("text-")){let n=t.substring(5);if(n.startsWith("[")&&!n.startsWith("[#"))return null;let s=i(n);if(s)return{color:s}}if(t.startsWith("border-")&&!t.match(/^border-[0-9]/)){let n=t.substring(7);if(n.startsWith("[")&&!n.startsWith("[#"))return null;let s=i(n);if(s)return{borderColor:s}}return null}function h(t){let e=t.match(/^\[(-?\d+)(?:px)?\]$/);if(e)return parseInt(e[1],10);let r=t.match(/^\[(-?\d+(?:\.\d+)?)%\]$/);return r?`${r[1]}%`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary inset unit: ${t}. Only px and % are supported.`),null)}function Wt(t){let e=t.match(/^\[(-?\d+)\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary z-index: ${t}. Only integers are supported.`),null)}var Ct={flex:{display:"flex"},hidden:{display:"none"}},Et={"flex-row":{flexDirection:"row"},"flex-row-reverse":{flexDirection:"row-reverse"},"flex-col":{flexDirection:"column"},"flex-col-reverse":{flexDirection:"column-reverse"}},Tt={"flex-wrap":{flexWrap:"wrap"},"flex-wrap-reverse":{flexWrap:"wrap-reverse"},"flex-nowrap":{flexWrap:"nowrap"}},At={"flex-1":{flex:1},"flex-auto":{flex:1},"flex-none":{flex:0}},Nt={grow:{flexGrow:1},"grow-0":{flexGrow:0},shrink:{flexShrink:1},"shrink-0":{flexShrink:0}},_t={"justify-start":{justifyContent:"flex-start"},"justify-end":{justifyContent:"flex-end"},"justify-center":{justifyContent:"center"},"justify-between":{justifyContent:"space-between"},"justify-around":{justifyContent:"space-around"},"justify-evenly":{justifyContent:"space-evenly"}},Mt={"items-start":{alignItems:"flex-start"},"items-end":{alignItems:"flex-end"},"items-center":{alignItems:"center"},"items-baseline":{alignItems:"baseline"},"items-stretch":{alignItems:"stretch"}},vt={"self-auto":{alignSelf:"auto"},"self-start":{alignSelf:"flex-start"},"self-end":{alignSelf:"flex-end"},"self-center":{alignSelf:"center"},"self-stretch":{alignSelf:"stretch"},"self-baseline":{alignSelf:"baseline"}},It={"content-start":{alignContent:"flex-start"},"content-end":{alignContent:"flex-end"},"content-center":{alignContent:"center"},"content-between":{alignContent:"space-between"},"content-around":{alignContent:"space-around"},"content-stretch":{alignContent:"stretch"}},jt={absolute:{position:"absolute"},relative:{position:"relative"}},$t={"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"}},Pt={"opacity-0":{opacity:0},"opacity-5":{opacity:.05},"opacity-10":{opacity:.1},"opacity-15":{opacity:.15},"opacity-20":{opacity:.2},"opacity-25":{opacity:.25},"opacity-30":{opacity:.3},"opacity-35":{opacity:.35},"opacity-40":{opacity:.4},"opacity-45":{opacity:.45},"opacity-50":{opacity:.5},"opacity-55":{opacity:.55},"opacity-60":{opacity:.6},"opacity-65":{opacity:.65},"opacity-70":{opacity:.7},"opacity-75":{opacity:.75},"opacity-80":{opacity:.8},"opacity-85":{opacity:.85},"opacity-90":{opacity:.9},"opacity-95":{opacity:.95},"opacity-100":{opacity:1}},Vt={0:0,10:10,20:20,30:30,40:40,50:50,auto:0},y={0:0,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,8:32,10:40,12:48,16:64,20:80,24:96};function I(t){var e,r,i,n,s,o,a,f,d,p,g,K;if(t.startsWith("z-")){let u=t.substring(2),c=Wt(u);if(c!==null)return{zIndex:c};let l=Vt[u];if(l!==void 0)return{zIndex:l}}if(t.startsWith("top-")){let u=t.substring(4);if(u==="auto")return{};let c=h(u);if(c!==null)return{top:c};let l=y[u];if(l!==void 0)return{top:l}}if(t.startsWith("right-")){let u=t.substring(6);if(u==="auto")return{};let c=h(u);if(c!==null)return{right:c};let l=y[u];if(l!==void 0)return{right:l}}if(t.startsWith("bottom-")){let u=t.substring(7);if(u==="auto")return{};let c=h(u);if(c!==null)return{bottom:c};let l=y[u];if(l!==void 0)return{bottom:l}}if(t.startsWith("left-")){let u=t.substring(5);if(u==="auto")return{};let c=h(u);if(c!==null)return{left:c};let l=y[u];if(l!==void 0)return{left:l}}if(t.startsWith("inset-x-")){let u=t.substring(8),c=h(u);if(c!==null)return{left:c,right:c};let l=y[u];if(l!==void 0)return{left:l,right:l}}if(t.startsWith("inset-y-")){let u=t.substring(8),c=h(u);if(c!==null)return{top:c,bottom:c};let l=y[u];if(l!==void 0)return{top:l,bottom:l}}if(t.startsWith("inset-")){let u=t.substring(6),c=h(u);if(c!==null)return{top:c,right:c,bottom:c,left:c};let l=y[u];if(l!==void 0)return{top:l,right:l,bottom:l,left:l}}return(K=(g=(p=(d=(f=(a=(o=(s=(n=(i=(r=(e=Ct[t])!=null?e:Et[t])!=null?r:Tt[t])!=null?i:At[t])!=null?n:Nt[t])!=null?s:_t[t])!=null?o:Mt[t])!=null?a:vt[t])!=null?f:It[t])!=null?d:jt[t])!=null?p:$t[t])!=null?g:Pt[t])!=null?K:null}var rt={"shadow-sm":{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:1,elevation:1},shadow:{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:.1,shadowRadius:2,elevation:2},"shadow-md":{shadowColor:"#000000",shadowOffset:{width:0,height:3},shadowOpacity:.15,shadowRadius:4,elevation:4},"shadow-lg":{shadowColor:"#000000",shadowOffset:{width:0,height:6},shadowOpacity:.2,shadowRadius:8,elevation:8},"shadow-xl":{shadowColor:"#000000",shadowOffset:{width:0,height:10},shadowOpacity:.25,shadowRadius:12,elevation:12},"shadow-2xl":{shadowColor:"#000000",shadowOffset:{width:0,height:20},shadowOpacity:.3,shadowRadius:24,elevation:16},"shadow-none":{shadowColor:"transparent",shadowOffset:{width:0,height:0},shadowOpacity:0,shadowRadius:0,elevation:0}};function j(t){return t in rt?rt[t]:null}var x={0:0,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},S={full:"100%","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%"};function w(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);if(e)return parseInt(e[1],10);let r=t.match(/^\[(\d+(?:\.\d+)?)%\]$/);return r?`${r[1]}%`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary size unit: ${t}. Only px and % are supported.`),null)}function $(t){if(t.startsWith("w-")){let e=t.substring(2),r=w(e);if(r!==null)return{width:r};let i=S[e];if(i)return{width:i};let n=x[e];if(n!==void 0)return{width:n};if(e==="auto")return{width:"auto"}}if(t.startsWith("h-")){let e=t.substring(2),r=w(e);if(r!==null)return{height:r};let i=S[e];if(i)return{height:i};let n=x[e];if(n!==void 0)return{height:n};if(e==="auto")return{height:"auto"}}if(t.startsWith("min-w-")){let e=t.substring(6),r=w(e);if(r!==null)return{minWidth:r};let i=S[e];if(i)return{minWidth:i};let n=x[e];if(n!==void 0)return{minWidth:n}}if(t.startsWith("min-h-")){let e=t.substring(6),r=w(e);if(r!==null)return{minHeight:r};let i=S[e];if(i)return{minHeight:i};let n=x[e];if(n!==void 0)return{minHeight:n}}if(t.startsWith("max-w-")){let e=t.substring(6),r=w(e);if(r!==null)return{maxWidth:r};let i=S[e];if(i)return{maxWidth:i};let n=x[e];if(n!==void 0)return{maxWidth:n}}if(t.startsWith("max-h-")){let e=t.substring(6),r=w(e);if(r!==null)return{maxHeight:r};let i=S[e];if(i)return{maxHeight:i};let n=x[e];if(n!==void 0)return{maxHeight:n}}return null}var O={0:0,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384};function P(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary spacing value: ${t}. Only px values are supported (e.g., [16px] or [16]).`),null)}function V(t){let e=t.match(/^m([xytrbls]?)-(.+)$/);if(e){let[,n,s]=e,o=P(s);if(o!==null)return nt(n,o);let a=O[s];if(a!==void 0)return nt(n,a)}let r=t.match(/^p([xytrbls]?)-(.+)$/);if(r){let[,n,s]=r,o=P(s);if(o!==null)return it(n,o);let a=O[s];if(a!==void 0)return it(n,a)}let i=t.match(/^gap-(.+)$/);if(i){let n=i[1],s=P(n);if(s!==null)return{gap:s};let o=O[n];if(o!==void 0)return{gap:o}}return null}function nt(t,e){switch(t){case"":return{margin:e};case"x":return{marginHorizontal:e};case"y":return{marginVertical:e};case"t":return{marginTop:e};case"r":return{marginRight:e};case"b":return{marginBottom:e};case"l":return{marginLeft:e};default:return{}}}function it(t,e){switch(t){case"":return{padding:e};case"x":return{paddingHorizontal:e};case"y":return{paddingVertical:e};case"t":return{paddingTop:e};case"r":return{paddingRight:e};case"b":return{paddingBottom:e};case"l":return{paddingLeft:e};default:return{}}}var L={0:0,50:.5,75:.75,90:.9,95:.95,100:1,105:1.05,110:1.1,125:1.25,150:1.5,200:2},N={0:0,1:1,2:2,3:3,6:6,12:12,45:45,90:90,180:180},st={0:0,1:1,2:2,3:3,6:6,12:12},Lt={0:0,100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900,1e3:1e3};function D(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?)\]$/);return e?parseFloat(e[1]):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary scale value: ${t}. Only numbers are supported (e.g., [1.5], [0.75]).`),null)}function R(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?)deg\]$/);return e?`${e[1]}deg`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary rotation value: ${t}. Only deg unit is supported (e.g., [45deg], [-15deg]).`),null)}function ot(t){let e=t.match(/^\[(-?\d+)(?:px)?\]$/);if(e)return parseInt(e[1],10);let r=t.match(/^\[(-?\d+(?:\.\d+)?)%\]$/);return r?`${r[1]}%`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary translation unit: ${t}. Only px and % are supported.`),null)}function Dt(t){let e=t.match(/^\[(-?\d+)\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary perspective value: ${t}. Only integers are supported (e.g., [1500]).`),null)}function z(t){if(t.startsWith("origin-"))return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] transform-origin is not supported in React Native. Class "${t}" will be ignored.`),null;if(t.startsWith("scale-")){let e=t.substring(6),r=D(e);if(r!==null)return{transform:[{scale:r}]};let i=L[e];if(i!==void 0)return{transform:[{scale:i}]}}if(t.startsWith("scale-x-")){let e=t.substring(8),r=D(e);if(r!==null)return{transform:[{scaleX:r}]};let i=L[e];if(i!==void 0)return{transform:[{scaleX:i}]}}if(t.startsWith("scale-y-")){let e=t.substring(8),r=D(e);if(r!==null)return{transform:[{scaleY:r}]};let i=L[e];if(i!==void 0)return{transform:[{scaleY:i}]}}if(t.startsWith("rotate-")||t.startsWith("-rotate-")){let e=t.startsWith("-"),r=e?t.substring(8):t.substring(7),i=R(r);if(i!==null)return{transform:[{rotate:e?`-${i}`:i}]};let n=N[r];if(n!==void 0)return{transform:[{rotate:`${e?-n:n}deg`}]}}if(t.startsWith("rotate-x-")||t.startsWith("-rotate-x-")){let e=t.startsWith("-"),r=e?t.substring(10):t.substring(9),i=R(r);if(i!==null)return{transform:[{rotateX:e?`-${i}`:i}]};let n=N[r];if(n!==void 0)return{transform:[{rotateX:`${e?-n:n}deg`}]}}if(t.startsWith("rotate-y-")||t.startsWith("-rotate-y-")){let e=t.startsWith("-"),r=e?t.substring(10):t.substring(9),i=R(r);if(i!==null)return{transform:[{rotateY:e?`-${i}`:i}]};let n=N[r];if(n!==void 0)return{transform:[{rotateY:`${e?-n:n}deg`}]}}if(t.startsWith("rotate-z-")||t.startsWith("-rotate-z-")){let e=t.startsWith("-"),r=e?t.substring(10):t.substring(9),i=R(r);if(i!==null)return{transform:[{rotateZ:e?`-${i}`:i}]};let n=N[r];if(n!==void 0)return{transform:[{rotateZ:`${e?-n:n}deg`}]}}if(t.startsWith("translate-x-")||t.startsWith("-translate-x-")){let e=t.startsWith("-"),r=e?t.substring(13):t.substring(12),i=ot(r);if(i!==null)return{transform:[{translateX:typeof i=="number"?e?-i:i:e?`-${i}`:i}]};let n=O[r];if(n!==void 0)return{transform:[{translateX:e?-n:n}]}}if(t.startsWith("translate-y-")||t.startsWith("-translate-y-")){let e=t.startsWith("-"),r=e?t.substring(13):t.substring(12),i=ot(r);if(i!==null)return{transform:[{translateY:typeof i=="number"?e?-i:i:e?`-${i}`:i}]};let n=O[r];if(n!==void 0)return{transform:[{translateY:e?-n:n}]}}if(t.startsWith("skew-x-")||t.startsWith("-skew-x-")){let e=t.startsWith("-"),r=e?t.substring(8):t.substring(7),i=R(r);if(i!==null)return{transform:[{skewX:e?`-${i}`:i}]};let n=st[r];if(n!==void 0)return{transform:[{skewX:`${e?-n:n}deg`}]}}if(t.startsWith("skew-y-")||t.startsWith("-skew-y-")){let e=t.startsWith("-"),r=e?t.substring(8):t.substring(7),i=R(r);if(i!==null)return{transform:[{skewY:e?`-${i}`:i}]};let n=st[r];if(n!==void 0)return{transform:[{skewY:`${e?-n:n}deg`}]}}if(t.startsWith("perspective-")){let e=t.substring(12),r=Dt(e);if(r!==null)return{transform:[{perspective:r}]};let i=Lt[e];if(i!==void 0)return{transform:[{perspective:i}]}}return null}var zt={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128};var kt={"font-sans":{fontFamily:"System"},"font-serif":{fontFamily:"serif"},"font-mono":{fontFamily:"Courier"}},Kt={"font-thin":{fontWeight:"100"},"font-extralight":{fontWeight:"200"},"font-light":{fontWeight:"300"},"font-normal":{fontWeight:"400"},"font-medium":{fontWeight:"500"},"font-semibold":{fontWeight:"600"},"font-bold":{fontWeight:"700"},"font-extrabold":{fontWeight:"800"},"font-black":{fontWeight:"900"}},Ft={italic:{fontStyle:"italic"},"not-italic":{fontStyle:"normal"}},Ht={"text-left":{textAlign:"left"},"text-center":{textAlign:"center"},"text-right":{textAlign:"right"},"text-justify":{textAlign:"justify"}},Bt={underline:{textDecorationLine:"underline"},"line-through":{textDecorationLine:"line-through"},"no-underline":{textDecorationLine:"none"}},Ut={uppercase:{textTransform:"uppercase"},lowercase:{textTransform:"lowercase"},capitalize:{textTransform:"capitalize"},"normal-case":{textTransform:"none"}},Gt={3:12,4:16,5:20,6:24,7:28,8:32,9:36,10:40},Xt={"leading-none":{lineHeight:16},"leading-tight":{lineHeight:20},"leading-snug":{lineHeight:22},"leading-normal":{lineHeight:24},"leading-relaxed":{lineHeight:28},"leading-loose":{lineHeight:32}},Yt={"tracking-tighter":{letterSpacing:-.8},"tracking-tight":{letterSpacing:-.4},"tracking-normal":{letterSpacing:0},"tracking-wide":{letterSpacing:.4},"tracking-wider":{letterSpacing:.8},"tracking-widest":{letterSpacing:1.6}};function Zt(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary font size value: ${t}. Only px values are supported (e.g., [18px] or [18]).`),null)}function qt(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary line height value: ${t}. Only px values are supported (e.g., [24px] or [24]).`),null)}function k(t){var e,r,i,n,s,o,a,f;if(t.startsWith("text-")){let d=t.substring(5),p=Zt(d);if(p!==null)return{fontSize:p};let g=zt[d];if(g!==void 0)return{fontSize:g}}if(t.startsWith("leading-")){let d=t.substring(8),p=qt(d);if(p!==null)return{lineHeight:p};let g=Gt[d];if(g!==void 0)return{lineHeight:g}}return(f=(a=(o=(s=(n=(i=(r=(e=kt[t])!=null?e:Kt[t])!=null?r:Ft[t])!=null?i:Ht[t])!=null?n:Bt[t])!=null?s:Ut[t])!=null?o:Xt[t])!=null?a:Yt[t])!=null?f:null}function W(t,e){let r=t.split(/\s+/).filter(Boolean),i={};for(let n of r){let s=Jt(n,e);Object.assign(i,s)}return i}function Jt(t,e){let r=[V,v,i=>A(i,e),I,k,$,j,_,z];for(let i of r){let n=i(t);if(n!==null)return n}return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unknown class: "${t}"`),{}}var at=["active","focus","disabled"];function ft(t){return at.some(e=>t.includes(`${e}:`))}function ct(t){let e=t.split(/\s+/).filter(Boolean),r=[],i=new Map;for(let n of e){let s=!1;for(let o of at){let a=`${o}:`;if(n.startsWith(a)){let f=n.slice(a.length);i.has(o)||i.set(o,[]);let d=i.get(o);d&&d.push(f),s=!0;break}}s||r.push(n)}return{base:r,modifiers:i}}var b,m=new Map;function Qt(t){var e,r;(r=(e=t.theme)==null?void 0:e.extend)!=null&&r.colors?b=C(t.theme.extend.colors):b=void 0,m.clear()}function te(){return b}function ee(){m.clear()}function re(){return{size:m.size,keys:Array.from(m.keys())}}function lt(t){let e=m.get(t);if(e)return e;if(!ft(t)){let f={style:W(t,b)};return m.set(t,f),f}let{base:r,modifiers:i}=ct(t),n=r.join(" "),o={style:n?W(n,b):{}};if(i.has("active")){let a=i.get("active");if(a&&a.length>0){let f=a.join(" ");o.activeStyle=W(f,b)}}if(i.has("focus")){let a=i.get("focus");if(a&&a.length>0){let f=a.join(" ");o.focusStyle=W(f,b)}}if(i.has("disabled")){let a=i.get("disabled");if(a&&a.length>0){let f=a.join(" ");o.disabledStyle=W(f,b)}}return m.set(t,o),o}function ne(t,...e){let i=t.reduce((n,s,o)=>{let a=e[o],f=a?String(a):"";return n+s+f},"").trim().replace(/\s+/g," ");return i?lt(i):{style:{}}}function ie(t){let e=t.trim().replace(/\s+/g," ");if(e)return lt(e)}
|
|
1
|
+
"use strict";var C=Object.defineProperty,ut=Object.defineProperties,dt=Object.getOwnPropertyDescriptor,pt=Object.getOwnPropertyDescriptors,gt=Object.getOwnPropertyNames,F=Object.getOwnPropertySymbols;var B=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var H=(t,e,r)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,U=(t,e)=>{for(var r in e||(e={}))B.call(e,r)&&H(t,r,e[r]);if(F)for(var r of F(e))bt.call(e,r)&&H(t,r,e[r]);return t},G=(t,e)=>ut(t,pt(e));var yt=(t,e)=>{for(var r in e)C(t,r,{get:e[r],enumerable:!0})},ht=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!B.call(t,i)&&i!==r&&C(t,i,{get:()=>e[i],enumerable:!(n=dt(e,i))||n.enumerable});return t};var mt=t=>ht(C({},"__esModule",{value:!0}),t);var ae={};yt(ae,{clearCache:()=>ne,getCacheStats:()=>ie,getCustomColors:()=>re,setConfig:()=>ee,tw:()=>se,twStyle:()=>oe});module.exports=mt(ae);var X={"aspect-auto":void 0,"aspect-square":1,"aspect-video":1.7777777777777777};function xt(t){let e=t.match(/^\[(\d+)\/(\d+)\]$/);if(e){let r=Number.parseInt(e[1],10),n=Number.parseInt(e[2],10);return n===0?(process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid aspect ratio: ${t}. Denominator cannot be zero.`),null):r/n}return null}function N(t){if(!t.startsWith("aspect-"))return null;if(t in X){let n=X[t];return n===void 0?{aspectRatio:void 0}:{aspectRatio:n}}let e=t.substring(7),r=xt(e);return r!==null?{aspectRatio:r}:null}var Y={"":1,0:0,2:2,4:4,8:8},M={none:0,sm:2,"":4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999},Z={t:"borderTopWidth",r:"borderRightWidth",b:"borderBottomWidth",l:"borderLeftWidth"},q={tl:"borderTopLeftRadius",tr:"borderTopRightRadius",bl:"borderBottomLeftRadius",br:"borderBottomRightRadius"},St={t:["borderTopLeftRadius","borderTopRightRadius"],r:["borderTopRightRadius","borderBottomRightRadius"],b:["borderBottomLeftRadius","borderBottomRightRadius"],l:["borderTopLeftRadius","borderBottomLeftRadius"]};function J(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary border width value: ${t}. Only px values are supported (e.g., [8px] or [8]).`),null)}function _(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary border radius value: ${t}. Only px values are supported (e.g., [12px] or [12]).`),null)}function v(t){return t==="border-solid"?{borderStyle:"solid"}:t==="border-dotted"?{borderStyle:"dotted"}:t==="border-dashed"?{borderStyle:"dashed"}:t.startsWith("border-")?wt(t):t==="border"?{borderWidth:1}:t.startsWith("rounded")?Ot(t):null}function wt(t){let e=t.match(/^border-([trbl])(?:-(.+))?$/);if(e){let i=e[1],s=e[2]||"";if(s.startsWith("[")){let o=J(s);return o!==null?{[Z[i]]:o}:null}let a=Y[s];return a!==void 0?{[Z[i]]:a}:null}let r=t.match(/^border-(\d+)$/);if(r){let i=Y[r[1]];if(i!==void 0)return{borderWidth:i}}let n=t.match(/^border-(\[.+\])$/);if(n){let i=J(n[1]);if(i!==null)return{borderWidth:i}}return null}function Ot(t){let e=t.substring(7);if(e==="")return{borderRadius:M[""]};if(!e.startsWith("-"))return null;let r=e.substring(1);if(r==="")return null;let n=r.match(/^(tl|tr|bl|br)(?:-(.+))?$/);if(n){let a=n[1],o=n[2]||"";if(o.startsWith("[")){let c=_(o);return c!==null?{[q[a]]:c}:null}let f=M[o];return f!==void 0?{[q[a]]:f}:null}let i=r.match(/^([trbl])(?:-(.+))?$/);if(i){let a=i[1],o=i[2]||"",f;if(o.startsWith("[")){let c=_(o);if(c!==null)f=c;else return null}else f=M[o];if(f!==void 0){let c={};return St[a].forEach(p=>c[p]=f),c}return null}if(r.startsWith("[")){let a=_(r);return a!==null?{borderRadius:a}:null}let s=M[r];return s!==void 0?{borderRadius:s}:null}var Q={red:{50:"#fef2f2",100:"#ffe2e2",200:"#ffc9c9",300:"#ffa2a2",400:"#ff6467",500:"#fb2c36",600:"#e7000b",700:"#c10007",800:"#9f0712",900:"#82181a",950:"#460809"},orange:{50:"#fff7ed",100:"#ffedd4",200:"#ffd6a7",300:"#ffb86a",400:"#ff8904",500:"#ff6900",600:"#f54900",700:"#ca3500",800:"#9f2d00",900:"#7e2a0c",950:"#441306"},amber:{50:"#fffbeb",100:"#fef3c6",200:"#fee685",300:"#ffd230",400:"#ffb900",500:"#fe9a00",600:"#e17100",700:"#bb4d00",800:"#973c00",900:"#7b3306",950:"#461901"},yellow:{50:"#fefce8",100:"#fef9c2",200:"#fff085",300:"#ffdf20",400:"#fdc700",500:"#f0b100",600:"#d08700",700:"#a65f00",800:"#894b00",900:"#733e0a",950:"#432004"},lime:{50:"#f7fee7",100:"#ecfcca",200:"#d8f999",300:"#bbf451",400:"#9ae600",500:"#7ccf00",600:"#5ea500",700:"#497d00",800:"#3c6300",900:"#35530e",950:"#192e03"},green:{50:"#f0fdf4",100:"#dcfce7",200:"#b9f8cf",300:"#7bf1a8",400:"#05df72",500:"#00c950",600:"#00a63e",700:"#008236",800:"#016630",900:"#0d542b",950:"#032e15"},emerald:{50:"#ecfdf5",100:"#d0fae5",200:"#a4f4cf",300:"#5ee9b5",400:"#00d492",500:"#00bc7d",600:"#009966",700:"#007a55",800:"#006045",900:"#004f3b",950:"#002c22"},teal:{50:"#f0fdfa",100:"#cbfbf1",200:"#96f7e4",300:"#46ecd5",400:"#00d5be",500:"#00bba7",600:"#009689",700:"#00786f",800:"#005f5a",900:"#0b4f4a",950:"#022f2e"},cyan:{50:"#ecfeff",100:"#cefafe",200:"#a2f4fd",300:"#53eafd",400:"#00d3f2",500:"#00b8db",600:"#0092b8",700:"#007595",800:"#005f78",900:"#104e64",950:"#053345"},sky:{50:"#f0f9ff",100:"#dff2fe",200:"#b8e6fe",300:"#74d4ff",400:"#00bcff",500:"#00a6f4",600:"#0084d1",700:"#0069a8",800:"#00598a",900:"#024a70",950:"#052f4a"},blue:{50:"#eff6ff",100:"#dbeafe",200:"#bedbff",300:"#8ec5ff",400:"#51a2ff",500:"#2b7fff",600:"#155dfc",700:"#1447e6",800:"#193cb8",900:"#1c398e",950:"#162456"},indigo:{50:"#eef2ff",100:"#e0e7ff",200:"#c6d2ff",300:"#a3b3ff",400:"#7c86ff",500:"#615fff",600:"#4f39f6",700:"#432dd7",800:"#372aac",900:"#312c85",950:"#1e1a4d"},violet:{50:"#f5f3ff",100:"#ede9fe",200:"#ddd6ff",300:"#c4b4ff",400:"#a684ff",500:"#8e51ff",600:"#7f22fe",700:"#7008e7",800:"#5d0ec0",900:"#4d179a",950:"#2f0d68"},purple:{50:"#faf5ff",100:"#f3e8ff",200:"#e9d4ff",300:"#dab2ff",400:"#c27aff",500:"#ad46ff",600:"#9810fa",700:"#8200db",800:"#6e11b0",900:"#59168b",950:"#3c0366"},fuchsia:{50:"#fdf4ff",100:"#fae8ff",200:"#f6cfff",300:"#f4a8ff",400:"#ed6aff",500:"#e12afb",600:"#c800de",700:"#a800b7",800:"#8a0194",900:"#721378",950:"#4b004f"},pink:{50:"#fdf2f8",100:"#fce7f3",200:"#fccee8",300:"#fda5d5",400:"#fb64b6",500:"#f6339a",600:"#e60076",700:"#c6005c",800:"#a3004c",900:"#861043",950:"#510424"},rose:{50:"#fff1f2",100:"#ffe4e6",200:"#ffccd3",300:"#ffa1ad",400:"#ff637e",500:"#ff2056",600:"#ec003f",700:"#c70036",800:"#a50036",900:"#8b0836",950:"#4d0218"},slate:{50:"#f8fafc",100:"#f1f5f9",200:"#e2e8f0",300:"#cad5e2",400:"#90a1b9",500:"#62748e",600:"#45556c",700:"#314158",800:"#1d293d",900:"#0f172b",950:"#020618"},gray:{50:"#f9fafb",100:"#f3f4f6",200:"#e5e7eb",300:"#d1d5dc",400:"#99a1af",500:"#6a7282",600:"#4a5565",700:"#364153",800:"#1e2939",900:"#101828",950:"#030712"},zinc:{50:"#fafafa",100:"#f4f4f5",200:"#e4e4e7",300:"#d4d4d8",400:"#9f9fa9",500:"#71717b",600:"#52525c",700:"#3f3f46",800:"#27272a",900:"#18181b",950:"#09090b"},neutral:{50:"#fafafa",100:"#f5f5f5",200:"#e5e5e5",300:"#d4d4d4",400:"#a1a1a1",500:"#737373",600:"#525252",700:"#404040",800:"#262626",900:"#171717",950:"#0a0a0a"},stone:{50:"#fafaf9",100:"#f5f5f4",200:"#e7e5e4",300:"#d6d3d1",400:"#a6a09b",500:"#79716b",600:"#57534d",700:"#44403b",800:"#292524",900:"#1c1917",950:"#0c0a09"}};function T(t,e=""){let r={};for(let[n,i]of Object.entries(t)){let s=n==="DEFAULT"&&e?e:e?`${e}-${n}`:n;typeof i=="string"?r[s]=i:typeof i=="object"&&i!==null&&Object.assign(r,T(i,s))}return r}var Rt=G(U({},T(Q)),{white:"#FFFFFF",black:"#000000",transparent:"transparent"});function tt(t,e){if(t==="transparent")return"transparent";let r=t.replace(/^#/,""),n=r.length===3?r.split("").map(a=>a+a).join(""):r,s=Math.round(e/100*255).toString(16).padStart(2,"0").toUpperCase();return`#${n.toUpperCase()}${s}`}function et(t){let e=t.match(/^\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\]$/);if(e){let r=e[1];return r.length===3?`#${r.split("").map(i=>i+i).join("")}`:`#${r}`}return t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary color value: ${t}. Only hex colors are supported (e.g., [#ff0000], [#f00], or [#ff0000aa]).`),null}function E(t,e){let r=i=>{var s;return(s=e==null?void 0:e[i])!=null?s:Rt[i]},n=i=>{var o;let s=i.match(/^(.+)\/(\d+)$/);if(s){let f=s[1],c=Number.parseInt(s[2],10);if(c<0||c>100)return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid opacity value: ${c}. Opacity must be between 0 and 100.`),null;let p=et(f);if(p!==null)return tt(p,c);let g=r(f);return g?tt(g,c):null}let a=et(i);return a!==null?a:(o=r(i))!=null?o:null};if(t.startsWith("bg-")){let i=t.substring(3);if(i.startsWith("[")&&!i.startsWith("[#"))return null;let s=n(i);if(s)return{backgroundColor:s}}if(t.startsWith("text-")){let i=t.substring(5);if(i.startsWith("[")&&!i.startsWith("[#"))return null;let s=n(i);if(s)return{color:s}}if(t.startsWith("border-")&&!t.match(/^border-[0-9]/)){let i=t.substring(7);if(i.startsWith("[")&&!i.startsWith("[#"))return null;let s=n(i);if(s)return{borderColor:s}}return null}function y(t){let e=t.match(/^\[(-?\d+)(?:px)?\]$/);if(e)return parseInt(e[1],10);let r=t.match(/^\[(-?\d+(?:\.\d+)?)%\]$/);return r?`${r[1]}%`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary inset unit: ${t}. Only px and % are supported.`),null)}function Wt(t){let e=t.match(/^\[(-?\d+)\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary z-index: ${t}. Only integers are supported.`),null)}var Tt={flex:{display:"flex"},hidden:{display:"none"}},Ct={"flex-row":{flexDirection:"row"},"flex-row-reverse":{flexDirection:"row-reverse"},"flex-col":{flexDirection:"column"},"flex-col-reverse":{flexDirection:"column-reverse"}},Mt={"flex-wrap":{flexWrap:"wrap"},"flex-wrap-reverse":{flexWrap:"wrap-reverse"},"flex-nowrap":{flexWrap:"nowrap"}},Et={"flex-1":{flex:1},"flex-auto":{flex:1},"flex-none":{flex:0}},At={grow:{flexGrow:1},"grow-0":{flexGrow:0},shrink:{flexShrink:1},"shrink-0":{flexShrink:0}},Nt={"justify-start":{justifyContent:"flex-start"},"justify-end":{justifyContent:"flex-end"},"justify-center":{justifyContent:"center"},"justify-between":{justifyContent:"space-between"},"justify-around":{justifyContent:"space-around"},"justify-evenly":{justifyContent:"space-evenly"}},_t={"items-start":{alignItems:"flex-start"},"items-end":{alignItems:"flex-end"},"items-center":{alignItems:"center"},"items-baseline":{alignItems:"baseline"},"items-stretch":{alignItems:"stretch"}},vt={"self-auto":{alignSelf:"auto"},"self-start":{alignSelf:"flex-start"},"self-end":{alignSelf:"flex-end"},"self-center":{alignSelf:"center"},"self-stretch":{alignSelf:"stretch"},"self-baseline":{alignSelf:"baseline"}},It={"content-start":{alignContent:"flex-start"},"content-end":{alignContent:"flex-end"},"content-center":{alignContent:"center"},"content-between":{alignContent:"space-between"},"content-around":{alignContent:"space-around"},"content-stretch":{alignContent:"stretch"}},jt={absolute:{position:"absolute"},relative:{position:"relative"}},Pt={"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"}},$t={"opacity-0":{opacity:0},"opacity-5":{opacity:.05},"opacity-10":{opacity:.1},"opacity-15":{opacity:.15},"opacity-20":{opacity:.2},"opacity-25":{opacity:.25},"opacity-30":{opacity:.3},"opacity-35":{opacity:.35},"opacity-40":{opacity:.4},"opacity-45":{opacity:.45},"opacity-50":{opacity:.5},"opacity-55":{opacity:.55},"opacity-60":{opacity:.6},"opacity-65":{opacity:.65},"opacity-70":{opacity:.7},"opacity-75":{opacity:.75},"opacity-80":{opacity:.8},"opacity-85":{opacity:.85},"opacity-90":{opacity:.9},"opacity-95":{opacity:.95},"opacity-100":{opacity:1}},Vt={0:0,10:10,20:20,30:30,40:40,50:50,auto:0},h={0:0,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,8:32,10:40,12:48,16:64,20:80,24:96};function I(t){var e,r,n,i,s,a,o,f,c,p,g,K;if(t.startsWith("z-")){let d=t.substring(2),l=Wt(d);if(l!==null)return{zIndex:l};let u=Vt[d];if(u!==void 0)return{zIndex:u}}if(t.startsWith("top-")){let d=t.substring(4);if(d==="auto")return{};let l=y(d);if(l!==null)return{top:l};let u=h[d];if(u!==void 0)return{top:u}}if(t.startsWith("right-")){let d=t.substring(6);if(d==="auto")return{};let l=y(d);if(l!==null)return{right:l};let u=h[d];if(u!==void 0)return{right:u}}if(t.startsWith("bottom-")){let d=t.substring(7);if(d==="auto")return{};let l=y(d);if(l!==null)return{bottom:l};let u=h[d];if(u!==void 0)return{bottom:u}}if(t.startsWith("left-")){let d=t.substring(5);if(d==="auto")return{};let l=y(d);if(l!==null)return{left:l};let u=h[d];if(u!==void 0)return{left:u}}if(t.startsWith("inset-x-")){let d=t.substring(8),l=y(d);if(l!==null)return{left:l,right:l};let u=h[d];if(u!==void 0)return{left:u,right:u}}if(t.startsWith("inset-y-")){let d=t.substring(8),l=y(d);if(l!==null)return{top:l,bottom:l};let u=h[d];if(u!==void 0)return{top:u,bottom:u}}if(t.startsWith("inset-")){let d=t.substring(6),l=y(d);if(l!==null)return{top:l,right:l,bottom:l,left:l};let u=h[d];if(u!==void 0)return{top:u,right:u,bottom:u,left:u}}return(K=(g=(p=(c=(f=(o=(a=(s=(i=(n=(r=(e=Tt[t])!=null?e:Ct[t])!=null?r:Mt[t])!=null?n:Et[t])!=null?i:At[t])!=null?s:Nt[t])!=null?a:_t[t])!=null?o:vt[t])!=null?f:It[t])!=null?c:jt[t])!=null?p:Pt[t])!=null?g:$t[t])!=null?K:null}var rt={"shadow-sm":{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:.05,shadowRadius:1,elevation:1},shadow:{shadowColor:"#000000",shadowOffset:{width:0,height:1},shadowOpacity:.1,shadowRadius:2,elevation:2},"shadow-md":{shadowColor:"#000000",shadowOffset:{width:0,height:3},shadowOpacity:.15,shadowRadius:4,elevation:4},"shadow-lg":{shadowColor:"#000000",shadowOffset:{width:0,height:6},shadowOpacity:.2,shadowRadius:8,elevation:8},"shadow-xl":{shadowColor:"#000000",shadowOffset:{width:0,height:10},shadowOpacity:.25,shadowRadius:12,elevation:12},"shadow-2xl":{shadowColor:"#000000",shadowOffset:{width:0,height:20},shadowOpacity:.3,shadowRadius:24,elevation:16},"shadow-none":{shadowColor:"transparent",shadowOffset:{width:0,height:0},shadowOpacity:0,shadowRadius:0,elevation:0}};function j(t){return t in rt?rt[t]:null}var x={0:0,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384},S={full:"100%","1/2":"50%","1/3":"33.333333%","2/3":"66.666667%","1/4":"25%","2/4":"50%","3/4":"75%","1/5":"20%","2/5":"40%","3/5":"60%","4/5":"80%","1/6":"16.666667%","2/6":"33.333333%","3/6":"50%","4/6":"66.666667%","5/6":"83.333333%"};function w(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);if(e)return parseInt(e[1],10);let r=t.match(/^\[(\d+(?:\.\d+)?)%\]$/);return r?`${r[1]}%`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary size unit: ${t}. Only px and % are supported.`),null)}function P(t){if(t.startsWith("w-")){let e=t.substring(2),r=w(e);if(r!==null)return{width:r};let n=S[e];if(n)return{width:n};let i=x[e];if(i!==void 0)return{width:i};if(e==="auto")return{width:"auto"}}if(t.startsWith("h-")){let e=t.substring(2),r=w(e);if(r!==null)return{height:r};let n=S[e];if(n)return{height:n};let i=x[e];if(i!==void 0)return{height:i};if(e==="auto")return{height:"auto"}}if(t.startsWith("min-w-")){let e=t.substring(6),r=w(e);if(r!==null)return{minWidth:r};let n=S[e];if(n)return{minWidth:n};let i=x[e];if(i!==void 0)return{minWidth:i}}if(t.startsWith("min-h-")){let e=t.substring(6),r=w(e);if(r!==null)return{minHeight:r};let n=S[e];if(n)return{minHeight:n};let i=x[e];if(i!==void 0)return{minHeight:i}}if(t.startsWith("max-w-")){let e=t.substring(6),r=w(e);if(r!==null)return{maxWidth:r};let n=S[e];if(n)return{maxWidth:n};let i=x[e];if(i!==void 0)return{maxWidth:i}}if(t.startsWith("max-h-")){let e=t.substring(6),r=w(e);if(r!==null)return{maxHeight:r};let n=S[e];if(n)return{maxHeight:n};let i=x[e];if(i!==void 0)return{maxHeight:i}}return null}var O={0:0,.5:2,1:4,1.5:6,2:8,2.5:10,3:12,3.5:14,4:16,5:20,6:24,7:28,8:32,9:36,10:40,11:44,12:48,14:56,16:64,20:80,24:96,28:112,32:128,36:144,40:160,44:176,48:192,52:208,56:224,60:240,64:256,72:288,80:320,96:384};function $(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary spacing value: ${t}. Only px values are supported (e.g., [16px] or [16]).`),null)}function V(t){let e=t.match(/^(-?)m([xytrbls]?)-(.+)$/);if(e){let[,i,s,a]=e,o=i==="-",f=$(a);if(f!==null){let p=o?-f:f;return nt(s,p)}let c=O[a];if(c!==void 0){let p=o?-c:c;return nt(s,p)}}let r=t.match(/^p([xytrbls]?)-(.+)$/);if(r){let[,i,s]=r,a=$(s);if(a!==null)return it(i,a);let o=O[s];if(o!==void 0)return it(i,o)}let n=t.match(/^gap-(.+)$/);if(n){let i=n[1],s=$(i);if(s!==null)return{gap:s};let a=O[i];if(a!==void 0)return{gap:a}}return null}function nt(t,e){switch(t){case"":return{margin:e};case"x":return{marginHorizontal:e};case"y":return{marginVertical:e};case"t":return{marginTop:e};case"r":return{marginRight:e};case"b":return{marginBottom:e};case"l":return{marginLeft:e};default:return{}}}function it(t,e){switch(t){case"":return{padding:e};case"x":return{paddingHorizontal:e};case"y":return{paddingVertical:e};case"t":return{paddingTop:e};case"r":return{paddingRight:e};case"b":return{paddingBottom:e};case"l":return{paddingLeft:e};default:return{}}}var D={0:0,50:.5,75:.75,90:.9,95:.95,100:1,105:1.05,110:1.1,125:1.25,150:1.5,200:2},A={0:0,1:1,2:2,3:3,6:6,12:12,45:45,90:90,180:180},st={0:0,1:1,2:2,3:3,6:6,12:12},Dt={0:0,100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900,1e3:1e3};function L(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?)\]$/);return e?parseFloat(e[1]):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary scale value: ${t}. Only numbers are supported (e.g., [1.5], [0.75]).`),null)}function R(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?)deg\]$/);return e?`${e[1]}deg`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary rotation value: ${t}. Only deg unit is supported (e.g., [45deg], [-15deg]).`),null)}function ot(t){let e=t.match(/^\[(-?\d+)(?:px)?\]$/);if(e)return parseInt(e[1],10);let r=t.match(/^\[(-?\d+(?:\.\d+)?)%\]$/);return r?`${r[1]}%`:(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary translation unit: ${t}. Only px and % are supported.`),null)}function Lt(t){let e=t.match(/^\[(-?\d+)\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary perspective value: ${t}. Only integers are supported (e.g., [1500]).`),null)}function z(t){if(t.startsWith("origin-"))return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] transform-origin is not supported in React Native. Class "${t}" will be ignored.`),null;if(t.startsWith("scale-")){let e=t.substring(6),r=L(e);if(r!==null)return{transform:[{scale:r}]};let n=D[e];if(n!==void 0)return{transform:[{scale:n}]}}if(t.startsWith("scale-x-")){let e=t.substring(8),r=L(e);if(r!==null)return{transform:[{scaleX:r}]};let n=D[e];if(n!==void 0)return{transform:[{scaleX:n}]}}if(t.startsWith("scale-y-")){let e=t.substring(8),r=L(e);if(r!==null)return{transform:[{scaleY:r}]};let n=D[e];if(n!==void 0)return{transform:[{scaleY:n}]}}if(t.startsWith("rotate-")||t.startsWith("-rotate-")){let e=t.startsWith("-"),r=e?t.substring(8):t.substring(7),n=R(r);if(n!==null)return{transform:[{rotate:e?`-${n}`:n}]};let i=A[r];if(i!==void 0)return{transform:[{rotate:`${e?-i:i}deg`}]}}if(t.startsWith("rotate-x-")||t.startsWith("-rotate-x-")){let e=t.startsWith("-"),r=e?t.substring(10):t.substring(9),n=R(r);if(n!==null)return{transform:[{rotateX:e?`-${n}`:n}]};let i=A[r];if(i!==void 0)return{transform:[{rotateX:`${e?-i:i}deg`}]}}if(t.startsWith("rotate-y-")||t.startsWith("-rotate-y-")){let e=t.startsWith("-"),r=e?t.substring(10):t.substring(9),n=R(r);if(n!==null)return{transform:[{rotateY:e?`-${n}`:n}]};let i=A[r];if(i!==void 0)return{transform:[{rotateY:`${e?-i:i}deg`}]}}if(t.startsWith("rotate-z-")||t.startsWith("-rotate-z-")){let e=t.startsWith("-"),r=e?t.substring(10):t.substring(9),n=R(r);if(n!==null)return{transform:[{rotateZ:e?`-${n}`:n}]};let i=A[r];if(i!==void 0)return{transform:[{rotateZ:`${e?-i:i}deg`}]}}if(t.startsWith("translate-x-")||t.startsWith("-translate-x-")){let e=t.startsWith("-"),r=e?t.substring(13):t.substring(12),n=ot(r);if(n!==null)return{transform:[{translateX:typeof n=="number"?e?-n:n:e?`-${n}`:n}]};let i=O[r];if(i!==void 0)return{transform:[{translateX:e?-i:i}]}}if(t.startsWith("translate-y-")||t.startsWith("-translate-y-")){let e=t.startsWith("-"),r=e?t.substring(13):t.substring(12),n=ot(r);if(n!==null)return{transform:[{translateY:typeof n=="number"?e?-n:n:e?`-${n}`:n}]};let i=O[r];if(i!==void 0)return{transform:[{translateY:e?-i:i}]}}if(t.startsWith("skew-x-")||t.startsWith("-skew-x-")){let e=t.startsWith("-"),r=e?t.substring(8):t.substring(7),n=R(r);if(n!==null)return{transform:[{skewX:e?`-${n}`:n}]};let i=st[r];if(i!==void 0)return{transform:[{skewX:`${e?-i:i}deg`}]}}if(t.startsWith("skew-y-")||t.startsWith("-skew-y-")){let e=t.startsWith("-"),r=e?t.substring(8):t.substring(7),n=R(r);if(n!==null)return{transform:[{skewY:e?`-${n}`:n}]};let i=st[r];if(i!==void 0)return{transform:[{skewY:`${e?-i:i}deg`}]}}if(t.startsWith("perspective-")){let e=t.substring(12),r=Lt(e);if(r!==null)return{transform:[{perspective:r}]};let n=Dt[e];if(n!==void 0)return{transform:[{perspective:n}]}}return null}var zt={xs:12,sm:14,base:16,lg:18,xl:20,"2xl":24,"3xl":30,"4xl":36,"5xl":48,"6xl":60,"7xl":72,"8xl":96,"9xl":128};var kt={"font-sans":{fontFamily:"System"},"font-serif":{fontFamily:"serif"},"font-mono":{fontFamily:"Courier"}},Kt={"font-thin":{fontWeight:"100"},"font-extralight":{fontWeight:"200"},"font-light":{fontWeight:"300"},"font-normal":{fontWeight:"400"},"font-medium":{fontWeight:"500"},"font-semibold":{fontWeight:"600"},"font-bold":{fontWeight:"700"},"font-extrabold":{fontWeight:"800"},"font-black":{fontWeight:"900"}},Ft={italic:{fontStyle:"italic"},"not-italic":{fontStyle:"normal"}},Ht={"text-left":{textAlign:"left"},"text-center":{textAlign:"center"},"text-right":{textAlign:"right"},"text-justify":{textAlign:"justify"}},Bt={underline:{textDecorationLine:"underline"},"line-through":{textDecorationLine:"line-through"},"no-underline":{textDecorationLine:"none"}},Ut={uppercase:{textTransform:"uppercase"},lowercase:{textTransform:"lowercase"},capitalize:{textTransform:"capitalize"},"normal-case":{textTransform:"none"}},Gt={3:12,4:16,5:20,6:24,7:28,8:32,9:36,10:40},Xt={"leading-none":{lineHeight:16},"leading-tight":{lineHeight:20},"leading-snug":{lineHeight:22},"leading-normal":{lineHeight:24},"leading-relaxed":{lineHeight:28},"leading-loose":{lineHeight:32}},Yt={"tracking-tighter":{letterSpacing:-.8},"tracking-tight":{letterSpacing:-.4},"tracking-normal":{letterSpacing:0},"tracking-wide":{letterSpacing:.4},"tracking-wider":{letterSpacing:.8},"tracking-widest":{letterSpacing:1.6}};function Zt(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary font size value: ${t}. Only px values are supported (e.g., [18px] or [18]).`),null)}function qt(t){let e=t.match(/^\[(\d+)(?:px)?\]$/);return e?parseInt(e[1],10):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary line height value: ${t}. Only px values are supported (e.g., [24px] or [24]).`),null)}function k(t){var e,r,n,i,s,a,o,f;if(t.startsWith("text-")){let c=t.substring(5),p=Zt(c);if(p!==null)return{fontSize:p};let g=zt[c];if(g!==void 0)return{fontSize:g}}if(t.startsWith("leading-")){let c=t.substring(8),p=qt(c);if(p!==null)return{lineHeight:p};let g=Gt[c];if(g!==void 0)return{lineHeight:g}}return(f=(o=(a=(s=(i=(n=(r=(e=kt[t])!=null?e:Kt[t])!=null?r:Ft[t])!=null?n:Ht[t])!=null?i:Bt[t])!=null?s:Ut[t])!=null?a:Xt[t])!=null?o:Yt[t])!=null?f:null}var Jt=["active","hover","focus","disabled","placeholder"],Qt=["ios","android","web"],Ce=[...Jt,...Qt];function W(t,e){let r=t.split(/\s+/).filter(Boolean),n={};for(let i of r){let s=te(i,e);Object.assign(n,s)}return n}function te(t,e){let r=[V,v,n=>E(n,e),I,k,P,j,N,z];for(let n of r){let i=n(t);if(i!==null)return i}return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unknown class: "${t}"`),{}}var at=["active","focus","disabled"];function ft(t){return at.some(e=>t.includes(`${e}:`))}function ct(t){let e=t.split(/\s+/).filter(Boolean),r=[],n=new Map;for(let i of e){let s=!1;for(let a of at){let o=`${a}:`;if(i.startsWith(o)){let f=i.slice(o.length);n.has(a)||n.set(a,[]);let c=n.get(a);c&&c.push(f),s=!0;break}}s||r.push(i)}return{base:r,modifiers:n}}var b,m=new Map;function ee(t){var e,r;(r=(e=t.theme)==null?void 0:e.extend)!=null&&r.colors?b=T(t.theme.extend.colors):b=void 0,m.clear()}function re(){return b}function ne(){m.clear()}function ie(){return{size:m.size,keys:Array.from(m.keys())}}function lt(t){let e=m.get(t);if(e)return e;if(!ft(t)){let f={style:W(t,b)};return m.set(t,f),f}let{base:r,modifiers:n}=ct(t),i=r.join(" "),a={style:i?W(i,b):{}};if(n.has("active")){let o=n.get("active");if(o&&o.length>0){let f=o.join(" ");a.activeStyle=W(f,b)}}if(n.has("focus")){let o=n.get("focus");if(o&&o.length>0){let f=o.join(" ");a.focusStyle=W(f,b)}}if(n.has("disabled")){let o=n.get("disabled");if(o&&o.length>0){let f=o.join(" ");a.disabledStyle=W(f,b)}}return m.set(t,a),a}function se(t,...e){let n=t.reduce((i,s,a)=>{let o=e[a],f=o!=null&&o!==!1?String(o):"";return i+s+f},"").trim().replace(/\s+/g," ");return n?lt(n):{style:{}}}function oe(t){let e=t.trim().replace(/\s+/g," ");if(e)return lt(e)}
|
|
2
2
|
//# sourceMappingURL=runtime.cjs.map
|