react-native-css 3.0.6 → 3.1.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- 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 +43 -30
- 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 +102 -61
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/lightningcss-loader.js +11 -8
- 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/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/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 +48 -12
- 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 +32 -22
- 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 +43 -29
- package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -1
- 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/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 +140 -14
- 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/animation.js +6 -3
- package/dist/commonjs/native/styles/shorthands/animation.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 +1 -1
- 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 +44 -31
- 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 +102 -61
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/lightningcss-loader.js +10 -8
- 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/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/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 +49 -13
- 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 +32 -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 +43 -29
- package/dist/module/native/styles/functions/color-mix.js.map +1 -1
- 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/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 +140 -14
- 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/animation.js +6 -3
- package/dist/module/native/styles/shorthands/animation.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 +1 -1
- 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 +2 -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/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/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 +7 -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.map +1 -1
- 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/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/animation.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 +4 -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 +1 -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/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 +7 -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 +1 -1
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts.map +1 -1
- 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 -8
- 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 +61 -27
- 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 +73 -49
- package/src/compiler/container-query.ts +8 -3
- package/src/compiler/declarations.ts +189 -100
- package/src/compiler/lightningcss-loader.ts +16 -15
- package/src/compiler/media-query.ts +20 -9
- package/src/compiler/selector-builder.ts +29 -3
- package/src/components/FlatList.tsx +1 -0
- package/src/components/ImageBackground.tsx +2 -6
- package/src/components/KeyboardAvoidingView.tsx +2 -3
- 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 +54 -14
- package/src/native/react/usePassthrough.ts +3 -2
- package/src/native/reactivity.ts +42 -24
- package/src/native/reanimated.ts +24 -5
- package/src/native/styles/functions/color-mix.ts +45 -39
- package/src/native/styles/functions/filters.ts +20 -6
- 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 +146 -15
- package/src/native/styles/resolve.ts +15 -11
- package/src/native/styles/scale-factor.ts +6 -0
- package/src/native/styles/shorthands/animation.ts +8 -2
- 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 +6 -11
- package/src/web/assign-style.ts +2 -1
- package/types.d.ts +0 -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
|
@@ -172,9 +172,10 @@ export const stylesFamily = family(
|
|
|
172
172
|
/**
|
|
173
173
|
* A family is a map, so we need to cleanup the observers when the the hash is no longer used
|
|
174
174
|
*/
|
|
175
|
+
const unsubscribe = obs.unsubscribe;
|
|
175
176
|
return Object.assign(obs, {
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
unsubscribe: (effect: Effect) => {
|
|
178
|
+
unsubscribe(effect);
|
|
178
179
|
if (obs.observers.size === 0) {
|
|
179
180
|
stylesFamily.delete(hash);
|
|
180
181
|
}
|
|
@@ -186,15 +187,23 @@ export const stylesFamily = family(
|
|
|
186
187
|
export function getStyledProps(
|
|
187
188
|
state: ComponentState,
|
|
188
189
|
inline: Record<string, any> | undefined | null,
|
|
190
|
+
adaptProps: (
|
|
191
|
+
props: Record<string, any> | undefined,
|
|
192
|
+
) => Record<string, any> | undefined = (props) => props,
|
|
189
193
|
) {
|
|
190
194
|
let result: Record<string, any> | undefined;
|
|
191
195
|
|
|
192
196
|
const styledProps = state.stylesObs?.get(state.styleEffect);
|
|
193
197
|
|
|
198
|
+
// Each config merges a complete props object. Preserve its full target path
|
|
199
|
+
// before the next config merges unrelated inline props over that object.
|
|
200
|
+
const computedTargets: { path: string[]; value: unknown }[] = [];
|
|
201
|
+
const consumedSources: string[] = [];
|
|
202
|
+
|
|
194
203
|
for (const config of state.configs) {
|
|
195
204
|
result = deepMergeConfig(
|
|
196
205
|
config,
|
|
197
|
-
nativeStyleMapping(config, styledProps?.normal),
|
|
206
|
+
nativeStyleMapping(config, adaptProps(styledProps?.normal)),
|
|
198
207
|
inline,
|
|
199
208
|
true,
|
|
200
209
|
);
|
|
@@ -203,10 +212,27 @@ export function getStyledProps(
|
|
|
203
212
|
result = deepMergeConfig(
|
|
204
213
|
config,
|
|
205
214
|
result,
|
|
206
|
-
nativeStyleMapping(config, styledProps.important),
|
|
215
|
+
nativeStyleMapping(config, adaptProps(styledProps.important)),
|
|
207
216
|
);
|
|
208
217
|
}
|
|
209
218
|
|
|
219
|
+
if (result && config.target) {
|
|
220
|
+
const path = Array.isArray(config.target)
|
|
221
|
+
? config.target
|
|
222
|
+
: [config.target];
|
|
223
|
+
let target = result;
|
|
224
|
+
for (const key of path.slice(0, -1)) target = target?.[key];
|
|
225
|
+
const key = path[path.length - 1];
|
|
226
|
+
if (target && key && key in target) {
|
|
227
|
+
computedTargets.push({ path, value: target[key] });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Track consumed className sources for cleanup
|
|
232
|
+
if (config.source !== config.target) {
|
|
233
|
+
consumedSources.push(config.source);
|
|
234
|
+
}
|
|
235
|
+
|
|
210
236
|
// Apply the handlers
|
|
211
237
|
if (hoverFamily.has(state.ruleEffectGetter)) {
|
|
212
238
|
result ??= {};
|
|
@@ -265,6 +291,68 @@ export function getStyledProps(
|
|
|
265
291
|
}
|
|
266
292
|
}
|
|
267
293
|
|
|
294
|
+
// Restore correctly-merged target props that may have been overwritten
|
|
295
|
+
// by later config iterations' Object.assign({}, left, right)
|
|
296
|
+
if (result) {
|
|
297
|
+
for (const { path, value } of computedTargets) {
|
|
298
|
+
let target = result;
|
|
299
|
+
for (const key of path.slice(0, -1)) {
|
|
300
|
+
const existing = target[key];
|
|
301
|
+
target = target[key] = Array.isArray(existing)
|
|
302
|
+
? [...existing]
|
|
303
|
+
: { ...existing };
|
|
304
|
+
}
|
|
305
|
+
target[path[path.length - 1]!] = value;
|
|
306
|
+
}
|
|
307
|
+
for (const source of consumedSources) {
|
|
308
|
+
delete result[source];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Merges two prop objects, skipping keys from `right` whose value is `undefined`
|
|
317
|
+
* or an empty plain object.
|
|
318
|
+
*
|
|
319
|
+
* `Object.assign({}, left, right)` copies all enumerable own properties from `right`,
|
|
320
|
+
* including those with value `undefined` or `{}`. When a component passes
|
|
321
|
+
* `style={undefined}` or `contentContainerStyle={{}}`, the computed NativeWind
|
|
322
|
+
* style from `left` gets overwritten. This function prevents that by only copying
|
|
323
|
+
* values that carry meaningful style information.
|
|
324
|
+
*
|
|
325
|
+
* Empty object detection uses inline `for...in` instead of a separate function or
|
|
326
|
+
* `Object.keys().length` — avoids both function call overhead and intermediate array
|
|
327
|
+
* allocation on a hot path (called per-prop per-render). Consistent with how the
|
|
328
|
+
* `["style"]` target path handles this via `filterCssVariables({})` returning `undefined`.
|
|
329
|
+
*
|
|
330
|
+
* @param left - The computed NativeWind props (className-derived styles)
|
|
331
|
+
* @param right - The inline props from the component (guaranteed non-null by caller; may contain undefined values)
|
|
332
|
+
* @returns A new object with all properties from `left`, overridden only by meaningful values from `right`
|
|
333
|
+
*/
|
|
334
|
+
function mergeDefinedProps(
|
|
335
|
+
left: Record<string, any> | undefined,
|
|
336
|
+
right: Record<string, any>,
|
|
337
|
+
) {
|
|
338
|
+
const result = left ? { ...left } : {};
|
|
339
|
+
for (const key in right) {
|
|
340
|
+
const value = right[key];
|
|
341
|
+
if (value === undefined) continue;
|
|
342
|
+
// Non-object values (strings, numbers, booleans, null, arrays): always assign
|
|
343
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
344
|
+
result[key] = value;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
// Plain object: assign only if non-empty. An empty style object (e.g.,
|
|
348
|
+
// contentContainerStyle={{}}) has no properties to apply and should not
|
|
349
|
+
// overwrite computed className styles. The for...in loop only executes
|
|
350
|
+
// if the object has enumerable keys — empty objects are skipped.
|
|
351
|
+
for (const _ in value) {
|
|
352
|
+
result[key] = value;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
268
356
|
return result;
|
|
269
357
|
}
|
|
270
358
|
|
|
@@ -359,10 +447,10 @@ function deepMergeConfig(
|
|
|
359
447
|
}
|
|
360
448
|
}
|
|
361
449
|
} else {
|
|
362
|
-
result =
|
|
450
|
+
result = mergeDefinedProps(left, right);
|
|
363
451
|
}
|
|
364
452
|
} else {
|
|
365
|
-
result =
|
|
453
|
+
result = mergeDefinedProps(left, right);
|
|
366
454
|
}
|
|
367
455
|
|
|
368
456
|
if (
|
|
@@ -378,21 +466,59 @@ function deepMergeConfig(
|
|
|
378
466
|
* If target is a path, deep merge until we get to the last key
|
|
379
467
|
*/
|
|
380
468
|
if (Array.isArray(config.target)) {
|
|
381
|
-
|
|
382
|
-
const key = config.target[
|
|
383
|
-
|
|
384
|
-
if (key === undefined) {
|
|
385
|
-
return result;
|
|
386
|
-
}
|
|
387
|
-
|
|
469
|
+
if (config.target.length > 1) {
|
|
470
|
+
const key = config.target[0]!;
|
|
388
471
|
result[key] = deepMergeConfig(
|
|
389
|
-
{ source: config.source, target: config.target.slice(
|
|
472
|
+
{ source: config.source, target: config.target.slice(1) },
|
|
390
473
|
left?.[key],
|
|
391
474
|
right?.[key],
|
|
392
475
|
rightIsInline,
|
|
393
476
|
);
|
|
394
477
|
}
|
|
395
478
|
|
|
479
|
+
// For length-1 array targets (e.g. ["contentContainerStyle"]), the loop
|
|
480
|
+
// above runs 0 iterations. Merge the target prop so inline styles don't
|
|
481
|
+
// silently overwrite className-computed styles (same as string target path).
|
|
482
|
+
const finalKey = config.target[config.target.length - 1];
|
|
483
|
+
if (config.target.length === 1 && finalKey && rightIsInline) {
|
|
484
|
+
let rightValue = right?.[finalKey];
|
|
485
|
+
if (rightValue !== undefined) {
|
|
486
|
+
rightValue = filterCssVariables(rightValue);
|
|
487
|
+
}
|
|
488
|
+
if (rightValue === undefined || rightValue === null) {
|
|
489
|
+
// Inline is empty or fully filtered — preserve className-computed value
|
|
490
|
+
if (left && finalKey in left) {
|
|
491
|
+
result[finalKey] = left[finalKey];
|
|
492
|
+
} else {
|
|
493
|
+
// No left value either — remove unfiltered inline value from result
|
|
494
|
+
delete result[finalKey];
|
|
495
|
+
}
|
|
496
|
+
} else if (left && finalKey in left) {
|
|
497
|
+
const leftValue = left[finalKey];
|
|
498
|
+
const leftIsObj =
|
|
499
|
+
typeof leftValue === "object" &&
|
|
500
|
+
leftValue !== null &&
|
|
501
|
+
!Array.isArray(leftValue);
|
|
502
|
+
const rightIsObj =
|
|
503
|
+
typeof rightValue === "object" &&
|
|
504
|
+
rightValue !== null &&
|
|
505
|
+
!Array.isArray(rightValue);
|
|
506
|
+
if (leftIsObj && rightIsObj) {
|
|
507
|
+
if (hasNonOverlappingProperties(leftValue, rightValue)) {
|
|
508
|
+
result[finalKey] = [leftValue, rightValue];
|
|
509
|
+
} else {
|
|
510
|
+
// All left keys are in right — use filtered right value
|
|
511
|
+
result[finalKey] = rightValue;
|
|
512
|
+
}
|
|
513
|
+
} else {
|
|
514
|
+
result[finalKey] = [leftValue, rightValue];
|
|
515
|
+
}
|
|
516
|
+
} else {
|
|
517
|
+
// No left value — use filtered right value (not the unfiltered one from mergeDefinedProps)
|
|
518
|
+
result[finalKey] = rightValue;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
396
522
|
return result;
|
|
397
523
|
}
|
|
398
524
|
|
|
@@ -421,7 +547,11 @@ function nativeStyleMapping(
|
|
|
421
547
|
config: Config,
|
|
422
548
|
props: Record<string, any> | undefined,
|
|
423
549
|
) {
|
|
424
|
-
if (!
|
|
550
|
+
if (!props) {
|
|
551
|
+
return props;
|
|
552
|
+
}
|
|
553
|
+
if (!config.nativeStyleMapping) {
|
|
554
|
+
if (config.target === false) delete props.style;
|
|
425
555
|
return props;
|
|
426
556
|
}
|
|
427
557
|
|
|
@@ -470,5 +600,6 @@ function nativeStyleMapping(
|
|
|
470
600
|
target[lastToken!] = styleValue;
|
|
471
601
|
}
|
|
472
602
|
|
|
603
|
+
if (config.target === false) delete props.style;
|
|
473
604
|
return props;
|
|
474
605
|
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
StyleDescriptor,
|
|
6
6
|
StyleFunction,
|
|
7
7
|
} from "react-native-css/compiler";
|
|
8
|
+
import { isStyleDescriptorArray } from "react-native-css/utilities";
|
|
8
9
|
|
|
9
10
|
import type { RenderGuard } from "../conditions/guards";
|
|
10
11
|
import { type Getter, type VariableContextValue } from "../reactivity";
|
|
@@ -12,6 +13,7 @@ import type { calculateProps } from "./calculate-props";
|
|
|
12
13
|
import { transformKeys } from "./defaults";
|
|
13
14
|
import * as functions from "./functions";
|
|
14
15
|
import { lineHeight } from "./line-height";
|
|
16
|
+
import { scaleFactor } from "./scale-factor";
|
|
15
17
|
import * as shorthands from "./shorthands";
|
|
16
18
|
import { em, rem, vh, vw } from "./units";
|
|
17
19
|
import { varResolver } from "./variables";
|
|
@@ -51,6 +53,7 @@ export type ResolveValueOptions = {
|
|
|
51
53
|
inlineVariables?: InlineVariable | undefined;
|
|
52
54
|
renderGuards?: RenderGuard[];
|
|
53
55
|
variableHistory?: Set<string>;
|
|
56
|
+
variableCycles?: Set<string>;
|
|
54
57
|
/** Pass down to perform recursive calculations and avoid circular dependencies */
|
|
55
58
|
calculateProps?: typeof calculateProps;
|
|
56
59
|
};
|
|
@@ -77,7 +80,7 @@ export function resolveValue(
|
|
|
77
80
|
return null;
|
|
78
81
|
} else if (value.endsWith("px")) {
|
|
79
82
|
// Inline vars() might set a value with a px suffix
|
|
80
|
-
return
|
|
83
|
+
return parseFloat(value.slice(0, -2));
|
|
81
84
|
} else {
|
|
82
85
|
return value;
|
|
83
86
|
}
|
|
@@ -87,7 +90,7 @@ export function resolveValue(
|
|
|
87
90
|
return value;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
if (
|
|
93
|
+
if (isStyleDescriptorArray(value)) {
|
|
91
94
|
value = value
|
|
92
95
|
.map((d) => resolveValue(d, get, options))
|
|
93
96
|
.filter((d) => d !== undefined);
|
|
@@ -122,7 +125,16 @@ export function resolveValue(
|
|
|
122
125
|
) as StyleDescriptor;
|
|
123
126
|
} else if (transformKeys.has(name)) {
|
|
124
127
|
// translate, rotate, scale, etc.
|
|
125
|
-
|
|
128
|
+
let resolved = simpleResolve(value[2], castToArray);
|
|
129
|
+
// CSS scale percentages describe a factor, unlike translation percentages.
|
|
130
|
+
if (
|
|
131
|
+
(name === "scaleX" || name === "scaleY" || name === "scale") &&
|
|
132
|
+
typeof resolved === "string" &&
|
|
133
|
+
resolved.endsWith("%")
|
|
134
|
+
) {
|
|
135
|
+
resolved = scaleFactor(resolved);
|
|
136
|
+
}
|
|
137
|
+
return { [name]: resolved };
|
|
126
138
|
} else {
|
|
127
139
|
let args = simpleResolve(value[2], castToArray);
|
|
128
140
|
|
|
@@ -154,11 +166,3 @@ export function resolveValue(
|
|
|
154
166
|
}
|
|
155
167
|
}
|
|
156
168
|
}
|
|
157
|
-
|
|
158
|
-
function isDescriptorArray(
|
|
159
|
-
value: StyleDescriptor | StyleDescriptor[],
|
|
160
|
-
): value is StyleDescriptor[] {
|
|
161
|
-
return Array.isArray(value) && typeof value[0] === "object"
|
|
162
|
-
? Array.isArray(value[0])
|
|
163
|
-
: true;
|
|
164
|
-
}
|
|
@@ -39,6 +39,8 @@ export const animationShorthand = shorthandHandler(
|
|
|
39
39
|
[name],
|
|
40
40
|
[duration, name],
|
|
41
41
|
[name, duration],
|
|
42
|
+
[name, duration, timingFunction],
|
|
43
|
+
[duration, timingFunction, name],
|
|
42
44
|
[name, duration, iteration],
|
|
43
45
|
[name, duration, timingFunction, iteration],
|
|
44
46
|
[duration, delay, name],
|
|
@@ -67,7 +69,7 @@ export const animation: StyleFunctionResolver = (
|
|
|
67
69
|
) => {
|
|
68
70
|
const animationShortHandTuples = animationShorthand(
|
|
69
71
|
resolveValue,
|
|
70
|
-
value,
|
|
72
|
+
[value[2]],
|
|
71
73
|
get,
|
|
72
74
|
options,
|
|
73
75
|
);
|
|
@@ -86,6 +88,10 @@ export const animation: StyleFunctionResolver = (
|
|
|
86
88
|
return;
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
if (name === "none") {
|
|
92
|
+
return applyShorthand(animationShortHandTuples);
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
const keyframes = get(StyleCollection.keyframes(name));
|
|
90
96
|
|
|
91
97
|
const animation: Record<string, any> = {};
|
|
@@ -127,5 +133,5 @@ export const animationName: StyleFunctionResolver = (
|
|
|
127
133
|
options,
|
|
128
134
|
) => {
|
|
129
135
|
const shorthand: any = animation(resolveValue, value, get, options);
|
|
130
|
-
return shorthand
|
|
136
|
+
return shorthand?.animationName;
|
|
131
137
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ShortHandSymbol } from "../constants";
|
|
2
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
3
|
+
|
|
4
|
+
function logicalWidth(start: string, end: string): StyleFunctionResolver {
|
|
5
|
+
return (resolve, descriptor) => {
|
|
6
|
+
const resolved = resolve(descriptor[2]);
|
|
7
|
+
const values: unknown[] = Array.isArray(resolved) ? resolved : [resolved];
|
|
8
|
+
if (
|
|
9
|
+
values.length < 1 ||
|
|
10
|
+
values.length > 2 ||
|
|
11
|
+
!values.every(
|
|
12
|
+
(value) =>
|
|
13
|
+
typeof value === "number" && Number.isFinite(value) && value >= 0,
|
|
14
|
+
)
|
|
15
|
+
)
|
|
16
|
+
return;
|
|
17
|
+
return {
|
|
18
|
+
[ShortHandSymbol]: true,
|
|
19
|
+
[start]: values[0],
|
|
20
|
+
[end]: values[1] ?? values[0],
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const borderBlockWidth = logicalWidth(
|
|
26
|
+
"borderTopWidth",
|
|
27
|
+
"borderBottomWidth",
|
|
28
|
+
);
|
|
29
|
+
export const borderInlineWidth = logicalWidth(
|
|
30
|
+
"borderStartWidth",
|
|
31
|
+
"borderEndWidth",
|
|
32
|
+
);
|
|
@@ -18,7 +18,8 @@ export function varResolver(
|
|
|
18
18
|
renderGuards,
|
|
19
19
|
inheritedVariables: variables = { [VAR_SYMBOL]: true },
|
|
20
20
|
inlineVariables,
|
|
21
|
-
variableHistory = new Set(),
|
|
21
|
+
variableHistory = (options.variableHistory ??= new Set()),
|
|
22
|
+
variableCycles = (options.variableCycles ??= new Set()),
|
|
22
23
|
} = options;
|
|
23
24
|
|
|
24
25
|
const args = fn[2];
|
|
@@ -29,11 +30,10 @@ export function varResolver(
|
|
|
29
30
|
if (typeof args === "string") {
|
|
30
31
|
name = args;
|
|
31
32
|
} else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
fallback = result[1];
|
|
33
|
+
// Fallbacks are substituted only when needed, after reading the variable.
|
|
34
|
+
if (isStyleDescriptorArray(args)) {
|
|
35
|
+
name = args[0] as string;
|
|
36
|
+
fallback = args[1];
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -41,48 +41,58 @@ export function varResolver(
|
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
45
|
+
|
|
46
|
+
// Share the active resolution path with recursive calls. Mark only the
|
|
47
|
+
// actual cycle, so a dependent variable can still use its own fallback.
|
|
45
48
|
if (variableHistory.has(name)) {
|
|
49
|
+
let inCycle = false;
|
|
50
|
+
for (const dependency of variableHistory) {
|
|
51
|
+
if (dependency === name) inCycle = true;
|
|
52
|
+
if (inCycle) variableCycles.add(dependency);
|
|
53
|
+
}
|
|
46
54
|
return;
|
|
47
55
|
}
|
|
48
56
|
|
|
49
|
-
if (name in variables) {
|
|
50
|
-
renderGuards?.push(["v", name, variables[name]]);
|
|
51
|
-
return resolve(variables[name]);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
57
|
variableHistory.add(name);
|
|
55
58
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
try {
|
|
60
|
+
let value = resolve(inlineVariables?.[name] as StyleDescriptor);
|
|
61
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
62
|
+
if (value !== undefined) {
|
|
63
|
+
options.inlineVariables ??= { [VAR_SYMBOL]: "inline" };
|
|
64
|
+
options.inlineVariables[name] = value;
|
|
60
65
|
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
63
68
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
// A universal selector declares the variable on this element. It has lower
|
|
70
|
+
// specificity than the element's class declarations, but beats inheritance.
|
|
71
|
+
value = resolve(get(universalVariables(name)));
|
|
72
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
73
|
+
if (value !== undefined) {
|
|
74
|
+
options.inlineVariables ??= { [VAR_SYMBOL]: "inline" };
|
|
75
|
+
options.inlineVariables[name] = value;
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
69
78
|
|
|
70
|
-
|
|
71
|
-
|
|
79
|
+
// Guards retain the ancestor's raw descriptor, matching the context value.
|
|
80
|
+
if (name in variables) {
|
|
81
|
+
renderGuards?.push(["v", name, variables[name]]);
|
|
82
|
+
value = resolve(variables[name]);
|
|
83
|
+
return variableCycles.has(name) ? resolve(fallback) : value;
|
|
84
|
+
}
|
|
72
85
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
value = resolve(get(rootVariables(name)));
|
|
87
|
+
if (variableCycles.has(name)) return resolve(fallback);
|
|
88
|
+
if (value !== undefined) {
|
|
89
|
+
options.inlineVariables ??= { [VAR_SYMBOL]: "inline" };
|
|
90
|
+
options.inlineVariables[name] = value;
|
|
91
|
+
return value;
|
|
92
|
+
}
|
|
79
93
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
options.inlineVariables[name] = value;
|
|
84
|
-
return value;
|
|
94
|
+
return resolve(fallback);
|
|
95
|
+
} finally {
|
|
96
|
+
variableHistory.delete(name);
|
|
85
97
|
}
|
|
86
|
-
|
|
87
|
-
return resolve(fallback);
|
|
88
98
|
}
|
package/src/runtime.types.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type {
|
|
|
3
3
|
ClassicComponentClass,
|
|
4
4
|
ComponentClass,
|
|
5
5
|
ComponentProps,
|
|
6
|
+
ComponentPropsWithRef,
|
|
6
7
|
ComponentType,
|
|
7
8
|
ForwardRefExoticComponent,
|
|
8
9
|
FunctionComponent,
|
|
@@ -44,20 +45,24 @@ export type StyledProps<P, M extends StyledConfiguration<any>> = P & {
|
|
|
44
45
|
: never]?: string;
|
|
45
46
|
};
|
|
46
47
|
|
|
47
|
-
export
|
|
48
|
-
const C extends ReactComponent
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
export interface Styled {
|
|
49
|
+
<const C extends ReactComponent>(
|
|
50
|
+
component: C,
|
|
51
|
+
mapping?: undefined,
|
|
52
|
+
options?: StyledOptions,
|
|
53
|
+
): ComponentType<ComponentPropsWithRef<C> & { className?: string }>;
|
|
54
|
+
<const C extends ReactComponent, const M extends StyledConfiguration<C>>(
|
|
55
|
+
component: C,
|
|
56
|
+
mapping: M & StyledConfiguration<C>,
|
|
57
|
+
options?: StyledOptions,
|
|
58
|
+
): StyledComponent<C, M>;
|
|
59
|
+
}
|
|
55
60
|
|
|
56
61
|
type StyledComponent<
|
|
57
62
|
C extends ReactComponent,
|
|
58
63
|
M extends StyledConfiguration<C>,
|
|
59
64
|
> = ComponentType<
|
|
60
|
-
|
|
65
|
+
ComponentPropsWithRef<C> & {
|
|
61
66
|
[K in keyof M as K extends string
|
|
62
67
|
? M[K] extends undefined | false
|
|
63
68
|
? never
|
|
@@ -90,10 +95,7 @@ interface StyledConfigurationObject<
|
|
|
90
95
|
ComponentProps<C>
|
|
91
96
|
>;
|
|
92
97
|
/** @deprecated Please use nativeStyleMapping */
|
|
93
|
-
nativeStyleToProp?:
|
|
94
|
-
ResolveDotPath<T, ComponentProps<C>>,
|
|
95
|
-
ComponentProps<C>
|
|
96
|
-
>;
|
|
98
|
+
nativeStyleToProp?: StyledConfigurationObject<C, T>["nativeStyleMapping"];
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
type NativeStyleMapping<T, S> = T extends object
|
|
@@ -145,6 +147,6 @@ export type RNStyle = ViewStyle & TextStyle & ImageStyle;
|
|
|
145
147
|
/******************************** Globals ********************************/
|
|
146
148
|
|
|
147
149
|
export interface ColorScheme {
|
|
148
|
-
get: () => ColorSchemeName;
|
|
149
|
-
set: (value: ColorSchemeName) => void;
|
|
150
|
+
get: () => ColorSchemeName | null | undefined;
|
|
151
|
+
set: (value: ColorSchemeName | null | undefined) => void;
|
|
150
152
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import type { Component, ReactElement } from "react";
|
|
3
|
+
|
|
2
4
|
// ---------- Base Utilities ----------
|
|
3
5
|
|
|
4
6
|
type Falsy = undefined | null | false | "";
|
|
@@ -32,14 +34,13 @@ export type StyleProp<T> =
|
|
|
32
34
|
type UnwrapRecursiveArray<
|
|
33
35
|
T,
|
|
34
36
|
Depth extends unknown[] = [],
|
|
35
|
-
MaxDepth extends number = 10
|
|
37
|
+
MaxDepth extends number = 10,
|
|
36
38
|
> = Depth["length"] extends MaxDepth
|
|
37
39
|
? T
|
|
38
40
|
: T extends (infer I)[]
|
|
39
41
|
? UnwrapRecursiveArray<I, [...Depth, unknown], MaxDepth>
|
|
40
42
|
: T;
|
|
41
43
|
|
|
42
|
-
|
|
43
44
|
// Remove null, false, undefined, etc.
|
|
44
45
|
type RemoveFalsy<T> = Exclude<T, Falsy>;
|
|
45
46
|
|
|
@@ -53,7 +54,7 @@ type ExtractStyleObject<T> = RemoveRegisteredStyle<
|
|
|
53
54
|
|
|
54
55
|
// Check if something is a non-array plain object
|
|
55
56
|
type IsPlainObject<T> = T extends object
|
|
56
|
-
? T extends Function
|
|
57
|
+
? T extends Function | Component | ReactElement
|
|
57
58
|
? false
|
|
58
59
|
: T extends readonly any[]
|
|
59
60
|
? false
|
|
@@ -3,22 +3,17 @@ import type { StyleDescriptor, StyleFunction } from "react-native-css/compiler";
|
|
|
3
3
|
export function isStyleDescriptorArray(
|
|
4
4
|
value: unknown,
|
|
5
5
|
): value is StyleDescriptor[] {
|
|
6
|
-
|
|
7
|
-
// If its an array and the first item is an object, the only allowed value is an array
|
|
8
|
-
return typeof value[0] === "object" ? Array.isArray(value[0]) : true;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return false;
|
|
6
|
+
return Array.isArray(value) && !isStyleFunction(value);
|
|
12
7
|
}
|
|
13
8
|
|
|
14
|
-
export function isStyleFunction(
|
|
15
|
-
value
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
export function isStyleFunction(value: unknown): value is StyleFunction {
|
|
10
|
+
if (!Array.isArray(value)) return false;
|
|
11
|
+
const marker: unknown = value[0];
|
|
12
|
+
return (
|
|
13
|
+
marker !== null &&
|
|
14
|
+
typeof marker === "object" &&
|
|
15
|
+
!Array.isArray(marker) &&
|
|
16
|
+
Object.keys(marker).length === 0 &&
|
|
17
|
+
typeof value[1] === "string"
|
|
18
|
+
);
|
|
24
19
|
}
|