react-native-css 0.0.0-nightly.d6f42ab → 0.0.0-nightly.df32ce3
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 +29 -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 +107 -32
- 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 +149 -57
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/lightningcss-loader.js +15 -2
- package/dist/commonjs/compiler/lightningcss-loader.js.map +1 -1
- package/dist/commonjs/compiler/media-query.js +16 -6
- package/dist/commonjs/compiler/media-query.js.map +1 -1
- package/dist/commonjs/compiler/selector-builder.js +15 -4
- package/dist/commonjs/compiler/selector-builder.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +16 -3
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +2 -2
- 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 +46 -1
- package/dist/commonjs/components/index.cjs.map +1 -1
- package/dist/commonjs/jest/index.js +1 -1
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/cache-version.js +43 -0
- package/dist/commonjs/metro/cache-version.js.map +1 -0
- package/dist/commonjs/metro/index.js +2 -0
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +16 -3
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/metro/typescript.js +26 -6
- package/dist/commonjs/metro/typescript.js.map +1 -1
- package/dist/commonjs/metro/warnings.js +135 -0
- package/dist/commonjs/metro/warnings.js.map +1 -0
- package/dist/commonjs/native/api.js +13 -9
- package/dist/commonjs/native/api.js.map +1 -1
- package/dist/commonjs/native/conditions/attributes.js +16 -9
- package/dist/commonjs/native/conditions/attributes.js.map +1 -1
- package/dist/commonjs/native/conditions/container-query.js +11 -11
- package/dist/commonjs/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/native/conditions/media-query.js +1 -1
- package/dist/commonjs/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/native/react/interaction.js +10 -5
- package/dist/commonjs/native/react/interaction.js.map +1 -1
- package/dist/commonjs/native/react/rules.js +12 -5
- package/dist/commonjs/native/react/rules.js.map +1 -1
- package/dist/commonjs/native/react/useNativeCss.js +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 +61 -24
- package/dist/commonjs/native/reactivity.js.map +1 -1
- package/dist/commonjs/native/reanimated.js +15 -3
- package/dist/commonjs/native/reanimated.js.map +1 -1
- package/dist/commonjs/native/styles/functions/color-mix.js +64 -0
- package/dist/commonjs/native/styles/functions/color-mix.js.map +1 -0
- package/dist/commonjs/native/styles/functions/filters.js +18 -5
- package/dist/commonjs/native/styles/functions/filters.js.map +1 -1
- package/dist/commonjs/native/styles/functions/index.js +11 -0
- package/dist/commonjs/native/styles/functions/index.js.map +1 -1
- package/dist/commonjs/native/styles/functions/numeric-functions.js +4 -3
- package/dist/commonjs/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/string-functions.js +16 -1
- package/dist/commonjs/native/styles/functions/string-functions.js.map +1 -1
- package/dist/commonjs/native/styles/functions/transform-functions.js +5 -4
- package/dist/commonjs/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/commonjs/native/styles/index.js +382 -28
- package/dist/commonjs/native/styles/index.js.map +1 -1
- package/dist/commonjs/native/styles/resolve.js +10 -6
- package/dist/commonjs/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/native/styles/scale-factor.js +13 -0
- package/dist/commonjs/native/styles/scale-factor.js.map +1 -0
- package/dist/commonjs/native/styles/shorthands/_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 +45 -12
- 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/variables.js +55 -43
- package/dist/commonjs/native/styles/variables.js.map +1 -1
- package/dist/commonjs/native-internal/root.js +18 -7
- package/dist/commonjs/native-internal/root.js.map +1 -1
- package/dist/commonjs/native-internal/style-collection.js +1 -1
- package/dist/commonjs/native-internal/style-collection.js.map +1 -1
- package/dist/commonjs/native-internal/variables.js +1 -1
- package/dist/commonjs/native-internal/variables.js.map +1 -1
- package/dist/commonjs/utilities/dot-notation.types.js +4 -0
- package/dist/commonjs/utilities/style-descriptor.js +4 -9
- package/dist/commonjs/utilities/style-descriptor.js.map +1 -1
- package/dist/commonjs/web/api.js +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 +109 -34
- 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 +148 -57
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/lightningcss-loader.js +14 -2
- package/dist/module/compiler/lightningcss-loader.js.map +1 -1
- package/dist/module/compiler/media-query.js +16 -6
- package/dist/module/compiler/media-query.js.map +1 -1
- package/dist/module/compiler/selector-builder.js +15 -4
- package/dist/module/compiler/selector-builder.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +16 -3
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +2 -2
- 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 +46 -1
- package/dist/module/components/index.cjs.map +1 -1
- package/dist/module/jest/index.js +1 -1
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/cache-version.js +39 -0
- package/dist/module/metro/cache-version.js.map +1 -0
- package/dist/module/metro/index.js +2 -0
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +16 -3
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/typescript.js +26 -6
- package/dist/module/metro/typescript.js.map +1 -1
- package/dist/module/metro/warnings.js +131 -0
- package/dist/module/metro/warnings.js.map +1 -0
- package/dist/module/native/api.js +15 -11
- package/dist/module/native/api.js.map +1 -1
- package/dist/module/native/conditions/attributes.js +16 -9
- package/dist/module/native/conditions/attributes.js.map +1 -1
- package/dist/module/native/conditions/container-query.js +11 -11
- package/dist/module/native/conditions/container-query.js.map +1 -1
- package/dist/module/native/conditions/media-query.js +1 -1
- package/dist/module/native/conditions/media-query.js.map +1 -1
- package/dist/module/native/react/interaction.js +10 -5
- package/dist/module/native/react/interaction.js.map +1 -1
- package/dist/module/native/react/rules.js +13 -6
- package/dist/module/native/react/rules.js.map +1 -1
- package/dist/module/native/react/useNativeCss.js +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 +55 -22
- package/dist/module/native/reactivity.js.map +1 -1
- package/dist/module/native/reanimated.js +15 -3
- package/dist/module/native/reanimated.js.map +1 -1
- package/dist/module/native/styles/functions/color-mix.js +59 -0
- package/dist/module/native/styles/functions/color-mix.js.map +1 -0
- package/dist/module/native/styles/functions/filters.js +16 -4
- package/dist/module/native/styles/functions/filters.js.map +1 -1
- package/dist/module/native/styles/functions/index.js +1 -0
- package/dist/module/native/styles/functions/index.js.map +1 -1
- package/dist/module/native/styles/functions/numeric-functions.js +4 -3
- package/dist/module/native/styles/functions/numeric-functions.js.map +1 -1
- package/dist/module/native/styles/functions/string-functions.js +13 -0
- package/dist/module/native/styles/functions/string-functions.js.map +1 -1
- package/dist/module/native/styles/functions/transform-functions.js +5 -4
- package/dist/module/native/styles/functions/transform-functions.js.map +1 -1
- package/dist/module/native/styles/index.js +383 -28
- package/dist/module/native/styles/index.js.map +1 -1
- package/dist/module/native/styles/resolve.js +10 -6
- package/dist/module/native/styles/resolve.js.map +1 -1
- package/dist/module/native/styles/scale-factor.js +9 -0
- package/dist/module/native/styles/scale-factor.js.map +1 -0
- package/dist/module/native/styles/shorthands/_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 +46 -12
- 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/variables.js +55 -43
- package/dist/module/native/styles/variables.js.map +1 -1
- package/dist/module/native-internal/root.js +18 -7
- package/dist/module/native-internal/root.js.map +1 -1
- package/dist/module/native-internal/style-collection.js +1 -1
- package/dist/module/native-internal/style-collection.js.map +1 -1
- package/dist/module/native-internal/variables.js +2 -2
- package/dist/module/native-internal/variables.js.map +1 -1
- package/dist/module/utilities/dot-notation.types.js +2 -0
- package/dist/module/utilities/style-descriptor.js +4 -9
- package/dist/module/utilities/style-descriptor.js.map +1 -1
- package/dist/module/web/api.js +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 +6 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +7 -8
- 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 +1 -1
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +2 -10
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/cache-version.d.ts +8 -0
- package/dist/typescript/commonjs/src/metro/cache-version.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +9 -4
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/warnings.d.ts +13 -0
- package/dist/typescript/commonjs/src/metro/warnings.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/api.d.ts +4 -8
- package/dist/typescript/commonjs/src/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/interaction.d.ts +1 -1
- package/dist/typescript/commonjs/src/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/react/usePassthrough.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/reactivity.d.ts +14 -3
- package/dist/typescript/commonjs/src/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/reanimated.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts +3 -0
- package/dist/typescript/commonjs/src/native/styles/functions/color-mix.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/functions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/functions/string-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/functions/transform-functions.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts +1 -0
- package/dist/typescript/commonjs/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts +2 -0
- package/dist/typescript/commonjs/src/native/styles/scale-factor.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/native/styles/shorthands/_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/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/root.d.ts +12 -0
- package/dist/typescript/commonjs/src/native-internal/root.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/native-internal/variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/native-internal/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime.types.d.ts +11 -6
- package/dist/typescript/commonjs/src/runtime.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts +2 -1
- package/dist/typescript/commonjs/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts +1 -1
- package/dist/typescript/commonjs/src/utilities/style-descriptor.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/api.d.ts +5 -5
- package/dist/typescript/commonjs/src/web/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/web/assign-style.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/helpers.d.ts +2 -1
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts +2 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/atRules.d.ts +6 -3
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +3 -7
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +7 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +5 -4
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/index.d.ts +2 -2
- package/dist/typescript/module/src/compiler/index.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/inline-variables.d.ts +1 -1
- package/dist/typescript/module/src/compiler/inline-variables.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/keyframes.d.ts +2 -2
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/lightningcss-loader.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/media-query.d.ts +3 -3
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +1 -1
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selectors.d.ts +2 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +7 -8
- 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 +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +2 -10
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/cache-version.d.ts +8 -0
- package/dist/typescript/module/src/metro/cache-version.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/index.d.ts +5 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +10 -5
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/warnings.d.ts +13 -0
- package/dist/typescript/module/src/metro/warnings.d.ts.map +1 -0
- package/dist/typescript/module/src/native/api.d.ts +5 -9
- package/dist/typescript/module/src/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/attributes.d.ts +1 -1
- package/dist/typescript/module/src/native/conditions/attributes.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/container-query.d.ts +2 -2
- package/dist/typescript/module/src/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/index.d.ts +3 -3
- package/dist/typescript/module/src/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/conditions/media-query.d.ts +1 -1
- package/dist/typescript/module/src/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/native/index.d.ts +3 -3
- package/dist/typescript/module/src/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/rules.d.ts +2 -2
- package/dist/typescript/module/src/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts +4 -4
- package/dist/typescript/module/src/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/native/react/usePassthrough.d.ts +1 -1
- package/dist/typescript/module/src/native/react/usePassthrough.d.ts.map +1 -1
- package/dist/typescript/module/src/native/reactivity.d.ts +14 -3
- package/dist/typescript/module/src/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/native/reanimated.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/calculate-props.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/animation-timing.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/calc.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/calc.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts +3 -0
- package/dist/typescript/module/src/native/styles/functions/color-mix.d.ts.map +1 -0
- 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 -7
- package/dist/typescript/module/src/native/styles/functions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/numeric-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/platform-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts +3 -1
- package/dist/typescript/module/src/native/styles/functions/string-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/functions/transform-functions.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/index.d.ts +7 -7
- package/dist/typescript/module/src/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/line-height.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/line-height.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/resolve.d.ts +4 -3
- package/dist/typescript/module/src/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/scale-factor.d.ts +2 -0
- package/dist/typescript/module/src/native/styles/scale-factor.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/_handler.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/shorthands/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/border.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/border.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/box-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/index.d.ts +6 -5
- package/dist/typescript/module/src/native/styles/shorthands/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts +4 -0
- package/dist/typescript/module/src/native/styles/shorthands/logical-border-width.d.ts.map +1 -0
- package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/text-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/shorthands/transform.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/units.d.ts +1 -1
- package/dist/typescript/module/src/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/native/styles/variables.d.ts +2 -2
- package/dist/typescript/module/src/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/index.d.ts +3 -3
- package/dist/typescript/module/src/native-internal/index.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/root.d.ts +13 -1
- package/dist/typescript/module/src/native-internal/root.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/style-collection.d.ts +2 -2
- package/dist/typescript/module/src/native-internal/style-collection.d.ts.map +1 -1
- package/dist/typescript/module/src/native-internal/variables.d.ts +2 -2
- package/dist/typescript/module/src/native-internal/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.d.ts +1 -1
- package/dist/typescript/module/src/runtime.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.native.d.ts +1 -1
- package/dist/typescript/module/src/runtime.native.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime.types.d.ts +11 -6
- package/dist/typescript/module/src/runtime.types.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts +2 -1
- package/dist/typescript/module/src/utilities/dot-notation.types.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/index.d.ts +3 -3
- package/dist/typescript/module/src/utilities/index.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/specificity.d.ts +2 -2
- package/dist/typescript/module/src/utilities/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/utilities/style-descriptor.d.ts +1 -1
- package/dist/typescript/module/src/utilities/style-descriptor.d.ts.map +1 -1
- package/dist/typescript/module/src/web/api.d.ts +5 -5
- package/dist/typescript/module/src/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/web/assign-style.d.ts.map +1 -1
- package/dist/typescript/module/src/web/index.d.ts +3 -3
- package/dist/typescript/module/src/web/index.d.ts.map +1 -1
- package/node/babel.mjs +4 -0
- package/node/compiler.mjs +2 -0
- package/node/metro.mjs +2 -0
- package/package.json +78 -29
- 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 +159 -43
- package/src/compiler/compiler.types.ts +9 -0
- package/src/compiler/container-query.ts +8 -3
- package/src/compiler/declarations.ts +280 -95
- package/src/compiler/lightningcss-loader.ts +21 -1
- package/src/compiler/media-query.ts +20 -9
- package/src/compiler/selector-builder.ts +31 -4
- package/src/compiler/stylesheet.ts +23 -10
- package/src/compiler/supports.ts +2 -2
- 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 +46 -1
- package/src/jest/index.ts +1 -1
- package/src/metro/cache-version.ts +48 -0
- package/src/metro/index.ts +7 -0
- package/src/metro/metro-transformer.ts +26 -8
- package/src/metro/typescript.ts +53 -6
- package/src/metro/warnings.ts +187 -0
- package/src/native/api.tsx +22 -17
- package/src/native/conditions/attributes.ts +26 -9
- package/src/native/conditions/container-query.ts +11 -9
- package/src/native/conditions/media-query.ts +1 -1
- package/src/native/react/interaction.ts +11 -6
- package/src/native/react/rules.ts +13 -5
- package/src/native/react/useNativeCss.ts +79 -17
- package/src/native/react/usePassthrough.ts +3 -2
- package/src/native/reactivity.ts +76 -24
- package/src/native/reanimated.ts +24 -5
- package/src/native/styles/functions/color-mix.ts +74 -0
- package/src/native/styles/functions/filters.ts +20 -6
- package/src/native/styles/functions/index.ts +1 -0
- package/src/native/styles/functions/numeric-functions.ts +7 -6
- package/src/native/styles/functions/string-functions.ts +18 -0
- package/src/native/styles/functions/transform-functions.ts +5 -4
- package/src/native/styles/index.ts +443 -36
- package/src/native/styles/resolve.ts +15 -11
- package/src/native/styles/scale-factor.ts +6 -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 +50 -15
- package/src/native/styles/shorthands/index.ts +1 -0
- package/src/native/styles/shorthands/logical-border-width.ts +32 -0
- package/src/native/styles/variables.ts +48 -38
- package/src/native-internal/root.ts +40 -13
- package/src/native-internal/style-collection.ts +1 -1
- package/src/native-internal/variables.tsx +6 -4
- package/src/runtime.types.ts +17 -15
- package/src/utilities/dot-notation.types.ts +4 -3
- package/src/utilities/style-descriptor.ts +11 -16
- package/src/web/api.tsx +7 -12
- package/src/web/assign-style.ts +2 -1
- package/types.d.ts +3 -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,6 +17,149 @@ 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
|
+
* Flattens a style array into a single object when possible, with rightmost values taking precedence.
|
|
59
|
+
* Returns the original array if it contains any non-plain objects, arrays, or CSS variable objects.
|
|
60
|
+
*
|
|
61
|
+
* Note: This function assumes the input array has already been filtered (e.g., by filterCssVariables),
|
|
62
|
+
* so empty arrays should not reach this function. If they do, they will be treated as non-flattenable.
|
|
63
|
+
*
|
|
64
|
+
* @param styleArray - The style array to potentially flatten
|
|
65
|
+
* @returns A single merged object if all items are plain objects, otherwise the original array
|
|
66
|
+
*/
|
|
67
|
+
function flattenStyleArray(styleArray: any[]): any {
|
|
68
|
+
// Check if we can flatten to a single object (all items are plain objects)
|
|
69
|
+
for (const item of styleArray) {
|
|
70
|
+
// Use explicit null check instead of !item to allow falsy values like 0 or false
|
|
71
|
+
if (
|
|
72
|
+
item == null ||
|
|
73
|
+
typeof item !== "object" ||
|
|
74
|
+
Array.isArray(item) ||
|
|
75
|
+
Object.prototype.hasOwnProperty.call(item, VAR_SYMBOL)
|
|
76
|
+
) {
|
|
77
|
+
return styleArray;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Use reduce to avoid spread operator performance issues with large arrays
|
|
82
|
+
return styleArray.reduce((acc, item) => Object.assign(acc, item), {});
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Recursively filters out CSS variable objects (with VAR_SYMBOL) from style values.
|
|
87
|
+
* This prevents CSS variable runtime objects from leaking into React Native component props.
|
|
88
|
+
*
|
|
89
|
+
* @param value - The value to filter (can be any type: object, array, primitive, etc.)
|
|
90
|
+
* @param depth - Internal recursion depth counter to prevent stack overflow (max 100)
|
|
91
|
+
* @returns The filtered value with CSS variables removed, or `undefined` if the entire value
|
|
92
|
+
* should be filtered out (e.g., empty arrays, objects with only VAR_SYMBOL properties)
|
|
93
|
+
*
|
|
94
|
+
* Filtering behavior:
|
|
95
|
+
* - Objects with VAR_SYMBOL property: returns `undefined` (completely filtered)
|
|
96
|
+
* - Arrays: filters out VAR_SYMBOL objects, returns `undefined` if empty after filtering
|
|
97
|
+
* - Objects: recursively filters properties, returns `undefined` if no properties remain
|
|
98
|
+
* - Primitives (null, undefined, numbers, strings, booleans): returned as-is
|
|
99
|
+
* - Symbol properties: intentionally filtered out for React Native compatibility
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* filterCssVariables({fontSize: 16, color: {[VAR_SYMBOL]: true}}) // {fontSize: 16}
|
|
103
|
+
* filterCssVariables([{margin: 10}, {[VAR_SYMBOL]: true}]) // [{margin: 10}]
|
|
104
|
+
* filterCssVariables({color: {[VAR_SYMBOL]: true}}) // undefined (all props filtered)
|
|
105
|
+
*/
|
|
106
|
+
function filterCssVariables(value: any, depth = 0): any | undefined {
|
|
107
|
+
// Prevent stack overflow on deeply nested structures
|
|
108
|
+
if (depth > 100) {
|
|
109
|
+
return value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (value === null || value === undefined) {
|
|
113
|
+
return value;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (Array.isArray(value)) {
|
|
117
|
+
// Single-pass filter with map operation
|
|
118
|
+
const filtered: any[] = [];
|
|
119
|
+
|
|
120
|
+
for (const item of value) {
|
|
121
|
+
const filteredItem = filterCssVariables(item, depth + 1);
|
|
122
|
+
if (
|
|
123
|
+
filteredItem !== undefined &&
|
|
124
|
+
!(
|
|
125
|
+
typeof filteredItem === "object" &&
|
|
126
|
+
filteredItem !== null &&
|
|
127
|
+
Object.prototype.hasOwnProperty.call(filteredItem, VAR_SYMBOL)
|
|
128
|
+
)
|
|
129
|
+
) {
|
|
130
|
+
filtered.push(filteredItem);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return filtered.length > 0 ? filtered : undefined;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (typeof value === "object") {
|
|
138
|
+
// If the object itself has VAR_SYMBOL, filter it out (check own property only)
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(value, VAR_SYMBOL)) {
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Otherwise, filter VAR_SYMBOL properties from nested objects
|
|
144
|
+
const filtered: Record<string, any> = {};
|
|
145
|
+
let hasProperties = false;
|
|
146
|
+
|
|
147
|
+
// Use Object.keys to only iterate own string properties (not inherited, not Symbols)
|
|
148
|
+
// This intentionally filters out Symbol properties for React Native compatibility
|
|
149
|
+
for (const key of Object.keys(value)) {
|
|
150
|
+
const filteredValue = filterCssVariables(value[key], depth + 1);
|
|
151
|
+
if (filteredValue !== undefined) {
|
|
152
|
+
filtered[key] = filteredValue;
|
|
153
|
+
hasProperties = true;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return hasProperties ? filtered : undefined;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
|
|
20
163
|
export const stylesFamily = family(
|
|
21
164
|
(
|
|
22
165
|
hash: string,
|
|
@@ -29,9 +172,10 @@ export const stylesFamily = family(
|
|
|
29
172
|
/**
|
|
30
173
|
* A family is a map, so we need to cleanup the observers when the the hash is no longer used
|
|
31
174
|
*/
|
|
175
|
+
const unsubscribe = obs.unsubscribe;
|
|
32
176
|
return Object.assign(obs, {
|
|
33
|
-
|
|
34
|
-
|
|
177
|
+
unsubscribe: (effect: Effect) => {
|
|
178
|
+
unsubscribe(effect);
|
|
35
179
|
if (obs.observers.size === 0) {
|
|
36
180
|
stylesFamily.delete(hash);
|
|
37
181
|
}
|
|
@@ -43,16 +187,50 @@ export const stylesFamily = family(
|
|
|
43
187
|
export function getStyledProps(
|
|
44
188
|
state: ComponentState,
|
|
45
189
|
inline: Record<string, any> | undefined | null,
|
|
190
|
+
adaptProps: (
|
|
191
|
+
props: Record<string, any> | undefined,
|
|
192
|
+
) => Record<string, any> | undefined = (props) => props,
|
|
46
193
|
) {
|
|
47
194
|
let result: Record<string, any> | undefined;
|
|
48
195
|
|
|
49
196
|
const styledProps = state.stylesObs?.get(state.styleEffect);
|
|
50
197
|
|
|
198
|
+
// Each config merges a complete props object. Preserve its full target path
|
|
199
|
+
// before the next config merges unrelated inline props over that object.
|
|
200
|
+
const computedTargets: { path: string[]; value: unknown }[] = [];
|
|
201
|
+
const consumedSources: string[] = [];
|
|
202
|
+
|
|
51
203
|
for (const config of state.configs) {
|
|
52
|
-
result = deepMergeConfig(
|
|
204
|
+
result = deepMergeConfig(
|
|
205
|
+
config,
|
|
206
|
+
nativeStyleMapping(config, adaptProps(styledProps?.normal)),
|
|
207
|
+
inline,
|
|
208
|
+
true,
|
|
209
|
+
);
|
|
53
210
|
|
|
54
211
|
if (styledProps?.important) {
|
|
55
|
-
result = deepMergeConfig(
|
|
212
|
+
result = deepMergeConfig(
|
|
213
|
+
config,
|
|
214
|
+
result,
|
|
215
|
+
nativeStyleMapping(config, adaptProps(styledProps.important)),
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (result && config.target) {
|
|
220
|
+
const path = Array.isArray(config.target)
|
|
221
|
+
? config.target
|
|
222
|
+
: [config.target];
|
|
223
|
+
let target = result;
|
|
224
|
+
for (const key of path.slice(0, -1)) target = target?.[key];
|
|
225
|
+
const key = path[path.length - 1];
|
|
226
|
+
if (target && key && key in target) {
|
|
227
|
+
computedTargets.push({ path, value: target[key] });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Track consumed className sources for cleanup
|
|
232
|
+
if (config.source !== config.target) {
|
|
233
|
+
consumedSources.push(config.source);
|
|
56
234
|
}
|
|
57
235
|
|
|
58
236
|
// Apply the handlers
|
|
@@ -113,6 +291,68 @@ export function getStyledProps(
|
|
|
113
291
|
}
|
|
114
292
|
}
|
|
115
293
|
|
|
294
|
+
// Restore correctly-merged target props that may have been overwritten
|
|
295
|
+
// by later config iterations' Object.assign({}, left, right)
|
|
296
|
+
if (result) {
|
|
297
|
+
for (const { path, value } of computedTargets) {
|
|
298
|
+
let target = result;
|
|
299
|
+
for (const key of path.slice(0, -1)) {
|
|
300
|
+
const existing = target[key];
|
|
301
|
+
target = target[key] = Array.isArray(existing)
|
|
302
|
+
? [...existing]
|
|
303
|
+
: { ...existing };
|
|
304
|
+
}
|
|
305
|
+
target[path[path.length - 1]!] = value;
|
|
306
|
+
}
|
|
307
|
+
for (const source of consumedSources) {
|
|
308
|
+
delete result[source];
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Merges two prop objects, skipping keys from `right` whose value is `undefined`
|
|
317
|
+
* or an empty plain object.
|
|
318
|
+
*
|
|
319
|
+
* `Object.assign({}, left, right)` copies all enumerable own properties from `right`,
|
|
320
|
+
* including those with value `undefined` or `{}`. When a component passes
|
|
321
|
+
* `style={undefined}` or `contentContainerStyle={{}}`, the computed NativeWind
|
|
322
|
+
* style from `left` gets overwritten. This function prevents that by only copying
|
|
323
|
+
* values that carry meaningful style information.
|
|
324
|
+
*
|
|
325
|
+
* Empty object detection uses inline `for...in` instead of a separate function or
|
|
326
|
+
* `Object.keys().length` — avoids both function call overhead and intermediate array
|
|
327
|
+
* allocation on a hot path (called per-prop per-render). Consistent with how the
|
|
328
|
+
* `["style"]` target path handles this via `filterCssVariables({})` returning `undefined`.
|
|
329
|
+
*
|
|
330
|
+
* @param left - The computed NativeWind props (className-derived styles)
|
|
331
|
+
* @param right - The inline props from the component (guaranteed non-null by caller; may contain undefined values)
|
|
332
|
+
* @returns A new object with all properties from `left`, overridden only by meaningful values from `right`
|
|
333
|
+
*/
|
|
334
|
+
function mergeDefinedProps(
|
|
335
|
+
left: Record<string, any> | undefined,
|
|
336
|
+
right: Record<string, any>,
|
|
337
|
+
) {
|
|
338
|
+
const result = left ? { ...left } : {};
|
|
339
|
+
for (const key in right) {
|
|
340
|
+
const value = right[key];
|
|
341
|
+
if (value === undefined) continue;
|
|
342
|
+
// Non-object values (strings, numbers, booleans, null, arrays): always assign
|
|
343
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
344
|
+
result[key] = value;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
// Plain object: assign only if non-empty. An empty style object (e.g.,
|
|
348
|
+
// contentContainerStyle={{}}) has no properties to apply and should not
|
|
349
|
+
// overwrite computed className styles. The for...in loop only executes
|
|
350
|
+
// if the object has enumerable keys — empty objects are skipped.
|
|
351
|
+
for (const _ in value) {
|
|
352
|
+
result[key] = value;
|
|
353
|
+
break;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
116
356
|
return result;
|
|
117
357
|
}
|
|
118
358
|
|
|
@@ -122,11 +362,96 @@ function deepMergeConfig(
|
|
|
122
362
|
right: Record<string, any> | undefined | null,
|
|
123
363
|
rightIsInline = false,
|
|
124
364
|
) {
|
|
125
|
-
if (!
|
|
365
|
+
if (!right) {
|
|
126
366
|
return { ...left };
|
|
127
367
|
}
|
|
128
368
|
|
|
129
|
-
|
|
369
|
+
// Handle style merging to support both className and inline style props
|
|
370
|
+
let result: Record<string, any>;
|
|
371
|
+
if (config.target) {
|
|
372
|
+
if (
|
|
373
|
+
Array.isArray(config.target) &&
|
|
374
|
+
config.target.length === 1 &&
|
|
375
|
+
config.target[0] === "style"
|
|
376
|
+
) {
|
|
377
|
+
// Special handling for style target when we have inline styles
|
|
378
|
+
result = { ...left, ...right };
|
|
379
|
+
|
|
380
|
+
// Handle null/undefined inline styles
|
|
381
|
+
if (right?.style === null || right?.style === undefined) {
|
|
382
|
+
if (left?.style) {
|
|
383
|
+
result.style = left.style;
|
|
384
|
+
}
|
|
385
|
+
} else if (rightIsInline && right?.style) {
|
|
386
|
+
// Filter inline styles if rightIsInline is true
|
|
387
|
+
const filteredRightStyle = filterCssVariables(right.style);
|
|
388
|
+
|
|
389
|
+
if (left?.style) {
|
|
390
|
+
if (!filteredRightStyle) {
|
|
391
|
+
// All inline styles were CSS variables, only use left
|
|
392
|
+
result.style = left.style;
|
|
393
|
+
} else {
|
|
394
|
+
const leftStyle = left.style;
|
|
395
|
+
|
|
396
|
+
// For arrays or objects, check if we need to create a style array
|
|
397
|
+
const leftIsObject =
|
|
398
|
+
typeof leftStyle === "object" && !Array.isArray(leftStyle);
|
|
399
|
+
const rightIsObject =
|
|
400
|
+
typeof filteredRightStyle === "object" &&
|
|
401
|
+
!Array.isArray(filteredRightStyle);
|
|
402
|
+
|
|
403
|
+
if (leftIsObject && rightIsObject) {
|
|
404
|
+
if (hasNonOverlappingProperties(leftStyle, filteredRightStyle)) {
|
|
405
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
406
|
+
} else {
|
|
407
|
+
// All left properties are in right, right overrides
|
|
408
|
+
result.style = filteredRightStyle;
|
|
409
|
+
}
|
|
410
|
+
} else {
|
|
411
|
+
// One or both are arrays, merge them
|
|
412
|
+
result.style = [leftStyle, filteredRightStyle];
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
} else {
|
|
416
|
+
// No left style, just use filtered right
|
|
417
|
+
if (filteredRightStyle) {
|
|
418
|
+
result.style = filteredRightStyle;
|
|
419
|
+
} else {
|
|
420
|
+
// All filtered out, remove style prop
|
|
421
|
+
delete result.style;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
} else if (!rightIsInline && right?.style) {
|
|
425
|
+
// Merging non-inline styles (e.g., important styles)
|
|
426
|
+
if (left?.style) {
|
|
427
|
+
// If left.style is an array, append right.style
|
|
428
|
+
if (Array.isArray(left.style)) {
|
|
429
|
+
const combined = [...left.style, right.style];
|
|
430
|
+
result.style = flattenStyleArray(combined);
|
|
431
|
+
} else if (
|
|
432
|
+
typeof left.style === "object" &&
|
|
433
|
+
typeof right.style === "object"
|
|
434
|
+
) {
|
|
435
|
+
// Both are objects, check for overlaps
|
|
436
|
+
if (hasNonOverlappingProperties(left.style, right.style)) {
|
|
437
|
+
result.style = flattenStyleArray([left.style, right.style]);
|
|
438
|
+
} else {
|
|
439
|
+
// All left properties are overridden by right
|
|
440
|
+
result.style = right.style;
|
|
441
|
+
}
|
|
442
|
+
} else {
|
|
443
|
+
// One or both are arrays/mixed types
|
|
444
|
+
const combined = [left.style, right.style];
|
|
445
|
+
result.style = flattenStyleArray(combined);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
} else {
|
|
450
|
+
result = mergeDefinedProps(left, right);
|
|
451
|
+
}
|
|
452
|
+
} else {
|
|
453
|
+
result = mergeDefinedProps(left, right);
|
|
454
|
+
}
|
|
130
455
|
|
|
131
456
|
if (
|
|
132
457
|
right &&
|
|
@@ -140,53 +465,74 @@ function deepMergeConfig(
|
|
|
140
465
|
/**
|
|
141
466
|
* If target is a path, deep merge until we get to the last key
|
|
142
467
|
*/
|
|
143
|
-
if (Array.isArray(config.target)
|
|
144
|
-
|
|
145
|
-
const key = config.target[
|
|
146
|
-
|
|
147
|
-
if (key === undefined) {
|
|
148
|
-
return result;
|
|
149
|
-
}
|
|
150
|
-
|
|
468
|
+
if (Array.isArray(config.target)) {
|
|
469
|
+
if (config.target.length > 1) {
|
|
470
|
+
const key = config.target[0]!;
|
|
151
471
|
result[key] = deepMergeConfig(
|
|
152
|
-
{ source: config.source, target: config.target.slice(
|
|
472
|
+
{ source: config.source, target: config.target.slice(1) },
|
|
153
473
|
left?.[key],
|
|
154
474
|
right?.[key],
|
|
155
475
|
rightIsInline,
|
|
156
476
|
);
|
|
157
477
|
}
|
|
158
478
|
|
|
479
|
+
// For length-1 array targets (e.g. ["contentContainerStyle"]), the loop
|
|
480
|
+
// above runs 0 iterations. Merge the target prop so inline styles don't
|
|
481
|
+
// silently overwrite className-computed styles (same as string target path).
|
|
482
|
+
const finalKey = config.target[config.target.length - 1];
|
|
483
|
+
if (config.target.length === 1 && finalKey && rightIsInline) {
|
|
484
|
+
let rightValue = right?.[finalKey];
|
|
485
|
+
if (rightValue !== undefined) {
|
|
486
|
+
rightValue = filterCssVariables(rightValue);
|
|
487
|
+
}
|
|
488
|
+
if (rightValue === undefined || rightValue === null) {
|
|
489
|
+
// Inline is empty or fully filtered — preserve className-computed value
|
|
490
|
+
if (left && finalKey in left) {
|
|
491
|
+
result[finalKey] = left[finalKey];
|
|
492
|
+
} else {
|
|
493
|
+
// No left value either — remove unfiltered inline value from result
|
|
494
|
+
delete result[finalKey];
|
|
495
|
+
}
|
|
496
|
+
} else if (left && finalKey in left) {
|
|
497
|
+
const leftValue = left[finalKey];
|
|
498
|
+
const leftIsObj =
|
|
499
|
+
typeof leftValue === "object" &&
|
|
500
|
+
leftValue !== null &&
|
|
501
|
+
!Array.isArray(leftValue);
|
|
502
|
+
const rightIsObj =
|
|
503
|
+
typeof rightValue === "object" &&
|
|
504
|
+
rightValue !== null &&
|
|
505
|
+
!Array.isArray(rightValue);
|
|
506
|
+
if (leftIsObj && rightIsObj) {
|
|
507
|
+
if (hasNonOverlappingProperties(leftValue, rightValue)) {
|
|
508
|
+
result[finalKey] = [leftValue, rightValue];
|
|
509
|
+
} else {
|
|
510
|
+
// All left keys are in right — use filtered right value
|
|
511
|
+
result[finalKey] = rightValue;
|
|
512
|
+
}
|
|
513
|
+
} else {
|
|
514
|
+
result[finalKey] = [leftValue, rightValue];
|
|
515
|
+
}
|
|
516
|
+
} else {
|
|
517
|
+
// No left value — use filtered right value (not the unfiltered one from mergeDefinedProps)
|
|
518
|
+
result[finalKey] = rightValue;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
159
522
|
return result;
|
|
160
523
|
}
|
|
161
524
|
|
|
162
|
-
const target =
|
|
163
|
-
? config.target[0]
|
|
164
|
-
: config.target;
|
|
525
|
+
const target = config.target;
|
|
165
526
|
|
|
166
|
-
if (target === undefined) {
|
|
527
|
+
if (target === undefined || target === false) {
|
|
167
528
|
return result;
|
|
168
529
|
}
|
|
169
530
|
|
|
170
531
|
let rightValue = right?.[target];
|
|
171
532
|
|
|
172
533
|
// Strip any inline variables from the target
|
|
173
|
-
if (rightIsInline && rightValue) {
|
|
174
|
-
|
|
175
|
-
rightValue = rightValue.filter((v) => {
|
|
176
|
-
return typeof v !== "object" || !(v && VAR_SYMBOL in v);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
if (rightValue.length === 0) {
|
|
180
|
-
rightValue = undefined;
|
|
181
|
-
}
|
|
182
|
-
} else if (
|
|
183
|
-
typeof rightValue === "object" &&
|
|
184
|
-
rightValue &&
|
|
185
|
-
VAR_SYMBOL in rightValue
|
|
186
|
-
) {
|
|
187
|
-
rightValue = undefined;
|
|
188
|
-
delete result[target][VAR_SYMBOL];
|
|
189
|
-
}
|
|
534
|
+
if (rightIsInline && rightValue !== undefined) {
|
|
535
|
+
rightValue = filterCssVariables(rightValue);
|
|
190
536
|
}
|
|
191
537
|
|
|
192
538
|
if (rightValue !== undefined) {
|
|
@@ -196,3 +542,64 @@ function deepMergeConfig(
|
|
|
196
542
|
|
|
197
543
|
return result;
|
|
198
544
|
}
|
|
545
|
+
|
|
546
|
+
function nativeStyleMapping(
|
|
547
|
+
config: Config,
|
|
548
|
+
props: Record<string, any> | undefined,
|
|
549
|
+
) {
|
|
550
|
+
if (!props) {
|
|
551
|
+
return props;
|
|
552
|
+
}
|
|
553
|
+
if (!config.nativeStyleMapping) {
|
|
554
|
+
if (config.target === false) delete props.style;
|
|
555
|
+
return props;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
let source: Record<string, any> | undefined;
|
|
559
|
+
|
|
560
|
+
if (typeof config.target === "string") {
|
|
561
|
+
source = props[config.target];
|
|
562
|
+
} else if (config.target === false) {
|
|
563
|
+
source = props["style"];
|
|
564
|
+
} else {
|
|
565
|
+
const tokens = [...config.target];
|
|
566
|
+
const lastToken = tokens.pop()!;
|
|
567
|
+
|
|
568
|
+
source = props;
|
|
569
|
+
for (const token of tokens) {
|
|
570
|
+
source = source[token];
|
|
571
|
+
if (!source) {
|
|
572
|
+
return props;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
source = source[lastToken];
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
if (!source) {
|
|
580
|
+
return props;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
for (const [key, path] of Object.entries(config.nativeStyleMapping)) {
|
|
584
|
+
const styleValue = source[key];
|
|
585
|
+
|
|
586
|
+
delete source[key];
|
|
587
|
+
|
|
588
|
+
if (styleValue === undefined) {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
let target = props;
|
|
593
|
+
const tokens = path.split(".");
|
|
594
|
+
const lastToken = tokens.pop();
|
|
595
|
+
for (const token of tokens) {
|
|
596
|
+
target[token] ??= {};
|
|
597
|
+
target = target[token];
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
target[lastToken!] = styleValue;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
if (config.target === false) delete props.style;
|
|
604
|
+
return props;
|
|
605
|
+
}
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
StyleDescriptor,
|
|
6
6
|
StyleFunction,
|
|
7
7
|
} from "react-native-css/compiler";
|
|
8
|
+
import { isStyleDescriptorArray } from "react-native-css/utilities";
|
|
8
9
|
|
|
9
10
|
import type { RenderGuard } from "../conditions/guards";
|
|
10
11
|
import { type Getter, type VariableContextValue } from "../reactivity";
|
|
@@ -12,6 +13,7 @@ import type { calculateProps } from "./calculate-props";
|
|
|
12
13
|
import { transformKeys } from "./defaults";
|
|
13
14
|
import * as functions from "./functions";
|
|
14
15
|
import { lineHeight } from "./line-height";
|
|
16
|
+
import { scaleFactor } from "./scale-factor";
|
|
15
17
|
import * as shorthands from "./shorthands";
|
|
16
18
|
import { em, rem, vh, vw } from "./units";
|
|
17
19
|
import { varResolver } from "./variables";
|
|
@@ -51,6 +53,7 @@ export type ResolveValueOptions = {
|
|
|
51
53
|
inlineVariables?: InlineVariable | undefined;
|
|
52
54
|
renderGuards?: RenderGuard[];
|
|
53
55
|
variableHistory?: Set<string>;
|
|
56
|
+
variableCycles?: Set<string>;
|
|
54
57
|
/** Pass down to perform recursive calculations and avoid circular dependencies */
|
|
55
58
|
calculateProps?: typeof calculateProps;
|
|
56
59
|
};
|
|
@@ -77,7 +80,7 @@ export function resolveValue(
|
|
|
77
80
|
return null;
|
|
78
81
|
} else if (value.endsWith("px")) {
|
|
79
82
|
// Inline vars() might set a value with a px suffix
|
|
80
|
-
return
|
|
83
|
+
return parseFloat(value.slice(0, -2));
|
|
81
84
|
} else {
|
|
82
85
|
return value;
|
|
83
86
|
}
|
|
@@ -87,7 +90,7 @@ export function resolveValue(
|
|
|
87
90
|
return value;
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
if (
|
|
93
|
+
if (isStyleDescriptorArray(value)) {
|
|
91
94
|
value = value
|
|
92
95
|
.map((d) => resolveValue(d, get, options))
|
|
93
96
|
.filter((d) => d !== undefined);
|
|
@@ -122,7 +125,16 @@ export function resolveValue(
|
|
|
122
125
|
) as StyleDescriptor;
|
|
123
126
|
} else if (transformKeys.has(name)) {
|
|
124
127
|
// translate, rotate, scale, etc.
|
|
125
|
-
|
|
128
|
+
let resolved = simpleResolve(value[2], castToArray);
|
|
129
|
+
// CSS scale percentages describe a factor, unlike translation percentages.
|
|
130
|
+
if (
|
|
131
|
+
(name === "scaleX" || name === "scaleY" || name === "scale") &&
|
|
132
|
+
typeof resolved === "string" &&
|
|
133
|
+
resolved.endsWith("%")
|
|
134
|
+
) {
|
|
135
|
+
resolved = scaleFactor(resolved);
|
|
136
|
+
}
|
|
137
|
+
return { [name]: resolved };
|
|
126
138
|
} else {
|
|
127
139
|
let args = simpleResolve(value[2], castToArray);
|
|
128
140
|
|
|
@@ -154,11 +166,3 @@ export function resolveValue(
|
|
|
154
166
|
}
|
|
155
167
|
}
|
|
156
168
|
}
|
|
157
|
-
|
|
158
|
-
function isDescriptorArray(
|
|
159
|
-
value: StyleDescriptor | StyleDescriptor[],
|
|
160
|
-
): value is StyleDescriptor[] {
|
|
161
|
-
return Array.isArray(value) && typeof value[0] === "object"
|
|
162
|
-
? Array.isArray(value[0])
|
|
163
|
-
: true;
|
|
164
|
-
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isStyleDescriptorArray,
|
|
4
|
+
isStyleFunction,
|
|
5
|
+
} from "react-native-css/utilities";
|
|
3
6
|
|
|
4
7
|
import { setDeepPath } from "../../objects";
|
|
5
8
|
import { ShortHandSymbol } from "../constants";
|
|
@@ -56,6 +59,16 @@ export function shorthandHandler(
|
|
|
56
59
|
return type.includes(value) || type.includes(typeof value);
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
// Style functions (var, calc, env, etc.) are unresolved at pattern-match
|
|
63
|
+
// time — their actual values won't be known until runtime variable
|
|
64
|
+
// resolution. Accepting them in any type slot makes pattern matching
|
|
65
|
+
// less strict when variables are involved, but rejecting them would
|
|
66
|
+
// break variable-based shadows entirely (e.g. box-shadow: var(--shadow)
|
|
67
|
+
// where --shadow resolves to "0 4px 6px -1px #000").
|
|
68
|
+
if (isStyleFunction(value)) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
|
|
59
72
|
switch (type) {
|
|
60
73
|
case "string":
|
|
61
74
|
case "number":
|
|
@@ -39,6 +39,8 @@ export const animationShorthand = shorthandHandler(
|
|
|
39
39
|
[name],
|
|
40
40
|
[duration, name],
|
|
41
41
|
[name, duration],
|
|
42
|
+
[name, duration, timingFunction],
|
|
43
|
+
[duration, timingFunction, name],
|
|
42
44
|
[name, duration, iteration],
|
|
43
45
|
[name, duration, timingFunction, iteration],
|
|
44
46
|
[duration, delay, name],
|
|
@@ -67,7 +69,7 @@ export const animation: StyleFunctionResolver = (
|
|
|
67
69
|
) => {
|
|
68
70
|
const animationShortHandTuples = animationShorthand(
|
|
69
71
|
resolveValue,
|
|
70
|
-
value,
|
|
72
|
+
[value[2]],
|
|
71
73
|
get,
|
|
72
74
|
options,
|
|
73
75
|
);
|
|
@@ -86,6 +88,10 @@ export const animation: StyleFunctionResolver = (
|
|
|
86
88
|
return;
|
|
87
89
|
}
|
|
88
90
|
|
|
91
|
+
if (name === "none") {
|
|
92
|
+
return applyShorthand(animationShortHandTuples);
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
const keyframes = get(StyleCollection.keyframes(name));
|
|
90
96
|
|
|
91
97
|
const animation: Record<string, any> = {};
|
|
@@ -127,5 +133,5 @@ export const animationName: StyleFunctionResolver = (
|
|
|
127
133
|
options,
|
|
128
134
|
) => {
|
|
129
135
|
const shorthand: any = animation(resolveValue, value, get, options);
|
|
130
|
-
return shorthand
|
|
136
|
+
return shorthand?.animationName;
|
|
131
137
|
};
|