@mgcrea/react-native-tailwind 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -2014
- package/dist/babel/index.cjs +1462 -1155
- package/dist/babel/plugin/componentScope.d.ts +26 -0
- package/dist/babel/plugin/componentScope.ts +87 -0
- package/dist/babel/plugin/state.d.ts +119 -0
- package/dist/babel/plugin/state.ts +177 -0
- package/dist/babel/plugin/visitors/className.d.ts +11 -0
- package/{src/babel/plugin.test.ts → dist/babel/plugin/visitors/className.test.ts} +74 -674
- package/dist/babel/plugin/visitors/className.ts +624 -0
- package/dist/babel/plugin/visitors/className.windowDimensions.test.ts +406 -0
- package/dist/babel/plugin/visitors/imports.d.ts +11 -0
- package/dist/babel/plugin/visitors/imports.test.ts +88 -0
- package/dist/babel/plugin/visitors/imports.ts +101 -0
- package/dist/babel/plugin/visitors/program.d.ts +15 -0
- package/dist/babel/plugin/visitors/program.test.ts +325 -0
- package/dist/babel/plugin/visitors/program.ts +99 -0
- package/dist/babel/plugin/visitors/tw.d.ts +16 -0
- package/dist/babel/plugin/visitors/tw.test.ts +620 -0
- package/dist/babel/plugin/visitors/tw.ts +148 -0
- package/dist/babel/plugin.d.ts +3 -96
- package/dist/babel/plugin.test.ts +470 -0
- package/dist/babel/plugin.ts +28 -963
- package/dist/babel/utils/colorSchemeModifierProcessing.ts +11 -0
- package/dist/babel/utils/componentSupport.test.ts +20 -7
- package/dist/babel/utils/componentSupport.ts +2 -0
- package/dist/babel/utils/modifierProcessing.ts +21 -0
- package/dist/babel/utils/platformModifierProcessing.ts +11 -0
- package/dist/babel/utils/styleInjection.d.ts +15 -0
- package/dist/babel/utils/styleInjection.ts +115 -0
- package/dist/babel/utils/twProcessing.ts +11 -0
- package/dist/babel/utils/windowDimensionsProcessing.d.ts +56 -0
- package/dist/babel/utils/windowDimensionsProcessing.ts +121 -0
- package/dist/components/TouchableOpacity.d.ts +35 -0
- package/dist/components/TouchableOpacity.js +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +1 -0
- package/dist/config/markers.d.ts +5 -0
- package/dist/config/markers.js +1 -0
- package/dist/index.d.ts +2 -5
- package/dist/index.js +1 -1
- package/dist/parser/borders.d.ts +3 -1
- package/dist/parser/borders.js +1 -1
- package/dist/parser/borders.test.js +1 -1
- package/dist/parser/colors.js +1 -1
- package/dist/parser/colors.test.js +1 -1
- package/dist/parser/index.js +1 -1
- package/dist/parser/sizing.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/package.json +1 -1
- package/src/babel/plugin/componentScope.ts +87 -0
- package/src/babel/plugin/state.ts +177 -0
- package/src/babel/plugin/visitors/className.test.ts +1312 -0
- package/src/babel/plugin/visitors/className.ts +624 -0
- package/src/babel/plugin/visitors/className.windowDimensions.test.ts +406 -0
- package/src/babel/plugin/visitors/imports.test.ts +88 -0
- package/src/babel/plugin/visitors/imports.ts +101 -0
- package/src/babel/plugin/visitors/program.test.ts +325 -0
- package/src/babel/plugin/visitors/program.ts +99 -0
- package/src/babel/plugin/visitors/tw.test.ts +620 -0
- package/src/babel/plugin/visitors/tw.ts +148 -0
- package/src/babel/plugin.ts +28 -963
- package/src/babel/utils/colorSchemeModifierProcessing.ts +11 -0
- package/src/babel/utils/componentSupport.test.ts +20 -7
- package/src/babel/utils/componentSupport.ts +2 -0
- package/src/babel/utils/modifierProcessing.ts +21 -0
- package/src/babel/utils/platformModifierProcessing.ts +11 -0
- package/src/babel/utils/styleInjection.ts +115 -0
- package/src/babel/utils/twProcessing.ts +11 -0
- package/src/babel/utils/windowDimensionsProcessing.ts +121 -0
- package/src/components/TouchableOpacity.tsx +71 -0
- package/src/components/index.ts +3 -0
- package/src/config/markers.ts +5 -0
- package/src/index.ts +4 -5
- package/src/parser/borders.test.ts +58 -0
- package/src/parser/borders.ts +18 -3
- package/src/parser/colors.test.ts +249 -0
- package/src/parser/colors.ts +38 -0
- package/src/parser/index.ts +2 -2
- package/src/parser/sizing.ts +11 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vitest=require("vitest");var _borders=require("./borders");(0,_vitest.describe)("BORDER_WIDTH_SCALE",function(){(0,_vitest.it)("should export complete border width scale",function(){(0,_vitest.expect)(_borders.BORDER_WIDTH_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("BORDER_RADIUS_SCALE",function(){(0,_vitest.it)("should export complete border radius scale",function(){(0,_vitest.expect)(_borders.BORDER_RADIUS_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("parseBorder - border width all sides",function(){(0,_vitest.it)("should parse border shorthand",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border")).toEqual({borderWidth:1});});(0,_vitest.it)("should parse border with preset values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-0")).toEqual({borderWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-2")).toEqual({borderWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-4")).toEqual({borderWidth:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-8")).toEqual({borderWidth:8});});(0,_vitest.it)("should parse border with arbitrary pixel values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[1px]")).toEqual({borderWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-[1]")).toEqual({borderWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-[3px]")).toEqual({borderWidth:3});(0,_vitest.expect)((0,_borders.parseBorder)("border-[10px]")).toEqual({borderWidth:10});});});(0,_vitest.describe)("parseBorder - border width directional",function(){(0,_vitest.it)("should parse border top",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t")).toEqual({borderTopWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-0")).toEqual({borderTopWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-2")).toEqual({borderTopWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-4")).toEqual({borderTopWidth:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-8")).toEqual({borderTopWidth:8});});(0,_vitest.it)("should parse border right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-r")).toEqual({borderRightWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-0")).toEqual({borderRightWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-2")).toEqual({borderRightWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-4")).toEqual({borderRightWidth:4});});(0,_vitest.it)("should parse border bottom",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-b")).toEqual({borderBottomWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-0")).toEqual({borderBottomWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-2")).toEqual({borderBottomWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-4")).toEqual({borderBottomWidth:4});});(0,_vitest.it)("should parse border left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-l")).toEqual({borderLeftWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-0")).toEqual({borderLeftWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-2")).toEqual({borderLeftWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-4")).toEqual({borderLeftWidth:4});});(0,_vitest.it)("should parse directional borders with arbitrary values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-[3px]")).toEqual({borderTopWidth:3});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-[5px]")).toEqual({borderRightWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[7px]")).toEqual({borderBottomWidth:7});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-[9px]")).toEqual({borderLeftWidth:9});});});(0,_vitest.describe)("parseBorder - border style",function(){(0,_vitest.it)("should parse border styles",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-solid")).toEqual({borderStyle:"solid"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dotted")).toEqual({borderStyle:"dotted"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dashed")).toEqual({borderStyle:"dashed"});});});(0,_vitest.describe)("parseBorder - border radius all corners",function(){(0,_vitest.it)("should parse rounded shorthand",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded")).toEqual({borderRadius:4});});(0,_vitest.it)("should parse rounded with preset values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-none")).toEqual({borderRadius:0});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-sm")).toEqual({borderRadius:2});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-md")).toEqual({borderRadius:6});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-lg")).toEqual({borderRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-xl")).toEqual({borderRadius:12});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-2xl")).toEqual({borderRadius:16});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-3xl")).toEqual({borderRadius:24});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-full")).toEqual({borderRadius:9999});});(0,_vitest.it)("should parse rounded with arbitrary pixel values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[5px]")).toEqual({borderRadius:5});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[10px]")).toEqual({borderRadius:10});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[15]")).toEqual({borderRadius:15});});});(0,_vitest.describe)("parseBorder - border radius sides",function(){(0,_vitest.it)("should parse rounded top",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t")).toEqual({borderTopLeftRadius:4,borderTopRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-lg")).toEqual({borderTopLeftRadius:8,borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-[12px]")).toEqual({borderTopLeftRadius:12,borderTopRightRadius:12});});(0,_vitest.it)("should parse rounded right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r")).toEqual({borderTopRightRadius:4,borderBottomRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r-lg")).toEqual({borderTopRightRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r-[12px]")).toEqual({borderTopRightRadius:12,borderBottomRightRadius:12});});(0,_vitest.it)("should parse rounded bottom",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b")).toEqual({borderBottomLeftRadius:4,borderBottomRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b-lg")).toEqual({borderBottomLeftRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b-[12px]")).toEqual({borderBottomLeftRadius:12,borderBottomRightRadius:12});});(0,_vitest.it)("should parse rounded left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l")).toEqual({borderTopLeftRadius:4,borderBottomLeftRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l-lg")).toEqual({borderTopLeftRadius:8,borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l-[12px]")).toEqual({borderTopLeftRadius:12,borderBottomLeftRadius:12});});});(0,_vitest.describe)("parseBorder - border radius specific corners",function(){(0,_vitest.it)("should parse rounded top-left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl")).toEqual({borderTopLeftRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-lg")).toEqual({borderTopLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-[12px]")).toEqual({borderTopLeftRadius:12});});(0,_vitest.it)("should parse rounded top-right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr")).toEqual({borderTopRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr-lg")).toEqual({borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr-[12px]")).toEqual({borderTopRightRadius:12});});(0,_vitest.it)("should parse rounded bottom-left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl")).toEqual({borderBottomLeftRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl-lg")).toEqual({borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl-[12px]")).toEqual({borderBottomLeftRadius:12});});(0,_vitest.it)("should parse rounded bottom-right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br")).toEqual({borderBottomRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br-lg")).toEqual({borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br-[12px]")).toEqual({borderBottomRightRadius:12});});});(0,_vitest.describe)("parseBorder - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_borders.parseBorder)("invalid")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("borders-4")).toBeNull();});(0,_vitest.it)("should return null for invalid border width values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-invalid")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-3")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-16")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-t-3")).toBeNull();});(0,_vitest.it)("should return null for invalid border radius values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-invalid")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-4xl")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-invalid")).toBeNull();});(0,_vitest.it)("should return null for arbitrary values with unsupported units",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[2rem]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-[1em]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[2rem]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[1em]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[8")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-8]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-[]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[12")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-12]")).toBeNull();});(0,_vitest.it)("should handle edge case values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-0")).toEqual({borderWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-0")).toEqual({borderTopWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-none")).toEqual({borderRadius:0});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-full")).toEqual({borderRadius:9999});});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_borders.parseBorder)("myborder-4")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-solid-extra")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("myrounded-lg")).toBeNull();});});(0,_vitest.describe)("parseBorder - comprehensive coverage",function(){(0,_vitest.it)("should handle all border width directions with same value",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-2")).toEqual({borderWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-2")).toEqual({borderTopWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-2")).toEqual({borderRightWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-2")).toEqual({borderBottomWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-2")).toEqual({borderLeftWidth:2});});(0,_vitest.it)("should handle all border radius types with same value",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-lg")).toEqual({borderRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-lg")).toEqual({borderTopLeftRadius:8,borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r-lg")).toEqual({borderTopRightRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b-lg")).toEqual({borderBottomLeftRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l-lg")).toEqual({borderTopLeftRadius:8,borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-lg")).toEqual({borderTopLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr-lg")).toEqual({borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl-lg")).toEqual({borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br-lg")).toEqual({borderBottomRightRadius:8});});(0,_vitest.it)("should handle arbitrary values across all border width types",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[5px]")).toEqual({borderWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-[5px]")).toEqual({borderTopWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-[5px]")).toEqual({borderRightWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[5px]")).toEqual({borderBottomWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-[5px]")).toEqual({borderLeftWidth:5});});(0,_vitest.it)("should handle arbitrary values across all border radius types",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[10px]")).toEqual({borderRadius:10});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-[10px]")).toEqual({borderTopLeftRadius:10,borderTopRightRadius:10});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-[10px]")).toEqual({borderTopLeftRadius:10});});(0,_vitest.it)("should handle all border styles",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-solid")).toEqual({borderStyle:"solid"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dotted")).toEqual({borderStyle:"dotted"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dashed")).toEqual({borderStyle:"dashed"});});(0,_vitest.it)("should handle shorthand classes correctly",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border")).toEqual({borderWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("rounded")).toEqual({borderRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-t")).toEqual({borderTopWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t")).toEqual({borderTopLeftRadius:4,borderTopRightRadius:4});});});
|
|
1
|
+
var _vitest=require("vitest");var _borders=require("./borders");(0,_vitest.describe)("BORDER_WIDTH_SCALE",function(){(0,_vitest.it)("should export complete border width scale",function(){(0,_vitest.expect)(_borders.BORDER_WIDTH_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("BORDER_RADIUS_SCALE",function(){(0,_vitest.it)("should export complete border radius scale",function(){(0,_vitest.expect)(_borders.BORDER_RADIUS_SCALE).toMatchSnapshot();});});(0,_vitest.describe)("parseBorder - border width all sides",function(){(0,_vitest.it)("should parse border shorthand",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border")).toEqual({borderWidth:1});});(0,_vitest.it)("should parse border with preset values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-0")).toEqual({borderWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-2")).toEqual({borderWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-4")).toEqual({borderWidth:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-8")).toEqual({borderWidth:8});});(0,_vitest.it)("should parse border with arbitrary pixel values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[1px]")).toEqual({borderWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-[1]")).toEqual({borderWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-[3px]")).toEqual({borderWidth:3});(0,_vitest.expect)((0,_borders.parseBorder)("border-[10px]")).toEqual({borderWidth:10});});});(0,_vitest.describe)("parseBorder - border width directional",function(){(0,_vitest.it)("should parse border top",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t")).toEqual({borderTopWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-0")).toEqual({borderTopWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-2")).toEqual({borderTopWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-4")).toEqual({borderTopWidth:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-8")).toEqual({borderTopWidth:8});});(0,_vitest.it)("should parse border right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-r")).toEqual({borderRightWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-0")).toEqual({borderRightWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-2")).toEqual({borderRightWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-4")).toEqual({borderRightWidth:4});});(0,_vitest.it)("should parse border bottom",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-b")).toEqual({borderBottomWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-0")).toEqual({borderBottomWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-2")).toEqual({borderBottomWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-4")).toEqual({borderBottomWidth:4});});(0,_vitest.it)("should parse border left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-l")).toEqual({borderLeftWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-0")).toEqual({borderLeftWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-2")).toEqual({borderLeftWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-4")).toEqual({borderLeftWidth:4});});(0,_vitest.it)("should parse directional borders with arbitrary values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-[3px]")).toEqual({borderTopWidth:3});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-[5px]")).toEqual({borderRightWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[7px]")).toEqual({borderBottomWidth:7});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-[9px]")).toEqual({borderLeftWidth:9});});});(0,_vitest.describe)("parseBorder - border style",function(){(0,_vitest.it)("should parse border styles",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-solid")).toEqual({borderStyle:"solid"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dotted")).toEqual({borderStyle:"dotted"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dashed")).toEqual({borderStyle:"dashed"});});});(0,_vitest.describe)("parseBorder - border radius all corners",function(){(0,_vitest.it)("should parse rounded shorthand",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded")).toEqual({borderRadius:4});});(0,_vitest.it)("should parse rounded with preset values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-none")).toEqual({borderRadius:0});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-sm")).toEqual({borderRadius:2});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-md")).toEqual({borderRadius:6});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-lg")).toEqual({borderRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-xl")).toEqual({borderRadius:12});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-2xl")).toEqual({borderRadius:16});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-3xl")).toEqual({borderRadius:24});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-full")).toEqual({borderRadius:9999});});(0,_vitest.it)("should parse rounded with arbitrary pixel values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[5px]")).toEqual({borderRadius:5});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[10px]")).toEqual({borderRadius:10});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[15]")).toEqual({borderRadius:15});});});(0,_vitest.describe)("parseBorder - border radius sides",function(){(0,_vitest.it)("should parse rounded top",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t")).toEqual({borderTopLeftRadius:4,borderTopRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-lg")).toEqual({borderTopLeftRadius:8,borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-[12px]")).toEqual({borderTopLeftRadius:12,borderTopRightRadius:12});});(0,_vitest.it)("should parse rounded right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r")).toEqual({borderTopRightRadius:4,borderBottomRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r-lg")).toEqual({borderTopRightRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r-[12px]")).toEqual({borderTopRightRadius:12,borderBottomRightRadius:12});});(0,_vitest.it)("should parse rounded bottom",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b")).toEqual({borderBottomLeftRadius:4,borderBottomRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b-lg")).toEqual({borderBottomLeftRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b-[12px]")).toEqual({borderBottomLeftRadius:12,borderBottomRightRadius:12});});(0,_vitest.it)("should parse rounded left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l")).toEqual({borderTopLeftRadius:4,borderBottomLeftRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l-lg")).toEqual({borderTopLeftRadius:8,borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l-[12px]")).toEqual({borderTopLeftRadius:12,borderBottomLeftRadius:12});});});(0,_vitest.describe)("parseBorder - border radius specific corners",function(){(0,_vitest.it)("should parse rounded top-left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl")).toEqual({borderTopLeftRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-lg")).toEqual({borderTopLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-[12px]")).toEqual({borderTopLeftRadius:12});});(0,_vitest.it)("should parse rounded top-right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr")).toEqual({borderTopRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr-lg")).toEqual({borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr-[12px]")).toEqual({borderTopRightRadius:12});});(0,_vitest.it)("should parse rounded bottom-left",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl")).toEqual({borderBottomLeftRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl-lg")).toEqual({borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl-[12px]")).toEqual({borderBottomLeftRadius:12});});(0,_vitest.it)("should parse rounded bottom-right",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br")).toEqual({borderBottomRightRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br-lg")).toEqual({borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br-[12px]")).toEqual({borderBottomRightRadius:12});});});(0,_vitest.describe)("parseBorder - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_borders.parseBorder)("invalid")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("borders-4")).toBeNull();});(0,_vitest.it)("should return null for invalid border width values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-invalid")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-3")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-16")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-t-3")).toBeNull();});(0,_vitest.it)("should return null for invalid border radius values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-invalid")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-4xl")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-invalid")).toBeNull();});(0,_vitest.it)("should return null for arbitrary values with unsupported units",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[2rem]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-[1em]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[2rem]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[1em]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[8")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-8]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-[]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[12")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("rounded-12]")).toBeNull();});(0,_vitest.it)("should handle edge case values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-0")).toEqual({borderWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-0")).toEqual({borderTopWidth:0});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-none")).toEqual({borderRadius:0});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-full")).toEqual({borderRadius:9999});});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_borders.parseBorder)("myborder-4")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-solid-extra")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("myrounded-lg")).toBeNull();});});(0,_vitest.describe)("parseBorder - comprehensive coverage",function(){(0,_vitest.it)("should handle all border width directions with same value",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-2")).toEqual({borderWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-2")).toEqual({borderTopWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-2")).toEqual({borderRightWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-2")).toEqual({borderBottomWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-2")).toEqual({borderLeftWidth:2});});(0,_vitest.it)("should handle all border radius types with same value",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-lg")).toEqual({borderRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-lg")).toEqual({borderTopLeftRadius:8,borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-r-lg")).toEqual({borderTopRightRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-b-lg")).toEqual({borderBottomLeftRadius:8,borderBottomRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-l-lg")).toEqual({borderTopLeftRadius:8,borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-lg")).toEqual({borderTopLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tr-lg")).toEqual({borderTopRightRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-bl-lg")).toEqual({borderBottomLeftRadius:8});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-br-lg")).toEqual({borderBottomRightRadius:8});});(0,_vitest.it)("should handle arbitrary values across all border width types",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-[5px]")).toEqual({borderWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-t-[5px]")).toEqual({borderTopWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-[5px]")).toEqual({borderRightWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[5px]")).toEqual({borderBottomWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-[5px]")).toEqual({borderLeftWidth:5});});(0,_vitest.it)("should handle arbitrary values across all border radius types",function(){(0,_vitest.expect)((0,_borders.parseBorder)("rounded-[10px]")).toEqual({borderRadius:10});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t-[10px]")).toEqual({borderTopLeftRadius:10,borderTopRightRadius:10});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-tl-[10px]")).toEqual({borderTopLeftRadius:10});});(0,_vitest.it)("should handle all border styles",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-solid")).toEqual({borderStyle:"solid"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dotted")).toEqual({borderStyle:"dotted"});(0,_vitest.expect)((0,_borders.parseBorder)("border-dashed")).toEqual({borderStyle:"dashed"});});(0,_vitest.it)("should handle shorthand classes correctly",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border")).toEqual({borderWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("rounded")).toEqual({borderRadius:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-t")).toEqual({borderTopWidth:1});(0,_vitest.expect)((0,_borders.parseBorder)("rounded-t")).toEqual({borderTopLeftRadius:4,borderTopRightRadius:4});});});(0,_vitest.describe)("parseBorder - color pattern detection",function(){(0,_vitest.it)("should return null for directional border colors with preset values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-red-500")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-r-blue-500")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-b-green-500")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-l-yellow-500")).toBeNull();});(0,_vitest.it)("should return null for directional border colors with basic values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-white")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-r-black")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-b-transparent")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-l-white")).toBeNull();});(0,_vitest.it)("should return null for directional border colors with arbitrary hex values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-[#ff0000]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-r-[#3B82F6]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[#abc]")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-l-[#00FF00AA]")).toBeNull();});(0,_vitest.it)("should return null for directional border colors with opacity",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-red-500/50")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-r-blue-500/80")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[#ff0000]/60")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-l-black/25")).toBeNull();});(0,_vitest.it)("should return null for directional border colors with custom colors",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-brand-primary")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-r-accent")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-b-brand-secondary")).toBeNull();(0,_vitest.expect)((0,_borders.parseBorder)("border-l-custom")).toBeNull();});(0,_vitest.it)("should still handle directional border widths correctly",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-2")).toEqual({borderTopWidth:2});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-4")).toEqual({borderRightWidth:4});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-8")).toEqual({borderBottomWidth:8});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-0")).toEqual({borderLeftWidth:0});});(0,_vitest.it)("should still handle directional border width arbitrary values",function(){(0,_vitest.expect)((0,_borders.parseBorder)("border-t-[3px]")).toEqual({borderTopWidth:3});(0,_vitest.expect)((0,_borders.parseBorder)("border-r-[5px]")).toEqual({borderRightWidth:5});(0,_vitest.expect)((0,_borders.parseBorder)("border-b-[10]")).toEqual({borderBottomWidth:10});(0,_vitest.expect)((0,_borders.parseBorder)("border-l-[8px]")).toEqual({borderLeftWidth:8});});});
|
package/dist/parser/colors.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.COLORS=void 0;exports.parseColor=parseColor;var _tailwind=require("../config/tailwind");var _flattenColors=require("../utils/flattenColors");var COLORS=exports.COLORS=Object.assign({},(0,_flattenColors.flattenColors)(_tailwind.TAILWIND_COLORS),{white:"#FFFFFF",black:"#000000",transparent:"transparent"});function applyOpacity(hex,opacity){if(hex==="transparent"){return"transparent";}var cleanHex=hex.replace(/^#/,"");var fullHex=cleanHex.length===3?cleanHex.split("").map(function(char){return char+char;}).join(""):cleanHex;var alpha=Math.round(opacity/100*255);var alphaHex=alpha.toString(16).padStart(2,"0").toUpperCase();return`#${fullHex.toUpperCase()}${alphaHex}`;}function parseArbitraryColor(value){var hexMatch=value.match(/^\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\]$/);if(hexMatch){var hex=hexMatch[1];if(hex.length===3){var expanded=hex.split("").map(function(char){return char+char;}).join("");return`#${expanded}`;}return`#${hex}`;}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary color value: ${value}. Only hex colors are supported (e.g., [#ff0000], [#f00], or [#ff0000aa]).`);}return null;}return null;}function parseColor(cls,customColors){var getColor=function getColor(key){var _customColors$key;return(_customColors$key=customColors==null?void 0:customColors[key])!=null?_customColors$key:COLORS[key];};var parseColorWithOpacity=function parseColorWithOpacity(colorKey){var _getColor;var opacityMatch=colorKey.match(/^(.+)\/(\d+)$/);if(opacityMatch){var baseColorKey=opacityMatch[1];var opacity=Number.parseInt(opacityMatch[2],10);if(opacity<0||opacity>100){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Invalid opacity value: ${opacity}. Opacity must be between 0 and 100.`);}return null;}var _arbitraryColor=parseArbitraryColor(baseColorKey);if(_arbitraryColor!==null){return applyOpacity(_arbitraryColor,opacity);}var color=getColor(baseColorKey);if(color){return applyOpacity(color,opacity);}return null;}var arbitraryColor=parseArbitraryColor(colorKey);if(arbitraryColor!==null){return arbitraryColor;}return(_getColor=getColor(colorKey))!=null?_getColor:null;};if(cls.startsWith("bg-")){var colorKey=cls.substring(3);if(colorKey.startsWith("[")&&!colorKey.startsWith("[#")){return null;}var color=parseColorWithOpacity(colorKey);if(color){return{backgroundColor:color};}}if(cls.startsWith("text-")){var _colorKey=cls.substring(5);if(_colorKey.startsWith("[")&&!_colorKey.startsWith("[#")){return null;}var _color=parseColorWithOpacity(_colorKey);if(_color){return{color:_color};}}if(cls.startsWith("border-")&&!cls.match(/^border-[0-9]/)){var _colorKey2=cls.substring(7);if(_colorKey2.startsWith("[")&&!_colorKey2.startsWith("[#")){return null;}var _color2=parseColorWithOpacity(_colorKey2);if(_color2){return{borderColor:_color2};}}return null;}
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.COLORS=void 0;exports.parseColor=parseColor;var _defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));var _tailwind=require("../config/tailwind");var _flattenColors=require("../utils/flattenColors");var COLORS=exports.COLORS=Object.assign({},(0,_flattenColors.flattenColors)(_tailwind.TAILWIND_COLORS),{white:"#FFFFFF",black:"#000000",transparent:"transparent"});function applyOpacity(hex,opacity){if(hex==="transparent"){return"transparent";}var cleanHex=hex.replace(/^#/,"");var fullHex=cleanHex.length===3?cleanHex.split("").map(function(char){return char+char;}).join(""):cleanHex;var alpha=Math.round(opacity/100*255);var alphaHex=alpha.toString(16).padStart(2,"0").toUpperCase();return`#${fullHex.toUpperCase()}${alphaHex}`;}function parseArbitraryColor(value){var hexMatch=value.match(/^\[#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})\]$/);if(hexMatch){var hex=hexMatch[1];if(hex.length===3){var expanded=hex.split("").map(function(char){return char+char;}).join("");return`#${expanded}`;}return`#${hex}`;}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary color value: ${value}. Only hex colors are supported (e.g., [#ff0000], [#f00], or [#ff0000aa]).`);}return null;}return null;}function parseColor(cls,customColors){var getColor=function getColor(key){var _customColors$key;return(_customColors$key=customColors==null?void 0:customColors[key])!=null?_customColors$key:COLORS[key];};var parseColorWithOpacity=function parseColorWithOpacity(colorKey){var _getColor;var opacityMatch=colorKey.match(/^(.+)\/(\d+)$/);if(opacityMatch){var baseColorKey=opacityMatch[1];var opacity=Number.parseInt(opacityMatch[2],10);if(opacity<0||opacity>100){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Invalid opacity value: ${opacity}. Opacity must be between 0 and 100.`);}return null;}var _arbitraryColor=parseArbitraryColor(baseColorKey);if(_arbitraryColor!==null){return applyOpacity(_arbitraryColor,opacity);}var color=getColor(baseColorKey);if(color){return applyOpacity(color,opacity);}return null;}var arbitraryColor=parseArbitraryColor(colorKey);if(arbitraryColor!==null){return arbitraryColor;}return(_getColor=getColor(colorKey))!=null?_getColor:null;};if(cls.startsWith("bg-")){var colorKey=cls.substring(3);if(colorKey.startsWith("[")&&!colorKey.startsWith("[#")){return null;}var color=parseColorWithOpacity(colorKey);if(color){return{backgroundColor:color};}}if(cls.startsWith("text-")){var _colorKey=cls.substring(5);if(_colorKey.startsWith("[")&&!_colorKey.startsWith("[#")){return null;}var _color=parseColorWithOpacity(_colorKey);if(_color){return{color:_color};}}if(cls.startsWith("border-")&&!cls.match(/^border-[0-9]/)){var _colorKey2=cls.substring(7);if(_colorKey2.startsWith("[")&&!_colorKey2.startsWith("[#")){return null;}var _color2=parseColorWithOpacity(_colorKey2);if(_color2){return{borderColor:_color2};}}var dirBorderMatch=cls.match(/^border-([trblxy])-(.+)$/);if(dirBorderMatch){var dir=dirBorderMatch[1];var _colorKey3=dirBorderMatch[2];if(_colorKey3.startsWith("[")&&!_colorKey3.startsWith("[#")){return null;}var _color3=parseColorWithOpacity(_colorKey3);if(_color3){if(dir==="x"){return{borderLeftColor:_color3,borderRightColor:_color3};}if(dir==="y"){return{borderTopColor:_color3,borderBottomColor:_color3};}var propMap={t:"borderTopColor",r:"borderRightColor",b:"borderBottomColor",l:"borderLeftColor"};return(0,_defineProperty2.default)({},propMap[dir],_color3);}}return null;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var _vitest=require("vitest");var _colors=require("./colors");function applyOpacity(hex,opacity){if(hex==="transparent")return"transparent";var cleanHex=hex.replace(/^#/,"");var fullHex=cleanHex.length===3?cleanHex.split("").map(function(char){return char+char;}).join(""):cleanHex;var alpha=Math.round(opacity/100*255);var alphaHex=alpha.toString(16).padStart(2,"0").toUpperCase();return`#${fullHex.toUpperCase()}${alphaHex}`;}(0,_vitest.describe)("COLORS",function(){(0,_vitest.it)("should export complete color palette",function(){(0,_vitest.expect)(_colors.COLORS).toMatchSnapshot();});});(0,_vitest.describe)("parseColor - background colors",function(){(0,_vitest.it)("should parse background colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500")).toEqual({backgroundColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-green-500")).toEqual({backgroundColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-gray-300")).toEqual({backgroundColor:_colors.COLORS["gray-300"]});});(0,_vitest.it)("should parse background colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-white")).toEqual({backgroundColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should parse background colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F6]")).toEqual({backgroundColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#000000]")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#123]")).toEqual({backgroundColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F680]")).toEqual({backgroundColor:"#3B82F680"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#00000000]")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFFFF]")).toEqual({backgroundColor:"#FFFFFFFF"});});(0,_vitest.it)("should handle case-insensitive hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FF0000]")).toEqual({backgroundColor:"#FF0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#Ff0000]")).toEqual({backgroundColor:"#Ff0000"});});(0,_vitest.it)("should prefer arbitrary values over preset colors",function(){var customColors={"[#ff0000]":"#00ff00"};(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]",customColors)).toEqual({backgroundColor:"#ff0000"});});});(0,_vitest.describe)("parseColor - text colors",function(){(0,_vitest.it)("should parse text colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500")).toEqual({color:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-green-500")).toEqual({color:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-700")).toEqual({color:_colors.COLORS["gray-700"]});});(0,_vitest.it)("should parse text colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-white")).toEqual({color:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("text-black")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]")).toEqual({color:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#333333]")).toEqual({color:"#333333"});});(0,_vitest.it)("should parse text colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#f00]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#000]")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#00000080]")).toEqual({color:"#00000080"});});});(0,_vitest.describe)("parseColor - border colors",function(){(0,_vitest.it)("should parse border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500")).toEqual({borderColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-green-500")).toEqual({borderColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200")).toEqual({borderColor:_colors.COLORS["gray-200"]});});(0,_vitest.it)("should parse border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-white")).toEqual({borderColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-black")).toEqual({borderColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-transparent")).toEqual({borderColor:"transparent"});});(0,_vitest.it)("should parse border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#3B82F6]")).toEqual({borderColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#cccccc]")).toEqual({borderColor:"#cccccc"});});(0,_vitest.it)("should parse border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#f00]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#999]")).toEqual({borderColor:"#999999"});});(0,_vitest.it)("should parse border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#0000FF50]")).toEqual({borderColor:"#0000FF50"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-4")).toBeNull();});});(0,_vitest.describe)("parseColor - custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.it)("should support custom background colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary",customColors)).toEqual({backgroundColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-secondary",customColors)).toEqual({backgroundColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("bg-accent",customColors)).toEqual({backgroundColor:"#FFE66D"});});(0,_vitest.it)("should support custom text colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary",customColors)).toEqual({color:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-secondary",customColors)).toEqual({color:"#4ECDC4"});});(0,_vitest.it)("should support custom border colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-brand-primary",customColors)).toEqual({borderColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-accent",customColors)).toEqual({borderColor:"#FFE66D"});});(0,_vitest.it)("should allow custom colors to override preset colors",function(){var overrideColors={"blue-500":"#FF0000"};(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500",overrideColors)).toEqual({backgroundColor:"#FF0000"});});(0,_vitest.it)("should support custom colors with DEFAULT key from tailwind.config",function(){var customColorsWithDefault={primary:"#1bacb5","primary-50":"#eefdfd","primary-100":"#d4f9f9","primary-500":"#1bacb5","primary-900":"#1e4f5b"};(0,_vitest.expect)((0,_colors.parseColor)("bg-primary",customColorsWithDefault)).toEqual({backgroundColor:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("bg-primary-50",customColorsWithDefault)).toEqual({backgroundColor:"#eefdfd"});(0,_vitest.expect)((0,_colors.parseColor)("text-primary",customColorsWithDefault)).toEqual({color:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("border-primary",customColorsWithDefault)).toEqual({borderColor:"#1bacb5"});});(0,_vitest.it)("should fallback to preset colors when custom color not found",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500",customColors)).toEqual({backgroundColor:_colors.COLORS["red-500"]});});});(0,_vitest.describe)("parseColor - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border")).toBeNull();});(0,_vitest.it)("should return null for invalid color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-xyz")).toBeNull();});(0,_vitest.it)("should return null for invalid arbitrary hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffffff]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-#ff0000]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[ff0000]")).toBeNull();});(0,_vitest.it)("should return null for non-hex arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#gggggg]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#zzzzzz]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[rgb(255,0,0)]")).toBeNull();});(0,_vitest.it)("should return null for non-color arbitrary values (to let other parsers handle them)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[13px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[18px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[24]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[100%]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[50px]")).toBeNull();});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_colors.parseColor)("background-blue-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("textcolor-red-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-color-blue-500")).toBeNull();});(0,_vitest.it)("should handle all color scale variants",function(){var scales=["50","100","200","300","400","500","600","700","800","900"];scales.forEach(function(scale){(0,_vitest.expect)((0,_colors.parseColor)(`bg-blue-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-red-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-green-${scale}`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - comprehensive coverage",function(){(0,_vitest.it)("should parse all color types with same preset color",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse all color types with same arbitrary hex",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});});(0,_vitest.it)("should handle all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle arbitrary values with mixed case",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#AbCdEf]")).toEqual({backgroundColor:"#AbCdEf"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#aBcDeF]")).toEqual({color:"#aBcDeF"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ABCDEF]")).toEqual({borderColor:"#ABCDEF"});});(0,_vitest.it)("should expand 3-digit hex consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});});(0,_vitest.it)("should handle alpha channel consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});});});(0,_vitest.describe)("parseColor - opacity modifiers",function(){(0,_vitest.it)("should parse background colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-white/50")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.white,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500/80")).toEqual({backgroundColor:applyOpacity(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500/30")).toEqual({backgroundColor:applyOpacity(_colors.COLORS["red-500"],30)});});(0,_vitest.it)("should parse text colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-black/80")).toEqual({color:applyOpacity(_colors.COLORS.black,80)});(0,_vitest.expect)((0,_colors.parseColor)("text-white/90")).toEqual({color:applyOpacity(_colors.COLORS.white,90)});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-900/70")).toEqual({color:applyOpacity(_colors.COLORS["gray-900"],70)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/50")).toEqual({color:applyOpacity(_colors.COLORS["blue-500"],50)});});(0,_vitest.it)("should parse border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-black/25")).toEqual({borderColor:applyOpacity(_colors.COLORS.black,25)});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500/60")).toEqual({borderColor:applyOpacity(_colors.COLORS["red-500"],60)});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200/40")).toEqual({borderColor:applyOpacity(_colors.COLORS["gray-200"],40)});});(0,_vitest.it)("should handle opacity modifier with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]/80")).toEqual({color:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]/60")).toEqual({borderColor:"#AABBCC99"});});(0,_vitest.it)("should handle opacity modifier with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary/50",customColors)).toEqual({backgroundColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary/75",customColors)).toEqual({color:"#FF6B6BBF"});});(0,_vitest.it)("should handle opacity 0 (fully transparent)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,0)});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500/0")).toEqual({color:applyOpacity(_colors.COLORS["red-500"],0)});});(0,_vitest.it)("should handle opacity 100 (fully opaque)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,100)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/100")).toEqual({color:applyOpacity(_colors.COLORS["blue-500"],100)});});(0,_vitest.it)("should handle transparent color with opacity modifier",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent/50")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should convert opacity percentage to correct hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/10")).toEqual({backgroundColor:"#0000001A"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/25")).toEqual({backgroundColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/75")).toEqual({backgroundColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:"#000000FF"});});(0,_vitest.it)("should return null for invalid opacity values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/101")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/-1")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/150")).toBeNull();});(0,_vitest.it)("should return null for malformed opacity syntax",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/abc")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50/")).toBeNull();});(0,_vitest.it)("should handle opacity with 3-digit hex expansion",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]/75")).toEqual({color:"#AABBCCBF"});});(0,_vitest.it)("should work with all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500/50`)).toBeTruthy();});});});
|
|
1
|
+
var _vitest=require("vitest");var _colors=require("./colors");function applyOpacity(hex,opacity){if(hex==="transparent")return"transparent";var cleanHex=hex.replace(/^#/,"");var fullHex=cleanHex.length===3?cleanHex.split("").map(function(char){return char+char;}).join(""):cleanHex;var alpha=Math.round(opacity/100*255);var alphaHex=alpha.toString(16).padStart(2,"0").toUpperCase();return`#${fullHex.toUpperCase()}${alphaHex}`;}(0,_vitest.describe)("COLORS",function(){(0,_vitest.it)("should export complete color palette",function(){(0,_vitest.expect)(_colors.COLORS).toMatchSnapshot();});});(0,_vitest.describe)("parseColor - background colors",function(){(0,_vitest.it)("should parse background colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500")).toEqual({backgroundColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-green-500")).toEqual({backgroundColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("bg-gray-300")).toEqual({backgroundColor:_colors.COLORS["gray-300"]});});(0,_vitest.it)("should parse background colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-white")).toEqual({backgroundColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should parse background colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F6]")).toEqual({backgroundColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#000000]")).toEqual({backgroundColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#123]")).toEqual({backgroundColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFF]")).toEqual({backgroundColor:"#FFFFFF"});});(0,_vitest.it)("should parse background colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#3B82F680]")).toEqual({backgroundColor:"#3B82F680"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#00000000]")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FFFFFFFF]")).toEqual({backgroundColor:"#FFFFFFFF"});});(0,_vitest.it)("should handle case-insensitive hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#FF0000]")).toEqual({backgroundColor:"#FF0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-[#Ff0000]")).toEqual({backgroundColor:"#Ff0000"});});(0,_vitest.it)("should prefer arbitrary values over preset colors",function(){var customColors={"[#ff0000]":"#00ff00"};(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]",customColors)).toEqual({backgroundColor:"#ff0000"});});});(0,_vitest.describe)("parseColor - text colors",function(){(0,_vitest.it)("should parse text colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500")).toEqual({color:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-green-500")).toEqual({color:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-700")).toEqual({color:_colors.COLORS["gray-700"]});});(0,_vitest.it)("should parse text colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-white")).toEqual({color:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("text-black")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]")).toEqual({color:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#333333]")).toEqual({color:"#333333"});});(0,_vitest.it)("should parse text colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#f00]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#000]")).toEqual({color:"#000000"});});(0,_vitest.it)("should parse text colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#00000080]")).toEqual({color:"#00000080"});});});(0,_vitest.describe)("parseColor - border colors",function(){(0,_vitest.it)("should parse border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500")).toEqual({borderColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-green-500")).toEqual({borderColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200")).toEqual({borderColor:_colors.COLORS["gray-200"]});});(0,_vitest.it)("should parse border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-white")).toEqual({borderColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-black")).toEqual({borderColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-transparent")).toEqual({borderColor:"transparent"});});(0,_vitest.it)("should parse border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#3B82F6]")).toEqual({borderColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#cccccc]")).toEqual({borderColor:"#cccccc"});});(0,_vitest.it)("should parse border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#f00]")).toEqual({borderColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#999]")).toEqual({borderColor:"#999999"});});(0,_vitest.it)("should parse border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#0000FF50]")).toEqual({borderColor:"#0000FF50"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-4")).toBeNull();});});(0,_vitest.describe)("parseColor - custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.it)("should support custom background colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary",customColors)).toEqual({backgroundColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-secondary",customColors)).toEqual({backgroundColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("bg-accent",customColors)).toEqual({backgroundColor:"#FFE66D"});});(0,_vitest.it)("should support custom text colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary",customColors)).toEqual({color:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-secondary",customColors)).toEqual({color:"#4ECDC4"});});(0,_vitest.it)("should support custom border colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-brand-primary",customColors)).toEqual({borderColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-accent",customColors)).toEqual({borderColor:"#FFE66D"});});(0,_vitest.it)("should allow custom colors to override preset colors",function(){var overrideColors={"blue-500":"#FF0000"};(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500",overrideColors)).toEqual({backgroundColor:"#FF0000"});});(0,_vitest.it)("should support custom colors with DEFAULT key from tailwind.config",function(){var customColorsWithDefault={primary:"#1bacb5","primary-50":"#eefdfd","primary-100":"#d4f9f9","primary-500":"#1bacb5","primary-900":"#1e4f5b"};(0,_vitest.expect)((0,_colors.parseColor)("bg-primary",customColorsWithDefault)).toEqual({backgroundColor:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("bg-primary-50",customColorsWithDefault)).toEqual({backgroundColor:"#eefdfd"});(0,_vitest.expect)((0,_colors.parseColor)("text-primary",customColorsWithDefault)).toEqual({color:"#1bacb5"});(0,_vitest.expect)((0,_colors.parseColor)("border-primary",customColorsWithDefault)).toEqual({borderColor:"#1bacb5"});});(0,_vitest.it)("should fallback to preset colors when custom color not found",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500",customColors)).toEqual({backgroundColor:_colors.COLORS["red-500"]});});});(0,_vitest.describe)("parseColor - edge cases",function(){(0,_vitest.it)("should return null for invalid classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border")).toBeNull();});(0,_vitest.it)("should return null for invalid color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-xyz")).toBeNull();});(0,_vitest.it)("should return null for invalid arbitrary hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffff]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#fffffffff]")).toBeNull();});(0,_vitest.it)("should return null for malformed arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-#ff0000]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[ff0000]")).toBeNull();});(0,_vitest.it)("should return null for non-hex arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#gggggg]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[#zzzzzz]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[rgb(255,0,0)]")).toBeNull();});(0,_vitest.it)("should return null for non-color arbitrary values (to let other parsers handle them)",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-[13px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[18px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("text-[24]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[100%]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-[50px]")).toBeNull();});(0,_vitest.it)("should not match partial class names",function(){(0,_vitest.expect)((0,_colors.parseColor)("background-blue-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("textcolor-red-500")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-color-blue-500")).toBeNull();});(0,_vitest.it)("should handle all color scale variants",function(){var scales=["50","100","200","300","400","500","600","700","800","900"];scales.forEach(function(scale){(0,_vitest.expect)((0,_colors.parseColor)(`bg-blue-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-red-${scale}`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-green-${scale}`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - comprehensive coverage",function(){(0,_vitest.it)("should parse all color types with same preset color",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500")).toEqual({backgroundColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500")).toEqual({color:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-blue-500")).toEqual({borderColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse all color types with same arbitrary hex",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]")).toEqual({backgroundColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000]")).toEqual({color:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000]")).toEqual({borderColor:"#ff0000"});});(0,_vitest.it)("should handle all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle arbitrary values with mixed case",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#AbCdEf]")).toEqual({backgroundColor:"#AbCdEf"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#aBcDeF]")).toEqual({color:"#aBcDeF"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ABCDEF]")).toEqual({borderColor:"#ABCDEF"});});(0,_vitest.it)("should expand 3-digit hex consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#abc]")).toEqual({backgroundColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]")).toEqual({color:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]")).toEqual({borderColor:"#aabbcc"});});(0,_vitest.it)("should handle alpha channel consistently across all color types",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000aa]")).toEqual({backgroundColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#ff0000aa]")).toEqual({color:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#ff0000aa]")).toEqual({borderColor:"#ff0000aa"});});});(0,_vitest.describe)("parseColor - opacity modifiers",function(){(0,_vitest.it)("should parse background colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-white/50")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.white,50)});(0,_vitest.expect)((0,_colors.parseColor)("bg-blue-500/80")).toEqual({backgroundColor:applyOpacity(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("bg-red-500/30")).toEqual({backgroundColor:applyOpacity(_colors.COLORS["red-500"],30)});});(0,_vitest.it)("should parse text colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("text-black/80")).toEqual({color:applyOpacity(_colors.COLORS.black,80)});(0,_vitest.expect)((0,_colors.parseColor)("text-white/90")).toEqual({color:applyOpacity(_colors.COLORS.white,90)});(0,_vitest.expect)((0,_colors.parseColor)("text-gray-900/70")).toEqual({color:applyOpacity(_colors.COLORS["gray-900"],70)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/50")).toEqual({color:applyOpacity(_colors.COLORS["blue-500"],50)});});(0,_vitest.it)("should parse border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-black/25")).toEqual({borderColor:applyOpacity(_colors.COLORS.black,25)});(0,_vitest.expect)((0,_colors.parseColor)("border-red-500/60")).toEqual({borderColor:applyOpacity(_colors.COLORS["red-500"],60)});(0,_vitest.expect)((0,_colors.parseColor)("border-gray-200/40")).toEqual({borderColor:applyOpacity(_colors.COLORS["gray-200"],40)});});(0,_vitest.it)("should handle opacity modifier with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#ff0000]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#3B82F6]/80")).toEqual({color:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-[#abc]/60")).toEqual({borderColor:"#AABBCC99"});});(0,_vitest.it)("should handle opacity modifier with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("bg-brand-primary/50",customColors)).toEqual({backgroundColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("text-brand-primary/75",customColors)).toEqual({color:"#FF6B6BBF"});});(0,_vitest.it)("should handle opacity 0 (fully transparent)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,0)});(0,_vitest.expect)((0,_colors.parseColor)("text-red-500/0")).toEqual({color:applyOpacity(_colors.COLORS["red-500"],0)});});(0,_vitest.it)("should handle opacity 100 (fully opaque)",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:applyOpacity(_colors.COLORS.black,100)});(0,_vitest.expect)((0,_colors.parseColor)("text-blue-500/100")).toEqual({color:applyOpacity(_colors.COLORS["blue-500"],100)});});(0,_vitest.it)("should handle transparent color with opacity modifier",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-transparent/50")).toEqual({backgroundColor:"transparent"});});(0,_vitest.it)("should convert opacity percentage to correct hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/0")).toEqual({backgroundColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/10")).toEqual({backgroundColor:"#0000001A"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/25")).toEqual({backgroundColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50")).toEqual({backgroundColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/75")).toEqual({backgroundColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("bg-black/100")).toEqual({backgroundColor:"#000000FF"});});(0,_vitest.it)("should return null for invalid opacity values",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/101")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/-1")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/150")).toBeNull();});(0,_vitest.it)("should return null for malformed opacity syntax",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-black/")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/abc")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("bg-black/50/")).toBeNull();});(0,_vitest.it)("should handle opacity with 3-digit hex expansion",function(){(0,_vitest.expect)((0,_colors.parseColor)("bg-[#f00]/50")).toEqual({backgroundColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("text-[#abc]/75")).toEqual({color:"#AABBCCBF"});});(0,_vitest.it)("should work with all color families",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`bg-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`text-${family}-500/50`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-${family}-500/50`)).toBeTruthy();});});});(0,_vitest.describe)("parseColor - directional border colors",function(){(0,_vitest.it)("should parse directional border colors with preset values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-red-500")).toEqual({borderTopColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500")).toEqual({borderRightColor:_colors.COLORS["blue-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-b-green-500")).toEqual({borderBottomColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-l-yellow-500")).toEqual({borderLeftColor:_colors.COLORS["yellow-500"]});});(0,_vitest.it)("should parse directional border colors with basic values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-white")).toEqual({borderTopColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-black")).toEqual({borderRightColor:"#000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-transparent")).toEqual({borderBottomColor:"transparent"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-white")).toEqual({borderLeftColor:"#FFFFFF"});});(0,_vitest.it)("should parse directional border colors with arbitrary 6-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000]")).toEqual({borderTopColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#3B82F6]")).toEqual({borderRightColor:"#3B82F6"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#00ff00]")).toEqual({borderBottomColor:"#00ff00"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#cccccc]")).toEqual({borderLeftColor:"#cccccc"});});(0,_vitest.it)("should parse directional border colors with arbitrary 3-digit hex values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#f00]")).toEqual({borderTopColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#abc]")).toEqual({borderRightColor:"#aabbcc"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#123]")).toEqual({borderBottomColor:"#112233"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#999]")).toEqual({borderLeftColor:"#999999"});});(0,_vitest.it)("should parse directional border colors with arbitrary 8-digit hex values (with alpha)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000aa]")).toEqual({borderTopColor:"#ff0000aa"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#0000FF50]")).toEqual({borderRightColor:"#0000FF50"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#00FF0080]")).toEqual({borderBottomColor:"#00FF0080"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#FFFFFF00]")).toEqual({borderLeftColor:"#FFFFFF00"});});(0,_vitest.it)("should parse directional border colors with opacity modifiers",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-red-500/50")).toEqual({borderTopColor:applyOpacity(_colors.COLORS["red-500"],50)});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500/80")).toEqual({borderRightColor:applyOpacity(_colors.COLORS["blue-500"],80)});(0,_vitest.expect)((0,_colors.parseColor)("border-b-green-500/30")).toEqual({borderBottomColor:applyOpacity(_colors.COLORS["green-500"],30)});(0,_vitest.expect)((0,_colors.parseColor)("border-l-black/25")).toEqual({borderLeftColor:applyOpacity(_colors.COLORS.black,25)});});(0,_vitest.it)("should parse directional border colors with arbitrary hex and opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[#ff0000]/50")).toEqual({borderTopColor:"#FF000080"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-[#3B82F6]/80")).toEqual({borderRightColor:"#3B82F6CC"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-[#abc]/60")).toEqual({borderBottomColor:"#AABBCC99"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-[#000]/100")).toEqual({borderLeftColor:"#000000FF"});});(0,_vitest.it)("should parse directional border colors with custom colors",function(){var customColors={"brand-primary":"#FF6B6B","brand-secondary":"#4ECDC4",accent:"#FFE66D"};(0,_vitest.expect)((0,_colors.parseColor)("border-t-brand-primary",customColors)).toEqual({borderTopColor:"#FF6B6B"});(0,_vitest.expect)((0,_colors.parseColor)("border-r-brand-secondary",customColors)).toEqual({borderRightColor:"#4ECDC4"});(0,_vitest.expect)((0,_colors.parseColor)("border-b-accent",customColors)).toEqual({borderBottomColor:"#FFE66D"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-brand-primary",customColors)).toEqual({borderLeftColor:"#FF6B6B"});});(0,_vitest.it)("should parse directional border colors with custom colors and opacity",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("border-t-brand-primary/50",customColors)).toEqual({borderTopColor:"#FF6B6B80"});(0,_vitest.expect)((0,_colors.parseColor)("border-l-brand-primary/75",customColors)).toEqual({borderLeftColor:"#FF6B6BBF"});});(0,_vitest.it)("should not match border width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-4")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-8")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-0")).toBeNull();});(0,_vitest.it)("should not match border width arbitrary values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-[3px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-[8px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-[5]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-[10px]")).toBeNull();});(0,_vitest.it)("should return null for invalid directional border color values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-invalid")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-r-notacolor")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-b-xyz")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-l-wrongcolor")).toBeNull();});(0,_vitest.it)("should handle all directions with same color",function(){var color=_colors.COLORS["blue-500"];(0,_vitest.expect)((0,_colors.parseColor)("border-t-blue-500")).toEqual({borderTopColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-r-blue-500")).toEqual({borderRightColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-b-blue-500")).toEqual({borderBottomColor:color});(0,_vitest.expect)((0,_colors.parseColor)("border-l-blue-500")).toEqual({borderLeftColor:color});});(0,_vitest.it)("should handle all color families for directional borders",function(){var families=["gray","red","blue","green","yellow","purple","pink","orange","indigo"];families.forEach(function(family){(0,_vitest.expect)((0,_colors.parseColor)(`border-t-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-r-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-b-${family}-500`)).toBeTruthy();(0,_vitest.expect)((0,_colors.parseColor)(`border-l-${family}-500`)).toBeTruthy();});});(0,_vitest.it)("should handle directional borders with all opacity levels",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/0")).toEqual({borderTopColor:"#00000000"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/25")).toEqual({borderTopColor:"#00000040"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/50")).toEqual({borderTopColor:"#00000080"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/75")).toEqual({borderTopColor:"#000000BF"});(0,_vitest.expect)((0,_colors.parseColor)("border-t-black/100")).toEqual({borderTopColor:"#000000FF"});});});(0,_vitest.describe)("parseColor - border-x and border-y colors",function(){(0,_vitest.it)("should parse border-x colors (horizontal: left + right)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-red-500")).toEqual({borderLeftColor:_colors.COLORS["red-500"],borderRightColor:_colors.COLORS["red-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-x-blue-500")).toEqual({borderLeftColor:_colors.COLORS["blue-500"],borderRightColor:_colors.COLORS["blue-500"]});});(0,_vitest.it)("should parse border-y colors (vertical: top + bottom)",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-green-500")).toEqual({borderTopColor:_colors.COLORS["green-500"],borderBottomColor:_colors.COLORS["green-500"]});(0,_vitest.expect)((0,_colors.parseColor)("border-y-yellow-500")).toEqual({borderTopColor:_colors.COLORS["yellow-500"],borderBottomColor:_colors.COLORS["yellow-500"]});});(0,_vitest.it)("should parse border-x with basic colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-white")).toEqual({borderLeftColor:"#FFFFFF",borderRightColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-x-black")).toEqual({borderLeftColor:"#000000",borderRightColor:"#000000"});});(0,_vitest.it)("should parse border-y with basic colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-white")).toEqual({borderTopColor:"#FFFFFF",borderBottomColor:"#FFFFFF"});(0,_vitest.expect)((0,_colors.parseColor)("border-y-transparent")).toEqual({borderTopColor:"transparent",borderBottomColor:"transparent"});});(0,_vitest.it)("should parse border-x with opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-red-500/50")).toEqual({borderLeftColor:applyOpacity(_colors.COLORS["red-500"],50),borderRightColor:applyOpacity(_colors.COLORS["red-500"],50)});});(0,_vitest.it)("should parse border-y with opacity",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-blue-500/80")).toEqual({borderTopColor:applyOpacity(_colors.COLORS["blue-500"],80),borderBottomColor:applyOpacity(_colors.COLORS["blue-500"],80)});});(0,_vitest.it)("should parse border-x with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-[#ff0000]")).toEqual({borderLeftColor:"#ff0000",borderRightColor:"#ff0000"});(0,_vitest.expect)((0,_colors.parseColor)("border-x-[#abc]")).toEqual({borderLeftColor:"#aabbcc",borderRightColor:"#aabbcc"});});(0,_vitest.it)("should parse border-y with arbitrary hex colors",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-y-[#00ff00]")).toEqual({borderTopColor:"#00ff00",borderBottomColor:"#00ff00"});(0,_vitest.expect)((0,_colors.parseColor)("border-y-[#123]")).toEqual({borderTopColor:"#112233",borderBottomColor:"#112233"});});(0,_vitest.it)("should parse border-x with custom colors",function(){var customColors={"brand-primary":"#FF6B6B"};(0,_vitest.expect)((0,_colors.parseColor)("border-x-brand-primary",customColors)).toEqual({borderLeftColor:"#FF6B6B",borderRightColor:"#FF6B6B"});});(0,_vitest.it)("should parse border-y with custom colors",function(){var customColors={accent:"#FFE66D"};(0,_vitest.expect)((0,_colors.parseColor)("border-y-accent",customColors)).toEqual({borderTopColor:"#FFE66D",borderBottomColor:"#FFE66D"});});(0,_vitest.it)("should not match border-x/border-y width classes",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-2")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-4")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-x-0")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-8")).toBeNull();});(0,_vitest.it)("should not match border-x/border-y arbitrary width values",function(){(0,_vitest.expect)((0,_colors.parseColor)("border-x-[3px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-[5px]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-x-[10]")).toBeNull();(0,_vitest.expect)((0,_colors.parseColor)("border-y-[8px]")).toBeNull();});});
|
package/dist/parser/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});Object.defineProperty(exports,"expandSchemeModifier",{enumerable:true,get:function get(){return _modifiers.expandSchemeModifier;}});Object.defineProperty(exports,"hasModifier",{enumerable:true,get:function get(){return _modifiers.hasModifier;}});Object.defineProperty(exports,"isColorClass",{enumerable:true,get:function get(){return _modifiers.isColorClass;}});Object.defineProperty(exports,"isColorSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isColorSchemeModifier;}});Object.defineProperty(exports,"isPlatformModifier",{enumerable:true,get:function get(){return _modifiers.isPlatformModifier;}});Object.defineProperty(exports,"isSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isSchemeModifier;}});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,customTheme){var classes=className.split(/\s+/).filter(Boolean);var style={};for(var cls of classes){var parsedStyle=parseClass(cls,customTheme);Object.assign(style,parsedStyle);}return style;}function parseClass(cls,customTheme){var parsers=[_spacing.parseSpacing,_borders.parseBorder,function(cls){return(0,_colors.parseColor)(cls,customTheme==null?void 0:customTheme.colors);},_layout.parseLayout,function(cls){return(0,_typography.parseTypography)(cls,customTheme==null?void 0:customTheme.fontFamily,customTheme==null?void 0:customTheme.fontSize);},_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,"expandSchemeModifier",{enumerable:true,get:function get(){return _modifiers.expandSchemeModifier;}});Object.defineProperty(exports,"hasModifier",{enumerable:true,get:function get(){return _modifiers.hasModifier;}});Object.defineProperty(exports,"isColorClass",{enumerable:true,get:function get(){return _modifiers.isColorClass;}});Object.defineProperty(exports,"isColorSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isColorSchemeModifier;}});Object.defineProperty(exports,"isPlatformModifier",{enumerable:true,get:function get(){return _modifiers.isPlatformModifier;}});Object.defineProperty(exports,"isSchemeModifier",{enumerable:true,get:function get(){return _modifiers.isSchemeModifier;}});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,customTheme){var classes=className.split(/\s+/).filter(Boolean);var style={};for(var cls of classes){var parsedStyle=parseClass(cls,customTheme);Object.assign(style,parsedStyle);}return style;}function parseClass(cls,customTheme){var parsers=[_spacing.parseSpacing,function(cls){return(0,_borders.parseBorder)(cls,customTheme==null?void 0:customTheme.colors);},function(cls){return(0,_colors.parseColor)(cls,customTheme==null?void 0:customTheme.colors);},_layout.parseLayout,function(cls){return(0,_typography.parseTypography)(cls,customTheme==null?void 0:customTheme.fontFamily,customTheme==null?void 0:customTheme.fontSize);},_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{};}
|
package/dist/parser/sizing.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,"__esModule",{value:true});exports.SIZE_SCALE=exports.SIZE_PERCENTAGES=void 0;exports.parseSizing=parseSizing;var SIZE_SCALE=exports.SIZE_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};var SIZE_PERCENTAGES=exports.SIZE_PERCENTAGES={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 parseArbitrarySize(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}var percentMatch=value.match(/^\[(\d+(?:\.\d+)?)%\]$/);if(percentMatch){return`${percentMatch[1]}%`;}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary size unit: ${value}. Only px and % are supported.`);}return null;}return null;}function parseSizing(cls){if(cls.startsWith("w-")){var sizeKey=cls.substring(2);var arbitrarySize=parseArbitrarySize(sizeKey);if(arbitrarySize!==null){return{width:arbitrarySize};}var percentage=SIZE_PERCENTAGES[sizeKey];if(percentage){return{width:percentage};}var numericSize=SIZE_SCALE[sizeKey];if(numericSize!==undefined){return{width:numericSize};}if(sizeKey==="auto"){return{width:"auto"};}}if(cls.startsWith("h-")){var _sizeKey=cls.substring(2);var _arbitrarySize=parseArbitrarySize(_sizeKey);if(_arbitrarySize!==null){return{height:_arbitrarySize};}var _percentage=SIZE_PERCENTAGES[_sizeKey];if(_percentage){return{height:_percentage};}var _numericSize=SIZE_SCALE[_sizeKey];if(_numericSize!==undefined){return{height:_numericSize};}if(_sizeKey==="auto"){return{height:"auto"};}}if(cls.startsWith("min-w-")){var _sizeKey2=cls.substring(6);var _arbitrarySize2=parseArbitrarySize(_sizeKey2);if(_arbitrarySize2!==null){return{minWidth:_arbitrarySize2};}var _percentage2=SIZE_PERCENTAGES[_sizeKey2];if(_percentage2){return{minWidth:_percentage2};}var _numericSize2=SIZE_SCALE[_sizeKey2];if(_numericSize2!==undefined){return{minWidth:_numericSize2};}}if(cls.startsWith("min-h-")){var _sizeKey3=cls.substring(6);var _arbitrarySize3=parseArbitrarySize(_sizeKey3);if(_arbitrarySize3!==null){return{minHeight:_arbitrarySize3};}var _percentage3=SIZE_PERCENTAGES[_sizeKey3];if(_percentage3){return{minHeight:_percentage3};}var _numericSize3=SIZE_SCALE[_sizeKey3];if(_numericSize3!==undefined){return{minHeight:_numericSize3};}}if(cls.startsWith("max-w-")){var _sizeKey4=cls.substring(6);var _arbitrarySize4=parseArbitrarySize(_sizeKey4);if(_arbitrarySize4!==null){return{maxWidth:_arbitrarySize4};}var _percentage4=SIZE_PERCENTAGES[_sizeKey4];if(_percentage4){return{maxWidth:_percentage4};}var _numericSize4=SIZE_SCALE[_sizeKey4];if(_numericSize4!==undefined){return{maxWidth:_numericSize4};}}if(cls.startsWith("max-h-")){var _sizeKey5=cls.substring(6);var _arbitrarySize5=parseArbitrarySize(_sizeKey5);if(_arbitrarySize5!==null){return{maxHeight:_arbitrarySize5};}var _percentage5=SIZE_PERCENTAGES[_sizeKey5];if(_percentage5){return{maxHeight:_percentage5};}var _numericSize5=SIZE_SCALE[_sizeKey5];if(_numericSize5!==undefined){return{maxHeight:_numericSize5};}}return null;}
|
|
1
|
+
Object.defineProperty(exports,"__esModule",{value:true});exports.SIZE_SCALE=exports.SIZE_PERCENTAGES=void 0;exports.parseSizing=parseSizing;var _markers=require("../config/markers");var SIZE_SCALE=exports.SIZE_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};var SIZE_PERCENTAGES=exports.SIZE_PERCENTAGES={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 parseArbitrarySize(value){var pxMatch=value.match(/^\[(\d+)(?:px)?\]$/);if(pxMatch){return parseInt(pxMatch[1],10);}var percentMatch=value.match(/^\[(\d+(?:\.\d+)?)%\]$/);if(percentMatch){return`${percentMatch[1]}%`;}if(value.startsWith("[")&&value.endsWith("]")){if(process.env.NODE_ENV!=="production"){console.warn(`[react-native-tailwind] Unsupported arbitrary size unit: ${value}. Only px and % are supported.`);}return null;}return null;}function parseSizing(cls){if(cls.startsWith("w-")){var sizeKey=cls.substring(2);if(sizeKey==="screen"){return{width:`${_markers.RUNTIME_DIMENSIONS_MARKER}width}}`};}var arbitrarySize=parseArbitrarySize(sizeKey);if(arbitrarySize!==null){return{width:arbitrarySize};}var percentage=SIZE_PERCENTAGES[sizeKey];if(percentage){return{width:percentage};}var numericSize=SIZE_SCALE[sizeKey];if(numericSize!==undefined){return{width:numericSize};}if(sizeKey==="auto"){return{width:"auto"};}}if(cls.startsWith("h-")){var _sizeKey=cls.substring(2);if(_sizeKey==="screen"){return{height:`${_markers.RUNTIME_DIMENSIONS_MARKER}height}}`};}var _arbitrarySize=parseArbitrarySize(_sizeKey);if(_arbitrarySize!==null){return{height:_arbitrarySize};}var _percentage=SIZE_PERCENTAGES[_sizeKey];if(_percentage){return{height:_percentage};}var _numericSize=SIZE_SCALE[_sizeKey];if(_numericSize!==undefined){return{height:_numericSize};}if(_sizeKey==="auto"){return{height:"auto"};}}if(cls.startsWith("min-w-")){var _sizeKey2=cls.substring(6);var _arbitrarySize2=parseArbitrarySize(_sizeKey2);if(_arbitrarySize2!==null){return{minWidth:_arbitrarySize2};}var _percentage2=SIZE_PERCENTAGES[_sizeKey2];if(_percentage2){return{minWidth:_percentage2};}var _numericSize2=SIZE_SCALE[_sizeKey2];if(_numericSize2!==undefined){return{minWidth:_numericSize2};}}if(cls.startsWith("min-h-")){var _sizeKey3=cls.substring(6);var _arbitrarySize3=parseArbitrarySize(_sizeKey3);if(_arbitrarySize3!==null){return{minHeight:_arbitrarySize3};}var _percentage3=SIZE_PERCENTAGES[_sizeKey3];if(_percentage3){return{minHeight:_percentage3};}var _numericSize3=SIZE_SCALE[_sizeKey3];if(_numericSize3!==undefined){return{minHeight:_numericSize3};}}if(cls.startsWith("max-w-")){var _sizeKey4=cls.substring(6);var _arbitrarySize4=parseArbitrarySize(_sizeKey4);if(_arbitrarySize4!==null){return{maxWidth:_arbitrarySize4};}var _percentage4=SIZE_PERCENTAGES[_sizeKey4];if(_percentage4){return{maxWidth:_percentage4};}var _numericSize4=SIZE_SCALE[_sizeKey4];if(_numericSize4!==undefined){return{maxWidth:_numericSize4};}}if(cls.startsWith("max-h-")){var _sizeKey5=cls.substring(6);var _arbitrarySize5=parseArbitrarySize(_sizeKey5);if(_arbitrarySize5!==null){return{maxHeight:_arbitrarySize5};}var _percentage5=SIZE_PERCENTAGES[_sizeKey5];if(_percentage5){return{maxHeight:_percentage5};}var _numericSize5=SIZE_SCALE[_sizeKey5];if(_numericSize5!==undefined){return{maxHeight:_numericSize5};}}return null;}
|
package/dist/runtime.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var E=Object.defineProperty,pt=Object.defineProperties,gt=Object.getOwnPropertyDescriptor,ht=Object.getOwnPropertyDescriptors,yt=Object.getOwnPropertyNames,H=Object.getOwnPropertySymbols;var U=Object.prototype.hasOwnProperty,bt=Object.prototype.propertyIsEnumerable;var B=(t,e,r)=>e in t?E(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M=(t,e)=>{for(var r in e||(e={}))U.call(e,r)&&B(t,r,e[r]);if(H)for(var r of H(e))bt.call(e,r)&&B(t,r,e[r]);return t},G=(t,e)=>pt(t,ht(e));var mt=(t,e)=>{for(var r in e)E(t,r,{get:e[r],enumerable:!0})},xt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of yt(e))!U.call(t,i)&&i!==r&&E(t,i,{get:()=>e[i],enumerable:!(n=gt(e,i))||n.enumerable});return t};var St=t=>xt(E({},"__esModule",{value:!0}),t);var ue={};mt(ue,{clearCache:()=>fe,getCacheStats:()=>le,getCustomColors:()=>ae,getCustomTheme:()=>se,setConfig:()=>oe,tw:()=>ce,twStyle:()=>de});module.exports=St(ue);var X={"aspect-auto":void 0,"aspect-square":1,"aspect-video":1.7777777777777777};function wt(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 v(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=wt(e);return r!==null?{aspectRatio:r}:null}var Y={"":1,0:0,2:2,4:4,8:8},N={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"},Ot={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 I(t){return t==="border-solid"?{borderStyle:"solid"}:t==="border-dotted"?{borderStyle:"dotted"}:t==="border-dashed"?{borderStyle:"dashed"}:t.startsWith("border-")?Rt(t):t==="border"?{borderWidth:1}:t.startsWith("rounded")?Wt(t):null}function Rt(t){let e=t.match(/^border-([trbl])(?:-(.+))?$/);if(e){let i=e[1],o=e[2]||"";if(o.startsWith("[")){let a=J(o);return a!==null?{[Z[i]]:a}:null}let s=Y[o];return s!==void 0?{[Z[i]]:s}: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 Wt(t){let e=t.substring(7);if(e==="")return{borderRadius:N[""]};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 s=n[1],a=n[2]||"";if(a.startsWith("[")){let u=$(a);return u!==null?{[q[s]]:u}:null}let c=N[a];return c!==void 0?{[q[s]]:c}:null}let i=r.match(/^([trbl])(?:-(.+))?$/);if(i){let s=i[1],a=i[2]||"",c;if(a.startsWith("[")){let u=$(a);if(u!==null)c=u;else return null}else c=N[a];if(c!==void 0){let u={};return Ot[s].forEach(p=>u[p]=c),u}return null}if(r.startsWith("[")){let s=$(r);return s!==null?{borderRadius:s}:null}let o=N[r];return o!==void 0?{borderRadius:o}: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 o=n==="DEFAULT"&&e?e:e?`${e}-${n}`:n;typeof i=="string"?r[o]=i:typeof i=="object"&&i!==null&&Object.assign(r,T(i,o))}return r}var Ct=G(M({},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(s=>s+s).join(""):r,o=Math.round(e/100*255).toString(16).padStart(2,"0").toUpperCase();return`#${n.toUpperCase()}${o}`}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 A(t,e){let r=i=>{var o;return(o=e==null?void 0:e[i])!=null?o:Ct[i]},n=i=>{var a;let o=i.match(/^(.+)\/(\d+)$/);if(o){let c=o[1],u=Number.parseInt(o[2],10);if(u<0||u>100)return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid opacity value: ${u}. Opacity must be between 0 and 100.`),null;let p=et(c);if(p!==null)return tt(p,u);let y=r(c);return y?tt(y,u):null}let s=et(i);return s!==null?s:(a=r(i))!=null?a:null};if(t.startsWith("bg-")){let i=t.substring(3);if(i.startsWith("[")&&!i.startsWith("[#"))return null;let o=n(i);if(o)return{backgroundColor:o}}if(t.startsWith("text-")){let i=t.substring(5);if(i.startsWith("[")&&!i.startsWith("[#"))return null;let o=n(i);if(o)return{color:o}}if(t.startsWith("border-")&&!t.match(/^border-[0-9]/)){let i=t.substring(7);if(i.startsWith("[")&&!i.startsWith("[#"))return null;let o=n(i);if(o)return{borderColor:o}}return null}function b(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 Mt(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)}function rt(t){let e=t.match(/^\[(\d+(?:\.\d+)?|\.\d+)\]$/);return e?parseFloat(e[1]):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary grow/shrink value: ${t}. Only non-negative numbers are supported (e.g., [1.5], [2], [0.5], [.5]).`),null)}var Tt={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"}},Nt={"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}},_t={grow:{flexGrow:1},"grow-0":{flexGrow:0},shrink:{flexShrink:1},"shrink-0":{flexShrink:0},"flex-grow":{flexGrow:1},"flex-grow-0":{flexGrow:0},"flex-shrink":{flexShrink:1},"flex-shrink-0":{flexShrink:0}},vt={"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"}},It={"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"}},jt={"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"}},Pt={absolute:{position:"absolute"},relative:{position:"relative"}},Vt={"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"}},kt={"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}},Dt={0:0,10:10,20:20,30:30,40:40,50:50,auto:0},m={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 j(t){var e,r,n,i,o,s,a,c,u,p,y,g;if(t.startsWith("z-")){let f=t.substring(2),l=Mt(f);if(l!==null)return{zIndex:l};let d=Dt[f];if(d!==void 0)return{zIndex:d}}if(t.startsWith("top-")){let f=t.substring(4);if(f==="auto")return{};let l=b(f);if(l!==null)return{top:l};let d=m[f];if(d!==void 0)return{top:d}}if(t.startsWith("right-")){let f=t.substring(6);if(f==="auto")return{};let l=b(f);if(l!==null)return{right:l};let d=m[f];if(d!==void 0)return{right:d}}if(t.startsWith("bottom-")){let f=t.substring(7);if(f==="auto")return{};let l=b(f);if(l!==null)return{bottom:l};let d=m[f];if(d!==void 0)return{bottom:d}}if(t.startsWith("left-")){let f=t.substring(5);if(f==="auto")return{};let l=b(f);if(l!==null)return{left:l};let d=m[f];if(d!==void 0)return{left:d}}if(t.startsWith("inset-x-")){let f=t.substring(8),l=b(f);if(l!==null)return{left:l,right:l};let d=m[f];if(d!==void 0)return{left:d,right:d}}if(t.startsWith("inset-y-")){let f=t.substring(8),l=b(f);if(l!==null)return{top:l,bottom:l};let d=m[f];if(d!==void 0)return{top:d,bottom:d}}if(t.startsWith("inset-")){let f=t.substring(6),l=b(f);if(l!==null)return{top:l,right:l,bottom:l,left:l};let d=m[f];if(d!==void 0)return{top:d,right:d,bottom:d,left:d}}if(t.startsWith("grow-")||t.startsWith("flex-grow-")){let f=t.startsWith("flex-grow-")?"flex-grow-":"grow-",l=t.substring(f.length),d=rt(l);if(d!==null)return{flexGrow:d}}if(t.startsWith("shrink-")||t.startsWith("flex-shrink-")){let f=t.startsWith("flex-shrink-")?"flex-shrink-":"shrink-",l=t.substring(f.length),d=rt(l);if(d!==null)return{flexShrink:d}}return(g=(y=(p=(u=(c=(a=(s=(o=(i=(n=(r=(e=Tt[t])!=null?e:Et[t])!=null?r:Nt[t])!=null?n:At[t])!=null?i:_t[t])!=null?o:vt[t])!=null?s:$t[t])!=null?a:It[t])!=null?c:jt[t])!=null?u:Pt[t])!=null?p:Vt[t])!=null?y:kt[t])!=null?g:null}var nt={"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 P(t){return t in nt?nt[t]:null}var S={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},w={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 O(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 V(t){if(t.startsWith("w-")){let e=t.substring(2),r=O(e);if(r!==null)return{width:r};let n=w[e];if(n)return{width:n};let i=S[e];if(i!==void 0)return{width:i};if(e==="auto")return{width:"auto"}}if(t.startsWith("h-")){let e=t.substring(2),r=O(e);if(r!==null)return{height:r};let n=w[e];if(n)return{height:n};let i=S[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=O(e);if(r!==null)return{minWidth:r};let n=w[e];if(n)return{minWidth:n};let i=S[e];if(i!==void 0)return{minWidth:i}}if(t.startsWith("min-h-")){let e=t.substring(6),r=O(e);if(r!==null)return{minHeight:r};let n=w[e];if(n)return{minHeight:n};let i=S[e];if(i!==void 0)return{minHeight:i}}if(t.startsWith("max-w-")){let e=t.substring(6),r=O(e);if(r!==null)return{maxWidth:r};let n=w[e];if(n)return{maxWidth:n};let i=S[e];if(i!==void 0)return{maxWidth:i}}if(t.startsWith("max-h-")){let e=t.substring(6),r=O(e);if(r!==null)return{maxHeight:r};let n=w[e];if(n)return{maxHeight:n};let i=S[e];if(i!==void 0)return{maxHeight:i}}return null}var R={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 k(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?)(?:px)?\]$/);return e?parseFloat(e[1]):(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], [16], [4.5px], [4.5]).`),null)}function D(t){let e=t.match(/^(-?)m([xytrbls]?)-(.+)$/);if(e){let[,i,o,s]=e,a=i==="-",c=k(s);if(c!==null){let p=a?-c:c;return it(o,p)}let u=R[s];if(u!==void 0){let p=a?-u:u;return it(o,p)}}let r=t.match(/^p([xytrbls]?)-(.+)$/);if(r){let[,i,o]=r,s=k(o);if(s!==null)return ot(i,s);let a=R[o];if(a!==void 0)return ot(i,a)}let n=t.match(/^gap-(.+)$/);if(n){let i=n[1],o=k(i);if(o!==null)return{gap:o};let s=R[i];if(s!==void 0)return{gap:s}}return null}function it(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 ot(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},_={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 z(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 W(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 at(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 zt(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 F(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=z(e);if(r!==null)return{transform:[{scale:r}]};let n=L[e];if(n!==void 0)return{transform:[{scale:n}]}}if(t.startsWith("scale-x-")){let e=t.substring(8),r=z(e);if(r!==null)return{transform:[{scaleX:r}]};let n=L[e];if(n!==void 0)return{transform:[{scaleX:n}]}}if(t.startsWith("scale-y-")){let e=t.substring(8),r=z(e);if(r!==null)return{transform:[{scaleY:r}]};let n=L[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=W(r);if(n!==null)return{transform:[{rotate:e?`-${n}`:n}]};let i=_[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=W(r);if(n!==null)return{transform:[{rotateX:e?`-${n}`:n}]};let i=_[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=W(r);if(n!==null)return{transform:[{rotateY:e?`-${n}`:n}]};let i=_[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=W(r);if(n!==null)return{transform:[{rotateZ:e?`-${n}`:n}]};let i=_[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=at(r);if(n!==null)return{transform:[{translateX:typeof n=="number"?e?-n:n:e?`-${n}`:n}]};let i=R[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=at(r);if(n!==null)return{transform:[{translateY:typeof n=="number"?e?-n:n:e?`-${n}`:n}]};let i=R[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=W(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=W(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=zt(e);if(r!==null)return{transform:[{perspective:r}]};let n=Lt[e];if(n!==void 0)return{transform:[{perspective:n}]}}return null}var Ft={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 ft={"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"}},Ht={italic:{fontStyle:"italic"},"not-italic":{fontStyle:"normal"}},Bt={"text-left":{textAlign:"left"},"text-center":{textAlign:"center"},"text-right":{textAlign:"right"},"text-justify":{textAlign:"justify"}},Ut={underline:{textDecorationLine:"underline"},"line-through":{textDecorationLine:"line-through"},"no-underline":{textDecorationLine:"none"}},Gt={uppercase:{textTransform:"uppercase"},lowercase:{textTransform:"lowercase"},capitalize:{textTransform:"capitalize"},"normal-case":{textTransform:"none"}},Xt={3:12,4:16,5:20,6:24,7:28,8:32,9:36,10:40},Yt={"leading-none":{lineHeight:16},"leading-tight":{lineHeight:20},"leading-snug":{lineHeight:22},"leading-normal":{lineHeight:24},"leading-relaxed":{lineHeight:28},"leading-loose":{lineHeight:32}},Zt={"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 qt(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?|-?\.\d+)(?:px)?\]$/);return e?parseFloat(e[1]):(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], [13.5px], [.5]).`),null)}function Jt(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?|-?\.\d+)(?:px)?\]$/);return e?parseFloat(e[1]):(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], [21.5px], [.5]).`),null)}function Qt(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?|-?\.\d+)(?:px)?\]$/);return e?parseFloat(e[1]):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary letter spacing value: ${t}. Only px values are supported (e.g., [0.5px], [0.3], [.5], [-0.4]).`),null)}function K(t,e,r){var i,o,s,a,c,u,p,y;let n=e?M(M({},ft),Object.fromEntries(Object.entries(e).map(([g,f])=>[`font-${g}`,{fontFamily:f}]))):ft;if(t.startsWith("text-")){let g=t.substring(5),f=qt(g);if(f!==null)return{fontSize:f};if((r==null?void 0:r[g])!==void 0)return{fontSize:r[g]};let l=Ft[g];if(l!==void 0)return{fontSize:l}}if(t.startsWith("leading-")){let g=t.substring(8),f=Jt(g);if(f!==null)return{lineHeight:f};let l=Xt[g];if(l!==void 0)return{lineHeight:l}}if(t.startsWith("tracking-")){let g=t.substring(9),f=Qt(g);if(f!==null)return{letterSpacing:f}}return(y=(p=(u=(c=(a=(s=(o=(i=n[t])!=null?i:Kt[t])!=null?o:Ht[t])!=null?s:Bt[t])!=null?a:Ut[t])!=null?c:Gt[t])!=null?u:Yt[t])!=null?p:Zt[t])!=null?y:null}var te=["active","hover","focus","disabled","placeholder"],ee=["ios","android","web"],re=["dark","light"],ne=["scheme"],ve=[...te,...ee,...re,...ne];function C(t,e){let r=t.split(/\s+/).filter(Boolean),n={};for(let i of r){let o=ie(i,e);Object.assign(n,o)}return n}function ie(t,e){let r=[D,I,n=>A(n,e==null?void 0:e.colors),j,n=>K(n,e==null?void 0:e.fontFamily,e==null?void 0:e.fontSize),V,P,v,F];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 lt=["active","focus","disabled"];function ct(t){return lt.some(e=>t.includes(`${e}:`))}function dt(t){let e=t.split(/\s+/).filter(Boolean),r=[],n=new Map;for(let i of e){let o=!1;for(let s of lt){let a=`${s}:`;if(i.startsWith(a)){let c=i.slice(a.length);n.has(s)||n.set(s,[]);let u=n.get(s);u&&u.push(c),o=!0;break}}o||r.push(i)}return{base:r,modifiers:n}}var h={colors:{},fontFamily:{}},x=new Map;function oe(t){var e,r,n,i,o;if((r=(e=t.theme)==null?void 0:e.extend)!=null&&r.colors?h.colors=T((n=t.theme)==null?void 0:n.extend.colors):h.colors={},(o=(i=t.theme)==null?void 0:i.extend)!=null&&o.fontFamily){let s={};for(let[a,c]of Object.entries(t.theme.extend.fontFamily))Array.isArray(c)?s[a]=c[0]:s[a]=c;h.fontFamily=s}else h.fontFamily={};x.clear()}function se(){return h}function ae(){var t;return Object.keys((t=h.colors)!=null?t:{}).length>0?h.colors:void 0}function fe(){x.clear()}function le(){return{size:x.size,keys:Array.from(x.keys())}}function ut(t){let e=x.get(t);if(e)return e;if(!ct(t)){let c={style:C(t,h)};return x.set(t,c),c}let{base:r,modifiers:n}=dt(t),i=r.join(" "),s={style:i?C(i,h):{}};if(n.has("active")){let a=n.get("active");if(a&&a.length>0){let c=a.join(" ");s.activeStyle=C(c,h)}}if(n.has("focus")){let a=n.get("focus");if(a&&a.length>0){let c=a.join(" ");s.focusStyle=C(c,h)}}if(n.has("disabled")){let a=n.get("disabled");if(a&&a.length>0){let c=a.join(" ");s.disabledStyle=C(c,h)}}return x.set(t,s),s}function ce(t,...e){let n=t.reduce((i,o,s)=>{let a=e[s],c=a!=null&&a!==!1?String(a):"";return i+o+c},"").trim().replace(/\s+/g," ");return n?ut(n):{style:{}}}function de(t){let e=t.trim().replace(/\s+/g," ");if(e)return ut(e)}
|
|
1
|
+
"use strict";var N=Object.defineProperty,gt=Object.defineProperties,ht=Object.getOwnPropertyDescriptor,yt=Object.getOwnPropertyDescriptors,bt=Object.getOwnPropertyNames,B=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var U=(t,e,r)=>e in t?N(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,E=(t,e)=>{for(var r in e||(e={}))G.call(e,r)&&U(t,r,e[r]);if(B)for(var r of B(e))mt.call(e,r)&&U(t,r,e[r]);return t},X=(t,e)=>gt(t,yt(e));var xt=(t,e)=>{for(var r in e)N(t,r,{get:e[r],enumerable:!0})},St=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bt(e))!G.call(t,i)&&i!==r&&N(t,i,{get:()=>e[i],enumerable:!(n=ht(e,i))||n.enumerable});return t};var wt=t=>St(N({},"__esModule",{value:!0}),t);var pe={};xt(pe,{clearCache:()=>le,getCacheStats:()=>ce,getCustomColors:()=>fe,getCustomTheme:()=>ae,setConfig:()=>se,tw:()=>de,twStyle:()=>ue});module.exports=wt(pe);var Y={"aspect-auto":void 0,"aspect-square":1,"aspect-video":1.7777777777777777};function Rt(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 v(t){if(!t.startsWith("aspect-"))return null;if(t in Y){let n=Y[t];return n===void 0?{aspectRatio:void 0}:{aspectRatio:n}}let e=t.substring(7),r=Rt(e);return r!==null?{aspectRatio:r}:null}var Z={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 o=n==="DEFAULT"&&e?e:e?`${e}-${n}`:n;typeof i=="string"?r[o]=i:typeof i=="object"&&i!==null&&Object.assign(r,T(i,o))}return r}var Ot=X(E({},T(Z)),{white:"#FFFFFF",black:"#000000",transparent:"transparent"});function q(t,e){if(t==="transparent")return"transparent";let r=t.replace(/^#/,""),n=r.length===3?r.split("").map(s=>s+s).join(""):r,o=Math.round(e/100*255).toString(16).padStart(2,"0").toUpperCase();return`#${n.toUpperCase()}${o}`}function J(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 S(t,e){let r=o=>{var s;return(s=e==null?void 0:e[o])!=null?s:Ot[o]},n=o=>{var f;let s=o.match(/^(.+)\/(\d+)$/);if(s){let u=s[1],p=Number.parseInt(s[2],10);if(p<0||p>100)return process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid opacity value: ${p}. Opacity must be between 0 and 100.`),null;let y=J(u);if(y!==null)return q(y,p);let g=r(u);return g?q(g,p):null}let a=J(o);return a!==null?a:(f=r(o))!=null?f:null};if(t.startsWith("bg-")){let o=t.substring(3);if(o.startsWith("[")&&!o.startsWith("[#"))return null;let s=n(o);if(s)return{backgroundColor:s}}if(t.startsWith("text-")){let o=t.substring(5);if(o.startsWith("[")&&!o.startsWith("[#"))return null;let s=n(o);if(s)return{color:s}}if(t.startsWith("border-")&&!t.match(/^border-[0-9]/)){let o=t.substring(7);if(o.startsWith("[")&&!o.startsWith("[#"))return null;let s=n(o);if(s)return{borderColor:s}}let i=t.match(/^border-([trblxy])-(.+)$/);if(i){let o=i[1],s=i[2];if(s.startsWith("[")&&!s.startsWith("[#"))return null;let a=n(s);if(a)return o==="x"?{borderLeftColor:a,borderRightColor:a}:o==="y"?{borderTopColor:a,borderBottomColor:a}:{[{t:"borderTopColor",r:"borderRightColor",b:"borderBottomColor",l:"borderLeftColor"}[o]]:a}}return null}var Q={"":1,0:0,2:2,4:4,8:8},_={none:0,sm:2,"":4,md:6,lg:8,xl:12,"2xl":16,"3xl":24,full:9999},tt={t:"borderTopWidth",r:"borderRightWidth",b:"borderBottomWidth",l:"borderLeftWidth"},et={tl:"borderTopLeftRadius",tr:"borderTopRightRadius",bl:"borderBottomLeftRadius",br:"borderBottomRightRadius"},Mt={t:["borderTopLeftRadius","borderTopRightRadius"],r:["borderTopRightRadius","borderBottomRightRadius"],b:["borderBottomLeftRadius","borderBottomRightRadius"],l:["borderTopLeftRadius","borderBottomLeftRadius"]};function rt(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 I(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 $(t,e){return t==="border-solid"?{borderStyle:"solid"}:t==="border-dotted"?{borderStyle:"dotted"}:t==="border-dashed"?{borderStyle:"dashed"}:t.startsWith("border-")?Ct(t,e):t==="border"?{borderWidth:1}:t.startsWith("rounded")?Wt(t):null}function Ct(t,e){let r=t.match(/^border-([trbl])(?:-(.+))?$/);if(r){let o=r[1],s=r[2]||"";if(s&&S(t,e)!==null)return null;if(s.startsWith("[")){let f=rt(s);return f!==null?{[tt[o]]:f}:null}let a=Q[s];return a!==void 0?{[tt[o]]:a}:null}let n=t.match(/^border-(\d+)$/);if(n){let o=Q[n[1]];if(o!==void 0)return{borderWidth:o}}let i=t.match(/^border-(\[.+\])$/);if(i){let o=rt(i[1]);if(o!==null)return{borderWidth:o}}return null}function Wt(t){let e=t.substring(7);if(e==="")return{borderRadius:_[""]};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 s=n[1],a=n[2]||"";if(a.startsWith("[")){let u=I(a);return u!==null?{[et[s]]:u}:null}let f=_[a];return f!==void 0?{[et[s]]:f}:null}let i=r.match(/^([trbl])(?:-(.+))?$/);if(i){let s=i[1],a=i[2]||"",f;if(a.startsWith("[")){let u=I(a);if(u!==null)f=u;else return null}else f=_[a];if(f!==void 0){let u={};return Mt[s].forEach(p=>u[p]=f),u}return null}if(r.startsWith("[")){let s=I(r);return s!==null?{borderRadius:s}:null}let o=_[r];return o!==void 0?{borderRadius:o}:null}function b(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 Et(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)}function nt(t){let e=t.match(/^\[(\d+(?:\.\d+)?|\.\d+)\]$/);return e?parseFloat(e[1]):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Invalid arbitrary grow/shrink value: ${t}. Only non-negative numbers are supported (e.g., [1.5], [2], [0.5], [.5]).`),null)}var Tt={flex:{display:"flex"},hidden:{display:"none"}},Nt={"flex-row":{flexDirection:"row"},"flex-row-reverse":{flexDirection:"row-reverse"},"flex-col":{flexDirection:"column"},"flex-col-reverse":{flexDirection:"column-reverse"}},_t={"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}},vt={grow:{flexGrow:1},"grow-0":{flexGrow:0},shrink:{flexShrink:1},"shrink-0":{flexShrink:0},"flex-grow":{flexGrow:1},"flex-grow-0":{flexGrow:0},"flex-shrink":{flexShrink:1},"flex-shrink-0":{flexShrink:0}},It={"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"}},jt={"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"}},Pt={"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"}},Vt={absolute:{position:"absolute"},relative:{position:"relative"}},Dt={"overflow-hidden":{overflow:"hidden"},"overflow-visible":{overflow:"visible"},"overflow-scroll":{overflow:"scroll"}},kt={"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}},Lt={0:0,10:10,20:20,30:30,40:40,50:50,auto:0},m={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 j(t){var e,r,n,i,o,s,a,f,u,p,y,g;if(t.startsWith("z-")){let l=t.substring(2),c=Et(l);if(c!==null)return{zIndex:c};let d=Lt[l];if(d!==void 0)return{zIndex:d}}if(t.startsWith("top-")){let l=t.substring(4);if(l==="auto")return{};let c=b(l);if(c!==null)return{top:c};let d=m[l];if(d!==void 0)return{top:d}}if(t.startsWith("right-")){let l=t.substring(6);if(l==="auto")return{};let c=b(l);if(c!==null)return{right:c};let d=m[l];if(d!==void 0)return{right:d}}if(t.startsWith("bottom-")){let l=t.substring(7);if(l==="auto")return{};let c=b(l);if(c!==null)return{bottom:c};let d=m[l];if(d!==void 0)return{bottom:d}}if(t.startsWith("left-")){let l=t.substring(5);if(l==="auto")return{};let c=b(l);if(c!==null)return{left:c};let d=m[l];if(d!==void 0)return{left:d}}if(t.startsWith("inset-x-")){let l=t.substring(8),c=b(l);if(c!==null)return{left:c,right:c};let d=m[l];if(d!==void 0)return{left:d,right:d}}if(t.startsWith("inset-y-")){let l=t.substring(8),c=b(l);if(c!==null)return{top:c,bottom:c};let d=m[l];if(d!==void 0)return{top:d,bottom:d}}if(t.startsWith("inset-")){let l=t.substring(6),c=b(l);if(c!==null)return{top:c,right:c,bottom:c,left:c};let d=m[l];if(d!==void 0)return{top:d,right:d,bottom:d,left:d}}if(t.startsWith("grow-")||t.startsWith("flex-grow-")){let l=t.startsWith("flex-grow-")?"flex-grow-":"grow-",c=t.substring(l.length),d=nt(c);if(d!==null)return{flexGrow:d}}if(t.startsWith("shrink-")||t.startsWith("flex-shrink-")){let l=t.startsWith("flex-shrink-")?"flex-shrink-":"shrink-",c=t.substring(l.length),d=nt(c);if(d!==null)return{flexShrink:d}}return(g=(y=(p=(u=(f=(a=(s=(o=(i=(n=(r=(e=Tt[t])!=null?e:Nt[t])!=null?r:_t[t])!=null?n:At[t])!=null?i:vt[t])!=null?o:It[t])!=null?s:$t[t])!=null?a:jt[t])!=null?f:Pt[t])!=null?u:Vt[t])!=null?p:Dt[t])!=null?y:kt[t])!=null?g:null}var it={"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 P(t){return t in it?it[t]:null}var V="{{RUNTIME:dimensions.";var w={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},R={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 O(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 D(t){if(t.startsWith("w-")){let e=t.substring(2);if(e==="screen")return{width:`${V}width}}`};let r=O(e);if(r!==null)return{width:r};let n=R[e];if(n)return{width:n};let i=w[e];if(i!==void 0)return{width:i};if(e==="auto")return{width:"auto"}}if(t.startsWith("h-")){let e=t.substring(2);if(e==="screen")return{height:`${V}height}}`};let r=O(e);if(r!==null)return{height:r};let n=R[e];if(n)return{height:n};let i=w[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=O(e);if(r!==null)return{minWidth:r};let n=R[e];if(n)return{minWidth:n};let i=w[e];if(i!==void 0)return{minWidth:i}}if(t.startsWith("min-h-")){let e=t.substring(6),r=O(e);if(r!==null)return{minHeight:r};let n=R[e];if(n)return{minHeight:n};let i=w[e];if(i!==void 0)return{minHeight:i}}if(t.startsWith("max-w-")){let e=t.substring(6),r=O(e);if(r!==null)return{maxWidth:r};let n=R[e];if(n)return{maxWidth:n};let i=w[e];if(i!==void 0)return{maxWidth:i}}if(t.startsWith("max-h-")){let e=t.substring(6),r=O(e);if(r!==null)return{maxHeight:r};let n=R[e];if(n)return{maxHeight:n};let i=w[e];if(i!==void 0)return{maxHeight:i}}return null}var M={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 k(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?)(?:px)?\]$/);return e?parseFloat(e[1]):(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], [16], [4.5px], [4.5]).`),null)}function L(t){let e=t.match(/^(-?)m([xytrbls]?)-(.+)$/);if(e){let[,i,o,s]=e,a=i==="-",f=k(s);if(f!==null){let p=a?-f:f;return ot(o,p)}let u=M[s];if(u!==void 0){let p=a?-u:u;return ot(o,p)}}let r=t.match(/^p([xytrbls]?)-(.+)$/);if(r){let[,i,o]=r,s=k(o);if(s!==null)return st(i,s);let a=M[o];if(a!==void 0)return st(i,a)}let n=t.match(/^gap-(.+)$/);if(n){let i=n[1],o=k(i);if(o!==null)return{gap:o};let s=M[i];if(s!==void 0)return{gap:s}}return null}function ot(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 st(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 z={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},at={0:0,1:1,2:2,3:3,6:6,12:12},zt={0:0,100:100,200:200,300:300,400:400,500:500,600:600,700:700,800:800,900:900,1e3:1e3};function F(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 C(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 ft(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 Ft(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 K(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=F(e);if(r!==null)return{transform:[{scale:r}]};let n=z[e];if(n!==void 0)return{transform:[{scale:n}]}}if(t.startsWith("scale-x-")){let e=t.substring(8),r=F(e);if(r!==null)return{transform:[{scaleX:r}]};let n=z[e];if(n!==void 0)return{transform:[{scaleX:n}]}}if(t.startsWith("scale-y-")){let e=t.substring(8),r=F(e);if(r!==null)return{transform:[{scaleY:r}]};let n=z[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=C(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=C(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=C(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=C(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=ft(r);if(n!==null)return{transform:[{translateX:typeof n=="number"?e?-n:n:e?`-${n}`:n}]};let i=M[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=ft(r);if(n!==null)return{transform:[{translateY:typeof n=="number"?e?-n:n:e?`-${n}`:n}]};let i=M[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=C(r);if(n!==null)return{transform:[{skewX:e?`-${n}`:n}]};let i=at[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=C(r);if(n!==null)return{transform:[{skewY:e?`-${n}`:n}]};let i=at[r];if(i!==void 0)return{transform:[{skewY:`${e?-i:i}deg`}]}}if(t.startsWith("perspective-")){let e=t.substring(12),r=Ft(e);if(r!==null)return{transform:[{perspective:r}]};let n=zt[e];if(n!==void 0)return{transform:[{perspective:n}]}}return null}var Kt={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 lt={"font-sans":{fontFamily:"System"},"font-serif":{fontFamily:"serif"},"font-mono":{fontFamily:"Courier"}},Ht={"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"}},Bt={italic:{fontStyle:"italic"},"not-italic":{fontStyle:"normal"}},Ut={"text-left":{textAlign:"left"},"text-center":{textAlign:"center"},"text-right":{textAlign:"right"},"text-justify":{textAlign:"justify"}},Gt={underline:{textDecorationLine:"underline"},"line-through":{textDecorationLine:"line-through"},"no-underline":{textDecorationLine:"none"}},Xt={uppercase:{textTransform:"uppercase"},lowercase:{textTransform:"lowercase"},capitalize:{textTransform:"capitalize"},"normal-case":{textTransform:"none"}},Yt={3:12,4:16,5:20,6:24,7:28,8:32,9:36,10:40},Zt={"leading-none":{lineHeight:16},"leading-tight":{lineHeight:20},"leading-snug":{lineHeight:22},"leading-normal":{lineHeight:24},"leading-relaxed":{lineHeight:28},"leading-loose":{lineHeight:32}},qt={"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 Jt(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?|-?\.\d+)(?:px)?\]$/);return e?parseFloat(e[1]):(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], [13.5px], [.5]).`),null)}function Qt(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?|-?\.\d+)(?:px)?\]$/);return e?parseFloat(e[1]):(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], [21.5px], [.5]).`),null)}function te(t){let e=t.match(/^\[(-?\d+(?:\.\d+)?|-?\.\d+)(?:px)?\]$/);return e?parseFloat(e[1]):(t.startsWith("[")&&t.endsWith("]")&&process.env.NODE_ENV!=="production"&&console.warn(`[react-native-tailwind] Unsupported arbitrary letter spacing value: ${t}. Only px values are supported (e.g., [0.5px], [0.3], [.5], [-0.4]).`),null)}function H(t,e,r){var i,o,s,a,f,u,p,y;let n=e?E(E({},lt),Object.fromEntries(Object.entries(e).map(([g,l])=>[`font-${g}`,{fontFamily:l}]))):lt;if(t.startsWith("text-")){let g=t.substring(5),l=Jt(g);if(l!==null)return{fontSize:l};if((r==null?void 0:r[g])!==void 0)return{fontSize:r[g]};let c=Kt[g];if(c!==void 0)return{fontSize:c}}if(t.startsWith("leading-")){let g=t.substring(8),l=Qt(g);if(l!==null)return{lineHeight:l};let c=Yt[g];if(c!==void 0)return{lineHeight:c}}if(t.startsWith("tracking-")){let g=t.substring(9),l=te(g);if(l!==null)return{letterSpacing:l}}return(y=(p=(u=(f=(a=(s=(o=(i=n[t])!=null?i:Ht[t])!=null?o:Bt[t])!=null?s:Ut[t])!=null?a:Gt[t])!=null?f:Xt[t])!=null?u:Zt[t])!=null?p:qt[t])!=null?y:null}var ee=["active","hover","focus","disabled","placeholder"],re=["ios","android","web"],ne=["dark","light"],ie=["scheme"],Pe=[...ee,...re,...ne,...ie];function W(t,e){let r=t.split(/\s+/).filter(Boolean),n={};for(let i of r){let o=oe(i,e);Object.assign(n,o)}return n}function oe(t,e){let r=[L,n=>$(n,e==null?void 0:e.colors),n=>S(n,e==null?void 0:e.colors),j,n=>H(n,e==null?void 0:e.fontFamily,e==null?void 0:e.fontSize),D,P,v,K];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 ct=["active","focus","disabled"];function dt(t){return ct.some(e=>t.includes(`${e}:`))}function ut(t){let e=t.split(/\s+/).filter(Boolean),r=[],n=new Map;for(let i of e){let o=!1;for(let s of ct){let a=`${s}:`;if(i.startsWith(a)){let f=i.slice(a.length);n.has(s)||n.set(s,[]);let u=n.get(s);u&&u.push(f),o=!0;break}}o||r.push(i)}return{base:r,modifiers:n}}var h={colors:{},fontFamily:{}},x=new Map;function se(t){var e,r,n,i,o;if((r=(e=t.theme)==null?void 0:e.extend)!=null&&r.colors?h.colors=T((n=t.theme)==null?void 0:n.extend.colors):h.colors={},(o=(i=t.theme)==null?void 0:i.extend)!=null&&o.fontFamily){let s={};for(let[a,f]of Object.entries(t.theme.extend.fontFamily))Array.isArray(f)?s[a]=f[0]:s[a]=f;h.fontFamily=s}else h.fontFamily={};x.clear()}function ae(){return h}function fe(){var t;return Object.keys((t=h.colors)!=null?t:{}).length>0?h.colors:void 0}function le(){x.clear()}function ce(){return{size:x.size,keys:Array.from(x.keys())}}function pt(t){let e=x.get(t);if(e)return e;if(!dt(t)){let f={style:W(t,h)};return x.set(t,f),f}let{base:r,modifiers:n}=ut(t),i=r.join(" "),s={style:i?W(i,h):{}};if(n.has("active")){let a=n.get("active");if(a&&a.length>0){let f=a.join(" ");s.activeStyle=W(f,h)}}if(n.has("focus")){let a=n.get("focus");if(a&&a.length>0){let f=a.join(" ");s.focusStyle=W(f,h)}}if(n.has("disabled")){let a=n.get("disabled");if(a&&a.length>0){let f=a.join(" ");s.disabledStyle=W(f,h)}}return x.set(t,s),s}function de(t,...e){let n=t.reduce((i,o,s)=>{let a=e[s],f=a!=null&&a!==!1?String(a):"";return i+o+f},"").trim().replace(/\s+/g," ");return n?pt(n):{style:{}}}function ue(t){let e=t.trim().replace(/\s+/g," ");if(e)return pt(e)}
|
|
2
2
|
//# sourceMappingURL=runtime.cjs.map
|