react-native-css 3.0.0-nightly.61014be → 3.0.0-nightly.8dd703d
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/attributes.test.js +1 -1
- package/dist/commonjs/compiler/attributes.test.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +26 -17
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +195 -94
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +7 -7
- 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/selector-builder.js +457 -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 +122 -43
- package/dist/commonjs/compiler/stylesheet.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 +10 -46
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +19 -17
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +3 -2
- 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 +9 -9
- 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 +56 -48
- 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/{calc.js → functions/calc.js} +1 -1
- 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 +83 -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/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 +25 -5
- 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/attributes.test.js +1 -1
- package/dist/module/compiler/attributes.test.js.map +1 -1
- package/dist/module/compiler/compiler.js +26 -17
- 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 +190 -90
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +7 -7
- 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/selector-builder.js +452 -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 +121 -42
- package/dist/module/compiler/stylesheet.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 +10 -46
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +19 -17
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/injection.js +2 -1
- 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 +9 -9
- 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 +57 -49
- 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/{calc.js → functions/calc.js} +1 -1
- 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 +76 -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/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 +25 -5
- 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 +5 -4
- 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/selector-builder.d.ts +23 -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/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/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.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 +5 -4
- 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/selector-builder.d.ts +23 -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/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/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.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 +4 -3
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/attributes.test.ts +1 -1
- package/src/compiler/compiler.ts +30 -31
- package/src/compiler/compiler.types.ts +7 -5
- package/src/compiler/declarations.ts +351 -114
- package/src/compiler/inheritance.test.ts +6 -6
- package/src/compiler/keyframes.ts +1 -1
- package/src/compiler/selector-builder.ts +531 -0
- package/src/compiler/selectors.ts +20 -6
- package/src/compiler/stylesheet.ts +168 -48
- 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 +12 -66
- package/src/runtime/native/conditions/media-query.ts +20 -20
- package/src/runtime/native/injection.ts +1 -1
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +9 -9
- 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 +61 -50
- 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/{calc.ts → functions/calc.ts} +2 -2
- 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 +51 -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} +1 -1
- package/src/runtime/native/styles/units.ts +8 -4
- package/src/runtime/native/styles/variables.ts +2 -6
- package/src/runtime/utils/objects.ts +24 -3
- package/src/runtime/utils/specificity.ts +1 -0
- 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.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/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.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/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/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/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +0 -0
- /package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +0 -0
|
@@ -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
|
}
|
|
@@ -992,8 +1130,8 @@ export function parseUnparsed(
|
|
|
992
1130
|
case "scaleY":
|
|
993
1131
|
case "translateX":
|
|
994
1132
|
case "translateY":
|
|
995
|
-
tokenOrValue
|
|
996
|
-
|
|
1133
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
1134
|
+
case "blur":
|
|
997
1135
|
case "brightness":
|
|
998
1136
|
case "contrast":
|
|
999
1137
|
case "cubic-bezier":
|
|
@@ -1007,7 +1145,7 @@ export function parseUnparsed(
|
|
|
1007
1145
|
case "linear-gradient":
|
|
1008
1146
|
case "opacity":
|
|
1009
1147
|
case "pixelScale":
|
|
1010
|
-
case "
|
|
1148
|
+
case "getPixelSizeForLayoutSize":
|
|
1011
1149
|
case "platformColor":
|
|
1012
1150
|
case "radial-gradient":
|
|
1013
1151
|
case "rgb":
|
|
@@ -1017,7 +1155,7 @@ export function parseUnparsed(
|
|
|
1017
1155
|
case "sepia":
|
|
1018
1156
|
case "shadow":
|
|
1019
1157
|
case "steps":
|
|
1020
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
1158
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
1021
1159
|
case "hairlineWidth":
|
|
1022
1160
|
return [{}, tokenOrValue.value.name, []];
|
|
1023
1161
|
case "calc":
|
|
@@ -1028,9 +1166,10 @@ export function parseUnparsed(
|
|
|
1028
1166
|
tokenOrValue.value.name,
|
|
1029
1167
|
tokenOrValue.value.arguments,
|
|
1030
1168
|
builder,
|
|
1169
|
+
property,
|
|
1031
1170
|
);
|
|
1032
1171
|
default: {
|
|
1033
|
-
builder.addWarning("
|
|
1172
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
1034
1173
|
return;
|
|
1035
1174
|
}
|
|
1036
1175
|
}
|
|
@@ -1060,6 +1199,8 @@ export function parseUnparsed(
|
|
|
1060
1199
|
return true;
|
|
1061
1200
|
} else if (value === "false") {
|
|
1062
1201
|
return false;
|
|
1202
|
+
} else if (value === "infinity") {
|
|
1203
|
+
return Number.MAX_SAFE_INTEGER;
|
|
1063
1204
|
} else {
|
|
1064
1205
|
return value;
|
|
1065
1206
|
}
|
|
@@ -1076,11 +1217,16 @@ export function parseUnparsed(
|
|
|
1076
1217
|
return parseDimension(tokenOrValue.value, builder);
|
|
1077
1218
|
case "comma":
|
|
1078
1219
|
return CommaSeparator as unknown as StyleDescriptor;
|
|
1220
|
+
case "delim": {
|
|
1221
|
+
if (tokenOrValue.value.value === "/") {
|
|
1222
|
+
return tokenOrValue.value.value;
|
|
1223
|
+
}
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1079
1226
|
case "at-keyword":
|
|
1080
1227
|
case "hash":
|
|
1081
1228
|
case "id-hash":
|
|
1082
1229
|
case "unquoted-url":
|
|
1083
|
-
case "delim":
|
|
1084
1230
|
case "white-space":
|
|
1085
1231
|
case "comment":
|
|
1086
1232
|
case "colon":
|
|
@@ -1151,23 +1297,35 @@ export function parseLength(
|
|
|
1151
1297
|
const { inlineRem = 14 } = builder.getOptions();
|
|
1152
1298
|
|
|
1153
1299
|
if (typeof length === "number") {
|
|
1154
|
-
return length;
|
|
1300
|
+
return round(length);
|
|
1155
1301
|
}
|
|
1156
1302
|
|
|
1157
1303
|
if ("unit" in length) {
|
|
1158
1304
|
switch (length.unit) {
|
|
1159
|
-
case "px":
|
|
1160
|
-
|
|
1305
|
+
case "px": {
|
|
1306
|
+
if (length.value === Infinity) {
|
|
1307
|
+
return 9999;
|
|
1308
|
+
} else if (length.value === -Infinity) {
|
|
1309
|
+
return -9999;
|
|
1310
|
+
} else {
|
|
1311
|
+
// Normalize large values to safe integers, e.g. `calc(infinity * 1px)`
|
|
1312
|
+
const value = Math.max(
|
|
1313
|
+
Math.min(length.value, Number.MAX_SAFE_INTEGER),
|
|
1314
|
+
Number.MIN_SAFE_INTEGER,
|
|
1315
|
+
);
|
|
1316
|
+
return round(value);
|
|
1317
|
+
}
|
|
1318
|
+
}
|
|
1161
1319
|
case "rem":
|
|
1162
1320
|
if (typeof inlineRem === "number") {
|
|
1163
1321
|
return length.value * inlineRem;
|
|
1164
1322
|
} else {
|
|
1165
|
-
return [{}, "rem", length.value];
|
|
1323
|
+
return [{}, "rem", round(length.value)];
|
|
1166
1324
|
}
|
|
1167
1325
|
case "vw":
|
|
1168
1326
|
case "vh":
|
|
1169
1327
|
case "em":
|
|
1170
|
-
return [{}, length.unit, length.value, 1];
|
|
1328
|
+
return [{}, length.unit, round(length.value), 1];
|
|
1171
1329
|
case "in":
|
|
1172
1330
|
case "cm":
|
|
1173
1331
|
case "mm":
|
|
@@ -1250,7 +1408,7 @@ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
|
|
|
1250
1408
|
case "rad":
|
|
1251
1409
|
return `${angle.value}${angle.type}`;
|
|
1252
1410
|
default:
|
|
1253
|
-
builder.addWarning("value", angle.value);
|
|
1411
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
1254
1412
|
return undefined;
|
|
1255
1413
|
}
|
|
1256
1414
|
}
|
|
@@ -1333,7 +1491,7 @@ export function parseSize(
|
|
|
1333
1491
|
return;
|
|
1334
1492
|
}
|
|
1335
1493
|
|
|
1336
|
-
export function
|
|
1494
|
+
export function parseColorOrAutoDeclaration(
|
|
1337
1495
|
{ value }: { value: ColorOrAuto },
|
|
1338
1496
|
builder: StylesheetBuilder,
|
|
1339
1497
|
) {
|
|
@@ -1835,7 +1993,13 @@ export function parseOverflow(
|
|
|
1835
1993
|
}
|
|
1836
1994
|
|
|
1837
1995
|
export function parseBorderStyleDeclaration(
|
|
1838
|
-
declaration: DeclarationType<
|
|
1996
|
+
declaration: DeclarationType<
|
|
1997
|
+
| "border-style"
|
|
1998
|
+
| "border-left-style"
|
|
1999
|
+
| "border-right-style"
|
|
2000
|
+
| "border-top-style"
|
|
2001
|
+
| "border-bottom-style"
|
|
2002
|
+
>,
|
|
1839
2003
|
builder: StylesheetBuilder,
|
|
1840
2004
|
) {
|
|
1841
2005
|
return parseBorderStyle(declaration.value, builder);
|
|
@@ -1868,17 +2032,8 @@ export function parseBorderStyle(
|
|
|
1868
2032
|
return undefined;
|
|
1869
2033
|
}
|
|
1870
2034
|
|
|
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
2035
|
export function parseBorderBlockWidth(
|
|
1881
|
-
declaration: DeclarationType<"border-block-width"
|
|
2036
|
+
declaration: DeclarationType<"border-block-width">,
|
|
1882
2037
|
builder: StylesheetBuilder,
|
|
1883
2038
|
) {
|
|
1884
2039
|
builder.addDescriptor(
|
|
@@ -1891,11 +2046,48 @@ export function parseBorderBlockWidth(
|
|
|
1891
2046
|
);
|
|
1892
2047
|
}
|
|
1893
2048
|
|
|
2049
|
+
function parseBorderBlockStyle(
|
|
2050
|
+
declaration: DeclarationType<"border-block-style">,
|
|
2051
|
+
builder: StylesheetBuilder,
|
|
2052
|
+
) {
|
|
2053
|
+
if (declaration.value.start === declaration.value.end) {
|
|
2054
|
+
builder.addDescriptor(
|
|
2055
|
+
"border-style",
|
|
2056
|
+
parseBorderStyle(declaration.value.start, builder),
|
|
2057
|
+
);
|
|
2058
|
+
} else {
|
|
2059
|
+
builder.addWarning("property", "border-block-style");
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
|
|
1894
2063
|
export function parseBorderSideWidthDeclaration(
|
|
1895
|
-
declaration:
|
|
2064
|
+
declaration: DeclarationType<
|
|
2065
|
+
| "border-block-end-width"
|
|
2066
|
+
| "border-block-start-width"
|
|
2067
|
+
| "border-bottom-width"
|
|
2068
|
+
| "border-inline-end-width"
|
|
2069
|
+
| "border-inline-start-width"
|
|
2070
|
+
| "border-left-width"
|
|
2071
|
+
| "border-right-width"
|
|
2072
|
+
| "border-top-width"
|
|
2073
|
+
>,
|
|
1896
2074
|
builder: StylesheetBuilder,
|
|
1897
2075
|
) {
|
|
1898
|
-
|
|
2076
|
+
if (declaration.property.includes("block")) {
|
|
2077
|
+
builder.addDescriptor(
|
|
2078
|
+
`border-${declaration.property.includes("start") ? "top" : "bottom"}-width`,
|
|
2079
|
+
parseBorderSideWidth(declaration.value, builder),
|
|
2080
|
+
);
|
|
2081
|
+
return;
|
|
2082
|
+
} else if (declaration.property.includes("inline")) {
|
|
2083
|
+
builder.addDescriptor(
|
|
2084
|
+
`border-${declaration.property.includes("start") ? "left" : "right"}-width`,
|
|
2085
|
+
parseBorderSideWidth(declaration.value, builder),
|
|
2086
|
+
);
|
|
2087
|
+
return;
|
|
2088
|
+
} else {
|
|
2089
|
+
return parseBorderSideWidth(declaration.value, builder);
|
|
2090
|
+
}
|
|
1899
2091
|
}
|
|
1900
2092
|
|
|
1901
2093
|
export function parseBorderSideWidth(
|
|
@@ -1958,7 +2150,8 @@ export function parseLineHeight(
|
|
|
1958
2150
|
case "percentage":
|
|
1959
2151
|
case "calc":
|
|
1960
2152
|
builder.addWarning(
|
|
1961
|
-
"
|
|
2153
|
+
"style",
|
|
2154
|
+
"line-height",
|
|
1962
2155
|
typeof length.value === "number"
|
|
1963
2156
|
? length.value
|
|
1964
2157
|
: JSON.stringify(length.value),
|
|
@@ -2065,8 +2258,14 @@ export function parseGap(
|
|
|
2065
2258
|
builder: StylesheetBuilder,
|
|
2066
2259
|
) {
|
|
2067
2260
|
if ("column" in declaration.value) {
|
|
2068
|
-
builder.addDescriptor(
|
|
2069
|
-
|
|
2261
|
+
builder.addDescriptor(
|
|
2262
|
+
"row-gap",
|
|
2263
|
+
parseGapValue(declaration.value.row, builder),
|
|
2264
|
+
);
|
|
2265
|
+
builder.addDescriptor(
|
|
2266
|
+
"column-gap",
|
|
2267
|
+
parseGapValue(declaration.value.column, builder),
|
|
2268
|
+
);
|
|
2070
2269
|
|
|
2071
2270
|
return;
|
|
2072
2271
|
} else {
|
|
@@ -2079,6 +2278,17 @@ export function parseGap(
|
|
|
2079
2278
|
}
|
|
2080
2279
|
}
|
|
2081
2280
|
|
|
2281
|
+
function parseGapValue(
|
|
2282
|
+
value: GapValue,
|
|
2283
|
+
builder: StylesheetBuilder,
|
|
2284
|
+
): StyleDescriptor {
|
|
2285
|
+
if (value.type === "normal") {
|
|
2286
|
+
return;
|
|
2287
|
+
} else {
|
|
2288
|
+
return parseLength(value.value, builder);
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
|
|
2082
2292
|
export function parseTextAlign(
|
|
2083
2293
|
{ value }: DeclarationType<"text-align">,
|
|
2084
2294
|
builder: StylesheetBuilder,
|
|
@@ -2204,7 +2414,11 @@ export function parseDimension(
|
|
|
2204
2414
|
): StyleDescriptor {
|
|
2205
2415
|
switch (unit) {
|
|
2206
2416
|
case "px":
|
|
2207
|
-
|
|
2417
|
+
if (value === Infinity) {
|
|
2418
|
+
return 9999;
|
|
2419
|
+
} else {
|
|
2420
|
+
return value;
|
|
2421
|
+
}
|
|
2208
2422
|
case "%":
|
|
2209
2423
|
return `${value}%`;
|
|
2210
2424
|
case "rnh":
|
|
@@ -2231,20 +2445,24 @@ export function parseUserSelect(
|
|
|
2231
2445
|
}
|
|
2232
2446
|
|
|
2233
2447
|
export function parseSVGPaint(
|
|
2234
|
-
{ value }: DeclarationType<"fill" | "stroke">,
|
|
2448
|
+
{ value, property }: DeclarationType<"fill" | "stroke">,
|
|
2235
2449
|
builder: StylesheetBuilder,
|
|
2236
2450
|
) {
|
|
2451
|
+
let parsedValue: StyleDescriptor | undefined;
|
|
2452
|
+
|
|
2237
2453
|
if (value.type === "none") {
|
|
2238
|
-
|
|
2454
|
+
parsedValue = "transparent";
|
|
2239
2455
|
} else if (value.type === "color") {
|
|
2240
|
-
|
|
2456
|
+
parsedValue = parseColor(value.value, builder);
|
|
2457
|
+
} else {
|
|
2458
|
+
return;
|
|
2241
2459
|
}
|
|
2242
2460
|
|
|
2243
|
-
|
|
2461
|
+
builder.addDescriptor(property, parsedValue);
|
|
2244
2462
|
}
|
|
2245
2463
|
|
|
2246
2464
|
export function round(number: number) {
|
|
2247
|
-
return Math.round((number + Number.EPSILON) *
|
|
2465
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
2248
2466
|
}
|
|
2249
2467
|
|
|
2250
2468
|
export function parseDimensionPercentageFor_LengthValue(
|
|
@@ -2260,7 +2478,7 @@ export function parseDimensionPercentageFor_LengthValue(
|
|
|
2260
2478
|
}
|
|
2261
2479
|
}
|
|
2262
2480
|
|
|
2263
|
-
const
|
|
2481
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
2264
2482
|
|
|
2265
2483
|
export function parseEnv(
|
|
2266
2484
|
value: EnvironmentVariable,
|
|
@@ -2278,7 +2496,7 @@ export function parseEnv(
|
|
|
2278
2496
|
"var",
|
|
2279
2497
|
[
|
|
2280
2498
|
`--react-native-css-${value.name.value}`,
|
|
2281
|
-
parseUnparsed(value.fallback, builder),
|
|
2499
|
+
parseUnparsed(value.fallback, builder, value.name.value),
|
|
2282
2500
|
],
|
|
2283
2501
|
1,
|
|
2284
2502
|
];
|
|
@@ -2301,8 +2519,9 @@ export function parseCalcFn(
|
|
|
2301
2519
|
name: string,
|
|
2302
2520
|
tokens: TokenOrValue[],
|
|
2303
2521
|
builder: StylesheetBuilder,
|
|
2522
|
+
property: string,
|
|
2304
2523
|
): StyleDescriptor {
|
|
2305
|
-
const args = parseCalcArguments(tokens, builder);
|
|
2524
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
2306
2525
|
if (args) {
|
|
2307
2526
|
return [{}, name, args];
|
|
2308
2527
|
}
|
|
@@ -2313,6 +2532,7 @@ export function parseCalcFn(
|
|
|
2313
2532
|
export function parseCalcArguments(
|
|
2314
2533
|
[...args]: TokenOrValue[],
|
|
2315
2534
|
builder: StylesheetBuilder,
|
|
2535
|
+
property: string,
|
|
2316
2536
|
) {
|
|
2317
2537
|
const parsed: StyleDescriptor[] = [];
|
|
2318
2538
|
|
|
@@ -2327,7 +2547,7 @@ export function parseCalcArguments(
|
|
|
2327
2547
|
case "var":
|
|
2328
2548
|
case "function":
|
|
2329
2549
|
case "unresolved-color": {
|
|
2330
|
-
const value = parseUnparsed(arg, builder);
|
|
2550
|
+
const value = parseUnparsed(arg, builder, property);
|
|
2331
2551
|
|
|
2332
2552
|
if (value === undefined) {
|
|
2333
2553
|
return undefined;
|
|
@@ -2403,7 +2623,7 @@ export function parseCalcArguments(
|
|
|
2403
2623
|
// Then drop the surrounding parenthesis
|
|
2404
2624
|
.slice(1, -1);
|
|
2405
2625
|
|
|
2406
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
2626
|
+
parsed.push(parseCalcFn("calc", innerCalcArgs, builder, property));
|
|
2407
2627
|
|
|
2408
2628
|
break;
|
|
2409
2629
|
}
|
|
@@ -2456,6 +2676,8 @@ export function parseTranslateProp(
|
|
|
2456
2676
|
export function parseUnresolvedColor(
|
|
2457
2677
|
color: UnresolvedColor,
|
|
2458
2678
|
builder: StylesheetBuilder,
|
|
2679
|
+
property: string,
|
|
2680
|
+
allowAuto: boolean,
|
|
2459
2681
|
): StyleDescriptor {
|
|
2460
2682
|
switch (color.type) {
|
|
2461
2683
|
case "rgb":
|
|
@@ -2466,26 +2688,31 @@ export function parseUnresolvedColor(
|
|
|
2466
2688
|
round(color.r * 255),
|
|
2467
2689
|
round(color.g * 255),
|
|
2468
2690
|
round(color.b * 255),
|
|
2469
|
-
parseUnparsed(color.alpha, builder),
|
|
2691
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2470
2692
|
],
|
|
2471
2693
|
];
|
|
2472
2694
|
case "hsl":
|
|
2473
2695
|
return [
|
|
2474
2696
|
{},
|
|
2475
2697
|
color.type,
|
|
2476
|
-
[
|
|
2698
|
+
[
|
|
2699
|
+
color.h,
|
|
2700
|
+
color.s,
|
|
2701
|
+
color.l,
|
|
2702
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2703
|
+
],
|
|
2477
2704
|
];
|
|
2478
2705
|
case "light-dark": {
|
|
2479
2706
|
const extraRule = builder.extendRule({
|
|
2480
2707
|
m: [["=", "prefers-color-scheme", "dark"]],
|
|
2481
2708
|
});
|
|
2482
2709
|
builder.addUnnamedDescriptor(
|
|
2483
|
-
reduceParseUnparsed(color.dark, builder),
|
|
2710
|
+
reduceParseUnparsed(color.dark, builder, property, allowAuto),
|
|
2484
2711
|
false,
|
|
2485
2712
|
extraRule,
|
|
2486
2713
|
);
|
|
2487
2714
|
builder.addExtraRule(extraRule);
|
|
2488
|
-
return reduceParseUnparsed(color.light, builder);
|
|
2715
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
2489
2716
|
}
|
|
2490
2717
|
default:
|
|
2491
2718
|
color satisfies never;
|
|
@@ -2731,7 +2958,7 @@ function parseGradient(
|
|
|
2731
2958
|
case "linear": {
|
|
2732
2959
|
return [
|
|
2733
2960
|
{},
|
|
2734
|
-
"
|
|
2961
|
+
"linear-gradient",
|
|
2735
2962
|
[
|
|
2736
2963
|
parseLineDirection(gradient.direction, builder),
|
|
2737
2964
|
...gradient.items.map((item) => parseGradientItem(item, builder)),
|
|
@@ -2808,6 +3035,16 @@ function parseFilter(
|
|
|
2808
3035
|
[value.type]: parseAngle(value.value, builder),
|
|
2809
3036
|
} as unknown as StyleDescriptor;
|
|
2810
3037
|
case "drop-shadow":
|
|
3038
|
+
return [
|
|
3039
|
+
{},
|
|
3040
|
+
toRNProperty(value.type),
|
|
3041
|
+
[
|
|
3042
|
+
parseLength(value.value.xOffset, builder),
|
|
3043
|
+
parseLength(value.value.yOffset, builder),
|
|
3044
|
+
parseLength(value.value.blur, builder),
|
|
3045
|
+
parseColor(value.value.color, builder),
|
|
3046
|
+
],
|
|
3047
|
+
] as unknown as StyleDescriptor;
|
|
2811
3048
|
case "url":
|
|
2812
3049
|
return;
|
|
2813
3050
|
}
|