react-native-css 0.0.0-nightly.d6f42ab → 0.0.0-nightly.eda2b28
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 +5 -5
- package/dist/commonjs/babel/import-plugin.js +9 -3
- package/dist/commonjs/babel/import-plugin.js.map +1 -1
- package/dist/commonjs/babel/react-native-web.js +16 -3
- package/dist/commonjs/babel/react-native-web.js.map +1 -1
- package/dist/commonjs/babel/react-native.js +7 -2
- package/dist/commonjs/babel/react-native.js.map +1 -1
- package/dist/commonjs/compiler/atRules.js +35 -0
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +92 -31
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/container-query.js +6 -1
- package/dist/commonjs/compiler/container-query.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +148 -56
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/lightningcss-loader.js +15 -2
- package/dist/commonjs/compiler/lightningcss-loader.js.map +1 -1
- package/dist/commonjs/compiler/media-query.js +16 -6
- package/dist/commonjs/compiler/media-query.js.map +1 -1
- package/dist/commonjs/compiler/selector-builder.js +13 -3
- package/dist/commonjs/compiler/selector-builder.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +5 -0
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +2 -2
- package/dist/commonjs/compiler/supports.js.map +1 -1
- package/dist/commonjs/components/FlatList.js +1 -0
- package/dist/commonjs/components/FlatList.js.map +1 -1
- package/dist/commonjs/components/ImageBackground.js +2 -6
- package/dist/commonjs/components/ImageBackground.js.map +1 -1
- package/dist/commonjs/components/KeyboardAvoidingView.js +2 -3
- package/dist/commonjs/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/commonjs/components/SafeAreaProvider.js +13 -0
- package/dist/commonjs/components/SafeAreaProvider.js.map +1 -0
- package/dist/commonjs/components/index.cjs +46 -1
- package/dist/commonjs/components/index.cjs.map +1 -1
- package/dist/commonjs/jest/index.js +1 -1
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/cache-version.js +43 -0
- package/dist/commonjs/metro/cache-version.js.map +1 -0
- package/dist/commonjs/metro/index.js +2 -0
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +1 -1
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/metro/typescript.js +26 -6
- package/dist/commonjs/metro/typescript.js.map +1 -1
- package/dist/commonjs/native/api.js +12 -8
- package/dist/commonjs/native/api.js.map +1 -1
- package/dist/commonjs/native/conditions/attributes.js +16 -9
- package/dist/commonjs/native/conditions/attributes.js.map +1 -1
- package/dist/commonjs/native/conditions/container-query.js +11 -11
- package/dist/commonjs/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/native/conditions/media-query.js +1 -1
- package/dist/commonjs/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/native/react/interaction.js +10 -5
- package/dist/commonjs/native/react/interaction.js.map +1 -1
- package/dist/commonjs/native/react/rules.js +12 -5
- package/dist/commonjs/native/react/rules.js.map +1 -1
- package/dist/commonjs/native/react/useNativeCss.js +70 -15
- package/dist/commonjs/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/native/react/usePassthrough.js +5 -2
- package/dist/commonjs/native/react/usePassthrough.js.map +1 -1
- package/dist/commonjs/native/reactivity.js +47 -23
- package/dist/commonjs/native/reactivity.js.map +1 -1
- package/dist/commonjs/native/reanimated.js +15 -3
- package/dist/commonjs/native/reanimated.js.map +1 -1
- package/dist/commonjs/native/styles/functions/color-mix.js +64 -0
- package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -0
- package/dist/commonjs/native/styles/functions/filters.js +18 -5
- package/dist/commonjs/native/styles/functions/filters.js.map +1 -1
- 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/functions/numeric-functions.js +4 -3
- package/dist/commonjs/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/string-functions.js +16 -1
- package/dist/commonjs/native/styles/functions/string-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/transform-functions.js +5 -4
- package/dist/commonjs/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/commonjs/native/styles/index.js +382 -28
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/commonjs/native/styles/resolve.js +10 -6
- package/dist/commonjs/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/native/styles/scale-factor.js +13 -0
- package/dist/commonjs/native/styles/scale-factor.js.map +1 -0
- package/dist/commonjs/native/styles/shorthands/_handler.js +10 -0
- package/dist/commonjs/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/animation.js +6 -3
- package/dist/commonjs/native/styles/shorthands/animation.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/box-shadow.js +45 -12
- package/dist/commonjs/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/index.js +11 -0
- package/dist/commonjs/native/styles/shorthands/index.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/logical-border-width.js +22 -0
- package/dist/commonjs/native/styles/shorthands/logical-border-width.js.map +1 -0
- package/dist/commonjs/native/styles/variables.js +55 -43
- package/dist/commonjs/native/styles/variables.js.map +1 -1
- package/dist/commonjs/native-internal/style-collection.js +1 -1
- package/dist/commonjs/native-internal/style-collection.js.map +1 -1
- package/dist/commonjs/utilities/dot-notation.types.js +4 -0
- package/dist/commonjs/utilities/style-descriptor.js +4 -9
- package/dist/commonjs/utilities/style-descriptor.js.map +1 -1
- package/dist/commonjs/web/api.js +2 -2
- package/dist/commonjs/web/api.js.map +1 -1
- package/dist/commonjs/web/assign-style.js +4 -1
- package/dist/commonjs/web/assign-style.js.map +1 -1
- package/dist/module/babel/import-plugin.js +11 -5
- package/dist/module/babel/import-plugin.js.map +1 -1
- package/dist/module/babel/react-native-web.js +16 -4
- package/dist/module/babel/react-native-web.js.map +1 -1
- package/dist/module/babel/react-native.js +7 -2
- package/dist/module/babel/react-native.js.map +1 -1
- package/dist/module/compiler/atRules.js +33 -0
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +94 -33
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/container-query.js +6 -1
- package/dist/module/compiler/container-query.js.map +1 -1
- package/dist/module/compiler/declarations.js +147 -56
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/lightningcss-loader.js +14 -2
- package/dist/module/compiler/lightningcss-loader.js.map +1 -1
- package/dist/module/compiler/media-query.js +16 -6
- package/dist/module/compiler/media-query.js.map +1 -1
- package/dist/module/compiler/selector-builder.js +13 -3
- package/dist/module/compiler/selector-builder.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +5 -0
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +2 -2
- package/dist/module/compiler/supports.js.map +1 -1
- package/dist/module/components/FlatList.js +1 -0
- package/dist/module/components/FlatList.js.map +1 -1
- package/dist/module/components/ImageBackground.js +2 -6
- package/dist/module/components/ImageBackground.js.map +1 -1
- package/dist/module/components/KeyboardAvoidingView.js +2 -3
- package/dist/module/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/module/components/SafeAreaProvider.js +4 -0
- package/dist/module/components/SafeAreaProvider.js.map +1 -0
- package/dist/module/components/index.cjs +46 -1
- package/dist/module/components/index.cjs.map +1 -1
- package/dist/module/jest/index.js +1 -1
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/cache-version.js +39 -0
- package/dist/module/metro/cache-version.js.map +1 -0
- package/dist/module/metro/index.js +2 -0
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +1 -1
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/typescript.js +26 -6
- package/dist/module/metro/typescript.js.map +1 -1
- package/dist/module/native/api.js +14 -10
- package/dist/module/native/api.js.map +1 -1
- package/dist/module/native/conditions/attributes.js +16 -9
- package/dist/module/native/conditions/attributes.js.map +1 -1
- package/dist/module/native/conditions/container-query.js +11 -11
- package/dist/module/native/conditions/container-query.js.map +1 -1
- package/dist/module/native/conditions/media-query.js +1 -1
- package/dist/module/native/conditions/media-query.js.map +1 -1
- package/dist/module/native/react/interaction.js +10 -5
- package/dist/module/native/react/interaction.js.map +1 -1
- package/dist/module/native/react/rules.js +13 -6
- package/dist/module/native/react/rules.js.map +1 -1
- package/dist/module/native/react/useNativeCss.js +73 -18
- package/dist/module/native/react/useNativeCss.js.map +1 -1
- package/dist/module/native/react/usePassthrough.js +5 -2
- package/dist/module/native/react/usePassthrough.js.map +1 -1
- package/dist/module/native/reactivity.js +44 -22
- package/dist/module/native/reactivity.js.map +1 -1
- package/dist/module/native/reanimated.js +15 -3
- package/dist/module/native/reanimated.js.map +1 -1
- package/dist/module/native/styles/functions/color-mix.js +59 -0
- package/dist/module/native/styles/functions/color-mix.js.map +1 -0
- package/dist/module/native/styles/functions/filters.js +16 -4
- package/dist/module/native/styles/functions/filters.js.map +1 -1
- 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/functions/numeric-functions.js +4 -3
- package/dist/module/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/module/native/styles/functions/string-functions.js +13 -0
- package/dist/module/native/styles/functions/string-functions.js.map +1 -1
- package/dist/module/native/styles/functions/transform-functions.js +5 -4
- package/dist/module/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/module/native/styles/index.js +383 -28
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/resolve.js +10 -6
- package/dist/module/native/styles/resolve.js.map +1 -1
- package/dist/module/native/styles/scale-factor.js +9 -0
- package/dist/module/native/styles/scale-factor.js.map +1 -0
- package/dist/module/native/styles/shorthands/_handler.js +11 -1
- package/dist/module/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/module/native/styles/shorthands/animation.js +6 -3
- package/dist/module/native/styles/shorthands/animation.js.map +1 -1
- package/dist/module/native/styles/shorthands/box-shadow.js +46 -12
- package/dist/module/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/module/native/styles/shorthands/index.js +1 -0
- package/dist/module/native/styles/shorthands/index.js.map +1 -1
- package/dist/module/native/styles/shorthands/logical-border-width.js +18 -0
- package/dist/module/native/styles/shorthands/logical-border-width.js.map +1 -0
- package/dist/module/native/styles/variables.js +55 -43
- package/dist/module/native/styles/variables.js.map +1 -1
- package/dist/module/native-internal/style-collection.js +1 -1
- package/dist/module/native-internal/style-collection.js.map +1 -1
- package/dist/module/utilities/dot-notation.types.js +2 -0
- package/dist/module/utilities/style-descriptor.js +4 -9
- package/dist/module/utilities/style-descriptor.js.map +1 -1
- package/dist/module/web/api.js +2 -2
- package/dist/module/web/api.js.map +1 -1
- package/dist/module/web/assign-style.js +4 -1
- package/dist/module/web/assign-style.js.map +1 -1
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +2 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts +4 -1
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +1 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/cache-version.d.ts +8 -0
- package/dist/typescript/commonjs/src/metro/cache-version.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +5 -3
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/api.d.ts +4 -8
- package/dist/typescript/commonjs/src/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/interaction.d.ts +1 -1
- package/dist/typescript/commonjs/src/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/usePassthrough.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/reactivity.d.ts +13 -3
- package/dist/typescript/commonjs/src/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/reanimated.d.ts.map +1 -1
- 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/filters.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/functions/filters.d.ts.map +1 -1
- 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/functions/numeric-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/transform-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/native-internal/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime.types.d.ts +11 -6
- package/dist/typescript/commonjs/src/runtime.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts +2 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts +1 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/api.d.ts +5 -5
- package/dist/typescript/commonjs/src/web/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/assign-style.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts +2 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/atRules.d.ts +6 -3
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +2 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +5 -4
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/index.d.ts +2 -2
- package/dist/typescript/module/src/compiler/index.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/inline-variables.d.ts +1 -1
- package/dist/typescript/module/src/compiler/inline-variables.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/keyframes.d.ts +2 -2
- 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/compiler/media-query.d.ts +3 -3
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selectors.d.ts +2 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +2 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/module/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/module/src/components/SafeAreaProvider.d.ts +2 -0
- package/dist/typescript/module/src/components/SafeAreaProvider.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +16 -16
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/cache-version.d.ts +8 -0
- package/dist/typescript/module/src/metro/cache-version.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/index.d.ts +1 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +6 -4
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -1
- package/dist/typescript/module/src/native/api.d.ts +5 -9
- package/dist/typescript/module/src/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/attributes.d.ts +1 -1
- package/dist/typescript/module/src/native/conditions/attributes.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/container-query.d.ts +2 -2
- package/dist/typescript/module/src/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/index.d.ts +3 -3
- package/dist/typescript/module/src/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/media-query.d.ts +1 -1
- package/dist/typescript/module/src/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/native/index.d.ts +3 -3
- package/dist/typescript/module/src/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/rules.d.ts +2 -2
- package/dist/typescript/module/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts +4 -4
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/usePassthrough.d.ts +1 -1
- package/dist/typescript/module/src/native/react/usePassthrough.d.ts.map +1 -1
- package/dist/typescript/module/src/native/reactivity.d.ts +13 -3
- package/dist/typescript/module/src/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/native/reanimated.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/calculate-props.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/calc.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/calc.d.ts.map +1 -1
- 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/filters.d.ts +3 -1
- package/dist/typescript/module/src/native/styles/functions/filters.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/index.d.ts +8 -7
- package/dist/typescript/module/src/native/styles/functions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts +3 -1
- package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/index.d.ts +7 -7
- package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/line-height.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/line-height.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/resolve.d.ts +4 -3
- package/dist/typescript/module/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/scale-factor.d.ts +2 -0
- package/dist/typescript/module/src/native/styles/scale-factor.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/border.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/border.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/index.d.ts +6 -5
- package/dist/typescript/module/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/units.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/variables.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/index.d.ts +3 -3
- package/dist/typescript/module/src/native-internal/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/root.d.ts +1 -1
- package/dist/typescript/module/src/native-internal/root.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/style-collection.d.ts +2 -2
- package/dist/typescript/module/src/native-internal/style-collection.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/variables.d.ts +2 -2
- package/dist/typescript/module/src/native-internal/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.d.ts +1 -1
- package/dist/typescript/module/src/runtime.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.native.d.ts +1 -1
- package/dist/typescript/module/src/runtime.native.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.types.d.ts +11 -6
- package/dist/typescript/module/src/runtime.types.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts +2 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/index.d.ts +3 -3
- package/dist/typescript/module/src/utilities/index.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/specificity.d.ts +2 -2
- package/dist/typescript/module/src/utilities/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/style-descriptor.d.ts +1 -1
- package/dist/typescript/module/src/utilities/style-descriptor.d.ts.map +1 -1
- package/dist/typescript/module/src/web/api.d.ts +5 -5
- package/dist/typescript/module/src/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/web/assign-style.d.ts.map +1 -1
- package/dist/typescript/module/src/web/index.d.ts +3 -3
- package/dist/typescript/module/src/web/index.d.ts.map +1 -1
- package/node/babel.mjs +4 -0
- package/node/compiler.mjs +2 -0
- package/node/metro.mjs +2 -0
- package/package.json +78 -29
- package/src/babel/import-plugin.ts +15 -4
- package/src/babel/react-native-web.ts +32 -3
- package/src/babel/react-native.ts +7 -1
- package/src/compiler/atRules.ts +44 -0
- package/src/compiler/compiler.ts +140 -42
- package/src/compiler/container-query.ts +8 -3
- package/src/compiler/declarations.ts +279 -94
- package/src/compiler/lightningcss-loader.ts +21 -1
- package/src/compiler/media-query.ts +20 -9
- package/src/compiler/selector-builder.ts +29 -3
- package/src/compiler/stylesheet.ts +6 -0
- package/src/compiler/supports.ts +2 -2
- package/src/components/FlatList.tsx +1 -0
- package/src/components/ImageBackground.tsx +2 -6
- package/src/components/KeyboardAvoidingView.tsx +2 -3
- package/src/components/SafeAreaProvider.tsx +1 -0
- package/src/components/index.cts +46 -1
- package/src/jest/index.ts +1 -1
- package/src/metro/cache-version.ts +48 -0
- package/src/metro/index.ts +2 -0
- package/src/metro/metro-transformer.ts +9 -6
- package/src/metro/typescript.ts +53 -6
- package/src/native/api.tsx +20 -14
- package/src/native/conditions/attributes.ts +26 -9
- package/src/native/conditions/container-query.ts +11 -9
- package/src/native/conditions/media-query.ts +1 -1
- package/src/native/react/interaction.ts +11 -6
- package/src/native/react/rules.ts +13 -5
- package/src/native/react/useNativeCss.ts +79 -17
- package/src/native/react/usePassthrough.ts +3 -2
- package/src/native/reactivity.ts +61 -24
- package/src/native/reanimated.ts +24 -5
- package/src/native/styles/functions/color-mix.ts +74 -0
- package/src/native/styles/functions/filters.ts +20 -6
- package/src/native/styles/functions/index.ts +1 -0
- package/src/native/styles/functions/numeric-functions.ts +7 -6
- package/src/native/styles/functions/string-functions.ts +18 -0
- package/src/native/styles/functions/transform-functions.ts +5 -4
- package/src/native/styles/index.ts +443 -36
- package/src/native/styles/resolve.ts +15 -11
- package/src/native/styles/scale-factor.ts +6 -0
- package/src/native/styles/shorthands/_handler.ts +14 -1
- package/src/native/styles/shorthands/animation.ts +8 -2
- package/src/native/styles/shorthands/box-shadow.ts +50 -15
- package/src/native/styles/shorthands/index.ts +1 -0
- package/src/native/styles/shorthands/logical-border-width.ts +32 -0
- package/src/native/styles/variables.ts +48 -38
- package/src/native-internal/style-collection.ts +1 -1
- package/src/runtime.types.ts +17 -15
- package/src/utilities/dot-notation.types.ts +4 -3
- package/src/utilities/style-descriptor.ts +11 -16
- package/src/web/api.tsx +7 -12
- package/src/web/assign-style.ts +2 -1
- package/types.d.ts +3 -20
- package/dist/commonjs/compiler/inheritance.test.js +0 -78
- package/dist/commonjs/compiler/inheritance.test.js.map +0 -1
- package/dist/module/compiler/inheritance.test.js +0 -78
- package/dist/module/compiler/inheritance.test.js.map +0 -1
- package/dist/typescript/commonjs/.config/eslint.config.d.mts +0 -3
- package/dist/typescript/commonjs/.config/eslint.config.d.mts.map +0 -1
- package/dist/typescript/commonjs/eslint.config.d.mts +0 -2
- package/dist/typescript/commonjs/eslint.config.d.mts.map +0 -1
- package/dist/typescript/commonjs/example/app.config.d.ts +0 -4
- package/dist/typescript/commonjs/example/app.config.d.ts.map +0 -1
- package/dist/typescript/commonjs/example/index.d.ts +0 -2
- package/dist/typescript/commonjs/example/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/example/metro.config.d.ts +0 -3
- package/dist/typescript/commonjs/example/metro.config.d.ts.map +0 -1
- package/dist/typescript/commonjs/example/postcss.config.d.mts +0 -7
- package/dist/typescript/commonjs/example/postcss.config.d.mts.map +0 -1
- package/dist/typescript/commonjs/example/src/App.d.ts +0 -3
- package/dist/typescript/commonjs/example/src/App.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +0 -2
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +0 -1
- package/dist/typescript/module/.config/eslint.config.d.mts +0 -3
- package/dist/typescript/module/.config/eslint.config.d.mts.map +0 -1
- package/dist/typescript/module/eslint.config.d.mts +0 -2
- package/dist/typescript/module/eslint.config.d.mts.map +0 -1
- package/dist/typescript/module/example/app.config.d.ts +0 -4
- package/dist/typescript/module/example/app.config.d.ts.map +0 -1
- package/dist/typescript/module/example/index.d.ts +0 -2
- package/dist/typescript/module/example/index.d.ts.map +0 -1
- package/dist/typescript/module/example/metro.config.d.ts +0 -3
- package/dist/typescript/module/example/metro.config.d.ts.map +0 -1
- package/dist/typescript/module/example/postcss.config.d.mts +0 -7
- package/dist/typescript/module/example/postcss.config.d.mts.map +0 -1
- package/dist/typescript/module/example/src/App.d.ts +0 -3
- package/dist/typescript/module/example/src/App.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts +0 -2
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +0 -1
- package/src/compiler/inheritance.test.ts +0 -121
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolve } from "path";
|
|
1
|
+
import { basename, dirname, resolve, sep } from "path";
|
|
2
2
|
|
|
3
3
|
import { type PluginObj } from "@babel/core";
|
|
4
4
|
import type { Statement } from "@babel/types";
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
handleReactNativeWebIdentifierRequire,
|
|
18
18
|
handleReactNativeWebImport,
|
|
19
|
+
handleReactNativeWebInteropRequireDefault,
|
|
19
20
|
handleReactNativeWebObjectPatternRequire,
|
|
20
21
|
} from "./react-native-web";
|
|
21
22
|
|
|
@@ -26,8 +27,12 @@ export default function ({
|
|
|
26
27
|
}): PluginObj<PluginState> {
|
|
27
28
|
const processed = new WeakSet();
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
-
|
|
30
|
+
const packageRoot = resolve(
|
|
31
|
+
__dirname,
|
|
32
|
+
basename(dirname(__dirname)) === "src" ? "../.." : "../../..",
|
|
33
|
+
);
|
|
34
|
+
const thisModuleDist = resolve(packageRoot, "dist") + sep;
|
|
35
|
+
const thisModuleSrc = resolve(packageRoot, "src") + sep;
|
|
31
36
|
|
|
32
37
|
function isFromThisModule(filename: string): boolean {
|
|
33
38
|
return (
|
|
@@ -94,6 +99,11 @@ export default function ({
|
|
|
94
99
|
return;
|
|
95
100
|
}
|
|
96
101
|
|
|
102
|
+
// A local function called require is not the module loader.
|
|
103
|
+
if (path.scope.getBinding("require")) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
97
107
|
const initArg = init.arguments.at(0);
|
|
98
108
|
|
|
99
109
|
if (!initArg) {
|
|
@@ -152,10 +162,11 @@ export default function ({
|
|
|
152
162
|
if (!source) {
|
|
153
163
|
return;
|
|
154
164
|
}
|
|
155
|
-
statements =
|
|
165
|
+
statements = handleReactNativeWebInteropRequireDefault(
|
|
156
166
|
path,
|
|
157
167
|
t,
|
|
158
168
|
id.name,
|
|
169
|
+
init,
|
|
159
170
|
source,
|
|
160
171
|
state.filename,
|
|
161
172
|
);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { resolve } from "path";
|
|
1
|
+
import { dirname, resolve } from "path";
|
|
2
2
|
|
|
3
3
|
import { type NodePath } from "@babel/traverse";
|
|
4
4
|
import tBabelTypes, {
|
|
5
|
+
type CallExpression,
|
|
5
6
|
type ImportDeclaration,
|
|
6
7
|
type ObjectPattern,
|
|
7
8
|
type Statement,
|
|
@@ -14,7 +15,7 @@ type BabelTypes = typeof tBabelTypes;
|
|
|
14
15
|
|
|
15
16
|
function parseReactNativeWebSource(source: string, filename: string) {
|
|
16
17
|
if (source.startsWith(".")) {
|
|
17
|
-
source = resolve(filename, source);
|
|
18
|
+
source = resolve(dirname(filename), source);
|
|
18
19
|
|
|
19
20
|
const internalPath = source.split("react-native-web/dist")[1];
|
|
20
21
|
if (!internalPath) {
|
|
@@ -48,6 +49,7 @@ export function handleReactNativeWebImport(
|
|
|
48
49
|
filename: string,
|
|
49
50
|
): Statement[] | undefined {
|
|
50
51
|
const { specifiers, source } = declaration;
|
|
52
|
+
if (declaration.importKind && declaration.importKind !== "value") return;
|
|
51
53
|
|
|
52
54
|
const rnwSource = parseReactNativeWebSource(source.value, filename);
|
|
53
55
|
if (!rnwSource) {
|
|
@@ -76,7 +78,7 @@ export function handleReactNativeWebImport(
|
|
|
76
78
|
} else {
|
|
77
79
|
statements.push(
|
|
78
80
|
t.importDeclaration(
|
|
79
|
-
[t.importSpecifier(specifier.local,
|
|
81
|
+
[t.importSpecifier(specifier.local, t.identifier(name))],
|
|
80
82
|
t.stringLiteral(`react-native-css/components/${name}`),
|
|
81
83
|
),
|
|
82
84
|
);
|
|
@@ -89,6 +91,10 @@ export function handleReactNativeWebImport(
|
|
|
89
91
|
),
|
|
90
92
|
);
|
|
91
93
|
} else {
|
|
94
|
+
if (specifier.importKind && specifier.importKind !== "value") {
|
|
95
|
+
statements.push(t.importDeclaration([specifier], source));
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
92
98
|
const localName = t.isStringLiteral(specifier.imported)
|
|
93
99
|
? specifier.imported.value
|
|
94
100
|
: specifier.imported.name;
|
|
@@ -158,6 +164,28 @@ export function handleReactNativeWebIdentifierRequire(
|
|
|
158
164
|
}
|
|
159
165
|
}
|
|
160
166
|
|
|
167
|
+
export function handleReactNativeWebInteropRequireDefault(
|
|
168
|
+
path: NodePath<VariableDeclaration>,
|
|
169
|
+
t: BabelTypes,
|
|
170
|
+
id: string,
|
|
171
|
+
init: CallExpression,
|
|
172
|
+
source: string,
|
|
173
|
+
filename: string,
|
|
174
|
+
) {
|
|
175
|
+
const parsed = parseReactNativeWebSource(source, filename);
|
|
176
|
+
if (!parsed) return;
|
|
177
|
+
|
|
178
|
+
const wrapped = t.cloneNode(init);
|
|
179
|
+
wrapped.arguments = [
|
|
180
|
+
t.callExpression(t.identifier("require"), [t.stringLiteral(parsed.source)]),
|
|
181
|
+
];
|
|
182
|
+
return [
|
|
183
|
+
t.variableDeclaration(path.node.kind, [
|
|
184
|
+
t.variableDeclarator(t.identifier(id), wrapped),
|
|
185
|
+
]),
|
|
186
|
+
];
|
|
187
|
+
}
|
|
188
|
+
|
|
161
189
|
export function handleReactNativeWebObjectPatternRequire(
|
|
162
190
|
path: NodePath<VariableDeclaration>,
|
|
163
191
|
t: BabelTypes,
|
|
@@ -180,6 +208,7 @@ export function handleReactNativeWebObjectPatternRequire(
|
|
|
180
208
|
// We need to exit as we do not handle `const { Text, ...rest } = require('react-native-web');`
|
|
181
209
|
return;
|
|
182
210
|
} else if (
|
|
211
|
+
identifier.computed ||
|
|
183
212
|
!(t.isIdentifier(identifier.value) && t.isIdentifier(identifier.key))
|
|
184
213
|
) {
|
|
185
214
|
// Bail out on anything that isn't `const { <key>: <identifier> } = require('react-native-web');`
|
|
@@ -48,6 +48,7 @@ export function handleReactNativeImport(
|
|
|
48
48
|
filename: string,
|
|
49
49
|
): Statement[] | undefined {
|
|
50
50
|
const { specifiers, source } = declaration;
|
|
51
|
+
if (declaration.importKind && declaration.importKind !== "value") return;
|
|
51
52
|
|
|
52
53
|
const rnwSource = parseReactNativeSource(source.value, filename);
|
|
53
54
|
if (!rnwSource) {
|
|
@@ -76,7 +77,7 @@ export function handleReactNativeImport(
|
|
|
76
77
|
} else {
|
|
77
78
|
statements.push(
|
|
78
79
|
t.importDeclaration(
|
|
79
|
-
[t.importSpecifier(specifier.local,
|
|
80
|
+
[t.importSpecifier(specifier.local, t.identifier(name))],
|
|
80
81
|
t.stringLiteral(`react-native-css/components/${name}`),
|
|
81
82
|
),
|
|
82
83
|
);
|
|
@@ -89,6 +90,10 @@ export function handleReactNativeImport(
|
|
|
89
90
|
),
|
|
90
91
|
);
|
|
91
92
|
} else {
|
|
93
|
+
if (specifier.importKind && specifier.importKind !== "value") {
|
|
94
|
+
statements.push(t.importDeclaration([specifier], source));
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
92
97
|
const localName = t.isStringLiteral(specifier.imported)
|
|
93
98
|
? specifier.imported.value
|
|
94
99
|
: specifier.imported.name;
|
|
@@ -180,6 +185,7 @@ export function handleReactNativeObjectPatternRequire(
|
|
|
180
185
|
// We need to exit as we do not handle `const { Text, ...rest } = require('react-native');`
|
|
181
186
|
return;
|
|
182
187
|
} else if (
|
|
188
|
+
identifier.computed ||
|
|
183
189
|
!(t.isIdentifier(identifier.value) && t.isIdentifier(identifier.key))
|
|
184
190
|
) {
|
|
185
191
|
// Bail out on anything that isn't `const { <key>: <identifier> } = require('react-native');`
|
package/src/compiler/atRules.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
Declaration,
|
|
2
3
|
DeclarationBlock,
|
|
3
4
|
ParsedComponent,
|
|
4
5
|
Rule,
|
|
@@ -99,6 +100,49 @@ export function parsePropAtRule(rules?: (Rule | PropAtRule)[]) {
|
|
|
99
100
|
return mapping;
|
|
100
101
|
}
|
|
101
102
|
|
|
103
|
+
const mappingProperty = "-rn-native-mapping";
|
|
104
|
+
|
|
105
|
+
export function isMappingProperty(name: string) {
|
|
106
|
+
return name === mappingProperty || name.startsWith(`${mappingProperty}-`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** Declaration metadata survives the optimizer flattening nested at rules. */
|
|
110
|
+
export function parsePropDeclarations(declarations: Declaration[] = []) {
|
|
111
|
+
const mapping: StyleRuleMapping = {};
|
|
112
|
+
for (const declaration of declarations) {
|
|
113
|
+
if (
|
|
114
|
+
declaration.property !== "custom" ||
|
|
115
|
+
!isMappingProperty(declaration.value.name)
|
|
116
|
+
) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const { name, value } = declaration.value;
|
|
120
|
+
const target = value.filter(
|
|
121
|
+
(item): item is Extract<TokenOrValue, { type: "token" }> =>
|
|
122
|
+
item.type === "token" && item.value.type !== "white-space",
|
|
123
|
+
);
|
|
124
|
+
if (target.length === 0) continue;
|
|
125
|
+
nativeMappingAtRuleBlock(
|
|
126
|
+
[
|
|
127
|
+
{
|
|
128
|
+
type: "token",
|
|
129
|
+
value: {
|
|
130
|
+
type: "ident",
|
|
131
|
+
value:
|
|
132
|
+
name === mappingProperty
|
|
133
|
+
? "*"
|
|
134
|
+
: name.slice(mappingProperty.length + 1),
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{ type: "token", value: { type: "colon" } },
|
|
138
|
+
...target,
|
|
139
|
+
],
|
|
140
|
+
mapping,
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
return mapping;
|
|
144
|
+
}
|
|
145
|
+
|
|
102
146
|
function nativeMappingAtRuleBlock(
|
|
103
147
|
token: Extract<TokenOrValue, { type: "token" }>[],
|
|
104
148
|
mapping: StyleRuleMapping = {},
|
package/src/compiler/compiler.ts
CHANGED
|
@@ -4,22 +4,35 @@ import { inspect } from "node:util";
|
|
|
4
4
|
import { debug } from "debug";
|
|
5
5
|
import {
|
|
6
6
|
type ContainerRule,
|
|
7
|
-
type MediaQuery as CSSMediaQuery,
|
|
8
7
|
type CustomAtRules,
|
|
9
8
|
type MediaRule,
|
|
9
|
+
type ParsedComponent,
|
|
10
|
+
type PropertyRule,
|
|
10
11
|
type Rule,
|
|
11
12
|
type Visitor,
|
|
12
13
|
} from "lightningcss";
|
|
13
14
|
|
|
14
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
maybeMutateReactNativeOptions,
|
|
17
|
+
parsePropAtRule,
|
|
18
|
+
parsePropDeclarations,
|
|
19
|
+
} from "./atRules";
|
|
15
20
|
import type {
|
|
16
21
|
CompilerOptions,
|
|
17
22
|
ContainerQuery,
|
|
23
|
+
StyleDescriptor,
|
|
18
24
|
StyleRuleMapping,
|
|
19
25
|
UniqueVarInfo,
|
|
20
26
|
} from "./compiler.types";
|
|
21
27
|
import { parseContainerCondition } from "./container-query";
|
|
22
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
parseAngle,
|
|
30
|
+
parseColor,
|
|
31
|
+
parseDeclaration,
|
|
32
|
+
parseLength,
|
|
33
|
+
reduceParseUnparsed,
|
|
34
|
+
round,
|
|
35
|
+
} from "./declarations";
|
|
23
36
|
import { inlineVariables } from "./inline-variables";
|
|
24
37
|
import { extractKeyFrames } from "./keyframes";
|
|
25
38
|
import { lightningcssLoader } from "./lightningcss-loader";
|
|
@@ -74,17 +87,60 @@ export function compile(code: Buffer | string, options: CompilerOptions = {}) {
|
|
|
74
87
|
|
|
75
88
|
const vars = new Map<string, UniqueVarInfo>();
|
|
76
89
|
|
|
77
|
-
|
|
90
|
+
// Determine the effective rem multiplier for compile-time inlining.
|
|
91
|
+
// If inlineRem is explicitly set, use that. Otherwise, scan for
|
|
92
|
+
// :root { font-size: Npx } in the CSS to allow CSS-based configuration.
|
|
93
|
+
let effectiveRem: number | false = options.inlineRem ?? undefined!;
|
|
94
|
+
if (effectiveRem === undefined) {
|
|
95
|
+
const css = typeof code === "string" ? code : code.toString();
|
|
96
|
+
const match = css.match(/:root\s*\{[^}]*font-size:\s*([\d.]+)px/);
|
|
97
|
+
effectiveRem = match?.[1] ? parseFloat(match[1]) : 14;
|
|
98
|
+
options.inlineRem = effectiveRem;
|
|
99
|
+
}
|
|
78
100
|
|
|
79
|
-
|
|
101
|
+
const firstPassVisitor: Visitor<CustomAtRules> = {
|
|
102
|
+
Rule(rule) {
|
|
103
|
+
if (
|
|
104
|
+
rule.type === "unknown" &&
|
|
105
|
+
["cssInterop", "react-native"].includes(rule.value.name)
|
|
106
|
+
) {
|
|
107
|
+
throw new Error(
|
|
108
|
+
`Unsupported @${rule.value.name} configuration. Use the compiler inlineVariables.exclude option to preserve variables, @media (prefers-color-scheme: dark) for dark mode, and React Native Appearance.setColorScheme() for manual selection.`,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
// Reject before variable inlining can erase an unsupported condition and
|
|
112
|
+
// accidentally turn its values into unconditional declarations.
|
|
113
|
+
if (
|
|
114
|
+
rule.type === "style" &&
|
|
115
|
+
rule.value.selectors.some(
|
|
116
|
+
(selector) =>
|
|
117
|
+
selector.some(
|
|
118
|
+
(part) => part.type === "pseudo-class" && part.kind === "root",
|
|
119
|
+
) &&
|
|
120
|
+
selector.some(
|
|
121
|
+
(part) =>
|
|
122
|
+
part.type === "class" ||
|
|
123
|
+
(part.type === "attribute" && part.name === "class"),
|
|
124
|
+
),
|
|
125
|
+
)
|
|
126
|
+
) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
"Class-qualified :root selectors are unsupported on native. Use @media (prefers-color-scheme: dark) for dark mode, and React Native Appearance.setColorScheme() for manual selection.",
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
if (effectiveRem !== false) {
|
|
135
|
+
const remMultiplier = effectiveRem;
|
|
80
136
|
firstPassVisitor.Length = (length) => {
|
|
81
|
-
if (length.unit !== "rem"
|
|
137
|
+
if (length.unit !== "rem") {
|
|
82
138
|
return length;
|
|
83
139
|
}
|
|
84
140
|
|
|
85
141
|
return {
|
|
86
142
|
unit: "px",
|
|
87
|
-
value: round(length.value *
|
|
143
|
+
value: round(length.value * remMultiplier),
|
|
88
144
|
};
|
|
89
145
|
};
|
|
90
146
|
}
|
|
@@ -233,7 +289,12 @@ function extractRule(
|
|
|
233
289
|
const value = rule.value;
|
|
234
290
|
|
|
235
291
|
const declarationBlock = value.declarations;
|
|
236
|
-
mapping = {
|
|
292
|
+
mapping = {
|
|
293
|
+
...mapping,
|
|
294
|
+
...parsePropAtRule(value.rules),
|
|
295
|
+
...parsePropDeclarations(declarationBlock?.declarations),
|
|
296
|
+
...parsePropDeclarations(declarationBlock?.importantDeclarations),
|
|
297
|
+
};
|
|
237
298
|
|
|
238
299
|
// If the rule is a style declaration, extract it with the `getExtractedStyle` function and store it in the `declarations` map
|
|
239
300
|
builder = builder.fork("style", value.selectors);
|
|
@@ -276,13 +337,15 @@ function extractRule(
|
|
|
276
337
|
}
|
|
277
338
|
}
|
|
278
339
|
break;
|
|
340
|
+
case "property":
|
|
341
|
+
extractPropertyRule(rule.value, builder);
|
|
342
|
+
break;
|
|
279
343
|
case "custom":
|
|
280
344
|
case "font-face":
|
|
281
345
|
case "font-palette-values":
|
|
282
346
|
case "font-feature-values":
|
|
283
347
|
case "namespace":
|
|
284
348
|
case "layer-statement":
|
|
285
|
-
case "property":
|
|
286
349
|
case "view-transition":
|
|
287
350
|
case "ignored":
|
|
288
351
|
case "unknown":
|
|
@@ -314,39 +377,16 @@ function extractMedia(
|
|
|
314
377
|
builder: StylesheetBuilder,
|
|
315
378
|
mapping: StyleRuleMapping,
|
|
316
379
|
) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
// Initialize an empty array to store screen media queries
|
|
320
|
-
const media: CSSMediaQuery[] = [];
|
|
321
|
-
|
|
322
|
-
// Iterate over all media queries in the mediaRule
|
|
380
|
+
// Comma separated queries are alternatives. Each branch inherits the outer
|
|
381
|
+
// conditions without adding its siblings as required conjunctions.
|
|
323
382
|
for (const mediaQuery of mediaRule.query.mediaQueries) {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
(mediaQuery.mediaType === "print" && mediaQuery.qualifier !== "not") ||
|
|
327
|
-
// If this is a @media not print {}
|
|
328
|
-
// We can only do this if there are no conditions, as @media not print and (min-width: 100px) could be valid
|
|
329
|
-
(mediaQuery.mediaType !== "print" &&
|
|
330
|
-
mediaQuery.qualifier === "not" &&
|
|
331
|
-
mediaQuery.condition === null)
|
|
332
|
-
) {
|
|
383
|
+
const queryBuilder = builder.fork("media");
|
|
384
|
+
if (!parseMediaQuery(mediaQuery, queryBuilder)) {
|
|
333
385
|
continue;
|
|
334
386
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
if (media.length === 0) {
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
for (const m of media) {
|
|
344
|
-
parseMediaQuery(m, builder);
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
// Iterate over all rules in the mediaRule and extract their styles using the updated CompilerCollection
|
|
348
|
-
for (const rule of mediaRule.rules) {
|
|
349
|
-
extractRule(rule, builder, mapping);
|
|
387
|
+
for (const rule of mediaRule.rules) {
|
|
388
|
+
extractRule(rule, queryBuilder, mapping);
|
|
389
|
+
}
|
|
350
390
|
}
|
|
351
391
|
}
|
|
352
392
|
|
|
@@ -363,9 +403,12 @@ function extractContainer(
|
|
|
363
403
|
builder = builder.fork("container");
|
|
364
404
|
|
|
365
405
|
// Iterate over all rules inside the containerRule and extract their styles using the updated CompilerCollection
|
|
366
|
-
const
|
|
367
|
-
|
|
368
|
-
|
|
406
|
+
const condition = parseContainerCondition(containerRule.condition, builder);
|
|
407
|
+
if (!condition) {
|
|
408
|
+
// An unsupported condition must not turn into an unconditional container.
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
const query: ContainerQuery = { m: condition };
|
|
369
412
|
|
|
370
413
|
if (containerRule.name) {
|
|
371
414
|
query.n = `c:${containerRule.name}`;
|
|
@@ -377,3 +420,58 @@ function extractContainer(
|
|
|
377
420
|
extractRule(rule, builder, mapping);
|
|
378
421
|
}
|
|
379
422
|
}
|
|
423
|
+
|
|
424
|
+
function extractPropertyRule(
|
|
425
|
+
propertyRule: PropertyRule,
|
|
426
|
+
builder: StylesheetBuilder,
|
|
427
|
+
) {
|
|
428
|
+
const { initialValue, name } = propertyRule;
|
|
429
|
+
|
|
430
|
+
if (initialValue == null) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
const varName = name.startsWith("--") ? name.slice(2) : name;
|
|
435
|
+
const value = parsePropertyInitialValue(initialValue, builder);
|
|
436
|
+
|
|
437
|
+
if (value !== undefined) {
|
|
438
|
+
builder.addRootVariable(varName, value);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function parsePropertyInitialValue(
|
|
443
|
+
component: ParsedComponent,
|
|
444
|
+
builder: StylesheetBuilder,
|
|
445
|
+
): StyleDescriptor {
|
|
446
|
+
switch (component.type) {
|
|
447
|
+
case "length":
|
|
448
|
+
return parseLength(component.value, builder);
|
|
449
|
+
case "number":
|
|
450
|
+
case "integer":
|
|
451
|
+
return round(component.value);
|
|
452
|
+
case "percentage":
|
|
453
|
+
return `${round(component.value * 100)}%`;
|
|
454
|
+
case "color":
|
|
455
|
+
return parseColor(component.value, builder);
|
|
456
|
+
case "angle":
|
|
457
|
+
return parseAngle(component.value, builder);
|
|
458
|
+
case "length-percentage":
|
|
459
|
+
return parseLength(component.value, builder);
|
|
460
|
+
case "token-list":
|
|
461
|
+
return reduceParseUnparsed(component.value, builder, "@property", false);
|
|
462
|
+
case "custom-ident":
|
|
463
|
+
case "literal":
|
|
464
|
+
return component.value;
|
|
465
|
+
case "repeated": {
|
|
466
|
+
const results = component.value.components
|
|
467
|
+
.map((c) => parsePropertyInitialValue(c, builder))
|
|
468
|
+
.filter((v): v is NonNullable<StyleDescriptor> => v !== undefined);
|
|
469
|
+
// Unwrap single-child repeated values so downstream consumers get a
|
|
470
|
+
// scalar instead of a 1-element array. For example, `<length>+` with
|
|
471
|
+
// initial-value `10px` should produce the same shape as `<length>`.
|
|
472
|
+
return results.length === 1 ? results[0] : results;
|
|
473
|
+
}
|
|
474
|
+
default:
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
@@ -36,9 +36,14 @@ function parseContainerQueryCondition(
|
|
|
36
36
|
const query = parseContainerCondition(condition.value, builder);
|
|
37
37
|
return query ? ["!", query] : undefined;
|
|
38
38
|
case "operation":
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const parsed = condition.conditions.map((c) =>
|
|
40
|
+
parseContainerCondition(c, builder),
|
|
41
|
+
);
|
|
42
|
+
if (condition.operator === "and" && parsed.some((c) => !c)) {
|
|
43
|
+
// Dropping a conjunct would broaden the query to unrelated containers.
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const conditions = parsed.filter((c): c is MediaCondition => !!c);
|
|
42
47
|
|
|
43
48
|
if (conditions.length === 0) {
|
|
44
49
|
return;
|