react-native-css 3.0.0-nightly.fa5e95b → 3.0.0-preview.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/compiler/atRules.js +15 -2
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +13 -8
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +323 -176
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +12 -12
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
- package/dist/commonjs/compiler/keyframes.js +1 -1
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/pseudo-elements.js +49 -0
- package/dist/commonjs/compiler/pseudo-elements.js.map +1 -0
- package/dist/commonjs/compiler/selector-builder.js +501 -0
- package/dist/commonjs/compiler/selector-builder.js.map +1 -0
- package/dist/commonjs/compiler/selectors.js +10 -6
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +63 -25
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +27 -0
- package/dist/commonjs/compiler/supports.js.map +1 -0
- package/dist/commonjs/components/ActivityIndicator.js +22 -0
- package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
- package/dist/commonjs/components/Button.js +22 -0
- package/dist/commonjs/components/Button.js.map +1 -0
- package/dist/commonjs/components/FlatList.js +19 -0
- package/dist/commonjs/components/FlatList.js.map +1 -0
- package/dist/commonjs/components/Image.js +17 -0
- package/dist/commonjs/components/Image.js.map +1 -0
- package/dist/commonjs/components/Switch.js +17 -0
- package/dist/commonjs/components/Switch.js.map +1 -0
- package/dist/commonjs/components/TextInput.js +17 -0
- package/dist/commonjs/components/TextInput.js.map +1 -0
- package/dist/commonjs/components/index.js +48 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/components/react-native-safe-area-context.js +17 -0
- package/dist/commonjs/components/react-native-safe-area-context.js.map +1 -0
- package/dist/commonjs/components/react-native-safe-area-context.native.js +53 -0
- package/dist/commonjs/components/react-native-safe-area-context.native.js.map +1 -0
- package/dist/commonjs/jest/index.js +24 -18
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +7 -4
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/injection-code.js +5 -10
- package/dist/commonjs/metro/injection-code.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +18 -8
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/metro/resolver.js +3 -0
- package/dist/commonjs/metro/resolver.js.map +1 -1
- package/dist/commonjs/poison.pill.js +10 -10
- package/dist/commonjs/runtime/native/api.js +29 -4
- package/dist/commonjs/runtime/native/api.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
- package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +7 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +6 -40
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +16 -11
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +26 -20
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +2 -2
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +12 -25
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/reanimated.js +17 -0
- package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js +29 -9
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/defaults.js +1 -1
- package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
- package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/calc.js +125 -0
- package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{filters.js → functions/filters.js} +3 -3
- package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js +83 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js +32 -0
- package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +3 -3
- package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/string-functions.js +23 -0
- package/dist/commonjs/runtime/native/styles/functions/string-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +121 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +6 -37
- package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{border.js → shorthands/border.js} +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js +50 -0
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
- package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/units.js +11 -9
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/variables.js +3 -2
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +14 -6
- package/dist/commonjs/runtime/utils/objects.js.map +1 -1
- package/dist/commonjs/runtime/utils/specificity.js +2 -1
- package/dist/commonjs/runtime/utils/specificity.js.map +1 -1
- package/dist/commonjs/runtime/web/api.js +18 -0
- package/dist/commonjs/runtime/web/api.js.map +1 -1
- package/dist/commonjs/style-collection/index.js +110 -0
- package/dist/commonjs/style-collection/index.js.map +1 -0
- package/dist/commonjs/style-collection/root.js +29 -0
- package/dist/commonjs/style-collection/root.js.map +1 -0
- package/dist/module/compiler/atRules.js +15 -2
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +13 -8
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +314 -172
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +12 -12
- package/dist/module/compiler/inheritance.test.js.map +1 -1
- package/dist/module/compiler/keyframes.js +1 -1
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/pseudo-elements.js +44 -0
- package/dist/module/compiler/pseudo-elements.js.map +1 -0
- package/dist/module/compiler/selector-builder.js +496 -0
- package/dist/module/compiler/selector-builder.js.map +1 -0
- package/dist/module/compiler/selectors.js +10 -6
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +61 -23
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +23 -0
- package/dist/module/compiler/supports.js.map +1 -0
- package/dist/module/components/ActivityIndicator.js +17 -0
- package/dist/module/components/ActivityIndicator.js.map +1 -0
- package/dist/module/components/Button.js +17 -0
- package/dist/module/components/Button.js.map +1 -0
- package/dist/module/components/FlatList.js +14 -0
- package/dist/module/components/FlatList.js.map +1 -0
- package/dist/module/components/Image.js +12 -0
- package/dist/module/components/Image.js.map +1 -0
- package/dist/module/components/Switch.js +12 -0
- package/dist/module/components/Switch.js.map +1 -0
- package/dist/module/components/TextInput.js +12 -0
- package/dist/module/components/TextInput.js.map +1 -0
- package/dist/module/components/index.js +6 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/react-native-safe-area-context.js +4 -0
- package/dist/module/components/react-native-safe-area-context.js.map +1 -0
- package/dist/module/components/react-native-safe-area-context.native.js +36 -0
- package/dist/module/components/react-native-safe-area-context.native.js.map +1 -0
- package/dist/module/jest/index.js +23 -18
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +7 -4
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/injection-code.js +5 -10
- package/dist/module/metro/injection-code.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +18 -8
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/resolver.js +3 -0
- package/dist/module/metro/resolver.js.map +1 -1
- package/dist/module/poison.pill.js +10 -10
- package/dist/module/runtime/native/api.js +23 -4
- package/dist/module/runtime/native/api.js.map +1 -1
- package/dist/module/runtime/native/conditions/attributes.js +38 -0
- package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +7 -0
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +6 -40
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +17 -12
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +24 -19
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +11 -24
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/reanimated.js +13 -0
- package/dist/module/runtime/native/reanimated.js.map +1 -0
- package/dist/module/runtime/native/styles/calculate-props.js +30 -10
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/defaults.js +1 -1
- package/dist/module/runtime/native/styles/defaults.js.map +1 -1
- package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
- package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/calc.js +120 -0
- package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
- package/dist/module/runtime/native/styles/{filters.js → functions/filters.js} +2 -2
- package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/index.js +10 -0
- package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/numeric-functions.js +25 -0
- package/dist/module/runtime/native/styles/functions/numeric-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +1 -1
- package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/string-functions.js +18 -0
- package/dist/module/runtime/native/styles/functions/string-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js +114 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/resolve.js +20 -44
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
- package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +16 -6
- package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
- package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
- package/dist/module/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
- package/dist/module/runtime/native/styles/units.js +12 -9
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/module/runtime/native/styles/variables.js +2 -1
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +14 -6
- package/dist/module/runtime/utils/objects.js.map +1 -1
- package/dist/module/runtime/utils/specificity.js +2 -1
- package/dist/module/runtime/utils/specificity.js.map +1 -1
- package/dist/module/runtime/web/api.js +18 -1
- package/dist/module/runtime/web/api.js.map +1 -1
- package/dist/module/style-collection/index.js +95 -0
- package/dist/module/style-collection/index.js.map +1 -0
- package/dist/module/style-collection/root.js +25 -0
- package/dist/module/style-collection/root.js.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +11 -13
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +26 -17
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
- package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +24 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +7 -7
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/supports.d.ts +3 -0
- package/dist/typescript/commonjs/src/compiler/supports.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +13 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Button.d.ts +13 -0
- package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/FlatList.d.ts +10 -0
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Image.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Switch.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +4 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/index.d.ts +13 -3
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +4 -7
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +4 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +16 -2
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +1 -11
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts +9 -3
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/style-collection/index.d.ts +14 -0
- package/dist/typescript/commonjs/src/style-collection/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/style-collection/root.d.ts +11 -0
- package/dist/typescript/commonjs/src/style-collection/root.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +11 -13
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +26 -17
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +24 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +7 -7
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/supports.d.ts +3 -0
- package/dist/typescript/module/src/compiler/supports.d.ts.map +1 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +13 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Button.d.ts +13 -0
- package/dist/typescript/module/src/components/Button.d.ts.map +1 -0
- package/dist/typescript/module/src/components/FlatList.d.ts +10 -0
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Image.d.ts +8 -0
- package/dist/typescript/module/src/components/Image.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Switch.d.ts +8 -0
- package/dist/typescript/module/src/components/Switch.d.ts.map +1 -0
- package/dist/typescript/module/src/components/TextInput.d.ts +8 -0
- package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +6 -0
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts +2 -0
- package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts.map +1 -0
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +4 -0
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/index.d.ts +13 -3
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts +4 -7
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +4 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts +16 -2
- package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +1 -11
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
- package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
- package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/api.d.ts +9 -3
- package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/style-collection/index.d.ts +14 -0
- package/dist/typescript/module/src/style-collection/index.d.ts.map +1 -0
- package/dist/typescript/module/src/style-collection/root.d.ts +11 -0
- package/dist/typescript/module/src/style-collection/root.d.ts.map +1 -0
- package/package.json +30 -15
- package/src/compiler/atRules.ts +16 -2
- package/src/compiler/compiler.ts +12 -10
- package/src/compiler/compiler.types.ts +11 -14
- package/src/compiler/declarations.ts +518 -215
- package/src/compiler/inheritance.test.ts +10 -10
- package/src/compiler/keyframes.ts +1 -1
- package/src/compiler/pseudo-elements.ts +54 -0
- package/src/compiler/selector-builder.ts +586 -0
- package/src/compiler/selectors.ts +20 -6
- package/src/compiler/stylesheet.ts +93 -33
- package/src/compiler/supports.ts +26 -0
- package/src/components/ActivityIndicator.tsx +27 -0
- package/src/components/Button.tsx +22 -0
- package/src/components/FlatList.tsx +21 -0
- package/src/components/Image.tsx +17 -0
- package/src/components/Switch.tsx +17 -0
- package/src/components/TextInput.tsx +17 -0
- package/src/components/index.tsx +6 -0
- package/src/components/react-native-safe-area-context.native.tsx +40 -0
- package/src/components/react-native-safe-area-context.tsx +1 -0
- package/src/jest/index.ts +26 -17
- package/src/metro/index.ts +12 -7
- package/src/metro/injection-code.ts +6 -10
- package/src/metro/metro-transformer.ts +27 -10
- package/src/metro/resolver.ts +8 -0
- package/src/poison.pill.ts +10 -10
- package/src/runtime/native/{api.ts → api.tsx} +34 -5
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +5 -0
- package/src/runtime/native/conditions/index.ts +7 -59
- package/src/runtime/native/conditions/media-query.ts +18 -12
- package/src/runtime/native/react/rules.ts +27 -17
- package/src/runtime/native/react/useNativeCss.ts +1 -1
- package/src/runtime/native/reactivity.ts +13 -33
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/styles/calculate-props.ts +30 -8
- package/src/runtime/native/styles/defaults.ts +1 -0
- package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
- package/src/runtime/native/styles/functions/calc.ts +121 -0
- package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
- package/src/runtime/native/styles/functions/index.ts +7 -0
- package/src/runtime/native/styles/functions/numeric-functions.ts +38 -0
- package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
- package/src/runtime/native/styles/functions/string-functions.ts +22 -0
- package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
- package/src/runtime/native/styles/resolve.ts +20 -63
- package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
- package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -62
- package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
- package/src/runtime/native/styles/shorthands/box-shadow.ts +74 -0
- package/src/runtime/native/styles/shorthands/index.ts +5 -0
- package/src/runtime/native/styles/{text-shadow.ts → shorthands/text-shadow.ts} +1 -1
- package/src/runtime/native/styles/{transform.ts → shorthands/transform.ts} +4 -2
- package/src/runtime/native/styles/units.ts +14 -9
- package/src/runtime/native/styles/variables.ts +5 -5
- package/src/runtime/utils/objects.ts +16 -4
- package/src/runtime/utils/specificity.ts +1 -0
- package/src/runtime/web/{api.ts → api.tsx} +29 -3
- package/src/style-collection/index.ts +142 -0
- package/src/style-collection/root.ts +37 -0
- package/dist/commonjs/compiler/attributes.test.js +0 -20
- package/dist/commonjs/compiler/attributes.test.js.map +0 -1
- package/dist/commonjs/doctor/index.js +0 -6
- package/dist/commonjs/doctor/index.js.map +0 -1
- package/dist/commonjs/runtime/native/injection.js +0 -98
- package/dist/commonjs/runtime/native/injection.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/animation.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/border.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/box-shadow.js +0 -40
- package/dist/commonjs/runtime/native/styles/box-shadow.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/calc.js +0 -85
- package/dist/commonjs/runtime/native/styles/calc.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/filters.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/platform-functions.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/text-shadow.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/transform.js.map +0 -1
- package/dist/module/compiler/attributes.test.js +0 -20
- package/dist/module/compiler/attributes.test.js.map +0 -1
- package/dist/module/doctor/index.js +0 -4
- package/dist/module/doctor/index.js.map +0 -1
- package/dist/module/runtime/native/injection.js +0 -93
- package/dist/module/runtime/native/injection.js.map +0 -1
- package/dist/module/runtime/native/styles/animation.js.map +0 -1
- package/dist/module/runtime/native/styles/border.js.map +0 -1
- package/dist/module/runtime/native/styles/box-shadow.js.map +0 -1
- package/dist/module/runtime/native/styles/calc.js +0 -79
- package/dist/module/runtime/native/styles/calc.js.map +0 -1
- package/dist/module/runtime/native/styles/filters.js.map +0 -1
- package/dist/module/runtime/native/styles/platform-functions.js.map +0 -1
- package/dist/module/runtime/native/styles/shorthand.js.map +0 -1
- package/dist/module/runtime/native/styles/text-shadow.js.map +0 -1
- package/dist/module/runtime/native/styles/transform.js.map +0 -1
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +0 -2
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/doctor/index.d.ts +0 -2
- package/dist/typescript/commonjs/src/doctor/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +0 -16
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +0 -9
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +0 -3
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +0 -3
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/attributes.test.d.ts +0 -2
- package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +0 -1
- package/dist/typescript/module/src/doctor/index.d.ts +0 -2
- package/dist/typescript/module/src/doctor/index.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts +0 -16
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +0 -9
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +0 -3
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +0 -3
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +0 -1
- package/src/compiler/attributes.test.ts +0 -28
- package/src/doctor/index.ts +0 -1
- package/src/runtime/native/injection.ts +0 -131
- package/src/runtime/native/styles/box-shadow.ts +0 -54
- package/src/runtime/native/styles/calc.ts +0 -97
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
4
|
+
const advancedTimingFunctions: Record<
|
|
5
|
+
string,
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7
|
+
() => (...args: any[]) => unknown
|
|
8
|
+
> = {
|
|
9
|
+
cubicBezier: () => {
|
|
10
|
+
return (
|
|
11
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
12
|
+
).cubicBezier;
|
|
13
|
+
},
|
|
14
|
+
steps: () => {
|
|
15
|
+
return (
|
|
16
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
17
|
+
).steps;
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const timingFunctionResolver: StyleFunctionResolver = (resolveValue, value) => {
|
|
22
|
+
const name = value[1];
|
|
23
|
+
const resolver = advancedTimingFunctions[name];
|
|
24
|
+
|
|
25
|
+
if (!resolver) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const args = resolveValue(value[2]);
|
|
30
|
+
|
|
31
|
+
if (!Array.isArray(args)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const fn = resolver();
|
|
36
|
+
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
38
|
+
const result = fn(...args);
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const cubicBezier = timingFunctionResolver;
|
|
44
|
+
export const steps = timingFunctionResolver;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
interface Value {
|
|
4
|
+
value: number;
|
|
5
|
+
isPercent: boolean;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const precedence: Record<string, number> = { "+": 1, "-": 1, "*": 2, "/": 2 };
|
|
9
|
+
|
|
10
|
+
export const calc: StyleFunctionResolver = (resolveValue, func) => {
|
|
11
|
+
const tokens = resolveValue(func[2]);
|
|
12
|
+
|
|
13
|
+
if (!Array.isArray(tokens)) {
|
|
14
|
+
return tokens;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// --- Step 1: Convert to RPN (Shunting-Yard) ---
|
|
18
|
+
const output: (string | Value)[] = [];
|
|
19
|
+
const ops: string[] = [];
|
|
20
|
+
|
|
21
|
+
for (const t of tokens) {
|
|
22
|
+
if (typeof t === "number") {
|
|
23
|
+
output.push({ value: round(t), isPercent: false });
|
|
24
|
+
} else if (typeof t === "string") {
|
|
25
|
+
if (t.endsWith("%")) {
|
|
26
|
+
const num = parseFloat(t.slice(0, -1));
|
|
27
|
+
if (Number.isNaN(num)) return undefined;
|
|
28
|
+
output.push({ value: round(num / 100), isPercent: true });
|
|
29
|
+
} else if (t === "+" || t === "-" || t === "*" || t === "/") {
|
|
30
|
+
while (
|
|
31
|
+
ops.length &&
|
|
32
|
+
(ops[ops.length - 1] === "+" ||
|
|
33
|
+
ops[ops.length - 1] === "-" ||
|
|
34
|
+
ops[ops.length - 1] === "*" ||
|
|
35
|
+
ops[ops.length - 1] === "/") &&
|
|
36
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
37
|
+
(precedence[ops[ops.length - 1]!] ?? 0) >= (precedence[t] ?? 0)
|
|
38
|
+
) {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
40
|
+
output.push(ops.pop()!);
|
|
41
|
+
}
|
|
42
|
+
ops.push(t);
|
|
43
|
+
} else if (t === "(") {
|
|
44
|
+
ops.push(t);
|
|
45
|
+
} else if (t === ")") {
|
|
46
|
+
while (ops.length && ops[ops.length - 1] !== "(") {
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
48
|
+
output.push(ops.pop()!);
|
|
49
|
+
}
|
|
50
|
+
if (ops.pop() !== "(") return undefined; // mismatched parens
|
|
51
|
+
} else {
|
|
52
|
+
return undefined; // invalid token
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
while (ops.length) {
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
60
|
+
const op = ops.pop()!;
|
|
61
|
+
if (op === "(" || op === ")") return undefined;
|
|
62
|
+
output.push(op);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// --- Step 2: Evaluate RPN ---
|
|
66
|
+
const stack: Value[] = [];
|
|
67
|
+
for (const t of output) {
|
|
68
|
+
if (typeof t !== "string") {
|
|
69
|
+
stack.push(t);
|
|
70
|
+
} else {
|
|
71
|
+
const b = stack.pop();
|
|
72
|
+
const a = stack.pop();
|
|
73
|
+
if (!a || !b) return undefined;
|
|
74
|
+
|
|
75
|
+
const res: Value = { value: 0, isPercent: false };
|
|
76
|
+
|
|
77
|
+
switch (t) {
|
|
78
|
+
case "+":
|
|
79
|
+
case "-": {
|
|
80
|
+
if (a.isPercent !== b.isPercent) return undefined; // cannot mix
|
|
81
|
+
res.isPercent = a.isPercent;
|
|
82
|
+
res.value =
|
|
83
|
+
t === "+" ? round(a.value + b.value) : round(a.value - b.value);
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case "*": {
|
|
87
|
+
if (a.isPercent && b.isPercent) return undefined; // ambiguous
|
|
88
|
+
res.isPercent = a.isPercent || b.isPercent;
|
|
89
|
+
res.value = round(a.value * b.value);
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
case "/": {
|
|
93
|
+
if (b.value === 0) return undefined;
|
|
94
|
+
if (a.isPercent && b.isPercent) {
|
|
95
|
+
// % / % → plain number ratio
|
|
96
|
+
res.isPercent = false;
|
|
97
|
+
res.value = round(a.value / b.value);
|
|
98
|
+
} else {
|
|
99
|
+
res.isPercent = a.isPercent || b.isPercent;
|
|
100
|
+
res.value = round(a.value / b.value);
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
stack.push(res);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (stack.length !== 1) return undefined;
|
|
110
|
+
|
|
111
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
112
|
+
const final = stack[0]!;
|
|
113
|
+
if (final.isPercent) {
|
|
114
|
+
return `${final.value * 100}%`;
|
|
115
|
+
}
|
|
116
|
+
return final.value;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
function round(number: number) {
|
|
120
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
121
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { isStyleDescriptorArray } from "
|
|
2
|
-
import type { StyleFunctionResolver } from "
|
|
3
|
-
import { shorthandHandler } from "
|
|
1
|
+
import { isStyleDescriptorArray } from "../../../utils";
|
|
2
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
3
|
+
import { shorthandHandler } from "../shorthands/_handler";
|
|
4
4
|
|
|
5
5
|
export const blur: StyleFunctionResolver = (resolveValue, value) => {
|
|
6
6
|
const args = resolveValue(value[2]);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
export const max: StyleFunctionResolver = (resolveValue, value) => {
|
|
4
|
+
const args = resolveValue(value[2]);
|
|
5
|
+
|
|
6
|
+
if (!Array.isArray(args) || args.some((arg) => typeof arg !== "number")) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
return Math.max(...(args as number[]));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const min: StyleFunctionResolver = (resolveValue, value) => {
|
|
14
|
+
const args = resolveValue(value[2]);
|
|
15
|
+
|
|
16
|
+
if (!Array.isArray(args) || args.some((arg) => typeof arg !== "number")) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return Math.min(...(args as number[]));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const clamp: StyleFunctionResolver = (resolveValue, value) => {
|
|
24
|
+
const args = resolveValue(value[2]);
|
|
25
|
+
|
|
26
|
+
const [clampValue, min, max] = args as number[];
|
|
27
|
+
|
|
28
|
+
if (
|
|
29
|
+
!Array.isArray(args) ||
|
|
30
|
+
typeof clampValue !== "number" ||
|
|
31
|
+
typeof min !== "number" ||
|
|
32
|
+
typeof max !== "number"
|
|
33
|
+
) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return Math.min(Math.max(clampValue, min), max);
|
|
38
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PixelRatio, PlatformColor, StyleSheet } from "react-native";
|
|
2
2
|
|
|
3
|
-
import type { StyleFunctionResolver } from "
|
|
3
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
4
4
|
|
|
5
5
|
export const platformColor: StyleFunctionResolver = (resolveValue, value) => {
|
|
6
6
|
const color: unknown = resolveValue(value[2]);
|
|
@@ -25,7 +25,7 @@ export const fontScale: StyleFunctionResolver = () => {
|
|
|
25
25
|
return PixelRatio.getFontScale();
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
export const
|
|
28
|
+
export const getPixelSizeForLayoutSize: StyleFunctionResolver = (
|
|
29
29
|
resolveValue,
|
|
30
30
|
value,
|
|
31
31
|
) => {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
|
+
|
|
3
|
+
export const join: StyleFunctionResolver = (resolveValue, value) => {
|
|
4
|
+
const args = resolveValue(value[2]);
|
|
5
|
+
|
|
6
|
+
if (!Array.isArray(args)) {
|
|
7
|
+
return args;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const array: unknown = args[0];
|
|
11
|
+
const separator: unknown = args[1] ?? ",";
|
|
12
|
+
|
|
13
|
+
if (!Array.isArray(array)) {
|
|
14
|
+
return array;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (!separator || typeof separator !== "string") {
|
|
18
|
+
return array.join();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return array.join(separator);
|
|
22
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { isStyleDescriptorArray } from "../../../utils";
|
|
2
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
3
|
+
|
|
4
|
+
export const scale: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
5
|
+
const args = descriptor[2];
|
|
6
|
+
|
|
7
|
+
if (!isStyleDescriptorArray(args)) {
|
|
8
|
+
return { scale: resolveValue(args) };
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const x = resolveValue(args[0]);
|
|
12
|
+
const y = resolveValue(args[1]);
|
|
13
|
+
|
|
14
|
+
const isXValid = typeof x === "string" || typeof x === "number";
|
|
15
|
+
const isYValid = typeof y === "string" || typeof y === "number";
|
|
16
|
+
|
|
17
|
+
if (isXValid && isYValid) {
|
|
18
|
+
return x === y ? { scale: x } : [{ scaleX: x }, { scaleY: y }];
|
|
19
|
+
} else if (isXValid) {
|
|
20
|
+
return { scaleX: x };
|
|
21
|
+
} else if (isYValid) {
|
|
22
|
+
return { scaleY: y };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const rotate: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
29
|
+
const args = descriptor[2];
|
|
30
|
+
|
|
31
|
+
if (!isStyleDescriptorArray(args)) {
|
|
32
|
+
return { rotate: resolveValue(args) };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const x = resolveValue(args[0]);
|
|
36
|
+
const y = resolveValue(args[1]);
|
|
37
|
+
const z = resolveValue(args[2]);
|
|
38
|
+
|
|
39
|
+
const isXValid = typeof x === "string" || typeof x === "number";
|
|
40
|
+
const isYValid = typeof y === "string" || typeof y === "number";
|
|
41
|
+
const isZValid = typeof z === "string" || typeof z === "number";
|
|
42
|
+
|
|
43
|
+
if (isXValid && isYValid && isZValid) {
|
|
44
|
+
return [{ rotateX: x }, { rotateY: y }, { rotateZ: z }];
|
|
45
|
+
} else if (isXValid && isYValid) {
|
|
46
|
+
return [{ rotateX: x }, { rotateY: y }];
|
|
47
|
+
} else if (isXValid && isZValid) {
|
|
48
|
+
return [{ rotateX: x }, { rotateZ: z }];
|
|
49
|
+
} else if (isYValid && isZValid) {
|
|
50
|
+
return [{ rotateY: y }, { rotateZ: z }];
|
|
51
|
+
} else if (isXValid) {
|
|
52
|
+
return { rotateX: x };
|
|
53
|
+
} else if (isYValid) {
|
|
54
|
+
return { rotateY: y };
|
|
55
|
+
} else if (isZValid) {
|
|
56
|
+
return { rotateZ: z };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const translate: StyleFunctionResolver = (resolveValue, descriptor) => {
|
|
63
|
+
const args = descriptor[2];
|
|
64
|
+
|
|
65
|
+
if (!isStyleDescriptorArray(args)) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const x = resolveValue(args[0]);
|
|
70
|
+
const y = resolveValue(args[1]);
|
|
71
|
+
|
|
72
|
+
const isXValid = typeof x === "string" || typeof x === "number";
|
|
73
|
+
const isYValid = typeof y === "string" || typeof y === "number";
|
|
74
|
+
|
|
75
|
+
if (isXValid && isYValid) {
|
|
76
|
+
return [{ translateX: x }, { translateY: y }];
|
|
77
|
+
} else if (isXValid) {
|
|
78
|
+
return { translateX: x };
|
|
79
|
+
} else if (isYValid) {
|
|
80
|
+
return { translateY: y };
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return;
|
|
84
|
+
};
|
|
@@ -7,34 +7,10 @@ import type {
|
|
|
7
7
|
} from "../../../compiler";
|
|
8
8
|
import type { RenderGuard } from "../conditions/guards";
|
|
9
9
|
import { type Getter, type VariableContextValue } from "../reactivity";
|
|
10
|
-
import { animation, timingFunctionResolver } from "./animation";
|
|
11
|
-
import { border } from "./border";
|
|
12
|
-
import { boxShadow } from "./box-shadow";
|
|
13
|
-
import { calc } from "./calc";
|
|
14
10
|
import type { calculateProps } from "./calculate-props";
|
|
15
11
|
import { transformKeys } from "./defaults";
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
brightness,
|
|
19
|
-
contrast,
|
|
20
|
-
dropShadow,
|
|
21
|
-
grayscale,
|
|
22
|
-
hueRotate,
|
|
23
|
-
invert,
|
|
24
|
-
opacity,
|
|
25
|
-
saturate,
|
|
26
|
-
sepia,
|
|
27
|
-
} from "./filters";
|
|
28
|
-
import {
|
|
29
|
-
fontScale,
|
|
30
|
-
hairlineWidth,
|
|
31
|
-
pixelRatio,
|
|
32
|
-
pixelSizeForLayoutSize,
|
|
33
|
-
platformColor,
|
|
34
|
-
roundToNearestPixel,
|
|
35
|
-
} from "./platform-functions";
|
|
36
|
-
import { textShadow } from "./text-shadow";
|
|
37
|
-
import { transform } from "./transform";
|
|
12
|
+
import * as functions from "./functions";
|
|
13
|
+
import * as shorthands from "./shorthands";
|
|
38
14
|
import { em, rem, vh, vw } from "./units";
|
|
39
15
|
import { varResolver } from "./variables";
|
|
40
16
|
|
|
@@ -57,34 +33,12 @@ export type StyleResolver = (
|
|
|
57
33
|
options: ResolveValueOptions,
|
|
58
34
|
) => unknown;
|
|
59
35
|
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"@textShadow": textShadow,
|
|
65
|
-
"@transform": transform,
|
|
66
|
-
"animationName": animation,
|
|
67
|
-
"cubic-bezier": timingFunctionResolver,
|
|
68
|
-
"steps": timingFunctionResolver,
|
|
69
|
-
"hue-rotate": hueRotate,
|
|
70
|
-
"drop-shadow": dropShadow,
|
|
71
|
-
blur,
|
|
72
|
-
brightness,
|
|
73
|
-
calc,
|
|
74
|
-
contrast,
|
|
36
|
+
const functionResolvers = {
|
|
37
|
+
...shorthands,
|
|
38
|
+
...functions,
|
|
39
|
+
animationName: shorthands.animation,
|
|
75
40
|
em,
|
|
76
|
-
fontScale,
|
|
77
|
-
grayscale,
|
|
78
|
-
hairlineWidth,
|
|
79
|
-
invert,
|
|
80
|
-
opacity,
|
|
81
|
-
pixelRatio,
|
|
82
|
-
pixelSizeForLayoutSize,
|
|
83
|
-
platformColor,
|
|
84
41
|
rem,
|
|
85
|
-
roundToNearestPixel,
|
|
86
|
-
saturate,
|
|
87
|
-
sepia,
|
|
88
42
|
vh,
|
|
89
43
|
vw,
|
|
90
44
|
};
|
|
@@ -116,10 +70,16 @@ export function resolveValue(
|
|
|
116
70
|
case "number":
|
|
117
71
|
case "boolean":
|
|
118
72
|
return value;
|
|
119
|
-
case "string":
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
73
|
+
case "string": {
|
|
74
|
+
if (value === "unset") {
|
|
75
|
+
return null;
|
|
76
|
+
} else if (value.endsWith("px")) {
|
|
77
|
+
// Inline vars() might set a value with a px suffix
|
|
78
|
+
return parseInt(value.slice(0, -2), 10);
|
|
79
|
+
} else {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
123
83
|
case "object": {
|
|
124
84
|
if (!Array.isArray(value)) {
|
|
125
85
|
return value;
|
|
@@ -145,8 +105,8 @@ export function resolveValue(
|
|
|
145
105
|
|
|
146
106
|
if (name === "var") {
|
|
147
107
|
return varResolver(simpleResolve, value, get, options);
|
|
148
|
-
} else if (name in
|
|
149
|
-
const fn =
|
|
108
|
+
} else if (name in functionResolvers) {
|
|
109
|
+
const fn = functionResolvers[name as keyof typeof functionResolvers];
|
|
150
110
|
|
|
151
111
|
if (typeof fn !== "function") {
|
|
152
112
|
throw new Error(`Unknown function: ${name}`);
|
|
@@ -160,11 +120,7 @@ export function resolveValue(
|
|
|
160
120
|
) as StyleDescriptor;
|
|
161
121
|
} else if (transformKeys.has(name)) {
|
|
162
122
|
// translate, rotate, scale, etc.
|
|
163
|
-
|
|
164
|
-
return simpleResolve(args, castToArray);
|
|
165
|
-
} else if (transformKeys.has(name.slice(1))) {
|
|
166
|
-
// @translate, @rotate, @scale, etc.
|
|
167
|
-
return { [name.slice(1)]: simpleResolve(value[2], castToArray) };
|
|
123
|
+
return { [name]: simpleResolve(value[2], castToArray) };
|
|
168
124
|
} else {
|
|
169
125
|
let args = simpleResolve(value[2], castToArray);
|
|
170
126
|
|
|
@@ -178,6 +134,7 @@ export function resolveValue(
|
|
|
178
134
|
}
|
|
179
135
|
return arg;
|
|
180
136
|
})
|
|
137
|
+
.filter((value) => value !== "/")
|
|
181
138
|
.join(", ");
|
|
182
139
|
|
|
183
140
|
if (name === "radial-gradient") {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import { setDeepPath } from "
|
|
3
|
-
import { isStyleDescriptorArray } from "
|
|
4
|
-
import { ShortHandSymbol } from "
|
|
5
|
-
import { defaultValues } from "
|
|
6
|
-
import type { StyleResolver } from "
|
|
2
|
+
import { setDeepPath } from "../../../utils/objects";
|
|
3
|
+
import { isStyleDescriptorArray } from "../../../utils/style-value";
|
|
4
|
+
import { ShortHandSymbol } from "../constants";
|
|
5
|
+
import { defaultValues } from "../defaults";
|
|
6
|
+
import type { StyleResolver } from "../resolve";
|
|
7
7
|
|
|
8
8
|
type ShorthandType =
|
|
9
9
|
| "string"
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import
|
|
2
|
+
import { StyleCollection } from "react-native-css/style-collection";
|
|
3
3
|
|
|
4
|
-
import { applyShorthand } from "
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import type { StyleFunctionResolver } from "./resolve";
|
|
8
|
-
import { shorthandHandler } from "./shorthand";
|
|
4
|
+
import { applyShorthand } from "../../../utils";
|
|
5
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
6
|
+
import { shorthandHandler } from "./_handler";
|
|
9
7
|
|
|
10
8
|
const name = ["animationName", "string", "none"] as const;
|
|
11
9
|
const delay = ["animationDelay", "number", 0] as const;
|
|
@@ -61,22 +59,6 @@ export const animationShorthand = shorthandHandler(
|
|
|
61
59
|
"tuples",
|
|
62
60
|
);
|
|
63
61
|
|
|
64
|
-
export const animatedComponentFamily = weakFamily(
|
|
65
|
-
(component: ComponentType) => {
|
|
66
|
-
if (
|
|
67
|
-
"displayName" in component &&
|
|
68
|
-
component.displayName?.startsWith("Animated.")
|
|
69
|
-
) {
|
|
70
|
-
return component;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const createAnimatedComponent =
|
|
74
|
-
require("react-native-reanimated").createAnimatedComponent;
|
|
75
|
-
|
|
76
|
-
return createAnimatedComponent(component);
|
|
77
|
-
},
|
|
78
|
-
);
|
|
79
|
-
|
|
80
62
|
export const animation: StyleFunctionResolver = (
|
|
81
63
|
resolveValue,
|
|
82
64
|
value,
|
|
@@ -139,43 +121,3 @@ export const animation: StyleFunctionResolver = (
|
|
|
139
121
|
|
|
140
122
|
return applyShorthand(animationShortHandTuples);
|
|
141
123
|
};
|
|
142
|
-
|
|
143
|
-
const advancedTimingFunctions: Record<
|
|
144
|
-
string,
|
|
145
|
-
() => (...args: any[]) => unknown
|
|
146
|
-
> = {
|
|
147
|
-
"cubic-bezier": () => {
|
|
148
|
-
return (
|
|
149
|
-
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
150
|
-
).cubicBezier;
|
|
151
|
-
},
|
|
152
|
-
"steps": () => {
|
|
153
|
-
return (
|
|
154
|
-
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
155
|
-
).steps;
|
|
156
|
-
},
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const timingFunctionResolver: StyleFunctionResolver = (
|
|
160
|
-
resolveValue,
|
|
161
|
-
value,
|
|
162
|
-
) => {
|
|
163
|
-
const name = value[1];
|
|
164
|
-
const resolver = advancedTimingFunctions[name];
|
|
165
|
-
|
|
166
|
-
if (!resolver) {
|
|
167
|
-
return;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const args = resolveValue(value[2]);
|
|
171
|
-
|
|
172
|
-
if (!Array.isArray(args)) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const fn = resolver();
|
|
177
|
-
|
|
178
|
-
const result = fn(...args);
|
|
179
|
-
|
|
180
|
-
return result;
|
|
181
|
-
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { isStyleDescriptorArray } from "../../../utils";
|
|
2
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
3
|
+
import { shorthandHandler } from "./_handler";
|
|
4
|
+
|
|
5
|
+
const color = ["color", "string"] as const;
|
|
6
|
+
const offsetX = ["offsetX", "number"] as const;
|
|
7
|
+
const offsetY = ["offsetY", "number"] as const;
|
|
8
|
+
const blurRadius = ["blurRadius", "number"] as const;
|
|
9
|
+
const spreadDistance = ["spreadDistance", "number"] as const;
|
|
10
|
+
// const inset = ["inset", "string"] as const;
|
|
11
|
+
|
|
12
|
+
const handler = shorthandHandler(
|
|
13
|
+
[
|
|
14
|
+
[offsetX, offsetY, blurRadius, spreadDistance, color],
|
|
15
|
+
[color, offsetX, offsetY],
|
|
16
|
+
[color, offsetX, offsetY, blurRadius],
|
|
17
|
+
[color, offsetX, offsetY, blurRadius, spreadDistance],
|
|
18
|
+
[offsetX, offsetY, color],
|
|
19
|
+
[offsetX, offsetY, blurRadius, color],
|
|
20
|
+
],
|
|
21
|
+
[],
|
|
22
|
+
"object",
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const boxShadow: StyleFunctionResolver = (
|
|
26
|
+
resolveValue,
|
|
27
|
+
func,
|
|
28
|
+
get,
|
|
29
|
+
options,
|
|
30
|
+
) => {
|
|
31
|
+
const args = resolveValue(func[2]);
|
|
32
|
+
|
|
33
|
+
if (!isStyleDescriptorArray(args)) {
|
|
34
|
+
return args;
|
|
35
|
+
} else {
|
|
36
|
+
return args
|
|
37
|
+
.flatMap((shadows) => {
|
|
38
|
+
if (shadows === undefined) {
|
|
39
|
+
return [];
|
|
40
|
+
} else if (isStyleDescriptorArray(shadows)) {
|
|
41
|
+
if (shadows.length === 0) {
|
|
42
|
+
return [];
|
|
43
|
+
} else if (Array.isArray(shadows[0])) {
|
|
44
|
+
return shadows
|
|
45
|
+
.map((shadow) => {
|
|
46
|
+
return omitTransparentShadows(
|
|
47
|
+
handler(resolveValue, shadow, get, options),
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
.filter((v) => v !== undefined);
|
|
51
|
+
} else {
|
|
52
|
+
return omitTransparentShadows(
|
|
53
|
+
handler(resolveValue, shadows, get, options),
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
} else {
|
|
57
|
+
return omitTransparentShadows(
|
|
58
|
+
handler(resolveValue, shadows, get, options),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
.filter((v) => v !== undefined);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function omitTransparentShadows(style: unknown) {
|
|
67
|
+
if (typeof style === "object" && style && "color" in style) {
|
|
68
|
+
if (style.color === "#0000" || style.color === "transparent") {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return style;
|
|
74
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StyleFunctionResolver } from "
|
|
1
|
+
import type { StyleFunctionResolver } from "../resolve";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Handle the unparsable transform property by converting its values into StyleDeclarations
|
|
@@ -11,7 +11,9 @@ export const transform: StyleFunctionResolver = (
|
|
|
11
11
|
const transforms = resolveValue(transformDescriptor[2]);
|
|
12
12
|
|
|
13
13
|
if (Array.isArray(transforms)) {
|
|
14
|
-
return transforms.filter(
|
|
14
|
+
return transforms.filter(
|
|
15
|
+
(transform) => transform !== undefined && transform !== "initial",
|
|
16
|
+
) as unknown;
|
|
15
17
|
} else if (transforms) {
|
|
16
18
|
// If it's a single transform, wrap it in an array
|
|
17
19
|
return [transforms];
|