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
|
@@ -17,9 +17,129 @@ import {
|
|
|
17
17
|
} from "../reactivity";
|
|
18
18
|
import { calculateProps } from "./calculate-props";
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Checks if the left style object has any properties that are not present in the right style object.
|
|
22
|
+
* This is used to determine if styles need to be preserved in an array or if right can completely override left.
|
|
23
|
+
*
|
|
24
|
+
* Note: This intentionally only checks one direction (left → right). We don't need to check if right has
|
|
25
|
+
* properties that left doesn't have, because right will always be applied/merged. The question we're
|
|
26
|
+
* answering is: "Does left have any properties that would be lost if we just used right?" If yes, we
|
|
27
|
+
* create a style array [left, right] to preserve both. If no, right can safely replace left entirely.
|
|
28
|
+
*
|
|
29
|
+
* @param left - The left style object to check
|
|
30
|
+
* @param right - The right style object to compare against
|
|
31
|
+
* @returns true if left has at least one property key that doesn't exist in right, false otherwise
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* hasNonOverlappingProperties({color: 'red', fontSize: 12}, {color: 'blue'}) // true - fontSize is not in right
|
|
35
|
+
* hasNonOverlappingProperties({color: 'red'}, {color: 'blue', fontSize: 12}) // false - all left keys exist in right
|
|
36
|
+
*/
|
|
37
|
+
function hasNonOverlappingProperties(
|
|
38
|
+
left: Record<string, any>,
|
|
39
|
+
right: Record<string, any>,
|
|
40
|
+
): boolean {
|
|
41
|
+
// Null safety check
|
|
42
|
+
if (!left || !right) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Only check own properties to avoid prototype pollution
|
|
47
|
+
for (const key in left) {
|
|
48
|
+
if (Object.prototype.hasOwnProperty.call(left, key)) {
|
|
49
|
+
if (!Object.prototype.hasOwnProperty.call(right, key)) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
59
|
+
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
60
|
+
*
|
|
61
|
+
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
62
|
+
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
63
|
+
* @returns The value with CSS variables removed, or `undefined` if the entire value should be filtered out
|
|
64
|
+
*
|
|
65
|
+
* Filtering behavior:
|
|
66
|
+
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
67
|
+
* - A value holding no CSS variable comes back as the same object, uncopied, so an animated style keeps its identity
|
|
68
|
+
* - A value holding some comes back copied without them, or `undefined` if nothing remains
|
|
69
|
+
* - Class instances (e.g. an Animated.Value) and primitives: returned as-is
|
|
70
|
+
* - A top-level style object with no string keys (`{}`, or only Symbol keys): returns `undefined`
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
74
|
+
* filterCssVariables([{margin: 10}, {[VAR_SYMBOL]: true}]) // [{margin: 10}]
|
|
75
|
+
* filterCssVariables({color: {[VAR_SYMBOL]: true}}) // undefined (all props filtered)
|
|
76
|
+
*/
|
|
77
|
+
function filterCssVariables(value: any, depth = 0): any | undefined {
|
|
78
|
+
// Prevent stack overflow on deeply nested structures
|
|
79
|
+
if (depth > 100 || typeof value !== "object" || value === null) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Nothing is copied until a CSS variable is found, so an inline style keeps its identity, as an animated style's handle needs
|
|
84
|
+
if (Array.isArray(value)) {
|
|
85
|
+
let filtered: any[] | undefined;
|
|
86
|
+
for (let index = 0; index < value.length; index++) {
|
|
87
|
+
const item = value[index];
|
|
88
|
+
const kept = filterCssVariables(item, depth + 1);
|
|
89
|
+
// No copy yet: skip unchanged items, then copy them all with the slice once one changes
|
|
90
|
+
if (filtered === undefined) {
|
|
91
|
+
if (kept === item) continue;
|
|
92
|
+
filtered = value.slice(0, index);
|
|
93
|
+
}
|
|
94
|
+
if (kept !== undefined) filtered.push(kept);
|
|
95
|
+
}
|
|
96
|
+
if (filtered === undefined) return value;
|
|
97
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
101
|
+
if (Object.prototype.hasOwnProperty.call(value, VAR_SYMBOL)) {
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// A class instance, such as an Animated.Value, passes as it is: a plain copy detaches it from its animation
|
|
106
|
+
const prototype: unknown = Object.getPrototypeOf(value);
|
|
107
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
108
|
+
return value;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Object.keys only iterates own string properties, so Symbol properties are left out of a copy
|
|
112
|
+
const keys = Object.keys(value);
|
|
113
|
+
let filtered: Record<string, any> | undefined;
|
|
114
|
+
for (let index = 0; index < keys.length; index++) {
|
|
115
|
+
const key = keys[index] as string;
|
|
116
|
+
const item = value[key];
|
|
117
|
+
const kept = filterCssVariables(item, depth + 1);
|
|
118
|
+
// No copy yet: skip unchanged keys, then copy them all below once one changes
|
|
119
|
+
if (filtered === undefined) {
|
|
120
|
+
if (kept === item) continue;
|
|
121
|
+
// Objects have no slice: copy the unchanged keys before this one, performantly / avoiding allocations
|
|
122
|
+
filtered = {};
|
|
123
|
+
for (let earlier = 0; earlier < index; earlier++) {
|
|
124
|
+
const earlierKey = keys[earlier] as string;
|
|
125
|
+
filtered[earlierKey] = value[earlierKey];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (kept !== undefined) filtered[key] = kept;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// A style object with no string keys, such as {}, adds nothing, as before
|
|
132
|
+
if (filtered === undefined) {
|
|
133
|
+
return depth === 0 && keys.length === 0 ? undefined : value;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
for (const _ in filtered) return filtered;
|
|
137
|
+
return undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
20
140
|
export const stylesFamily = family(
|
|
21
141
|
(
|
|
22
|
-
hash:
|
|
142
|
+
hash: number,
|
|
23
143
|
rules: Set<StyleRule | InlineVariable | VariableContextValue>,
|
|
24
144
|
) => {
|
|
25
145
|
const sortedRules = Array.from(rules).sort(specificityCompareFn);
|
|
@@ -29,9 +149,10 @@ export const stylesFamily = family(
|
|
|
29
149
|
/**
|
|
30
150
|
* A family is a map, so we need to cleanup the observers when the the hash is no longer used
|
|
31
151
|
*/
|
|
152
|
+
const unsubscribe = obs.unsubscribe;
|
|
32
153
|
return Object.assign(obs, {
|
|
33
|
-
|
|
34
|
-
|
|
154
|
+
unsubscribe: (effect: Effect) => {
|
|
155
|
+
unsubscribe(effect);
|
|
35
156
|
if (obs.observers.size === 0) {
|
|
36
157
|
stylesFamily.delete(hash);
|
|
37
158
|
}
|
|
@@ -43,15 +164,23 @@ export const stylesFamily = family(
|
|
|
43
164
|
export function getStyledProps(
|
|
44
165
|
state: ComponentState,
|
|
45
166
|
inline: Record<string, any> | undefined | null,
|
|
167
|
+
adaptProps: (
|
|
168
|
+
props: Record<string, any> | undefined,
|
|
169
|
+
) => Record<string, any> | undefined = (props) => props,
|
|
46
170
|
) {
|
|
47
171
|
let result: Record<string, any> | undefined;
|
|
48
172
|
|
|
49
173
|
const styledProps = state.stylesObs?.get(state.styleEffect);
|
|
50
174
|
|
|
175
|
+
// Each config merges a complete props object. Preserve its full target path
|
|
176
|
+
// before the next config merges unrelated inline props over that object.
|
|
177
|
+
const computedTargets: { path: string[]; value: unknown }[] = [];
|
|
178
|
+
const consumedSources: string[] = [];
|
|
179
|
+
|
|
51
180
|
for (const config of state.configs) {
|
|
52
181
|
result = deepMergeConfig(
|
|
53
182
|
config,
|
|
54
|
-
nativeStyleMapping(config, styledProps?.normal),
|
|
183
|
+
nativeStyleMapping(config, adaptProps(styledProps?.normal)),
|
|
55
184
|
inline,
|
|
56
185
|
true,
|
|
57
186
|
);
|
|
@@ -60,10 +189,27 @@ export function getStyledProps(
|
|
|
60
189
|
result = deepMergeConfig(
|
|
61
190
|
config,
|
|
62
191
|
result,
|
|
63
|
-
nativeStyleMapping(config, styledProps.important),
|
|
192
|
+
nativeStyleMapping(config, adaptProps(styledProps.important)),
|
|
64
193
|
);
|
|
65
194
|
}
|
|
66
195
|
|
|
196
|
+
if (result && config.target) {
|
|
197
|
+
const path = Array.isArray(config.target)
|
|
198
|
+
? config.target
|
|
199
|
+
: [config.target];
|
|
200
|
+
let target = result;
|
|
201
|
+
for (const key of path.slice(0, -1)) target = target?.[key];
|
|
202
|
+
const key = path[path.length - 1];
|
|
203
|
+
if (target && key && key in target) {
|
|
204
|
+
computedTargets.push({ path, value: target[key] });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Track consumed className sources for cleanup
|
|
209
|
+
if (config.source !== config.target) {
|
|
210
|
+
consumedSources.push(config.source);
|
|
211
|
+
}
|
|
212
|
+
|
|
67
213
|
// Apply the handlers
|
|
68
214
|
if (hoverFamily.has(state.ruleEffectGetter)) {
|
|
69
215
|
result ??= {};
|
|
@@ -122,9 +268,85 @@ export function getStyledProps(
|
|
|
122
268
|
}
|
|
123
269
|
}
|
|
124
270
|
|
|
271
|
+
// Restore correctly-merged target props that may have been overwritten
|
|
272
|
+
// by later config iterations' Object.assign({}, left, right)
|
|
273
|
+
if (result) {
|
|
274
|
+
for (const { path, value } of computedTargets) {
|
|
275
|
+
let target = result;
|
|
276
|
+
for (const key of path.slice(0, -1)) {
|
|
277
|
+
const existing = target[key];
|
|
278
|
+
target = target[key] = Array.isArray(existing)
|
|
279
|
+
? [...existing]
|
|
280
|
+
: { ...existing };
|
|
281
|
+
}
|
|
282
|
+
target[path[path.length - 1]!] = value;
|
|
283
|
+
}
|
|
284
|
+
for (const source of consumedSources) {
|
|
285
|
+
delete result[source];
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
125
289
|
return result;
|
|
126
290
|
}
|
|
127
291
|
|
|
292
|
+
/**
|
|
293
|
+
* Merges two prop objects, skipping keys from `right` whose value is `undefined`
|
|
294
|
+
* or an empty plain object.
|
|
295
|
+
*
|
|
296
|
+
* `Object.assign({}, left, right)` copies all enumerable own properties from `right`,
|
|
297
|
+
* including those with value `undefined` or `{}`. When a component passes
|
|
298
|
+
* `style={undefined}` or `contentContainerStyle={{}}`, the computed NativeWind
|
|
299
|
+
* style from `left` gets overwritten. This function prevents that by only copying
|
|
300
|
+
* values that carry meaningful style information.
|
|
301
|
+
*
|
|
302
|
+
* Empty object detection uses inline `for...in` instead of a separate function or
|
|
303
|
+
* `Object.keys().length` — avoids both function call overhead and intermediate array
|
|
304
|
+
* allocation on a hot path (called per-prop per-render). Consistent with how the
|
|
305
|
+
* `["style"]` target path handles this via `filterCssVariables({})` returning `undefined`.
|
|
306
|
+
*
|
|
307
|
+
* @param left - The computed NativeWind props (className-derived styles)
|
|
308
|
+
* @param right - The inline props from the component (guaranteed non-null by caller; may contain undefined values)
|
|
309
|
+
* @returns A new object with all properties from `left`, overridden only by meaningful values from `right`
|
|
310
|
+
*/
|
|
311
|
+
function mergeDefinedProps(
|
|
312
|
+
left: Record<string, any> | undefined,
|
|
313
|
+
right: Record<string, any>,
|
|
314
|
+
) {
|
|
315
|
+
const result = left ? { ...left } : {};
|
|
316
|
+
for (const key in right) {
|
|
317
|
+
const value = right[key];
|
|
318
|
+
if (value === undefined) continue;
|
|
319
|
+
// Non-object values (strings, numbers, booleans, null, arrays): always assign
|
|
320
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
321
|
+
result[key] = value;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
// Plain object: assign only if non-empty. An empty style object (e.g.,
|
|
325
|
+
// contentContainerStyle={{}}) has no properties to apply and should not
|
|
326
|
+
// overwrite computed className styles. The for...in loop only executes
|
|
327
|
+
// if the object has enumerable keys — empty objects are skipped.
|
|
328
|
+
for (const _ in value) {
|
|
329
|
+
result[key] = value;
|
|
330
|
+
break;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
return result;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
type StyleCallback = (state: unknown) => unknown;
|
|
337
|
+
|
|
338
|
+
function isStyleCallback(value: unknown): value is StyleCallback {
|
|
339
|
+
return typeof value === "function";
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// Pressable calls a function style with its pressed state, so a merge keeps a callback a callback
|
|
343
|
+
function composeStyleCallback(left: unknown, right: unknown): StyleCallback {
|
|
344
|
+
return (state) => [
|
|
345
|
+
isStyleCallback(left) ? left(state) : left,
|
|
346
|
+
isStyleCallback(right) ? right(state) : right,
|
|
347
|
+
];
|
|
348
|
+
}
|
|
349
|
+
|
|
128
350
|
function deepMergeConfig(
|
|
129
351
|
config: Config,
|
|
130
352
|
left: Record<string, any> | undefined,
|
|
@@ -144,31 +366,39 @@ function deepMergeConfig(
|
|
|
144
366
|
config.target[0] === "style"
|
|
145
367
|
) {
|
|
146
368
|
// Special handling for style target when we have inline styles
|
|
147
|
-
result =
|
|
148
|
-
// More performant approach - check for non-overlapping properties without Sets
|
|
149
|
-
if (left?.style && right?.style && rightIsInline) {
|
|
150
|
-
const leftStyle = left.style;
|
|
151
|
-
const rightStyle = right.style;
|
|
152
|
-
|
|
153
|
-
// Quick check: do any left properties NOT exist in right?
|
|
154
|
-
let hasNonOverlappingProperties = false;
|
|
155
|
-
for (const key in leftStyle) {
|
|
156
|
-
if (!(key in rightStyle)) {
|
|
157
|
-
hasNonOverlappingProperties = true;
|
|
158
|
-
break; // Early exit for performance
|
|
159
|
-
}
|
|
160
|
-
}
|
|
369
|
+
result = mergeDefinedProps(left, right);
|
|
161
370
|
|
|
162
|
-
|
|
163
|
-
|
|
371
|
+
// Handle null/undefined inline styles
|
|
372
|
+
if (right?.style === null || right?.style === undefined) {
|
|
373
|
+
if (left?.style) {
|
|
374
|
+
result.style = left.style;
|
|
375
|
+
}
|
|
376
|
+
} else if (!rightIsInline && right?.style) {
|
|
377
|
+
// Merging non-inline styles (e.g., important styles)
|
|
378
|
+
if (left?.style) {
|
|
379
|
+
if (isStyleCallback(left.style) || isStyleCallback(right.style)) {
|
|
380
|
+
result.style = composeStyleCallback(left.style, right.style);
|
|
381
|
+
} else if (
|
|
382
|
+
typeof left.style === "object" &&
|
|
383
|
+
!Array.isArray(left.style) &&
|
|
384
|
+
typeof right.style === "object" &&
|
|
385
|
+
!hasNonOverlappingProperties(left.style, right.style)
|
|
386
|
+
) {
|
|
387
|
+
// All left properties are overridden by right
|
|
388
|
+
result.style = right.style;
|
|
389
|
+
} else {
|
|
390
|
+
// Layered rather than flattened: a copy would merge an inline animated style's handle into a plain object
|
|
391
|
+
result.style = Array.isArray(left.style)
|
|
392
|
+
? [...left.style, right.style]
|
|
393
|
+
: [left.style, right.style];
|
|
394
|
+
}
|
|
164
395
|
}
|
|
165
|
-
// Otherwise, Object.assign above will handle the override correctly
|
|
166
396
|
}
|
|
167
397
|
} else {
|
|
168
|
-
result =
|
|
398
|
+
result = mergeDefinedProps(left, right);
|
|
169
399
|
}
|
|
170
400
|
} else {
|
|
171
|
-
result =
|
|
401
|
+
result = mergeDefinedProps(left, right);
|
|
172
402
|
}
|
|
173
403
|
|
|
174
404
|
if (
|
|
@@ -184,21 +414,75 @@ function deepMergeConfig(
|
|
|
184
414
|
* If target is a path, deep merge until we get to the last key
|
|
185
415
|
*/
|
|
186
416
|
if (Array.isArray(config.target)) {
|
|
187
|
-
|
|
188
|
-
const key = config.target[
|
|
189
|
-
|
|
190
|
-
if (key === undefined) {
|
|
191
|
-
return result;
|
|
192
|
-
}
|
|
193
|
-
|
|
417
|
+
if (config.target.length > 1) {
|
|
418
|
+
const key = config.target[0]!;
|
|
194
419
|
result[key] = deepMergeConfig(
|
|
195
|
-
{ source: config.source, target: config.target.slice(
|
|
420
|
+
{ source: config.source, target: config.target.slice(1) },
|
|
196
421
|
left?.[key],
|
|
197
422
|
right?.[key],
|
|
198
423
|
rightIsInline,
|
|
199
424
|
);
|
|
200
425
|
}
|
|
201
426
|
|
|
427
|
+
// For length-1 array targets (e.g. ["contentContainerStyle"]), the loop
|
|
428
|
+
// above runs 0 iterations. Merge the target prop so inline styles don't
|
|
429
|
+
// silently overwrite className-computed styles (same as string target path).
|
|
430
|
+
const finalKey = config.target[config.target.length - 1];
|
|
431
|
+
if (config.target.length === 1 && finalKey && rightIsInline) {
|
|
432
|
+
let rightValue = right?.[finalKey];
|
|
433
|
+
if (rightValue !== undefined) {
|
|
434
|
+
rightValue = filterCssVariables(rightValue);
|
|
435
|
+
}
|
|
436
|
+
if (rightValue === undefined || rightValue === null) {
|
|
437
|
+
// Inline is empty or fully filtered — preserve className-computed value
|
|
438
|
+
if (left && finalKey in left) {
|
|
439
|
+
result[finalKey] = left[finalKey];
|
|
440
|
+
} else {
|
|
441
|
+
// No left value either — remove unfiltered inline value from result
|
|
442
|
+
delete result[finalKey];
|
|
443
|
+
}
|
|
444
|
+
} else if (left && finalKey in left) {
|
|
445
|
+
const leftValue = left[finalKey];
|
|
446
|
+
const leftIsObj =
|
|
447
|
+
typeof leftValue === "object" &&
|
|
448
|
+
leftValue !== null &&
|
|
449
|
+
!Array.isArray(leftValue);
|
|
450
|
+
const rightIsObj =
|
|
451
|
+
typeof rightValue === "object" &&
|
|
452
|
+
rightValue !== null &&
|
|
453
|
+
!Array.isArray(rightValue);
|
|
454
|
+
if (isStyleCallback(leftValue) || isStyleCallback(rightValue)) {
|
|
455
|
+
result[finalKey] = composeStyleCallback(leftValue, rightValue);
|
|
456
|
+
} else if (leftIsObj && rightIsObj) {
|
|
457
|
+
if (hasNonOverlappingProperties(leftValue, rightValue)) {
|
|
458
|
+
result[finalKey] = [leftValue, rightValue];
|
|
459
|
+
} else {
|
|
460
|
+
// All left keys are in right — use filtered right value
|
|
461
|
+
result[finalKey] = rightValue;
|
|
462
|
+
}
|
|
463
|
+
} else {
|
|
464
|
+
result[finalKey] = [leftValue, rightValue];
|
|
465
|
+
}
|
|
466
|
+
} else {
|
|
467
|
+
// No left value — use filtered right value (not the unfiltered one from mergeDefinedProps)
|
|
468
|
+
result[finalKey] = rightValue;
|
|
469
|
+
}
|
|
470
|
+
} else if (
|
|
471
|
+
config.target.length === 1 &&
|
|
472
|
+
finalKey &&
|
|
473
|
+
finalKey !== "style" &&
|
|
474
|
+
left?.[finalKey] !== undefined &&
|
|
475
|
+
right[finalKey] !== undefined
|
|
476
|
+
) {
|
|
477
|
+
// An !important value layers over the class's and the inline value rather than replacing both
|
|
478
|
+
const leftValue = left[finalKey];
|
|
479
|
+
const rightValue = right[finalKey];
|
|
480
|
+
result[finalKey] =
|
|
481
|
+
isStyleCallback(leftValue) || isStyleCallback(rightValue)
|
|
482
|
+
? composeStyleCallback(leftValue, rightValue)
|
|
483
|
+
: [leftValue, rightValue];
|
|
484
|
+
}
|
|
485
|
+
|
|
202
486
|
return result;
|
|
203
487
|
}
|
|
204
488
|
|
|
@@ -211,28 +495,26 @@ function deepMergeConfig(
|
|
|
211
495
|
let rightValue = right?.[target];
|
|
212
496
|
|
|
213
497
|
// Strip any inline variables from the target
|
|
214
|
-
if (rightIsInline && rightValue) {
|
|
215
|
-
|
|
216
|
-
rightValue = rightValue.filter((v) => {
|
|
217
|
-
return typeof v !== "object" || !(v && VAR_SYMBOL in v);
|
|
218
|
-
});
|
|
219
|
-
|
|
220
|
-
if (rightValue.length === 0) {
|
|
221
|
-
rightValue = undefined;
|
|
222
|
-
}
|
|
223
|
-
} else if (
|
|
224
|
-
typeof rightValue === "object" &&
|
|
225
|
-
rightValue &&
|
|
226
|
-
VAR_SYMBOL in rightValue
|
|
227
|
-
) {
|
|
228
|
-
rightValue = undefined;
|
|
229
|
-
delete result[target][VAR_SYMBOL];
|
|
230
|
-
}
|
|
498
|
+
if (rightIsInline && rightValue !== undefined) {
|
|
499
|
+
rightValue = filterCssVariables(rightValue);
|
|
231
500
|
}
|
|
232
501
|
|
|
233
|
-
if (rightValue
|
|
234
|
-
|
|
235
|
-
|
|
502
|
+
if (rightValue === undefined && rightIsInline && target in right) {
|
|
503
|
+
// An inline value that held only CSS variables leaves the class's, and never reaches the component itself
|
|
504
|
+
if (left && target in left) {
|
|
505
|
+
result[target] = left[target];
|
|
506
|
+
} else {
|
|
507
|
+
delete result[target];
|
|
508
|
+
}
|
|
509
|
+
} else if (rightValue !== undefined) {
|
|
510
|
+
if (left && target in left) {
|
|
511
|
+
result[target] =
|
|
512
|
+
isStyleCallback(left[target]) || isStyleCallback(rightValue)
|
|
513
|
+
? composeStyleCallback(left[target], rightValue)
|
|
514
|
+
: [left[target], rightValue];
|
|
515
|
+
} else {
|
|
516
|
+
result[target] = rightValue;
|
|
517
|
+
}
|
|
236
518
|
}
|
|
237
519
|
|
|
238
520
|
return result;
|
|
@@ -242,7 +524,11 @@ function nativeStyleMapping(
|
|
|
242
524
|
config: Config,
|
|
243
525
|
props: Record<string, any> | undefined,
|
|
244
526
|
) {
|
|
245
|
-
if (!
|
|
527
|
+
if (!props) {
|
|
528
|
+
return props;
|
|
529
|
+
}
|
|
530
|
+
if (!config.nativeStyleMapping) {
|
|
531
|
+
if (config.target === false) delete props.style;
|
|
246
532
|
return props;
|
|
247
533
|
}
|
|
248
534
|
|
|
@@ -291,5 +577,6 @@ function nativeStyleMapping(
|
|
|
291
577
|
target[lastToken!] = styleValue;
|
|
292
578
|
}
|
|
293
579
|
|
|
580
|
+
if (config.target === false) delete props.style;
|
|
294
581
|
return props;
|
|
295
582
|
}
|