react-native-css 0.0.0-nightly.2c68396 → 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 +35 -5
- 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 +198 -39
- 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 +33 -9
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +1 -3
- package/dist/commonjs/compiler/supports.js.map +1 -1
- package/dist/commonjs/components/FlatList.js +1 -0
- package/dist/commonjs/components/FlatList.js.map +1 -1
- package/dist/commonjs/components/ImageBackground.js +2 -6
- package/dist/commonjs/components/ImageBackground.js.map +1 -1
- package/dist/commonjs/components/KeyboardAvoidingView.js +2 -3
- package/dist/commonjs/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/commonjs/components/SafeAreaProvider.js +13 -0
- package/dist/commonjs/components/SafeAreaProvider.js.map +1 -0
- package/dist/commonjs/components/index.cjs +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 +19 -5
- package/dist/commonjs/native/styles/functions/filters.js.map +1 -1
- package/dist/commonjs/native/styles/functions/numeric-functions.js +4 -3
- package/dist/commonjs/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/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 +303 -49
- 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/_handler.js +10 -0
- package/dist/commonjs/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/animation.js +6 -3
- package/dist/commonjs/native/styles/shorthands/animation.js.map +1 -1
- package/dist/commonjs/native/styles/shorthands/box-shadow.js +41 -20
- 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 +2 -2
- package/dist/commonjs/web/api.js.map +1 -1
- package/dist/commonjs/web/assign-style.js +4 -1
- package/dist/commonjs/web/assign-style.js.map +1 -1
- package/dist/module/babel/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 +200 -41
- 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 +33 -9
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +1 -3
- package/dist/module/compiler/supports.js.map +1 -1
- package/dist/module/components/FlatList.js +1 -0
- package/dist/module/components/FlatList.js.map +1 -1
- package/dist/module/components/ImageBackground.js +2 -6
- package/dist/module/components/ImageBackground.js.map +1 -1
- package/dist/module/components/KeyboardAvoidingView.js +2 -3
- package/dist/module/components/KeyboardAvoidingView.js.map +1 -1
- package/dist/module/components/SafeAreaProvider.js +4 -0
- package/dist/module/components/SafeAreaProvider.js.map +1 -0
- package/dist/module/components/index.cjs +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 +17 -4
- package/dist/module/native/styles/functions/filters.js.map +1 -1
- package/dist/module/native/styles/functions/numeric-functions.js +4 -3
- package/dist/module/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/module/native/styles/functions/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 +304 -49
- 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/_handler.js +11 -1
- package/dist/module/native/styles/shorthands/_handler.js.map +1 -1
- package/dist/module/native/styles/shorthands/animation.js +6 -3
- package/dist/module/native/styles/shorthands/animation.js.map +1 -1
- package/dist/module/native/styles/shorthands/box-shadow.js +43 -21
- 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 +2 -2
- package/dist/module/web/api.js.map +1 -1
- package/dist/module/web/assign-style.js +4 -1
- package/dist/module/web/assign-style.js.map +1 -1
- package/dist/typescript/commonjs/src/babel/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 -10
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +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/_handler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/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 -10
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -1
- package/dist/typescript/module/src/components/ImageBackground.d.ts.map +1 -1
- package/dist/typescript/module/src/components/KeyboardAvoidingView.d.ts.map +1 -1
- package/dist/typescript/module/src/components/SafeAreaProvider.d.ts +2 -0
- package/dist/typescript/module/src/components/SafeAreaProvider.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +16 -16
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +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 +78 -31
- 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 +282 -50
- 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 +51 -15
- package/src/compiler/supports.ts +1 -3
- package/src/components/FlatList.tsx +1 -0
- package/src/components/ImageBackground.tsx +2 -6
- package/src/components/KeyboardAvoidingView.tsx +2 -3
- package/src/components/SafeAreaProvider.tsx +1 -0
- 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 +21 -6
- 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 +340 -53
- package/src/native/styles/resolve.ts +188 -29
- package/src/native/styles/scale-factor.ts +9 -0
- package/src/native/styles/shorthands/_handler.ts +14 -1
- package/src/native/styles/shorthands/animation.ts +8 -2
- package/src/native/styles/shorthands/box-shadow.ts +46 -25
- 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 +7 -12
- 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
|
@@ -1,114 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { isStyleDescriptorArray } from "react-native-css/utilities";
|
|
3
|
+
import { commaListItems, isStyleDescriptorArray } from "react-native-css/utilities";
|
|
4
|
+
import { scaleFactor } from "../scale-factor.js";
|
|
5
|
+
|
|
6
|
+
// A component left without a valid value makes the declaration invalid at computed-value time (css-variables-1 §3.1), which null carries
|
|
4
7
|
export const scale = (resolveValue, descriptor) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
return {
|
|
8
|
-
scale: resolveValue(args)
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
const x = resolveValue(args[0]);
|
|
12
|
-
const y = resolveValue(args[1]);
|
|
13
|
-
const isXValid = typeof x === "string" || typeof x === "number";
|
|
14
|
-
const isYValid = typeof y === "string" || typeof y === "number";
|
|
15
|
-
if (isXValid && isYValid) {
|
|
16
|
-
return x === y ? {
|
|
17
|
-
scale: x
|
|
18
|
-
} : [{
|
|
19
|
-
scaleX: x
|
|
20
|
-
}, {
|
|
21
|
-
scaleY: y
|
|
22
|
-
}];
|
|
23
|
-
} else if (isXValid) {
|
|
24
|
-
return {
|
|
25
|
-
scaleX: x
|
|
26
|
-
};
|
|
27
|
-
} else if (isYValid) {
|
|
28
|
-
return {
|
|
29
|
-
scaleY: y
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return;
|
|
8
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
9
|
+
return scalePair(operands, operands.length);
|
|
33
10
|
};
|
|
34
11
|
export const rotate = (resolveValue, descriptor) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
const x = resolveValue(args[0]);
|
|
42
|
-
const y = resolveValue(args[1]);
|
|
43
|
-
const z = resolveValue(args[2]);
|
|
44
|
-
const isXValid = typeof x === "string" || typeof x === "number";
|
|
45
|
-
const isYValid = typeof y === "string" || typeof y === "number";
|
|
46
|
-
const isZValid = typeof z === "string" || typeof z === "number";
|
|
47
|
-
if (isXValid && isYValid && isZValid) {
|
|
48
|
-
return [{
|
|
49
|
-
rotateX: x
|
|
50
|
-
}, {
|
|
51
|
-
rotateY: y
|
|
52
|
-
}, {
|
|
53
|
-
rotateZ: z
|
|
54
|
-
}];
|
|
55
|
-
} else if (isXValid && isYValid) {
|
|
56
|
-
return [{
|
|
57
|
-
rotateX: x
|
|
58
|
-
}, {
|
|
59
|
-
rotateY: y
|
|
60
|
-
}];
|
|
61
|
-
} else if (isXValid && isZValid) {
|
|
62
|
-
return [{
|
|
63
|
-
rotateX: x
|
|
64
|
-
}, {
|
|
65
|
-
rotateZ: z
|
|
66
|
-
}];
|
|
67
|
-
} else if (isYValid && isZValid) {
|
|
68
|
-
return [{
|
|
69
|
-
rotateY: y
|
|
70
|
-
}, {
|
|
71
|
-
rotateZ: z
|
|
72
|
-
}];
|
|
73
|
-
} else if (isXValid) {
|
|
74
|
-
return {
|
|
75
|
-
rotateX: x
|
|
76
|
-
};
|
|
77
|
-
} else if (isYValid) {
|
|
78
|
-
return {
|
|
79
|
-
rotateY: y
|
|
80
|
-
};
|
|
81
|
-
} else if (isZValid) {
|
|
82
|
-
return {
|
|
83
|
-
rotateZ: z
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return;
|
|
12
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
13
|
+
const angle = operands[0];
|
|
14
|
+
return operands.length === 1 && isTransformComponent(angle) ? {
|
|
15
|
+
rotate: angle
|
|
16
|
+
} : null;
|
|
87
17
|
};
|
|
88
18
|
export const translate = (resolveValue, descriptor) => {
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
19
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
20
|
+
return translatePair(operands, operands.length);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// css-transforms-2 §3: `translate: none | <length-percentage> [<length-percentage> <length>?]?`, and React Native has no z axis to move along
|
|
24
|
+
export const individualTranslate = (resolveValue, descriptor) => {
|
|
25
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
26
|
+
const z = operands.length > 2 ? operands[2] : 0;
|
|
27
|
+
return operands.length <= 3 && typeof z === "number" ? translatePair(operands, Math.min(operands.length, 2)) : null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// css-transforms-2 §3: `scale: none | [<number> | <percentage>]{1,3}`, and React Native has no z axis to scale along
|
|
31
|
+
export const individualScale = (resolveValue, descriptor) => {
|
|
32
|
+
const operands = resolveOperands(resolveValue, descriptor[2]);
|
|
33
|
+
const z = operands.length > 2 ? operands[2] : 1;
|
|
34
|
+
return operands.length <= 3 && scaleFactor(z) !== null ? scalePair(operands, Math.min(operands.length, 2)) : null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// The first `count` operands, so a caller can leave out a z without copying the list
|
|
38
|
+
function scalePair(operands, count) {
|
|
39
|
+
const x = scaleFactor(operands[0]);
|
|
40
|
+
const y = count > 1 ? scaleFactor(operands[1]) : x;
|
|
41
|
+
if (count > 2 || x === null || y === null) {
|
|
42
|
+
return null;
|
|
92
43
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
} else if (isYValid) {
|
|
108
|
-
return {
|
|
109
|
-
translateY: y
|
|
110
|
-
};
|
|
44
|
+
return [{
|
|
45
|
+
scaleX: x
|
|
46
|
+
}, {
|
|
47
|
+
scaleY: y
|
|
48
|
+
}];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// `translate(x)` is `translate(x, 0)` (css-transforms-1 §9)
|
|
52
|
+
function translatePair(operands, count) {
|
|
53
|
+
const x = operands[0];
|
|
54
|
+
const y = count > 1 ? operands[1] : 0;
|
|
55
|
+
if (count > 2 || !isTransformComponent(x) || !isTransformComponent(y)) {
|
|
56
|
+
return null;
|
|
111
57
|
}
|
|
112
|
-
return
|
|
113
|
-
|
|
58
|
+
return [{
|
|
59
|
+
translateX: x
|
|
60
|
+
}, {
|
|
61
|
+
translateY: y
|
|
62
|
+
}];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** A comma-separated argument list holds each argument as the array of its tokens */
|
|
66
|
+
function argument(resolveValue, arg) {
|
|
67
|
+
// A descriptor, never a resolved value: a style function starts with its {}
|
|
68
|
+
// marker, so an array of one entry that isn't a plain object is an item.
|
|
69
|
+
// This skips isStyleFunction's Object.keys, which resolveValue runs anyway
|
|
70
|
+
const token = Array.isArray(arg) && arg.length === 1 ? arg[0] : undefined;
|
|
71
|
+
return resolveValue(token !== undefined && (typeof token !== "object" || Array.isArray(token)) ? token : arg);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 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)
|
|
75
|
+
function resolveOperands(resolveValue, args) {
|
|
76
|
+
const operands = [];
|
|
77
|
+
if (isStyleDescriptorArray(args)) {
|
|
78
|
+
for (const arg of args) {
|
|
79
|
+
pushOperand(operands, argument(resolveValue, arg));
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
// A lone var()'s comma-separated list supplies its items as the operands
|
|
83
|
+
pushOperand(operands, commaListItems(resolveValue(args)));
|
|
84
|
+
}
|
|
85
|
+
return operands;
|
|
86
|
+
}
|
|
87
|
+
function pushOperand(operands, operand) {
|
|
88
|
+
if (Array.isArray(operand)) {
|
|
89
|
+
for (const item of operand) operands.push(item);
|
|
90
|
+
} else {
|
|
91
|
+
operands.push(operand);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// A number, or a dimension such as "45deg" or "-50%". A keyword such as none
|
|
96
|
+
// from a var() is not one: React Native throws on it, and the property is none
|
|
97
|
+
function isTransformComponent(value) {
|
|
98
|
+
if (typeof value === "number") return true;
|
|
99
|
+
if (typeof value !== "string") return false;
|
|
100
|
+
const first = value.charCodeAt(0);
|
|
101
|
+
return first >= 48 && first <= 57 || first === 45 || first === 43 || first === 46;
|
|
102
|
+
}
|
|
114
103
|
//# sourceMappingURL=transform-functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["isStyleDescriptorArray","scale","resolveValue","descriptor","
|
|
1
|
+
{"version":3,"names":["commaListItems","isStyleDescriptorArray","scaleFactor","scale","resolveValue","descriptor","operands","resolveOperands","scalePair","length","rotate","angle","isTransformComponent","translate","translatePair","individualTranslate","z","Math","min","individualScale","count","x","y","scaleX","scaleY","translateX","translateY","argument","arg","token","Array","isArray","undefined","args","pushOperand","operand","item","push","value","first","charCodeAt"],"sourceRoot":"../../../../../src","sources":["native/styles/functions/transform-functions.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -6,6 +6,122 @@ import { specificityCompareFn } from "react-native-css/utilities";
|
|
|
6
6
|
import { getInteractionHandler } from "../react/interaction.js";
|
|
7
7
|
import { activeFamily, containerLayoutFamily, family, focusFamily, hoverFamily, observable, VAR_SYMBOL } from "../reactivity.js";
|
|
8
8
|
import { calculateProps } from "./calculate-props.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Checks if the left style object has any properties that are not present in the right style object.
|
|
12
|
+
* This is used to determine if styles need to be preserved in an array or if right can completely override left.
|
|
13
|
+
*
|
|
14
|
+
* Note: This intentionally only checks one direction (left → right). We don't need to check if right has
|
|
15
|
+
* properties that left doesn't have, because right will always be applied/merged. The question we're
|
|
16
|
+
* answering is: "Does left have any properties that would be lost if we just used right?" If yes, we
|
|
17
|
+
* create a style array [left, right] to preserve both. If no, right can safely replace left entirely.
|
|
18
|
+
*
|
|
19
|
+
* @param left - The left style object to check
|
|
20
|
+
* @param right - The right style object to compare against
|
|
21
|
+
* @returns true if left has at least one property key that doesn't exist in right, false otherwise
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* hasNonOverlappingProperties({color: 'red', fontSize: 12}, {color: 'blue'}) // true - fontSize is not in right
|
|
25
|
+
* hasNonOverlappingProperties({color: 'red'}, {color: 'blue', fontSize: 12}) // false - all left keys exist in right
|
|
26
|
+
*/
|
|
27
|
+
function hasNonOverlappingProperties(left, right) {
|
|
28
|
+
// Null safety check
|
|
29
|
+
if (!left || !right) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Only check own properties to avoid prototype pollution
|
|
34
|
+
for (const key in left) {
|
|
35
|
+
if (Object.prototype.hasOwnProperty.call(left, key)) {
|
|
36
|
+
if (!Object.prototype.hasOwnProperty.call(right, key)) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
46
|
+
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
47
|
+
*
|
|
48
|
+
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
49
|
+
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
50
|
+
* @returns The value with CSS variables removed, or `undefined` if the entire value should be filtered out
|
|
51
|
+
*
|
|
52
|
+
* Filtering behavior:
|
|
53
|
+
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
54
|
+
* - A value holding no CSS variable comes back as the same object, uncopied, so an animated style keeps its identity
|
|
55
|
+
* - A value holding some comes back copied without them, or `undefined` if nothing remains
|
|
56
|
+
* - Class instances (e.g. an Animated.Value) and primitives: returned as-is
|
|
57
|
+
* - A top-level style object with no string keys (`{}`, or only Symbol keys): returns `undefined`
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
61
|
+
* filterCssVariables([{margin: 10}, {[VAR_SYMBOL]: true}]) // [{margin: 10}]
|
|
62
|
+
* filterCssVariables({color: {[VAR_SYMBOL]: true}}) // undefined (all props filtered)
|
|
63
|
+
*/
|
|
64
|
+
function filterCssVariables(value, depth = 0) {
|
|
65
|
+
// Prevent stack overflow on deeply nested structures
|
|
66
|
+
if (depth > 100 || typeof value !== "object" || value === null) {
|
|
67
|
+
return value;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Nothing is copied until a CSS variable is found, so an inline style keeps its identity, as an animated style's handle needs
|
|
71
|
+
if (Array.isArray(value)) {
|
|
72
|
+
let filtered;
|
|
73
|
+
for (let index = 0; index < value.length; index++) {
|
|
74
|
+
const item = value[index];
|
|
75
|
+
const kept = filterCssVariables(item, depth + 1);
|
|
76
|
+
// No copy yet: skip unchanged items, then copy them all with the slice once one changes
|
|
77
|
+
if (filtered === undefined) {
|
|
78
|
+
if (kept === item) continue;
|
|
79
|
+
filtered = value.slice(0, index);
|
|
80
|
+
}
|
|
81
|
+
if (kept !== undefined) filtered.push(kept);
|
|
82
|
+
}
|
|
83
|
+
if (filtered === undefined) return value;
|
|
84
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(value, VAR_SYMBOL)) {
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// A class instance, such as an Animated.Value, passes as it is: a plain copy detaches it from its animation
|
|
93
|
+
const prototype = Object.getPrototypeOf(value);
|
|
94
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Object.keys only iterates own string properties, so Symbol properties are left out of a copy
|
|
99
|
+
const keys = Object.keys(value);
|
|
100
|
+
let filtered;
|
|
101
|
+
for (let index = 0; index < keys.length; index++) {
|
|
102
|
+
const key = keys[index];
|
|
103
|
+
const item = value[key];
|
|
104
|
+
const kept = filterCssVariables(item, depth + 1);
|
|
105
|
+
// No copy yet: skip unchanged keys, then copy them all below once one changes
|
|
106
|
+
if (filtered === undefined) {
|
|
107
|
+
if (kept === item) continue;
|
|
108
|
+
// Objects have no slice: copy the unchanged keys before this one, performantly / avoiding allocations
|
|
109
|
+
filtered = {};
|
|
110
|
+
for (let earlier = 0; earlier < index; earlier++) {
|
|
111
|
+
const earlierKey = keys[earlier];
|
|
112
|
+
filtered[earlierKey] = value[earlierKey];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (kept !== undefined) filtered[key] = kept;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// A style object with no string keys, such as {}, adds nothing, as before
|
|
119
|
+
if (filtered === undefined) {
|
|
120
|
+
return depth === 0 && keys.length === 0 ? undefined : value;
|
|
121
|
+
}
|
|
122
|
+
for (const _ in filtered) return filtered;
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
9
125
|
export const stylesFamily = family((hash, rules) => {
|
|
10
126
|
const sortedRules = Array.from(rules).sort(specificityCompareFn);
|
|
11
127
|
const obs = observable(read => calculateProps(read, sortedRules));
|
|
@@ -13,22 +129,45 @@ export const stylesFamily = family((hash, rules) => {
|
|
|
13
129
|
/**
|
|
14
130
|
* A family is a map, so we need to cleanup the observers when the the hash is no longer used
|
|
15
131
|
*/
|
|
132
|
+
const unsubscribe = obs.unsubscribe;
|
|
16
133
|
return Object.assign(obs, {
|
|
17
|
-
|
|
18
|
-
|
|
134
|
+
unsubscribe: effect => {
|
|
135
|
+
unsubscribe(effect);
|
|
19
136
|
if (obs.observers.size === 0) {
|
|
20
137
|
stylesFamily.delete(hash);
|
|
21
138
|
}
|
|
22
139
|
}
|
|
23
140
|
});
|
|
24
141
|
});
|
|
25
|
-
export function getStyledProps(state, inline) {
|
|
142
|
+
export function getStyledProps(state, inline, adaptProps = props => props) {
|
|
26
143
|
let result;
|
|
27
144
|
const styledProps = state.stylesObs?.get(state.styleEffect);
|
|
145
|
+
|
|
146
|
+
// Each config merges a complete props object. Preserve its full target path
|
|
147
|
+
// before the next config merges unrelated inline props over that object.
|
|
148
|
+
const computedTargets = [];
|
|
149
|
+
const consumedSources = [];
|
|
28
150
|
for (const config of state.configs) {
|
|
29
|
-
result = deepMergeConfig(config, nativeStyleMapping(config, styledProps?.normal), inline, true);
|
|
151
|
+
result = deepMergeConfig(config, nativeStyleMapping(config, adaptProps(styledProps?.normal)), inline, true);
|
|
30
152
|
if (styledProps?.important) {
|
|
31
|
-
result = deepMergeConfig(config, result, nativeStyleMapping(config, styledProps.important));
|
|
153
|
+
result = deepMergeConfig(config, result, nativeStyleMapping(config, adaptProps(styledProps.important)));
|
|
154
|
+
}
|
|
155
|
+
if (result && config.target) {
|
|
156
|
+
const path = Array.isArray(config.target) ? config.target : [config.target];
|
|
157
|
+
let target = result;
|
|
158
|
+
for (const key of path.slice(0, -1)) target = target?.[key];
|
|
159
|
+
const key = path[path.length - 1];
|
|
160
|
+
if (target && key && key in target) {
|
|
161
|
+
computedTargets.push({
|
|
162
|
+
path,
|
|
163
|
+
value: target[key]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Track consumed className sources for cleanup
|
|
169
|
+
if (config.source !== config.target) {
|
|
170
|
+
consumedSources.push(config.source);
|
|
32
171
|
}
|
|
33
172
|
|
|
34
173
|
// Apply the handlers
|
|
@@ -53,8 +192,80 @@ export function getStyledProps(state, inline) {
|
|
|
53
192
|
result.onLayout = getInteractionHandler(state.ruleEffectGetter, "onLayout", inline?.onLayout);
|
|
54
193
|
}
|
|
55
194
|
}
|
|
195
|
+
|
|
196
|
+
// Restore correctly-merged target props that may have been overwritten
|
|
197
|
+
// by later config iterations' Object.assign({}, left, right)
|
|
198
|
+
if (result) {
|
|
199
|
+
for (const {
|
|
200
|
+
path,
|
|
201
|
+
value
|
|
202
|
+
} of computedTargets) {
|
|
203
|
+
let target = result;
|
|
204
|
+
for (const key of path.slice(0, -1)) {
|
|
205
|
+
const existing = target[key];
|
|
206
|
+
target = target[key] = Array.isArray(existing) ? [...existing] : {
|
|
207
|
+
...existing
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
target[path[path.length - 1]] = value;
|
|
211
|
+
}
|
|
212
|
+
for (const source of consumedSources) {
|
|
213
|
+
delete result[source];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return result;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Merges two prop objects, skipping keys from `right` whose value is `undefined`
|
|
221
|
+
* or an empty plain object.
|
|
222
|
+
*
|
|
223
|
+
* `Object.assign({}, left, right)` copies all enumerable own properties from `right`,
|
|
224
|
+
* including those with value `undefined` or `{}`. When a component passes
|
|
225
|
+
* `style={undefined}` or `contentContainerStyle={{}}`, the computed NativeWind
|
|
226
|
+
* style from `left` gets overwritten. This function prevents that by only copying
|
|
227
|
+
* values that carry meaningful style information.
|
|
228
|
+
*
|
|
229
|
+
* Empty object detection uses inline `for...in` instead of a separate function or
|
|
230
|
+
* `Object.keys().length` — avoids both function call overhead and intermediate array
|
|
231
|
+
* allocation on a hot path (called per-prop per-render). Consistent with how the
|
|
232
|
+
* `["style"]` target path handles this via `filterCssVariables({})` returning `undefined`.
|
|
233
|
+
*
|
|
234
|
+
* @param left - The computed NativeWind props (className-derived styles)
|
|
235
|
+
* @param right - The inline props from the component (guaranteed non-null by caller; may contain undefined values)
|
|
236
|
+
* @returns A new object with all properties from `left`, overridden only by meaningful values from `right`
|
|
237
|
+
*/
|
|
238
|
+
function mergeDefinedProps(left, right) {
|
|
239
|
+
const result = left ? {
|
|
240
|
+
...left
|
|
241
|
+
} : {};
|
|
242
|
+
for (const key in right) {
|
|
243
|
+
const value = right[key];
|
|
244
|
+
if (value === undefined) continue;
|
|
245
|
+
// Non-object values (strings, numbers, booleans, null, arrays): always assign
|
|
246
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
247
|
+
result[key] = value;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
// Plain object: assign only if non-empty. An empty style object (e.g.,
|
|
251
|
+
// contentContainerStyle={{}}) has no properties to apply and should not
|
|
252
|
+
// overwrite computed className styles. The for...in loop only executes
|
|
253
|
+
// if the object has enumerable keys — empty objects are skipped.
|
|
254
|
+
for (const _ in value) {
|
|
255
|
+
result[key] = value;
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
56
259
|
return result;
|
|
57
260
|
}
|
|
261
|
+
function isStyleCallback(value) {
|
|
262
|
+
return typeof value === "function";
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Pressable calls a function style with its pressed state, so a merge keeps a callback a callback
|
|
266
|
+
function composeStyleCallback(left, right) {
|
|
267
|
+
return state => [isStyleCallback(left) ? left(state) : left, isStyleCallback(right) ? right(state) : right];
|
|
268
|
+
}
|
|
58
269
|
function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
59
270
|
if (!right) {
|
|
60
271
|
return {
|
|
@@ -67,35 +278,32 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
67
278
|
if (config.target) {
|
|
68
279
|
if (Array.isArray(config.target) && config.target.length === 1 && config.target[0] === "style") {
|
|
69
280
|
// Special handling for style target when we have inline styles
|
|
70
|
-
result =
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const leftStyle = left.style;
|
|
77
|
-
const rightStyle = right.style;
|
|
78
|
-
|
|
79
|
-
// Quick check: do any left properties NOT exist in right?
|
|
80
|
-
let hasNonOverlappingProperties = false;
|
|
81
|
-
for (const key in leftStyle) {
|
|
82
|
-
if (!(key in rightStyle)) {
|
|
83
|
-
hasNonOverlappingProperties = true;
|
|
84
|
-
break; // Early exit for performance
|
|
85
|
-
}
|
|
281
|
+
result = mergeDefinedProps(left, right);
|
|
282
|
+
|
|
283
|
+
// Handle null/undefined inline styles
|
|
284
|
+
if (right?.style === null || right?.style === undefined) {
|
|
285
|
+
if (left?.style) {
|
|
286
|
+
result.style = left.style;
|
|
86
287
|
}
|
|
87
|
-
|
|
88
|
-
|
|
288
|
+
} else if (!rightIsInline && right?.style) {
|
|
289
|
+
// Merging non-inline styles (e.g., important styles)
|
|
290
|
+
if (left?.style) {
|
|
291
|
+
if (isStyleCallback(left.style) || isStyleCallback(right.style)) {
|
|
292
|
+
result.style = composeStyleCallback(left.style, right.style);
|
|
293
|
+
} else if (typeof left.style === "object" && !Array.isArray(left.style) && typeof right.style === "object" && !hasNonOverlappingProperties(left.style, right.style)) {
|
|
294
|
+
// All left properties are overridden by right
|
|
295
|
+
result.style = right.style;
|
|
296
|
+
} else {
|
|
297
|
+
// Layered rather than flattened: a copy would merge an inline animated style's handle into a plain object
|
|
298
|
+
result.style = Array.isArray(left.style) ? [...left.style, right.style] : [left.style, right.style];
|
|
299
|
+
}
|
|
89
300
|
}
|
|
90
|
-
// Otherwise, Object.assign above will handle the override correctly
|
|
91
301
|
}
|
|
92
302
|
} else {
|
|
93
|
-
result =
|
|
303
|
+
result = mergeDefinedProps(left, right);
|
|
94
304
|
}
|
|
95
305
|
} else {
|
|
96
|
-
result =
|
|
97
|
-
...left
|
|
98
|
-
};
|
|
306
|
+
result = mergeDefinedProps(left, right);
|
|
99
307
|
}
|
|
100
308
|
if (right && rightIsInline && config.source in right && config.target !== config.source) {
|
|
101
309
|
delete result[config.source];
|
|
@@ -105,16 +313,57 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
105
313
|
* If target is a path, deep merge until we get to the last key
|
|
106
314
|
*/
|
|
107
315
|
if (Array.isArray(config.target)) {
|
|
108
|
-
|
|
109
|
-
const key = config.target[
|
|
110
|
-
if (key === undefined) {
|
|
111
|
-
return result;
|
|
112
|
-
}
|
|
316
|
+
if (config.target.length > 1) {
|
|
317
|
+
const key = config.target[0];
|
|
113
318
|
result[key] = deepMergeConfig({
|
|
114
319
|
source: config.source,
|
|
115
|
-
target: config.target.slice(
|
|
320
|
+
target: config.target.slice(1)
|
|
116
321
|
}, left?.[key], right?.[key], rightIsInline);
|
|
117
322
|
}
|
|
323
|
+
|
|
324
|
+
// For length-1 array targets (e.g. ["contentContainerStyle"]), the loop
|
|
325
|
+
// above runs 0 iterations. Merge the target prop so inline styles don't
|
|
326
|
+
// silently overwrite className-computed styles (same as string target path).
|
|
327
|
+
const finalKey = config.target[config.target.length - 1];
|
|
328
|
+
if (config.target.length === 1 && finalKey && rightIsInline) {
|
|
329
|
+
let rightValue = right?.[finalKey];
|
|
330
|
+
if (rightValue !== undefined) {
|
|
331
|
+
rightValue = filterCssVariables(rightValue);
|
|
332
|
+
}
|
|
333
|
+
if (rightValue === undefined || rightValue === null) {
|
|
334
|
+
// Inline is empty or fully filtered — preserve className-computed value
|
|
335
|
+
if (left && finalKey in left) {
|
|
336
|
+
result[finalKey] = left[finalKey];
|
|
337
|
+
} else {
|
|
338
|
+
// No left value either — remove unfiltered inline value from result
|
|
339
|
+
delete result[finalKey];
|
|
340
|
+
}
|
|
341
|
+
} else if (left && finalKey in left) {
|
|
342
|
+
const leftValue = left[finalKey];
|
|
343
|
+
const leftIsObj = typeof leftValue === "object" && leftValue !== null && !Array.isArray(leftValue);
|
|
344
|
+
const rightIsObj = typeof rightValue === "object" && rightValue !== null && !Array.isArray(rightValue);
|
|
345
|
+
if (isStyleCallback(leftValue) || isStyleCallback(rightValue)) {
|
|
346
|
+
result[finalKey] = composeStyleCallback(leftValue, rightValue);
|
|
347
|
+
} else if (leftIsObj && rightIsObj) {
|
|
348
|
+
if (hasNonOverlappingProperties(leftValue, rightValue)) {
|
|
349
|
+
result[finalKey] = [leftValue, rightValue];
|
|
350
|
+
} else {
|
|
351
|
+
// All left keys are in right — use filtered right value
|
|
352
|
+
result[finalKey] = rightValue;
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
result[finalKey] = [leftValue, rightValue];
|
|
356
|
+
}
|
|
357
|
+
} else {
|
|
358
|
+
// No left value — use filtered right value (not the unfiltered one from mergeDefinedProps)
|
|
359
|
+
result[finalKey] = rightValue;
|
|
360
|
+
}
|
|
361
|
+
} else if (config.target.length === 1 && finalKey && finalKey !== "style" && left?.[finalKey] !== undefined && right[finalKey] !== undefined) {
|
|
362
|
+
// An !important value layers over the class's and the inline value rather than replacing both
|
|
363
|
+
const leftValue = left[finalKey];
|
|
364
|
+
const rightValue = right[finalKey];
|
|
365
|
+
result[finalKey] = isStyleCallback(leftValue) || isStyleCallback(rightValue) ? composeStyleCallback(leftValue, rightValue) : [leftValue, rightValue];
|
|
366
|
+
}
|
|
118
367
|
return result;
|
|
119
368
|
}
|
|
120
369
|
const target = config.target;
|
|
@@ -124,26 +373,31 @@ function deepMergeConfig(config, left, right, rightIsInline = false) {
|
|
|
124
373
|
let rightValue = right?.[target];
|
|
125
374
|
|
|
126
375
|
// Strip any inline variables from the target
|
|
127
|
-
if (rightIsInline && rightValue) {
|
|
128
|
-
|
|
129
|
-
rightValue = rightValue.filter(v => {
|
|
130
|
-
return typeof v !== "object" || !(v && VAR_SYMBOL in v);
|
|
131
|
-
});
|
|
132
|
-
if (rightValue.length === 0) {
|
|
133
|
-
rightValue = undefined;
|
|
134
|
-
}
|
|
135
|
-
} else if (typeof rightValue === "object" && rightValue && VAR_SYMBOL in rightValue) {
|
|
136
|
-
rightValue = undefined;
|
|
137
|
-
delete result[target][VAR_SYMBOL];
|
|
138
|
-
}
|
|
376
|
+
if (rightIsInline && rightValue !== undefined) {
|
|
377
|
+
rightValue = filterCssVariables(rightValue);
|
|
139
378
|
}
|
|
140
|
-
if (rightValue
|
|
141
|
-
|
|
379
|
+
if (rightValue === undefined && rightIsInline && target in right) {
|
|
380
|
+
// An inline value that held only CSS variables leaves the class's, and never reaches the component itself
|
|
381
|
+
if (left && target in left) {
|
|
382
|
+
result[target] = left[target];
|
|
383
|
+
} else {
|
|
384
|
+
delete result[target];
|
|
385
|
+
}
|
|
386
|
+
} else if (rightValue !== undefined) {
|
|
387
|
+
if (left && target in left) {
|
|
388
|
+
result[target] = isStyleCallback(left[target]) || isStyleCallback(rightValue) ? composeStyleCallback(left[target], rightValue) : [left[target], rightValue];
|
|
389
|
+
} else {
|
|
390
|
+
result[target] = rightValue;
|
|
391
|
+
}
|
|
142
392
|
}
|
|
143
393
|
return result;
|
|
144
394
|
}
|
|
145
395
|
function nativeStyleMapping(config, props) {
|
|
146
|
-
if (!
|
|
396
|
+
if (!props) {
|
|
397
|
+
return props;
|
|
398
|
+
}
|
|
399
|
+
if (!config.nativeStyleMapping) {
|
|
400
|
+
if (config.target === false) delete props.style;
|
|
147
401
|
return props;
|
|
148
402
|
}
|
|
149
403
|
let source;
|
|
@@ -181,6 +435,7 @@ function nativeStyleMapping(config, props) {
|
|
|
181
435
|
}
|
|
182
436
|
target[lastToken] = styleValue;
|
|
183
437
|
}
|
|
438
|
+
if (config.target === false) delete props.style;
|
|
184
439
|
return props;
|
|
185
440
|
}
|
|
186
441
|
//# sourceMappingURL=index.js.map
|