react-native-css 3.0.0-nightly.75f8b74 → 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 +186 -92
- 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 +27 -9
- 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 +181 -88
- 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 +26 -8
- 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 +19 -2
- 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 +19 -2
- 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 +3 -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 +331 -112
- 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 +32 -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,
|
|
@@ -63,12 +62,16 @@ const propertyRename: Record<string, string> = {
|
|
|
63
62
|
"background-image": "experimental_backgroundImage",
|
|
64
63
|
};
|
|
65
64
|
|
|
65
|
+
// TODO: We need a better way to handle this
|
|
66
66
|
const unparsedRuntimeParsing = new Set([
|
|
67
67
|
"animation",
|
|
68
|
+
"border",
|
|
69
|
+
"box-shadow",
|
|
68
70
|
"text-shadow",
|
|
69
71
|
"transform",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
+
"scale",
|
|
73
|
+
"rotate",
|
|
74
|
+
"translate",
|
|
72
75
|
]);
|
|
73
76
|
|
|
74
77
|
const parsers: {
|
|
@@ -92,37 +95,44 @@ const parsers: {
|
|
|
92
95
|
"block-size": parseSizeDeclaration,
|
|
93
96
|
"border": parseBorder,
|
|
94
97
|
"border-block": parseBorderBlock,
|
|
95
|
-
"border-block-color":
|
|
98
|
+
"border-block-color": parseBorderColor,
|
|
96
99
|
"border-block-end": parseBorderBlockEnd,
|
|
97
100
|
"border-block-end-color": parseColorDeclaration,
|
|
98
101
|
"border-block-end-width": parseBorderSideWidthDeclaration,
|
|
99
102
|
"border-block-start": parseBorderBlockStart,
|
|
100
103
|
"border-block-start-color": parseColorDeclaration,
|
|
101
104
|
"border-block-start-width": parseBorderSideWidthDeclaration,
|
|
105
|
+
"border-block-style": parseBorderBlockStyle,
|
|
102
106
|
"border-block-width": parseBorderBlockWidth,
|
|
103
107
|
"border-bottom": parseBorderSide,
|
|
104
108
|
"border-bottom-color": parseColorDeclaration,
|
|
105
109
|
"border-bottom-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
106
110
|
"border-bottom-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
111
|
+
"border-bottom-style": parseBorderStyleDeclaration,
|
|
107
112
|
"border-bottom-width": parseBorderSideWidthDeclaration,
|
|
108
113
|
"border-color": parseBorderColor,
|
|
109
114
|
"border-end-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
110
115
|
"border-end-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
111
116
|
"border-inline": parseBorderInline,
|
|
112
|
-
"border-inline-color":
|
|
117
|
+
"border-inline-color": parseBorderColor,
|
|
113
118
|
"border-inline-end": parseBorderInlineEnd,
|
|
114
119
|
"border-inline-end-color": parseColorDeclaration,
|
|
120
|
+
"border-inline-end-style": parseBorderInlineStyle,
|
|
115
121
|
"border-inline-end-width": parseBorderSideWidthDeclaration,
|
|
116
122
|
"border-inline-start": parseBorderInlineStart,
|
|
117
123
|
"border-inline-start-color": parseColorDeclaration,
|
|
124
|
+
"border-inline-start-style": parseBorderInlineStyle,
|
|
118
125
|
"border-inline-start-width": parseBorderSideWidthDeclaration,
|
|
119
|
-
"border-inline-
|
|
126
|
+
"border-inline-style": parseBorderInlineStyle,
|
|
127
|
+
"border-inline-width": parseBorderInlineWidth,
|
|
120
128
|
"border-left": parseBorderSide,
|
|
121
129
|
"border-left-color": parseColorDeclaration,
|
|
130
|
+
"border-left-style": parseBorderStyleDeclaration,
|
|
122
131
|
"border-left-width": parseBorderSideWidthDeclaration,
|
|
123
132
|
"border-radius": parseBorderRadius,
|
|
124
133
|
"border-right": parseBorderSide,
|
|
125
134
|
"border-right-color": parseColorDeclaration,
|
|
135
|
+
"border-right-style": parseBorderStyleDeclaration,
|
|
126
136
|
"border-right-width": parseBorderSideWidthDeclaration,
|
|
127
137
|
"border-start-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
128
138
|
"border-start-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
@@ -131,11 +141,12 @@ const parsers: {
|
|
|
131
141
|
"border-top-color": parseColorDeclaration,
|
|
132
142
|
"border-top-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
133
143
|
"border-top-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
144
|
+
"border-top-style": parseBorderStyleDeclaration,
|
|
134
145
|
"border-top-width": parseBorderSideWidthDeclaration,
|
|
135
146
|
"border-width": parseBorderWidth,
|
|
136
147
|
"bottom": parseSizeDeclaration,
|
|
137
148
|
"box-shadow": parseBoxShadow,
|
|
138
|
-
"caret-color":
|
|
149
|
+
"caret-color": parseColorOrAutoDeclaration,
|
|
139
150
|
"color": parseFontColorDeclaration,
|
|
140
151
|
"column-gap": parseGap,
|
|
141
152
|
"container": parseContainer,
|
|
@@ -256,9 +267,9 @@ export function parseDeclaration(
|
|
|
256
267
|
}
|
|
257
268
|
|
|
258
269
|
if (declaration.property === "unparsed") {
|
|
259
|
-
|
|
270
|
+
parseUnparsedDeclaration(declaration, builder);
|
|
260
271
|
} else if (declaration.property === "custom") {
|
|
261
|
-
|
|
272
|
+
parseCustomDeclaration(declaration, builder);
|
|
262
273
|
} else {
|
|
263
274
|
parseWithParser(declaration, builder);
|
|
264
275
|
}
|
|
@@ -270,6 +281,7 @@ function parseWithParser(declaration: Declaration, builder: StylesheetBuilder) {
|
|
|
270
281
|
|
|
271
282
|
builder.descriptorProperty = declaration.property;
|
|
272
283
|
|
|
284
|
+
builder.setWarningProperty(declaration.property);
|
|
273
285
|
const value = parser(declaration, builder, declaration.property);
|
|
274
286
|
|
|
275
287
|
if (value !== undefined) {
|
|
@@ -343,15 +355,41 @@ function parseBorderRadius(
|
|
|
343
355
|
}
|
|
344
356
|
|
|
345
357
|
function parseBorderColor(
|
|
346
|
-
|
|
358
|
+
declaration: DeclarationType<
|
|
359
|
+
"border-color" | "border-block-color" | "border-inline-color"
|
|
360
|
+
>,
|
|
347
361
|
builder: StylesheetBuilder,
|
|
348
362
|
) {
|
|
349
|
-
|
|
350
|
-
"border-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
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
|
+
}
|
|
355
393
|
}
|
|
356
394
|
|
|
357
395
|
function parseBorderWidth(
|
|
@@ -475,6 +513,43 @@ function parseBorderInlineEnd(
|
|
|
475
513
|
);
|
|
476
514
|
}
|
|
477
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
|
+
|
|
478
553
|
function parseFlexFlow(
|
|
479
554
|
{ value }: DeclarationType<"flex-flow">,
|
|
480
555
|
builder: StylesheetBuilder,
|
|
@@ -595,22 +670,22 @@ function parseTransform(
|
|
|
595
670
|
) {
|
|
596
671
|
builder.addDescriptor("transform", [
|
|
597
672
|
{},
|
|
598
|
-
"
|
|
673
|
+
"transform",
|
|
599
674
|
value.flatMap((t): StyleDescriptor[] => {
|
|
600
675
|
switch (t.type) {
|
|
601
676
|
case "perspective":
|
|
602
|
-
return [[{}, "
|
|
677
|
+
return [[{}, "perspective", parseLength(t.value, builder)]];
|
|
603
678
|
case "translate":
|
|
604
679
|
return [
|
|
605
680
|
[
|
|
606
681
|
{},
|
|
607
|
-
"
|
|
682
|
+
"translateX",
|
|
608
683
|
parseLengthOrCoercePercentageToRuntime(t.value[0], builder),
|
|
609
684
|
],
|
|
610
685
|
[
|
|
611
686
|
[
|
|
612
687
|
{},
|
|
613
|
-
"
|
|
688
|
+
"translateY",
|
|
614
689
|
parseLengthOrCoercePercentageToRuntime(t.value[1], builder),
|
|
615
690
|
],
|
|
616
691
|
],
|
|
@@ -619,7 +694,7 @@ function parseTransform(
|
|
|
619
694
|
return [
|
|
620
695
|
[
|
|
621
696
|
{},
|
|
622
|
-
"
|
|
697
|
+
"translateX",
|
|
623
698
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
624
699
|
],
|
|
625
700
|
];
|
|
@@ -627,22 +702,22 @@ function parseTransform(
|
|
|
627
702
|
return [
|
|
628
703
|
[
|
|
629
704
|
{},
|
|
630
|
-
"
|
|
705
|
+
"translateY",
|
|
631
706
|
parseLengthOrCoercePercentageToRuntime(t.value, builder),
|
|
632
707
|
],
|
|
633
708
|
];
|
|
634
709
|
case "rotate":
|
|
635
|
-
return [[{}, "
|
|
710
|
+
return [[{}, "rotate", parseAngle(t.value, builder)]];
|
|
636
711
|
case "rotateX":
|
|
637
|
-
return [[{}, "
|
|
712
|
+
return [[{}, "rotateX", parseAngle(t.value, builder)]];
|
|
638
713
|
case "rotateY":
|
|
639
|
-
return [[{}, "
|
|
714
|
+
return [[{}, "rotateY", parseAngle(t.value, builder)]];
|
|
640
715
|
case "rotateZ":
|
|
641
|
-
return [[{}, "
|
|
716
|
+
return [[{}, "rotateZ", parseAngle(t.value, builder)]];
|
|
642
717
|
case "scale":
|
|
643
718
|
return [
|
|
644
|
-
[{}, "
|
|
645
|
-
[{}, "
|
|
719
|
+
[{}, "scaleX", parseLength(t.value[0], builder)],
|
|
720
|
+
[{}, "scaleY", parseLength(t.value[1], builder)],
|
|
646
721
|
];
|
|
647
722
|
case "scaleX":
|
|
648
723
|
return [[{}, "scaleX", parseLength(t.value, builder)]];
|
|
@@ -691,21 +766,29 @@ function parseRotate(
|
|
|
691
766
|
{ value }: DeclarationType<"rotate">,
|
|
692
767
|
builder: StylesheetBuilder,
|
|
693
768
|
) {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
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
|
+
}
|
|
709
792
|
}
|
|
710
793
|
|
|
711
794
|
function parseScale(
|
|
@@ -743,7 +826,17 @@ function parseLetterSpacing(
|
|
|
743
826
|
if (value.type === "normal") {
|
|
744
827
|
return;
|
|
745
828
|
}
|
|
746
|
-
|
|
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;
|
|
747
840
|
}
|
|
748
841
|
|
|
749
842
|
function parseTextDecoration(
|
|
@@ -772,7 +865,11 @@ function parseZIndex(
|
|
|
772
865
|
}
|
|
773
866
|
}
|
|
774
867
|
|
|
775
|
-
function parseContainerType(
|
|
868
|
+
function parseContainerType(
|
|
869
|
+
_declaration: DeclarationType<"container-type">,
|
|
870
|
+
builder: StylesheetBuilder,
|
|
871
|
+
) {
|
|
872
|
+
builder.addContainer(["___default___"]);
|
|
776
873
|
return;
|
|
777
874
|
}
|
|
778
875
|
|
|
@@ -792,7 +889,7 @@ function parseContainer(
|
|
|
792
889
|
return;
|
|
793
890
|
}
|
|
794
891
|
|
|
795
|
-
export function
|
|
892
|
+
export function parseUnparsedDeclaration(
|
|
796
893
|
declaration: Extract<Declaration, { property: "unparsed" }>,
|
|
797
894
|
builder: StylesheetBuilder,
|
|
798
895
|
) {
|
|
@@ -803,6 +900,8 @@ export function parseDeclarationUnparsed(
|
|
|
803
900
|
return;
|
|
804
901
|
}
|
|
805
902
|
|
|
903
|
+
builder.setWarningProperty(property);
|
|
904
|
+
|
|
806
905
|
/**
|
|
807
906
|
* React Native doesn't support all the logical properties
|
|
808
907
|
*/
|
|
@@ -817,24 +916,15 @@ export function parseDeclarationUnparsed(
|
|
|
817
916
|
builder.descriptorProperty = property;
|
|
818
917
|
|
|
819
918
|
if (unparsedRuntimeParsing.has(property)) {
|
|
820
|
-
const args = parseUnparsed(declaration.value.value, builder);
|
|
919
|
+
const args = parseUnparsed(declaration.value.value, builder, property);
|
|
821
920
|
|
|
822
921
|
if (property === "animation") {
|
|
823
|
-
builder.addDescriptor("animation", [
|
|
824
|
-
{},
|
|
825
|
-
`@${toRNProperty(property)}`,
|
|
826
|
-
args,
|
|
827
|
-
]);
|
|
922
|
+
builder.addDescriptor("animation", [{}, property, args]);
|
|
828
923
|
} else {
|
|
829
|
-
builder.addDescriptor(property, [
|
|
830
|
-
{},
|
|
831
|
-
`@${toRNProperty(property)}`,
|
|
832
|
-
args,
|
|
833
|
-
1,
|
|
834
|
-
]);
|
|
924
|
+
builder.addDescriptor(property, [{}, toRNProperty(property), args, 1]);
|
|
835
925
|
}
|
|
836
926
|
} else {
|
|
837
|
-
const value = parseUnparsed(declaration.value.value, builder);
|
|
927
|
+
const value = parseUnparsed(declaration.value.value, builder, property);
|
|
838
928
|
|
|
839
929
|
builder.addDescriptor(property, value);
|
|
840
930
|
|
|
@@ -848,19 +938,31 @@ export function parseDeclarationUnparsed(
|
|
|
848
938
|
}
|
|
849
939
|
}
|
|
850
940
|
|
|
851
|
-
export function
|
|
941
|
+
export function parseCustomDeclaration(
|
|
852
942
|
declaration: Extract<Declaration, { property: "custom" }>,
|
|
853
943
|
builder: StylesheetBuilder,
|
|
854
944
|
) {
|
|
855
945
|
const property = declaration.value.name;
|
|
856
|
-
|
|
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 (
|
|
857
959
|
validProperties.has(property) ||
|
|
858
960
|
property.startsWith("--") ||
|
|
859
961
|
property.startsWith("-rn-")
|
|
860
962
|
) {
|
|
861
963
|
builder.addDescriptor(
|
|
862
964
|
property,
|
|
863
|
-
parseUnparsed(declaration.value.value, builder,
|
|
965
|
+
parseUnparsed(declaration.value.value, builder, property),
|
|
864
966
|
);
|
|
865
967
|
} else {
|
|
866
968
|
builder.addWarning("property", declaration.value.name);
|
|
@@ -870,9 +972,13 @@ export function parseDeclarationCustom(
|
|
|
870
972
|
export function reduceParseUnparsed(
|
|
871
973
|
tokenOrValues: TokenOrValue[],
|
|
872
974
|
builder: StylesheetBuilder,
|
|
975
|
+
property: string,
|
|
976
|
+
allowAuto: boolean,
|
|
873
977
|
): StyleDescriptor {
|
|
874
978
|
const result = tokenOrValues
|
|
875
|
-
.map((tokenOrValue) =>
|
|
979
|
+
.map((tokenOrValue) =>
|
|
980
|
+
parseUnparsed(tokenOrValue, builder, property, allowAuto),
|
|
981
|
+
)
|
|
876
982
|
.filter((v) => v !== undefined);
|
|
877
983
|
|
|
878
984
|
if (result.length === 0) {
|
|
@@ -891,6 +997,8 @@ export function reduceParseUnparsed(
|
|
|
891
997
|
}
|
|
892
998
|
}
|
|
893
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
|
|
894
1002
|
groups = groups.flatMap((group): StyleDescriptor[] => {
|
|
895
1003
|
if (!Array.isArray(group)) {
|
|
896
1004
|
return [];
|
|
@@ -906,6 +1014,17 @@ export function reduceParseUnparsed(
|
|
|
906
1014
|
} else {
|
|
907
1015
|
return [first];
|
|
908
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(" ")];
|
|
909
1028
|
} else {
|
|
910
1029
|
return [group];
|
|
911
1030
|
}
|
|
@@ -917,11 +1036,13 @@ export function reduceParseUnparsed(
|
|
|
917
1036
|
export function unparsedFunction(
|
|
918
1037
|
token: Extract<TokenOrValue, { type: "function" }>,
|
|
919
1038
|
builder: StylesheetBuilder,
|
|
1039
|
+
property: string,
|
|
1040
|
+
allowAuto: boolean,
|
|
920
1041
|
): StyleFunction {
|
|
921
1042
|
return [
|
|
922
1043
|
{},
|
|
923
|
-
token.value.name,
|
|
924
|
-
reduceParseUnparsed(token.value.arguments, builder),
|
|
1044
|
+
toRNProperty(token.value.name),
|
|
1045
|
+
reduceParseUnparsed(token.value.arguments, builder, property, allowAuto),
|
|
925
1046
|
];
|
|
926
1047
|
}
|
|
927
1048
|
|
|
@@ -938,7 +1059,8 @@ export function parseUnparsed(
|
|
|
938
1059
|
| undefined
|
|
939
1060
|
| null,
|
|
940
1061
|
builder: StylesheetBuilder,
|
|
941
|
-
|
|
1062
|
+
property: string,
|
|
1063
|
+
allowAuto = allowAutoProperties.has(property),
|
|
942
1064
|
): StyleDescriptor {
|
|
943
1065
|
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
944
1066
|
return;
|
|
@@ -961,7 +1083,12 @@ export function parseUnparsed(
|
|
|
961
1083
|
}
|
|
962
1084
|
|
|
963
1085
|
if (Array.isArray(tokenOrValue)) {
|
|
964
|
-
const args = reduceParseUnparsed(
|
|
1086
|
+
const args = reduceParseUnparsed(
|
|
1087
|
+
tokenOrValue,
|
|
1088
|
+
builder,
|
|
1089
|
+
property,
|
|
1090
|
+
allowAuto,
|
|
1091
|
+
);
|
|
965
1092
|
if (!args) return;
|
|
966
1093
|
if (Array.isArray(args) && args.length === 1) return args[0];
|
|
967
1094
|
return args;
|
|
@@ -969,11 +1096,21 @@ export function parseUnparsed(
|
|
|
969
1096
|
|
|
970
1097
|
switch (tokenOrValue.type) {
|
|
971
1098
|
case "unresolved-color": {
|
|
972
|
-
return parseUnresolvedColor(
|
|
1099
|
+
return parseUnresolvedColor(
|
|
1100
|
+
tokenOrValue.value,
|
|
1101
|
+
builder,
|
|
1102
|
+
property,
|
|
1103
|
+
allowAuto,
|
|
1104
|
+
);
|
|
973
1105
|
}
|
|
974
1106
|
case "var": {
|
|
975
1107
|
let args: StyleDescriptor = tokenOrValue.value.name.ident.slice(2);
|
|
976
|
-
const fallback = parseUnparsed(
|
|
1108
|
+
const fallback = parseUnparsed(
|
|
1109
|
+
tokenOrValue.value.fallback,
|
|
1110
|
+
builder,
|
|
1111
|
+
property,
|
|
1112
|
+
allowAuto,
|
|
1113
|
+
);
|
|
977
1114
|
if (fallback !== undefined) {
|
|
978
1115
|
args = [args, fallback];
|
|
979
1116
|
}
|
|
@@ -993,8 +1130,8 @@ export function parseUnparsed(
|
|
|
993
1130
|
case "scaleY":
|
|
994
1131
|
case "translateX":
|
|
995
1132
|
case "translateY":
|
|
996
|
-
tokenOrValue
|
|
997
|
-
|
|
1133
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
1134
|
+
case "blur":
|
|
998
1135
|
case "brightness":
|
|
999
1136
|
case "contrast":
|
|
1000
1137
|
case "cubic-bezier":
|
|
@@ -1008,7 +1145,7 @@ export function parseUnparsed(
|
|
|
1008
1145
|
case "linear-gradient":
|
|
1009
1146
|
case "opacity":
|
|
1010
1147
|
case "pixelScale":
|
|
1011
|
-
case "
|
|
1148
|
+
case "getPixelSizeForLayoutSize":
|
|
1012
1149
|
case "platformColor":
|
|
1013
1150
|
case "radial-gradient":
|
|
1014
1151
|
case "rgb":
|
|
@@ -1018,7 +1155,7 @@ export function parseUnparsed(
|
|
|
1018
1155
|
case "sepia":
|
|
1019
1156
|
case "shadow":
|
|
1020
1157
|
case "steps":
|
|
1021
|
-
return unparsedFunction(tokenOrValue, builder);
|
|
1158
|
+
return unparsedFunction(tokenOrValue, builder, property, allowAuto);
|
|
1022
1159
|
case "hairlineWidth":
|
|
1023
1160
|
return [{}, tokenOrValue.value.name, []];
|
|
1024
1161
|
case "calc":
|
|
@@ -1029,9 +1166,10 @@ export function parseUnparsed(
|
|
|
1029
1166
|
tokenOrValue.value.name,
|
|
1030
1167
|
tokenOrValue.value.arguments,
|
|
1031
1168
|
builder,
|
|
1169
|
+
property,
|
|
1032
1170
|
);
|
|
1033
1171
|
default: {
|
|
1034
|
-
builder.addWarning("
|
|
1172
|
+
builder.addWarning("value", `${tokenOrValue.value.name}()`);
|
|
1035
1173
|
return;
|
|
1036
1174
|
}
|
|
1037
1175
|
}
|
|
@@ -1061,6 +1199,8 @@ export function parseUnparsed(
|
|
|
1061
1199
|
return true;
|
|
1062
1200
|
} else if (value === "false") {
|
|
1063
1201
|
return false;
|
|
1202
|
+
} else if (value === "infinity") {
|
|
1203
|
+
return Number.MAX_SAFE_INTEGER;
|
|
1064
1204
|
} else {
|
|
1065
1205
|
return value;
|
|
1066
1206
|
}
|
|
@@ -1077,11 +1217,16 @@ export function parseUnparsed(
|
|
|
1077
1217
|
return parseDimension(tokenOrValue.value, builder);
|
|
1078
1218
|
case "comma":
|
|
1079
1219
|
return CommaSeparator as unknown as StyleDescriptor;
|
|
1220
|
+
case "delim": {
|
|
1221
|
+
if (tokenOrValue.value.value === "/") {
|
|
1222
|
+
return tokenOrValue.value.value;
|
|
1223
|
+
}
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1080
1226
|
case "at-keyword":
|
|
1081
1227
|
case "hash":
|
|
1082
1228
|
case "id-hash":
|
|
1083
1229
|
case "unquoted-url":
|
|
1084
|
-
case "delim":
|
|
1085
1230
|
case "white-space":
|
|
1086
1231
|
case "comment":
|
|
1087
1232
|
case "colon":
|
|
@@ -1152,23 +1297,35 @@ export function parseLength(
|
|
|
1152
1297
|
const { inlineRem = 14 } = builder.getOptions();
|
|
1153
1298
|
|
|
1154
1299
|
if (typeof length === "number") {
|
|
1155
|
-
return length;
|
|
1300
|
+
return round(length);
|
|
1156
1301
|
}
|
|
1157
1302
|
|
|
1158
1303
|
if ("unit" in length) {
|
|
1159
1304
|
switch (length.unit) {
|
|
1160
|
-
case "px":
|
|
1161
|
-
|
|
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
|
+
}
|
|
1162
1319
|
case "rem":
|
|
1163
1320
|
if (typeof inlineRem === "number") {
|
|
1164
1321
|
return length.value * inlineRem;
|
|
1165
1322
|
} else {
|
|
1166
|
-
return [{}, "rem", length.value];
|
|
1323
|
+
return [{}, "rem", round(length.value)];
|
|
1167
1324
|
}
|
|
1168
1325
|
case "vw":
|
|
1169
1326
|
case "vh":
|
|
1170
1327
|
case "em":
|
|
1171
|
-
return [{}, length.unit, length.value, 1];
|
|
1328
|
+
return [{}, length.unit, round(length.value), 1];
|
|
1172
1329
|
case "in":
|
|
1173
1330
|
case "cm":
|
|
1174
1331
|
case "mm":
|
|
@@ -1251,7 +1408,7 @@ export function parseAngle(angle: Angle | number, builder: StylesheetBuilder) {
|
|
|
1251
1408
|
case "rad":
|
|
1252
1409
|
return `${angle.value}${angle.type}`;
|
|
1253
1410
|
default:
|
|
1254
|
-
builder.addWarning("value", angle.value);
|
|
1411
|
+
builder.addWarning("value", `${angle.value} ${angle.type}`);
|
|
1255
1412
|
return undefined;
|
|
1256
1413
|
}
|
|
1257
1414
|
}
|
|
@@ -1334,7 +1491,7 @@ export function parseSize(
|
|
|
1334
1491
|
return;
|
|
1335
1492
|
}
|
|
1336
1493
|
|
|
1337
|
-
export function
|
|
1494
|
+
export function parseColorOrAutoDeclaration(
|
|
1338
1495
|
{ value }: { value: ColorOrAuto },
|
|
1339
1496
|
builder: StylesheetBuilder,
|
|
1340
1497
|
) {
|
|
@@ -1836,7 +1993,13 @@ export function parseOverflow(
|
|
|
1836
1993
|
}
|
|
1837
1994
|
|
|
1838
1995
|
export function parseBorderStyleDeclaration(
|
|
1839
|
-
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
|
+
>,
|
|
1840
2003
|
builder: StylesheetBuilder,
|
|
1841
2004
|
) {
|
|
1842
2005
|
return parseBorderStyle(declaration.value, builder);
|
|
@@ -1869,17 +2032,8 @@ export function parseBorderStyle(
|
|
|
1869
2032
|
return undefined;
|
|
1870
2033
|
}
|
|
1871
2034
|
|
|
1872
|
-
export function parseBorderBlockColor(
|
|
1873
|
-
{ value }: { value: BorderBlockColor },
|
|
1874
|
-
builder: StylesheetBuilder,
|
|
1875
|
-
) {
|
|
1876
|
-
builder.addDescriptor("border-top-color", parseColor(value.start, builder));
|
|
1877
|
-
builder.addDescriptor("border-bottom-color", parseColor(value.end, builder));
|
|
1878
|
-
return;
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
2035
|
export function parseBorderBlockWidth(
|
|
1882
|
-
declaration: DeclarationType<"border-block-width"
|
|
2036
|
+
declaration: DeclarationType<"border-block-width">,
|
|
1883
2037
|
builder: StylesheetBuilder,
|
|
1884
2038
|
) {
|
|
1885
2039
|
builder.addDescriptor(
|
|
@@ -1892,11 +2046,48 @@ export function parseBorderBlockWidth(
|
|
|
1892
2046
|
);
|
|
1893
2047
|
}
|
|
1894
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
|
+
|
|
1895
2063
|
export function parseBorderSideWidthDeclaration(
|
|
1896
|
-
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
|
+
>,
|
|
1897
2074
|
builder: StylesheetBuilder,
|
|
1898
2075
|
) {
|
|
1899
|
-
|
|
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
|
+
}
|
|
1900
2091
|
}
|
|
1901
2092
|
|
|
1902
2093
|
export function parseBorderSideWidth(
|
|
@@ -1959,7 +2150,8 @@ export function parseLineHeight(
|
|
|
1959
2150
|
case "percentage":
|
|
1960
2151
|
case "calc":
|
|
1961
2152
|
builder.addWarning(
|
|
1962
|
-
"
|
|
2153
|
+
"style",
|
|
2154
|
+
"line-height",
|
|
1963
2155
|
typeof length.value === "number"
|
|
1964
2156
|
? length.value
|
|
1965
2157
|
: JSON.stringify(length.value),
|
|
@@ -2222,7 +2414,11 @@ export function parseDimension(
|
|
|
2222
2414
|
): StyleDescriptor {
|
|
2223
2415
|
switch (unit) {
|
|
2224
2416
|
case "px":
|
|
2225
|
-
|
|
2417
|
+
if (value === Infinity) {
|
|
2418
|
+
return 9999;
|
|
2419
|
+
} else {
|
|
2420
|
+
return value;
|
|
2421
|
+
}
|
|
2226
2422
|
case "%":
|
|
2227
2423
|
return `${value}%`;
|
|
2228
2424
|
case "rnh":
|
|
@@ -2249,20 +2445,24 @@ export function parseUserSelect(
|
|
|
2249
2445
|
}
|
|
2250
2446
|
|
|
2251
2447
|
export function parseSVGPaint(
|
|
2252
|
-
{ value }: DeclarationType<"fill" | "stroke">,
|
|
2448
|
+
{ value, property }: DeclarationType<"fill" | "stroke">,
|
|
2253
2449
|
builder: StylesheetBuilder,
|
|
2254
2450
|
) {
|
|
2451
|
+
let parsedValue: StyleDescriptor | undefined;
|
|
2452
|
+
|
|
2255
2453
|
if (value.type === "none") {
|
|
2256
|
-
|
|
2454
|
+
parsedValue = "transparent";
|
|
2257
2455
|
} else if (value.type === "color") {
|
|
2258
|
-
|
|
2456
|
+
parsedValue = parseColor(value.value, builder);
|
|
2457
|
+
} else {
|
|
2458
|
+
return;
|
|
2259
2459
|
}
|
|
2260
2460
|
|
|
2261
|
-
|
|
2461
|
+
builder.addDescriptor(property, parsedValue);
|
|
2262
2462
|
}
|
|
2263
2463
|
|
|
2264
2464
|
export function round(number: number) {
|
|
2265
|
-
return Math.round((number + Number.EPSILON) *
|
|
2465
|
+
return Math.round((number + Number.EPSILON) * 10000) / 10000;
|
|
2266
2466
|
}
|
|
2267
2467
|
|
|
2268
2468
|
export function parseDimensionPercentageFor_LengthValue(
|
|
@@ -2278,7 +2478,7 @@ export function parseDimensionPercentageFor_LengthValue(
|
|
|
2278
2478
|
}
|
|
2279
2479
|
}
|
|
2280
2480
|
|
|
2281
|
-
const
|
|
2481
|
+
const allowAutoProperties = new Set(["pointer-events"]);
|
|
2282
2482
|
|
|
2283
2483
|
export function parseEnv(
|
|
2284
2484
|
value: EnvironmentVariable,
|
|
@@ -2296,7 +2496,7 @@ export function parseEnv(
|
|
|
2296
2496
|
"var",
|
|
2297
2497
|
[
|
|
2298
2498
|
`--react-native-css-${value.name.value}`,
|
|
2299
|
-
parseUnparsed(value.fallback, builder),
|
|
2499
|
+
parseUnparsed(value.fallback, builder, value.name.value),
|
|
2300
2500
|
],
|
|
2301
2501
|
1,
|
|
2302
2502
|
];
|
|
@@ -2319,8 +2519,9 @@ export function parseCalcFn(
|
|
|
2319
2519
|
name: string,
|
|
2320
2520
|
tokens: TokenOrValue[],
|
|
2321
2521
|
builder: StylesheetBuilder,
|
|
2522
|
+
property: string,
|
|
2322
2523
|
): StyleDescriptor {
|
|
2323
|
-
const args = parseCalcArguments(tokens, builder);
|
|
2524
|
+
const args = parseCalcArguments(tokens, builder, property);
|
|
2324
2525
|
if (args) {
|
|
2325
2526
|
return [{}, name, args];
|
|
2326
2527
|
}
|
|
@@ -2331,6 +2532,7 @@ export function parseCalcFn(
|
|
|
2331
2532
|
export function parseCalcArguments(
|
|
2332
2533
|
[...args]: TokenOrValue[],
|
|
2333
2534
|
builder: StylesheetBuilder,
|
|
2535
|
+
property: string,
|
|
2334
2536
|
) {
|
|
2335
2537
|
const parsed: StyleDescriptor[] = [];
|
|
2336
2538
|
|
|
@@ -2345,7 +2547,7 @@ export function parseCalcArguments(
|
|
|
2345
2547
|
case "var":
|
|
2346
2548
|
case "function":
|
|
2347
2549
|
case "unresolved-color": {
|
|
2348
|
-
const value = parseUnparsed(arg, builder);
|
|
2550
|
+
const value = parseUnparsed(arg, builder, property);
|
|
2349
2551
|
|
|
2350
2552
|
if (value === undefined) {
|
|
2351
2553
|
return undefined;
|
|
@@ -2421,7 +2623,7 @@ export function parseCalcArguments(
|
|
|
2421
2623
|
// Then drop the surrounding parenthesis
|
|
2422
2624
|
.slice(1, -1);
|
|
2423
2625
|
|
|
2424
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
2626
|
+
parsed.push(parseCalcFn("calc", innerCalcArgs, builder, property));
|
|
2425
2627
|
|
|
2426
2628
|
break;
|
|
2427
2629
|
}
|
|
@@ -2474,6 +2676,8 @@ export function parseTranslateProp(
|
|
|
2474
2676
|
export function parseUnresolvedColor(
|
|
2475
2677
|
color: UnresolvedColor,
|
|
2476
2678
|
builder: StylesheetBuilder,
|
|
2679
|
+
property: string,
|
|
2680
|
+
allowAuto: boolean,
|
|
2477
2681
|
): StyleDescriptor {
|
|
2478
2682
|
switch (color.type) {
|
|
2479
2683
|
case "rgb":
|
|
@@ -2484,26 +2688,31 @@ export function parseUnresolvedColor(
|
|
|
2484
2688
|
round(color.r * 255),
|
|
2485
2689
|
round(color.g * 255),
|
|
2486
2690
|
round(color.b * 255),
|
|
2487
|
-
parseUnparsed(color.alpha, builder),
|
|
2691
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2488
2692
|
],
|
|
2489
2693
|
];
|
|
2490
2694
|
case "hsl":
|
|
2491
2695
|
return [
|
|
2492
2696
|
{},
|
|
2493
2697
|
color.type,
|
|
2494
|
-
[
|
|
2698
|
+
[
|
|
2699
|
+
color.h,
|
|
2700
|
+
color.s,
|
|
2701
|
+
color.l,
|
|
2702
|
+
parseUnparsed(color.alpha, builder, property),
|
|
2703
|
+
],
|
|
2495
2704
|
];
|
|
2496
2705
|
case "light-dark": {
|
|
2497
2706
|
const extraRule = builder.extendRule({
|
|
2498
2707
|
m: [["=", "prefers-color-scheme", "dark"]],
|
|
2499
2708
|
});
|
|
2500
2709
|
builder.addUnnamedDescriptor(
|
|
2501
|
-
reduceParseUnparsed(color.dark, builder),
|
|
2710
|
+
reduceParseUnparsed(color.dark, builder, property, allowAuto),
|
|
2502
2711
|
false,
|
|
2503
2712
|
extraRule,
|
|
2504
2713
|
);
|
|
2505
2714
|
builder.addExtraRule(extraRule);
|
|
2506
|
-
return reduceParseUnparsed(color.light, builder);
|
|
2715
|
+
return reduceParseUnparsed(color.light, builder, property, allowAuto);
|
|
2507
2716
|
}
|
|
2508
2717
|
default:
|
|
2509
2718
|
color satisfies never;
|
|
@@ -2749,7 +2958,7 @@ function parseGradient(
|
|
|
2749
2958
|
case "linear": {
|
|
2750
2959
|
return [
|
|
2751
2960
|
{},
|
|
2752
|
-
"
|
|
2961
|
+
"linear-gradient",
|
|
2753
2962
|
[
|
|
2754
2963
|
parseLineDirection(gradient.direction, builder),
|
|
2755
2964
|
...gradient.items.map((item) => parseGradientItem(item, builder)),
|
|
@@ -2826,6 +3035,16 @@ function parseFilter(
|
|
|
2826
3035
|
[value.type]: parseAngle(value.value, builder),
|
|
2827
3036
|
} as unknown as StyleDescriptor;
|
|
2828
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;
|
|
2829
3048
|
case "url":
|
|
2830
3049
|
return;
|
|
2831
3050
|
}
|