react-native-css 0.0.0-nightly.81d3fdb → 0.0.0-nightly.8a01f75
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/dist/commonjs/compiler/atRules.js +8 -8
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +51 -0
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/keyframes.js +1 -1
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/lightningcss-loader.js +12 -2
- package/dist/commonjs/compiler/lightningcss-loader.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +1 -1
- package/dist/commonjs/compiler/supports.js +3 -1
- package/dist/commonjs/compiler/supports.js.map +1 -1
- package/dist/commonjs/components/ActivityIndicator.js +6 -6
- package/dist/commonjs/components/ActivityIndicator.js.map +1 -1
- package/dist/commonjs/components/Button.js +6 -6
- package/dist/commonjs/components/Button.js.map +1 -1
- package/dist/commonjs/components/FlatList.js +6 -6
- package/dist/commonjs/components/FlatList.js.map +1 -1
- package/dist/commonjs/components/Image.js +6 -6
- package/dist/commonjs/components/Image.js.map +1 -1
- package/dist/commonjs/components/ImageBackground.js +6 -6
- package/dist/commonjs/components/ImageBackground.js.map +1 -1
- package/dist/commonjs/components/KeyboardAvoidingView.js +6 -6
- package/dist/commonjs/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/commonjs/components/Pressable.js +6 -6
- package/dist/commonjs/components/Pressable.js.map +1 -1
- package/dist/commonjs/components/ScrollView.js +6 -6
- package/dist/commonjs/components/ScrollView.js.map +1 -1
- package/dist/commonjs/components/Switch.js +6 -6
- package/dist/commonjs/components/Switch.js.map +1 -1
- package/dist/commonjs/components/Text.js +6 -6
- package/dist/commonjs/components/Text.js.map +1 -1
- package/dist/commonjs/components/TextInput.js +6 -6
- package/dist/commonjs/components/TextInput.js.map +1 -1
- package/dist/commonjs/components/TouchableHighlight.js +6 -6
- package/dist/commonjs/components/TouchableHighlight.js.map +1 -1
- package/dist/commonjs/components/TouchableOpacity.js +6 -6
- package/dist/commonjs/components/TouchableOpacity.js.map +1 -1
- package/dist/commonjs/components/TouchableWithoutFeedback.js +6 -6
- package/dist/commonjs/components/TouchableWithoutFeedback.js.map +1 -1
- package/dist/commonjs/components/View.js +6 -6
- package/dist/commonjs/components/View.js.map +1 -1
- package/dist/commonjs/components/VirtualizedList.js +6 -6
- package/dist/commonjs/components/VirtualizedList.js.map +1 -1
- package/dist/commonjs/components/copyComponentProperties.js +19 -0
- package/dist/commonjs/components/copyComponentProperties.js.map +1 -0
- package/dist/commonjs/components/index.cjs +265 -0
- package/dist/commonjs/components/index.cjs.map +1 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/jest/index.js +1 -1
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +8 -118
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +8 -1
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/{native/metro.js → metro/override.js} +1 -1
- package/dist/commonjs/{native/metro.js.map → metro/override.js.map} +1 -1
- package/dist/commonjs/metro/resolver.js +15 -22
- package/dist/commonjs/metro/resolver.js.map +1 -1
- package/dist/commonjs/native/api.js +5 -1
- package/dist/commonjs/native/api.js.map +1 -1
- package/dist/commonjs/native/index.js +8 -8
- package/dist/commonjs/native/index.js.map +1 -1
- package/dist/commonjs/native/react/useNativeCss.js +11 -5
- package/dist/commonjs/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/{poison.pill.js → native/react-native-css-metro-override.js} +1 -1
- package/dist/commonjs/native/react-native-css-metro-override.js.map +1 -0
- package/dist/commonjs/native/styles/functions/color-mix.js +50 -0
- package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -0
- package/dist/commonjs/native/styles/functions/index.js +11 -0
- package/dist/commonjs/native/styles/functions/index.js.map +1 -1
- package/dist/commonjs/native/styles/index.js +50 -7
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/commonjs/native/styles/resolve.js +0 -1
- package/dist/commonjs/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/animation.js +6 -2
- package/dist/commonjs/native/styles/shorthands/animation.js.map +1 -1
- package/dist/commonjs/web/api.js +5 -2
- package/dist/commonjs/web/api.js.map +1 -1
- package/dist/module/compiler/atRules.js +8 -8
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/declarations.js +50 -0
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/keyframes.js +1 -1
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/lightningcss-loader.js +12 -2
- package/dist/module/compiler/lightningcss-loader.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +1 -1
- package/dist/module/compiler/supports.js +3 -1
- package/dist/module/compiler/supports.js.map +1 -1
- package/dist/module/components/ActivityIndicator.js +4 -3
- package/dist/module/components/ActivityIndicator.js.map +1 -1
- package/dist/module/components/Button.js +4 -3
- package/dist/module/components/Button.js.map +1 -1
- package/dist/module/components/FlatList.js +4 -3
- package/dist/module/components/FlatList.js.map +1 -1
- package/dist/module/components/Image.js +4 -3
- package/dist/module/components/Image.js.map +1 -1
- package/dist/module/components/ImageBackground.js +4 -3
- package/dist/module/components/ImageBackground.js.map +1 -1
- package/dist/module/components/KeyboardAvoidingView.js +4 -3
- package/dist/module/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/module/components/Pressable.js +4 -3
- package/dist/module/components/Pressable.js.map +1 -1
- package/dist/module/components/ScrollView.js +4 -3
- package/dist/module/components/ScrollView.js.map +1 -1
- package/dist/module/components/Switch.js +4 -3
- package/dist/module/components/Switch.js.map +1 -1
- package/dist/module/components/Text.js +4 -3
- package/dist/module/components/Text.js.map +1 -1
- package/dist/module/components/TextInput.js +4 -3
- package/dist/module/components/TextInput.js.map +1 -1
- package/dist/module/components/TouchableHighlight.js +4 -3
- package/dist/module/components/TouchableHighlight.js.map +1 -1
- package/dist/module/components/TouchableOpacity.js +4 -3
- package/dist/module/components/TouchableOpacity.js.map +1 -1
- package/dist/module/components/TouchableWithoutFeedback.js +4 -3
- package/dist/module/components/TouchableWithoutFeedback.js.map +1 -1
- package/dist/module/components/View.js +4 -3
- package/dist/module/components/View.js.map +1 -1
- package/dist/module/components/VirtualizedList.js +4 -3
- package/dist/module/components/VirtualizedList.js.map +1 -1
- package/dist/module/components/copyComponentProperties.js +15 -0
- package/dist/module/components/copyComponentProperties.js.map +1 -0
- package/dist/module/components/index.cjs +265 -0
- package/dist/module/components/index.cjs.map +1 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/jest/index.js +1 -1
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +8 -117
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +8 -1
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/override.js +4 -0
- package/dist/module/{native/metro.js.map → metro/override.js.map} +1 -1
- package/dist/module/metro/resolver.js +15 -22
- package/dist/module/metro/resolver.js.map +1 -1
- package/dist/module/native/api.js +4 -1
- package/dist/module/native/api.js.map +1 -1
- package/dist/module/native/index.js +1 -1
- package/dist/module/native/index.js.map +1 -1
- package/dist/module/native/react/useNativeCss.js +11 -5
- package/dist/module/native/react/useNativeCss.js.map +1 -1
- package/dist/module/{poison.pill.js → native/react-native-css-metro-override.js} +1 -1
- package/dist/module/native/react-native-css-metro-override.js.map +1 -0
- package/dist/module/native/styles/functions/color-mix.js +45 -0
- package/dist/module/native/styles/functions/color-mix.js.map +1 -0
- package/dist/module/native/styles/functions/index.js +1 -0
- package/dist/module/native/styles/functions/index.js.map +1 -1
- package/dist/module/native/styles/index.js +50 -7
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/resolve.js +0 -1
- package/dist/module/native/styles/resolve.js.map +1 -1
- package/dist/module/native/styles/shorthands/animation.js +4 -1
- package/dist/module/native/styles/shorthands/animation.js.map +1 -1
- package/dist/module/web/api.js +5 -2
- package/dist/module/web/api.js.map +1 -1
- package/dist/typescript/commonjs/.config/eslint.config.d.mts +3 -0
- package/dist/typescript/commonjs/.config/eslint.config.d.mts.map +1 -0
- package/dist/typescript/commonjs/eslint.config.d.mts +2 -0
- package/dist/typescript/commonjs/eslint.config.d.mts.map +1 -0
- package/dist/typescript/commonjs/example/index.d.ts +2 -0
- package/dist/typescript/commonjs/example/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/example/metro.config.d.ts +3 -0
- package/dist/typescript/commonjs/example/metro.config.d.ts.map +1 -0
- package/dist/typescript/commonjs/example/postcss.config.d.mts +7 -0
- package/dist/typescript/commonjs/example/postcss.config.d.mts.map +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +2 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/Button.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/FlatList.d.ts +3 -3
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/Image.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/ImageBackground.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/Pressable.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/Pressable.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/ScrollView.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/ScrollView.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/Switch.d.ts +2 -6
- package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/Text.d.ts +2 -6
- package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/TouchableHighlight.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/TouchableHighlight.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/TouchableOpacity.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/TouchableOpacity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/TouchableWithoutFeedback.d.ts +2 -4
- package/dist/typescript/commonjs/src/components/TouchableWithoutFeedback.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts +2 -6
- package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/VirtualizedList.d.ts +3 -3
- package/dist/typescript/commonjs/src/components/VirtualizedList.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/copyComponentProperties.d.ts +5 -0
- package/dist/typescript/commonjs/src/components/copyComponentProperties.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/index.d.cts +2 -0
- package/dist/typescript/commonjs/src/components/index.d.cts.map +1 -0
- package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/override.d.ts +2 -0
- package/dist/typescript/commonjs/src/metro/override.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/api.d.ts +2 -2
- package/dist/typescript/commonjs/src/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/index.d.ts +1 -1
- package/dist/typescript/commonjs/src/native/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react-native-css-metro-override.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/react-native-css-metro-override.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts +3 -0
- package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/animation.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts +1 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/api.d.ts +2 -2
- package/dist/typescript/commonjs/src/web/api.d.ts.map +1 -1
- package/dist/typescript/module/.config/eslint.config.d.mts +3 -0
- package/dist/typescript/module/.config/eslint.config.d.mts.map +1 -0
- package/dist/typescript/module/eslint.config.d.mts +2 -0
- package/dist/typescript/module/eslint.config.d.mts.map +1 -0
- package/dist/typescript/module/example/index.d.ts +2 -0
- package/dist/typescript/module/example/index.d.ts.map +1 -0
- package/dist/typescript/module/example/metro.config.d.ts +3 -0
- package/dist/typescript/module/example/metro.config.d.ts.map +1 -0
- package/dist/typescript/module/example/postcss.config.d.mts +7 -0
- package/dist/typescript/module/example/postcss.config.d.mts.map +1 -0
- package/dist/typescript/module/example/src/App.d.ts +1 -0
- package/dist/typescript/module/example/src/App.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +2 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/keyframes.d.ts +1 -1
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +2 -4
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -1
- package/dist/typescript/module/src/components/Button.d.ts +2 -4
- package/dist/typescript/module/src/components/Button.d.ts.map +1 -1
- package/dist/typescript/module/src/components/FlatList.d.ts +3 -3
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/module/src/components/Image.d.ts +2 -4
- package/dist/typescript/module/src/components/Image.d.ts.map +1 -1
- package/dist/typescript/module/src/components/ImageBackground.d.ts +2 -4
- package/dist/typescript/module/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts +2 -4
- package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/module/src/components/Pressable.d.ts +2 -4
- package/dist/typescript/module/src/components/Pressable.d.ts.map +1 -1
- package/dist/typescript/module/src/components/ScrollView.d.ts +2 -4
- package/dist/typescript/module/src/components/ScrollView.d.ts.map +1 -1
- package/dist/typescript/module/src/components/Switch.d.ts +2 -6
- package/dist/typescript/module/src/components/Switch.d.ts.map +1 -1
- package/dist/typescript/module/src/components/Text.d.ts +2 -6
- package/dist/typescript/module/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/module/src/components/TextInput.d.ts +2 -4
- package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -1
- package/dist/typescript/module/src/components/TouchableHighlight.d.ts +2 -4
- package/dist/typescript/module/src/components/TouchableHighlight.d.ts.map +1 -1
- package/dist/typescript/module/src/components/TouchableOpacity.d.ts +2 -4
- package/dist/typescript/module/src/components/TouchableOpacity.d.ts.map +1 -1
- package/dist/typescript/module/src/components/TouchableWithoutFeedback.d.ts +2 -4
- package/dist/typescript/module/src/components/TouchableWithoutFeedback.d.ts.map +1 -1
- package/dist/typescript/module/src/components/View.d.ts +2 -6
- package/dist/typescript/module/src/components/View.d.ts.map +1 -1
- package/dist/typescript/module/src/components/VirtualizedList.d.ts +3 -3
- package/dist/typescript/module/src/components/VirtualizedList.d.ts.map +1 -1
- package/dist/typescript/module/src/components/copyComponentProperties.d.ts +5 -0
- package/dist/typescript/module/src/components/copyComponentProperties.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.cts +2 -0
- package/dist/typescript/module/src/components/index.d.cts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/override.d.ts +2 -0
- package/dist/typescript/module/src/metro/override.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/module/src/native/api.d.ts +2 -2
- package/dist/typescript/module/src/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/native/index.d.ts +1 -1
- package/dist/typescript/module/src/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react-native-css-metro-override.d.ts +2 -0
- package/dist/typescript/module/src/native/react-native-css-metro-override.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts +3 -0
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/functions/index.d.ts +1 -0
- package/dist/typescript/module/src/native/styles/functions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts +1 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/module/src/web/api.d.ts +2 -2
- package/dist/typescript/module/src/web/api.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/compiler/atRules.ts +8 -8
- package/src/compiler/declarations.ts +96 -0
- package/src/compiler/keyframes.ts +2 -2
- package/src/compiler/lightningcss-loader.ts +20 -1
- package/src/compiler/stylesheet.ts +1 -1
- package/src/compiler/supports.ts +2 -0
- package/src/components/ActivityIndicator.tsx +9 -6
- package/src/components/Button.tsx +9 -4
- package/src/components/FlatList.tsx +14 -5
- package/src/components/Image.tsx +9 -4
- package/src/components/ImageBackground.tsx +9 -6
- package/src/components/KeyboardAvoidingView.tsx +9 -6
- package/src/components/Pressable.tsx +9 -4
- package/src/components/ScrollView.tsx +9 -6
- package/src/components/Switch.tsx +9 -4
- package/src/components/Text.tsx +9 -4
- package/src/components/TextInput.tsx +9 -4
- package/src/components/TouchableHighlight.tsx +9 -6
- package/src/components/TouchableOpacity.tsx +9 -6
- package/src/components/TouchableWithoutFeedback.tsx +9 -6
- package/src/components/View.tsx +9 -4
- package/src/components/VirtualizedList.tsx +18 -6
- package/src/components/copyComponentProperties.ts +21 -0
- package/src/components/index.cts +263 -0
- package/src/components/{index.tsx → index.ts} +0 -1
- package/src/jest/index.ts +2 -1
- package/src/metro/index.ts +8 -166
- package/src/metro/metro-transformer.ts +15 -1
- package/src/metro/override.ts +1 -0
- package/src/metro/resolver.ts +29 -28
- package/src/native/api.tsx +6 -2
- package/src/native/index.ts +1 -2
- package/src/native/react/useNativeCss.ts +13 -6
- package/src/native/styles/functions/color-mix.ts +68 -0
- package/src/native/styles/functions/index.ts +1 -0
- package/src/native/styles/index.ts +72 -9
- package/src/native/styles/resolve.ts +0 -1
- package/src/native/styles/shorthands/animation.ts +10 -2
- package/src/utilities/dot-notation.types.ts +10 -3
- package/src/web/api.tsx +9 -4
- package/types.d.ts +3 -0
- package/dist/commonjs/poison.pill.js.map +0 -1
- package/dist/commonjs/runtime/native/injection.js +0 -2
- package/dist/commonjs/runtime/native/injection.js.map +0 -1
- package/dist/module/native/metro.js +0 -5
- package/dist/module/poison.pill.js.map +0 -1
- package/dist/module/runtime/native/injection.js +0 -2
- package/dist/module/runtime/native/injection.js.map +0 -1
- package/dist/typescript/commonjs/src/native/metro.d.ts +0 -2
- package/dist/typescript/commonjs/src/native/metro.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/poison.pill.d.ts +0 -2
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +0 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/module/src/native/metro.d.ts +0 -2
- package/dist/typescript/module/src/native/metro.d.ts.map +0 -1
- package/dist/typescript/module/src/poison.pill.d.ts +0 -2
- package/dist/typescript/module/src/poison.pill.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts +0 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +0 -1
- package/src/native/metro.ts +0 -2
- package/src/runtime/native/injection.ts +0 -0
- /package/src/{poison.pill.ts → native/react-native-css-metro-override.ts} +0 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
get ActivityIndicator() {
|
|
8
|
+
return require("./ActivityIndicator").ActivityIndicator;
|
|
9
|
+
},
|
|
10
|
+
get Button() {
|
|
11
|
+
return require("./Button").Button;
|
|
12
|
+
},
|
|
13
|
+
get FlatList() {
|
|
14
|
+
return require("./FlatList").FlatList;
|
|
15
|
+
},
|
|
16
|
+
get Image() {
|
|
17
|
+
return require("./Image").Image;
|
|
18
|
+
},
|
|
19
|
+
get ImageBackground() {
|
|
20
|
+
return require("./ImageBackground").ImageBackground;
|
|
21
|
+
},
|
|
22
|
+
get KeyboardAvoidingView() {
|
|
23
|
+
return require("./KeyboardAvoidingView").KeyboardAvoidingView;
|
|
24
|
+
},
|
|
25
|
+
get Pressable() {
|
|
26
|
+
return require("./Pressable").Pressable;
|
|
27
|
+
},
|
|
28
|
+
get ScrollView() {
|
|
29
|
+
return require("./ScrollView").ScrollView;
|
|
30
|
+
},
|
|
31
|
+
get Switch() {
|
|
32
|
+
return require("./Switch").Switch;
|
|
33
|
+
},
|
|
34
|
+
get Text() {
|
|
35
|
+
return require("./Text").Text;
|
|
36
|
+
},
|
|
37
|
+
get TextInput() {
|
|
38
|
+
return require("./TextInput").TextInput;
|
|
39
|
+
},
|
|
40
|
+
get TouchableHighlight() {
|
|
41
|
+
return require("./TouchableHighlight").TouchableHighlight;
|
|
42
|
+
},
|
|
43
|
+
get TouchableOpacity() {
|
|
44
|
+
return require("./TouchableOpacity").TouchableOpacity;
|
|
45
|
+
},
|
|
46
|
+
get View() {
|
|
47
|
+
return require("./View").View;
|
|
48
|
+
},
|
|
49
|
+
get VirtualizedList() {
|
|
50
|
+
return require("./VirtualizedList").VirtualizedList;
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* We need to return
|
|
55
|
+
*/
|
|
56
|
+
get DrawerLayoutAndroid() {
|
|
57
|
+
return require("react-native").DrawerLayoutAndroid;
|
|
58
|
+
},
|
|
59
|
+
get InputAccessoryView() {
|
|
60
|
+
return require("react-native").InputAccessoryView;
|
|
61
|
+
},
|
|
62
|
+
get experimental_LayoutConformance() {
|
|
63
|
+
return require("react-native").experimental_LayoutConformance;
|
|
64
|
+
},
|
|
65
|
+
get Modal() {
|
|
66
|
+
return require("react-native").Modal;
|
|
67
|
+
},
|
|
68
|
+
get ProgressBarAndroid() {
|
|
69
|
+
return require("react-native").ProgressBarAndroid;
|
|
70
|
+
},
|
|
71
|
+
get RefreshControl() {
|
|
72
|
+
return require("react-native").RefreshControl;
|
|
73
|
+
},
|
|
74
|
+
get SafeAreaView() {
|
|
75
|
+
return require("react-native").SafeAreaView;
|
|
76
|
+
},
|
|
77
|
+
get SectionList() {
|
|
78
|
+
return require("react-native").SectionList;
|
|
79
|
+
},
|
|
80
|
+
get StatusBar() {
|
|
81
|
+
return require("react-native").StatusBar;
|
|
82
|
+
},
|
|
83
|
+
get unstable_TextAncestorContext() {
|
|
84
|
+
return require("react-native").unstable_TextAncestorContext;
|
|
85
|
+
},
|
|
86
|
+
get Touchable() {
|
|
87
|
+
return require("react-native").Touchable;
|
|
88
|
+
},
|
|
89
|
+
get TouchableNativeFeedback() {
|
|
90
|
+
return require("react-native").TouchableNativeFeedback;
|
|
91
|
+
},
|
|
92
|
+
get TouchableWithoutFeedback() {
|
|
93
|
+
return require("react-native").TouchableWithoutFeedback;
|
|
94
|
+
},
|
|
95
|
+
get VirtualizedSectionList() {
|
|
96
|
+
return require("react-native").VirtualizedSectionList;
|
|
97
|
+
},
|
|
98
|
+
get unstable_VirtualView() {
|
|
99
|
+
return require("react-native").unstable_VirtualView;
|
|
100
|
+
},
|
|
101
|
+
get AccessibilityInfo() {
|
|
102
|
+
return require("react-native").AccessibilityInfo;
|
|
103
|
+
},
|
|
104
|
+
get ActionSheetIOS() {
|
|
105
|
+
return require("react-native").ActionSheetIOS;
|
|
106
|
+
},
|
|
107
|
+
get Alert() {
|
|
108
|
+
return require("react-native").Alert;
|
|
109
|
+
},
|
|
110
|
+
get Animated() {
|
|
111
|
+
return require("react-native").Animated;
|
|
112
|
+
},
|
|
113
|
+
get Appearance() {
|
|
114
|
+
return require("react-native").Appearance;
|
|
115
|
+
},
|
|
116
|
+
get AppRegistry() {
|
|
117
|
+
return require("react-native").AppRegistry;
|
|
118
|
+
},
|
|
119
|
+
get AppState() {
|
|
120
|
+
return require("react-native").AppState;
|
|
121
|
+
},
|
|
122
|
+
get BackHandler() {
|
|
123
|
+
return require("react-native").BackHandler;
|
|
124
|
+
},
|
|
125
|
+
get Clipboard() {
|
|
126
|
+
return require("react-native").Clipboard;
|
|
127
|
+
},
|
|
128
|
+
get codegenNativeCommands() {
|
|
129
|
+
return require("react-native").codegenNativeCommands;
|
|
130
|
+
},
|
|
131
|
+
get codegenNativeComponent() {
|
|
132
|
+
return require("react-native").codegenNativeComponent;
|
|
133
|
+
},
|
|
134
|
+
get DeviceEventEmitter() {
|
|
135
|
+
return require("react-native").DeviceEventEmitter;
|
|
136
|
+
},
|
|
137
|
+
get DeviceInfo() {
|
|
138
|
+
return require("react-native").DeviceInfo;
|
|
139
|
+
},
|
|
140
|
+
get DevMenu() {
|
|
141
|
+
return require("react-native").DevMenu;
|
|
142
|
+
},
|
|
143
|
+
get DevSettings() {
|
|
144
|
+
return require("react-native").DevSettings;
|
|
145
|
+
},
|
|
146
|
+
get Dimensions() {
|
|
147
|
+
return require("react-native").Dimensions;
|
|
148
|
+
},
|
|
149
|
+
get DynamicColorIOS() {
|
|
150
|
+
return require("react-native").DynamicColorIOS;
|
|
151
|
+
},
|
|
152
|
+
get Easing() {
|
|
153
|
+
return require("react-native").Easing;
|
|
154
|
+
},
|
|
155
|
+
get findNodeHandle() {
|
|
156
|
+
return require("react-native").findNodeHandle;
|
|
157
|
+
},
|
|
158
|
+
get I18nManager() {
|
|
159
|
+
return require("react-native").I18nManager;
|
|
160
|
+
},
|
|
161
|
+
get InteractionManager() {
|
|
162
|
+
return require("react-native").InteractionManager;
|
|
163
|
+
},
|
|
164
|
+
get Keyboard() {
|
|
165
|
+
return require("react-native").Keyboard;
|
|
166
|
+
},
|
|
167
|
+
get LayoutAnimation() {
|
|
168
|
+
return require("react-native").LayoutAnimation;
|
|
169
|
+
},
|
|
170
|
+
get Linking() {
|
|
171
|
+
return require("react-native").Linking;
|
|
172
|
+
},
|
|
173
|
+
get LogBox() {
|
|
174
|
+
return require("react-native").LogBox;
|
|
175
|
+
},
|
|
176
|
+
get NativeAppEventEmitter() {
|
|
177
|
+
return require("react-native").NativeAppEventEmitter;
|
|
178
|
+
},
|
|
179
|
+
get NativeDialogManagerAndroid() {
|
|
180
|
+
return require("react-native").NativeDialogManagerAndroid;
|
|
181
|
+
},
|
|
182
|
+
get NativeEventEmitter() {
|
|
183
|
+
return require("react-native").NativeEventEmitter;
|
|
184
|
+
},
|
|
185
|
+
get NativeModules() {
|
|
186
|
+
return require("react-native").NativeModules;
|
|
187
|
+
},
|
|
188
|
+
get Networking() {
|
|
189
|
+
return require("react-native").Networking;
|
|
190
|
+
},
|
|
191
|
+
get PanResponder() {
|
|
192
|
+
return require("react-native").PanResponder;
|
|
193
|
+
},
|
|
194
|
+
get PermissionsAndroid() {
|
|
195
|
+
return require("react-native").PermissionsAndroid;
|
|
196
|
+
},
|
|
197
|
+
get PixelRatio() {
|
|
198
|
+
return require("react-native").PixelRatio;
|
|
199
|
+
},
|
|
200
|
+
get Platform() {
|
|
201
|
+
return require("react-native").Platform;
|
|
202
|
+
},
|
|
203
|
+
get PlatformColor() {
|
|
204
|
+
return require("react-native").PlatformColor;
|
|
205
|
+
},
|
|
206
|
+
get PushNotificationIOS() {
|
|
207
|
+
return require("react-native").PushNotificationIOS;
|
|
208
|
+
},
|
|
209
|
+
get processColor() {
|
|
210
|
+
return require("react-native").processColor;
|
|
211
|
+
},
|
|
212
|
+
get registerCallableModule() {
|
|
213
|
+
return require("react-native").registerCallableModule;
|
|
214
|
+
},
|
|
215
|
+
get requireNativeComponent() {
|
|
216
|
+
return require("react-native").requireNativeComponent;
|
|
217
|
+
},
|
|
218
|
+
get RootTagContext() {
|
|
219
|
+
return require("react-native").RootTagContext;
|
|
220
|
+
},
|
|
221
|
+
get Settings() {
|
|
222
|
+
return require("react-native").Settings;
|
|
223
|
+
},
|
|
224
|
+
get Share() {
|
|
225
|
+
return require("react-native").Share;
|
|
226
|
+
},
|
|
227
|
+
get StyleSheet() {
|
|
228
|
+
return require("react-native").StyleSheet;
|
|
229
|
+
},
|
|
230
|
+
get Systrace() {
|
|
231
|
+
return require("react-native").Systrace;
|
|
232
|
+
},
|
|
233
|
+
get ToastAndroid() {
|
|
234
|
+
return require("react-native").ToastAndroid;
|
|
235
|
+
},
|
|
236
|
+
get TurboModuleRegistry() {
|
|
237
|
+
return require("react-native").TurboModuleRegistry;
|
|
238
|
+
},
|
|
239
|
+
get UIManager() {
|
|
240
|
+
return require("react-native").UIManager;
|
|
241
|
+
},
|
|
242
|
+
get unstable_batchedUpdates() {
|
|
243
|
+
return require("react-native").unstable_batchedUpdates;
|
|
244
|
+
},
|
|
245
|
+
get useAnimatedValue() {
|
|
246
|
+
return require("react-native").useAnimatedValue;
|
|
247
|
+
},
|
|
248
|
+
get useColorScheme() {
|
|
249
|
+
return require("react-native").useColorScheme;
|
|
250
|
+
},
|
|
251
|
+
get useWindowDimensions() {
|
|
252
|
+
return require("react-native").useWindowDimensions;
|
|
253
|
+
},
|
|
254
|
+
get UTFSequence() {
|
|
255
|
+
return require("react-native").UTFSequence;
|
|
256
|
+
},
|
|
257
|
+
get Vibration() {
|
|
258
|
+
return require("react-native").Vibration;
|
|
259
|
+
},
|
|
260
|
+
get VirtualViewMode() {
|
|
261
|
+
return require("react-native").VirtualViewMode;
|
|
262
|
+
},
|
|
263
|
+
};
|
package/src/jest/index.ts
CHANGED
|
@@ -27,7 +27,8 @@ beforeEach(() => {
|
|
|
27
27
|
|
|
28
28
|
const debugDefault = Boolean(
|
|
29
29
|
process.env.REACT_NATIVE_CSS_TEST_DEBUG &&
|
|
30
|
-
process.env.NODE_OPTIONS
|
|
30
|
+
typeof process.env.NODE_OPTIONS === "string" &&
|
|
31
|
+
process.env.NODE_OPTIONS.includes("--inspect"),
|
|
31
32
|
);
|
|
32
33
|
|
|
33
34
|
export function registerCSS(
|
package/src/metro/index.ts
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import { dirname, relative, sep } from "node:path";
|
|
3
2
|
import { versions } from "node:process";
|
|
4
3
|
|
|
5
|
-
import debug from "debug";
|
|
6
4
|
import type { MetroConfig } from "metro-config";
|
|
7
5
|
|
|
8
|
-
import {
|
|
9
|
-
compile,
|
|
10
|
-
type CompilerOptions,
|
|
11
|
-
type ReactNativeCssStyleSheet,
|
|
12
|
-
} from "../compiler";
|
|
13
|
-
import { getNativeInjectionCode, getWebInjectionCode } from "./injection-code";
|
|
6
|
+
import { type CompilerOptions } from "../compiler";
|
|
14
7
|
import { nativeResolver, webResolver } from "./resolver";
|
|
15
8
|
import { setupTypeScript } from "./typescript";
|
|
16
9
|
|
|
@@ -24,7 +17,10 @@ export interface WithReactNativeCSSOptions extends CompilerOptions {
|
|
|
24
17
|
hexColors?: boolean;
|
|
25
18
|
}
|
|
26
19
|
|
|
27
|
-
const
|
|
20
|
+
const metroOverrideResolution = {
|
|
21
|
+
type: "sourceFile",
|
|
22
|
+
filePath: require.resolve("./override"),
|
|
23
|
+
};
|
|
28
24
|
|
|
29
25
|
export function withReactNativeCSS<
|
|
30
26
|
T extends MetroConfig | (() => Promise<MetroConfig>),
|
|
@@ -43,18 +39,15 @@ export function withReactNativeCSS<
|
|
|
43
39
|
disableTypeScriptGeneration,
|
|
44
40
|
typescriptEnvPath,
|
|
45
41
|
globalClassNamePolyfill = false,
|
|
46
|
-
logger = defaultLogger,
|
|
47
42
|
} = options || {};
|
|
48
43
|
|
|
49
|
-
const loggerEnabled = "enabled" in logger ? logger.enabled : true;
|
|
50
|
-
|
|
51
44
|
if (disableTypeScriptGeneration !== true) {
|
|
52
45
|
setupTypeScript(typescriptEnvPath);
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
return {
|
|
56
49
|
...config,
|
|
57
|
-
|
|
50
|
+
transformerPath: require.resolve("./metro-transformer"),
|
|
58
51
|
transformer: {
|
|
59
52
|
...config.transformer,
|
|
60
53
|
reactNativeCSS: options,
|
|
@@ -63,8 +56,8 @@ export function withReactNativeCSS<
|
|
|
63
56
|
...config.resolver,
|
|
64
57
|
sourceExts: [...(config?.resolver?.sourceExts || []), "css"],
|
|
65
58
|
resolveRequest: (context, moduleName, platform) => {
|
|
66
|
-
if (moduleName.includes("
|
|
67
|
-
return
|
|
59
|
+
if (moduleName.includes("react-native-css-metro-override")) {
|
|
60
|
+
return metroOverrideResolution;
|
|
68
61
|
}
|
|
69
62
|
|
|
70
63
|
const parentResolver =
|
|
@@ -86,156 +79,5 @@ export function withReactNativeCSS<
|
|
|
86
79
|
return resolved;
|
|
87
80
|
},
|
|
88
81
|
},
|
|
89
|
-
server: {
|
|
90
|
-
...config.server,
|
|
91
|
-
enhanceMiddleware(metroMiddleware, metroServer) {
|
|
92
|
-
const bundler: any = metroServer.getBundler().getBundler();
|
|
93
|
-
|
|
94
|
-
if (!bundler.__react_native_css__patched) {
|
|
95
|
-
bundler.__react_native_css__patched = true;
|
|
96
|
-
|
|
97
|
-
const nativeCSSFiles = new Map<
|
|
98
|
-
string,
|
|
99
|
-
[string, ReactNativeCssStyleSheet]
|
|
100
|
-
>();
|
|
101
|
-
const webCSSFiles = new Set<string>();
|
|
102
|
-
|
|
103
|
-
const nativeInjectionPath = require.resolve("../native/metro");
|
|
104
|
-
const nativeInjectionFilepaths = [
|
|
105
|
-
// CommonJS
|
|
106
|
-
nativeInjectionPath,
|
|
107
|
-
// ES Module
|
|
108
|
-
nativeInjectionPath.replace(
|
|
109
|
-
`dist${sep}commonjs`,
|
|
110
|
-
`dist${sep}module`,
|
|
111
|
-
),
|
|
112
|
-
// TypeScript
|
|
113
|
-
nativeInjectionPath
|
|
114
|
-
.replace(`dist${sep}commonjs`, `src`)
|
|
115
|
-
.replace(".js", ".ts"),
|
|
116
|
-
];
|
|
117
|
-
|
|
118
|
-
const webInjectionPath = require.resolve("../web/metro");
|
|
119
|
-
const webInjectionFilepaths = [
|
|
120
|
-
// CommonJS
|
|
121
|
-
webInjectionPath,
|
|
122
|
-
// ES Module
|
|
123
|
-
webInjectionPath.replace(`dist${sep}commonjs`, `dist${sep}module`),
|
|
124
|
-
// TypeScript
|
|
125
|
-
webInjectionPath
|
|
126
|
-
.replace(`dist${sep}commonjs`, `src`)
|
|
127
|
-
.replace(".js", ".ts"),
|
|
128
|
-
];
|
|
129
|
-
|
|
130
|
-
// Keep the original
|
|
131
|
-
const transformFile = bundler.transformFile.bind(bundler);
|
|
132
|
-
|
|
133
|
-
const watcher = bundler.getWatcher();
|
|
134
|
-
|
|
135
|
-
// Patch with our functionality
|
|
136
|
-
bundler.transformFile = async function (
|
|
137
|
-
filePath: string,
|
|
138
|
-
transformOptions: any,
|
|
139
|
-
fileBuffer?: Buffer,
|
|
140
|
-
) {
|
|
141
|
-
const isCss = /\.(s?css|sass)$/.test(filePath);
|
|
142
|
-
|
|
143
|
-
if (transformOptions.platform === "web") {
|
|
144
|
-
if (isCss) {
|
|
145
|
-
webCSSFiles.add(filePath);
|
|
146
|
-
} else if (webInjectionFilepaths.includes(filePath)) {
|
|
147
|
-
fileBuffer = getWebInjectionCode(Array.from(webCSSFiles));
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return transformFile(filePath, transformOptions, fileBuffer);
|
|
151
|
-
} else {
|
|
152
|
-
// Handle CSS files on native platforms
|
|
153
|
-
if (isCss) {
|
|
154
|
-
const webTransform = await transformFile(
|
|
155
|
-
filePath,
|
|
156
|
-
{
|
|
157
|
-
...transformOptions,
|
|
158
|
-
// Force the platform to web for CSS files
|
|
159
|
-
platform: "web",
|
|
160
|
-
// Let the transformer know that we will handle compilation
|
|
161
|
-
customTransformOptions: {
|
|
162
|
-
...transformOptions.customTransformOptions,
|
|
163
|
-
reactNativeCSS: options,
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
fileBuffer,
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
const lastTransform = nativeCSSFiles.get(filePath);
|
|
170
|
-
const last = lastTransform?.[0];
|
|
171
|
-
const next = webTransform.output[0].data.css.code.toString();
|
|
172
|
-
|
|
173
|
-
// The CSS file has changed, we need to recompile the injection file
|
|
174
|
-
if (next !== last) {
|
|
175
|
-
nativeCSSFiles.set(filePath, [
|
|
176
|
-
next,
|
|
177
|
-
compile(next, {
|
|
178
|
-
hexColors: options?.hexColors,
|
|
179
|
-
}).stylesheet(),
|
|
180
|
-
]);
|
|
181
|
-
|
|
182
|
-
watcher.emit("change", {
|
|
183
|
-
eventsQueue: nativeInjectionFilepaths.map((filePath) => ({
|
|
184
|
-
filePath,
|
|
185
|
-
metadata: {
|
|
186
|
-
modifiedTime: Date.now(),
|
|
187
|
-
size: 1, // Can be anything
|
|
188
|
-
type: "virtual", // Can be anything
|
|
189
|
-
},
|
|
190
|
-
type: "change",
|
|
191
|
-
})),
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
const nativeTransform = await transformFile(
|
|
196
|
-
filePath,
|
|
197
|
-
transformOptions,
|
|
198
|
-
fileBuffer,
|
|
199
|
-
);
|
|
200
|
-
|
|
201
|
-
// Tell Expo to skip caching this file
|
|
202
|
-
nativeTransform.output[0].data.css = {
|
|
203
|
-
skipCache: true,
|
|
204
|
-
// Expo requires a `code` property
|
|
205
|
-
code: "",
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
return nativeTransform;
|
|
209
|
-
} else if (nativeInjectionFilepaths.includes(filePath)) {
|
|
210
|
-
// If this is the injection file, we to swap its content with the
|
|
211
|
-
// compiled CSS files
|
|
212
|
-
fileBuffer = getNativeInjectionCode(
|
|
213
|
-
Array.from(nativeCSSFiles.keys()).map((key) =>
|
|
214
|
-
relative(dirname(filePath), key),
|
|
215
|
-
),
|
|
216
|
-
Array.from(nativeCSSFiles.values()).map(([, value]) => value),
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
if (loggerEnabled && fileBuffer) {
|
|
220
|
-
logger(`Transformed ${filePath}`);
|
|
221
|
-
logger(fileBuffer?.toString());
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
return transformFile(filePath, transformOptions, fileBuffer);
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* We don't modify the middleware, we just use this function to get the metroServer
|
|
232
|
-
* So simply return the existing middleware
|
|
233
|
-
*/
|
|
234
|
-
return (
|
|
235
|
-
config.server?.enhanceMiddleware?.(metroMiddleware, metroServer) ??
|
|
236
|
-
metroMiddleware
|
|
237
|
-
);
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
82
|
};
|
|
241
83
|
}
|
|
@@ -44,5 +44,19 @@ export async function transform(
|
|
|
44
44
|
|
|
45
45
|
data = Buffer.from(getNativeInjectionCode([], [productionJS]));
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
const transform = await worker.transform(
|
|
48
|
+
config,
|
|
49
|
+
projectRoot,
|
|
50
|
+
`${filePath}.js`,
|
|
51
|
+
data,
|
|
52
|
+
options,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access
|
|
56
|
+
(transform as any).output[0].data.css = {
|
|
57
|
+
skipCache: true,
|
|
58
|
+
code: "",
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
return transform;
|
|
48
62
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/src/metro/resolver.ts
CHANGED
|
@@ -24,45 +24,39 @@ export function nativeResolver(
|
|
|
24
24
|
platform: string | null,
|
|
25
25
|
): Resolution {
|
|
26
26
|
const resolution = resolver(context, moduleName, platform);
|
|
27
|
+
const isInternal = isFromThisModule(context.originModulePath);
|
|
28
|
+
const isReactNativeIndex = context.originModulePath.endsWith(
|
|
29
|
+
`${sep}react-native${sep}index.js`,
|
|
30
|
+
);
|
|
27
31
|
|
|
28
|
-
if (
|
|
29
|
-
// Don't include our internal files
|
|
30
|
-
isFromThisModule(context.originModulePath) ||
|
|
31
|
-
// Only operate on source files
|
|
32
|
-
resolution.type !== "sourceFile" ||
|
|
33
|
-
// Skip the React Native barrel file to prevent infinite recursion
|
|
34
|
-
context.originModulePath.endsWith("react-native/index.js") ||
|
|
35
|
-
// Skip anything that isn't importing a React Native component
|
|
36
|
-
!(
|
|
37
|
-
moduleName.startsWith("react-native") ||
|
|
38
|
-
moduleName.startsWith("react-native/")
|
|
39
|
-
)
|
|
40
|
-
) {
|
|
32
|
+
if (isInternal || resolution.type !== "sourceFile" || isReactNativeIndex) {
|
|
41
33
|
return resolution;
|
|
42
34
|
}
|
|
43
35
|
|
|
44
36
|
if (moduleName === "react-native") {
|
|
45
37
|
return resolver(context, `react-native-css/components`, platform);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (moduleName === "react-native-safe-area-context") {
|
|
38
|
+
} else if (moduleName === "react-native-safe-area-context") {
|
|
49
39
|
return resolver(
|
|
50
40
|
context,
|
|
51
41
|
`react-native-css/components/react-native-safe-area-context`,
|
|
52
42
|
platform,
|
|
53
43
|
);
|
|
44
|
+
} else if (
|
|
45
|
+
resolution.filePath.includes(`${sep}react-native${sep}Libraries${sep}`)
|
|
46
|
+
) {
|
|
47
|
+
const filename = basename(resolution.filePath.split(sep).at(-1) ?? "");
|
|
48
|
+
const module = filename.split(".").at(0);
|
|
49
|
+
|
|
50
|
+
if (module && allowedModules.has(module)) {
|
|
51
|
+
return resolver(
|
|
52
|
+
context,
|
|
53
|
+
`react-native-css/components/${module}`,
|
|
54
|
+
platform,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
54
57
|
}
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
const segments = resolution.filePath.split(sep);
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
59
|
-
const module = basename(segments.at(-1)!).split(".")[0];
|
|
60
|
-
|
|
61
|
-
if (!module || !allowedModules.has(module)) {
|
|
62
|
-
return resolution;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return resolver(context, `react-native-css/components/${module}`, platform);
|
|
59
|
+
return resolution;
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
export function webResolver(
|
|
@@ -79,7 +73,9 @@ export function webResolver(
|
|
|
79
73
|
// Only operate on source files
|
|
80
74
|
resolution.type !== "sourceFile" ||
|
|
81
75
|
// Skip anything that isn't importing from `react-native-web`
|
|
82
|
-
!resolution.filePath.includes(`${sep}react-native-web${sep}`)
|
|
76
|
+
!resolution.filePath.includes(`${sep}react-native-web${sep}`) ||
|
|
77
|
+
// Skip internal react-native-web files
|
|
78
|
+
resolution.filePath.includes(`${sep}react-native-web${sep}dist${sep}vendor`)
|
|
83
79
|
) {
|
|
84
80
|
return resolution;
|
|
85
81
|
}
|
|
@@ -89,7 +85,12 @@ export function webResolver(
|
|
|
89
85
|
const isIndex = segments.at(-1)?.startsWith("index.");
|
|
90
86
|
const module = segments.at(-2);
|
|
91
87
|
|
|
92
|
-
if (
|
|
88
|
+
if (
|
|
89
|
+
!isIndex ||
|
|
90
|
+
!module ||
|
|
91
|
+
!allowedModules.has(module) ||
|
|
92
|
+
module === "VirtualizedList"
|
|
93
|
+
) {
|
|
93
94
|
return resolution;
|
|
94
95
|
}
|
|
95
96
|
|
package/src/native/api.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import { useContext, useState } from "react";
|
|
2
|
+
import { useContext, useState, type ComponentType } from "react";
|
|
3
3
|
import { Appearance } from "react-native";
|
|
4
4
|
|
|
5
5
|
import type { StyleDescriptor } from "react-native-css/compiler";
|
|
@@ -30,6 +30,10 @@ export {
|
|
|
30
30
|
|
|
31
31
|
export { useNativeCss };
|
|
32
32
|
|
|
33
|
+
const defaultMapping: StyledConfiguration<ComponentType<{ style: unknown }>> = {
|
|
34
|
+
className: "style",
|
|
35
|
+
};
|
|
36
|
+
|
|
33
37
|
/**
|
|
34
38
|
* Generates a new Higher-Order component the wraps the base component and applies the styles.
|
|
35
39
|
* This is added to the `interopComponents` map so that it can be used in the `wrapJSX` function
|
|
@@ -41,7 +45,7 @@ export const styled = <
|
|
|
41
45
|
const M extends StyledConfiguration<C>,
|
|
42
46
|
>(
|
|
43
47
|
baseComponent: C,
|
|
44
|
-
mapping: M,
|
|
48
|
+
mapping: M = defaultMapping as M,
|
|
45
49
|
options?: StyledOptions,
|
|
46
50
|
) => {
|
|
47
51
|
let component: any;
|
package/src/native/index.ts
CHANGED
|
@@ -172,29 +172,36 @@ export function useNativeCss(
|
|
|
172
172
|
export function mappingToConfig(mapping: StyledConfiguration<any>) {
|
|
173
173
|
return Object.entries(mapping).flatMap(([key, value]): Config => {
|
|
174
174
|
if (value === true) {
|
|
175
|
-
return {
|
|
175
|
+
return {
|
|
176
|
+
source: key,
|
|
177
|
+
target: key,
|
|
178
|
+
};
|
|
176
179
|
} else if (value === false) {
|
|
177
180
|
return { source: key, target: false };
|
|
178
181
|
} else if (typeof value === "string") {
|
|
179
182
|
return { source: key, target: value.split(".") };
|
|
180
183
|
} else if (typeof value === "object") {
|
|
184
|
+
const nativeStyleMapping = value.nativeStyleMapping as
|
|
185
|
+
| Record<string, string>
|
|
186
|
+
| undefined;
|
|
187
|
+
|
|
181
188
|
if (Array.isArray(value)) {
|
|
182
|
-
return { source: key, target: value };
|
|
189
|
+
return { source: key, target: value, nativeStyleMapping };
|
|
183
190
|
}
|
|
184
191
|
|
|
185
192
|
if ("target" in value) {
|
|
186
193
|
if (value.target === false) {
|
|
187
|
-
return { source: key, target: false };
|
|
194
|
+
return { source: key, target: false, nativeStyleMapping };
|
|
188
195
|
} else if (typeof value.target === "string") {
|
|
189
196
|
const target = value.target.split(".");
|
|
190
197
|
|
|
191
198
|
if (target.length === 1) {
|
|
192
|
-
return { source: key, target: target[0]
|
|
199
|
+
return { source: key, target: target[0]!, nativeStyleMapping };
|
|
193
200
|
} else {
|
|
194
|
-
return { source: key, target };
|
|
201
|
+
return { source: key, target, nativeStyleMapping };
|
|
195
202
|
}
|
|
196
203
|
} else if (Array.isArray(value.target)) {
|
|
197
|
-
return { source: key, target: value.target };
|
|
204
|
+
return { source: key, target: value.target, nativeStyleMapping };
|
|
198
205
|
}
|
|
199
206
|
}
|
|
200
207
|
}
|