react-native-css 3.0.0-nightly.61014be → 3.0.0-nightly.67b5d08
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 +34 -18
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +214 -136
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +15 -15
- 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 +137 -46
- 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/jest/index.js +33 -10
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +1 -1
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/poison.pill.js +4 -1
- package/dist/commonjs/poison.pill.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 +28 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +12 -46
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +26 -21
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +22 -20
- package/dist/commonjs/runtime/native/injection.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +26 -24
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +3 -2
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -12
- 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/root.js +28 -0
- package/dist/commonjs/runtime/native/root.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 +61 -0
- package/dist/commonjs/runtime/native/styles/functions/index.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/transform-functions.js +121 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- 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} +5 -36
- 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/{box-shadow.js → shorthands/box-shadow.js} +3 -3
- 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/module/compiler/atRules.js +16 -3
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +34 -18
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +209 -132
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +15 -15
- 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 +136 -45
- 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/jest/index.js +32 -10
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +1 -1
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/poison.pill.js +4 -1
- package/dist/module/poison.pill.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 +28 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +12 -46
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +27 -22
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/injection.js +21 -19
- package/dist/module/runtime/native/injection.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +26 -24
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +2 -1
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +0 -11
- 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/root.js +24 -0
- package/dist/module/runtime/native/root.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 +8 -0
- package/dist/module/runtime/native/styles/functions/index.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/transform-functions.js +114 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- 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} +2 -2
- 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/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +7 -8
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +16 -19
- 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 +21 -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/jest/index.d.ts +20 -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/poison.pill.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 +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.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 +2 -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 +2 -10
- 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/root.d.ts +11 -0
- package/dist/typescript/commonjs/src/runtime/native/root.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 +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.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/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/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +7 -8
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +16 -19
- 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 +21 -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/jest/index.d.ts +20 -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/poison.pill.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 +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.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 +2 -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 +2 -10
- 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/root.d.ts +11 -0
- package/dist/typescript/module/src/runtime/native/root.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 +6 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.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/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/package.json +6 -3
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/compiler.ts +38 -32
- package/src/compiler/compiler.types.ts +9 -9
- package/src/compiler/declarations.ts +379 -166
- package/src/compiler/inheritance.test.ts +13 -13
- 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 +186 -51
- 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/jest/index.ts +41 -8
- package/src/metro/index.ts +6 -3
- package/src/poison.pill.ts +5 -1
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +27 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +14 -66
- package/src/runtime/native/conditions/media-query.ts +29 -25
- package/src/runtime/native/injection.ts +32 -31
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +27 -23
- package/src/runtime/native/react/useNativeCss.ts +4 -1
- package/src/runtime/native/reactivity.ts +2 -21
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/root.ts +31 -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 +5 -0
- package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
- package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
- package/src/runtime/native/styles/index.ts +12 -12
- 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 -63
- package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
- package/src/runtime/native/styles/{box-shadow.ts → shorthands/box-shadow.ts} +3 -3
- 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 +2 -6
- package/src/runtime/utils/objects.ts +16 -4
- package/src/runtime/utils/specificity.ts +1 -0
- package/dist/commonjs/compiler/attributes.test.js +0 -20
- package/dist/commonjs/compiler/attributes.test.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.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/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/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/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/runtime/native/styles/calc.ts +0 -97
|
@@ -3,7 +3,6 @@
|
|
|
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,
|
|
@@ -15,6 +14,7 @@ import type {
|
|
|
15
14
|
FontStyle,
|
|
16
15
|
FontVariantCaps,
|
|
17
16
|
FontWeight,
|
|
17
|
+
GapValue,
|
|
18
18
|
Gradient,
|
|
19
19
|
GradientItemFor_DimensionPercentageFor_LengthValue,
|
|
20
20
|
Length,
|
|
@@ -62,12 +62,16 @@ const propertyRename: Record<string, string> = {
|
|
|
62
62
|
"background-image": "experimental_backgroundImage",
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
// TODO: We need a better way to handle this
|
|
65
66
|
const unparsedRuntimeParsing = new Set([
|
|
66
67
|
"animation",
|
|
68
|
+
"border",
|
|
69
|
+
"box-shadow",
|
|
67
70
|
"text-shadow",
|
|
68
71
|
"transform",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
72
|
+
"scale",
|
|
73
|
+
"rotate",
|
|
74
|
+
"translate",
|
|
71
75
|
]);
|
|
72
76
|
|
|
73
77
|
const parsers: {
|
|
@@ -91,37 +95,44 @@ const parsers: {
|
|
|
91
95
|
"block-size": parseSizeDeclaration,
|
|
92
96
|
"border": parseBorder,
|
|
93
97
|
"border-block": parseBorderBlock,
|
|
94
|
-
"border-block-color":
|
|
98
|
+
"border-block-color": parseBorderColor,
|
|
95
99
|
"border-block-end": parseBorderBlockEnd,
|
|
96
100
|
"border-block-end-color": parseColorDeclaration,
|
|
97
101
|
"border-block-end-width": parseBorderSideWidthDeclaration,
|
|
98
102
|
"border-block-start": parseBorderBlockStart,
|
|
99
103
|
"border-block-start-color": parseColorDeclaration,
|
|
100
104
|
"border-block-start-width": parseBorderSideWidthDeclaration,
|
|
105
|
+
"border-block-style": parseBorderBlockStyle,
|
|
101
106
|
"border-block-width": parseBorderBlockWidth,
|
|
102
107
|
"border-bottom": parseBorderSide,
|
|
103
108
|
"border-bottom-color": parseColorDeclaration,
|
|
104
109
|
"border-bottom-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
105
110
|
"border-bottom-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
111
|
+
"border-bottom-style": parseBorderStyleDeclaration,
|
|
106
112
|
"border-bottom-width": parseBorderSideWidthDeclaration,
|
|
107
113
|
"border-color": parseBorderColor,
|
|
108
114
|
"border-end-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
109
115
|
"border-end-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
110
116
|
"border-inline": parseBorderInline,
|
|
111
|
-
"border-inline-color":
|
|
117
|
+
"border-inline-color": parseBorderColor,
|
|
112
118
|
"border-inline-end": parseBorderInlineEnd,
|
|
113
119
|
"border-inline-end-color": parseColorDeclaration,
|
|
120
|
+
"border-inline-end-style": parseBorderInlineStyle,
|
|
114
121
|
"border-inline-end-width": parseBorderSideWidthDeclaration,
|
|
115
122
|
"border-inline-start": parseBorderInlineStart,
|
|
116
123
|
"border-inline-start-color": parseColorDeclaration,
|
|
124
|
+
"border-inline-start-style": parseBorderInlineStyle,
|
|
117
125
|
"border-inline-start-width": parseBorderSideWidthDeclaration,
|
|
118
|
-
"border-inline-
|
|
126
|
+
"border-inline-style": parseBorderInlineStyle,
|
|
127
|
+
"border-inline-width": parseBorderInlineWidth,
|
|
119
128
|
"border-left": parseBorderSide,
|
|
120
129
|
"border-left-color": parseColorDeclaration,
|
|
130
|
+
"border-left-style": parseBorderStyleDeclaration,
|
|
121
131
|
"border-left-width": parseBorderSideWidthDeclaration,
|
|
122
132
|
"border-radius": parseBorderRadius,
|
|
123
133
|
"border-right": parseBorderSide,
|
|
124
134
|
"border-right-color": parseColorDeclaration,
|
|
135
|
+
"border-right-style": parseBorderStyleDeclaration,
|
|
125
136
|
"border-right-width": parseBorderSideWidthDeclaration,
|
|
126
137
|
"border-start-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
127
138
|
"border-start-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
@@ -130,11 +141,12 @@ const parsers: {
|
|
|
130
141
|
"border-top-color": parseColorDeclaration,
|
|
131
142
|
"border-top-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
132
143
|
"border-top-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
144
|
+
"border-top-style": parseBorderStyleDeclaration,
|
|
133
145
|
"border-top-width": parseBorderSideWidthDeclaration,
|
|
134
146
|
"border-width": parseBorderWidth,
|
|
135
147
|
"bottom": parseSizeDeclaration,
|
|
136
148
|
"box-shadow": parseBoxShadow,
|
|
137
|
-
"caret-color":
|
|
149
|
+
"caret-color": parseColorOrAutoDeclaration,
|
|
138
150
|
"color": parseFontColorDeclaration,
|
|
139
151
|
"column-gap": parseGap,
|
|
140
152
|
"container": parseContainer,
|
|
@@ -255,9 +267,9 @@ export function parseDeclaration(
|
|
|
255
267
|
}
|
|
256
268
|
|
|
257
269
|
if (declaration.property === "unparsed") {
|
|
258
|
-
|
|
270
|
+
parseUnparsedDeclaration(declaration, builder);
|
|
259
271
|
} else if (declaration.property === "custom") {
|
|
260
|
-
|
|
272
|
+
parseCustomDeclaration(declaration, builder);
|
|
261
273
|
} else {
|
|
262
274
|
parseWithParser(declaration, builder);
|
|
263
275
|
}
|
|
@@ -269,6 +281,7 @@ function parseWithParser(declaration: Declaration, builder: StylesheetBuilder) {
|
|
|
269
281
|
|
|
270
282
|
builder.descriptorProperty = declaration.property;
|
|
271
283
|
|
|
284
|
+
builder.setWarningProperty(declaration.property);
|
|
272
285
|
const value = parser(declaration, builder, declaration.property);
|
|
273
286
|
|
|
274
287
|
if (value !== undefined) {
|
|
@@ -342,15 +355,41 @@ function parseBorderRadius(
|
|
|
342
355
|
}
|
|
343
356
|
|
|
344
357
|
function parseBorderColor(
|
|
345
|
-
|
|
358
|
+
declaration: DeclarationType<
|
|
359
|
+
"border-color" | "border-block-color" | "border-inline-color"
|
|
360
|
+
>,
|
|
346
361
|
builder: StylesheetBuilder,
|
|
347
362
|
) {
|
|
348
|
-
|
|
349
|
-
"border-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
363
|
+
switch (declaration.property) {
|
|
364
|
+
case "border-color":
|
|
365
|
+
builder.addShorthand("border-color", {
|
|
366
|
+
"border-top-color": parseColor(declaration.value.top, builder),
|
|
367
|
+
"border-bottom-color": parseColor(declaration.value.bottom, builder),
|
|
368
|
+
"border-left-color": parseColor(declaration.value.left, builder),
|
|
369
|
+
"border-right-color": parseColor(declaration.value.right, builder),
|
|
370
|
+
});
|
|
371
|
+
break;
|
|
372
|
+
case "border-block-color":
|
|
373
|
+
builder.addDescriptor(
|
|
374
|
+
"border-top-color",
|
|
375
|
+
parseColor(declaration.value.start, builder),
|
|
376
|
+
);
|
|
377
|
+
builder.addDescriptor(
|
|
378
|
+
"border-bottom-color",
|
|
379
|
+
parseColor(declaration.value.end, builder),
|
|
380
|
+
);
|
|
381
|
+
break;
|
|
382
|
+
case "border-inline-color":
|
|
383
|
+
builder.addDescriptor(
|
|
384
|
+
"border-left-color",
|
|
385
|
+
parseColor(declaration.value.start, builder),
|
|
386
|
+
);
|
|
387
|
+
builder.addDescriptor(
|
|
388
|
+
"border-right-color",
|
|
389
|
+
parseColor(declaration.value.end, builder),
|
|
390
|
+
);
|
|
391
|
+
break;
|
|
392
|
+
}
|
|
354
393
|
}
|
|
355
394
|
|
|
356
395
|
function parseBorderWidth(
|
|
@@ -474,6 +513,43 @@ function parseBorderInlineEnd(
|
|
|
474
513
|
);
|
|
475
514
|
}
|
|
476
515
|
|
|
516
|
+
export function parseBorderInlineWidth(
|
|
517
|
+
declaration: DeclarationType<"border-inline-width">,
|
|
518
|
+
builder: StylesheetBuilder,
|
|
519
|
+
) {
|
|
520
|
+
builder.addDescriptor(
|
|
521
|
+
"border-left-width",
|
|
522
|
+
parseBorderSideWidth(declaration.value.start, builder),
|
|
523
|
+
);
|
|
524
|
+
builder.addDescriptor(
|
|
525
|
+
"border-right-width",
|
|
526
|
+
parseBorderSideWidth(declaration.value.end, builder),
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
export function parseBorderInlineStyle(
|
|
531
|
+
declaration: DeclarationType<
|
|
532
|
+
| "border-inline-style"
|
|
533
|
+
| "border-inline-start-style"
|
|
534
|
+
| "border-inline-end-style"
|
|
535
|
+
>,
|
|
536
|
+
builder: StylesheetBuilder,
|
|
537
|
+
) {
|
|
538
|
+
if (typeof declaration.value === "string") {
|
|
539
|
+
builder.addDescriptor(
|
|
540
|
+
"border-style",
|
|
541
|
+
parseBorderStyle(declaration.value, builder),
|
|
542
|
+
);
|
|
543
|
+
} else if (declaration.value.start === declaration.value.end) {
|
|
544
|
+
builder.addDescriptor(
|
|
545
|
+
"border-style",
|
|
546
|
+
parseBorderStyle(declaration.value.start, builder),
|
|
547
|
+
);
|
|
548
|
+
} else {
|
|
549
|
+
builder.addWarning("property", "border-inline-style");
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
477
553
|
function parseFlexFlow(
|
|
478
554
|
{ value }: DeclarationType<"flex-flow">,
|
|
479
555
|
builder: StylesheetBuilder,
|
|
@@ -594,22 +670,22 @@ function parseTransform(
|
|
|
594
670
|
) {
|
|
595
671
|
builder.addDescriptor("transform", [
|
|
596
672
|
{},
|
|
597
|
-
"
|
|
673
|
+
"transform",
|
|
598
674
|
value.flatMap((t): StyleDescriptor[] => {
|
|
599
675
|
switch (t.type) {
|
|
600
676
|
case "perspective":
|
|
601
|
-
return [[{}, "
|
|
677
|
+
return [[{}, "perspective", parseLength(t.value, builder)]];
|
|
602
678
|
case "translate":
|
|
603
679
|
return [
|
|
604
680
|
[
|
|
605
681
|
{},
|
|
606
|
-
"
|
|
682
|
+
"translateX",
|
|
607
683
|
parseLengthOrCoercePercentageToRuntime(t.value[0], builder),
|
|
608
684
|
],
|
|
609
685
|
[
|
|
610
686
|
[
|
|
611
687
|
{},
|
|
612
|
-
"
|
|
688
|
+
"translateY",
|
|
613
689
|
parseLengthOrCoercePercentageToRuntime(t.value[1], builder),
|
|
614
690
|
],
|
|
615
691
|
],
|
|
@@ -618,7 +694,7 @@ function parseTransform(
|
|
|
618
694
|
return [
|
|
619
695
|
[
|
|
620
696
|
{},
|
|
621
|
-
"
|
|
697
|
+
"translateX",
|
|
622
698
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
623
699
|
],
|
|
624
700
|
];
|
|
@@ -626,22 +702,22 @@ function parseTransform(
|
|
|
626
702
|
return [
|
|
627
703
|
[
|
|
628
704
|
{},
|
|
629
|
-
"
|
|
705
|
+
"translateY",
|
|
630
706
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
631
707
|
],
|
|
632
708
|
];
|
|
633
709
|
case "rotate":
|
|
634
|
-
return [[{}, "
|
|
710
|
+
return [[{}, "rotate", parseAngle(t.value, builder)]];
|
|
635
711
|
case "rotateX":
|
|
636
|
-
return [[{}, "
|
|
712
|
+
return [[{}, "rotateX", parseAngle(t.value, builder)]];
|
|
637
713
|
case "rotateY":
|
|
638
|
-
return [[{}, "
|
|
714
|
+
return [[{}, "rotateY", parseAngle(t.value, builder)]];
|
|
639
715
|
case "rotateZ":
|
|
640
|
-
return [[{}, "
|
|
716
|
+
return [[{}, "rotateZ", parseAngle(t.value, builder)]];
|
|
641
717
|
case "scale":
|
|
642
718
|
return [
|
|
643
|
-
[{}, "
|
|
644
|
-
[{}, "
|
|
719
|
+
[{}, "scaleX", parseLength(t.value[0], builder)],
|
|
720
|
+
[{}, "scaleY", parseLength(t.value[1], builder)],
|
|
645
721
|
];
|
|
646
722
|
case "scaleX":
|
|
647
723
|
return [[{}, "scaleX", parseLength(t.value, builder)]];
|
|
@@ -690,21 +766,29 @@ function parseRotate(
|
|
|
690
766
|
{ value }: DeclarationType<"rotate">,
|
|
691
767
|
builder: StylesheetBuilder,
|
|
692
768
|
) {
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
769
|
+
if (value.x) {
|
|
770
|
+
builder.addDescriptor("rotateX", [
|
|
771
|
+
{},
|
|
772
|
+
"rotateX",
|
|
773
|
+
parseAngle(value.angle, builder),
|
|
774
|
+
]);
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
if (value.y) {
|
|
778
|
+
builder.addDescriptor("rotateY", [
|
|
779
|
+
{},
|
|
780
|
+
"rotateY",
|
|
781
|
+
parseAngle(value.angle, builder),
|
|
782
|
+
]);
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
if (value.z) {
|
|
786
|
+
builder.addDescriptor("rotateZ", [
|
|
787
|
+
{},
|
|
788
|
+
"rotateZ",
|
|
789
|
+
parseAngle(value.angle, builder),
|
|
790
|
+
]);
|
|
791
|
+
}
|
|
708
792
|
}
|
|
709
793
|
|
|
710
794
|
function parseScale(
|
|
@@ -742,7 +826,17 @@ function parseLetterSpacing(
|
|
|
742
826
|
if (value.type === "normal") {
|
|
743
827
|
return;
|
|
744
828
|
}
|
|
745
|
-
|
|
829
|
+
const descriptor = parseLength(value.value, builder);
|
|
830
|
+
|
|
831
|
+
if (
|
|
832
|
+
Array.isArray(descriptor) &&
|
|
833
|
+
descriptor[1] === "em" &&
|
|
834
|
+
typeof descriptor[2] === "number"
|
|
835
|
+
) {
|
|
836
|
+
return descriptor[2];
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
return descriptor;
|
|
746
840
|
}
|
|
747
841
|
|
|
748
842
|
function parseTextDecoration(
|
|
@@ -771,7 +865,11 @@ function parseZIndex(
|
|
|
771
865
|
}
|
|
772
866
|
}
|
|
773
867
|
|
|
774
|
-
function parseContainerType(
|
|
868
|
+
function parseContainerType(
|
|
869
|
+
_declaration: DeclarationType<"container-type">,
|
|
870
|
+
builder: StylesheetBuilder,
|
|
871
|
+
) {
|
|
872
|
+
builder.addContainer(["___default___"]);
|
|
775
873
|
return;
|
|
776
874
|
}
|
|
777
875
|
|
|
@@ -791,7 +889,7 @@ function parseContainer(
|
|
|
791
889
|
return;
|
|
792
890
|
}
|
|
793
891
|
|
|
794
|
-
export function
|
|
892
|
+
export function parseUnparsedDeclaration(
|
|
795
893
|
declaration: Extract<Declaration, { property: "unparsed" }>,
|
|
796
894
|
builder: StylesheetBuilder,
|
|
797
895
|
) {
|
|
@@ -802,6 +900,8 @@ export function parseDeclarationUnparsed(
|
|
|
802
900
|
return;
|
|
803
901
|
}
|
|
804
902
|
|
|
903
|
+
builder.setWarningProperty(property);
|
|
904
|
+
|
|
805
905
|
/**
|
|
806
906
|
* React Native doesn't support all the logical properties
|
|
807
907
|
*/
|
|
@@ -816,24 +916,15 @@ export function parseDeclarationUnparsed(
|
|
|
816
916
|
builder.descriptorProperty = property;
|
|
817
917
|
|
|
818
918
|
if (unparsedRuntimeParsing.has(property)) {
|
|
819
|
-
const args = parseUnparsed(declaration.value.value, builder);
|
|
919
|
+
const args = parseUnparsed(declaration.value.value, builder, property);
|
|
820
920
|
|
|
821
921
|
if (property === "animation") {
|
|
822
|
-
builder.addDescriptor("animation", [
|
|
823
|
-
{},
|
|
824
|
-
`@${toRNProperty(property)}`,
|
|
825
|
-
args,
|
|
826
|
-
]);
|
|
922
|
+
builder.addDescriptor("animation", [{}, property, args]);
|
|
827
923
|
} else {
|
|
828
|
-
builder.addDescriptor(property, [
|
|
829
|
-
{},
|
|
830
|
-
`@${toRNProperty(property)}`,
|
|
831
|
-
args,
|
|
832
|
-
1,
|
|
833
|
-
]);
|
|
924
|
+
builder.addDescriptor(property, [{}, toRNProperty(property), args, 1]);
|
|
834
925
|
}
|
|
835
926
|
} else {
|
|
836
|
-
const value = parseUnparsed(declaration.value.value, builder);
|
|
927
|
+
const value = parseUnparsed(declaration.value.value, builder, property);
|
|
837
928
|
|
|
838
929
|
builder.addDescriptor(property, value);
|
|
839
930
|
|
|
@@ -847,19 +938,31 @@ export function parseDeclarationUnparsed(
|
|
|
847
938
|
}
|
|
848
939
|
}
|
|
849
940
|
|
|
850
|
-
export function
|
|
941
|
+
export function parseCustomDeclaration(
|
|
851
942
|
declaration: Extract<Declaration, { property: "custom" }>,
|
|
852
943
|
builder: StylesheetBuilder,
|
|
853
944
|
) {
|
|
854
945
|
const property = declaration.value.name;
|
|
855
|
-
|
|
946
|
+
|
|
947
|
+
if (property === "-webkit-line-clamp") {
|
|
948
|
+
builder.addDescriptor(
|
|
949
|
+
property,
|
|
950
|
+
parseUnparsed(declaration.value.value, builder, property),
|
|
951
|
+
);
|
|
952
|
+
} else if (property === "-rn-ripple-style") {
|
|
953
|
+
builder.addDescriptor(
|
|
954
|
+
property,
|
|
955
|
+
parseUnparsed(declaration.value.value, builder, property) ===
|
|
956
|
+
"borderless",
|
|
957
|
+
);
|
|
958
|
+
} else if (
|
|
856
959
|
validProperties.has(property) ||
|
|
857
960
|
property.startsWith("--") ||
|
|
858
961
|
property.startsWith("-rn-")
|
|
859
962
|
) {
|
|
860
963
|
builder.addDescriptor(
|
|
861
964
|
property,
|
|
862
|
-
parseUnparsed(declaration.value.value, builder,
|
|
965
|
+
parseUnparsed(declaration.value.value, builder, property),
|
|
863
966
|
);
|
|
864
967
|
} else {
|
|
865
968
|
builder.addWarning("property", declaration.value.name);
|
|
@@ -869,9 +972,13 @@ export function parseDeclarationCustom(
|
|
|
869
972
|
export function reduceParseUnparsed(
|
|
870
973
|
tokenOrValues: TokenOrValue[],
|
|
871
974
|
builder: StylesheetBuilder,
|
|
975
|
+
property: string,
|
|
976
|
+
allowAuto: boolean,
|
|
872
977
|
): StyleDescriptor {
|
|
873
978
|
const result = tokenOrValues
|
|
874
|
-
.map((tokenOrValue) =>
|
|
979
|
+
.map((tokenOrValue) =>
|
|
980
|
+
parseUnparsed(tokenOrValue, builder, property, allowAuto),
|
|
981
|
+
)
|
|
875
982
|
.filter((v) => v !== undefined);
|
|
876
983
|
|
|
877
984
|
if (result.length === 0) {
|
|
@@ -890,6 +997,8 @@ export function reduceParseUnparsed(
|
|
|
890
997
|
}
|
|
891
998
|
}
|
|
892
999
|
|
|
1000
|
+
// Groups are the tokens grouped together by comma location
|
|
1001
|
+
// If a group only has 1 item, it shouldn't be an array
|
|
893
1002
|
groups = groups.flatMap((group): StyleDescriptor[] => {
|
|
894
1003
|
if (!Array.isArray(group)) {
|
|
895
1004
|
return [];
|
|
@@ -905,6 +1014,17 @@ export function reduceParseUnparsed(
|
|
|
905
1014
|
} else {
|
|
906
1015
|
return [first];
|
|
907
1016
|
}
|
|
1017
|
+
} else if (
|
|
1018
|
+
// This is a special case for <ratio> values
|
|
1019
|
+
group.includes("/") &&
|
|
1020
|
+
group.every((item) =>
|
|
1021
|
+
typeof item === "string" && item === "/"
|
|
1022
|
+
? item
|
|
1023
|
+
: typeof item === "number",
|
|
1024
|
+
)
|
|
1025
|
+
) {
|
|
1026
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
1027
|
+
return [group.join(" ")];
|
|
908
1028
|
} else {
|
|
909
1029
|
return [group];
|
|
910
1030
|
}
|
|
@@ -916,11 +1036,13 @@ export function reduceParseUnparsed(
|
|
|
916
1036
|
export function unparsedFunction(
|
|
917
1037
|
token: Extract<TokenOrValue, { type: "function" }>,
|
|
918
1038
|
builder: StylesheetBuilder,
|
|
1039
|
+
property: string,
|
|
1040
|
+
allowAuto: boolean,
|
|
919
1041
|
): StyleFunction {
|
|
920
1042
|
return [
|
|
921
1043
|
{},
|
|
922
|
-
token.value.name,
|
|
923
|
-
reduceParseUnparsed(token.value.arguments, builder),
|
|
1044
|
+
toRNProperty(token.value.name),
|
|
1045
|
+
reduceParseUnparsed(token.value.arguments, builder, property, allowAuto),
|
|
924
1046
|
];
|
|
925
1047
|
}
|
|
926
1048
|
|
|
@@ -937,7 +1059,8 @@ export function parseUnparsed(
|
|
|
937
1059
|
| undefined
|
|
938
1060
|
| null,
|
|
939
1061
|
builder: StylesheetBuilder,
|
|
940
|
-
|
|
1062
|
+
property: string,
|
|
1063
|
+
allowAuto = allowAutoProperties.has(property),
|
|
941
1064
|
): StyleDescriptor {
|
|
942
1065
|
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
943
1066
|
return;
|
|
@@ -960,7 +1083,12 @@ export function parseUnparsed(
|
|
|
960
1083
|
}
|
|
961
1084
|
|
|
962
1085
|
if (Array.isArray(tokenOrValue)) {
|
|
963
|
-
const args = reduceParseUnparsed(
|
|
1086
|
+
const args = reduceParseUnparsed(
|
|
1087
|
+
tokenOrValue,
|
|
1088
|
+
builder,
|
|
1089
|
+
property,
|
|
1090
|
+
allowAuto,
|
|
1091
|
+
);
|
|
964
1092
|
if (!args) return;
|
|
965
1093
|
if (Array.isArray(args) && args.length === 1) return args[0];
|
|
966
1094
|
return args;
|
|
@@ -968,11 +1096,21 @@ export function parseUnparsed(
|
|
|
968
1096
|
|
|
969
1097
|
switch (tokenOrValue.type) {
|
|
970
1098
|
case "unresolved-color": {
|
|
971
|
-
return parseUnresolvedColor(
|
|
1099
|
+
return parseUnresolvedColor(
|
|
1100
|
+
tokenOrValue.value,
|
|
1101
|
+
builder,
|
|
1102
|
+
property,
|
|
1103
|
+
allowAuto,
|
|
1104
|
+
);
|
|
972
1105
|
}
|
|
973
1106
|
case "var": {
|
|
974
1107
|
let args: StyleDescriptor = tokenOrValue.value.name.ident.slice(2);
|
|
975
|
-
const fallback = parseUnparsed(
|
|
1108
|
+
const fallback = parseUnparsed(
|
|
1109
|
+
tokenOrValue.value.fallback,
|
|
1110
|
+
builder,
|
|
1111
|
+
property,
|
|
1112
|
+
allowAuto,
|
|
1113
|
+
);
|
|
976
1114
|
if (fallback !== undefined) {
|
|
977
1115
|
args = [args, fallback];
|
|
978
1116
|
}
|
|
@@ -981,43 +1119,53 @@ export function parseUnparsed(
|
|
|
981
1119
|
}
|
|
982
1120
|
case "function": {
|
|
983
1121
|
switch (tokenOrValue.value.name) {
|
|
984
|
-
case "
|
|
985
|
-
case "rotate":
|
|
986
|
-
case "rotateX":
|
|
987
|
-
case "rotateY":
|
|
988
|
-
case "skewX":
|
|
989
|
-
case "skewY":
|
|
990
|
-
case "scale":
|
|
991
|
-
case "scaleX":
|
|
992
|
-
case "scaleY":
|
|
993
|
-
case "translateX":
|
|
994
|
-
case "translateY":
|
|
995
|
-
tokenOrValue.value.name = `@${tokenOrValue.value.name}`;
|
|
996
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
1122
|
+
case "blur":
|
|
997
1123
|
case "brightness":
|
|
998
1124
|
case "contrast":
|
|
999
1125
|
case "cubic-bezier":
|
|
1000
1126
|
case "drop-shadow":
|
|
1001
1127
|
case "fontScale":
|
|
1128
|
+
case "getPixelSizeForLayoutSize":
|
|
1002
1129
|
case "grayscale":
|
|
1003
1130
|
case "hsl":
|
|
1004
1131
|
case "hsla":
|
|
1005
1132
|
case "hue-rotate":
|
|
1006
1133
|
case "invert":
|
|
1007
|
-
case "linear-gradient":
|
|
1008
1134
|
case "opacity":
|
|
1009
1135
|
case "pixelScale":
|
|
1010
|
-
case "pixelSizeForLayoutSize":
|
|
1011
1136
|
case "platformColor":
|
|
1012
|
-
case "radial-gradient":
|
|
1013
1137
|
case "rgb":
|
|
1014
1138
|
case "rgba":
|
|
1139
|
+
case "rotate":
|
|
1140
|
+
case "rotateX":
|
|
1141
|
+
case "rotateY":
|
|
1015
1142
|
case "roundToNearestPixel":
|
|
1016
1143
|
case "saturate":
|
|
1144
|
+
case "scale":
|
|
1145
|
+
case "scaleX":
|
|
1146
|
+
case "scaleY":
|
|
1017
1147
|
case "sepia":
|
|
1018
1148
|
case "shadow":
|
|
1149
|
+
case "skewX":
|
|
1150
|
+
case "skewY":
|
|
1019
1151
|
case "steps":
|
|
1020
|
-
|
|
1152
|
+
case "translate":
|
|
1153
|
+
case "translateX":
|
|
1154
|
+
case "translateY":
|
|
1155
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
1156
|
+
case "linear-gradient":
|
|
1157
|
+
case "radial-gradient":
|
|
1158
|
+
// These are special as React Native requires the '-' in their name
|
|
1159
|
+
return [
|
|
1160
|
+
{},
|
|
1161
|
+
tokenOrValue.value.name,
|
|
1162
|
+
reduceParseUnparsed(
|
|
1163
|
+
tokenOrValue.value.arguments,
|
|
1164
|
+
builder,
|
|
1165
|
+
property,
|
|
1166
|
+
allowAuto,
|
|
1167
|
+
),
|
|
1168
|
+
];
|
|
1021
1169
|
case "hairlineWidth":
|
|
1022
1170
|
return [{}, tokenOrValue.value.name, []];
|
|
1023
1171
|
case "calc":
|
|
@@ -1028,9 +1176,10 @@ export function parseUnparsed(
|
|
|
1028
1176
|
tokenOrValue.value.name,
|
|
1029
1177
|
tokenOrValue.value.arguments,
|
|
1030
1178
|
builder,
|
|
1179
|
+
property,
|
|
1031
1180
|
);
|
|
1032
1181
|
default: {
|
|
1033
|
-
builder.addWarning("
|
|
1182
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
1034
1183
|
return;
|
|
1035
1184
|
}
|
|
1036
1185
|
}
|
|
@@ -1060,6 +1209,8 @@ export function parseUnparsed(
|
|
|
1060
1209
|
return true;
|
|
1061
1210
|
} else if (value === "false") {
|
|
1062
1211
|
return false;
|
|
1212
|
+
} else if (value === "infinity") {
|
|
1213
|
+
return Number.MAX_SAFE_INTEGER;
|
|
1063
1214
|
} else {
|
|
1064
1215
|
return value;
|
|
1065
1216
|
}
|
|
@@ -1076,11 +1227,16 @@ export function parseUnparsed(
|
|
|
1076
1227
|
return parseDimension(tokenOrValue.value, builder);
|
|
1077
1228
|
case "comma":
|
|
1078
1229
|
return CommaSeparator as unknown as StyleDescriptor;
|
|
1230
|
+
case "delim": {
|
|
1231
|
+
if (tokenOrValue.value.value === "/") {
|
|
1232
|
+
return tokenOrValue.value.value;
|
|
1233
|
+
}
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1079
1236
|
case "at-keyword":
|
|
1080
1237
|
case "hash":
|
|
1081
1238
|
case "id-hash":
|
|
1082
1239
|
case "unquoted-url":
|
|
1083
|
-
case "delim":
|
|
1084
1240
|
case "white-space":
|
|
1085
1241
|
case "comment":
|
|
1086
1242
|
case "colon":
|
|
@@ -1151,23 +1307,35 @@ export function parseLength(
|
|
|
1151
1307
|
const { inlineRem = 14 } = builder.getOptions();
|
|
1152
1308
|
|
|
1153
1309
|
if (typeof length === "number") {
|
|
1154
|
-
return length;
|
|
1310
|
+
return round(length);
|
|
1155
1311
|
}
|
|
1156
1312
|
|
|
1157
1313
|
if ("unit" in length) {
|
|
1158
1314
|
switch (length.unit) {
|
|
1159
|
-
case "px":
|
|
1160
|
-
|
|
1315
|
+
case "px": {
|
|
1316
|
+
if (length.value === Infinity) {
|
|
1317
|
+
return 9999;
|
|
1318
|
+
} else if (length.value === -Infinity) {
|
|
1319
|
+
return -9999;
|
|
1320
|
+
} else {
|
|
1321
|
+
// Normalize large values to safe integers, e.g. `calc(infinity * 1px)`
|
|
1322
|
+
const value = Math.max(
|
|
1323
|
+
Math.min(length.value, Number.MAX_SAFE_INTEGER),
|
|
1324
|
+
Number.MIN_SAFE_INTEGER,
|
|
1325
|
+
);
|
|
1326
|
+
return round(value);
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1161
1329
|
case "rem":
|
|
1162
1330
|
if (typeof inlineRem === "number") {
|
|
1163
1331
|
return length.value * inlineRem;
|
|
1164
1332
|
} else {
|
|
1165
|
-
return [{}, "rem", length.value];
|
|
1333
|
+
return [{}, "rem", round(length.value)];
|
|
1166
1334
|
}
|
|
1167
1335
|
case "vw":
|
|
1168
1336
|
case "vh":
|
|
1169
1337
|
case "em":
|
|
1170
|
-
return [{}, length.unit, length.value, 1];
|
|
1338
|
+
return [{}, length.unit, round(length.value), 1];
|
|
1171
1339
|
case "in":
|
|
1172
1340
|
case "cm":
|
|
1173
1341
|
case "mm":
|
|
@@ -1250,7 +1418,7 @@ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
|
|
|
1250
1418
|
case "rad":
|
|
1251
1419
|
return `${angle.value}${angle.type}`;
|
|
1252
1420
|
default:
|
|
1253
|
-
builder.addWarning("value", angle.value);
|
|
1421
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
1254
1422
|
return undefined;
|
|
1255
1423
|
}
|
|
1256
1424
|
}
|
|
@@ -1333,7 +1501,7 @@ export function parseSize(
|
|
|
1333
1501
|
return;
|
|
1334
1502
|
}
|
|
1335
1503
|
|
|
1336
|
-
export function
|
|
1504
|
+
export function parseColorOrAutoDeclaration(
|
|
1337
1505
|
{ value }: { value: ColorOrAuto },
|
|
1338
1506
|
builder: StylesheetBuilder,
|
|
1339
1507
|
) {
|
|
@@ -1835,7 +2003,13 @@ export function parseOverflow(
|
|
|
1835
2003
|
}
|
|
1836
2004
|
|
|
1837
2005
|
export function parseBorderStyleDeclaration(
|
|
1838
|
-
declaration: DeclarationType<
|
|
2006
|
+
declaration: DeclarationType<
|
|
2007
|
+
| "border-style"
|
|
2008
|
+
| "border-left-style"
|
|
2009
|
+
| "border-right-style"
|
|
2010
|
+
| "border-top-style"
|
|
2011
|
+
| "border-bottom-style"
|
|
2012
|
+
>,
|
|
1839
2013
|
builder: StylesheetBuilder,
|
|
1840
2014
|
) {
|
|
1841
2015
|
return parseBorderStyle(declaration.value, builder);
|
|
@@ -1868,17 +2042,8 @@ export function parseBorderStyle(
|
|
|
1868
2042
|
return undefined;
|
|
1869
2043
|
}
|
|
1870
2044
|
|
|
1871
|
-
export function parseBorderBlockColor(
|
|
1872
|
-
{ value }: { value: BorderBlockColor },
|
|
1873
|
-
builder: StylesheetBuilder,
|
|
1874
|
-
) {
|
|
1875
|
-
builder.addDescriptor("border-top-color", parseColor(value.start, builder));
|
|
1876
|
-
builder.addDescriptor("border-bottom-color", parseColor(value.end, builder));
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1879
|
-
|
|
1880
2045
|
export function parseBorderBlockWidth(
|
|
1881
|
-
declaration: DeclarationType<"border-block-width"
|
|
2046
|
+
declaration: DeclarationType<"border-block-width">,
|
|
1882
2047
|
builder: StylesheetBuilder,
|
|
1883
2048
|
) {
|
|
1884
2049
|
builder.addDescriptor(
|
|
@@ -1891,11 +2056,48 @@ export function parseBorderBlockWidth(
|
|
|
1891
2056
|
);
|
|
1892
2057
|
}
|
|
1893
2058
|
|
|
2059
|
+
function parseBorderBlockStyle(
|
|
2060
|
+
declaration: DeclarationType<"border-block-style">,
|
|
2061
|
+
builder: StylesheetBuilder,
|
|
2062
|
+
) {
|
|
2063
|
+
if (declaration.value.start === declaration.value.end) {
|
|
2064
|
+
builder.addDescriptor(
|
|
2065
|
+
"border-style",
|
|
2066
|
+
parseBorderStyle(declaration.value.start, builder),
|
|
2067
|
+
);
|
|
2068
|
+
} else {
|
|
2069
|
+
builder.addWarning("property", "border-block-style");
|
|
2070
|
+
}
|
|
2071
|
+
}
|
|
2072
|
+
|
|
1894
2073
|
export function parseBorderSideWidthDeclaration(
|
|
1895
|
-
declaration:
|
|
2074
|
+
declaration: DeclarationType<
|
|
2075
|
+
| "border-block-end-width"
|
|
2076
|
+
| "border-block-start-width"
|
|
2077
|
+
| "border-bottom-width"
|
|
2078
|
+
| "border-inline-end-width"
|
|
2079
|
+
| "border-inline-start-width"
|
|
2080
|
+
| "border-left-width"
|
|
2081
|
+
| "border-right-width"
|
|
2082
|
+
| "border-top-width"
|
|
2083
|
+
>,
|
|
1896
2084
|
builder: StylesheetBuilder,
|
|
1897
2085
|
) {
|
|
1898
|
-
|
|
2086
|
+
if (declaration.property.includes("block")) {
|
|
2087
|
+
builder.addDescriptor(
|
|
2088
|
+
`border-${declaration.property.includes("start") ? "top" : "bottom"}-width`,
|
|
2089
|
+
parseBorderSideWidth(declaration.value, builder),
|
|
2090
|
+
);
|
|
2091
|
+
return;
|
|
2092
|
+
} else if (declaration.property.includes("inline")) {
|
|
2093
|
+
builder.addDescriptor(
|
|
2094
|
+
`border-${declaration.property.includes("start") ? "left" : "right"}-width`,
|
|
2095
|
+
parseBorderSideWidth(declaration.value, builder),
|
|
2096
|
+
);
|
|
2097
|
+
return;
|
|
2098
|
+
} else {
|
|
2099
|
+
return parseBorderSideWidth(declaration.value, builder);
|
|
2100
|
+
}
|
|
1899
2101
|
}
|
|
1900
2102
|
|
|
1901
2103
|
export function parseBorderSideWidth(
|
|
@@ -1958,7 +2160,8 @@ export function parseLineHeight(
|
|
|
1958
2160
|
case "percentage":
|
|
1959
2161
|
case "calc":
|
|
1960
2162
|
builder.addWarning(
|
|
1961
|
-
"
|
|
2163
|
+
"style",
|
|
2164
|
+
"line-height",
|
|
1962
2165
|
typeof length.value === "number"
|
|
1963
2166
|
? length.value
|
|
1964
2167
|
: JSON.stringify(length.value),
|
|
@@ -2065,8 +2268,14 @@ export function parseGap(
|
|
|
2065
2268
|
builder: StylesheetBuilder,
|
|
2066
2269
|
) {
|
|
2067
2270
|
if ("column" in declaration.value) {
|
|
2068
|
-
builder.addDescriptor(
|
|
2069
|
-
|
|
2271
|
+
builder.addDescriptor(
|
|
2272
|
+
"row-gap",
|
|
2273
|
+
parseGapValue(declaration.value.row, builder),
|
|
2274
|
+
);
|
|
2275
|
+
builder.addDescriptor(
|
|
2276
|
+
"column-gap",
|
|
2277
|
+
parseGapValue(declaration.value.column, builder),
|
|
2278
|
+
);
|
|
2070
2279
|
|
|
2071
2280
|
return;
|
|
2072
2281
|
} else {
|
|
@@ -2079,6 +2288,17 @@ export function parseGap(
|
|
|
2079
2288
|
}
|
|
2080
2289
|
}
|
|
2081
2290
|
|
|
2291
|
+
function parseGapValue(
|
|
2292
|
+
value: GapValue,
|
|
2293
|
+
builder: StylesheetBuilder,
|
|
2294
|
+
): StyleDescriptor {
|
|
2295
|
+
if (value.type === "normal") {
|
|
2296
|
+
return;
|
|
2297
|
+
} else {
|
|
2298
|
+
return parseLength(value.value, builder);
|
|
2299
|
+
}
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2082
2302
|
export function parseTextAlign(
|
|
2083
2303
|
{ value }: DeclarationType<"text-align">,
|
|
2084
2304
|
builder: StylesheetBuilder,
|
|
@@ -2204,7 +2424,11 @@ export function parseDimension(
|
|
|
2204
2424
|
): StyleDescriptor {
|
|
2205
2425
|
switch (unit) {
|
|
2206
2426
|
case "px":
|
|
2207
|
-
|
|
2427
|
+
if (value === Infinity) {
|
|
2428
|
+
return 9999;
|
|
2429
|
+
} else {
|
|
2430
|
+
return value;
|
|
2431
|
+
}
|
|
2208
2432
|
case "%":
|
|
2209
2433
|
return `${value}%`;
|
|
2210
2434
|
case "rnh":
|
|
@@ -2231,20 +2455,24 @@ export function parseUserSelect(
|
|
|
2231
2455
|
}
|
|
2232
2456
|
|
|
2233
2457
|
export function parseSVGPaint(
|
|
2234
|
-
{ value }: DeclarationType<"fill" | "stroke">,
|
|
2458
|
+
{ value, property }: DeclarationType<"fill" | "stroke">,
|
|
2235
2459
|
builder: StylesheetBuilder,
|
|
2236
2460
|
) {
|
|
2461
|
+
let parsedValue: StyleDescriptor | undefined;
|
|
2462
|
+
|
|
2237
2463
|
if (value.type === "none") {
|
|
2238
|
-
|
|
2464
|
+
parsedValue = "transparent";
|
|
2239
2465
|
} else if (value.type === "color") {
|
|
2240
|
-
|
|
2466
|
+
parsedValue = parseColor(value.value, builder);
|
|
2467
|
+
} else {
|
|
2468
|
+
return;
|
|
2241
2469
|
}
|
|
2242
2470
|
|
|
2243
|
-
|
|
2471
|
+
builder.addDescriptor(property, parsedValue);
|
|
2244
2472
|
}
|
|
2245
2473
|
|
|
2246
2474
|
export function round(number: number) {
|
|
2247
|
-
return Math.round((number + Number.EPSILON) *
|
|
2475
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
2248
2476
|
}
|
|
2249
2477
|
|
|
2250
2478
|
export function parseDimensionPercentageFor_LengthValue(
|
|
@@ -2260,7 +2488,7 @@ export function parseDimensionPercentageFor_LengthValue(
|
|
|
2260
2488
|
}
|
|
2261
2489
|
}
|
|
2262
2490
|
|
|
2263
|
-
const
|
|
2491
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
2264
2492
|
|
|
2265
2493
|
export function parseEnv(
|
|
2266
2494
|
value: EnvironmentVariable,
|
|
@@ -2278,7 +2506,7 @@ export function parseEnv(
|
|
|
2278
2506
|
"var",
|
|
2279
2507
|
[
|
|
2280
2508
|
`--react-native-css-${value.name.value}`,
|
|
2281
|
-
parseUnparsed(value.fallback, builder),
|
|
2509
|
+
parseUnparsed(value.fallback, builder, value.name.value),
|
|
2282
2510
|
],
|
|
2283
2511
|
1,
|
|
2284
2512
|
];
|
|
@@ -2301,8 +2529,9 @@ export function parseCalcFn(
|
|
|
2301
2529
|
name: string,
|
|
2302
2530
|
tokens: TokenOrValue[],
|
|
2303
2531
|
builder: StylesheetBuilder,
|
|
2532
|
+
property: string,
|
|
2304
2533
|
): StyleDescriptor {
|
|
2305
|
-
const args = parseCalcArguments(tokens, builder);
|
|
2534
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
2306
2535
|
if (args) {
|
|
2307
2536
|
return [{}, name, args];
|
|
2308
2537
|
}
|
|
@@ -2313,12 +2542,11 @@ export function parseCalcFn(
|
|
|
2313
2542
|
export function parseCalcArguments(
|
|
2314
2543
|
[...args]: TokenOrValue[],
|
|
2315
2544
|
builder: StylesheetBuilder,
|
|
2545
|
+
property: string,
|
|
2316
2546
|
) {
|
|
2317
2547
|
const parsed: StyleDescriptor[] = [];
|
|
2318
2548
|
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
for (const [currentIndex, arg] of args.entries()) {
|
|
2549
|
+
for (const arg of args) {
|
|
2322
2550
|
switch (arg.type) {
|
|
2323
2551
|
case "env": {
|
|
2324
2552
|
parsed.push(parseEnv(arg.value, builder));
|
|
@@ -2327,7 +2555,7 @@ export function parseCalcArguments(
|
|
|
2327
2555
|
case "var":
|
|
2328
2556
|
case "function":
|
|
2329
2557
|
case "unresolved-color": {
|
|
2330
|
-
const value = parseUnparsed(arg, builder);
|
|
2558
|
+
const value = parseUnparsed(arg, builder, property);
|
|
2331
2559
|
|
|
2332
2560
|
if (value === undefined) {
|
|
2333
2561
|
return undefined;
|
|
@@ -2338,11 +2566,9 @@ export function parseCalcArguments(
|
|
|
2338
2566
|
}
|
|
2339
2567
|
case "length": {
|
|
2340
2568
|
const value = parseLength(arg.value, builder);
|
|
2341
|
-
|
|
2342
2569
|
if (value !== undefined) {
|
|
2343
2570
|
parsed.push(value);
|
|
2344
2571
|
}
|
|
2345
|
-
|
|
2346
2572
|
break;
|
|
2347
2573
|
}
|
|
2348
2574
|
case "color":
|
|
@@ -2365,49 +2591,19 @@ export function parseCalcArguments(
|
|
|
2365
2591
|
}
|
|
2366
2592
|
break;
|
|
2367
2593
|
case "percentage":
|
|
2368
|
-
|
|
2369
|
-
if (mode !== "percentage") return;
|
|
2370
|
-
parsed.push(`${arg.value.value * 100}%`);
|
|
2594
|
+
parsed.push(`${round(arg.value.value * 100)}%`);
|
|
2371
2595
|
break;
|
|
2372
2596
|
case "number": {
|
|
2373
|
-
|
|
2374
|
-
if (mode !== "number") return;
|
|
2375
|
-
parsed.push(arg.value.value);
|
|
2597
|
+
parsed.push(round(arg.value.value));
|
|
2376
2598
|
break;
|
|
2377
2599
|
}
|
|
2378
2600
|
case "parenthesis-block": {
|
|
2379
|
-
|
|
2380
|
-
* If we have a parenthesis block, we just treat it as a nested calc function
|
|
2381
|
-
* Because there could be multiple parenthesis blocks, this is recursive
|
|
2382
|
-
*/
|
|
2383
|
-
let closeParenthesisIndex = -1;
|
|
2384
|
-
for (let index = args.length - 1; index > 0; index--) {
|
|
2385
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2386
|
-
const value = args[index]!;
|
|
2387
|
-
if (
|
|
2388
|
-
value.type === "token" &&
|
|
2389
|
-
value.value.type === "close-parenthesis"
|
|
2390
|
-
) {
|
|
2391
|
-
closeParenthesisIndex = index;
|
|
2392
|
-
break;
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
|
|
2396
|
-
if (closeParenthesisIndex === -1) {
|
|
2397
|
-
return;
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
const innerCalcArgs = args
|
|
2401
|
-
// Extract the inner calcArgs including the parenthesis. This mutates args
|
|
2402
|
-
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
2403
|
-
// Then drop the surrounding parenthesis
|
|
2404
|
-
.slice(1, -1);
|
|
2405
|
-
|
|
2406
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
2407
|
-
|
|
2601
|
+
parsed.push("(");
|
|
2408
2602
|
break;
|
|
2409
2603
|
}
|
|
2410
2604
|
case "close-parenthesis":
|
|
2605
|
+
parsed.push(")");
|
|
2606
|
+
break;
|
|
2411
2607
|
case "string":
|
|
2412
2608
|
case "function":
|
|
2413
2609
|
case "ident":
|
|
@@ -2456,6 +2652,8 @@ export function parseTranslateProp(
|
|
|
2456
2652
|
export function parseUnresolvedColor(
|
|
2457
2653
|
color: UnresolvedColor,
|
|
2458
2654
|
builder: StylesheetBuilder,
|
|
2655
|
+
property: string,
|
|
2656
|
+
allowAuto: boolean,
|
|
2459
2657
|
): StyleDescriptor {
|
|
2460
2658
|
switch (color.type) {
|
|
2461
2659
|
case "rgb":
|
|
@@ -2466,26 +2664,31 @@ export function parseUnresolvedColor(
|
|
|
2466
2664
|
round(color.r * 255),
|
|
2467
2665
|
round(color.g * 255),
|
|
2468
2666
|
round(color.b * 255),
|
|
2469
|
-
parseUnparsed(color.alpha, builder),
|
|
2667
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2470
2668
|
],
|
|
2471
2669
|
];
|
|
2472
2670
|
case "hsl":
|
|
2473
2671
|
return [
|
|
2474
2672
|
{},
|
|
2475
2673
|
color.type,
|
|
2476
|
-
[
|
|
2674
|
+
[
|
|
2675
|
+
color.h,
|
|
2676
|
+
color.s,
|
|
2677
|
+
color.l,
|
|
2678
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2679
|
+
],
|
|
2477
2680
|
];
|
|
2478
2681
|
case "light-dark": {
|
|
2479
2682
|
const extraRule = builder.extendRule({
|
|
2480
2683
|
m: [["=", "prefers-color-scheme", "dark"]],
|
|
2481
2684
|
});
|
|
2482
2685
|
builder.addUnnamedDescriptor(
|
|
2483
|
-
reduceParseUnparsed(color.dark, builder),
|
|
2686
|
+
reduceParseUnparsed(color.dark, builder, property, allowAuto),
|
|
2484
2687
|
false,
|
|
2485
2688
|
extraRule,
|
|
2486
2689
|
);
|
|
2487
2690
|
builder.addExtraRule(extraRule);
|
|
2488
|
-
return reduceParseUnparsed(color.light, builder);
|
|
2691
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
2489
2692
|
}
|
|
2490
2693
|
default:
|
|
2491
2694
|
color satisfies never;
|
|
@@ -2731,7 +2934,7 @@ function parseGradient(
|
|
|
2731
2934
|
case "linear": {
|
|
2732
2935
|
return [
|
|
2733
2936
|
{},
|
|
2734
|
-
"
|
|
2937
|
+
"linear-gradient",
|
|
2735
2938
|
[
|
|
2736
2939
|
parseLineDirection(gradient.direction, builder),
|
|
2737
2940
|
...gradient.items.map((item) => parseGradientItem(item, builder)),
|
|
@@ -2808,6 +3011,16 @@ function parseFilter(
|
|
|
2808
3011
|
[value.type]: parseAngle(value.value, builder),
|
|
2809
3012
|
} as unknown as StyleDescriptor;
|
|
2810
3013
|
case "drop-shadow":
|
|
3014
|
+
return [
|
|
3015
|
+
{},
|
|
3016
|
+
toRNProperty(value.type),
|
|
3017
|
+
[
|
|
3018
|
+
parseLength(value.value.xOffset, builder),
|
|
3019
|
+
parseLength(value.value.yOffset, builder),
|
|
3020
|
+
parseLength(value.value.blur, builder),
|
|
3021
|
+
parseColor(value.value.color, builder),
|
|
3022
|
+
],
|
|
3023
|
+
] as unknown as StyleDescriptor;
|
|
2811
3024
|
case "url":
|
|
2812
3025
|
return;
|
|
2813
3026
|
}
|