react-native-css 0.0.0-nightly.2cfbf16 → 0.0.0-nightly.2e152c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -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 +150 -50
- 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 +190 -101
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/individual-transforms.js +129 -0
- package/dist/commonjs/compiler/individual-transforms.js.map +1 -0
- package/dist/commonjs/compiler/inline-variables.js +47 -1
- package/dist/commonjs/compiler/inline-variables.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 +16 -4
- package/dist/commonjs/compiler/selector-builder.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +32 -13
- 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 +49 -1
- package/dist/commonjs/components/index.cjs.map +1 -1
- package/dist/commonjs/components/react-native-safe-area-context.native.js +10 -0
- package/dist/commonjs/components/react-native-safe-area-context.native.js.map +1 -1
- package/dist/commonjs/jest/index.js +3 -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 +16 -11
- 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/guards.js +7 -0
- package/dist/commonjs/native/conditions/guards.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/objects.js +11 -18
- package/dist/commonjs/native/objects.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 +45 -38
- package/dist/commonjs/native/react/rules.js.map +1 -1
- package/dist/commonjs/native/react/useNativeCss.js +70 -15
- package/dist/commonjs/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/native/react/usePassthrough.js +5 -2
- package/dist/commonjs/native/react/usePassthrough.js.map +1 -1
- package/dist/commonjs/native/reactivity.js +64 -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/calculate-props.js +139 -26
- package/dist/commonjs/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/native/styles/functions/animation-timing.js +2 -1
- package/dist/commonjs/native/styles/functions/animation-timing.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 +15 -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/platform-functions.js +2 -1
- package/dist/commonjs/native/styles/functions/platform-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/string-functions.js +22 -6
- package/dist/commonjs/native/styles/functions/string-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/transform-functions.js +95 -105
- package/dist/commonjs/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/commonjs/native/styles/index.js +182 -123
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/commonjs/native/styles/resolve.js +136 -19
- package/dist/commonjs/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/native/styles/scale-factor.js +12 -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/box-shadow.js +13 -25
- package/dist/commonjs/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/index.js +11 -0
- package/dist/commonjs/native/styles/shorthands/index.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/logical-border-width.js +22 -0
- package/dist/commonjs/native/styles/shorthands/logical-border-width.js.map +1 -0
- package/dist/commonjs/native/styles/shorthands/transform.js +31 -8
- package/dist/commonjs/native/styles/shorthands/transform.js.map +1 -1
- package/dist/commonjs/native/styles/variables.js +165 -48
- package/dist/commonjs/native/styles/variables.js.map +1 -1
- package/dist/commonjs/native-internal/root.js +46 -7
- package/dist/commonjs/native-internal/root.js.map +1 -1
- package/dist/commonjs/native-internal/style-collection.js +22 -37
- 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/equality.js +41 -0
- package/dist/commonjs/utilities/equality.js.map +1 -0
- package/dist/commonjs/utilities/index.js +11 -0
- package/dist/commonjs/utilities/index.js.map +1 -1
- package/dist/commonjs/utilities/style-descriptor.js +32 -8
- 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 +151 -51
- 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 +190 -100
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/individual-transforms.js +125 -0
- package/dist/module/compiler/individual-transforms.js.map +1 -0
- package/dist/module/compiler/inline-variables.js +47 -1
- package/dist/module/compiler/inline-variables.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 +16 -5
- package/dist/module/compiler/selector-builder.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +32 -13
- 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 +49 -1
- package/dist/module/components/index.cjs.map +1 -1
- package/dist/module/components/react-native-safe-area-context.native.js +9 -1
- package/dist/module/components/react-native-safe-area-context.native.js.map +1 -1
- package/dist/module/jest/index.js +3 -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 +18 -13
- 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/guards.js +7 -0
- package/dist/module/native/conditions/guards.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/objects.js +11 -18
- package/dist/module/native/objects.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 +46 -39
- package/dist/module/native/react/rules.js.map +1 -1
- package/dist/module/native/react/useNativeCss.js +73 -18
- package/dist/module/native/react/useNativeCss.js.map +1 -1
- package/dist/module/native/react/usePassthrough.js +5 -2
- package/dist/module/native/react/usePassthrough.js.map +1 -1
- package/dist/module/native/reactivity.js +58 -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/calculate-props.js +139 -26
- package/dist/module/native/styles/calculate-props.js.map +1 -1
- package/dist/module/native/styles/functions/animation-timing.js +2 -1
- package/dist/module/native/styles/functions/animation-timing.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 +13 -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/platform-functions.js +2 -1
- package/dist/module/native/styles/functions/platform-functions.js.map +1 -1
- package/dist/module/native/styles/functions/string-functions.js +19 -5
- package/dist/module/native/styles/functions/string-functions.js.map +1 -1
- package/dist/module/native/styles/functions/transform-functions.js +93 -104
- package/dist/module/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/module/native/styles/index.js +182 -123
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/resolve.js +136 -19
- package/dist/module/native/styles/resolve.js.map +1 -1
- package/dist/module/native/styles/scale-factor.js +8 -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/box-shadow.js +14 -26
- package/dist/module/native/styles/shorthands/box-shadow.js.map +1 -1
- package/dist/module/native/styles/shorthands/index.js +1 -0
- package/dist/module/native/styles/shorthands/index.js.map +1 -1
- package/dist/module/native/styles/shorthands/logical-border-width.js +18 -0
- package/dist/module/native/styles/shorthands/logical-border-width.js.map +1 -0
- package/dist/module/native/styles/shorthands/transform.js +31 -8
- package/dist/module/native/styles/shorthands/transform.js.map +1 -1
- package/dist/module/native/styles/variables.js +166 -50
- package/dist/module/native/styles/variables.js.map +1 -1
- package/dist/module/native-internal/root.js +44 -7
- package/dist/module/native-internal/root.js.map +1 -1
- package/dist/module/native-internal/style-collection.js +10 -37
- 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/equality.js +37 -0
- package/dist/module/utilities/equality.js.map +1 -0
- package/dist/module/utilities/index.js +1 -0
- package/dist/module/utilities/index.js.map +1 -1
- package/dist/module/utilities/style-descriptor.js +30 -8
- 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 +13 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +2 -3
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/individual-transforms.d.ts +10 -0
- package/dist/typescript/commonjs/src/compiler/individual-transforms.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/inline-variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/inline-variables.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 +2 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +10 -11
- 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 +2 -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 +5 -9
- 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/conditions/guards.d.ts +2 -1
- package/dist/typescript/commonjs/src/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/objects.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 +7 -2
- package/dist/typescript/commonjs/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts +0 -3
- 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 +15 -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/calculate-props.d.ts +11 -2
- package/dist/typescript/commonjs/src/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/animation-timing.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/platform-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 +2 -0
- 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 +5 -4
- package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts +4 -1
- 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/box-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/transform.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/variables.d.ts +3 -2
- package/dist/typescript/commonjs/src/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/root.d.ts +38 -0
- package/dist/typescript/commonjs/src/native-internal/root.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/style-collection.d.ts +2 -2
- package/dist/typescript/commonjs/src/native-internal/style-collection.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/equality.d.ts +2 -0
- package/dist/typescript/commonjs/src/utilities/equality.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/utilities/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/utilities/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts +14 -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 +14 -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 -5
- 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/individual-transforms.d.ts +10 -0
- package/dist/typescript/module/src/compiler/individual-transforms.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/inline-variables.d.ts +2 -2
- 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 +3 -2
- 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 +10 -11
- 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 +2 -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 +6 -10
- 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 +4 -3
- 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/objects.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 +9 -4
- package/dist/typescript/module/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts +4 -7
- 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 +15 -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 +13 -4
- 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 +3 -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 +9 -8
- 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 +7 -4
- 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 +4 -3
- 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 +39 -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 +3 -3
- 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/equality.d.ts +2 -0
- package/dist/typescript/module/src/utilities/equality.d.ts.map +1 -0
- package/dist/typescript/module/src/utilities/index.d.ts +4 -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 +14 -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/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 +216 -69
- package/src/compiler/compiler.types.ts +17 -0
- package/src/compiler/container-query.ts +8 -3
- package/src/compiler/declarations.ts +385 -247
- package/src/compiler/individual-transforms.ts +129 -0
- package/src/compiler/inline-variables.ts +67 -0
- package/src/compiler/lightningcss-loader.ts +16 -15
- package/src/compiler/media-query.ts +20 -9
- package/src/compiler/selector-builder.ts +32 -5
- package/src/compiler/stylesheet.ts +49 -19
- package/src/components/ImageBackground.tsx +2 -6
- package/src/components/KeyboardAvoidingView.tsx +2 -3
- package/src/components/index.cts +49 -1
- package/src/components/react-native-safe-area-context.native.tsx +20 -0
- package/src/jest/index.ts +3 -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 +26 -18
- package/src/native/conditions/attributes.ts +26 -9
- package/src/native/conditions/container-query.ts +11 -9
- package/src/native/conditions/guards.ts +13 -1
- package/src/native/conditions/media-query.ts +1 -1
- package/src/native/objects.ts +12 -22
- package/src/native/react/interaction.ts +11 -6
- package/src/native/react/rules.ts +58 -45
- package/src/native/react/useNativeCss.ts +85 -18
- package/src/native/react/usePassthrough.ts +3 -2
- package/src/native/reactivity.ts +79 -24
- package/src/native/reanimated.ts +24 -5
- package/src/native/styles/calculate-props.ts +179 -28
- package/src/native/styles/functions/animation-timing.ts +3 -1
- package/src/native/styles/functions/color-mix.ts +45 -39
- package/src/native/styles/functions/filters.ts +15 -0
- package/src/native/styles/functions/numeric-functions.ts +7 -6
- package/src/native/styles/functions/platform-functions.ts +3 -1
- package/src/native/styles/functions/string-functions.ts +25 -5
- package/src/native/styles/functions/transform-functions.ts +111 -64
- package/src/native/styles/index.ts +208 -144
- package/src/native/styles/resolve.ts +188 -29
- package/src/native/styles/scale-factor.ts +9 -0
- package/src/native/styles/shorthands/animation.ts +8 -2
- package/src/native/styles/shorthands/box-shadow.ts +20 -34
- package/src/native/styles/shorthands/index.ts +1 -0
- package/src/native/styles/shorthands/logical-border-width.ts +32 -0
- package/src/native/styles/shorthands/transform.ts +36 -11
- package/src/native/styles/variables.ts +242 -45
- package/src/native-internal/root.ts +83 -13
- package/src/native-internal/style-collection.ts +21 -46
- 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/equality.ts +41 -0
- package/src/utilities/index.ts +1 -0
- package/src/utilities/style-descriptor.ts +36 -14
- 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
|
@@ -3,119 +3,109 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.translate = exports.scale = exports.rotate = void 0;
|
|
6
|
+
exports.translate = exports.scale = exports.rotate = exports.individualTranslate = exports.individualScale = void 0;
|
|
7
7
|
var _utilities = require("react-native-css/utilities");
|
|
8
|
+
var _scaleFactor = require("../scale-factor.js");
|
|
9
|
+
// A component left without a valid value makes the declaration invalid at computed-value time (css-variables-1 §3.1), which null carries
|
|
8
10
|
const scale = (resolveValue, descriptor) => {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
return {
|
|
12
|
-
scale: resolveValue(args)
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
const x = resolveValue(args[0]);
|
|
16
|
-
const y = resolveValue(args[1]);
|
|
17
|
-
const isXValid = typeof x === "string" || typeof x === "number";
|
|
18
|
-
const isYValid = typeof y === "string" || typeof y === "number";
|
|
19
|
-
if (isXValid && isYValid) {
|
|
20
|
-
return x === y ? {
|
|
21
|
-
scale: x
|
|
22
|
-
} : [{
|
|
23
|
-
scaleX: x
|
|
24
|
-
}, {
|
|
25
|
-
scaleY: y
|
|
26
|
-
}];
|
|
27
|
-
} else if (isXValid) {
|
|
28
|
-
return {
|
|
29
|
-
scaleX: x
|
|
30
|
-
};
|
|
31
|
-
} else if (isYValid) {
|
|
32
|
-
return {
|
|
33
|
-
scaleY: y
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
return;
|
|
11
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
12
|
+
return scalePair(operands, operands.length);
|
|
37
13
|
};
|
|
38
14
|
exports.scale = scale;
|
|
39
15
|
const rotate = (resolveValue, descriptor) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
const x = resolveValue(args[0]);
|
|
47
|
-
const y = resolveValue(args[1]);
|
|
48
|
-
const z = resolveValue(args[2]);
|
|
49
|
-
const isXValid = typeof x === "string" || typeof x === "number";
|
|
50
|
-
const isYValid = typeof y === "string" || typeof y === "number";
|
|
51
|
-
const isZValid = typeof z === "string" || typeof z === "number";
|
|
52
|
-
if (isXValid && isYValid && isZValid) {
|
|
53
|
-
return [{
|
|
54
|
-
rotateX: x
|
|
55
|
-
}, {
|
|
56
|
-
rotateY: y
|
|
57
|
-
}, {
|
|
58
|
-
rotateZ: z
|
|
59
|
-
}];
|
|
60
|
-
} else if (isXValid && isYValid) {
|
|
61
|
-
return [{
|
|
62
|
-
rotateX: x
|
|
63
|
-
}, {
|
|
64
|
-
rotateY: y
|
|
65
|
-
}];
|
|
66
|
-
} else if (isXValid && isZValid) {
|
|
67
|
-
return [{
|
|
68
|
-
rotateX: x
|
|
69
|
-
}, {
|
|
70
|
-
rotateZ: z
|
|
71
|
-
}];
|
|
72
|
-
} else if (isYValid && isZValid) {
|
|
73
|
-
return [{
|
|
74
|
-
rotateY: y
|
|
75
|
-
}, {
|
|
76
|
-
rotateZ: z
|
|
77
|
-
}];
|
|
78
|
-
} else if (isXValid) {
|
|
79
|
-
return {
|
|
80
|
-
rotateX: x
|
|
81
|
-
};
|
|
82
|
-
} else if (isYValid) {
|
|
83
|
-
return {
|
|
84
|
-
rotateY: y
|
|
85
|
-
};
|
|
86
|
-
} else if (isZValid) {
|
|
87
|
-
return {
|
|
88
|
-
rotateZ: z
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
return;
|
|
16
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
17
|
+
const angle = operands[0];
|
|
18
|
+
return operands.length === 1 && isTransformComponent(angle) ? {
|
|
19
|
+
rotate: angle
|
|
20
|
+
} : null;
|
|
92
21
|
};
|
|
93
22
|
exports.rotate = rotate;
|
|
94
23
|
const translate = (resolveValue, descriptor) => {
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
const x = resolveValue(args[0]);
|
|
100
|
-
const y = resolveValue(args[1]);
|
|
101
|
-
const isXValid = typeof x === "string" || typeof x === "number";
|
|
102
|
-
const isYValid = typeof y === "string" || typeof y === "number";
|
|
103
|
-
if (isXValid && isYValid) {
|
|
104
|
-
return [{
|
|
105
|
-
translateX: x
|
|
106
|
-
}, {
|
|
107
|
-
translateY: y
|
|
108
|
-
}];
|
|
109
|
-
} else if (isXValid) {
|
|
110
|
-
return {
|
|
111
|
-
translateX: x
|
|
112
|
-
};
|
|
113
|
-
} else if (isYValid) {
|
|
114
|
-
return {
|
|
115
|
-
translateY: y
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
return;
|
|
24
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
25
|
+
return translatePair(operands, operands.length);
|
|
119
26
|
};
|
|
27
|
+
|
|
28
|
+
// css-transforms-2 §3: `translate: none | <length-percentage> [<length-percentage> <length>?]?`, and React Native has no z axis to move along
|
|
120
29
|
exports.translate = translate;
|
|
30
|
+
const individualTranslate = (resolveValue, descriptor) => {
|
|
31
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
32
|
+
const z = operands.length > 2 ? operands[2] : 0;
|
|
33
|
+
return operands.length <= 3 && typeof z === "number" ? translatePair(operands, Math.min(operands.length, 2)) : null;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// css-transforms-2 §3: `scale: none | [<number> | <percentage>]{1,3}`, and React Native has no z axis to scale along
|
|
37
|
+
exports.individualTranslate = individualTranslate;
|
|
38
|
+
const individualScale = (resolveValue, descriptor) => {
|
|
39
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
40
|
+
const z = operands.length > 2 ? operands[2] : 1;
|
|
41
|
+
return operands.length <= 3 && (0, _scaleFactor.scaleFactor)(z) !== null ? scalePair(operands, Math.min(operands.length, 2)) : null;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// The first `count` operands, so a caller can leave out a z without copying the list
|
|
45
|
+
exports.individualScale = individualScale;
|
|
46
|
+
function scalePair(operands, count) {
|
|
47
|
+
const x = (0, _scaleFactor.scaleFactor)(operands[0]);
|
|
48
|
+
const y = count > 1 ? (0, _scaleFactor.scaleFactor)(operands[1]) : x;
|
|
49
|
+
if (count > 2 || x === null || y === null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return [{
|
|
53
|
+
scaleX: x
|
|
54
|
+
}, {
|
|
55
|
+
scaleY: y
|
|
56
|
+
}];
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// `translate(x)` is `translate(x, 0)` (css-transforms-1 §9)
|
|
60
|
+
function translatePair(operands, count) {
|
|
61
|
+
const x = operands[0];
|
|
62
|
+
const y = count > 1 ? operands[1] : 0;
|
|
63
|
+
if (count > 2 || !isTransformComponent(x) || !isTransformComponent(y)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return [{
|
|
67
|
+
translateX: x
|
|
68
|
+
}, {
|
|
69
|
+
translateY: y
|
|
70
|
+
}];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** A comma-separated argument list holds each argument as the array of its tokens */
|
|
74
|
+
function argument(resolveValue, arg) {
|
|
75
|
+
// A descriptor, never a resolved value: a style function starts with its {}
|
|
76
|
+
// marker, so an array of one entry that isn't a plain object is an item.
|
|
77
|
+
// This skips isStyleFunction's Object.keys, which resolveValue runs anyway
|
|
78
|
+
const token = Array.isArray(arg) && arg.length === 1 ? arg[0] : undefined;
|
|
79
|
+
return resolveValue(token !== undefined && (typeof token !== "object" || Array.isArray(token)) ? token : arg);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// A var() substitutes its tokens before the grammar reads them, so it can supply one operand, several, or the whole list (css-variables-1 §3)
|
|
83
|
+
function resolveOperands(resolveValue, args) {
|
|
84
|
+
const operands = [];
|
|
85
|
+
if ((0, _utilities.isStyleDescriptorArray)(args)) {
|
|
86
|
+
for (const arg of args) {
|
|
87
|
+
pushOperand(operands, argument(resolveValue, arg));
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
// A lone var()'s comma-separated list supplies its items as the operands
|
|
91
|
+
pushOperand(operands, (0, _utilities.commaListItems)(resolveValue(args)));
|
|
92
|
+
}
|
|
93
|
+
return operands;
|
|
94
|
+
}
|
|
95
|
+
function pushOperand(operands, operand) {
|
|
96
|
+
if (Array.isArray(operand)) {
|
|
97
|
+
for (const item of operand) operands.push(item);
|
|
98
|
+
} else {
|
|
99
|
+
operands.push(operand);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// A number, or a dimension such as "45deg" or "-50%". A keyword such as none
|
|
104
|
+
// from a var() is not one: React Native throws on it, and the property is none
|
|
105
|
+
function isTransformComponent(value) {
|
|
106
|
+
if (typeof value === "number") return true;
|
|
107
|
+
if (typeof value !== "string") return false;
|
|
108
|
+
const first = value.charCodeAt(0);
|
|
109
|
+
return first >= 48 && first <= 57 || first === 45 || first === 43 || first === 46;
|
|
110
|
+
}
|
|
121
111
|
//# sourceMappingURL=transform-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utilities","require","scale","resolveValue","descriptor","
|
|
1
|
+
{"version":3,"names":["_utilities","require","_scaleFactor","scale","resolveValue","descriptor","operands","resolveOperands","scalePair","length","exports","rotate","angle","isTransformComponent","translate","translatePair","individualTranslate","z","Math","min","individualScale","scaleFactor","count","x","y","scaleX","scaleY","translateX","translateY","argument","arg","token","Array","isArray","undefined","args","isStyleDescriptorArray","pushOperand","commaListItems","operand","item","push","value","first","charCodeAt"],"sourceRoot":"../../../../../src","sources":["native/styles/functions/transform-functions.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -45,44 +45,20 @@ function hasNonOverlappingProperties(left, right) {
|
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
/**
|
|
49
|
-
* Flattens a style array into a single object when possible, with rightmost values taking precedence.
|
|
50
|
-
* Returns the original array if it contains any non-plain objects, arrays, or CSS variable objects.
|
|
51
|
-
*
|
|
52
|
-
* Note: This function assumes the input array has already been filtered (e.g., by filterCssVariables),
|
|
53
|
-
* so empty arrays should not reach this function. If they do, they will be treated as non-flattenable.
|
|
54
|
-
*
|
|
55
|
-
* @param styleArray - The style array to potentially flatten
|
|
56
|
-
* @returns A single merged object if all items are plain objects, otherwise the original array
|
|
57
|
-
*/
|
|
58
|
-
function flattenStyleArray(styleArray) {
|
|
59
|
-
// Check if we can flatten to a single object (all items are plain objects)
|
|
60
|
-
for (const item of styleArray) {
|
|
61
|
-
// Use explicit null check instead of !item to allow falsy values like 0 or false
|
|
62
|
-
if (item == null || typeof item !== "object" || Array.isArray(item) || Object.prototype.hasOwnProperty.call(item, _reactivity.VAR_SYMBOL)) {
|
|
63
|
-
return styleArray;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Use reduce to avoid spread operator performance issues with large arrays
|
|
68
|
-
return styleArray.reduce((acc, item) => Object.assign(acc, item), {});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
48
|
/**
|
|
72
49
|
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
73
50
|
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
74
51
|
*
|
|
75
52
|
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
76
53
|
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
77
|
-
* @returns The
|
|
78
|
-
* should be filtered out (e.g., empty arrays, objects with only VAR_SYMBOL properties)
|
|
54
|
+
* @returns The value with CSS variables removed, or `undefined` if the entire value should be filtered out
|
|
79
55
|
*
|
|
80
56
|
* Filtering behavior:
|
|
81
57
|
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
82
|
-
* -
|
|
83
|
-
* -
|
|
84
|
-
* -
|
|
85
|
-
* -
|
|
58
|
+
* - A value holding no CSS variable comes back as the same object, uncopied, so an animated style keeps its identity
|
|
59
|
+
* - A value holding some comes back copied without them, or `undefined` if nothing remains
|
|
60
|
+
* - Class instances (e.g. an Animated.Value) and primitives: returned as-is
|
|
61
|
+
* - A top-level style object with no string keys (`{}`, or only Symbol keys): returns `undefined`
|
|
86
62
|
*
|
|
87
63
|
* @example
|
|
88
64
|
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
@@ -91,45 +67,64 @@ function flattenStyleArray(styleArray) {
|
|
|
91
67
|
*/
|
|
92
68
|
function filterCssVariables(value, depth = 0) {
|
|
93
69
|
// Prevent stack overflow on deeply nested structures
|
|
94
|
-
if (depth > 100) {
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
if (value === null || value === undefined) {
|
|
70
|
+
if (depth > 100 || typeof value !== "object" || value === null) {
|
|
98
71
|
return value;
|
|
99
72
|
}
|
|
73
|
+
|
|
74
|
+
// Nothing is copied until a CSS variable is found, so an inline style keeps its identity, as an animated style's handle needs
|
|
100
75
|
if (Array.isArray(value)) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
76
|
+
let filtered;
|
|
77
|
+
for (let index = 0; index < value.length; index++) {
|
|
78
|
+
const item = value[index];
|
|
79
|
+
const kept = filterCssVariables(item, depth + 1);
|
|
80
|
+
// No copy yet: skip unchanged items, then copy them all with the slice once one changes
|
|
81
|
+
if (filtered === undefined) {
|
|
82
|
+
if (kept === item) continue;
|
|
83
|
+
filtered = value.slice(0, index);
|
|
107
84
|
}
|
|
85
|
+
if (kept !== undefined) filtered.push(kept);
|
|
108
86
|
}
|
|
87
|
+
if (filtered === undefined) return value;
|
|
109
88
|
return filtered.length > 0 ? filtered : undefined;
|
|
110
89
|
}
|
|
111
|
-
if (typeof value === "object") {
|
|
112
|
-
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
113
|
-
if (Object.prototype.hasOwnProperty.call(value, _reactivity.VAR_SYMBOL)) {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
90
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
91
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
92
|
+
if (Object.prototype.hasOwnProperty.call(value, _reactivity.VAR_SYMBOL)) {
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
120
95
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
96
|
+
// A class instance, such as an Animated.Value, passes as it is: a plain copy detaches it from its animation
|
|
97
|
+
const prototype = Object.getPrototypeOf(value);
|
|
98
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
99
|
+
return value;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Object.keys only iterates own string properties, so Symbol properties are left out of a copy
|
|
103
|
+
const keys = Object.keys(value);
|
|
104
|
+
let filtered;
|
|
105
|
+
for (let index = 0; index < keys.length; index++) {
|
|
106
|
+
const key = keys[index];
|
|
107
|
+
const item = value[key];
|
|
108
|
+
const kept = filterCssVariables(item, depth + 1);
|
|
109
|
+
// No copy yet: skip unchanged keys, then copy them all below once one changes
|
|
110
|
+
if (filtered === undefined) {
|
|
111
|
+
if (kept === item) continue;
|
|
112
|
+
// Objects have no slice: copy the unchanged keys before this one, performantly / avoiding allocations
|
|
113
|
+
filtered = {};
|
|
114
|
+
for (let earlier = 0; earlier < index; earlier++) {
|
|
115
|
+
const earlierKey = keys[earlier];
|
|
116
|
+
filtered[earlierKey] = value[earlierKey];
|
|
128
117
|
}
|
|
129
118
|
}
|
|
130
|
-
|
|
119
|
+
if (kept !== undefined) filtered[key] = kept;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// A style object with no string keys, such as {}, adds nothing, as before
|
|
123
|
+
if (filtered === undefined) {
|
|
124
|
+
return depth === 0 && keys.length === 0 ? undefined : value;
|
|
131
125
|
}
|
|
132
|
-
return
|
|
126
|
+
for (const _ in filtered) return filtered;
|
|
127
|
+
return undefined;
|
|
133
128
|
}
|
|
134
129
|
const stylesFamily = exports.stylesFamily = (0, _reactivity.family)((hash, rules) => {
|
|
135
130
|
const sortedRules = Array.from(rules).sort(_utilities.specificityCompareFn);
|
|
@@ -138,22 +133,45 @@ const stylesFamily = exports.stylesFamily = (0, _reactivity.family)((hash, rules
|
|
|
138
133
|
/**
|
|
139
134
|
* A family is a map, so we need to cleanup the observers when the the hash is no longer used
|
|
140
135
|
*/
|
|
136
|
+
const unsubscribe = obs.unsubscribe;
|
|
141
137
|
return Object.assign(obs, {
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
unsubscribe: effect => {
|
|
139
|
+
unsubscribe(effect);
|
|
144
140
|
if (obs.observers.size === 0) {
|
|
145
141
|
stylesFamily.delete(hash);
|
|
146
142
|
}
|
|
147
143
|
}
|
|
148
144
|
});
|
|
149
145
|
});
|
|
150
|
-
function getStyledProps(state, inline) {
|
|
146
|
+
function getStyledProps(state, inline, adaptProps = props => props) {
|
|
151
147
|
let result;
|
|
152
148
|
const styledProps = state.stylesObs?.get(state.styleEffect);
|
|
149
|
+
|
|
150
|
+
// Each config merges a complete props object. Preserve its full target path
|
|
151
|
+
// before the next config merges unrelated inline props over that object.
|
|
152
|
+
const computedTargets = [];
|
|
153
|
+
const consumedSources = [];
|
|
153
154
|
for (const config of state.configs) {
|
|
154
|
-
result = deepMergeConfig(config, nativeStyleMapping(config, styledProps?.normal), inline, true);
|
|
155
|
+
result = deepMergeConfig(config, nativeStyleMapping(config, adaptProps(styledProps?.normal)), inline, true);
|
|
155
156
|
if (styledProps?.important) {
|
|
156
|
-
result = deepMergeConfig(config, result, nativeStyleMapping(config, styledProps.important));
|
|
157
|
+
result = deepMergeConfig(config, result, nativeStyleMapping(config, adaptProps(styledProps.important)));
|
|
158
|
+
}
|
|
159
|
+
if (result && config.target) {
|
|
160
|
+
const path = Array.isArray(config.target) ? config.target : [config.target];
|
|
161
|
+
let target = result;
|
|
162
|
+
for (const key of path.slice(0, -1)) target = target?.[key];
|
|
163
|
+
const key = path[path.length - 1];
|
|
164
|
+
if (target && key && key in target) {
|
|
165
|
+
computedTargets.push({
|
|
166
|
+
path,
|
|
167
|
+
value: target[key]
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Track consumed className sources for cleanup
|
|
173
|
+
if (config.source !== config.target) {
|
|
174
|
+
consumedSources.push(config.source);
|
|
157
175
|
}
|
|
158
176
|
|
|
159
177
|
// Apply the handlers
|
|
@@ -178,6 +196,27 @@ function getStyledProps(state, inline) {
|
|
|
178
196
|
result.onLayout = (0, _interaction.getInteractionHandler)(state.ruleEffectGetter, "onLayout", inline?.onLayout);
|
|
179
197
|
}
|
|
180
198
|
}
|
|
199
|
+
|
|
200
|
+
// Restore correctly-merged target props that may have been overwritten
|
|
201
|
+
// by later config iterations' Object.assign({}, left, right)
|
|
202
|
+
if (result) {
|
|
203
|
+
for (const {
|
|
204
|
+
path,
|
|
205
|
+
value
|
|
206
|
+
} of computedTargets) {
|
|
207
|
+
let target = result;
|
|
208
|
+
for (const key of path.slice(0, -1)) {
|
|
209
|
+
const existing = target[key];
|
|
210
|
+
target = target[key] = Array.isArray(existing) ? [...existing] : {
|
|
211
|
+
...existing
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
target[path[path.length - 1]] = value;
|
|
215
|
+
}
|
|
216
|
+
for (const source of consumedSources) {
|
|
217
|
+
delete result[source];
|
|
218
|
+
}
|
|
219
|
+
}
|
|
181
220
|
return result;
|
|
182
221
|
}
|
|
183
222
|
|
|
@@ -223,6 +262,14 @@ function mergeDefinedProps(left, right) {
|
|
|
223
262
|
}
|
|
224
263
|
return result;
|
|
225
264
|
}
|
|
265
|
+
function isStyleCallback(value) {
|
|
266
|
+
return typeof value === "function";
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// Pressable calls a function style with its pressed state, so a merge keeps a callback a callback
|
|
270
|
+
function composeStyleCallback(left, right) {
|
|
271
|
+
return state => [isStyleCallback(left) ? left(state) : left, isStyleCallback(right) ? right(state) : right];
|
|
272
|
+
}
|
|
226
273
|
function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
227
274
|
if (!right) {
|
|
228
275
|
return {
|
|
@@ -235,69 +282,24 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
235
282
|
if (config.target) {
|
|
236
283
|
if (Array.isArray(config.target) && config.target.length === 1 && config.target[0] === "style") {
|
|
237
284
|
// Special handling for style target when we have inline styles
|
|
238
|
-
result =
|
|
239
|
-
...left,
|
|
240
|
-
...right
|
|
241
|
-
};
|
|
285
|
+
result = mergeDefinedProps(left, right);
|
|
242
286
|
|
|
243
287
|
// Handle null/undefined inline styles
|
|
244
288
|
if (right?.style === null || right?.style === undefined) {
|
|
245
289
|
if (left?.style) {
|
|
246
290
|
result.style = left.style;
|
|
247
291
|
}
|
|
248
|
-
} else if (rightIsInline && right?.style) {
|
|
249
|
-
// Filter inline styles if rightIsInline is true
|
|
250
|
-
const filteredRightStyle = filterCssVariables(right.style);
|
|
251
|
-
if (left?.style) {
|
|
252
|
-
if (!filteredRightStyle) {
|
|
253
|
-
// All inline styles were CSS variables, only use left
|
|
254
|
-
result.style = left.style;
|
|
255
|
-
} else {
|
|
256
|
-
const leftStyle = left.style;
|
|
257
|
-
|
|
258
|
-
// For arrays or objects, check if we need to create a style array
|
|
259
|
-
const leftIsObject = typeof leftStyle === "object" && !Array.isArray(leftStyle);
|
|
260
|
-
const rightIsObject = typeof filteredRightStyle === "object" && !Array.isArray(filteredRightStyle);
|
|
261
|
-
if (leftIsObject && rightIsObject) {
|
|
262
|
-
if (hasNonOverlappingProperties(leftStyle, filteredRightStyle)) {
|
|
263
|
-
result.style = [leftStyle, filteredRightStyle];
|
|
264
|
-
} else {
|
|
265
|
-
// All left properties are in right, right overrides
|
|
266
|
-
result.style = filteredRightStyle;
|
|
267
|
-
}
|
|
268
|
-
} else {
|
|
269
|
-
// One or both are arrays, merge them
|
|
270
|
-
result.style = [leftStyle, filteredRightStyle];
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
} else {
|
|
274
|
-
// No left style, just use filtered right
|
|
275
|
-
if (filteredRightStyle) {
|
|
276
|
-
result.style = filteredRightStyle;
|
|
277
|
-
} else {
|
|
278
|
-
// All filtered out, remove style prop
|
|
279
|
-
delete result.style;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
292
|
} else if (!rightIsInline && right?.style) {
|
|
283
293
|
// Merging non-inline styles (e.g., important styles)
|
|
284
294
|
if (left?.style) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
// Both are objects, check for overlaps
|
|
291
|
-
if (hasNonOverlappingProperties(left.style, right.style)) {
|
|
292
|
-
result.style = flattenStyleArray([left.style, right.style]);
|
|
293
|
-
} else {
|
|
294
|
-
// All left properties are overridden by right
|
|
295
|
-
result.style = right.style;
|
|
296
|
-
}
|
|
295
|
+
if (isStyleCallback(left.style) || isStyleCallback(right.style)) {
|
|
296
|
+
result.style = composeStyleCallback(left.style, right.style);
|
|
297
|
+
} else if (typeof left.style === "object" && !Array.isArray(left.style) && typeof right.style === "object" && !hasNonOverlappingProperties(left.style, right.style)) {
|
|
298
|
+
// All left properties are overridden by right
|
|
299
|
+
result.style = right.style;
|
|
297
300
|
} else {
|
|
298
|
-
//
|
|
299
|
-
|
|
300
|
-
result.style = flattenStyleArray(combined);
|
|
301
|
+
// Layered rather than flattened: a copy would merge an inline animated style's handle into a plain object
|
|
302
|
+
result.style = Array.isArray(left.style) ? [...left.style, right.style] : [left.style, right.style];
|
|
301
303
|
}
|
|
302
304
|
}
|
|
303
305
|
}
|
|
@@ -315,16 +317,57 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
315
317
|
* If target is a path, deep merge until we get to the last key
|
|
316
318
|
*/
|
|
317
319
|
if (Array.isArray(config.target)) {
|
|
318
|
-
|
|
319
|
-
const key = config.target[
|
|
320
|
-
if (key === undefined) {
|
|
321
|
-
return result;
|
|
322
|
-
}
|
|
320
|
+
if (config.target.length > 1) {
|
|
321
|
+
const key = config.target[0];
|
|
323
322
|
result[key] = deepMergeConfig({
|
|
324
323
|
source: config.source,
|
|
325
|
-
target: config.target.slice(
|
|
324
|
+
target: config.target.slice(1)
|
|
326
325
|
}, left?.[key], right?.[key], rightIsInline);
|
|
327
326
|
}
|
|
327
|
+
|
|
328
|
+
// For length-1 array targets (e.g. ["contentContainerStyle"]), the loop
|
|
329
|
+
// above runs 0 iterations. Merge the target prop so inline styles don't
|
|
330
|
+
// silently overwrite className-computed styles (same as string target path).
|
|
331
|
+
const finalKey = config.target[config.target.length - 1];
|
|
332
|
+
if (config.target.length === 1 && finalKey && rightIsInline) {
|
|
333
|
+
let rightValue = right?.[finalKey];
|
|
334
|
+
if (rightValue !== undefined) {
|
|
335
|
+
rightValue = filterCssVariables(rightValue);
|
|
336
|
+
}
|
|
337
|
+
if (rightValue === undefined || rightValue === null) {
|
|
338
|
+
// Inline is empty or fully filtered — preserve className-computed value
|
|
339
|
+
if (left && finalKey in left) {
|
|
340
|
+
result[finalKey] = left[finalKey];
|
|
341
|
+
} else {
|
|
342
|
+
// No left value either — remove unfiltered inline value from result
|
|
343
|
+
delete result[finalKey];
|
|
344
|
+
}
|
|
345
|
+
} else if (left && finalKey in left) {
|
|
346
|
+
const leftValue = left[finalKey];
|
|
347
|
+
const leftIsObj = typeof leftValue === "object" && leftValue !== null && !Array.isArray(leftValue);
|
|
348
|
+
const rightIsObj = typeof rightValue === "object" && rightValue !== null && !Array.isArray(rightValue);
|
|
349
|
+
if (isStyleCallback(leftValue) || isStyleCallback(rightValue)) {
|
|
350
|
+
result[finalKey] = composeStyleCallback(leftValue, rightValue);
|
|
351
|
+
} else if (leftIsObj && rightIsObj) {
|
|
352
|
+
if (hasNonOverlappingProperties(leftValue, rightValue)) {
|
|
353
|
+
result[finalKey] = [leftValue, rightValue];
|
|
354
|
+
} else {
|
|
355
|
+
// All left keys are in right — use filtered right value
|
|
356
|
+
result[finalKey] = rightValue;
|
|
357
|
+
}
|
|
358
|
+
} else {
|
|
359
|
+
result[finalKey] = [leftValue, rightValue];
|
|
360
|
+
}
|
|
361
|
+
} else {
|
|
362
|
+
// No left value — use filtered right value (not the unfiltered one from mergeDefinedProps)
|
|
363
|
+
result[finalKey] = rightValue;
|
|
364
|
+
}
|
|
365
|
+
} else if (config.target.length === 1 && finalKey && finalKey !== "style" && left?.[finalKey] !== undefined && right[finalKey] !== undefined) {
|
|
366
|
+
// An !important value layers over the class's and the inline value rather than replacing both
|
|
367
|
+
const leftValue = left[finalKey];
|
|
368
|
+
const rightValue = right[finalKey];
|
|
369
|
+
result[finalKey] = isStyleCallback(leftValue) || isStyleCallback(rightValue) ? composeStyleCallback(leftValue, rightValue) : [leftValue, rightValue];
|
|
370
|
+
}
|
|
328
371
|
return result;
|
|
329
372
|
}
|
|
330
373
|
const target = config.target;
|
|
@@ -337,13 +380,28 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
337
380
|
if (rightIsInline && rightValue !== undefined) {
|
|
338
381
|
rightValue = filterCssVariables(rightValue);
|
|
339
382
|
}
|
|
340
|
-
if (rightValue
|
|
341
|
-
|
|
383
|
+
if (rightValue === undefined && rightIsInline && target in right) {
|
|
384
|
+
// An inline value that held only CSS variables leaves the class's, and never reaches the component itself
|
|
385
|
+
if (left && target in left) {
|
|
386
|
+
result[target] = left[target];
|
|
387
|
+
} else {
|
|
388
|
+
delete result[target];
|
|
389
|
+
}
|
|
390
|
+
} else if (rightValue !== undefined) {
|
|
391
|
+
if (left && target in left) {
|
|
392
|
+
result[target] = isStyleCallback(left[target]) || isStyleCallback(rightValue) ? composeStyleCallback(left[target], rightValue) : [left[target], rightValue];
|
|
393
|
+
} else {
|
|
394
|
+
result[target] = rightValue;
|
|
395
|
+
}
|
|
342
396
|
}
|
|
343
397
|
return result;
|
|
344
398
|
}
|
|
345
399
|
function nativeStyleMapping(config, props) {
|
|
346
|
-
if (!
|
|
400
|
+
if (!props) {
|
|
401
|
+
return props;
|
|
402
|
+
}
|
|
403
|
+
if (!config.nativeStyleMapping) {
|
|
404
|
+
if (config.target === false) delete props.style;
|
|
347
405
|
return props;
|
|
348
406
|
}
|
|
349
407
|
let source;
|
|
@@ -381,6 +439,7 @@ function nativeStyleMapping(config, props) {
|
|
|
381
439
|
}
|
|
382
440
|
target[lastToken] = styleValue;
|
|
383
441
|
}
|
|
442
|
+
if (config.target === false) delete props.style;
|
|
384
443
|
return props;
|
|
385
444
|
}
|
|
386
445
|
//# sourceMappingURL=index.js.map
|