react-native-css 3.0.7 → 3.1.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/README.md +24 -0
- package/dist/commonjs/babel/helpers.js +7 -0
- package/dist/commonjs/babel/helpers.js.map +1 -1
- package/dist/commonjs/babel/import-plugin.js +20 -8
- package/dist/commonjs/babel/import-plugin.js.map +1 -1
- package/dist/commonjs/babel/react-native-web.js +17 -4
- package/dist/commonjs/babel/react-native-web.js.map +1 -1
- package/dist/commonjs/babel/react-native.js +9 -4
- 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 +44 -28
- 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 +103 -62
- 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 +15 -4
- package/dist/commonjs/compiler/selector-builder.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +11 -3
- package/dist/commonjs/compiler/stylesheet.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 +16 -3
- 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/metro/warnings.js +135 -0
- package/dist/commonjs/metro/warnings.js.map +1 -0
- package/dist/commonjs/native/api.js +13 -9
- 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 +60 -11
- 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 +61 -24
- 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 +14 -1
- 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 +95 -12
- 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/root.js +18 -7
- package/dist/commonjs/native-internal/root.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/native-internal/variables.js +1 -1
- package/dist/commonjs/native-internal/variables.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/helpers.js +6 -0
- package/dist/module/babel/helpers.js.map +1 -1
- package/dist/module/babel/import-plugin.js +22 -10
- 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 +9 -4
- 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 +45 -29
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +2 -0
- package/dist/module/compiler/compiler.types.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 +103 -62
- 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 +15 -4
- package/dist/module/compiler/selector-builder.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +11 -3
- package/dist/module/compiler/stylesheet.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 +16 -3
- 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/metro/warnings.js +131 -0
- package/dist/module/metro/warnings.js.map +1 -0
- package/dist/module/native/api.js +15 -11
- 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 +63 -14
- 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 +55 -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 +12 -0
- 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 +95 -12
- 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/root.js +18 -7
- package/dist/module/native-internal/root.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/native-internal/variables.js +2 -2
- package/dist/module/native-internal/variables.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/helpers.d.ts +2 -1
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.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 +1 -5
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +6 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.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/compiler/stylesheet.d.ts +6 -8
- package/dist/typescript/commonjs/src/compiler/stylesheet.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/jest/index.d.ts +2 -10
- package/dist/typescript/commonjs/src/jest/index.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 +4 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +9 -4
- 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/metro/warnings.d.ts +13 -0
- package/dist/typescript/commonjs/src/metro/warnings.d.ts.map +1 -0
- 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 +14 -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/root.d.ts +12 -0
- package/dist/typescript/commonjs/src/native-internal/root.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/helpers.d.ts +2 -1
- package/dist/typescript/module/src/babel/helpers.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 +3 -7
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +7 -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 +6 -8
- package/dist/typescript/module/src/compiler/stylesheet.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/jest/index.d.ts +2 -10
- package/dist/typescript/module/src/jest/index.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 +5 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +10 -5
- 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/metro/warnings.d.ts +13 -0
- package/dist/typescript/module/src/metro/warnings.d.ts.map +1 -0
- 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 +14 -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 +13 -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 +63 -28
- package/src/babel/helpers.ts +8 -1
- package/src/babel/import-plugin.ts +31 -16
- package/src/babel/react-native-web.ts +32 -4
- package/src/babel/react-native.ts +9 -4
- package/src/compiler/atRules.ts +44 -0
- package/src/compiler/compiler.ts +78 -47
- package/src/compiler/compiler.types.ts +9 -0
- package/src/compiler/container-query.ts +8 -3
- package/src/compiler/declarations.ts +190 -101
- package/src/compiler/lightningcss-loader.ts +16 -15
- package/src/compiler/media-query.ts +20 -9
- package/src/compiler/selector-builder.ts +31 -4
- package/src/compiler/stylesheet.ts +17 -10
- 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 +7 -0
- package/src/metro/metro-transformer.ts +26 -8
- package/src/metro/typescript.ts +53 -6
- package/src/metro/warnings.ts +187 -0
- package/src/native/api.tsx +22 -17
- 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 +69 -14
- package/src/native/react/usePassthrough.ts +3 -2
- package/src/native/reactivity.ts +76 -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 +14 -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 +100 -13
- 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/root.ts +40 -13
- package/src/native-internal/style-collection.ts +1 -1
- package/src/native-internal/variables.tsx +6 -4
- 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
package/src/native/reanimated.ts
CHANGED
|
@@ -11,11 +11,30 @@ export const animatedComponentFamily = weakFamily(
|
|
|
11
11
|
return component;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
)
|
|
14
|
+
// Reanimated 4.5 keeps the original component display name. Compare its
|
|
15
|
+
// public built-in components by identity instead of interpreting that name.
|
|
16
|
+
const reanimated =
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
18
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated");
|
|
19
|
+
const animated = reanimated.default;
|
|
20
|
+
if (
|
|
21
|
+
[
|
|
22
|
+
animated.View,
|
|
23
|
+
animated.Text,
|
|
24
|
+
animated.Image,
|
|
25
|
+
animated.ScrollView,
|
|
26
|
+
animated.FlatList,
|
|
27
|
+
].some((value) => value === component)
|
|
28
|
+
) {
|
|
29
|
+
return component;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// This public constructor remains supported for arbitrary components; only
|
|
33
|
+
// its FlatList-specific overload is deprecated by Reanimated.
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
35
|
+
const createAnimatedComponent = reanimated.createAnimatedComponent as (
|
|
36
|
+
component: ComponentType,
|
|
37
|
+
) => ComponentType;
|
|
19
38
|
|
|
20
39
|
return createAnimatedComponent(component);
|
|
21
40
|
},
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
2
|
-
import type { PlainColorObject } from "colorjs.io";
|
|
3
1
|
import {
|
|
4
2
|
ColorSpace,
|
|
5
3
|
to as convert,
|
|
@@ -8,7 +6,6 @@ import {
|
|
|
8
6
|
P3,
|
|
9
7
|
parse,
|
|
10
8
|
sRGB,
|
|
11
|
-
type ColorConstructor,
|
|
12
9
|
} from "colorjs.io/fn";
|
|
13
10
|
|
|
14
11
|
import type { StyleFunctionResolver } from "../resolve";
|
|
@@ -18,49 +15,58 @@ ColorSpace.register(P3);
|
|
|
18
15
|
ColorSpace.register(OKLab);
|
|
19
16
|
|
|
20
17
|
export const colorMix: StyleFunctionResolver = (resolveValue, value) => {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
if (!Array.isArray(args) || args.length < 3) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
18
|
+
const resolved = resolveValue(value[2]);
|
|
19
|
+
if (!Array.isArray(resolved)) return;
|
|
26
20
|
|
|
21
|
+
// Resolved descriptors may be cached and shared by another styled component.
|
|
22
|
+
const args: unknown[] = [...(resolved as unknown[])];
|
|
27
23
|
try {
|
|
28
24
|
const space = args.shift();
|
|
25
|
+
const leftValue = args.shift();
|
|
26
|
+
if (typeof space !== "string" || typeof leftValue !== "string") return;
|
|
27
|
+
ColorSpace.get(space);
|
|
28
|
+
const left = parse(leftValue);
|
|
29
|
+
const percentage = () => {
|
|
30
|
+
const next = args[0];
|
|
31
|
+
if (typeof next !== "string" || !next.endsWith("%")) return undefined;
|
|
32
|
+
args.shift();
|
|
33
|
+
return Number(next.slice(0, -1)) / 100;
|
|
34
|
+
};
|
|
35
|
+
let leftWeight = percentage();
|
|
36
|
+
const rightValue = args.shift();
|
|
37
|
+
if (typeof rightValue !== "string") return;
|
|
38
|
+
const right = parse(rightValue);
|
|
39
|
+
let rightWeight = percentage();
|
|
40
|
+
if (args.length) return;
|
|
29
41
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
next = args.shift();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (next === undefined) {
|
|
42
|
-
if (left.spaceId !== "srgb") {
|
|
43
|
-
left = convert(left, "srgb");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return `rgba(${(left.coords[0] ?? 0) * 255}, ${(left.coords[1] ?? 0) * 255}, ${(left.coords[2] ?? 0) * 255}, ${left.alpha})`;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (typeof next !== "string") {
|
|
42
|
+
// CSS Color 5: omitted weights are complementary, then both are normalized.
|
|
43
|
+
leftWeight ??= rightWeight === undefined ? 0.5 : 1 - rightWeight;
|
|
44
|
+
rightWeight ??= 1 - leftWeight;
|
|
45
|
+
if (
|
|
46
|
+
![leftWeight, rightWeight].every(
|
|
47
|
+
(weight) => Number.isFinite(weight) && weight >= 0 && weight <= 1,
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
50
|
return;
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const sum = leftWeight + rightWeight;
|
|
52
|
+
if (sum === 0) return;
|
|
53
|
+
const alphaMultiplier = Math.min(sum, 1);
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
if (
|
|
56
|
-
|
|
55
|
+
let result;
|
|
56
|
+
if (right.alpha === 0 || left.alpha === 0) {
|
|
57
|
+
// A transparent endpoint contributes no premultiplied channels.
|
|
58
|
+
const source = right.alpha === 0 ? left : right;
|
|
59
|
+
const weight = right.alpha === 0 ? leftWeight : rightWeight;
|
|
60
|
+
result = convert(source, "srgb");
|
|
61
|
+
result.alpha = ((source.alpha ?? 1) * weight) / sum;
|
|
62
|
+
} else {
|
|
63
|
+
result = mix(left, right, rightWeight / sum, {
|
|
64
|
+
space,
|
|
65
|
+
outputSpace: "srgb",
|
|
66
|
+
premultiplied: true,
|
|
67
|
+
});
|
|
57
68
|
}
|
|
58
|
-
|
|
59
|
-
const result = mix(left, right, {
|
|
60
|
-
space,
|
|
61
|
-
outputSpace: "srgb",
|
|
62
|
-
});
|
|
63
|
-
|
|
69
|
+
result.alpha = (result.alpha ?? 1) * alphaMultiplier;
|
|
64
70
|
return `rgba(${(result.coords[0] ?? 0) * 255}, ${(result.coords[1] ?? 0) * 255}, ${(result.coords[2] ?? 0) * 255}, ${result.alpha})`;
|
|
65
71
|
} catch {
|
|
66
72
|
return;
|
|
@@ -97,3 +97,17 @@ export const dropShadow: StyleFunctionResolver = (
|
|
|
97
97
|
}
|
|
98
98
|
: undefined;
|
|
99
99
|
};
|
|
100
|
+
|
|
101
|
+
/** CSS variables may expand to multiple filters; native filter arrays must be flat. */
|
|
102
|
+
export const filter: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
103
|
+
const value: unknown = resolveValue(descriptor[2]);
|
|
104
|
+
if (Array.isArray(value)) {
|
|
105
|
+
const filters: unknown[] = value.flat(Infinity);
|
|
106
|
+
return filters.filter(
|
|
107
|
+
(entry) => entry !== undefined && entry !== "initial",
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
if (value === undefined || value === "initial") return;
|
|
111
|
+
if (value === "none") return null;
|
|
112
|
+
return typeof value === "string" ? value : [value];
|
|
113
|
+
};
|
|
@@ -23,16 +23,17 @@ export const min: StyleFunctionResolver = (resolveValue, value) => {
|
|
|
23
23
|
export const clamp: StyleFunctionResolver = (resolveValue, value) => {
|
|
24
24
|
const args = resolveValue(value[2]);
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
if (!Array.isArray(args)) return;
|
|
27
|
+
|
|
28
|
+
const [minimum, preferred, maximum] = args as unknown[];
|
|
27
29
|
|
|
28
30
|
if (
|
|
29
|
-
|
|
30
|
-
typeof
|
|
31
|
-
typeof
|
|
32
|
-
typeof max !== "number"
|
|
31
|
+
typeof minimum !== "number" ||
|
|
32
|
+
typeof preferred !== "number" ||
|
|
33
|
+
typeof maximum !== "number"
|
|
33
34
|
) {
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
return Math.
|
|
38
|
+
return Math.max(minimum, Math.min(preferred, maximum));
|
|
38
39
|
};
|
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
import type { StyleFunctionResolver } from "../resolve";
|
|
2
2
|
|
|
3
|
+
export const gradientPosition: StyleFunctionResolver = (
|
|
4
|
+
resolveValue,
|
|
5
|
+
value,
|
|
6
|
+
) => {
|
|
7
|
+
const position = resolveValue(value[2]);
|
|
8
|
+
return typeof position === "number" ? `${position}px` : position;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const colorStop: StyleFunctionResolver = (resolveValue, value) => {
|
|
12
|
+
const args = resolveValue(value[2]);
|
|
13
|
+
if (!Array.isArray(args)) return args;
|
|
14
|
+
const [color, position] = args as unknown[];
|
|
15
|
+
if (typeof color !== "string") return;
|
|
16
|
+
if (position === undefined) return color;
|
|
17
|
+
if (typeof position !== "number" && typeof position !== "string") return;
|
|
18
|
+
return `${color} ${typeof position === "number" ? `${position}px` : position}`;
|
|
19
|
+
};
|
|
20
|
+
|
|
3
21
|
export const join: StyleFunctionResolver = (resolveValue, value) => {
|
|
4
22
|
const args = resolveValue(value[2]);
|
|
5
23
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { isStyleDescriptorArray } from "react-native-css/utilities";
|
|
2
2
|
|
|
3
3
|
import type { StyleFunctionResolver } from "../resolve";
|
|
4
|
+
import { scaleFactor } from "../scale-factor";
|
|
4
5
|
|
|
5
6
|
export const scale: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
6
7
|
const args = descriptor[2];
|
|
7
8
|
|
|
8
9
|
if (!isStyleDescriptorArray(args)) {
|
|
9
|
-
return { scale: resolveValue(args) };
|
|
10
|
+
return { scale: scaleFactor(resolveValue(args)) };
|
|
10
11
|
}
|
|
11
12
|
|
|
12
|
-
const x = resolveValue(args[0]);
|
|
13
|
-
const y = resolveValue(args[1]);
|
|
13
|
+
const x = scaleFactor(resolveValue(args[0]));
|
|
14
|
+
const y = scaleFactor(resolveValue(args[1]));
|
|
14
15
|
|
|
15
16
|
const isXValid = typeof x === "string" || typeof x === "number";
|
|
16
17
|
const isYValid = typeof y === "string" || typeof y === "number";
|
|
@@ -18,7 +19,7 @@ export const scale: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
|
18
19
|
if (isXValid && isYValid) {
|
|
19
20
|
return x === y ? { scale: x } : [{ scaleX: x }, { scaleY: y }];
|
|
20
21
|
} else if (isXValid) {
|
|
21
|
-
return {
|
|
22
|
+
return { scale: x };
|
|
22
23
|
} else if (isYValid) {
|
|
23
24
|
return { scaleY: y };
|
|
24
25
|
}
|
|
@@ -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,24 @@ 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
|
+
|
|
268
312
|
return result;
|
|
269
313
|
}
|
|
270
314
|
|
|
@@ -422,21 +466,59 @@ function deepMergeConfig(
|
|
|
422
466
|
* If target is a path, deep merge until we get to the last key
|
|
423
467
|
*/
|
|
424
468
|
if (Array.isArray(config.target)) {
|
|
425
|
-
|
|
426
|
-
const key = config.target[
|
|
427
|
-
|
|
428
|
-
if (key === undefined) {
|
|
429
|
-
return result;
|
|
430
|
-
}
|
|
431
|
-
|
|
469
|
+
if (config.target.length > 1) {
|
|
470
|
+
const key = config.target[0]!;
|
|
432
471
|
result[key] = deepMergeConfig(
|
|
433
|
-
{ source: config.source, target: config.target.slice(
|
|
472
|
+
{ source: config.source, target: config.target.slice(1) },
|
|
434
473
|
left?.[key],
|
|
435
474
|
right?.[key],
|
|
436
475
|
rightIsInline,
|
|
437
476
|
);
|
|
438
477
|
}
|
|
439
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
|
+
|
|
440
522
|
return result;
|
|
441
523
|
}
|
|
442
524
|
|
|
@@ -465,7 +547,11 @@ function nativeStyleMapping(
|
|
|
465
547
|
config: Config,
|
|
466
548
|
props: Record<string, any> | undefined,
|
|
467
549
|
) {
|
|
468
|
-
if (!
|
|
550
|
+
if (!props) {
|
|
551
|
+
return props;
|
|
552
|
+
}
|
|
553
|
+
if (!config.nativeStyleMapping) {
|
|
554
|
+
if (config.target === false) delete props.style;
|
|
469
555
|
return props;
|
|
470
556
|
}
|
|
471
557
|
|
|
@@ -514,5 +600,6 @@ function nativeStyleMapping(
|
|
|
514
600
|
target[lastToken!] = styleValue;
|
|
515
601
|
}
|
|
516
602
|
|
|
603
|
+
if (config.target === false) delete props.style;
|
|
517
604
|
return props;
|
|
518
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
|
+
);
|