react-native-css 3.0.0-nightly.75f8b74 → 3.0.0-nightly.9c84741
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 +37 -21
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +255 -154
- 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/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 +30 -12
- 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 +14 -11
- package/dist/commonjs/poison.pill.js.map +1 -1
- 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 +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/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +33 -27
- 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 +12 -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/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/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} +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 +37 -21
- 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 +250 -150
- 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/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 +28 -10
- 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 +14 -11
- package/dist/module/poison.pill.js.map +1 -1
- 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 +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/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +31 -26
- 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 +11 -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/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/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} +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 +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +16 -17
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +18 -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 +23 -9
- 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 +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/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/poison.pill.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 +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/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/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 +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +16 -17
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +18 -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 +23 -9
- 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 +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/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/poison.pill.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 +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/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/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 +32 -16
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/compiler.ts +40 -33
- package/src/compiler/compiler.types.ts +18 -19
- package/src/compiler/declarations.ts +447 -192
- 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 +188 -53
- 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 +35 -10
- 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 +15 -11
- 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 +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/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +34 -24
- package/src/runtime/native/react/useNativeCss.ts +4 -1
- package/src/runtime/native/reactivity.ts +14 -21
- 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/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 -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,
|
|
119
|
-
"border-inline-
|
|
128
|
+
"border-inline-style": parseBorderInlineStyle,
|
|
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-
|
|
441
|
+
builder.addDescriptor("border-block-color", parseColor(value.color, builder));
|
|
401
442
|
builder.addDescriptor(
|
|
402
|
-
"border-
|
|
403
|
-
parseColor(value.color, builder),
|
|
404
|
-
);
|
|
405
|
-
builder.addDescriptor(
|
|
406
|
-
"border-top-width",
|
|
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,94 @@ 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
|
+
);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
export function parseBorderInlineWidth(
|
|
535
|
+
declaration: DeclarationType<"border-inline-width">,
|
|
536
|
+
builder: StylesheetBuilder,
|
|
537
|
+
) {
|
|
538
|
+
builder.addDescriptor(
|
|
539
|
+
"border-inline-width",
|
|
540
|
+
parseBorderSideWidth(declaration.value.start, builder),
|
|
541
|
+
);
|
|
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
|
+
}
|
|
476
572
|
}
|
|
477
573
|
|
|
478
574
|
function parseFlexFlow(
|
|
@@ -595,22 +691,22 @@ function parseTransform(
|
|
|
595
691
|
) {
|
|
596
692
|
builder.addDescriptor("transform", [
|
|
597
693
|
{},
|
|
598
|
-
"
|
|
694
|
+
"transform",
|
|
599
695
|
value.flatMap((t): StyleDescriptor[] => {
|
|
600
696
|
switch (t.type) {
|
|
601
697
|
case "perspective":
|
|
602
|
-
return [[{}, "
|
|
698
|
+
return [[{}, "perspective", parseLength(t.value, builder)]];
|
|
603
699
|
case "translate":
|
|
604
700
|
return [
|
|
605
701
|
[
|
|
606
702
|
{},
|
|
607
|
-
"
|
|
703
|
+
"translateX",
|
|
608
704
|
parseLengthOrCoercePercentageToRuntime(t.value[0], builder),
|
|
609
705
|
],
|
|
610
706
|
[
|
|
611
707
|
[
|
|
612
708
|
{},
|
|
613
|
-
"
|
|
709
|
+
"translateY",
|
|
614
710
|
parseLengthOrCoercePercentageToRuntime(t.value[1], builder),
|
|
615
711
|
],
|
|
616
712
|
],
|
|
@@ -619,7 +715,7 @@ function parseTransform(
|
|
|
619
715
|
return [
|
|
620
716
|
[
|
|
621
717
|
{},
|
|
622
|
-
"
|
|
718
|
+
"translateX",
|
|
623
719
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
624
720
|
],
|
|
625
721
|
];
|
|
@@ -627,22 +723,22 @@ function parseTransform(
|
|
|
627
723
|
return [
|
|
628
724
|
[
|
|
629
725
|
{},
|
|
630
|
-
"
|
|
726
|
+
"translateY",
|
|
631
727
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
632
728
|
],
|
|
633
729
|
];
|
|
634
730
|
case "rotate":
|
|
635
|
-
return [[{}, "
|
|
731
|
+
return [[{}, "rotate", parseAngle(t.value, builder)]];
|
|
636
732
|
case "rotateX":
|
|
637
|
-
return [[{}, "
|
|
733
|
+
return [[{}, "rotateX", parseAngle(t.value, builder)]];
|
|
638
734
|
case "rotateY":
|
|
639
|
-
return [[{}, "
|
|
735
|
+
return [[{}, "rotateY", parseAngle(t.value, builder)]];
|
|
640
736
|
case "rotateZ":
|
|
641
|
-
return [[{}, "
|
|
737
|
+
return [[{}, "rotateZ", parseAngle(t.value, builder)]];
|
|
642
738
|
case "scale":
|
|
643
739
|
return [
|
|
644
|
-
[{}, "
|
|
645
|
-
[{}, "
|
|
740
|
+
[{}, "scaleX", parseLength(t.value[0], builder)],
|
|
741
|
+
[{}, "scaleY", parseLength(t.value[1], builder)],
|
|
646
742
|
];
|
|
647
743
|
case "scaleX":
|
|
648
744
|
return [[{}, "scaleX", parseLength(t.value, builder)]];
|
|
@@ -691,21 +787,29 @@ function parseRotate(
|
|
|
691
787
|
{ value }: DeclarationType<"rotate">,
|
|
692
788
|
builder: StylesheetBuilder,
|
|
693
789
|
) {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
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
|
+
}
|
|
709
813
|
}
|
|
710
814
|
|
|
711
815
|
function parseScale(
|
|
@@ -743,7 +847,17 @@ function parseLetterSpacing(
|
|
|
743
847
|
if (value.type === "normal") {
|
|
744
848
|
return;
|
|
745
849
|
}
|
|
746
|
-
|
|
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;
|
|
747
861
|
}
|
|
748
862
|
|
|
749
863
|
function parseTextDecoration(
|
|
@@ -772,7 +886,11 @@ function parseZIndex(
|
|
|
772
886
|
}
|
|
773
887
|
}
|
|
774
888
|
|
|
775
|
-
function parseContainerType(
|
|
889
|
+
function parseContainerType(
|
|
890
|
+
_declaration: DeclarationType<"container-type">,
|
|
891
|
+
builder: StylesheetBuilder,
|
|
892
|
+
) {
|
|
893
|
+
builder.addContainer(["___default___"]);
|
|
776
894
|
return;
|
|
777
895
|
}
|
|
778
896
|
|
|
@@ -792,7 +910,7 @@ function parseContainer(
|
|
|
792
910
|
return;
|
|
793
911
|
}
|
|
794
912
|
|
|
795
|
-
export function
|
|
913
|
+
export function parseUnparsedDeclaration(
|
|
796
914
|
declaration: Extract<Declaration, { property: "unparsed" }>,
|
|
797
915
|
builder: StylesheetBuilder,
|
|
798
916
|
) {
|
|
@@ -803,6 +921,8 @@ export function parseDeclarationUnparsed(
|
|
|
803
921
|
return;
|
|
804
922
|
}
|
|
805
923
|
|
|
924
|
+
builder.setWarningProperty(property);
|
|
925
|
+
|
|
806
926
|
/**
|
|
807
927
|
* React Native doesn't support all the logical properties
|
|
808
928
|
*/
|
|
@@ -817,24 +937,15 @@ export function parseDeclarationUnparsed(
|
|
|
817
937
|
builder.descriptorProperty = property;
|
|
818
938
|
|
|
819
939
|
if (unparsedRuntimeParsing.has(property)) {
|
|
820
|
-
const args = parseUnparsed(declaration.value.value, builder);
|
|
940
|
+
const args = parseUnparsed(declaration.value.value, builder, property);
|
|
821
941
|
|
|
822
942
|
if (property === "animation") {
|
|
823
|
-
builder.addDescriptor("animation", [
|
|
824
|
-
{},
|
|
825
|
-
`@${toRNProperty(property)}`,
|
|
826
|
-
args,
|
|
827
|
-
]);
|
|
943
|
+
builder.addDescriptor("animation", [{}, property, args]);
|
|
828
944
|
} else {
|
|
829
|
-
builder.addDescriptor(property, [
|
|
830
|
-
{},
|
|
831
|
-
`@${toRNProperty(property)}`,
|
|
832
|
-
args,
|
|
833
|
-
1,
|
|
834
|
-
]);
|
|
945
|
+
builder.addDescriptor(property, [{}, toRNProperty(property), args, 1]);
|
|
835
946
|
}
|
|
836
947
|
} else {
|
|
837
|
-
const value = parseUnparsed(declaration.value.value, builder);
|
|
948
|
+
const value = parseUnparsed(declaration.value.value, builder, property);
|
|
838
949
|
|
|
839
950
|
builder.addDescriptor(property, value);
|
|
840
951
|
|
|
@@ -848,19 +959,37 @@ export function parseDeclarationUnparsed(
|
|
|
848
959
|
}
|
|
849
960
|
}
|
|
850
961
|
|
|
851
|
-
export function
|
|
962
|
+
export function parseCustomDeclaration(
|
|
852
963
|
declaration: Extract<Declaration, { property: "custom" }>,
|
|
853
964
|
builder: StylesheetBuilder,
|
|
854
965
|
) {
|
|
855
966
|
const property = declaration.value.name;
|
|
856
|
-
|
|
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 (
|
|
857
986
|
validProperties.has(property) ||
|
|
858
987
|
property.startsWith("--") ||
|
|
859
988
|
property.startsWith("-rn-")
|
|
860
989
|
) {
|
|
861
990
|
builder.addDescriptor(
|
|
862
991
|
property,
|
|
863
|
-
parseUnparsed(declaration.value.value, builder,
|
|
992
|
+
parseUnparsed(declaration.value.value, builder, property),
|
|
864
993
|
);
|
|
865
994
|
} else {
|
|
866
995
|
builder.addWarning("property", declaration.value.name);
|
|
@@ -870,9 +999,13 @@ export function parseDeclarationCustom(
|
|
|
870
999
|
export function reduceParseUnparsed(
|
|
871
1000
|
tokenOrValues: TokenOrValue[],
|
|
872
1001
|
builder: StylesheetBuilder,
|
|
1002
|
+
property: string,
|
|
1003
|
+
allowAuto: boolean,
|
|
873
1004
|
): StyleDescriptor {
|
|
874
1005
|
const result = tokenOrValues
|
|
875
|
-
.map((tokenOrValue) =>
|
|
1006
|
+
.map((tokenOrValue) =>
|
|
1007
|
+
parseUnparsed(tokenOrValue, builder, property, allowAuto),
|
|
1008
|
+
)
|
|
876
1009
|
.filter((v) => v !== undefined);
|
|
877
1010
|
|
|
878
1011
|
if (result.length === 0) {
|
|
@@ -891,6 +1024,8 @@ export function reduceParseUnparsed(
|
|
|
891
1024
|
}
|
|
892
1025
|
}
|
|
893
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
|
|
894
1029
|
groups = groups.flatMap((group): StyleDescriptor[] => {
|
|
895
1030
|
if (!Array.isArray(group)) {
|
|
896
1031
|
return [];
|
|
@@ -906,6 +1041,17 @@ export function reduceParseUnparsed(
|
|
|
906
1041
|
} else {
|
|
907
1042
|
return [first];
|
|
908
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(" ")];
|
|
909
1055
|
} else {
|
|
910
1056
|
return [group];
|
|
911
1057
|
}
|
|
@@ -917,11 +1063,13 @@ export function reduceParseUnparsed(
|
|
|
917
1063
|
export function unparsedFunction(
|
|
918
1064
|
token: Extract<TokenOrValue, { type: "function" }>,
|
|
919
1065
|
builder: StylesheetBuilder,
|
|
1066
|
+
property: string,
|
|
1067
|
+
allowAuto: boolean,
|
|
920
1068
|
): StyleFunction {
|
|
921
1069
|
return [
|
|
922
1070
|
{},
|
|
923
|
-
token.value.name,
|
|
924
|
-
reduceParseUnparsed(token.value.arguments, builder),
|
|
1071
|
+
toRNProperty(token.value.name),
|
|
1072
|
+
reduceParseUnparsed(token.value.arguments, builder, property, allowAuto),
|
|
925
1073
|
];
|
|
926
1074
|
}
|
|
927
1075
|
|
|
@@ -938,7 +1086,8 @@ export function parseUnparsed(
|
|
|
938
1086
|
| undefined
|
|
939
1087
|
| null,
|
|
940
1088
|
builder: StylesheetBuilder,
|
|
941
|
-
|
|
1089
|
+
property: string,
|
|
1090
|
+
allowAuto = allowAutoProperties.has(property),
|
|
942
1091
|
): StyleDescriptor {
|
|
943
1092
|
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
944
1093
|
return;
|
|
@@ -961,7 +1110,12 @@ export function parseUnparsed(
|
|
|
961
1110
|
}
|
|
962
1111
|
|
|
963
1112
|
if (Array.isArray(tokenOrValue)) {
|
|
964
|
-
const args = reduceParseUnparsed(
|
|
1113
|
+
const args = reduceParseUnparsed(
|
|
1114
|
+
tokenOrValue,
|
|
1115
|
+
builder,
|
|
1116
|
+
property,
|
|
1117
|
+
allowAuto,
|
|
1118
|
+
);
|
|
965
1119
|
if (!args) return;
|
|
966
1120
|
if (Array.isArray(args) && args.length === 1) return args[0];
|
|
967
1121
|
return args;
|
|
@@ -969,11 +1123,21 @@ export function parseUnparsed(
|
|
|
969
1123
|
|
|
970
1124
|
switch (tokenOrValue.type) {
|
|
971
1125
|
case "unresolved-color": {
|
|
972
|
-
return parseUnresolvedColor(
|
|
1126
|
+
return parseUnresolvedColor(
|
|
1127
|
+
tokenOrValue.value,
|
|
1128
|
+
builder,
|
|
1129
|
+
property,
|
|
1130
|
+
allowAuto,
|
|
1131
|
+
);
|
|
973
1132
|
}
|
|
974
1133
|
case "var": {
|
|
975
1134
|
let args: StyleDescriptor = tokenOrValue.value.name.ident.slice(2);
|
|
976
|
-
const fallback = parseUnparsed(
|
|
1135
|
+
const fallback = parseUnparsed(
|
|
1136
|
+
tokenOrValue.value.fallback,
|
|
1137
|
+
builder,
|
|
1138
|
+
property,
|
|
1139
|
+
allowAuto,
|
|
1140
|
+
);
|
|
977
1141
|
if (fallback !== undefined) {
|
|
978
1142
|
args = [args, fallback];
|
|
979
1143
|
}
|
|
@@ -982,43 +1146,53 @@ export function parseUnparsed(
|
|
|
982
1146
|
}
|
|
983
1147
|
case "function": {
|
|
984
1148
|
switch (tokenOrValue.value.name) {
|
|
985
|
-
case "
|
|
986
|
-
case "rotate":
|
|
987
|
-
case "rotateX":
|
|
988
|
-
case "rotateY":
|
|
989
|
-
case "skewX":
|
|
990
|
-
case "skewY":
|
|
991
|
-
case "scale":
|
|
992
|
-
case "scaleX":
|
|
993
|
-
case "scaleY":
|
|
994
|
-
case "translateX":
|
|
995
|
-
case "translateY":
|
|
996
|
-
tokenOrValue.value.name = `@${tokenOrValue.value.name}`;
|
|
997
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
1149
|
+
case "blur":
|
|
998
1150
|
case "brightness":
|
|
999
1151
|
case "contrast":
|
|
1000
1152
|
case "cubic-bezier":
|
|
1001
1153
|
case "drop-shadow":
|
|
1002
1154
|
case "fontScale":
|
|
1155
|
+
case "getPixelSizeForLayoutSize":
|
|
1003
1156
|
case "grayscale":
|
|
1004
1157
|
case "hsl":
|
|
1005
1158
|
case "hsla":
|
|
1006
1159
|
case "hue-rotate":
|
|
1007
1160
|
case "invert":
|
|
1008
|
-
case "linear-gradient":
|
|
1009
1161
|
case "opacity":
|
|
1010
1162
|
case "pixelScale":
|
|
1011
|
-
case "pixelSizeForLayoutSize":
|
|
1012
1163
|
case "platformColor":
|
|
1013
|
-
case "radial-gradient":
|
|
1014
1164
|
case "rgb":
|
|
1015
1165
|
case "rgba":
|
|
1166
|
+
case "rotate":
|
|
1167
|
+
case "rotateX":
|
|
1168
|
+
case "rotateY":
|
|
1016
1169
|
case "roundToNearestPixel":
|
|
1017
1170
|
case "saturate":
|
|
1171
|
+
case "scale":
|
|
1172
|
+
case "scaleX":
|
|
1173
|
+
case "scaleY":
|
|
1018
1174
|
case "sepia":
|
|
1019
1175
|
case "shadow":
|
|
1176
|
+
case "skewX":
|
|
1177
|
+
case "skewY":
|
|
1020
1178
|
case "steps":
|
|
1021
|
-
|
|
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
|
+
];
|
|
1022
1196
|
case "hairlineWidth":
|
|
1023
1197
|
return [{}, tokenOrValue.value.name, []];
|
|
1024
1198
|
case "calc":
|
|
@@ -1029,9 +1203,10 @@ export function parseUnparsed(
|
|
|
1029
1203
|
tokenOrValue.value.name,
|
|
1030
1204
|
tokenOrValue.value.arguments,
|
|
1031
1205
|
builder,
|
|
1206
|
+
property,
|
|
1032
1207
|
);
|
|
1033
1208
|
default: {
|
|
1034
|
-
builder.addWarning("
|
|
1209
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
1035
1210
|
return;
|
|
1036
1211
|
}
|
|
1037
1212
|
}
|
|
@@ -1050,7 +1225,7 @@ export function parseUnparsed(
|
|
|
1050
1225
|
return;
|
|
1051
1226
|
}
|
|
1052
1227
|
|
|
1053
|
-
if (value === "inherit") {
|
|
1228
|
+
if (value === "inherit" || value === "initial") {
|
|
1054
1229
|
builder.addWarning("value", value);
|
|
1055
1230
|
return;
|
|
1056
1231
|
} else if (value === "currentcolor") {
|
|
@@ -1061,6 +1236,8 @@ export function parseUnparsed(
|
|
|
1061
1236
|
return true;
|
|
1062
1237
|
} else if (value === "false") {
|
|
1063
1238
|
return false;
|
|
1239
|
+
} else if (value === "infinity") {
|
|
1240
|
+
return Number.MAX_SAFE_INTEGER;
|
|
1064
1241
|
} else {
|
|
1065
1242
|
return value;
|
|
1066
1243
|
}
|
|
@@ -1077,11 +1254,16 @@ export function parseUnparsed(
|
|
|
1077
1254
|
return parseDimension(tokenOrValue.value, builder);
|
|
1078
1255
|
case "comma":
|
|
1079
1256
|
return CommaSeparator as unknown as StyleDescriptor;
|
|
1257
|
+
case "delim": {
|
|
1258
|
+
if (tokenOrValue.value.value === "/") {
|
|
1259
|
+
return tokenOrValue.value.value;
|
|
1260
|
+
}
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1080
1263
|
case "at-keyword":
|
|
1081
1264
|
case "hash":
|
|
1082
1265
|
case "id-hash":
|
|
1083
1266
|
case "unquoted-url":
|
|
1084
|
-
case "delim":
|
|
1085
1267
|
case "white-space":
|
|
1086
1268
|
case "comment":
|
|
1087
1269
|
case "colon":
|
|
@@ -1152,23 +1334,35 @@ export function parseLength(
|
|
|
1152
1334
|
const { inlineRem = 14 } = builder.getOptions();
|
|
1153
1335
|
|
|
1154
1336
|
if (typeof length === "number") {
|
|
1155
|
-
return length;
|
|
1337
|
+
return round(length);
|
|
1156
1338
|
}
|
|
1157
1339
|
|
|
1158
1340
|
if ("unit" in length) {
|
|
1159
1341
|
switch (length.unit) {
|
|
1160
|
-
case "px":
|
|
1161
|
-
|
|
1342
|
+
case "px": {
|
|
1343
|
+
if (length.value === Infinity) {
|
|
1344
|
+
return 9999;
|
|
1345
|
+
} else if (length.value === -Infinity) {
|
|
1346
|
+
return -9999;
|
|
1347
|
+
} else {
|
|
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);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1162
1356
|
case "rem":
|
|
1163
1357
|
if (typeof inlineRem === "number") {
|
|
1164
1358
|
return length.value * inlineRem;
|
|
1165
1359
|
} else {
|
|
1166
|
-
return [{}, "rem", length.value];
|
|
1360
|
+
return [{}, "rem", round(length.value)];
|
|
1167
1361
|
}
|
|
1168
1362
|
case "vw":
|
|
1169
1363
|
case "vh":
|
|
1170
1364
|
case "em":
|
|
1171
|
-
return [{}, length.unit, length.value, 1];
|
|
1365
|
+
return [{}, length.unit, round(length.value), 1];
|
|
1172
1366
|
case "in":
|
|
1173
1367
|
case "cm":
|
|
1174
1368
|
case "mm":
|
|
@@ -1251,7 +1445,7 @@ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
|
|
|
1251
1445
|
case "rad":
|
|
1252
1446
|
return `${angle.value}${angle.type}`;
|
|
1253
1447
|
default:
|
|
1254
|
-
builder.addWarning("value", angle.value);
|
|
1448
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
1255
1449
|
return undefined;
|
|
1256
1450
|
}
|
|
1257
1451
|
}
|
|
@@ -1334,7 +1528,7 @@ export function parseSize(
|
|
|
1334
1528
|
return;
|
|
1335
1529
|
}
|
|
1336
1530
|
|
|
1337
|
-
export function
|
|
1531
|
+
export function parseColorOrAutoDeclaration(
|
|
1338
1532
|
{ value }: { value: ColorOrAuto },
|
|
1339
1533
|
builder: StylesheetBuilder,
|
|
1340
1534
|
) {
|
|
@@ -1836,7 +2030,10 @@ export function parseOverflow(
|
|
|
1836
2030
|
}
|
|
1837
2031
|
|
|
1838
2032
|
export function parseBorderStyleDeclaration(
|
|
1839
|
-
declaration:
|
|
2033
|
+
declaration: Extract<
|
|
2034
|
+
DeclarationType<Declaration["property"]>,
|
|
2035
|
+
{ value: LineStyle | BorderStyle }
|
|
2036
|
+
>,
|
|
1840
2037
|
builder: StylesheetBuilder,
|
|
1841
2038
|
) {
|
|
1842
2039
|
return parseBorderStyle(declaration.value, builder);
|
|
@@ -1869,34 +2066,53 @@ export function parseBorderStyle(
|
|
|
1869
2066
|
return undefined;
|
|
1870
2067
|
}
|
|
1871
2068
|
|
|
1872
|
-
export function
|
|
1873
|
-
|
|
2069
|
+
export function parseBorderBlockWidth(
|
|
2070
|
+
declaration: DeclarationType<"border-block-width">,
|
|
1874
2071
|
builder: StylesheetBuilder,
|
|
1875
2072
|
) {
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
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
|
+
}
|
|
1879
2082
|
}
|
|
1880
2083
|
|
|
1881
|
-
|
|
1882
|
-
declaration: DeclarationType<"border-block-
|
|
2084
|
+
function parseBorderBlockStyle(
|
|
2085
|
+
declaration: DeclarationType<"border-block-style">,
|
|
1883
2086
|
builder: StylesheetBuilder,
|
|
1884
2087
|
) {
|
|
1885
|
-
builder
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
)
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
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
|
+
}
|
|
1893
2097
|
}
|
|
1894
2098
|
|
|
1895
2099
|
export function parseBorderSideWidthDeclaration(
|
|
1896
|
-
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
|
+
>,
|
|
1897
2110
|
builder: StylesheetBuilder,
|
|
1898
2111
|
) {
|
|
1899
|
-
|
|
2112
|
+
builder.addDescriptor(
|
|
2113
|
+
declaration.property,
|
|
2114
|
+
parseBorderSideWidth(declaration.value, builder),
|
|
2115
|
+
);
|
|
1900
2116
|
}
|
|
1901
2117
|
|
|
1902
2118
|
export function parseBorderSideWidth(
|
|
@@ -1959,7 +2175,8 @@ export function parseLineHeight(
|
|
|
1959
2175
|
case "percentage":
|
|
1960
2176
|
case "calc":
|
|
1961
2177
|
builder.addWarning(
|
|
1962
|
-
"
|
|
2178
|
+
"style",
|
|
2179
|
+
"line-height",
|
|
1963
2180
|
typeof length.value === "number"
|
|
1964
2181
|
? length.value
|
|
1965
2182
|
: JSON.stringify(length.value),
|
|
@@ -2222,7 +2439,11 @@ export function parseDimension(
|
|
|
2222
2439
|
): StyleDescriptor {
|
|
2223
2440
|
switch (unit) {
|
|
2224
2441
|
case "px":
|
|
2225
|
-
|
|
2442
|
+
if (value === Infinity) {
|
|
2443
|
+
return 9999;
|
|
2444
|
+
} else {
|
|
2445
|
+
return value;
|
|
2446
|
+
}
|
|
2226
2447
|
case "%":
|
|
2227
2448
|
return `${value}%`;
|
|
2228
2449
|
case "rnh":
|
|
@@ -2249,20 +2470,24 @@ export function parseUserSelect(
|
|
|
2249
2470
|
}
|
|
2250
2471
|
|
|
2251
2472
|
export function parseSVGPaint(
|
|
2252
|
-
{ value }: DeclarationType<"fill" | "stroke">,
|
|
2473
|
+
{ value, property }: DeclarationType<"fill" | "stroke">,
|
|
2253
2474
|
builder: StylesheetBuilder,
|
|
2254
2475
|
) {
|
|
2476
|
+
let parsedValue: StyleDescriptor | undefined;
|
|
2477
|
+
|
|
2255
2478
|
if (value.type === "none") {
|
|
2256
|
-
|
|
2479
|
+
parsedValue = "transparent";
|
|
2257
2480
|
} else if (value.type === "color") {
|
|
2258
|
-
|
|
2481
|
+
parsedValue = parseColor(value.value, builder);
|
|
2482
|
+
} else {
|
|
2483
|
+
return;
|
|
2259
2484
|
}
|
|
2260
2485
|
|
|
2261
|
-
|
|
2486
|
+
builder.addDescriptor(property, parsedValue);
|
|
2262
2487
|
}
|
|
2263
2488
|
|
|
2264
2489
|
export function round(number: number) {
|
|
2265
|
-
return Math.round((number + Number.EPSILON) *
|
|
2490
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
2266
2491
|
}
|
|
2267
2492
|
|
|
2268
2493
|
export function parseDimensionPercentageFor_LengthValue(
|
|
@@ -2278,7 +2503,7 @@ export function parseDimensionPercentageFor_LengthValue(
|
|
|
2278
2503
|
}
|
|
2279
2504
|
}
|
|
2280
2505
|
|
|
2281
|
-
const
|
|
2506
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
2282
2507
|
|
|
2283
2508
|
export function parseEnv(
|
|
2284
2509
|
value: EnvironmentVariable,
|
|
@@ -2296,7 +2521,7 @@ export function parseEnv(
|
|
|
2296
2521
|
"var",
|
|
2297
2522
|
[
|
|
2298
2523
|
`--react-native-css-${value.name.value}`,
|
|
2299
|
-
parseUnparsed(value.fallback, builder),
|
|
2524
|
+
parseUnparsed(value.fallback, builder, value.name.value),
|
|
2300
2525
|
],
|
|
2301
2526
|
1,
|
|
2302
2527
|
];
|
|
@@ -2319,8 +2544,9 @@ export function parseCalcFn(
|
|
|
2319
2544
|
name: string,
|
|
2320
2545
|
tokens: TokenOrValue[],
|
|
2321
2546
|
builder: StylesheetBuilder,
|
|
2547
|
+
property: string,
|
|
2322
2548
|
): StyleDescriptor {
|
|
2323
|
-
const args = parseCalcArguments(tokens, builder);
|
|
2549
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
2324
2550
|
if (args) {
|
|
2325
2551
|
return [{}, name, args];
|
|
2326
2552
|
}
|
|
@@ -2331,12 +2557,11 @@ export function parseCalcFn(
|
|
|
2331
2557
|
export function parseCalcArguments(
|
|
2332
2558
|
[...args]: TokenOrValue[],
|
|
2333
2559
|
builder: StylesheetBuilder,
|
|
2560
|
+
property: string,
|
|
2334
2561
|
) {
|
|
2335
2562
|
const parsed: StyleDescriptor[] = [];
|
|
2336
2563
|
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
for (const [currentIndex, arg] of args.entries()) {
|
|
2564
|
+
for (const arg of args) {
|
|
2340
2565
|
switch (arg.type) {
|
|
2341
2566
|
case "env": {
|
|
2342
2567
|
parsed.push(parseEnv(arg.value, builder));
|
|
@@ -2345,7 +2570,7 @@ export function parseCalcArguments(
|
|
|
2345
2570
|
case "var":
|
|
2346
2571
|
case "function":
|
|
2347
2572
|
case "unresolved-color": {
|
|
2348
|
-
const value = parseUnparsed(arg, builder);
|
|
2573
|
+
const value = parseUnparsed(arg, builder, property);
|
|
2349
2574
|
|
|
2350
2575
|
if (value === undefined) {
|
|
2351
2576
|
return undefined;
|
|
@@ -2356,11 +2581,9 @@ export function parseCalcArguments(
|
|
|
2356
2581
|
}
|
|
2357
2582
|
case "length": {
|
|
2358
2583
|
const value = parseLength(arg.value, builder);
|
|
2359
|
-
|
|
2360
2584
|
if (value !== undefined) {
|
|
2361
2585
|
parsed.push(value);
|
|
2362
2586
|
}
|
|
2363
|
-
|
|
2364
2587
|
break;
|
|
2365
2588
|
}
|
|
2366
2589
|
case "color":
|
|
@@ -2383,49 +2606,19 @@ export function parseCalcArguments(
|
|
|
2383
2606
|
}
|
|
2384
2607
|
break;
|
|
2385
2608
|
case "percentage":
|
|
2386
|
-
|
|
2387
|
-
if (mode !== "percentage") return;
|
|
2388
|
-
parsed.push(`${arg.value.value * 100}%`);
|
|
2609
|
+
parsed.push(`${round(arg.value.value * 100)}%`);
|
|
2389
2610
|
break;
|
|
2390
2611
|
case "number": {
|
|
2391
|
-
|
|
2392
|
-
if (mode !== "number") return;
|
|
2393
|
-
parsed.push(arg.value.value);
|
|
2612
|
+
parsed.push(round(arg.value.value));
|
|
2394
2613
|
break;
|
|
2395
2614
|
}
|
|
2396
2615
|
case "parenthesis-block": {
|
|
2397
|
-
|
|
2398
|
-
* If we have a parenthesis block, we just treat it as a nested calc function
|
|
2399
|
-
* Because there could be multiple parenthesis blocks, this is recursive
|
|
2400
|
-
*/
|
|
2401
|
-
let closeParenthesisIndex = -1;
|
|
2402
|
-
for (let index = args.length - 1; index > 0; index--) {
|
|
2403
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
2404
|
-
const value = args[index]!;
|
|
2405
|
-
if (
|
|
2406
|
-
value.type === "token" &&
|
|
2407
|
-
value.value.type === "close-parenthesis"
|
|
2408
|
-
) {
|
|
2409
|
-
closeParenthesisIndex = index;
|
|
2410
|
-
break;
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
|
|
2414
|
-
if (closeParenthesisIndex === -1) {
|
|
2415
|
-
return;
|
|
2416
|
-
}
|
|
2417
|
-
|
|
2418
|
-
const innerCalcArgs = args
|
|
2419
|
-
// Extract the inner calcArgs including the parenthesis. This mutates args
|
|
2420
|
-
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
2421
|
-
// Then drop the surrounding parenthesis
|
|
2422
|
-
.slice(1, -1);
|
|
2423
|
-
|
|
2424
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
2425
|
-
|
|
2616
|
+
parsed.push("(");
|
|
2426
2617
|
break;
|
|
2427
2618
|
}
|
|
2428
2619
|
case "close-parenthesis":
|
|
2620
|
+
parsed.push(")");
|
|
2621
|
+
break;
|
|
2429
2622
|
case "string":
|
|
2430
2623
|
case "function":
|
|
2431
2624
|
case "ident":
|
|
@@ -2474,6 +2667,8 @@ export function parseTranslateProp(
|
|
|
2474
2667
|
export function parseUnresolvedColor(
|
|
2475
2668
|
color: UnresolvedColor,
|
|
2476
2669
|
builder: StylesheetBuilder,
|
|
2670
|
+
property: string,
|
|
2671
|
+
allowAuto: boolean,
|
|
2477
2672
|
): StyleDescriptor {
|
|
2478
2673
|
switch (color.type) {
|
|
2479
2674
|
case "rgb":
|
|
@@ -2484,26 +2679,31 @@ export function parseUnresolvedColor(
|
|
|
2484
2679
|
round(color.r * 255),
|
|
2485
2680
|
round(color.g * 255),
|
|
2486
2681
|
round(color.b * 255),
|
|
2487
|
-
parseUnparsed(color.alpha, builder),
|
|
2682
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2488
2683
|
],
|
|
2489
2684
|
];
|
|
2490
2685
|
case "hsl":
|
|
2491
2686
|
return [
|
|
2492
2687
|
{},
|
|
2493
2688
|
color.type,
|
|
2494
|
-
[
|
|
2689
|
+
[
|
|
2690
|
+
color.h,
|
|
2691
|
+
color.s,
|
|
2692
|
+
color.l,
|
|
2693
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2694
|
+
],
|
|
2495
2695
|
];
|
|
2496
2696
|
case "light-dark": {
|
|
2497
2697
|
const extraRule = builder.extendRule({
|
|
2498
2698
|
m: [["=", "prefers-color-scheme", "dark"]],
|
|
2499
2699
|
});
|
|
2500
2700
|
builder.addUnnamedDescriptor(
|
|
2501
|
-
reduceParseUnparsed(color.dark, builder),
|
|
2701
|
+
reduceParseUnparsed(color.dark, builder, property, allowAuto),
|
|
2502
2702
|
false,
|
|
2503
2703
|
extraRule,
|
|
2504
2704
|
);
|
|
2505
2705
|
builder.addExtraRule(extraRule);
|
|
2506
|
-
return reduceParseUnparsed(color.light, builder);
|
|
2706
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
2507
2707
|
}
|
|
2508
2708
|
default:
|
|
2509
2709
|
color satisfies never;
|
|
@@ -2600,7 +2800,12 @@ export function addTransitionValue(
|
|
|
2600
2800
|
declaration.property,
|
|
2601
2801
|
declaration.value
|
|
2602
2802
|
.map((v) => v.property)
|
|
2603
|
-
.filter(
|
|
2803
|
+
.filter(
|
|
2804
|
+
(v) =>
|
|
2805
|
+
(v in parsers && !["visibility"].includes(v)) ||
|
|
2806
|
+
v === "all" ||
|
|
2807
|
+
v === "none",
|
|
2808
|
+
)
|
|
2604
2809
|
.map((v) => toRNProperty(v)),
|
|
2605
2810
|
);
|
|
2606
2811
|
return;
|
|
@@ -2749,7 +2954,7 @@ function parseGradient(
|
|
|
2749
2954
|
case "linear": {
|
|
2750
2955
|
return [
|
|
2751
2956
|
{},
|
|
2752
|
-
"
|
|
2957
|
+
"linear-gradient",
|
|
2753
2958
|
[
|
|
2754
2959
|
parseLineDirection(gradient.direction, builder),
|
|
2755
2960
|
...gradient.items.map((item) => parseGradientItem(item, builder)),
|
|
@@ -2799,6 +3004,46 @@ function parseGradientItem(
|
|
|
2799
3004
|
}
|
|
2800
3005
|
}
|
|
2801
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
|
+
|
|
2802
3047
|
function parseFilter(
|
|
2803
3048
|
declaration: DeclarationType<"filter">,
|
|
2804
3049
|
builder: StylesheetBuilder,
|
|
@@ -2826,6 +3071,16 @@ function parseFilter(
|
|
|
2826
3071
|
[value.type]: parseAngle(value.value, builder),
|
|
2827
3072
|
} as unknown as StyleDescriptor;
|
|
2828
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;
|
|
2829
3084
|
case "url":
|
|
2830
3085
|
return;
|
|
2831
3086
|
}
|