react-native-css 3.0.0-nightly.df0f885 → 3.0.0-preview.0
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 +16 -3
- 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 +238 -154
- 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 +100 -43
- 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 -17
- 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 +8 -2
- 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 -21
- 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 +63 -38
- 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 +7 -4
- 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.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 +28 -0
- package/dist/commonjs/style-collection/root.js.map +1 -0
- package/dist/module/compiler/atRules.js +16 -3
- 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 +234 -150
- 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 +99 -42
- 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 +22 -16
- 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 +2 -1
- 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 -20
- 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 +64 -39
- 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 +7 -4
- 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.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 +24 -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 +4 -4
- 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 +16 -18
- 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 +16 -12
- 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 +16 -6
- 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 +3 -1
- 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 -9
- 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 +1 -1
- 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 +4 -4
- 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 +16 -18
- 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 +16 -12
- 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 +16 -6
- 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 +3 -1
- 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 -9
- 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 +1 -1
- 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 +31 -15
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/compiler.ts +12 -10
- package/src/compiler/compiler.types.ts +11 -14
- package/src/compiler/declarations.ts +423 -194
- 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 +145 -57
- 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 +25 -15
- 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 +3 -1
- 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 -29
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/styles/calculate-props.ts +71 -39
- 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 +8 -4
- 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 +1 -1
- package/src/style-collection/index.ts +142 -0
- package/src/style-collection/root.ts +35 -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
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import Color from "colorjs.io";
|
|
4
4
|
import type {
|
|
5
5
|
Angle,
|
|
6
|
-
BorderBlockColor,
|
|
7
6
|
BorderSideWidth,
|
|
8
7
|
BorderStyle,
|
|
9
8
|
ColorOrAuto,
|
|
10
9
|
CssColor,
|
|
10
|
+
CustomProperty,
|
|
11
11
|
Declaration,
|
|
12
12
|
DimensionPercentageFor_LengthValue,
|
|
13
13
|
EnvironmentVariable,
|
|
@@ -63,12 +63,16 @@ const propertyRename: Record<string, string> = {
|
|
|
63
63
|
"background-image": "experimental_backgroundImage",
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
// TODO: We need a better way to handle this
|
|
66
67
|
const unparsedRuntimeParsing = new Set([
|
|
67
68
|
"animation",
|
|
69
|
+
"border",
|
|
70
|
+
"box-shadow",
|
|
68
71
|
"text-shadow",
|
|
69
72
|
"transform",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
73
|
+
"scale",
|
|
74
|
+
"rotate",
|
|
75
|
+
"translate",
|
|
72
76
|
]);
|
|
73
77
|
|
|
74
78
|
const parsers: {
|
|
@@ -92,37 +96,45 @@ const parsers: {
|
|
|
92
96
|
"block-size": parseSizeDeclaration,
|
|
93
97
|
"border": parseBorder,
|
|
94
98
|
"border-block": parseBorderBlock,
|
|
95
|
-
"border-block-color":
|
|
99
|
+
"border-block-color": parseBorderColor,
|
|
96
100
|
"border-block-end": parseBorderBlockEnd,
|
|
97
101
|
"border-block-end-color": parseColorDeclaration,
|
|
98
102
|
"border-block-end-width": parseBorderSideWidthDeclaration,
|
|
99
103
|
"border-block-start": parseBorderBlockStart,
|
|
100
104
|
"border-block-start-color": parseColorDeclaration,
|
|
105
|
+
"border-block-start-style": parseBorderStyleDeclaration,
|
|
101
106
|
"border-block-start-width": parseBorderSideWidthDeclaration,
|
|
107
|
+
"border-block-style": parseBorderBlockStyle,
|
|
102
108
|
"border-block-width": parseBorderBlockWidth,
|
|
103
109
|
"border-bottom": parseBorderSide,
|
|
104
110
|
"border-bottom-color": parseColorDeclaration,
|
|
105
111
|
"border-bottom-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
106
112
|
"border-bottom-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
113
|
+
"border-bottom-style": parseBorderStyleDeclaration,
|
|
107
114
|
"border-bottom-width": parseBorderSideWidthDeclaration,
|
|
108
115
|
"border-color": parseBorderColor,
|
|
109
116
|
"border-end-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
110
117
|
"border-end-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
111
118
|
"border-inline": parseBorderInline,
|
|
112
|
-
"border-inline-color":
|
|
119
|
+
"border-inline-color": parseBorderColor,
|
|
113
120
|
"border-inline-end": parseBorderInlineEnd,
|
|
114
121
|
"border-inline-end-color": parseColorDeclaration,
|
|
122
|
+
"border-inline-end-style": parseBorderInlineStyle,
|
|
115
123
|
"border-inline-end-width": parseBorderSideWidthDeclaration,
|
|
116
124
|
"border-inline-start": parseBorderInlineStart,
|
|
117
125
|
"border-inline-start-color": parseColorDeclaration,
|
|
126
|
+
"border-inline-start-style": parseBorderInlineStyle,
|
|
118
127
|
"border-inline-start-width": parseBorderSideWidthDeclaration,
|
|
128
|
+
"border-inline-style": parseBorderInlineStyle,
|
|
119
129
|
"border-inline-width": parseBorderInlineWidth,
|
|
120
130
|
"border-left": parseBorderSide,
|
|
121
131
|
"border-left-color": parseColorDeclaration,
|
|
132
|
+
"border-left-style": parseBorderStyleDeclaration,
|
|
122
133
|
"border-left-width": parseBorderSideWidthDeclaration,
|
|
123
134
|
"border-radius": parseBorderRadius,
|
|
124
135
|
"border-right": parseBorderSide,
|
|
125
136
|
"border-right-color": parseColorDeclaration,
|
|
137
|
+
"border-right-style": parseBorderStyleDeclaration,
|
|
126
138
|
"border-right-width": parseBorderSideWidthDeclaration,
|
|
127
139
|
"border-start-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
128
140
|
"border-start-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
@@ -131,11 +143,12 @@ const parsers: {
|
|
|
131
143
|
"border-top-color": parseColorDeclaration,
|
|
132
144
|
"border-top-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
133
145
|
"border-top-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
146
|
+
"border-top-style": parseBorderStyleDeclaration,
|
|
134
147
|
"border-top-width": parseBorderSideWidthDeclaration,
|
|
135
148
|
"border-width": parseBorderWidth,
|
|
136
149
|
"bottom": parseSizeDeclaration,
|
|
137
150
|
"box-shadow": parseBoxShadow,
|
|
138
|
-
"caret-color":
|
|
151
|
+
"caret-color": parseColorOrAutoDeclaration,
|
|
139
152
|
"color": parseFontColorDeclaration,
|
|
140
153
|
"column-gap": parseGap,
|
|
141
154
|
"container": parseContainer,
|
|
@@ -227,6 +240,7 @@ const parsers: {
|
|
|
227
240
|
"translate": parseTranslate,
|
|
228
241
|
"user-select": parseUserSelect,
|
|
229
242
|
"vertical-align": parseVerticalAlign,
|
|
243
|
+
"visibility": parseVisibility,
|
|
230
244
|
"width": parseSizeDeclaration,
|
|
231
245
|
"z-index": parseZIndex,
|
|
232
246
|
};
|
|
@@ -256,9 +270,9 @@ export function parseDeclaration(
|
|
|
256
270
|
}
|
|
257
271
|
|
|
258
272
|
if (declaration.property === "unparsed") {
|
|
259
|
-
|
|
273
|
+
parseUnparsedDeclaration(declaration, builder);
|
|
260
274
|
} else if (declaration.property === "custom") {
|
|
261
|
-
|
|
275
|
+
parseCustomDeclaration(declaration, builder);
|
|
262
276
|
} else {
|
|
263
277
|
parseWithParser(declaration, builder);
|
|
264
278
|
}
|
|
@@ -270,6 +284,7 @@ function parseWithParser(declaration: Declaration, builder: StylesheetBuilder) {
|
|
|
270
284
|
|
|
271
285
|
builder.descriptorProperty = declaration.property;
|
|
272
286
|
|
|
287
|
+
builder.setWarningProperty(declaration.property);
|
|
273
288
|
const value = parser(declaration, builder, declaration.property);
|
|
274
289
|
|
|
275
290
|
if (value !== undefined) {
|
|
@@ -343,15 +358,41 @@ function parseBorderRadius(
|
|
|
343
358
|
}
|
|
344
359
|
|
|
345
360
|
function parseBorderColor(
|
|
346
|
-
|
|
361
|
+
declaration: DeclarationType<
|
|
362
|
+
"border-color" | "border-block-color" | "border-inline-color"
|
|
363
|
+
>,
|
|
347
364
|
builder: StylesheetBuilder,
|
|
348
365
|
) {
|
|
349
|
-
|
|
350
|
-
"border-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
366
|
+
switch (declaration.property) {
|
|
367
|
+
case "border-color":
|
|
368
|
+
builder.addShorthand("border-color", {
|
|
369
|
+
"border-top-color": parseColor(declaration.value.top, builder),
|
|
370
|
+
"border-bottom-color": parseColor(declaration.value.bottom, builder),
|
|
371
|
+
"border-left-color": parseColor(declaration.value.left, builder),
|
|
372
|
+
"border-right-color": parseColor(declaration.value.right, builder),
|
|
373
|
+
});
|
|
374
|
+
break;
|
|
375
|
+
case "border-block-color":
|
|
376
|
+
builder.addDescriptor(
|
|
377
|
+
"border-top-color",
|
|
378
|
+
parseColor(declaration.value.start, builder),
|
|
379
|
+
);
|
|
380
|
+
builder.addDescriptor(
|
|
381
|
+
"border-bottom-color",
|
|
382
|
+
parseColor(declaration.value.end, builder),
|
|
383
|
+
);
|
|
384
|
+
break;
|
|
385
|
+
case "border-inline-color":
|
|
386
|
+
builder.addDescriptor(
|
|
387
|
+
"border-left-color",
|
|
388
|
+
parseColor(declaration.value.start, builder),
|
|
389
|
+
);
|
|
390
|
+
builder.addDescriptor(
|
|
391
|
+
"border-right-color",
|
|
392
|
+
parseColor(declaration.value.end, builder),
|
|
393
|
+
);
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
355
396
|
}
|
|
356
397
|
|
|
357
398
|
function parseBorderWidth(
|
|
@@ -397,18 +438,14 @@ function parseBorderBlock(
|
|
|
397
438
|
{ value }: DeclarationType<"border-block">,
|
|
398
439
|
builder: StylesheetBuilder,
|
|
399
440
|
) {
|
|
400
|
-
builder.addDescriptor("border-
|
|
401
|
-
builder.addDescriptor(
|
|
402
|
-
"border-bottom-color",
|
|
403
|
-
parseColor(value.color, builder),
|
|
404
|
-
);
|
|
441
|
+
builder.addDescriptor("border-block-color", parseColor(value.color, builder));
|
|
405
442
|
builder.addDescriptor(
|
|
406
|
-
"border-
|
|
443
|
+
"border-block-width",
|
|
407
444
|
parseBorderSideWidth(value.width, builder),
|
|
408
445
|
);
|
|
409
446
|
builder.addDescriptor(
|
|
410
|
-
"border-
|
|
411
|
-
|
|
447
|
+
"border-block-style",
|
|
448
|
+
parseBorderStyle(value.style, builder),
|
|
412
449
|
);
|
|
413
450
|
}
|
|
414
451
|
|
|
@@ -416,9 +453,12 @@ function parseBorderBlockStart(
|
|
|
416
453
|
{ value }: DeclarationType<"border-block-start">,
|
|
417
454
|
builder: StylesheetBuilder,
|
|
418
455
|
) {
|
|
419
|
-
builder.addDescriptor("border-top-color", parseColor(value.color, builder));
|
|
420
456
|
builder.addDescriptor(
|
|
421
|
-
"border-
|
|
457
|
+
"border-block-start-color",
|
|
458
|
+
parseColor(value.color, builder),
|
|
459
|
+
);
|
|
460
|
+
builder.addDescriptor(
|
|
461
|
+
"border-block-start-width",
|
|
422
462
|
parseBorderSideWidth(value.width, builder),
|
|
423
463
|
);
|
|
424
464
|
}
|
|
@@ -428,11 +468,11 @@ function parseBorderBlockEnd(
|
|
|
428
468
|
builder: StylesheetBuilder,
|
|
429
469
|
) {
|
|
430
470
|
builder.addDescriptor(
|
|
431
|
-
"border-
|
|
471
|
+
"border-block-end-color",
|
|
432
472
|
parseColor(value.color, builder),
|
|
433
473
|
);
|
|
434
474
|
builder.addDescriptor(
|
|
435
|
-
"border-
|
|
475
|
+
"border-block-end-width",
|
|
436
476
|
parseBorderSideWidth(value.width, builder),
|
|
437
477
|
);
|
|
438
478
|
}
|
|
@@ -441,38 +481,54 @@ function parseBorderInline(
|
|
|
441
481
|
{ value }: DeclarationType<"border-inline">,
|
|
442
482
|
builder: StylesheetBuilder,
|
|
443
483
|
) {
|
|
444
|
-
builder.addDescriptor("border-left-color", parseColor(value.color, builder));
|
|
445
|
-
builder.addDescriptor("border-right-color", parseColor(value.color, builder));
|
|
446
484
|
builder.addDescriptor(
|
|
447
|
-
"border-
|
|
448
|
-
|
|
485
|
+
"border-inline-color",
|
|
486
|
+
parseColor(value.color, builder),
|
|
449
487
|
);
|
|
450
488
|
builder.addDescriptor(
|
|
451
|
-
"border-
|
|
489
|
+
"border-inline-width",
|
|
452
490
|
parseBorderSideWidth(value.width, builder),
|
|
453
491
|
);
|
|
492
|
+
builder.addDescriptor(
|
|
493
|
+
"border-inline-style",
|
|
494
|
+
parseBorderStyle(value.style, builder),
|
|
495
|
+
);
|
|
454
496
|
}
|
|
455
497
|
|
|
456
498
|
function parseBorderInlineStart(
|
|
457
499
|
{ value }: DeclarationType<"border-inline-start">,
|
|
458
500
|
builder: StylesheetBuilder,
|
|
459
501
|
) {
|
|
460
|
-
builder.addDescriptor("border-left-color", parseColor(value.color, builder));
|
|
461
502
|
builder.addDescriptor(
|
|
462
|
-
"border-
|
|
503
|
+
"border-inline-start-color",
|
|
504
|
+
parseColor(value.color, builder),
|
|
505
|
+
);
|
|
506
|
+
builder.addDescriptor(
|
|
507
|
+
"border-inline-start-width",
|
|
463
508
|
parseBorderSideWidth(value.width, builder),
|
|
464
509
|
);
|
|
510
|
+
builder.addDescriptor(
|
|
511
|
+
"border-inline-start-style",
|
|
512
|
+
parseBorderStyle(value.style, builder),
|
|
513
|
+
);
|
|
465
514
|
}
|
|
466
515
|
|
|
467
516
|
function parseBorderInlineEnd(
|
|
468
517
|
{ value }: DeclarationType<"border-inline-end">,
|
|
469
518
|
builder: StylesheetBuilder,
|
|
470
519
|
) {
|
|
471
|
-
builder.addDescriptor("border-right-color", parseColor(value.color, builder));
|
|
472
520
|
builder.addDescriptor(
|
|
473
|
-
"border-
|
|
521
|
+
"border-inline-end-color",
|
|
522
|
+
parseColor(value.color, builder),
|
|
523
|
+
);
|
|
524
|
+
builder.addDescriptor(
|
|
525
|
+
"border-inline-end-width",
|
|
474
526
|
parseBorderSideWidth(value.width, builder),
|
|
475
527
|
);
|
|
528
|
+
builder.addDescriptor(
|
|
529
|
+
"border-inline-end-style",
|
|
530
|
+
parseBorderStyle(value.style, builder),
|
|
531
|
+
);
|
|
476
532
|
}
|
|
477
533
|
|
|
478
534
|
export function parseBorderInlineWidth(
|
|
@@ -480,13 +536,39 @@ export function parseBorderInlineWidth(
|
|
|
480
536
|
builder: StylesheetBuilder,
|
|
481
537
|
) {
|
|
482
538
|
builder.addDescriptor(
|
|
483
|
-
"border-
|
|
539
|
+
"border-inline-width",
|
|
484
540
|
parseBorderSideWidth(declaration.value.start, builder),
|
|
485
541
|
);
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export function parseBorderInlineStyle(
|
|
545
|
+
declaration: DeclarationType<
|
|
546
|
+
| "border-inline-style"
|
|
547
|
+
| "border-inline-start-style"
|
|
548
|
+
| "border-inline-end-style"
|
|
549
|
+
>,
|
|
550
|
+
builder: StylesheetBuilder,
|
|
551
|
+
) {
|
|
552
|
+
if (typeof declaration.value === "string") {
|
|
553
|
+
builder.addDescriptor(
|
|
554
|
+
declaration.property,
|
|
555
|
+
parseBorderStyle(declaration.value, builder),
|
|
556
|
+
);
|
|
557
|
+
} else if (declaration.value.start === declaration.value.end) {
|
|
558
|
+
builder.addDescriptor(
|
|
559
|
+
declaration.property,
|
|
560
|
+
parseBorderStyle(declaration.value.start, builder),
|
|
561
|
+
);
|
|
562
|
+
} else {
|
|
563
|
+
builder.addDescriptor(
|
|
564
|
+
"border-inline-start-style",
|
|
565
|
+
parseBorderStyle(declaration.value.start, builder),
|
|
566
|
+
);
|
|
567
|
+
builder.addDescriptor(
|
|
568
|
+
"border-inline-end-style",
|
|
569
|
+
parseBorderStyle(declaration.value.end, builder),
|
|
570
|
+
);
|
|
571
|
+
}
|
|
490
572
|
}
|
|
491
573
|
|
|
492
574
|
function parseFlexFlow(
|
|
@@ -609,22 +691,22 @@ function parseTransform(
|
|
|
609
691
|
) {
|
|
610
692
|
builder.addDescriptor("transform", [
|
|
611
693
|
{},
|
|
612
|
-
"
|
|
694
|
+
"transform",
|
|
613
695
|
value.flatMap((t): StyleDescriptor[] => {
|
|
614
696
|
switch (t.type) {
|
|
615
697
|
case "perspective":
|
|
616
|
-
return [[{}, "
|
|
698
|
+
return [[{}, "perspective", parseLength(t.value, builder)]];
|
|
617
699
|
case "translate":
|
|
618
700
|
return [
|
|
619
701
|
[
|
|
620
702
|
{},
|
|
621
|
-
"
|
|
703
|
+
"translateX",
|
|
622
704
|
parseLengthOrCoercePercentageToRuntime(t.value[0], builder),
|
|
623
705
|
],
|
|
624
706
|
[
|
|
625
707
|
[
|
|
626
708
|
{},
|
|
627
|
-
"
|
|
709
|
+
"translateY",
|
|
628
710
|
parseLengthOrCoercePercentageToRuntime(t.value[1], builder),
|
|
629
711
|
],
|
|
630
712
|
],
|
|
@@ -633,7 +715,7 @@ function parseTransform(
|
|
|
633
715
|
return [
|
|
634
716
|
[
|
|
635
717
|
{},
|
|
636
|
-
"
|
|
718
|
+
"translateX",
|
|
637
719
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
638
720
|
],
|
|
639
721
|
];
|
|
@@ -641,22 +723,22 @@ function parseTransform(
|
|
|
641
723
|
return [
|
|
642
724
|
[
|
|
643
725
|
{},
|
|
644
|
-
"
|
|
726
|
+
"translateY",
|
|
645
727
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
646
728
|
],
|
|
647
729
|
];
|
|
648
730
|
case "rotate":
|
|
649
|
-
return [[{}, "
|
|
731
|
+
return [[{}, "rotate", parseAngle(t.value, builder)]];
|
|
650
732
|
case "rotateX":
|
|
651
|
-
return [[{}, "
|
|
733
|
+
return [[{}, "rotateX", parseAngle(t.value, builder)]];
|
|
652
734
|
case "rotateY":
|
|
653
|
-
return [[{}, "
|
|
735
|
+
return [[{}, "rotateY", parseAngle(t.value, builder)]];
|
|
654
736
|
case "rotateZ":
|
|
655
|
-
return [[{}, "
|
|
737
|
+
return [[{}, "rotateZ", parseAngle(t.value, builder)]];
|
|
656
738
|
case "scale":
|
|
657
739
|
return [
|
|
658
|
-
[{}, "
|
|
659
|
-
[{}, "
|
|
740
|
+
[{}, "scaleX", parseLength(t.value[0], builder)],
|
|
741
|
+
[{}, "scaleY", parseLength(t.value[1], builder)],
|
|
660
742
|
];
|
|
661
743
|
case "scaleX":
|
|
662
744
|
return [[{}, "scaleX", parseLength(t.value, builder)]];
|
|
@@ -705,21 +787,29 @@ function parseRotate(
|
|
|
705
787
|
{ value }: DeclarationType<"rotate">,
|
|
706
788
|
builder: StylesheetBuilder,
|
|
707
789
|
) {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
790
|
+
if (value.x) {
|
|
791
|
+
builder.addDescriptor("rotateX", [
|
|
792
|
+
{},
|
|
793
|
+
"rotateX",
|
|
794
|
+
parseAngle(value.angle, builder),
|
|
795
|
+
]);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
if (value.y) {
|
|
799
|
+
builder.addDescriptor("rotateY", [
|
|
800
|
+
{},
|
|
801
|
+
"rotateY",
|
|
802
|
+
parseAngle(value.angle, builder),
|
|
803
|
+
]);
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
if (value.z) {
|
|
807
|
+
builder.addDescriptor("rotateZ", [
|
|
808
|
+
{},
|
|
809
|
+
"rotateZ",
|
|
810
|
+
parseAngle(value.angle, builder),
|
|
811
|
+
]);
|
|
812
|
+
}
|
|
723
813
|
}
|
|
724
814
|
|
|
725
815
|
function parseScale(
|
|
@@ -757,7 +847,17 @@ function parseLetterSpacing(
|
|
|
757
847
|
if (value.type === "normal") {
|
|
758
848
|
return;
|
|
759
849
|
}
|
|
760
|
-
|
|
850
|
+
const descriptor = parseLength(value.value, builder);
|
|
851
|
+
|
|
852
|
+
if (
|
|
853
|
+
Array.isArray(descriptor) &&
|
|
854
|
+
descriptor[1] === "em" &&
|
|
855
|
+
typeof descriptor[2] === "number"
|
|
856
|
+
) {
|
|
857
|
+
return descriptor[2];
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
return descriptor;
|
|
761
861
|
}
|
|
762
862
|
|
|
763
863
|
function parseTextDecoration(
|
|
@@ -786,7 +886,11 @@ function parseZIndex(
|
|
|
786
886
|
}
|
|
787
887
|
}
|
|
788
888
|
|
|
789
|
-
function parseContainerType(
|
|
889
|
+
function parseContainerType(
|
|
890
|
+
_declaration: DeclarationType<"container-type">,
|
|
891
|
+
builder: StylesheetBuilder,
|
|
892
|
+
) {
|
|
893
|
+
builder.addContainer(["___default___"]);
|
|
790
894
|
return;
|
|
791
895
|
}
|
|
792
896
|
|
|
@@ -806,7 +910,7 @@ function parseContainer(
|
|
|
806
910
|
return;
|
|
807
911
|
}
|
|
808
912
|
|
|
809
|
-
export function
|
|
913
|
+
export function parseUnparsedDeclaration(
|
|
810
914
|
declaration: Extract<Declaration, { property: "unparsed" }>,
|
|
811
915
|
builder: StylesheetBuilder,
|
|
812
916
|
) {
|
|
@@ -817,6 +921,8 @@ export function parseDeclarationUnparsed(
|
|
|
817
921
|
return;
|
|
818
922
|
}
|
|
819
923
|
|
|
924
|
+
builder.setWarningProperty(property);
|
|
925
|
+
|
|
820
926
|
/**
|
|
821
927
|
* React Native doesn't support all the logical properties
|
|
822
928
|
*/
|
|
@@ -831,24 +937,15 @@ export function parseDeclarationUnparsed(
|
|
|
831
937
|
builder.descriptorProperty = property;
|
|
832
938
|
|
|
833
939
|
if (unparsedRuntimeParsing.has(property)) {
|
|
834
|
-
const args = parseUnparsed(declaration.value.value, builder);
|
|
940
|
+
const args = parseUnparsed(declaration.value.value, builder, property);
|
|
835
941
|
|
|
836
942
|
if (property === "animation") {
|
|
837
|
-
builder.addDescriptor("animation", [
|
|
838
|
-
{},
|
|
839
|
-
`@${toRNProperty(property)}`,
|
|
840
|
-
args,
|
|
841
|
-
]);
|
|
943
|
+
builder.addDescriptor("animation", [{}, property, args]);
|
|
842
944
|
} else {
|
|
843
|
-
builder.addDescriptor(property, [
|
|
844
|
-
{},
|
|
845
|
-
`@${toRNProperty(property)}`,
|
|
846
|
-
args,
|
|
847
|
-
1,
|
|
848
|
-
]);
|
|
945
|
+
builder.addDescriptor(property, [{}, toRNProperty(property), args, 1]);
|
|
849
946
|
}
|
|
850
947
|
} else {
|
|
851
|
-
const value = parseUnparsed(declaration.value.value, builder);
|
|
948
|
+
const value = parseUnparsed(declaration.value.value, builder, property);
|
|
852
949
|
|
|
853
950
|
builder.addDescriptor(property, value);
|
|
854
951
|
|
|
@@ -862,19 +959,37 @@ export function parseDeclarationUnparsed(
|
|
|
862
959
|
}
|
|
863
960
|
}
|
|
864
961
|
|
|
865
|
-
export function
|
|
962
|
+
export function parseCustomDeclaration(
|
|
866
963
|
declaration: Extract<Declaration, { property: "custom" }>,
|
|
867
964
|
builder: StylesheetBuilder,
|
|
868
965
|
) {
|
|
869
966
|
const property = declaration.value.name;
|
|
870
|
-
|
|
967
|
+
|
|
968
|
+
if (property === "-webkit-line-clamp") {
|
|
969
|
+
builder.addDescriptor(
|
|
970
|
+
property,
|
|
971
|
+
parseUnparsed(declaration.value.value, builder, property),
|
|
972
|
+
);
|
|
973
|
+
} else if (property === "-rn-ripple-style") {
|
|
974
|
+
builder.addDescriptor(
|
|
975
|
+
property,
|
|
976
|
+
parseUnparsed(declaration.value.value, builder, property) ===
|
|
977
|
+
"borderless",
|
|
978
|
+
);
|
|
979
|
+
} else if (property === "object-fit") {
|
|
980
|
+
// https://github.com/parcel-bundler/lightningcss/issues/1046
|
|
981
|
+
parseObjectFit(declaration.value, builder);
|
|
982
|
+
} else if (property === "object-position") {
|
|
983
|
+
// https://github.com/parcel-bundler/lightningcss/issues/1047
|
|
984
|
+
parseObjectPosition(declaration.value, builder);
|
|
985
|
+
} else if (
|
|
871
986
|
validProperties.has(property) ||
|
|
872
987
|
property.startsWith("--") ||
|
|
873
988
|
property.startsWith("-rn-")
|
|
874
989
|
) {
|
|
875
990
|
builder.addDescriptor(
|
|
876
991
|
property,
|
|
877
|
-
parseUnparsed(declaration.value.value, builder,
|
|
992
|
+
parseUnparsed(declaration.value.value, builder, property),
|
|
878
993
|
);
|
|
879
994
|
} else {
|
|
880
995
|
builder.addWarning("property", declaration.value.name);
|
|
@@ -884,9 +999,13 @@ export function parseDeclarationCustom(
|
|
|
884
999
|
export function reduceParseUnparsed(
|
|
885
1000
|
tokenOrValues: TokenOrValue[],
|
|
886
1001
|
builder: StylesheetBuilder,
|
|
1002
|
+
property: string,
|
|
1003
|
+
allowAuto: boolean,
|
|
887
1004
|
): StyleDescriptor {
|
|
888
1005
|
const result = tokenOrValues
|
|
889
|
-
.map((tokenOrValue) =>
|
|
1006
|
+
.map((tokenOrValue) =>
|
|
1007
|
+
parseUnparsed(tokenOrValue, builder, property, allowAuto),
|
|
1008
|
+
)
|
|
890
1009
|
.filter((v) => v !== undefined);
|
|
891
1010
|
|
|
892
1011
|
if (result.length === 0) {
|
|
@@ -905,6 +1024,8 @@ export function reduceParseUnparsed(
|
|
|
905
1024
|
}
|
|
906
1025
|
}
|
|
907
1026
|
|
|
1027
|
+
// Groups are the tokens grouped together by comma location
|
|
1028
|
+
// If a group only has 1 item, it shouldn't be an array
|
|
908
1029
|
groups = groups.flatMap((group): StyleDescriptor[] => {
|
|
909
1030
|
if (!Array.isArray(group)) {
|
|
910
1031
|
return [];
|
|
@@ -920,6 +1041,17 @@ export function reduceParseUnparsed(
|
|
|
920
1041
|
} else {
|
|
921
1042
|
return [first];
|
|
922
1043
|
}
|
|
1044
|
+
} else if (
|
|
1045
|
+
// This is a special case for <ratio> values
|
|
1046
|
+
group.includes("/") &&
|
|
1047
|
+
group.every((item) =>
|
|
1048
|
+
typeof item === "string" && item === "/"
|
|
1049
|
+
? item
|
|
1050
|
+
: typeof item === "number",
|
|
1051
|
+
)
|
|
1052
|
+
) {
|
|
1053
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
1054
|
+
return [group.join(" ")];
|
|
923
1055
|
} else {
|
|
924
1056
|
return [group];
|
|
925
1057
|
}
|
|
@@ -931,11 +1063,13 @@ export function reduceParseUnparsed(
|
|
|
931
1063
|
export function unparsedFunction(
|
|
932
1064
|
token: Extract<TokenOrValue, { type: "function" }>,
|
|
933
1065
|
builder: StylesheetBuilder,
|
|
1066
|
+
property: string,
|
|
1067
|
+
allowAuto: boolean,
|
|
934
1068
|
): StyleFunction {
|
|
935
1069
|
return [
|
|
936
1070
|
{},
|
|
937
|
-
token.value.name,
|
|
938
|
-
reduceParseUnparsed(token.value.arguments, builder),
|
|
1071
|
+
toRNProperty(token.value.name),
|
|
1072
|
+
reduceParseUnparsed(token.value.arguments, builder, property, allowAuto),
|
|
939
1073
|
];
|
|
940
1074
|
}
|
|
941
1075
|
|
|
@@ -952,7 +1086,8 @@ export function parseUnparsed(
|
|
|
952
1086
|
| undefined
|
|
953
1087
|
| null,
|
|
954
1088
|
builder: StylesheetBuilder,
|
|
955
|
-
|
|
1089
|
+
property: string,
|
|
1090
|
+
allowAuto = allowAutoProperties.has(property),
|
|
956
1091
|
): StyleDescriptor {
|
|
957
1092
|
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
958
1093
|
return;
|
|
@@ -975,7 +1110,12 @@ export function parseUnparsed(
|
|
|
975
1110
|
}
|
|
976
1111
|
|
|
977
1112
|
if (Array.isArray(tokenOrValue)) {
|
|
978
|
-
const args = reduceParseUnparsed(
|
|
1113
|
+
const args = reduceParseUnparsed(
|
|
1114
|
+
tokenOrValue,
|
|
1115
|
+
builder,
|
|
1116
|
+
property,
|
|
1117
|
+
allowAuto,
|
|
1118
|
+
);
|
|
979
1119
|
if (!args) return;
|
|
980
1120
|
if (Array.isArray(args) && args.length === 1) return args[0];
|
|
981
1121
|
return args;
|
|
@@ -983,11 +1123,21 @@ export function parseUnparsed(
|
|
|
983
1123
|
|
|
984
1124
|
switch (tokenOrValue.type) {
|
|
985
1125
|
case "unresolved-color": {
|
|
986
|
-
return parseUnresolvedColor(
|
|
1126
|
+
return parseUnresolvedColor(
|
|
1127
|
+
tokenOrValue.value,
|
|
1128
|
+
builder,
|
|
1129
|
+
property,
|
|
1130
|
+
allowAuto,
|
|
1131
|
+
);
|
|
987
1132
|
}
|
|
988
1133
|
case "var": {
|
|
989
1134
|
let args: StyleDescriptor = tokenOrValue.value.name.ident.slice(2);
|
|
990
|
-
const fallback = parseUnparsed(
|
|
1135
|
+
const fallback = parseUnparsed(
|
|
1136
|
+
tokenOrValue.value.fallback,
|
|
1137
|
+
builder,
|
|
1138
|
+
property,
|
|
1139
|
+
allowAuto,
|
|
1140
|
+
);
|
|
991
1141
|
if (fallback !== undefined) {
|
|
992
1142
|
args = [args, fallback];
|
|
993
1143
|
}
|
|
@@ -996,43 +1146,53 @@ export function parseUnparsed(
|
|
|
996
1146
|
}
|
|
997
1147
|
case "function": {
|
|
998
1148
|
switch (tokenOrValue.value.name) {
|
|
999
|
-
case "
|
|
1000
|
-
case "rotate":
|
|
1001
|
-
case "rotateX":
|
|
1002
|
-
case "rotateY":
|
|
1003
|
-
case "skewX":
|
|
1004
|
-
case "skewY":
|
|
1005
|
-
case "scale":
|
|
1006
|
-
case "scaleX":
|
|
1007
|
-
case "scaleY":
|
|
1008
|
-
case "translateX":
|
|
1009
|
-
case "translateY":
|
|
1010
|
-
tokenOrValue.value.name = `@${tokenOrValue.value.name}`;
|
|
1011
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
1149
|
+
case "blur":
|
|
1012
1150
|
case "brightness":
|
|
1013
1151
|
case "contrast":
|
|
1014
1152
|
case "cubic-bezier":
|
|
1015
1153
|
case "drop-shadow":
|
|
1016
1154
|
case "fontScale":
|
|
1155
|
+
case "getPixelSizeForLayoutSize":
|
|
1017
1156
|
case "grayscale":
|
|
1018
1157
|
case "hsl":
|
|
1019
1158
|
case "hsla":
|
|
1020
1159
|
case "hue-rotate":
|
|
1021
1160
|
case "invert":
|
|
1022
|
-
case "linear-gradient":
|
|
1023
1161
|
case "opacity":
|
|
1024
1162
|
case "pixelScale":
|
|
1025
|
-
case "pixelSizeForLayoutSize":
|
|
1026
1163
|
case "platformColor":
|
|
1027
|
-
case "radial-gradient":
|
|
1028
1164
|
case "rgb":
|
|
1029
1165
|
case "rgba":
|
|
1166
|
+
case "rotate":
|
|
1167
|
+
case "rotateX":
|
|
1168
|
+
case "rotateY":
|
|
1030
1169
|
case "roundToNearestPixel":
|
|
1031
1170
|
case "saturate":
|
|
1171
|
+
case "scale":
|
|
1172
|
+
case "scaleX":
|
|
1173
|
+
case "scaleY":
|
|
1032
1174
|
case "sepia":
|
|
1033
1175
|
case "shadow":
|
|
1176
|
+
case "skewX":
|
|
1177
|
+
case "skewY":
|
|
1034
1178
|
case "steps":
|
|
1035
|
-
|
|
1179
|
+
case "translate":
|
|
1180
|
+
case "translateX":
|
|
1181
|
+
case "translateY":
|
|
1182
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
1183
|
+
case "linear-gradient":
|
|
1184
|
+
case "radial-gradient":
|
|
1185
|
+
// These are special as React Native requires the '-' in their name
|
|
1186
|
+
return [
|
|
1187
|
+
{},
|
|
1188
|
+
tokenOrValue.value.name,
|
|
1189
|
+
reduceParseUnparsed(
|
|
1190
|
+
tokenOrValue.value.arguments,
|
|
1191
|
+
builder,
|
|
1192
|
+
property,
|
|
1193
|
+
allowAuto,
|
|
1194
|
+
),
|
|
1195
|
+
];
|
|
1036
1196
|
case "hairlineWidth":
|
|
1037
1197
|
return [{}, tokenOrValue.value.name, []];
|
|
1038
1198
|
case "calc":
|
|
@@ -1043,9 +1203,10 @@ export function parseUnparsed(
|
|
|
1043
1203
|
tokenOrValue.value.name,
|
|
1044
1204
|
tokenOrValue.value.arguments,
|
|
1045
1205
|
builder,
|
|
1206
|
+
property,
|
|
1046
1207
|
);
|
|
1047
1208
|
default: {
|
|
1048
|
-
builder.addWarning("
|
|
1209
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
1049
1210
|
return;
|
|
1050
1211
|
}
|
|
1051
1212
|
}
|
|
@@ -1064,7 +1225,7 @@ export function parseUnparsed(
|
|
|
1064
1225
|
return;
|
|
1065
1226
|
}
|
|
1066
1227
|
|
|
1067
|
-
if (value === "inherit") {
|
|
1228
|
+
if (value === "inherit" || value === "initial") {
|
|
1068
1229
|
builder.addWarning("value", value);
|
|
1069
1230
|
return;
|
|
1070
1231
|
} else if (value === "currentcolor") {
|
|
@@ -1075,6 +1236,8 @@ export function parseUnparsed(
|
|
|
1075
1236
|
return true;
|
|
1076
1237
|
} else if (value === "false") {
|
|
1077
1238
|
return false;
|
|
1239
|
+
} else if (value === "infinity") {
|
|
1240
|
+
return Number.MAX_SAFE_INTEGER;
|
|
1078
1241
|
} else {
|
|
1079
1242
|
return value;
|
|
1080
1243
|
}
|
|
@@ -1091,11 +1254,16 @@ export function parseUnparsed(
|
|
|
1091
1254
|
return parseDimension(tokenOrValue.value, builder);
|
|
1092
1255
|
case "comma":
|
|
1093
1256
|
return CommaSeparator as unknown as StyleDescriptor;
|
|
1257
|
+
case "delim": {
|
|
1258
|
+
if (tokenOrValue.value.value === "/") {
|
|
1259
|
+
return tokenOrValue.value.value;
|
|
1260
|
+
}
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1094
1263
|
case "at-keyword":
|
|
1095
1264
|
case "hash":
|
|
1096
1265
|
case "id-hash":
|
|
1097
1266
|
case "unquoted-url":
|
|
1098
|
-
case "delim":
|
|
1099
1267
|
case "white-space":
|
|
1100
1268
|
case "comment":
|
|
1101
1269
|
case "colon":
|
|
@@ -1166,7 +1334,7 @@ export function parseLength(
|
|
|
1166
1334
|
const { inlineRem = 14 } = builder.getOptions();
|
|
1167
1335
|
|
|
1168
1336
|
if (typeof length === "number") {
|
|
1169
|
-
return length;
|
|
1337
|
+
return round(length);
|
|
1170
1338
|
}
|
|
1171
1339
|
|
|
1172
1340
|
if ("unit" in length) {
|
|
@@ -1177,19 +1345,24 @@ export function parseLength(
|
|
|
1177
1345
|
} else if (length.value === -Infinity) {
|
|
1178
1346
|
return -9999;
|
|
1179
1347
|
} else {
|
|
1180
|
-
|
|
1348
|
+
// Normalize large values to safe integers, e.g. `calc(infinity * 1px)`
|
|
1349
|
+
const value = Math.max(
|
|
1350
|
+
Math.min(length.value, Number.MAX_SAFE_INTEGER),
|
|
1351
|
+
Number.MIN_SAFE_INTEGER,
|
|
1352
|
+
);
|
|
1353
|
+
return round(value);
|
|
1181
1354
|
}
|
|
1182
1355
|
}
|
|
1183
1356
|
case "rem":
|
|
1184
1357
|
if (typeof inlineRem === "number") {
|
|
1185
1358
|
return length.value * inlineRem;
|
|
1186
1359
|
} else {
|
|
1187
|
-
return [{}, "rem", length.value];
|
|
1360
|
+
return [{}, "rem", round(length.value)];
|
|
1188
1361
|
}
|
|
1189
1362
|
case "vw":
|
|
1190
1363
|
case "vh":
|
|
1191
1364
|
case "em":
|
|
1192
|
-
return [{}, length.unit, length.value, 1];
|
|
1365
|
+
return [{}, length.unit, round(length.value), 1];
|
|
1193
1366
|
case "in":
|
|
1194
1367
|
case "cm":
|
|
1195
1368
|
case "mm":
|
|
@@ -1272,7 +1445,7 @@ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
|
|
|
1272
1445
|
case "rad":
|
|
1273
1446
|
return `${angle.value}${angle.type}`;
|
|
1274
1447
|
default:
|
|
1275
|
-
builder.addWarning("value",
|
|
1448
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
1276
1449
|
return undefined;
|
|
1277
1450
|
}
|
|
1278
1451
|
}
|
|
@@ -1355,7 +1528,7 @@ export function parseSize(
|
|
|
1355
1528
|
return;
|
|
1356
1529
|
}
|
|
1357
1530
|
|
|
1358
|
-
export function
|
|
1531
|
+
export function parseColorOrAutoDeclaration(
|
|
1359
1532
|
{ value }: { value: ColorOrAuto },
|
|
1360
1533
|
builder: StylesheetBuilder,
|
|
1361
1534
|
) {
|
|
@@ -1857,7 +2030,10 @@ export function parseOverflow(
|
|
|
1857
2030
|
}
|
|
1858
2031
|
|
|
1859
2032
|
export function parseBorderStyleDeclaration(
|
|
1860
|
-
declaration:
|
|
2033
|
+
declaration: Extract<
|
|
2034
|
+
DeclarationType<Declaration["property"]>,
|
|
2035
|
+
{ value: LineStyle | BorderStyle }
|
|
2036
|
+
>,
|
|
1861
2037
|
builder: StylesheetBuilder,
|
|
1862
2038
|
) {
|
|
1863
2039
|
return parseBorderStyle(declaration.value, builder);
|
|
@@ -1890,34 +2066,53 @@ export function parseBorderStyle(
|
|
|
1890
2066
|
return undefined;
|
|
1891
2067
|
}
|
|
1892
2068
|
|
|
1893
|
-
export function
|
|
1894
|
-
|
|
2069
|
+
export function parseBorderBlockWidth(
|
|
2070
|
+
declaration: DeclarationType<"border-block-width">,
|
|
1895
2071
|
builder: StylesheetBuilder,
|
|
1896
2072
|
) {
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
2073
|
+
const start = parseBorderSideWidth(declaration.value.start, builder);
|
|
2074
|
+
const end = parseBorderSideWidth(declaration.value.end, builder);
|
|
2075
|
+
|
|
2076
|
+
if (start === end) {
|
|
2077
|
+
builder.addDescriptor("border-block-width", start);
|
|
2078
|
+
} else {
|
|
2079
|
+
builder.addDescriptor("border-block-start-width", start);
|
|
2080
|
+
builder.addDescriptor("border-block-end-width", end);
|
|
2081
|
+
}
|
|
1900
2082
|
}
|
|
1901
2083
|
|
|
1902
|
-
|
|
1903
|
-
declaration: DeclarationType<"border-block-
|
|
2084
|
+
function parseBorderBlockStyle(
|
|
2085
|
+
declaration: DeclarationType<"border-block-style">,
|
|
1904
2086
|
builder: StylesheetBuilder,
|
|
1905
2087
|
) {
|
|
1906
|
-
builder
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
)
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
2088
|
+
const start = parseBorderStyle(declaration.value.start, builder);
|
|
2089
|
+
const end = parseBorderStyle(declaration.value.end, builder);
|
|
2090
|
+
|
|
2091
|
+
if (start == end) {
|
|
2092
|
+
builder.addDescriptor("border-block-style", start);
|
|
2093
|
+
} else {
|
|
2094
|
+
builder.addDescriptor("border-block-start-style", start);
|
|
2095
|
+
builder.addDescriptor("border-block-end-style", end);
|
|
2096
|
+
}
|
|
1914
2097
|
}
|
|
1915
2098
|
|
|
1916
2099
|
export function parseBorderSideWidthDeclaration(
|
|
1917
|
-
declaration:
|
|
2100
|
+
declaration: DeclarationType<
|
|
2101
|
+
| "border-block-end-width"
|
|
2102
|
+
| "border-block-start-width"
|
|
2103
|
+
| "border-bottom-width"
|
|
2104
|
+
| "border-inline-end-width"
|
|
2105
|
+
| "border-inline-start-width"
|
|
2106
|
+
| "border-left-width"
|
|
2107
|
+
| "border-right-width"
|
|
2108
|
+
| "border-top-width"
|
|
2109
|
+
>,
|
|
1918
2110
|
builder: StylesheetBuilder,
|
|
1919
2111
|
) {
|
|
1920
|
-
|
|
2112
|
+
builder.addDescriptor(
|
|
2113
|
+
declaration.property,
|
|
2114
|
+
parseBorderSideWidth(declaration.value, builder),
|
|
2115
|
+
);
|
|
1921
2116
|
}
|
|
1922
2117
|
|
|
1923
2118
|
export function parseBorderSideWidth(
|
|
@@ -1980,7 +2175,7 @@ export function parseLineHeight(
|
|
|
1980
2175
|
case "percentage":
|
|
1981
2176
|
case "calc":
|
|
1982
2177
|
builder.addWarning(
|
|
1983
|
-
"
|
|
2178
|
+
"style",
|
|
1984
2179
|
"line-height",
|
|
1985
2180
|
typeof length.value === "number"
|
|
1986
2181
|
? length.value
|
|
@@ -2275,20 +2470,24 @@ export function parseUserSelect(
|
|
|
2275
2470
|
}
|
|
2276
2471
|
|
|
2277
2472
|
export function parseSVGPaint(
|
|
2278
|
-
{ value }: DeclarationType<"fill" | "stroke">,
|
|
2473
|
+
{ value, property }: DeclarationType<"fill" | "stroke">,
|
|
2279
2474
|
builder: StylesheetBuilder,
|
|
2280
2475
|
) {
|
|
2476
|
+
let parsedValue: StyleDescriptor | undefined;
|
|
2477
|
+
|
|
2281
2478
|
if (value.type === "none") {
|
|
2282
|
-
|
|
2479
|
+
parsedValue = "transparent";
|
|
2283
2480
|
} else if (value.type === "color") {
|
|
2284
|
-
|
|
2481
|
+
parsedValue = parseColor(value.value, builder);
|
|
2482
|
+
} else {
|
|
2483
|
+
return;
|
|
2285
2484
|
}
|
|
2286
2485
|
|
|
2287
|
-
|
|
2486
|
+
builder.addDescriptor(property, parsedValue);
|
|
2288
2487
|
}
|
|
2289
2488
|
|
|
2290
2489
|
export function round(number: number) {
|
|
2291
|
-
return Math.round((number + Number.EPSILON) *
|
|
2490
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
2292
2491
|
}
|
|
2293
2492
|
|
|
2294
2493
|
export function parseDimensionPercentageFor_LengthValue(
|
|
@@ -2304,7 +2503,7 @@ export function parseDimensionPercentageFor_LengthValue(
|
|
|
2304
2503
|
}
|
|
2305
2504
|
}
|
|
2306
2505
|
|
|
2307
|
-
const
|
|
2506
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
2308
2507
|
|
|
2309
2508
|
export function parseEnv(
|
|
2310
2509
|
value: EnvironmentVariable,
|
|
@@ -2322,7 +2521,7 @@ export function parseEnv(
|
|
|
2322
2521
|
"var",
|
|
2323
2522
|
[
|
|
2324
2523
|
`--react-native-css-${value.name.value}`,
|
|
2325
|
-
parseUnparsed(value.fallback, builder),
|
|
2524
|
+
parseUnparsed(value.fallback, builder, value.name.value),
|
|
2326
2525
|
],
|
|
2327
2526
|
1,
|
|
2328
2527
|
];
|
|
@@ -2345,8 +2544,9 @@ export function parseCalcFn(
|
|
|
2345
2544
|
name: string,
|
|
2346
2545
|
tokens: TokenOrValue[],
|
|
2347
2546
|
builder: StylesheetBuilder,
|
|
2547
|
+
property: string,
|
|
2348
2548
|
): StyleDescriptor {
|
|
2349
|
-
const args = parseCalcArguments(tokens, builder);
|
|
2549
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
2350
2550
|
if (args) {
|
|
2351
2551
|
return [{}, name, args];
|
|
2352
2552
|
}
|
|
@@ -2357,12 +2557,11 @@ export function parseCalcFn(
|
|
|
2357
2557
|
export function parseCalcArguments(
|
|
2358
2558
|
[...args]: TokenOrValue[],
|
|
2359
2559
|
builder: StylesheetBuilder,
|
|
2560
|
+
property: string,
|
|
2360
2561
|
) {
|
|
2361
2562
|
const parsed: StyleDescriptor[] = [];
|
|
2362
2563
|
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
for (const [currentIndex, arg] of args.entries()) {
|
|
2564
|
+
for (const arg of args) {
|
|
2366
2565
|
switch (arg.type) {
|
|
2367
2566
|
case "env": {
|
|
2368
2567
|
parsed.push(parseEnv(arg.value, builder));
|
|
@@ -2371,7 +2570,7 @@ export function parseCalcArguments(
|
|
|
2371
2570
|
case "var":
|
|
2372
2571
|
case "function":
|
|
2373
2572
|
case "unresolved-color": {
|
|
2374
|
-
const value = parseUnparsed(arg, builder);
|
|
2573
|
+
const value = parseUnparsed(arg, builder, property);
|
|
2375
2574
|
|
|
2376
2575
|
if (value === undefined) {
|
|
2377
2576
|
return undefined;
|
|
@@ -2382,11 +2581,9 @@ export function parseCalcArguments(
|
|
|
2382
2581
|
}
|
|
2383
2582
|
case "length": {
|
|
2384
2583
|
const value = parseLength(arg.value, builder);
|
|
2385
|
-
|
|
2386
2584
|
if (value !== undefined) {
|
|
2387
2585
|
parsed.push(value);
|
|
2388
2586
|
}
|
|
2389
|
-
|
|
2390
2587
|
break;
|
|
2391
2588
|
}
|
|
2392
2589
|
case "color":
|
|
@@ -2409,49 +2606,19 @@ export function parseCalcArguments(
|
|
|
2409
2606
|
}
|
|
2410
2607
|
break;
|
|
2411
2608
|
case "percentage":
|
|
2412
|
-
|
|
2413
|
-
if (mode !== "percentage") return;
|
|
2414
|
-
parsed.push(`${arg.value.value * 100}%`);
|
|
2609
|
+
parsed.push(`${round(arg.value.value * 100)}%`);
|
|
2415
2610
|
break;
|
|
2416
2611
|
case "number": {
|
|
2417
|
-
|
|
2418
|
-
if (mode !== "number") return;
|
|
2419
|
-
parsed.push(arg.value.value);
|
|
2612
|
+
parsed.push(round(arg.value.value));
|
|
2420
2613
|
break;
|
|
2421
2614
|
}
|
|
2422
2615
|
case "parenthesis-block": {
|
|
2423
|
-
|
|
2424
|
-
* If we have a parenthesis block, we just treat it as a nested calc function
|
|
2425
|
-
* Because there could be multiple parenthesis blocks, this is recursive
|
|
2426
|
-
*/
|
|
2427
|
-
let closeParenthesisIndex = -1;
|
|
2428
|
-
for (let index = args.length - 1; index > 0; index--) {
|
|
2429
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2430
|
-
const value = args[index]!;
|
|
2431
|
-
if (
|
|
2432
|
-
value.type === "token" &&
|
|
2433
|
-
value.value.type === "close-parenthesis"
|
|
2434
|
-
) {
|
|
2435
|
-
closeParenthesisIndex = index;
|
|
2436
|
-
break;
|
|
2437
|
-
}
|
|
2438
|
-
}
|
|
2439
|
-
|
|
2440
|
-
if (closeParenthesisIndex === -1) {
|
|
2441
|
-
return;
|
|
2442
|
-
}
|
|
2443
|
-
|
|
2444
|
-
const innerCalcArgs = args
|
|
2445
|
-
// Extract the inner calcArgs including the parenthesis. This mutates args
|
|
2446
|
-
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
2447
|
-
// Then drop the surrounding parenthesis
|
|
2448
|
-
.slice(1, -1);
|
|
2449
|
-
|
|
2450
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
2451
|
-
|
|
2616
|
+
parsed.push("(");
|
|
2452
2617
|
break;
|
|
2453
2618
|
}
|
|
2454
2619
|
case "close-parenthesis":
|
|
2620
|
+
parsed.push(")");
|
|
2621
|
+
break;
|
|
2455
2622
|
case "string":
|
|
2456
2623
|
case "function":
|
|
2457
2624
|
case "ident":
|
|
@@ -2500,6 +2667,8 @@ export function parseTranslateProp(
|
|
|
2500
2667
|
export function parseUnresolvedColor(
|
|
2501
2668
|
color: UnresolvedColor,
|
|
2502
2669
|
builder: StylesheetBuilder,
|
|
2670
|
+
property: string,
|
|
2671
|
+
allowAuto: boolean,
|
|
2503
2672
|
): StyleDescriptor {
|
|
2504
2673
|
switch (color.type) {
|
|
2505
2674
|
case "rgb":
|
|
@@ -2510,26 +2679,31 @@ export function parseUnresolvedColor(
|
|
|
2510
2679
|
round(color.r * 255),
|
|
2511
2680
|
round(color.g * 255),
|
|
2512
2681
|
round(color.b * 255),
|
|
2513
|
-
parseUnparsed(color.alpha, builder),
|
|
2682
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2514
2683
|
],
|
|
2515
2684
|
];
|
|
2516
2685
|
case "hsl":
|
|
2517
2686
|
return [
|
|
2518
2687
|
{},
|
|
2519
2688
|
color.type,
|
|
2520
|
-
[
|
|
2689
|
+
[
|
|
2690
|
+
color.h,
|
|
2691
|
+
color.s,
|
|
2692
|
+
color.l,
|
|
2693
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2694
|
+
],
|
|
2521
2695
|
];
|
|
2522
2696
|
case "light-dark": {
|
|
2523
2697
|
const extraRule = builder.extendRule({
|
|
2524
2698
|
m: [["=", "prefers-color-scheme", "dark"]],
|
|
2525
2699
|
});
|
|
2526
2700
|
builder.addUnnamedDescriptor(
|
|
2527
|
-
reduceParseUnparsed(color.dark, builder),
|
|
2701
|
+
reduceParseUnparsed(color.dark, builder, property, allowAuto),
|
|
2528
2702
|
false,
|
|
2529
2703
|
extraRule,
|
|
2530
2704
|
);
|
|
2531
2705
|
builder.addExtraRule(extraRule);
|
|
2532
|
-
return reduceParseUnparsed(color.light, builder);
|
|
2706
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
2533
2707
|
}
|
|
2534
2708
|
default:
|
|
2535
2709
|
color satisfies never;
|
|
@@ -2626,7 +2800,12 @@ export function addTransitionValue(
|
|
|
2626
2800
|
declaration.property,
|
|
2627
2801
|
declaration.value
|
|
2628
2802
|
.map((v) => v.property)
|
|
2629
|
-
.filter(
|
|
2803
|
+
.filter(
|
|
2804
|
+
(v) =>
|
|
2805
|
+
(v in parsers && !["visibility"].includes(v)) ||
|
|
2806
|
+
v === "all" ||
|
|
2807
|
+
v === "none",
|
|
2808
|
+
)
|
|
2630
2809
|
.map((v) => toRNProperty(v)),
|
|
2631
2810
|
);
|
|
2632
2811
|
return;
|
|
@@ -2775,7 +2954,7 @@ function parseGradient(
|
|
|
2775
2954
|
case "linear": {
|
|
2776
2955
|
return [
|
|
2777
2956
|
{},
|
|
2778
|
-
"
|
|
2957
|
+
"linear-gradient",
|
|
2779
2958
|
[
|
|
2780
2959
|
parseLineDirection(gradient.direction, builder),
|
|
2781
2960
|
...gradient.items.map((item) => parseGradientItem(item, builder)),
|
|
@@ -2825,6 +3004,46 @@ function parseGradientItem(
|
|
|
2825
3004
|
}
|
|
2826
3005
|
}
|
|
2827
3006
|
|
|
3007
|
+
function parseObjectFit(
|
|
3008
|
+
declaration: CustomProperty,
|
|
3009
|
+
builder: StylesheetBuilder,
|
|
3010
|
+
) {
|
|
3011
|
+
builder.addMapping({
|
|
3012
|
+
"object-fit": "contentFit",
|
|
3013
|
+
});
|
|
3014
|
+
builder.addDescriptor(
|
|
3015
|
+
"object-fit",
|
|
3016
|
+
parseUnparsed(declaration.value, builder, "object-fit"),
|
|
3017
|
+
);
|
|
3018
|
+
}
|
|
3019
|
+
|
|
3020
|
+
function parseObjectPosition(
|
|
3021
|
+
declaration: CustomProperty,
|
|
3022
|
+
builder: StylesheetBuilder,
|
|
3023
|
+
) {
|
|
3024
|
+
builder.addMapping({
|
|
3025
|
+
"object-position": "contentPosition",
|
|
3026
|
+
});
|
|
3027
|
+
builder.addDescriptor("object-position", [
|
|
3028
|
+
{},
|
|
3029
|
+
"join",
|
|
3030
|
+
[parseUnparsed(declaration.value, builder, "object-position"), " "],
|
|
3031
|
+
]);
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
function parseVisibility(
|
|
3035
|
+
declaration: DeclarationType<"visibility">,
|
|
3036
|
+
builder: StylesheetBuilder,
|
|
3037
|
+
) {
|
|
3038
|
+
if (declaration.value === "visible") {
|
|
3039
|
+
builder.addDescriptor("opacity", 1);
|
|
3040
|
+
} else if (declaration.value === "hidden") {
|
|
3041
|
+
builder.addDescriptor("opacity", 0);
|
|
3042
|
+
} else {
|
|
3043
|
+
builder.addWarning("value", declaration.value);
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
|
|
2828
3047
|
function parseFilter(
|
|
2829
3048
|
declaration: DeclarationType<"filter">,
|
|
2830
3049
|
builder: StylesheetBuilder,
|
|
@@ -2852,6 +3071,16 @@ function parseFilter(
|
|
|
2852
3071
|
[value.type]: parseAngle(value.value, builder),
|
|
2853
3072
|
} as unknown as StyleDescriptor;
|
|
2854
3073
|
case "drop-shadow":
|
|
3074
|
+
return [
|
|
3075
|
+
{},
|
|
3076
|
+
toRNProperty(value.type),
|
|
3077
|
+
[
|
|
3078
|
+
parseLength(value.value.xOffset, builder),
|
|
3079
|
+
parseLength(value.value.yOffset, builder),
|
|
3080
|
+
parseLength(value.value.blur, builder),
|
|
3081
|
+
parseColor(value.value.color, builder),
|
|
3082
|
+
],
|
|
3083
|
+
] as unknown as StyleDescriptor;
|
|
2855
3084
|
case "url":
|
|
2856
3085
|
return;
|
|
2857
3086
|
}
|