react-native-css 3.0.0-nightly.4723140 → 3.0.0-nightly.75f8b74
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/README.md +184 -1
- package/dist/commonjs/babel/allowedModules.js +23 -0
- package/dist/commonjs/babel/allowedModules.js.map +1 -0
- package/dist/commonjs/babel/helpers.js +18 -122
- package/dist/commonjs/babel/helpers.js.map +1 -1
- package/dist/commonjs/babel/import-plugin.js +62 -58
- package/dist/commonjs/babel/import-plugin.js.map +1 -1
- package/dist/commonjs/babel/react-native-web.js +118 -0
- package/dist/commonjs/babel/react-native-web.js.map +1 -0
- package/dist/commonjs/babel/react-native.js +118 -0
- package/dist/commonjs/babel/react-native.js.map +1 -0
- package/dist/commonjs/compiler/atRules.js +101 -0
- package/dist/commonjs/compiler/atRules.js.map +1 -0
- package/dist/commonjs/compiler/attributes.test.js +20 -0
- package/dist/commonjs/compiler/attributes.test.js.map +1 -0
- package/dist/commonjs/compiler/compiler.js +143 -344
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/compiler.types.js.map +1 -1
- package/dist/commonjs/compiler/container-query.js +10 -10
- package/dist/commonjs/compiler/container-query.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +1239 -987
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +78 -0
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -0
- package/dist/commonjs/compiler/keyframes.js +15 -24
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/media-query.js +22 -22
- package/dist/commonjs/compiler/media-query.js.map +1 -1
- package/dist/commonjs/compiler/selectors.js +264 -184
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/split-by-delimiter.js +21 -0
- package/dist/commonjs/compiler/split-by-delimiter.js.map +1 -0
- package/dist/commonjs/compiler/stylesheet.js +385 -0
- package/dist/commonjs/compiler/stylesheet.js.map +1 -0
- package/dist/commonjs/components/Text.js +2 -0
- package/dist/commonjs/components/Text.js.map +1 -1
- package/dist/commonjs/components/View.js +2 -0
- package/dist/commonjs/components/View.js.map +1 -1
- package/dist/commonjs/index.js +11 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/jest/index.js +12 -23
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +111 -50
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/injection-code.js +24 -4
- package/dist/commonjs/metro/injection-code.js.map +1 -1
- package/dist/commonjs/metro/resolver.js +62 -0
- package/dist/commonjs/metro/resolver.js.map +1 -0
- package/dist/commonjs/metro/typescript.js +1 -1
- package/dist/commonjs/poison.pill.js +36 -0
- package/dist/commonjs/poison.pill.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/guards.js +10 -4
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +2 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/index.js +11 -1
- package/dist/commonjs/runtime/native/index.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +18 -0
- package/dist/commonjs/runtime/native/injection.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +23 -27
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -5
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/animation.js +70 -72
- package/dist/commonjs/runtime/native/styles/animation.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/border.js +12 -0
- package/dist/commonjs/runtime/native/styles/border.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/box-shadow.js +40 -0
- package/dist/commonjs/runtime/native/styles/box-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calc.js +33 -61
- package/dist/commonjs/runtime/native/styles/calc.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/calculate-props.js +123 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/constants.js +2 -1
- package/dist/commonjs/runtime/native/styles/constants.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/filters.js +84 -0
- package/dist/commonjs/runtime/native/styles/filters.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +2 -110
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/platform-functions.js +46 -0
- package/dist/commonjs/runtime/native/styles/platform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/resolve.js +46 -13
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/shorthand.js +34 -17
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/transform.js +9 -3
- package/dist/commonjs/runtime/native/styles/transform.js.map +1 -1
- 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 +57 -36
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +18 -5
- package/dist/commonjs/runtime/utils/objects.js.map +1 -1
- package/dist/commonjs/runtime/utils/style-value.js +7 -0
- package/dist/commonjs/runtime/utils/style-value.js.map +1 -1
- package/dist/commonjs/runtime/web/index.js +1 -0
- package/dist/commonjs/runtime/web/index.js.map +1 -1
- package/dist/commonjs/runtime/web/metro.js +6 -0
- package/dist/commonjs/runtime/web/metro.js.map +1 -0
- package/dist/module/babel/allowedModules.js +19 -0
- package/dist/module/babel/allowedModules.js.map +1 -0
- package/dist/module/babel/helpers.js +17 -116
- package/dist/module/babel/helpers.js.map +1 -1
- package/dist/module/babel/import-plugin.js +63 -59
- package/dist/module/babel/import-plugin.js.map +1 -1
- package/dist/module/babel/react-native-web.js +112 -0
- package/dist/module/babel/react-native-web.js.map +1 -0
- package/dist/module/babel/react-native.js +112 -0
- package/dist/module/babel/react-native.js.map +1 -0
- package/dist/module/compiler/atRules.js +97 -0
- package/dist/module/compiler/atRules.js.map +1 -0
- package/dist/module/compiler/attributes.test.js +20 -0
- package/dist/module/compiler/attributes.test.js.map +1 -0
- package/dist/module/compiler/compiler.js +144 -345
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +0 -12
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/container-query.js +10 -10
- package/dist/module/compiler/container-query.js.map +1 -1
- package/dist/module/compiler/declarations.js +1178 -991
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +78 -0
- package/dist/module/compiler/inheritance.test.js.map +1 -0
- package/dist/module/compiler/keyframes.js +15 -24
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/media-query.js +22 -22
- package/dist/module/compiler/media-query.js.map +1 -1
- package/dist/module/compiler/selectors.js +264 -184
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/split-by-delimiter.js +17 -0
- package/dist/module/compiler/split-by-delimiter.js.map +1 -0
- package/dist/module/compiler/stylesheet.js +380 -0
- package/dist/module/compiler/stylesheet.js.map +1 -0
- package/dist/module/components/Text.js +1 -0
- package/dist/module/components/Text.js.map +1 -1
- package/dist/module/components/View.js +1 -0
- package/dist/module/components/View.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/jest/index.js +12 -8
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +111 -50
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/injection-code.js +22 -3
- package/dist/module/metro/injection-code.js.map +1 -1
- package/dist/module/metro/resolver.js +57 -0
- package/dist/module/metro/resolver.js.map +1 -0
- package/dist/module/metro/typescript.js +1 -1
- package/dist/module/poison.pill.js +34 -0
- package/dist/module/poison.pill.js.map +1 -0
- package/dist/module/runtime/native/conditions/guards.js +10 -4
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +2 -0
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/index.js +1 -2
- package/dist/module/runtime/native/index.js.map +1 -1
- package/dist/module/runtime/native/injection.js +18 -0
- package/dist/module/runtime/native/injection.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +22 -27
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +1 -5
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/animation.js +68 -71
- package/dist/module/runtime/native/styles/animation.js.map +1 -1
- package/dist/module/runtime/native/styles/border.js +8 -0
- package/dist/module/runtime/native/styles/border.js.map +1 -0
- package/dist/module/runtime/native/styles/box-shadow.js +35 -0
- package/dist/module/runtime/native/styles/box-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/calc.js +33 -62
- package/dist/module/runtime/native/styles/calc.js.map +1 -1
- package/dist/module/runtime/native/styles/calculate-props.js +118 -0
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -0
- package/dist/module/runtime/native/styles/constants.js +1 -0
- package/dist/module/runtime/native/styles/constants.js.map +1 -1
- package/dist/module/runtime/native/styles/filters.js +70 -0
- package/dist/module/runtime/native/styles/filters.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +2 -110
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/platform-functions.js +36 -0
- package/dist/module/runtime/native/styles/platform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/resolve.js +47 -14
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/shorthand.js +34 -17
- package/dist/module/runtime/native/styles/shorthand.js.map +1 -1
- package/dist/module/runtime/native/styles/transform.js +9 -3
- package/dist/module/runtime/native/styles/transform.js.map +1 -1
- 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 +57 -36
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +16 -4
- package/dist/module/runtime/utils/objects.js.map +1 -1
- package/dist/module/runtime/utils/style-value.js +6 -0
- package/dist/module/runtime/utils/style-value.js.map +1 -1
- package/dist/module/runtime/web/index.js +2 -0
- package/dist/module/runtime/web/index.js.map +1 -1
- package/dist/module/runtime/web/metro.js +5 -0
- package/dist/module/runtime/web/metro.js.map +1 -0
- package/dist/typescript/commonjs/example/app.config.d.ts +4 -0
- package/dist/typescript/commonjs/example/app.config.d.ts.map +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/allowedModules.d.ts +2 -0
- package/dist/typescript/commonjs/src/babel/allowedModules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts +3 -8
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +8 -0
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/react-native.d.ts +8 -0
- package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts +34 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +27 -108
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +118 -25
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +5 -4
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +4 -4
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +10 -5
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +54 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +4 -5
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts +5 -4
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +15 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/resolver.d.ts +4 -0
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/poison.pill.d.ts +2 -0
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +3 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +10 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts +3 -4
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts +6 -2
- 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 +3 -4
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +1 -1
- 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 +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts +0 -15
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts +3 -2
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/metro.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/web/metro.d.ts.map +1 -0
- package/dist/typescript/module/example/app.config.d.ts +4 -0
- package/dist/typescript/module/example/app.config.d.ts.map +1 -0
- package/dist/typescript/module/example/src/App.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/allowedModules.d.ts +2 -0
- package/dist/typescript/module/src/babel/allowedModules.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/helpers.d.ts +3 -8
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts +8 -0
- package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/react-native.d.ts +8 -0
- package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts +34 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/attributes.test.d.ts +2 -0
- package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +27 -108
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +118 -25
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts +2 -0
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts +5 -4
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/media-query.d.ts +4 -4
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selectors.d.ts +10 -5
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts +2 -0
- package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +54 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Text.d.ts +1 -1
- package/dist/typescript/module/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/module/src/components/View.d.ts +1 -1
- package/dist/typescript/module/src/components/View.d.ts.map +1 -1
- package/dist/typescript/module/src/index.d.ts +1 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +4 -5
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts +5 -4
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts +15 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/resolver.d.ts +4 -0
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -0
- package/dist/typescript/module/src/poison.pill.d.ts +2 -0
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/index.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +3 -2
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +10 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts +12 -0
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts +3 -4
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts +6 -2
- 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 +3 -4
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +1 -1
- 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 +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/runtime.types.d.ts +0 -15
- package/dist/typescript/module/src/runtime/runtime.types.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/components.d.ts +1 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts +2 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts +3 -2
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/index.d.ts +1 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/metro.d.ts +2 -0
- package/dist/typescript/module/src/runtime/web/metro.d.ts.map +1 -0
- package/package.json +69 -14
- package/src/babel/allowedModules.ts +24 -0
- package/src/babel/helpers.ts +16 -158
- package/src/babel/import-plugin.ts +125 -132
- package/src/babel/react-native-web.ts +226 -0
- package/src/babel/react-native.ts +226 -0
- package/src/compiler/atRules.ts +144 -0
- package/src/compiler/attributes.test.ts +28 -0
- package/src/compiler/compiler.ts +154 -482
- package/src/compiler/compiler.types.ts +30 -135
- package/src/compiler/container-query.ts +12 -12
- package/src/compiler/declarations.ts +1803 -1967
- package/src/compiler/inheritance.test.ts +121 -0
- package/src/compiler/keyframes.ts +28 -42
- package/src/compiler/media-query.ts +27 -26
- package/src/compiler/selectors.ts +289 -271
- package/src/compiler/split-by-delimiter.ts +19 -0
- package/src/compiler/stylesheet.ts +546 -0
- package/src/components/Text.tsx +2 -0
- package/src/components/View.tsx +2 -0
- package/src/index.ts +2 -0
- package/src/jest/index.ts +19 -9
- package/src/metro/index.ts +161 -64
- package/src/metro/injection-code.ts +33 -3
- package/src/metro/resolver.ts +89 -0
- package/src/metro/typescript.ts +1 -1
- package/src/poison.pill.ts +32 -0
- package/src/runtime/native/conditions/guards.ts +12 -4
- package/src/runtime/native/conditions/media-query.ts +2 -0
- package/src/runtime/native/index.ts +1 -2
- package/src/runtime/native/injection.ts +30 -0
- package/src/runtime/native/react/rules.ts +26 -33
- package/src/runtime/native/reactivity.ts +3 -7
- package/src/runtime/native/styles/animation.ts +143 -104
- package/src/runtime/native/styles/border.ts +10 -0
- package/src/runtime/native/styles/box-shadow.ts +54 -0
- package/src/runtime/native/styles/calc.ts +37 -60
- package/src/runtime/native/styles/calculate-props.ts +165 -0
- package/src/runtime/native/styles/constants.ts +1 -0
- package/src/runtime/native/styles/filters.ts +98 -0
- package/src/runtime/native/styles/index.ts +2 -138
- package/src/runtime/native/styles/platform-functions.ts +50 -0
- package/src/runtime/native/styles/resolve.ts +91 -17
- package/src/runtime/native/styles/shorthand.ts +61 -41
- package/src/runtime/native/styles/transform.ts +10 -4
- package/src/runtime/native/styles/units.ts +9 -4
- package/src/runtime/native/styles/variables.ts +51 -35
- package/src/runtime/runtime.types.ts +0 -25
- package/src/runtime/utils/objects.ts +20 -5
- package/src/runtime/utils/style-value.ts +14 -2
- package/src/runtime/web/index.ts +3 -0
- package/src/runtime/web/metro.ts +2 -0
- package/types.d.ts +70 -0
- package/dist/commonjs/compiler/add.js +0 -175
- package/dist/commonjs/compiler/add.js.map +0 -1
- package/dist/commonjs/components/ActivityIndicator.js +0 -20
- package/dist/commonjs/components/ActivityIndicator.js.map +0 -1
- package/dist/commonjs/components/SafeAreaProvider/index.js +0 -41
- package/dist/commonjs/components/SafeAreaProvider/index.js.map +0 -1
- package/dist/commonjs/components/SafeAreaProvider/index.web.js +0 -13
- package/dist/commonjs/components/SafeAreaProvider/index.web.js.map +0 -1
- package/dist/commonjs/components/TextInput.js +0 -20
- package/dist/commonjs/components/TextInput.js.map +0 -1
- package/dist/module/compiler/add.js +0 -168
- package/dist/module/compiler/add.js.map +0 -1
- package/dist/module/components/ActivityIndicator.js +0 -16
- package/dist/module/components/ActivityIndicator.js.map +0 -1
- package/dist/module/components/SafeAreaProvider/index.js +0 -36
- package/dist/module/components/SafeAreaProvider/index.js.map +0 -1
- package/dist/module/components/SafeAreaProvider/index.web.js +0 -4
- package/dist/module/components/SafeAreaProvider/index.web.js.map +0 -1
- package/dist/module/components/TextInput.js +0 -16
- package/dist/module/components/TextInput.js.map +0 -1
- package/dist/typescript/commonjs/src/compiler/add.d.ts +0 -10
- package/dist/typescript/commonjs/src/compiler/add.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +0 -3
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts +0 -4
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts +0 -2
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +0 -13
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/add.d.ts +0 -10
- package/dist/typescript/module/src/compiler/add.d.ts.map +0 -1
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +0 -3
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts +0 -4
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts.map +0 -1
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts +0 -2
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts.map +0 -1
- package/dist/typescript/module/src/components/TextInput.d.ts +0 -13
- package/dist/typescript/module/src/components/TextInput.d.ts.map +0 -1
- package/src/compiler/add.ts +0 -257
- package/src/components/ActivityIndicator.tsx +0 -19
- package/src/components/SafeAreaProvider/index.tsx +0 -50
- package/src/components/SafeAreaProvider/index.web.tsx +0 -1
- package/src/components/TextInput.tsx +0 -20
|
@@ -3,28 +3,261 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.addAnimationValue = addAnimationValue;
|
|
7
|
+
exports.addTransitionValue = addTransitionValue;
|
|
8
|
+
exports.allEqual = allEqual;
|
|
9
|
+
exports.equal = equal;
|
|
10
|
+
exports.kebabCase = kebabCase;
|
|
11
|
+
exports.parseAlignContent = parseAlignContent;
|
|
12
|
+
exports.parseAlignItems = parseAlignItems;
|
|
13
|
+
exports.parseAlignSelf = parseAlignSelf;
|
|
14
|
+
exports.parseAngle = parseAngle;
|
|
15
|
+
exports.parseAspectRatio = parseAspectRatio;
|
|
16
|
+
exports.parseBorderBlockColor = parseBorderBlockColor;
|
|
17
|
+
exports.parseBorderBlockWidth = parseBorderBlockWidth;
|
|
18
|
+
exports.parseBorderSideWidth = parseBorderSideWidth;
|
|
19
|
+
exports.parseBorderSideWidthDeclaration = parseBorderSideWidthDeclaration;
|
|
20
|
+
exports.parseBorderStyle = parseBorderStyle;
|
|
21
|
+
exports.parseBorderStyleDeclaration = parseBorderStyleDeclaration;
|
|
22
|
+
exports.parseBoxShadow = parseBoxShadow;
|
|
23
|
+
exports.parseCalcArguments = parseCalcArguments;
|
|
6
24
|
exports.parseCalcFn = parseCalcFn;
|
|
25
|
+
exports.parseColor = parseColor;
|
|
26
|
+
exports.parseColorDeclaration = parseColorDeclaration;
|
|
27
|
+
exports.parseColorOrAuto = parseColorOrAuto;
|
|
7
28
|
exports.parseDeclaration = parseDeclaration;
|
|
29
|
+
exports.parseDeclarationCustom = parseDeclarationCustom;
|
|
30
|
+
exports.parseDeclarationUnparsed = parseDeclarationUnparsed;
|
|
31
|
+
exports.parseDimension = parseDimension;
|
|
32
|
+
exports.parseDimensionPercentageFor_LengthValue = parseDimensionPercentageFor_LengthValue;
|
|
33
|
+
exports.parseDisplay = parseDisplay;
|
|
34
|
+
exports.parseEnv = parseEnv;
|
|
35
|
+
exports.parseFontColorDeclaration = parseFontColorDeclaration;
|
|
36
|
+
exports.parseFontSize = parseFontSize;
|
|
37
|
+
exports.parseFontSizeDeclaration = parseFontSizeDeclaration;
|
|
38
|
+
exports.parseFontStyle = parseFontStyle;
|
|
39
|
+
exports.parseFontStyleDeclaration = parseFontStyleDeclaration;
|
|
40
|
+
exports.parseFontVariantCaps = parseFontVariantCaps;
|
|
41
|
+
exports.parseFontVariantCapsDeclaration = parseFontVariantCapsDeclaration;
|
|
42
|
+
exports.parseFontWeight = parseFontWeight;
|
|
43
|
+
exports.parseFontWeightDeclaration = parseFontWeightDeclaration;
|
|
44
|
+
exports.parseGap = parseGap;
|
|
45
|
+
exports.parseJustifyContent = parseJustifyContent;
|
|
8
46
|
exports.parseLength = parseLength;
|
|
9
|
-
exports.
|
|
10
|
-
exports.
|
|
47
|
+
exports.parseLengthDeclaration = parseLengthDeclaration;
|
|
48
|
+
exports.parseLengthOrCoercePercentageToRuntime = parseLengthOrCoercePercentageToRuntime;
|
|
49
|
+
exports.parseLengthPercentageOrAuto = parseLengthPercentageOrAuto;
|
|
50
|
+
exports.parseLengthPercentageOrAutoDeclaration = parseLengthPercentageOrAutoDeclaration;
|
|
51
|
+
exports.parseLineHeight = parseLineHeight;
|
|
52
|
+
exports.parseLineHeightDeclaration = parseLineHeightDeclaration;
|
|
53
|
+
exports.parseOverflow = parseOverflow;
|
|
54
|
+
exports.parsePointerEvents = parsePointerEvents;
|
|
55
|
+
exports.parsePosition = parsePosition;
|
|
56
|
+
exports.parseSVGPaint = parseSVGPaint;
|
|
57
|
+
exports.parseScaleValue = parseScaleValue;
|
|
58
|
+
exports.parseSize = parseSize;
|
|
59
|
+
exports.parseSize2DDimensionPercentage = parseSize2DDimensionPercentage;
|
|
60
|
+
exports.parseSize2DDimensionPercentageDeclaration = parseSize2DDimensionPercentageDeclaration;
|
|
61
|
+
exports.parseSizeDeclaration = parseSizeDeclaration;
|
|
62
|
+
exports.parseTextAlign = parseTextAlign;
|
|
63
|
+
exports.parseTextDecorationLine = parseTextDecorationLine;
|
|
64
|
+
exports.parseTextDecorationLineDeclaration = parseTextDecorationLineDeclaration;
|
|
65
|
+
exports.parseTextDecorationStyle = parseTextDecorationStyle;
|
|
66
|
+
exports.parseTextShadow = parseTextShadow;
|
|
67
|
+
exports.parseTime = parseTime;
|
|
68
|
+
exports.parseTranslateProp = parseTranslateProp;
|
|
69
|
+
exports.parseUnparsed = parseUnparsed;
|
|
11
70
|
exports.parseUnresolvedColor = parseUnresolvedColor;
|
|
12
|
-
|
|
13
|
-
|
|
71
|
+
exports.parseUserSelect = parseUserSelect;
|
|
72
|
+
exports.parseVerticalAlign = parseVerticalAlign;
|
|
73
|
+
exports.reduceParseUnparsed = reduceParseUnparsed;
|
|
74
|
+
exports.round = round;
|
|
75
|
+
exports.unparsedFunction = unparsedFunction;
|
|
76
|
+
var _colorjs = _interopRequireDefault(require("colorjs.io"));
|
|
14
77
|
var _keyframes = require("./keyframes.js");
|
|
15
78
|
var _selectors = require("./selectors.js");
|
|
16
|
-
|
|
79
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
80
|
// cSpell:ignore rcap,vmin,svmin,lvmin,dvmin,cqmin,vmax,svmax,lvmax,dvmax,cqmax,currentcolor,oklab,oklch,prophoto
|
|
18
81
|
|
|
82
|
+
const CommaSeparator = Symbol("CommaSeparator");
|
|
19
83
|
const propertyRename = {
|
|
20
|
-
"
|
|
21
|
-
"margin-inline-end": "margin-end",
|
|
22
|
-
"padding-inline-start": "padding-start",
|
|
23
|
-
"padding-inline-end": "padding-end"
|
|
84
|
+
"background-image": "experimental_backgroundImage"
|
|
24
85
|
};
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
|
|
86
|
+
const unparsedRuntimeParsing = new Set(["animation", "text-shadow", "transform", "box-shadow", "border"]);
|
|
87
|
+
const parsers = {
|
|
88
|
+
"align-content": parseAlignContent,
|
|
89
|
+
"align-items": parseAlignItems,
|
|
90
|
+
"align-self": parseAlignSelf,
|
|
91
|
+
"animation": addAnimationValue,
|
|
92
|
+
"animation-delay": addAnimationValue,
|
|
93
|
+
"animation-direction": addAnimationValue,
|
|
94
|
+
"animation-duration": addAnimationValue,
|
|
95
|
+
"animation-fill-mode": addAnimationValue,
|
|
96
|
+
"animation-iteration-count": addAnimationValue,
|
|
97
|
+
"animation-name": addAnimationValue,
|
|
98
|
+
"animation-play-state": addAnimationValue,
|
|
99
|
+
"animation-timing-function": addAnimationValue,
|
|
100
|
+
"aspect-ratio": parseAspectRatio,
|
|
101
|
+
"background-color": parseColorDeclaration,
|
|
102
|
+
"background-image": parseBackgroundImage,
|
|
103
|
+
"block-size": parseSizeDeclaration,
|
|
104
|
+
"border": parseBorder,
|
|
105
|
+
"border-block": parseBorderBlock,
|
|
106
|
+
"border-block-color": parseBorderBlockColor,
|
|
107
|
+
"border-block-end": parseBorderBlockEnd,
|
|
108
|
+
"border-block-end-color": parseColorDeclaration,
|
|
109
|
+
"border-block-end-width": parseBorderSideWidthDeclaration,
|
|
110
|
+
"border-block-start": parseBorderBlockStart,
|
|
111
|
+
"border-block-start-color": parseColorDeclaration,
|
|
112
|
+
"border-block-start-width": parseBorderSideWidthDeclaration,
|
|
113
|
+
"border-block-width": parseBorderBlockWidth,
|
|
114
|
+
"border-bottom": parseBorderSide,
|
|
115
|
+
"border-bottom-color": parseColorDeclaration,
|
|
116
|
+
"border-bottom-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
117
|
+
"border-bottom-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
118
|
+
"border-bottom-width": parseBorderSideWidthDeclaration,
|
|
119
|
+
"border-color": parseBorderColor,
|
|
120
|
+
"border-end-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
121
|
+
"border-end-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
122
|
+
"border-inline": parseBorderInline,
|
|
123
|
+
"border-inline-color": parseBorderBlockColor,
|
|
124
|
+
"border-inline-end": parseBorderInlineEnd,
|
|
125
|
+
"border-inline-end-color": parseColorDeclaration,
|
|
126
|
+
"border-inline-end-width": parseBorderSideWidthDeclaration,
|
|
127
|
+
"border-inline-start": parseBorderInlineStart,
|
|
128
|
+
"border-inline-start-color": parseColorDeclaration,
|
|
129
|
+
"border-inline-start-width": parseBorderSideWidthDeclaration,
|
|
130
|
+
"border-inline-width": parseBorderBlockWidth,
|
|
131
|
+
"border-left": parseBorderSide,
|
|
132
|
+
"border-left-color": parseColorDeclaration,
|
|
133
|
+
"border-left-width": parseBorderSideWidthDeclaration,
|
|
134
|
+
"border-radius": parseBorderRadius,
|
|
135
|
+
"border-right": parseBorderSide,
|
|
136
|
+
"border-right-color": parseColorDeclaration,
|
|
137
|
+
"border-right-width": parseBorderSideWidthDeclaration,
|
|
138
|
+
"border-start-end-radius": parseSize2DDimensionPercentageDeclaration,
|
|
139
|
+
"border-start-start-radius": parseSize2DDimensionPercentageDeclaration,
|
|
140
|
+
"border-style": parseBorderStyleDeclaration,
|
|
141
|
+
"border-top": parseBorderSide,
|
|
142
|
+
"border-top-color": parseColorDeclaration,
|
|
143
|
+
"border-top-left-radius": parseSize2DDimensionPercentageDeclaration,
|
|
144
|
+
"border-top-right-radius": parseSize2DDimensionPercentageDeclaration,
|
|
145
|
+
"border-top-width": parseBorderSideWidthDeclaration,
|
|
146
|
+
"border-width": parseBorderWidth,
|
|
147
|
+
"bottom": parseSizeDeclaration,
|
|
148
|
+
"box-shadow": parseBoxShadow,
|
|
149
|
+
"caret-color": parseColorOrAuto,
|
|
150
|
+
"color": parseFontColorDeclaration,
|
|
151
|
+
"column-gap": parseGap,
|
|
152
|
+
"container": parseContainer,
|
|
153
|
+
"container-name": parseContainerName,
|
|
154
|
+
"container-type": parseContainerType,
|
|
155
|
+
"display": parseDisplay,
|
|
156
|
+
"fill": parseSVGPaint,
|
|
157
|
+
"filter": parseFilter,
|
|
158
|
+
"flex": parseFlex,
|
|
159
|
+
"flex-basis": parseLengthPercentageOrAutoDeclaration,
|
|
160
|
+
"flex-direction": ({
|
|
161
|
+
value
|
|
162
|
+
}) => value,
|
|
163
|
+
"flex-flow": parseFlexFlow,
|
|
164
|
+
"flex-grow": ({
|
|
165
|
+
value
|
|
166
|
+
}) => value,
|
|
167
|
+
"flex-shrink": ({
|
|
168
|
+
value
|
|
169
|
+
}) => value,
|
|
170
|
+
"flex-wrap": ({
|
|
171
|
+
value
|
|
172
|
+
}) => value,
|
|
173
|
+
"font": parseFont,
|
|
174
|
+
"font-family": parseFontFamily,
|
|
175
|
+
"font-size": parseFontSizeDeclaration,
|
|
176
|
+
"font-style": parseFontStyleDeclaration,
|
|
177
|
+
"font-variant-caps": parseFontVariantCapsDeclaration,
|
|
178
|
+
"font-weight": parseFontWeightDeclaration,
|
|
179
|
+
"gap": parseGap,
|
|
180
|
+
"height": parseSizeDeclaration,
|
|
181
|
+
"inline-size": parseSizeDeclaration,
|
|
182
|
+
"inset": parseInset,
|
|
183
|
+
"inset-block": parseInsetBlock,
|
|
184
|
+
"inset-block-end": parseLengthPercentageOrAutoDeclaration,
|
|
185
|
+
"inset-block-start": parseLengthPercentageOrAutoDeclaration,
|
|
186
|
+
"inset-inline": parseInsetInline,
|
|
187
|
+
"inset-inline-end": parseLengthPercentageOrAutoDeclaration,
|
|
188
|
+
"inset-inline-start": parseLengthPercentageOrAutoDeclaration,
|
|
189
|
+
"justify-content": parseJustifyContent,
|
|
190
|
+
"left": parseSizeDeclaration,
|
|
191
|
+
"letter-spacing": parseLetterSpacing,
|
|
192
|
+
"line-height": parseLineHeightDeclaration,
|
|
193
|
+
"margin": parseMargin,
|
|
194
|
+
"margin-block": parseMarginBlock,
|
|
195
|
+
"margin-block-end": parseLengthPercentageOrAutoDeclaration,
|
|
196
|
+
"margin-block-start": parseLengthPercentageOrAutoDeclaration,
|
|
197
|
+
"margin-bottom": parseSizeDeclaration,
|
|
198
|
+
"margin-inline": parseMarginInline,
|
|
199
|
+
"margin-inline-end": parseLengthPercentageOrAutoDeclaration,
|
|
200
|
+
"margin-inline-start": parseLengthPercentageOrAutoDeclaration,
|
|
201
|
+
"margin-left": parseSizeDeclaration,
|
|
202
|
+
"margin-right": parseSizeDeclaration,
|
|
203
|
+
"margin-top": parseSizeDeclaration,
|
|
204
|
+
"max-block-size": parseSizeDeclaration,
|
|
205
|
+
"max-height": parseSizeDeclaration,
|
|
206
|
+
"max-inline-size": parseSizeDeclaration,
|
|
207
|
+
"max-width": parseSizeDeclaration,
|
|
208
|
+
"min-block-size": parseSizeDeclaration,
|
|
209
|
+
"min-height": parseSizeDeclaration,
|
|
210
|
+
"min-inline-size": parseSizeDeclaration,
|
|
211
|
+
"min-width": parseSizeDeclaration,
|
|
212
|
+
"opacity": ({
|
|
213
|
+
value
|
|
214
|
+
}) => value,
|
|
215
|
+
"overflow": parseOverflow,
|
|
216
|
+
"padding": parsePadding,
|
|
217
|
+
"padding-block": parsePaddingBlock,
|
|
218
|
+
"padding-block-end": parseLengthPercentageOrAutoDeclaration,
|
|
219
|
+
"padding-block-start": parseLengthPercentageOrAutoDeclaration,
|
|
220
|
+
"padding-bottom": parseSizeDeclaration,
|
|
221
|
+
"padding-inline": parsePaddingInline,
|
|
222
|
+
"padding-inline-end": parseLengthPercentageOrAutoDeclaration,
|
|
223
|
+
"padding-inline-start": parseLengthPercentageOrAutoDeclaration,
|
|
224
|
+
"padding-left": parseSizeDeclaration,
|
|
225
|
+
"padding-right": parseSizeDeclaration,
|
|
226
|
+
"padding-top": parseSizeDeclaration,
|
|
227
|
+
"position": parsePosition,
|
|
228
|
+
"right": parseSizeDeclaration,
|
|
229
|
+
"rotate": parseRotate,
|
|
230
|
+
"row-gap": parseGap,
|
|
231
|
+
"scale": parseScale,
|
|
232
|
+
"stroke": parseSVGPaint,
|
|
233
|
+
"stroke-width": parseLengthDeclaration,
|
|
234
|
+
"text-align": parseTextAlign,
|
|
235
|
+
"text-decoration": parseTextDecoration,
|
|
236
|
+
"text-decoration-color": parseColorDeclaration,
|
|
237
|
+
"text-decoration-line": parseTextDecorationLineDeclaration,
|
|
238
|
+
"text-decoration-style": parseTextDecorationStyle,
|
|
239
|
+
"text-shadow": parseTextShadow,
|
|
240
|
+
"text-transform": ({
|
|
241
|
+
value
|
|
242
|
+
}) => value.case,
|
|
243
|
+
"top": parseSizeDeclaration,
|
|
244
|
+
"transform": parseTransform,
|
|
245
|
+
"transition": addTransitionValue,
|
|
246
|
+
"transition-delay": addTransitionValue,
|
|
247
|
+
"transition-duration": addTransitionValue,
|
|
248
|
+
"transition-property": addTransitionValue,
|
|
249
|
+
"transition-timing-function": addTransitionValue,
|
|
250
|
+
"translate": parseTranslate,
|
|
251
|
+
"user-select": parseUserSelect,
|
|
252
|
+
"vertical-align": parseVerticalAlign,
|
|
253
|
+
"width": parseSizeDeclaration,
|
|
254
|
+
"z-index": parseZIndex
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
// This is missing LightningCSS types
|
|
258
|
+
parsers["pointer-events"] = parsePointerEvents;
|
|
259
|
+
const validProperties = new Set(Object.keys(parsers));
|
|
260
|
+
function parseDeclaration(declaration, builder) {
|
|
28
261
|
if ("vendorPrefix" in declaration && declaration.vendorPrefix.length) {
|
|
29
262
|
return;
|
|
30
263
|
}
|
|
@@ -32,661 +265,417 @@ function parseDeclaration(declaration, options, add, addWarning) {
|
|
|
32
265
|
return;
|
|
33
266
|
}
|
|
34
267
|
if (declaration.property === "unparsed") {
|
|
35
|
-
|
|
268
|
+
parseDeclarationUnparsed(declaration, builder);
|
|
36
269
|
} else if (declaration.property === "custom") {
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return addWarning("property", declaration.property);
|
|
270
|
+
parseDeclarationCustom(declaration, builder);
|
|
271
|
+
} else {
|
|
272
|
+
parseWithParser(declaration, builder);
|
|
41
273
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
274
|
+
}
|
|
275
|
+
function parseWithParser(declaration, builder) {
|
|
276
|
+
if (declaration.property in parsers) {
|
|
277
|
+
const parser = parsers[declaration.property];
|
|
278
|
+
builder.descriptorProperty = declaration.property;
|
|
279
|
+
const value = parser(declaration, builder, declaration.property);
|
|
280
|
+
if (value !== undefined) {
|
|
281
|
+
builder.addDescriptor(propertyRename[declaration.property] ?? declaration.property, value);
|
|
47
282
|
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
283
|
+
} else {
|
|
284
|
+
builder.addWarning("property", declaration.property);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function parseInsetBlock({
|
|
288
|
+
value
|
|
289
|
+
}, builder) {
|
|
290
|
+
builder.addShorthand("inset-block", {
|
|
291
|
+
"inset-block-start": parseLengthPercentageOrAuto(value.blockStart, builder),
|
|
292
|
+
"inset-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder)
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function parseInsetInline({
|
|
296
|
+
value
|
|
297
|
+
}, builder) {
|
|
298
|
+
builder.addShorthand("inset-inline", {
|
|
299
|
+
"inset-block-start": parseLengthPercentageOrAuto(value.inlineStart, builder),
|
|
300
|
+
"inset-block-end": parseLengthPercentageOrAuto(value.inlineEnd, builder)
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
function parseInset({
|
|
304
|
+
value
|
|
305
|
+
}, builder) {
|
|
306
|
+
builder.addShorthand("inset", {
|
|
307
|
+
top: parseLengthPercentageOrAuto(value.top, builder),
|
|
308
|
+
bottom: parseLengthPercentageOrAuto(value.bottom, builder),
|
|
309
|
+
left: parseLengthPercentageOrAuto(value.left, builder),
|
|
310
|
+
right: parseLengthPercentageOrAuto(value.right, builder)
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
function parseBorderRadius({
|
|
314
|
+
value
|
|
315
|
+
}, builder) {
|
|
316
|
+
builder.addShorthand("border-radius", {
|
|
317
|
+
"border-bottom-left-radius": parseSize2DDimensionPercentage(value.bottomLeft, builder),
|
|
318
|
+
"border-bottom-right-radius": parseSize2DDimensionPercentage(value.bottomRight, builder),
|
|
319
|
+
"border-top-left-radius": parseSize2DDimensionPercentage(value.topLeft, builder),
|
|
320
|
+
"border-top-right-radius": parseSize2DDimensionPercentage(value.topRight, builder)
|
|
321
|
+
});
|
|
322
|
+
}
|
|
323
|
+
function parseBorderColor({
|
|
324
|
+
value
|
|
325
|
+
}, builder) {
|
|
326
|
+
builder.addShorthand("border-color", {
|
|
327
|
+
"border-top-color": parseColor(value.top, builder),
|
|
328
|
+
"border-bottom-color": parseColor(value.bottom, builder),
|
|
329
|
+
"border-left-color": parseColor(value.left, builder),
|
|
330
|
+
"border-right-color": parseColor(value.right, builder)
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
function parseBorderWidth({
|
|
334
|
+
value
|
|
335
|
+
}, builder) {
|
|
336
|
+
builder.addShorthand("border-width", {
|
|
337
|
+
"border-top-width": parseBorderSideWidth(value.top, builder),
|
|
338
|
+
"border-bottom-width": parseBorderSideWidth(value.bottom, builder),
|
|
339
|
+
"border-left-width": parseBorderSideWidth(value.left, builder),
|
|
340
|
+
"border-right-width": parseBorderSideWidth(value.right, builder)
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
function parseBorder({
|
|
344
|
+
value
|
|
345
|
+
}, builder) {
|
|
346
|
+
builder.addShorthand("border", {
|
|
347
|
+
"border-width": parseBorderSideWidth(value.width, builder),
|
|
348
|
+
"border-style": parseBorderStyle(value.style, builder),
|
|
349
|
+
"border-color": parseColor(value.color, builder)
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
function parseBorderSide({
|
|
353
|
+
value,
|
|
354
|
+
property
|
|
355
|
+
}, builder) {
|
|
356
|
+
builder.addDescriptor(property + "-color", parseColor(value.color, builder));
|
|
357
|
+
builder.addDescriptor(property + "-width", parseBorderSideWidth(value.width, builder));
|
|
358
|
+
}
|
|
359
|
+
function parseBorderBlock({
|
|
360
|
+
value
|
|
361
|
+
}, builder) {
|
|
362
|
+
builder.addDescriptor("border-top-color", parseColor(value.color, builder));
|
|
363
|
+
builder.addDescriptor("border-bottom-color", parseColor(value.color, builder));
|
|
364
|
+
builder.addDescriptor("border-top-width", parseBorderSideWidth(value.width, builder));
|
|
365
|
+
builder.addDescriptor("border-bottom-width", parseBorderSideWidth(value.width, builder));
|
|
366
|
+
}
|
|
367
|
+
function parseBorderBlockStart({
|
|
368
|
+
value
|
|
369
|
+
}, builder) {
|
|
370
|
+
builder.addDescriptor("border-top-color", parseColor(value.color, builder));
|
|
371
|
+
builder.addDescriptor("border-top-width", parseBorderSideWidth(value.width, builder));
|
|
372
|
+
}
|
|
373
|
+
function parseBorderBlockEnd({
|
|
374
|
+
value
|
|
375
|
+
}, builder) {
|
|
376
|
+
builder.addDescriptor("border-bottom-color", parseColor(value.color, builder));
|
|
377
|
+
builder.addDescriptor("border-bottom-width", parseBorderSideWidth(value.width, builder));
|
|
378
|
+
}
|
|
379
|
+
function parseBorderInline({
|
|
380
|
+
value
|
|
381
|
+
}, builder) {
|
|
382
|
+
builder.addDescriptor("border-left-color", parseColor(value.color, builder));
|
|
383
|
+
builder.addDescriptor("border-right-color", parseColor(value.color, builder));
|
|
384
|
+
builder.addDescriptor("border-left-width", parseBorderSideWidth(value.width, builder));
|
|
385
|
+
builder.addDescriptor("border-right-width", parseBorderSideWidth(value.width, builder));
|
|
386
|
+
}
|
|
387
|
+
function parseBorderInlineStart({
|
|
388
|
+
value
|
|
389
|
+
}, builder) {
|
|
390
|
+
builder.addDescriptor("border-left-color", parseColor(value.color, builder));
|
|
391
|
+
builder.addDescriptor("border-left-width", parseBorderSideWidth(value.width, builder));
|
|
392
|
+
}
|
|
393
|
+
function parseBorderInlineEnd({
|
|
394
|
+
value
|
|
395
|
+
}, builder) {
|
|
396
|
+
builder.addDescriptor("border-right-color", parseColor(value.color, builder));
|
|
397
|
+
builder.addDescriptor("border-right-width", parseBorderSideWidth(value.width, builder));
|
|
398
|
+
}
|
|
399
|
+
function parseFlexFlow({
|
|
400
|
+
value
|
|
401
|
+
}, builder) {
|
|
402
|
+
builder.addDescriptor("flexWrap", value.wrap);
|
|
403
|
+
builder.addDescriptor("flexDirection", value.direction);
|
|
404
|
+
}
|
|
405
|
+
function parseFlex({
|
|
406
|
+
value
|
|
407
|
+
}, builder) {
|
|
408
|
+
builder.addDescriptor("flex-grow", value.grow);
|
|
409
|
+
builder.addDescriptor("flex-shrink", value.shrink);
|
|
410
|
+
builder.addDescriptor("flex-basis", parseLengthPercentageOrAuto(value.basis, builder));
|
|
411
|
+
}
|
|
412
|
+
function parseMargin({
|
|
413
|
+
value
|
|
414
|
+
}, builder) {
|
|
415
|
+
builder.addShorthand("margin", {
|
|
416
|
+
"margin-top": parseSize(value.top, builder, {
|
|
417
|
+
allowAuto: true
|
|
418
|
+
}),
|
|
419
|
+
"margin-bottom": parseSize(value.bottom, builder, {
|
|
420
|
+
allowAuto: true
|
|
421
|
+
}),
|
|
422
|
+
"margin-left": parseSize(value.left, builder, {
|
|
423
|
+
allowAuto: true
|
|
424
|
+
}),
|
|
425
|
+
"margin-right": parseSize(value.right, builder, {
|
|
426
|
+
allowAuto: true
|
|
427
|
+
})
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function parseMarginBlock({
|
|
431
|
+
value
|
|
432
|
+
}, builder) {
|
|
433
|
+
builder.addShorthand("margin-block", {
|
|
434
|
+
"margin-block-start": parseLengthPercentageOrAuto(value.blockStart, builder),
|
|
435
|
+
"margin-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder)
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
function parseMarginInline({
|
|
439
|
+
value
|
|
440
|
+
}, builder) {
|
|
441
|
+
builder.addShorthand("margin-inline", {
|
|
442
|
+
"margin-inline-start": parseLengthPercentageOrAuto(value.inlineStart, builder),
|
|
443
|
+
"margin-inline-end": parseLengthPercentageOrAuto(value.inlineEnd, builder)
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
function parsePadding({
|
|
447
|
+
value
|
|
448
|
+
}, builder) {
|
|
449
|
+
builder.addShorthand("padding", {
|
|
450
|
+
"padding-top": parseSize(value.top, builder),
|
|
451
|
+
"padding-bottom": parseSize(value.bottom, builder),
|
|
452
|
+
"padding-left": parseSize(value.left, builder),
|
|
453
|
+
"padding-right": parseSize(value.right, builder)
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function parsePaddingBlock({
|
|
457
|
+
value
|
|
458
|
+
}, builder) {
|
|
459
|
+
builder.addShorthand("padding-block", {
|
|
460
|
+
"padding-block-start": parseLengthPercentageOrAuto(value.blockStart, builder),
|
|
461
|
+
"padding-block-end": parseLengthPercentageOrAuto(value.blockEnd, builder)
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
function parsePaddingInline({
|
|
465
|
+
value
|
|
466
|
+
}, builder) {
|
|
467
|
+
builder.addShorthand("padding-inline", {
|
|
468
|
+
"padding-inline-start": parseLengthPercentageOrAuto(value.inlineStart, builder),
|
|
469
|
+
"padding-inline-end": parseLengthPercentageOrAuto(value.inlineEnd, builder)
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function parseFont({
|
|
473
|
+
value
|
|
474
|
+
}, builder) {
|
|
475
|
+
builder.addDescriptor("font-family", value.family[0]);
|
|
476
|
+
builder.addDescriptor("line-height", parseLineHeight(value.lineHeight, builder));
|
|
477
|
+
builder.addDescriptor("font-size", parseFontSize(value.size, builder));
|
|
478
|
+
builder.addDescriptor("font-style", parseFontStyle(value.style, builder));
|
|
479
|
+
builder.addDescriptor("font-variant-caps", parseFontVariantCaps(value.variantCaps, builder));
|
|
480
|
+
builder.addDescriptor("font-weight", parseFontWeight(value.weight, builder));
|
|
481
|
+
}
|
|
482
|
+
function parseTransform({
|
|
483
|
+
value
|
|
484
|
+
}, builder) {
|
|
485
|
+
builder.addDescriptor("transform", [{}, "@transform", value.flatMap(t => {
|
|
486
|
+
switch (t.type) {
|
|
487
|
+
case "perspective":
|
|
488
|
+
return [[{}, "@perspective", parseLength(t.value, builder)]];
|
|
489
|
+
case "translate":
|
|
490
|
+
return [[{}, "@translateX", parseLengthOrCoercePercentageToRuntime(t.value[0], builder)], [[{}, "@translateY", parseLengthOrCoercePercentageToRuntime(t.value[1], builder)]]];
|
|
491
|
+
case "translateX":
|
|
492
|
+
return [[{}, "@translateX", parseLengthOrCoercePercentageToRuntime(t.value, builder)]];
|
|
493
|
+
case "translateY":
|
|
494
|
+
return [[{}, "@translateY", parseLengthOrCoercePercentageToRuntime(t.value, builder)]];
|
|
495
|
+
case "rotate":
|
|
496
|
+
return [[{}, "@rotate", parseAngle(t.value, builder)]];
|
|
497
|
+
case "rotateX":
|
|
498
|
+
return [[{}, "@rotateX", parseAngle(t.value, builder)]];
|
|
499
|
+
case "rotateY":
|
|
500
|
+
return [[{}, "@rotateY", parseAngle(t.value, builder)]];
|
|
501
|
+
case "rotateZ":
|
|
502
|
+
return [[{}, "@rotateZ", parseAngle(t.value, builder)]];
|
|
503
|
+
case "scale":
|
|
504
|
+
return [[{}, "@scaleX", parseLength(t.value[0], builder)], [{}, "@scaleY", parseLength(t.value[1], builder)]];
|
|
505
|
+
case "scaleX":
|
|
506
|
+
return [[{}, "scaleX", parseLength(t.value, builder)]];
|
|
507
|
+
case "scaleY":
|
|
508
|
+
return [[{}, "scaleY", parseLength(t.value, builder)]];
|
|
509
|
+
case "skew":
|
|
510
|
+
return [[{}, "skewX", parseAngle(t.value[0], builder)], [{}, "skewY", parseAngle(t.value[1], builder)]];
|
|
511
|
+
case "skewX":
|
|
512
|
+
return [[{}, "skewX", parseAngle(t.value, builder)]];
|
|
513
|
+
case "skewY":
|
|
514
|
+
return [[{}, "skewY", parseAngle(t.value, builder)]];
|
|
515
|
+
case "translateZ":
|
|
516
|
+
case "translate3d":
|
|
517
|
+
case "scaleZ":
|
|
518
|
+
case "scale3d":
|
|
519
|
+
case "rotate3d":
|
|
520
|
+
case "matrix":
|
|
521
|
+
case "matrix3d":
|
|
522
|
+
return [[]];
|
|
56
523
|
}
|
|
524
|
+
})]);
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
function parseTranslate({
|
|
528
|
+
value
|
|
529
|
+
}, builder) {
|
|
530
|
+
builder.addDescriptor("translateX", [{}, "translateX", parseTranslateProp(value, "x", builder)]);
|
|
531
|
+
builder.addDescriptor("translateY", [{}, "translateY", parseTranslateProp(value, "y", builder)]);
|
|
532
|
+
}
|
|
533
|
+
function parseRotate({
|
|
534
|
+
value
|
|
535
|
+
}, builder) {
|
|
536
|
+
builder.addDescriptor("rotateX", [{}, "rotateX", parseAngle(value.x, builder)]);
|
|
537
|
+
builder.addDescriptor("rotateY", [{}, "rotateY", parseAngle(value.y, builder)]);
|
|
538
|
+
builder.addDescriptor("rotateZ", [{}, "rotateZ", parseAngle(value.z, builder)]);
|
|
539
|
+
}
|
|
540
|
+
function parseScale({
|
|
541
|
+
value
|
|
542
|
+
}, builder) {
|
|
543
|
+
builder.addDescriptor("scaleX", [{}, "scaleX", parseScaleValue(value, "x", builder)]);
|
|
544
|
+
builder.addDescriptor("scaleY", [{}, "scaleY", parseScaleValue(value, "y", builder)]);
|
|
545
|
+
}
|
|
546
|
+
function parseScaleValue(translate, prop, builder) {
|
|
547
|
+
if (translate === "none") {
|
|
548
|
+
return 0;
|
|
57
549
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
case "display":
|
|
66
|
-
return add("style", declaration.property, parseDisplay(declaration.value, parseOptions));
|
|
67
|
-
case "width":
|
|
68
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
69
|
-
case "height":
|
|
70
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
71
|
-
case "min-width":
|
|
72
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
73
|
-
case "min-height":
|
|
74
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
75
|
-
case "max-width":
|
|
76
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
77
|
-
case "max-height":
|
|
78
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
79
|
-
case "block-size":
|
|
80
|
-
return add("style", "width", parseSize(declaration.value, parseOptions));
|
|
81
|
-
case "inline-size":
|
|
82
|
-
return add("style", "height", parseSize(declaration.value, parseOptions));
|
|
83
|
-
case "min-block-size":
|
|
84
|
-
return add("style", "min-width", parseSize(declaration.value, parseOptions));
|
|
85
|
-
case "min-inline-size":
|
|
86
|
-
return add("style", "min-height", parseSize(declaration.value, parseOptions));
|
|
87
|
-
case "max-block-size":
|
|
88
|
-
return add("style", "max-width", parseSize(declaration.value, parseOptions));
|
|
89
|
-
case "max-inline-size":
|
|
90
|
-
return add("style", "max-height", parseSize(declaration.value, parseOptions));
|
|
91
|
-
case "overflow":
|
|
92
|
-
return add("style", declaration.property, parseOverflow(declaration.value.x, parseOptions));
|
|
93
|
-
case "position":
|
|
94
|
-
const value = declaration.value.type;
|
|
95
|
-
if (value === "absolute" || value === "relative") {
|
|
96
|
-
return add("style", declaration.property, value);
|
|
97
|
-
} else {
|
|
98
|
-
parseOptions.addWarning("value", value);
|
|
99
|
-
}
|
|
100
|
-
return;
|
|
101
|
-
case "top":
|
|
102
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
103
|
-
case "bottom":
|
|
104
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
105
|
-
case "left":
|
|
106
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
107
|
-
case "right":
|
|
108
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
109
|
-
case "inset-block-start":
|
|
110
|
-
return add("style", declaration.property, parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
111
|
-
case "inset-block-end":
|
|
112
|
-
return add("style", declaration.property, parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
113
|
-
case "inset-inline-start":
|
|
114
|
-
return add("style", declaration.property, parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
115
|
-
case "inset-inline-end":
|
|
116
|
-
return add("style", declaration.property, parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
117
|
-
case "inset-block":
|
|
118
|
-
return handleStyleShorthand("inset-block", {
|
|
119
|
-
"inset-block-start": parseLengthPercentageOrAuto(declaration.value.blockStart, parseOptions),
|
|
120
|
-
"inset-block-end": parseLengthPercentageOrAuto(declaration.value.blockEnd, parseOptions)
|
|
121
|
-
});
|
|
122
|
-
case "inset-inline":
|
|
123
|
-
return handleStyleShorthand("inset-inline", {
|
|
124
|
-
"inset-block-start": parseLengthPercentageOrAuto(declaration.value.inlineStart, parseOptions),
|
|
125
|
-
"inset-block-end": parseLengthPercentageOrAuto(declaration.value.inlineEnd, parseOptions)
|
|
126
|
-
});
|
|
127
|
-
case "inset":
|
|
128
|
-
handleStyleShorthand("inset", {
|
|
129
|
-
top: parseLengthPercentageOrAuto(declaration.value.top, {
|
|
130
|
-
...parseOptions,
|
|
131
|
-
addWarning: buildAddWarning(addWarning, "top")
|
|
132
|
-
}),
|
|
133
|
-
bottom: parseLengthPercentageOrAuto(declaration.value.bottom, {
|
|
134
|
-
...parseOptions,
|
|
135
|
-
addWarning: buildAddWarning(addWarning, "bottom")
|
|
136
|
-
}),
|
|
137
|
-
left: parseLengthPercentageOrAuto(declaration.value.left, {
|
|
138
|
-
...parseOptions,
|
|
139
|
-
addWarning: buildAddWarning(addWarning, "left")
|
|
140
|
-
}),
|
|
141
|
-
right: parseLengthPercentageOrAuto(declaration.value.right, {
|
|
142
|
-
...parseOptions,
|
|
143
|
-
addWarning: buildAddWarning(addWarning, "right")
|
|
144
|
-
})
|
|
145
|
-
});
|
|
146
|
-
return;
|
|
147
|
-
case "border-top-color":
|
|
148
|
-
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
149
|
-
case "border-bottom-color":
|
|
150
|
-
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
151
|
-
case "border-left-color":
|
|
152
|
-
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
153
|
-
case "border-right-color":
|
|
154
|
-
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
155
|
-
case "border-block-start-color":
|
|
156
|
-
return add("style", "border-top-color", parseColor(declaration.value, parseOptions));
|
|
157
|
-
case "border-block-end-color":
|
|
158
|
-
return add("style", "border-bottom-color", parseColor(declaration.value, parseOptions));
|
|
159
|
-
case "border-inline-start-color":
|
|
160
|
-
return add("style", "border-left-color", parseColor(declaration.value, parseOptions));
|
|
161
|
-
case "border-inline-end-color":
|
|
162
|
-
return add("style", "border-right-color", parseColor(declaration.value, parseOptions));
|
|
163
|
-
case "border-top-width":
|
|
164
|
-
return add("style", declaration.property, parseBorderSideWidth(declaration.value, parseOptions));
|
|
165
|
-
case "border-bottom-width":
|
|
166
|
-
return add("style", declaration.property, parseBorderSideWidth(declaration.value, parseOptions));
|
|
167
|
-
case "border-left-width":
|
|
168
|
-
return add("style", declaration.property, parseBorderSideWidth(declaration.value, parseOptions));
|
|
169
|
-
case "border-right-width":
|
|
170
|
-
return add("style", declaration.property, parseBorderSideWidth(declaration.value, parseOptions));
|
|
171
|
-
case "border-block-start-width":
|
|
172
|
-
return add("style", "border-top-width", parseBorderSideWidth(declaration.value, parseOptions));
|
|
173
|
-
case "border-block-end-width":
|
|
174
|
-
return add("style", "border-bottom-width", parseBorderSideWidth(declaration.value, parseOptions));
|
|
175
|
-
case "border-inline-start-width":
|
|
176
|
-
return add("style", "border-left-width", parseBorderSideWidth(declaration.value, parseOptions));
|
|
177
|
-
case "border-inline-end-width":
|
|
178
|
-
return add("style", "border-right-width", parseBorderSideWidth(declaration.value, parseOptions));
|
|
179
|
-
case "border-top-left-radius":
|
|
180
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
181
|
-
case "border-top-right-radius":
|
|
182
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
183
|
-
case "border-bottom-left-radius":
|
|
184
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
185
|
-
case "border-bottom-right-radius":
|
|
186
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
187
|
-
case "border-start-start-radius":
|
|
188
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
189
|
-
case "border-start-end-radius":
|
|
190
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
191
|
-
case "border-end-start-radius":
|
|
192
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
193
|
-
case "border-end-end-radius":
|
|
194
|
-
return add("style", declaration.property, parseLength(declaration.value[0], parseOptions));
|
|
195
|
-
case "border-radius":
|
|
196
|
-
handleStyleShorthand("border-radius", {
|
|
197
|
-
"border-bottom-left-radius": parseLength(declaration.value.bottomLeft[0], parseOptions),
|
|
198
|
-
"border-bottom-right-radius": parseLength(declaration.value.bottomRight[0], parseOptions),
|
|
199
|
-
"border-top-left-radius": parseLength(declaration.value.topLeft[0], parseOptions),
|
|
200
|
-
"border-top-right-radius": parseLength(declaration.value.topRight[0], parseOptions)
|
|
201
|
-
});
|
|
202
|
-
return;
|
|
203
|
-
case "border-color":
|
|
204
|
-
handleStyleShorthand("border-color", {
|
|
205
|
-
"border-top-color": parseColor(declaration.value.top, {
|
|
206
|
-
...parseOptions,
|
|
207
|
-
addWarning: buildAddWarning(addWarning, "border-top-color")
|
|
208
|
-
}),
|
|
209
|
-
"border-bottom-color": parseColor(declaration.value.bottom, {
|
|
210
|
-
...parseOptions,
|
|
211
|
-
addWarning: buildAddWarning(addWarning, "border-bottom-color")
|
|
212
|
-
}),
|
|
213
|
-
"border-left-color": parseColor(declaration.value.left, {
|
|
214
|
-
...parseOptions,
|
|
215
|
-
addWarning: buildAddWarning(addWarning, "border-left-color")
|
|
216
|
-
}),
|
|
217
|
-
"border-right-color": parseColor(declaration.value.right, {
|
|
218
|
-
...parseOptions,
|
|
219
|
-
addWarning: buildAddWarning(addWarning, "border-right-color")
|
|
220
|
-
})
|
|
221
|
-
});
|
|
222
|
-
return;
|
|
223
|
-
case "border-style":
|
|
224
|
-
return add("style", declaration.property, parseBorderStyle(declaration.value, parseOptions));
|
|
225
|
-
case "border-width":
|
|
226
|
-
handleStyleShorthand("border-width", {
|
|
227
|
-
"border-top-width": parseBorderSideWidth(declaration.value.top, parseOptions),
|
|
228
|
-
"border-bottom-width": parseBorderSideWidth(declaration.value.bottom, parseOptions),
|
|
229
|
-
"border-left-width": parseBorderSideWidth(declaration.value.left, parseOptions),
|
|
230
|
-
"border-right-width": parseBorderSideWidth(declaration.value.right, parseOptions)
|
|
231
|
-
});
|
|
232
|
-
return;
|
|
233
|
-
case "border-block-color":
|
|
234
|
-
add("style", "border-top-color", parseColor(declaration.value.start, parseOptions));
|
|
235
|
-
add("style", "border-bottom-color", parseColor(declaration.value.end, parseOptions));
|
|
236
|
-
return;
|
|
237
|
-
case "border-block-width":
|
|
238
|
-
add("style", "border-top-width", parseBorderSideWidth(declaration.value.start, parseOptions));
|
|
239
|
-
add("style", "border-bottom-width", parseBorderSideWidth(declaration.value.end, parseOptions));
|
|
240
|
-
return;
|
|
241
|
-
case "border-inline-color":
|
|
242
|
-
add("style", "border-left-color", parseColor(declaration.value.start, parseOptions));
|
|
243
|
-
add("style", "border-right-color", parseColor(declaration.value.end, parseOptions));
|
|
244
|
-
return;
|
|
245
|
-
case "border-inline-width":
|
|
246
|
-
add("style", "border-left-width", parseBorderSideWidth(declaration.value.start, parseOptions));
|
|
247
|
-
add("style", "border-right-width", parseBorderSideWidth(declaration.value.end, parseOptions));
|
|
248
|
-
return;
|
|
249
|
-
case "border":
|
|
250
|
-
handleStyleShorthand("border", {
|
|
251
|
-
"border-width": parseBorderSideWidth(declaration.value.width, parseOptions),
|
|
252
|
-
"border-style": parseBorderStyle(declaration.value.style, parseOptions)
|
|
253
|
-
});
|
|
254
|
-
return;
|
|
255
|
-
case "border-top":
|
|
256
|
-
add("style", declaration.property + "-color", parseColor(declaration.value.color, parseOptions));
|
|
257
|
-
add("style", declaration.property + "-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
258
|
-
return;
|
|
259
|
-
case "border-bottom":
|
|
260
|
-
add("style", declaration.property + "-color", parseColor(declaration.value.color, parseOptions));
|
|
261
|
-
add("style", declaration.property + "-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
262
|
-
return;
|
|
263
|
-
case "border-left":
|
|
264
|
-
add("style", declaration.property + "-color", parseColor(declaration.value.color, parseOptions));
|
|
265
|
-
add("style", declaration.property + "-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
266
|
-
return;
|
|
267
|
-
case "border-right":
|
|
268
|
-
add("style", declaration.property + "-color", parseColor(declaration.value.color, parseOptions));
|
|
269
|
-
add("style", declaration.property + "-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
270
|
-
return;
|
|
271
|
-
case "border-block":
|
|
272
|
-
add("style", "border-top-color", parseColor(declaration.value.color, parseOptions));
|
|
273
|
-
add("style", "border-bottom-color", parseColor(declaration.value.color, parseOptions));
|
|
274
|
-
add("style", "border-top-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
275
|
-
add("style", "border-bottom-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
276
|
-
return;
|
|
277
|
-
case "border-block-start":
|
|
278
|
-
add("style", "border-top-color", parseColor(declaration.value.color, parseOptions));
|
|
279
|
-
add("style", "border-top-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
280
|
-
return;
|
|
281
|
-
case "border-block-end":
|
|
282
|
-
add("style", "border-bottom-color", parseColor(declaration.value.color, parseOptions));
|
|
283
|
-
add("style", "border-bottom-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
284
|
-
return;
|
|
285
|
-
case "border-inline":
|
|
286
|
-
add("style", "border-left-color", parseColor(declaration.value.color, parseOptions));
|
|
287
|
-
add("style", "border-right-color", parseColor(declaration.value.color, parseOptions));
|
|
288
|
-
add("style", "border-left-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
289
|
-
add("style", "border-right-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
290
|
-
return;
|
|
291
|
-
case "border-inline-start":
|
|
292
|
-
add("style", "border-left-color", parseColor(declaration.value.color, parseOptions));
|
|
293
|
-
add("style", "border-left-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
294
|
-
return;
|
|
295
|
-
case "border-inline-end":
|
|
296
|
-
add("style", "border-right-color", parseColor(declaration.value.color, parseOptions));
|
|
297
|
-
add("style", "border-right-width", parseBorderSideWidth(declaration.value.width, parseOptions));
|
|
298
|
-
return;
|
|
299
|
-
case "flex-direction":
|
|
300
|
-
return add("style", declaration.property, declaration.value);
|
|
301
|
-
case "flex-wrap":
|
|
302
|
-
return add("style", declaration.property, declaration.value);
|
|
303
|
-
case "flex-flow":
|
|
304
|
-
add("style", "flexWrap", declaration.value.wrap);
|
|
305
|
-
add("style", "flexDirection", declaration.value.direction);
|
|
306
|
-
break;
|
|
307
|
-
case "flex-grow":
|
|
308
|
-
return add("style", declaration.property, declaration.value);
|
|
309
|
-
case "flex-shrink":
|
|
310
|
-
return add("style", declaration.property, declaration.value);
|
|
311
|
-
case "flex-basis":
|
|
312
|
-
return add("style", declaration.property, parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
313
|
-
case "flex":
|
|
314
|
-
add("style", "flex-grow", declaration.value.grow);
|
|
315
|
-
add("style", "flex-shrink", declaration.value.shrink);
|
|
316
|
-
add("style", "flex-basis", parseLengthPercentageOrAuto(declaration.value.basis, parseOptions));
|
|
317
|
-
break;
|
|
318
|
-
case "align-content":
|
|
319
|
-
return add("style", declaration.property, parseAlignContent(declaration.value, parseOptions));
|
|
320
|
-
case "justify-content":
|
|
321
|
-
return add("style", declaration.property, parseJustifyContent(declaration.value, parseOptions));
|
|
322
|
-
case "align-self":
|
|
323
|
-
return add("style", declaration.property, parseAlignSelf(declaration.value, parseOptions));
|
|
324
|
-
case "align-items":
|
|
325
|
-
return add("style", declaration.property, parseAlignItems(declaration.value, parseOptions));
|
|
326
|
-
case "row-gap":
|
|
327
|
-
return add("style", "row-gap", parseGap(declaration.value, parseOptions));
|
|
328
|
-
case "column-gap":
|
|
329
|
-
return add("style", "column-gap", parseGap(declaration.value, parseOptions));
|
|
330
|
-
case "gap":
|
|
331
|
-
add("style", "row-gap", parseGap(declaration.value.row, parseOptions));
|
|
332
|
-
add("style", "column-gap", parseGap(declaration.value.column, parseOptions));
|
|
333
|
-
return;
|
|
334
|
-
case "margin":
|
|
335
|
-
handleStyleShorthand("margin", {
|
|
336
|
-
"margin-top": parseSize(declaration.value.top, parseOptions, {
|
|
337
|
-
allowAuto: true
|
|
338
|
-
}),
|
|
339
|
-
"margin-bottom": parseSize(declaration.value.bottom, parseOptions, {
|
|
340
|
-
allowAuto: true
|
|
341
|
-
}),
|
|
342
|
-
"margin-left": parseSize(declaration.value.left, parseOptions, {
|
|
343
|
-
allowAuto: true
|
|
344
|
-
}),
|
|
345
|
-
"margin-right": parseSize(declaration.value.right, parseOptions, {
|
|
346
|
-
allowAuto: true
|
|
347
|
-
})
|
|
348
|
-
});
|
|
349
|
-
return;
|
|
350
|
-
case "margin-top":
|
|
351
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions, {
|
|
352
|
-
allowAuto: true
|
|
353
|
-
}));
|
|
354
|
-
case "margin-bottom":
|
|
355
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions, {
|
|
356
|
-
allowAuto: true
|
|
357
|
-
}));
|
|
358
|
-
case "margin-left":
|
|
359
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions, {
|
|
360
|
-
allowAuto: true
|
|
361
|
-
}));
|
|
362
|
-
case "margin-right":
|
|
363
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions, {
|
|
364
|
-
allowAuto: true
|
|
365
|
-
}));
|
|
366
|
-
case "margin-block-start":
|
|
367
|
-
return add("style", "margin-start", parseLengthPercentageOrAuto(declaration.value, parseOptions, {
|
|
368
|
-
allowAuto: true
|
|
369
|
-
}));
|
|
370
|
-
case "margin-block-end":
|
|
371
|
-
return add("style", "margin-end", parseLengthPercentageOrAuto(declaration.value, parseOptions, {
|
|
372
|
-
allowAuto: true
|
|
373
|
-
}));
|
|
374
|
-
case "margin-inline-start":
|
|
375
|
-
return add("style", "margin-start", parseLengthPercentageOrAuto(declaration.value, parseOptions, {
|
|
376
|
-
allowAuto: true
|
|
377
|
-
}));
|
|
378
|
-
case "margin-inline-end":
|
|
379
|
-
return add("style", "margin-end", parseLengthPercentageOrAuto(declaration.value, parseOptions, {
|
|
380
|
-
allowAuto: true
|
|
381
|
-
}));
|
|
382
|
-
case "margin-block":
|
|
383
|
-
handleStyleShorthand("margin-block", {
|
|
384
|
-
"margin-start": parseLengthPercentageOrAuto(declaration.value.blockStart, parseOptions),
|
|
385
|
-
"margin-end": parseLengthPercentageOrAuto(declaration.value.blockEnd, parseOptions)
|
|
386
|
-
});
|
|
387
|
-
return;
|
|
388
|
-
case "margin-inline":
|
|
389
|
-
handleStyleShorthand("margin-inline", {
|
|
390
|
-
"margin-start": parseLengthPercentageOrAuto(declaration.value.inlineStart, parseOptions),
|
|
391
|
-
"margin-end": parseLengthPercentageOrAuto(declaration.value.inlineEnd, parseOptions)
|
|
392
|
-
});
|
|
393
|
-
return;
|
|
394
|
-
case "padding":
|
|
395
|
-
handleStyleShorthand("padding", {
|
|
396
|
-
"padding-top": parseSize(declaration.value.top, parseOptions),
|
|
397
|
-
"padding-left": parseSize(declaration.value.left, parseOptions),
|
|
398
|
-
"padding-right": parseSize(declaration.value.right, parseOptions),
|
|
399
|
-
"padding-bottom": parseSize(declaration.value.bottom, parseOptions)
|
|
400
|
-
});
|
|
401
|
-
break;
|
|
402
|
-
case "padding-top":
|
|
403
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
404
|
-
case "padding-bottom":
|
|
405
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
406
|
-
case "padding-left":
|
|
407
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
408
|
-
case "padding-right":
|
|
409
|
-
return add("style", declaration.property, parseSize(declaration.value, parseOptions));
|
|
410
|
-
case "padding-block-start":
|
|
411
|
-
return add("style", "padding-start", parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
412
|
-
case "padding-block-end":
|
|
413
|
-
return add("style", "padding-end", parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
414
|
-
case "padding-inline-start":
|
|
415
|
-
return add("style", "padding-start", parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
416
|
-
case "padding-inline-end":
|
|
417
|
-
return add("style", "padding-end", parseLengthPercentageOrAuto(declaration.value, parseOptions));
|
|
418
|
-
case "padding-block":
|
|
419
|
-
handleStyleShorthand("padding-block", {
|
|
420
|
-
"padding-start": parseLengthPercentageOrAuto(declaration.value.blockStart, parseOptions),
|
|
421
|
-
"padding-end": parseLengthPercentageOrAuto(declaration.value.blockEnd, parseOptions)
|
|
422
|
-
});
|
|
423
|
-
return;
|
|
424
|
-
case "padding-inline":
|
|
425
|
-
handleStyleShorthand("padding-inline", {
|
|
426
|
-
"padding-start": parseLengthPercentageOrAuto(declaration.value.inlineStart, parseOptions),
|
|
427
|
-
"padding-end": parseLengthPercentageOrAuto(declaration.value.inlineEnd, parseOptions)
|
|
428
|
-
});
|
|
429
|
-
return;
|
|
430
|
-
case "font-weight":
|
|
431
|
-
return add("style", declaration.property, parseFontWeight(declaration.value, parseOptions));
|
|
432
|
-
case "font-size":
|
|
433
|
-
{
|
|
434
|
-
add("style", declaration.property, parseFontSize(declaration.value, parseOptions));
|
|
435
|
-
add("style", `--${_constants.emVariableName}`, parseFontSize(declaration.value, parseOptions));
|
|
436
|
-
return;
|
|
437
|
-
}
|
|
438
|
-
case "font-family":
|
|
439
|
-
return add("style", declaration.property, parseFontFamily(declaration.value));
|
|
440
|
-
case "font-style":
|
|
441
|
-
return add("style", declaration.property, parseFontStyle(declaration.value, parseOptions));
|
|
442
|
-
case "font-variant-caps":
|
|
443
|
-
return add("style", declaration.property, parseFontVariantCaps(declaration.value, parseOptions));
|
|
444
|
-
case "line-height":
|
|
445
|
-
return add("style", declaration.property, parseLineHeight(declaration.value, parseOptions));
|
|
446
|
-
case "font":
|
|
447
|
-
add("style", declaration.property + "-family", parseFontFamily(declaration.value.family));
|
|
448
|
-
add("style", "line-height", parseLineHeight(declaration.value.lineHeight, parseOptions));
|
|
449
|
-
add("style", declaration.property + "-size", parseFontSize(declaration.value.size, parseOptions));
|
|
450
|
-
add("style", declaration.property + "-style", parseFontStyle(declaration.value.style, parseOptions));
|
|
451
|
-
add("style", declaration.property + "-variant", parseFontVariantCaps(declaration.value.variantCaps, parseOptions));
|
|
452
|
-
add("style", declaration.property + "-weight", parseFontWeight(declaration.value.weight, parseOptions));
|
|
453
|
-
return;
|
|
454
|
-
case "vertical-align":
|
|
455
|
-
return add("style", declaration.property, parseVerticalAlign(declaration.value, parseOptions));
|
|
456
|
-
case "transition-property":
|
|
457
|
-
case "transition-duration":
|
|
458
|
-
case "transition-delay":
|
|
459
|
-
case "transition-timing-function":
|
|
460
|
-
case "transition":
|
|
461
|
-
return addTransitionValue(declaration, parseOptions);
|
|
462
|
-
case "animation-duration":
|
|
463
|
-
return add("animation", "animationDuration", declaration.value.map(t => parseTime(t)));
|
|
464
|
-
case "animation-timing-function":
|
|
465
|
-
case "animation-iteration-count":
|
|
466
|
-
case "animation-name":
|
|
467
|
-
case "animation-delay":
|
|
468
|
-
case "animation-direction":
|
|
469
|
-
case "animation-play-state":
|
|
470
|
-
case "animation-fill-mode":
|
|
471
|
-
case "animation":
|
|
472
|
-
return addAnimationValue(declaration, parseOptions);
|
|
473
|
-
case "transform":
|
|
474
|
-
{
|
|
475
|
-
add("style", "transform", [{}, "@transform", declaration.value.flatMap(t => {
|
|
476
|
-
switch (t.type) {
|
|
477
|
-
case "perspective":
|
|
478
|
-
return [[{}, "@perspective", [parseLength(t.value, parseOptions)]]];
|
|
479
|
-
case "translate":
|
|
480
|
-
return [[{}, "@translateX", [parseLengthOrCoercePercentageToRuntime(t.value[0], parseOptions)]], [[{}, "@translateY", [parseLengthOrCoercePercentageToRuntime(t.value[1], parseOptions)]]]];
|
|
481
|
-
case "translateX":
|
|
482
|
-
return [[{}, "@translateX", [parseLengthOrCoercePercentageToRuntime(t.value, parseOptions)]]];
|
|
483
|
-
case "translateY":
|
|
484
|
-
return [[{}, "@translateY", [parseLengthOrCoercePercentageToRuntime(t.value, parseOptions)]]];
|
|
485
|
-
case "rotate":
|
|
486
|
-
return [[{}, "@rotate", [parseAngle(t.value, parseOptions)]]];
|
|
487
|
-
case "rotateX":
|
|
488
|
-
return [[{}, "@rotateX", [parseAngle(t.value, parseOptions)]]];
|
|
489
|
-
case "rotateY":
|
|
490
|
-
return [[{}, "@rotateY", [parseAngle(t.value, parseOptions)]]];
|
|
491
|
-
case "rotateZ":
|
|
492
|
-
return [[{}, "@rotateZ", [parseAngle(t.value, parseOptions)]]];
|
|
493
|
-
case "scale":
|
|
494
|
-
return [[{}, "@scaleX", [parseLength(t.value[0], parseOptions)]], [{}, "@scaleY", [parseLength(t.value[0], parseOptions)]]];
|
|
495
|
-
case "scaleX":
|
|
496
|
-
return [[{}, "scaleX", [parseLength(t.value, parseOptions)]]];
|
|
497
|
-
case "scaleY":
|
|
498
|
-
return [[{}, "scaleY", [parseLength(t.value, parseOptions)]]];
|
|
499
|
-
case "skew":
|
|
500
|
-
return [[{}, "skewX", [parseAngle(t.value[0], parseOptions)]], [{}, "skewY", [parseAngle(t.value[0], parseOptions)]]];
|
|
501
|
-
case "skewX":
|
|
502
|
-
return [[{}, "skewX", [parseAngle(t.value, parseOptions)]]];
|
|
503
|
-
case "skewY":
|
|
504
|
-
return [[{}, "skewY", [parseAngle(t.value, parseOptions)]]];
|
|
505
|
-
case "translateZ":
|
|
506
|
-
case "translate3d":
|
|
507
|
-
case "scaleZ":
|
|
508
|
-
case "scale3d":
|
|
509
|
-
case "rotate3d":
|
|
510
|
-
case "matrix":
|
|
511
|
-
case "matrix3d":
|
|
512
|
-
return [[]];
|
|
513
|
-
}
|
|
514
|
-
})]);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
case "translate":
|
|
518
|
-
add("style", "translateX", [{}, "translateX", [parseTranslate(declaration.value, "x", parseOptions)]]);
|
|
519
|
-
add("style", "translateY", [{}, "translateX", [parseTranslate(declaration.value, "y", parseOptions)]]);
|
|
520
|
-
return;
|
|
521
|
-
case "rotate":
|
|
522
|
-
add("style", "rotateX", [{}, "rotateX", [parseAngle(declaration.value.x, parseOptions)]]);
|
|
523
|
-
add("style", "rotateY", [{}, "rotateY", [parseAngle(declaration.value.y, parseOptions)]]);
|
|
524
|
-
add("style", "rotateZ", [{}, "rotateZ", [parseAngle(declaration.value.z, parseOptions)]]);
|
|
525
|
-
return;
|
|
526
|
-
case "scale":
|
|
527
|
-
add("style", "scaleX", [{}, "scaleX", [parseScale(declaration.value, "x", parseOptions)]]);
|
|
528
|
-
add("style", "scaleY", [{}, "scaleY", [parseScale(declaration.value, "y", parseOptions)]]);
|
|
529
|
-
return;
|
|
530
|
-
case "text-transform":
|
|
531
|
-
return add("style", declaration.property, declaration.value.case);
|
|
532
|
-
case "letter-spacing":
|
|
533
|
-
if (declaration.value.type !== "normal") {
|
|
534
|
-
return add("style", declaration.property, parseLength(declaration.value.value, parseOptions));
|
|
535
|
-
}
|
|
536
|
-
return;
|
|
537
|
-
case "text-decoration-line":
|
|
538
|
-
return add("style", declaration.property, parseTextDecorationLine(declaration.value, parseOptions));
|
|
539
|
-
case "text-decoration-color":
|
|
540
|
-
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
541
|
-
case "text-decoration":
|
|
542
|
-
add("style", "text-decoration-color", parseColor(declaration.value.color, parseOptions));
|
|
543
|
-
add("style", "text-decoration-line", parseTextDecorationLine(declaration.value.line, parseOptions));
|
|
544
|
-
return;
|
|
545
|
-
case "text-shadow":
|
|
546
|
-
return parseTextShadow(add, declaration.value, parseOptions);
|
|
547
|
-
case "z-index":
|
|
548
|
-
if (declaration.value.type === "integer") {
|
|
549
|
-
add("style", declaration.property, parseLength(declaration.value.value, parseOptions));
|
|
550
|
-
} else {
|
|
551
|
-
parseOptions.addWarning("value", declaration.value.type);
|
|
552
|
-
}
|
|
553
|
-
return;
|
|
554
|
-
case "container-type":
|
|
555
|
-
return;
|
|
556
|
-
case "container-name":
|
|
557
|
-
return add("container", declaration.property, declaration.value.type === "none" ? false : declaration.value.value);
|
|
558
|
-
case "container":
|
|
559
|
-
return add("container", "container-name", declaration.value.name.type === "none" ? false : declaration.value.name.value);
|
|
560
|
-
case "text-decoration-style":
|
|
561
|
-
return add("style", declaration.property, parseTextDecorationStyle(declaration.value, parseOptions));
|
|
562
|
-
case "text-align":
|
|
563
|
-
return add("style", declaration.property, parseTextAlign(declaration.value, parseOptions));
|
|
564
|
-
case "box-shadow":
|
|
565
|
-
{
|
|
566
|
-
return parseBoxShadow(declaration.value, parseOptions);
|
|
567
|
-
}
|
|
568
|
-
case "aspect-ratio":
|
|
569
|
-
{
|
|
570
|
-
return add("style", declaration.property, parseAspectRatio(declaration.value));
|
|
571
|
-
}
|
|
572
|
-
case "user-select":
|
|
573
|
-
{
|
|
574
|
-
return add("style", declaration.property, parseUserSelect(declaration.value, parseOptions));
|
|
575
|
-
}
|
|
576
|
-
case "fill":
|
|
577
|
-
{
|
|
578
|
-
return add("style", declaration.property, parseSVGPaint(declaration.value, parseOptions));
|
|
579
|
-
}
|
|
580
|
-
case "stroke":
|
|
581
|
-
{
|
|
582
|
-
return add("style", declaration.property, parseSVGPaint(declaration.value, parseOptions));
|
|
583
|
-
}
|
|
584
|
-
case "stroke-width":
|
|
585
|
-
{
|
|
586
|
-
return add("style", declaration.property, parseDimensionPercentageFor_LengthValue(declaration.value, parseOptions));
|
|
587
|
-
}
|
|
588
|
-
case "caret-color":
|
|
589
|
-
{
|
|
590
|
-
return add("style", declaration.property, parseColorOrAuto(declaration.value, parseOptions));
|
|
591
|
-
}
|
|
592
|
-
default:
|
|
593
|
-
{
|
|
594
|
-
/**
|
|
595
|
-
* This is used to know when lightningcss has added a new property and we need to add it to the
|
|
596
|
-
* switch.
|
|
597
|
-
*
|
|
598
|
-
* If your build fails here, its because you have a newer version of lightningcss installed.
|
|
599
|
-
*/
|
|
600
|
-
declaration;
|
|
601
|
-
}
|
|
550
|
+
return parseLength(translate[prop], builder);
|
|
551
|
+
}
|
|
552
|
+
function parseLetterSpacing({
|
|
553
|
+
value
|
|
554
|
+
}, builder) {
|
|
555
|
+
if (value.type === "normal") {
|
|
556
|
+
return;
|
|
602
557
|
}
|
|
558
|
+
return parseLength(value.value, builder);
|
|
603
559
|
}
|
|
604
|
-
function
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
return addWarning(type, property, value);
|
|
610
|
-
}
|
|
611
|
-
};
|
|
560
|
+
function parseTextDecoration({
|
|
561
|
+
value
|
|
562
|
+
}, builder) {
|
|
563
|
+
builder.addDescriptor("text-decoration-color", parseColor(value.color, builder));
|
|
564
|
+
builder.addDescriptor("text-decoration-line", parseTextDecorationLine(value.line, builder));
|
|
612
565
|
}
|
|
613
|
-
function
|
|
566
|
+
function parseZIndex({
|
|
567
|
+
value
|
|
568
|
+
}, builder) {
|
|
569
|
+
if (value.type === "integer") {
|
|
570
|
+
return parseLength(value.value, builder);
|
|
571
|
+
} else {
|
|
572
|
+
builder.addWarning("value", value.type);
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
function parseContainerType(_value, _builder) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
function parseContainerName({
|
|
580
|
+
value
|
|
581
|
+
}, builder) {
|
|
582
|
+
builder.addContainer(value.type === "none" ? false : value.value);
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
function parseContainer({
|
|
586
|
+
value
|
|
587
|
+
}, builder) {
|
|
588
|
+
builder.addContainer(value.name.type === "none" ? false : value.name.value);
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
function parseDeclarationUnparsed(declaration, builder) {
|
|
614
592
|
let property = declaration.value.propertyId.property;
|
|
615
|
-
if (!
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
...options,
|
|
620
|
-
add,
|
|
621
|
-
addWarning: buildAddWarning(addWarning, property)
|
|
622
|
-
};
|
|
593
|
+
if (!(property in parsers)) {
|
|
594
|
+
builder.addWarning("property", property);
|
|
595
|
+
return;
|
|
596
|
+
}
|
|
623
597
|
|
|
624
598
|
/**
|
|
625
599
|
* React Native doesn't support all the logical properties
|
|
626
600
|
*/
|
|
627
|
-
|
|
628
|
-
|
|
601
|
+
const rename = propertyRename[property];
|
|
602
|
+
if (rename) {
|
|
603
|
+
property = rename;
|
|
629
604
|
}
|
|
630
605
|
|
|
631
606
|
/**
|
|
632
607
|
* Unparsed shorthand properties need to be parsed at runtime
|
|
633
608
|
*/
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
args = [args];
|
|
638
|
-
}
|
|
609
|
+
builder.descriptorProperty = property;
|
|
610
|
+
if (unparsedRuntimeParsing.has(property)) {
|
|
611
|
+
const args = parseUnparsed(declaration.value.value, builder);
|
|
639
612
|
if (property === "animation") {
|
|
640
|
-
|
|
613
|
+
builder.addDescriptor("animation", [{}, `@${(0, _selectors.toRNProperty)(property)}`, args]);
|
|
641
614
|
} else {
|
|
642
|
-
|
|
615
|
+
builder.addDescriptor(property, [{}, `@${(0, _selectors.toRNProperty)(property)}`, args, 1]);
|
|
643
616
|
}
|
|
644
|
-
}
|
|
645
|
-
return add("style", property, parseUnparsed(declaration.value.value, parseOptions));
|
|
646
|
-
}
|
|
647
|
-
function parseDeclarationCustom(declaration, options, add, addWarning) {
|
|
648
|
-
const parseOptions = {
|
|
649
|
-
...options,
|
|
650
|
-
add,
|
|
651
|
-
addWarning(type, value) {
|
|
652
|
-
if (type === "property") {
|
|
653
|
-
return addWarning(type, property);
|
|
654
|
-
} else if (type === "value") {
|
|
655
|
-
return addWarning(type, property, value);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
let property = declaration.value.name;
|
|
660
|
-
if (validPropertiesLoose.has(property) || property.startsWith("--") || property.startsWith("-rn-")) {
|
|
661
|
-
return add("style", property, parseUnparsed(declaration.value.value, {
|
|
662
|
-
...parseOptions,
|
|
663
|
-
allowAuto: allowAuto.has(property)
|
|
664
|
-
}));
|
|
665
617
|
} else {
|
|
666
|
-
|
|
618
|
+
const value = parseUnparsed(declaration.value.value, builder);
|
|
619
|
+
builder.addDescriptor(property, value);
|
|
620
|
+
if (property === "font-size") {
|
|
621
|
+
builder.addDescriptor("--__rn-css-em", value);
|
|
622
|
+
}
|
|
623
|
+
if (property === "color") {
|
|
624
|
+
builder.addDescriptor("--__rn-css-current-color", value);
|
|
625
|
+
}
|
|
667
626
|
}
|
|
668
627
|
}
|
|
669
|
-
function
|
|
670
|
-
|
|
628
|
+
function parseDeclarationCustom(declaration, builder) {
|
|
629
|
+
const property = declaration.value.name;
|
|
630
|
+
if (validProperties.has(property) || property.startsWith("--") || property.startsWith("-rn-")) {
|
|
631
|
+
builder.addDescriptor(property, parseUnparsed(declaration.value.value, builder, allowAuto.has(property)));
|
|
632
|
+
} else {
|
|
633
|
+
builder.addWarning("property", declaration.value.name);
|
|
634
|
+
}
|
|
671
635
|
}
|
|
672
|
-
function reduceParseUnparsed(tokenOrValues,
|
|
673
|
-
const result = tokenOrValues.map(tokenOrValue => parseUnparsed(tokenOrValue,
|
|
636
|
+
function reduceParseUnparsed(tokenOrValues, builder) {
|
|
637
|
+
const result = tokenOrValues.map(tokenOrValue => parseUnparsed(tokenOrValue, builder)).filter(v => v !== undefined);
|
|
674
638
|
if (result.length === 0) {
|
|
675
639
|
return undefined;
|
|
676
|
-
} else {
|
|
677
|
-
return result;
|
|
678
640
|
}
|
|
641
|
+
let currentGroup = [];
|
|
642
|
+
let groups = [currentGroup];
|
|
643
|
+
for (const value of result) {
|
|
644
|
+
if (value === CommaSeparator) {
|
|
645
|
+
currentGroup = [];
|
|
646
|
+
groups.push(currentGroup);
|
|
647
|
+
} else {
|
|
648
|
+
currentGroup.push(value);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
groups = groups.flatMap(group => {
|
|
652
|
+
if (!Array.isArray(group)) {
|
|
653
|
+
return [];
|
|
654
|
+
}
|
|
655
|
+
if (group.length === 0) {
|
|
656
|
+
return [];
|
|
657
|
+
} else if (group.length === 1) {
|
|
658
|
+
const first = group[0];
|
|
659
|
+
if (first === undefined) {
|
|
660
|
+
return [];
|
|
661
|
+
} else {
|
|
662
|
+
return [first];
|
|
663
|
+
}
|
|
664
|
+
} else {
|
|
665
|
+
return [group];
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
return groups.length === 1 ? groups[0] : groups;
|
|
679
669
|
}
|
|
680
|
-
function unparsedFunction(token,
|
|
681
|
-
|
|
682
|
-
return [{}, token.value.name, args];
|
|
670
|
+
function unparsedFunction(token, builder) {
|
|
671
|
+
return [{}, token.value.name, reduceParseUnparsed(token.value.arguments, builder)];
|
|
683
672
|
}
|
|
684
673
|
|
|
685
674
|
/**
|
|
686
675
|
* When the CSS cannot be parsed (often due to a runtime condition like a CSS variable)
|
|
687
|
-
* This function best efforts parsing it into a function that we can evaluate at runtime
|
|
676
|
+
* This export function best efforts parsing it into a export function that we can evaluate at runtime
|
|
688
677
|
*/
|
|
689
|
-
function parseUnparsed(tokenOrValue,
|
|
678
|
+
function parseUnparsed(tokenOrValue, builder, allowAuto = false) {
|
|
690
679
|
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
691
680
|
return;
|
|
692
681
|
}
|
|
@@ -695,6 +684,8 @@ function parseUnparsed(tokenOrValue, options) {
|
|
|
695
684
|
return true;
|
|
696
685
|
} else if (tokenOrValue === "false") {
|
|
697
686
|
return false;
|
|
687
|
+
} else if (tokenOrValue === "currentcolor") {
|
|
688
|
+
return [{}, "var", "__rn-css-current-color"];
|
|
698
689
|
} else {
|
|
699
690
|
return tokenOrValue;
|
|
700
691
|
}
|
|
@@ -703,22 +694,22 @@ function parseUnparsed(tokenOrValue, options) {
|
|
|
703
694
|
return round(tokenOrValue);
|
|
704
695
|
}
|
|
705
696
|
if (Array.isArray(tokenOrValue)) {
|
|
706
|
-
const args = reduceParseUnparsed(tokenOrValue,
|
|
697
|
+
const args = reduceParseUnparsed(tokenOrValue, builder);
|
|
707
698
|
if (!args) return;
|
|
708
|
-
if (args.length === 1) return args[0];
|
|
699
|
+
if (Array.isArray(args) && args.length === 1) return args[0];
|
|
709
700
|
return args;
|
|
710
701
|
}
|
|
711
702
|
switch (tokenOrValue.type) {
|
|
712
703
|
case "unresolved-color":
|
|
713
704
|
{
|
|
714
|
-
return parseUnresolvedColor(tokenOrValue.value,
|
|
705
|
+
return parseUnresolvedColor(tokenOrValue.value, builder);
|
|
715
706
|
}
|
|
716
707
|
case "var":
|
|
717
708
|
{
|
|
718
|
-
|
|
719
|
-
const fallback = parseUnparsed(tokenOrValue.value.fallback,
|
|
709
|
+
let args = tokenOrValue.value.name.ident.slice(2);
|
|
710
|
+
const fallback = parseUnparsed(tokenOrValue.value.fallback, builder);
|
|
720
711
|
if (fallback !== undefined) {
|
|
721
|
-
args
|
|
712
|
+
args = [args, fallback];
|
|
722
713
|
}
|
|
723
714
|
return [{}, "var", args, 1];
|
|
724
715
|
}
|
|
@@ -737,72 +728,86 @@ function parseUnparsed(tokenOrValue, options) {
|
|
|
737
728
|
case "translateX":
|
|
738
729
|
case "translateY":
|
|
739
730
|
tokenOrValue.value.name = `@${tokenOrValue.value.name}`;
|
|
740
|
-
return unparsedFunction(tokenOrValue,
|
|
741
|
-
case "
|
|
742
|
-
case "
|
|
743
|
-
case "
|
|
744
|
-
case "
|
|
731
|
+
return unparsedFunction(tokenOrValue, builder);
|
|
732
|
+
case "brightness":
|
|
733
|
+
case "contrast":
|
|
734
|
+
case "cubic-bezier":
|
|
735
|
+
case "drop-shadow":
|
|
745
736
|
case "fontScale":
|
|
746
|
-
case "
|
|
747
|
-
case "rgb":
|
|
748
|
-
case "rgba":
|
|
737
|
+
case "grayscale":
|
|
749
738
|
case "hsl":
|
|
750
739
|
case "hsla":
|
|
751
|
-
|
|
740
|
+
case "hue-rotate":
|
|
741
|
+
case "invert":
|
|
742
|
+
case "linear-gradient":
|
|
743
|
+
case "opacity":
|
|
744
|
+
case "pixelScale":
|
|
745
|
+
case "pixelSizeForLayoutSize":
|
|
746
|
+
case "platformColor":
|
|
747
|
+
case "radial-gradient":
|
|
748
|
+
case "rgb":
|
|
749
|
+
case "rgba":
|
|
750
|
+
case "roundToNearestPixel":
|
|
751
|
+
case "saturate":
|
|
752
|
+
case "sepia":
|
|
753
|
+
case "shadow":
|
|
754
|
+
case "steps":
|
|
755
|
+
return unparsedFunction(tokenOrValue, builder);
|
|
752
756
|
case "hairlineWidth":
|
|
753
757
|
return [{}, tokenOrValue.value.name, []];
|
|
754
|
-
case "platformSelect":
|
|
755
|
-
case "fontScaleSelect":
|
|
756
|
-
case "pixelScaleSelect":
|
|
757
|
-
return parseRNRuntimeSpecificsFunction(tokenOrValue.value.name, tokenOrValue.value.arguments, options);
|
|
758
758
|
case "calc":
|
|
759
759
|
case "max":
|
|
760
760
|
case "min":
|
|
761
761
|
case "clamp":
|
|
762
|
-
return parseCalcFn(tokenOrValue.value.name, tokenOrValue.value.arguments,
|
|
762
|
+
return parseCalcFn(tokenOrValue.value.name, tokenOrValue.value.arguments, builder);
|
|
763
763
|
default:
|
|
764
764
|
{
|
|
765
|
-
|
|
765
|
+
builder.addWarning("function", tokenOrValue.value.name);
|
|
766
766
|
return;
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
}
|
|
770
770
|
case "length":
|
|
771
|
-
return parseLength(tokenOrValue.value,
|
|
771
|
+
return parseLength(tokenOrValue.value, builder);
|
|
772
772
|
case "angle":
|
|
773
|
-
return parseAngle(tokenOrValue.value,
|
|
773
|
+
return parseAngle(tokenOrValue.value, builder);
|
|
774
774
|
case "token":
|
|
775
775
|
switch (tokenOrValue.value.type) {
|
|
776
776
|
case "string":
|
|
777
|
-
case "number":
|
|
778
777
|
case "ident":
|
|
779
778
|
{
|
|
780
779
|
const value = tokenOrValue.value.value;
|
|
781
|
-
if (
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
780
|
+
if (!allowAuto && value === "auto") {
|
|
781
|
+
builder.addWarning("value", value);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
if (value === "inherit") {
|
|
785
|
+
builder.addWarning("value", value);
|
|
786
|
+
return;
|
|
787
|
+
} else if (value === "currentcolor") {
|
|
788
|
+
return [{}, "var", "__rn-css-current-color"];
|
|
789
|
+
}
|
|
790
|
+
if (value === "true") {
|
|
791
|
+
return true;
|
|
792
|
+
} else if (value === "false") {
|
|
793
|
+
return false;
|
|
795
794
|
} else {
|
|
796
795
|
return value;
|
|
797
796
|
}
|
|
798
797
|
}
|
|
798
|
+
case "number":
|
|
799
|
+
{
|
|
800
|
+
return round(tokenOrValue.value.value);
|
|
801
|
+
}
|
|
799
802
|
case "function":
|
|
800
|
-
|
|
803
|
+
builder.addWarning("value", tokenOrValue.value.value);
|
|
801
804
|
return;
|
|
802
805
|
case "percentage":
|
|
803
806
|
return `${round(tokenOrValue.value.value * 100)}%`;
|
|
804
807
|
case "dimension":
|
|
805
|
-
return parseDimension(tokenOrValue.value,
|
|
808
|
+
return parseDimension(tokenOrValue.value, builder);
|
|
809
|
+
case "comma":
|
|
810
|
+
return CommaSeparator;
|
|
806
811
|
case "at-keyword":
|
|
807
812
|
case "hash":
|
|
808
813
|
case "id-hash":
|
|
@@ -812,7 +817,6 @@ function parseUnparsed(tokenOrValue, options) {
|
|
|
812
817
|
case "comment":
|
|
813
818
|
case "colon":
|
|
814
819
|
case "semicolon":
|
|
815
|
-
case "comma":
|
|
816
820
|
case "include-match":
|
|
817
821
|
case "dash-match":
|
|
818
822
|
case "prefix-match":
|
|
@@ -836,9 +840,9 @@ function parseUnparsed(tokenOrValue, options) {
|
|
|
836
840
|
}
|
|
837
841
|
}
|
|
838
842
|
case "color":
|
|
839
|
-
return parseColor(tokenOrValue.value,
|
|
843
|
+
return parseColor(tokenOrValue.value, builder);
|
|
840
844
|
case "env":
|
|
841
|
-
return parseEnv(tokenOrValue.value,
|
|
845
|
+
return parseEnv(tokenOrValue.value, builder);
|
|
842
846
|
case "time":
|
|
843
847
|
return parseTime(tokenOrValue.value);
|
|
844
848
|
case "url":
|
|
@@ -853,10 +857,13 @@ function parseUnparsed(tokenOrValue, options) {
|
|
|
853
857
|
}
|
|
854
858
|
return;
|
|
855
859
|
}
|
|
856
|
-
function
|
|
860
|
+
function parseLengthDeclaration(declaration, builder) {
|
|
861
|
+
return parseLength(declaration.value, builder);
|
|
862
|
+
}
|
|
863
|
+
function parseLength(length, builder) {
|
|
857
864
|
const {
|
|
858
865
|
inlineRem = 14
|
|
859
|
-
} =
|
|
866
|
+
} = builder.getOptions();
|
|
860
867
|
if (typeof length === "number") {
|
|
861
868
|
return length;
|
|
862
869
|
}
|
|
@@ -868,12 +875,12 @@ function parseLength(length, options) {
|
|
|
868
875
|
if (typeof inlineRem === "number") {
|
|
869
876
|
return length.value * inlineRem;
|
|
870
877
|
} else {
|
|
871
|
-
return [{}, "rem",
|
|
878
|
+
return [{}, "rem", length.value];
|
|
872
879
|
}
|
|
873
880
|
case "vw":
|
|
874
881
|
case "vh":
|
|
875
882
|
case "em":
|
|
876
|
-
return [{}, length.unit,
|
|
883
|
+
return [{}, length.unit, length.value, 1];
|
|
877
884
|
case "in":
|
|
878
885
|
case "cm":
|
|
879
886
|
case "mm":
|
|
@@ -918,7 +925,7 @@ function parseLength(length, options) {
|
|
|
918
925
|
case "lvmax":
|
|
919
926
|
case "dvmax":
|
|
920
927
|
case "cqmax":
|
|
921
|
-
|
|
928
|
+
builder.addWarning("value", `${length.value}${length.unit}`);
|
|
922
929
|
return undefined;
|
|
923
930
|
default:
|
|
924
931
|
{
|
|
@@ -943,13 +950,13 @@ function parseLength(length, options) {
|
|
|
943
950
|
case "dimension":
|
|
944
951
|
case "value":
|
|
945
952
|
{
|
|
946
|
-
return parseLength(length.value,
|
|
953
|
+
return parseLength(length.value, builder);
|
|
947
954
|
}
|
|
948
955
|
}
|
|
949
956
|
}
|
|
950
957
|
return;
|
|
951
958
|
}
|
|
952
|
-
function parseAngle(angle,
|
|
959
|
+
function parseAngle(angle, builder) {
|
|
953
960
|
if (typeof angle === "number") {
|
|
954
961
|
return `${angle}deg`;
|
|
955
962
|
}
|
|
@@ -958,23 +965,47 @@ function parseAngle(angle, options) {
|
|
|
958
965
|
case "rad":
|
|
959
966
|
return `${angle.value}${angle.type}`;
|
|
960
967
|
default:
|
|
961
|
-
|
|
968
|
+
builder.addWarning("value", angle.value);
|
|
962
969
|
return undefined;
|
|
963
970
|
}
|
|
964
971
|
}
|
|
965
|
-
function
|
|
972
|
+
function parseSizeDeclaration(declaration, builder) {
|
|
973
|
+
return parseSize(declaration.value, builder);
|
|
974
|
+
}
|
|
975
|
+
function parsePointerEvents({
|
|
976
|
+
value
|
|
977
|
+
}, builder) {
|
|
978
|
+
switch (value) {
|
|
979
|
+
case "none":
|
|
980
|
+
case "box-none":
|
|
981
|
+
case "box-only":
|
|
982
|
+
case "auto":
|
|
983
|
+
return value;
|
|
984
|
+
case "visible":
|
|
985
|
+
case "visiblePainted":
|
|
986
|
+
case "visibleFill":
|
|
987
|
+
case "visibleStroke":
|
|
988
|
+
case "painted":
|
|
989
|
+
case "fill":
|
|
990
|
+
case "stroke":
|
|
991
|
+
builder.addWarning("value", value);
|
|
992
|
+
}
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
function parseSize(size, builder, options, {
|
|
966
996
|
allowAuto = false
|
|
967
997
|
} = {}) {
|
|
998
|
+
allowAuto = (typeof options === "object" ? options.allowAuto : allowAuto) ?? false;
|
|
968
999
|
switch (size.type) {
|
|
969
1000
|
case "length-percentage":
|
|
970
|
-
return parseLength(size.value,
|
|
1001
|
+
return parseLength(size.value, builder);
|
|
971
1002
|
case "none":
|
|
972
1003
|
return size.type;
|
|
973
1004
|
case "auto":
|
|
974
1005
|
if (allowAuto) {
|
|
975
1006
|
return size.type;
|
|
976
1007
|
} else {
|
|
977
|
-
|
|
1008
|
+
builder.addWarning("value", size.type);
|
|
978
1009
|
return undefined;
|
|
979
1010
|
}
|
|
980
1011
|
case "min-content":
|
|
@@ -983,7 +1014,7 @@ function parseSize(size, options, {
|
|
|
983
1014
|
case "fit-content-function":
|
|
984
1015
|
case "stretch":
|
|
985
1016
|
case "contain":
|
|
986
|
-
|
|
1017
|
+
builder.addWarning("value", size.type);
|
|
987
1018
|
return undefined;
|
|
988
1019
|
default:
|
|
989
1020
|
{
|
|
@@ -992,58 +1023,174 @@ function parseSize(size, options, {
|
|
|
992
1023
|
}
|
|
993
1024
|
return;
|
|
994
1025
|
}
|
|
995
|
-
function parseColorOrAuto(
|
|
996
|
-
|
|
997
|
-
|
|
1026
|
+
function parseColorOrAuto({
|
|
1027
|
+
value
|
|
1028
|
+
}, builder) {
|
|
1029
|
+
if (value.type === "auto") {
|
|
1030
|
+
builder.addWarning("value", `Invalid color value ${value.type}`);
|
|
998
1031
|
return;
|
|
999
1032
|
} else {
|
|
1000
|
-
return parseColor(
|
|
1033
|
+
return parseColor(value.value, builder);
|
|
1001
1034
|
}
|
|
1002
1035
|
}
|
|
1003
|
-
function
|
|
1004
|
-
|
|
1005
|
-
|
|
1036
|
+
function parseFontColorDeclaration(declaration, builder) {
|
|
1037
|
+
parseColorDeclaration(declaration, builder);
|
|
1038
|
+
builder.addDescriptor("--__rn-css-color", parseColor(declaration.value, builder));
|
|
1039
|
+
}
|
|
1040
|
+
function parseColorDeclaration(declaration, builder) {
|
|
1041
|
+
builder.addDescriptor(declaration.property, parseColor(declaration.value, builder));
|
|
1042
|
+
}
|
|
1043
|
+
function parseColor(cssColor, builder) {
|
|
1044
|
+
if (typeof cssColor === "string") {
|
|
1045
|
+
if (namedColors.has(cssColor)) {
|
|
1046
|
+
return cssColor;
|
|
1047
|
+
}
|
|
1006
1048
|
return;
|
|
1007
1049
|
}
|
|
1008
|
-
|
|
1050
|
+
let color;
|
|
1051
|
+
const {
|
|
1052
|
+
hexColors = true,
|
|
1053
|
+
colorPrecision
|
|
1054
|
+
} = builder.getOptions();
|
|
1055
|
+
switch (cssColor.type) {
|
|
1056
|
+
case "currentcolor":
|
|
1057
|
+
return [{}, "var", "__rn-css-current-color"];
|
|
1058
|
+
case "light-dark":
|
|
1059
|
+
{
|
|
1060
|
+
const extraRule = {
|
|
1061
|
+
s: [],
|
|
1062
|
+
m: [["=", "prefers-color-scheme", "dark"]]
|
|
1063
|
+
};
|
|
1064
|
+
builder.addUnnamedDescriptor(parseColor(cssColor.dark, builder), false, extraRule);
|
|
1065
|
+
builder.addExtraRule(extraRule);
|
|
1066
|
+
return parseColor(cssColor.light, builder);
|
|
1067
|
+
}
|
|
1009
1068
|
case "rgb":
|
|
1010
1069
|
{
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1070
|
+
color = new _colorjs.default({
|
|
1071
|
+
space: "sRGB",
|
|
1072
|
+
coords: [cssColor.r / 255, cssColor.g / 255, cssColor.b / 255],
|
|
1073
|
+
alpha: cssColor.alpha
|
|
1074
|
+
});
|
|
1075
|
+
break;
|
|
1017
1076
|
}
|
|
1018
1077
|
case "hsl":
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1078
|
+
color = new _colorjs.default({
|
|
1079
|
+
space: cssColor.type,
|
|
1080
|
+
coords: [cssColor.h, cssColor.s, cssColor.l],
|
|
1081
|
+
alpha: cssColor.alpha
|
|
1082
|
+
});
|
|
1083
|
+
break;
|
|
1084
|
+
case "hwb":
|
|
1085
|
+
color = new _colorjs.default({
|
|
1086
|
+
space: cssColor.type,
|
|
1087
|
+
coords: [cssColor.h, cssColor.w, cssColor.b],
|
|
1088
|
+
alpha: cssColor.alpha
|
|
1089
|
+
});
|
|
1090
|
+
break;
|
|
1024
1091
|
case "lab":
|
|
1092
|
+
color = new _colorjs.default({
|
|
1093
|
+
space: cssColor.type,
|
|
1094
|
+
coords: [cssColor.l, cssColor.a, cssColor.b],
|
|
1095
|
+
alpha: cssColor.alpha
|
|
1096
|
+
});
|
|
1097
|
+
break;
|
|
1025
1098
|
case "lch":
|
|
1099
|
+
color = new _colorjs.default({
|
|
1100
|
+
space: cssColor.type,
|
|
1101
|
+
coords: [cssColor.l, cssColor.c, cssColor.h],
|
|
1102
|
+
alpha: cssColor.alpha
|
|
1103
|
+
});
|
|
1104
|
+
break;
|
|
1026
1105
|
case "oklab":
|
|
1106
|
+
color = new _colorjs.default({
|
|
1107
|
+
space: cssColor.type,
|
|
1108
|
+
coords: [cssColor.l, cssColor.a, cssColor.b],
|
|
1109
|
+
alpha: cssColor.alpha
|
|
1110
|
+
});
|
|
1111
|
+
break;
|
|
1027
1112
|
case "oklch":
|
|
1113
|
+
color = new _colorjs.default({
|
|
1114
|
+
space: cssColor.type,
|
|
1115
|
+
coords: [cssColor.l, cssColor.c, cssColor.h],
|
|
1116
|
+
alpha: cssColor.alpha
|
|
1117
|
+
});
|
|
1118
|
+
break;
|
|
1028
1119
|
case "srgb":
|
|
1120
|
+
color = new _colorjs.default({
|
|
1121
|
+
space: cssColor.type,
|
|
1122
|
+
coords: [cssColor.r, cssColor.g, cssColor.b],
|
|
1123
|
+
alpha: cssColor.alpha
|
|
1124
|
+
});
|
|
1125
|
+
break;
|
|
1029
1126
|
case "srgb-linear":
|
|
1127
|
+
color = new _colorjs.default({
|
|
1128
|
+
space: cssColor.type,
|
|
1129
|
+
coords: [cssColor.r, cssColor.g, cssColor.b],
|
|
1130
|
+
alpha: cssColor.alpha
|
|
1131
|
+
});
|
|
1132
|
+
break;
|
|
1030
1133
|
case "display-p3":
|
|
1134
|
+
color = new _colorjs.default({
|
|
1135
|
+
space: "p3",
|
|
1136
|
+
coords: [cssColor.r, cssColor.g, cssColor.b],
|
|
1137
|
+
alpha: cssColor.alpha
|
|
1138
|
+
});
|
|
1139
|
+
break;
|
|
1031
1140
|
case "a98-rgb":
|
|
1141
|
+
color = new _colorjs.default({
|
|
1142
|
+
space: "a98rgb",
|
|
1143
|
+
coords: [cssColor.r, cssColor.g, cssColor.b],
|
|
1144
|
+
alpha: cssColor.alpha
|
|
1145
|
+
});
|
|
1146
|
+
break;
|
|
1032
1147
|
case "prophoto-rgb":
|
|
1148
|
+
color = new _colorjs.default({
|
|
1149
|
+
space: "prophoto",
|
|
1150
|
+
coords: [cssColor.r, cssColor.g, cssColor.b],
|
|
1151
|
+
alpha: cssColor.alpha
|
|
1152
|
+
});
|
|
1153
|
+
break;
|
|
1033
1154
|
case "rec2020":
|
|
1155
|
+
color = new _colorjs.default({
|
|
1156
|
+
space: cssColor.type,
|
|
1157
|
+
coords: [cssColor.r, cssColor.g, cssColor.b],
|
|
1158
|
+
alpha: cssColor.alpha
|
|
1159
|
+
});
|
|
1160
|
+
break;
|
|
1034
1161
|
case "xyz-d50":
|
|
1162
|
+
color = new _colorjs.default({
|
|
1163
|
+
space: cssColor.type,
|
|
1164
|
+
coords: [cssColor.x, cssColor.y, cssColor.z],
|
|
1165
|
+
alpha: cssColor.alpha
|
|
1166
|
+
});
|
|
1167
|
+
break;
|
|
1035
1168
|
case "xyz-d65":
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1169
|
+
color = new _colorjs.default({
|
|
1170
|
+
space: cssColor.type,
|
|
1171
|
+
coords: [cssColor.x, cssColor.y, cssColor.z],
|
|
1172
|
+
alpha: cssColor.alpha
|
|
1173
|
+
});
|
|
1174
|
+
break;
|
|
1039
1175
|
default:
|
|
1040
1176
|
{
|
|
1041
|
-
|
|
1177
|
+
cssColor;
|
|
1042
1178
|
}
|
|
1043
1179
|
}
|
|
1044
|
-
|
|
1180
|
+
if (!hexColors || colorPrecision) {
|
|
1181
|
+
return color?.toString({
|
|
1182
|
+
precision: colorPrecision ?? 3
|
|
1183
|
+
});
|
|
1184
|
+
} else {
|
|
1185
|
+
return color?.toString({
|
|
1186
|
+
format: "hex"
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
function parseLengthPercentageOrAutoDeclaration(value, builder) {
|
|
1191
|
+
return parseLengthPercentageOrAuto(value.value, builder);
|
|
1045
1192
|
}
|
|
1046
|
-
function parseLengthPercentageOrAuto(lengthPercentageOrAuto,
|
|
1193
|
+
function parseLengthPercentageOrAuto(lengthPercentageOrAuto, builder, {
|
|
1047
1194
|
allowAuto = false
|
|
1048
1195
|
} = {}) {
|
|
1049
1196
|
switch (lengthPercentageOrAuto.type) {
|
|
@@ -1051,11 +1198,11 @@ function parseLengthPercentageOrAuto(lengthPercentageOrAuto, options, {
|
|
|
1051
1198
|
if (allowAuto) {
|
|
1052
1199
|
return lengthPercentageOrAuto.type;
|
|
1053
1200
|
} else {
|
|
1054
|
-
|
|
1201
|
+
builder.addWarning("value", lengthPercentageOrAuto.type);
|
|
1055
1202
|
return undefined;
|
|
1056
1203
|
}
|
|
1057
1204
|
case "length-percentage":
|
|
1058
|
-
return parseLength(lengthPercentageOrAuto.value,
|
|
1205
|
+
return parseLength(lengthPercentageOrAuto.value, builder);
|
|
1059
1206
|
default:
|
|
1060
1207
|
{
|
|
1061
1208
|
lengthPercentageOrAuto;
|
|
@@ -1063,109 +1210,112 @@ function parseLengthPercentageOrAuto(lengthPercentageOrAuto, options, {
|
|
|
1063
1210
|
}
|
|
1064
1211
|
return;
|
|
1065
1212
|
}
|
|
1066
|
-
function parseJustifyContent(
|
|
1213
|
+
function parseJustifyContent(declaration, builder) {
|
|
1067
1214
|
const allowed = new Set(["flex-start", "flex-end", "center", "space-between", "space-around", "space-evenly"]);
|
|
1068
1215
|
let value;
|
|
1069
|
-
switch (
|
|
1216
|
+
switch (declaration.value.type) {
|
|
1070
1217
|
case "normal":
|
|
1071
1218
|
case "left":
|
|
1072
1219
|
case "right":
|
|
1073
|
-
value =
|
|
1220
|
+
value = declaration.value.type;
|
|
1074
1221
|
break;
|
|
1075
1222
|
case "content-distribution":
|
|
1076
1223
|
case "content-position":
|
|
1077
|
-
value =
|
|
1224
|
+
value = declaration.value.value;
|
|
1078
1225
|
break;
|
|
1079
1226
|
default:
|
|
1080
1227
|
{
|
|
1081
|
-
|
|
1228
|
+
declaration.value;
|
|
1082
1229
|
}
|
|
1083
1230
|
}
|
|
1084
1231
|
if (value && !allowed.has(value)) {
|
|
1085
|
-
|
|
1232
|
+
builder.addWarning("value", value);
|
|
1086
1233
|
return;
|
|
1087
1234
|
}
|
|
1088
1235
|
return value;
|
|
1089
1236
|
}
|
|
1090
|
-
function parseAlignContent(
|
|
1237
|
+
function parseAlignContent(declaration, builder) {
|
|
1091
1238
|
const allowed = new Set(["flex-start", "flex-end", "center", "stretch", "space-between", "space-around"]);
|
|
1092
1239
|
let value;
|
|
1093
|
-
switch (
|
|
1240
|
+
switch (declaration.value.type) {
|
|
1094
1241
|
case "normal":
|
|
1095
1242
|
case "baseline-position":
|
|
1096
|
-
value =
|
|
1243
|
+
value = declaration.value.type;
|
|
1097
1244
|
break;
|
|
1098
1245
|
case "content-distribution":
|
|
1099
1246
|
case "content-position":
|
|
1100
|
-
value =
|
|
1247
|
+
value = declaration.value.value;
|
|
1101
1248
|
break;
|
|
1102
1249
|
default:
|
|
1103
1250
|
{
|
|
1104
|
-
|
|
1251
|
+
declaration.value;
|
|
1105
1252
|
}
|
|
1106
1253
|
}
|
|
1107
1254
|
if (value && !allowed.has(value)) {
|
|
1108
|
-
|
|
1255
|
+
builder.addWarning("value", value);
|
|
1109
1256
|
return;
|
|
1110
1257
|
}
|
|
1111
1258
|
return value;
|
|
1112
1259
|
}
|
|
1113
|
-
function parseAlignItems(alignItems,
|
|
1260
|
+
function parseAlignItems(alignItems, builder) {
|
|
1114
1261
|
const allowed = new Set(["auto", "flex-start", "flex-end", "center", "stretch", "baseline"]);
|
|
1115
1262
|
let value;
|
|
1116
|
-
switch (alignItems.type) {
|
|
1263
|
+
switch (alignItems.value.type) {
|
|
1117
1264
|
case "normal":
|
|
1118
1265
|
value = "auto";
|
|
1119
1266
|
break;
|
|
1120
1267
|
case "stretch":
|
|
1121
|
-
value = alignItems.type;
|
|
1268
|
+
value = alignItems.value.type;
|
|
1122
1269
|
break;
|
|
1123
1270
|
case "baseline-position":
|
|
1124
1271
|
value = "baseline";
|
|
1125
1272
|
break;
|
|
1126
1273
|
case "self-position":
|
|
1127
|
-
value = alignItems.value;
|
|
1274
|
+
value = alignItems.value.value;
|
|
1128
1275
|
break;
|
|
1129
1276
|
default:
|
|
1130
1277
|
{
|
|
1131
|
-
alignItems;
|
|
1278
|
+
alignItems.value;
|
|
1132
1279
|
}
|
|
1133
1280
|
}
|
|
1134
1281
|
if (value && !allowed.has(value)) {
|
|
1135
|
-
|
|
1282
|
+
builder.addWarning("value", value);
|
|
1136
1283
|
return;
|
|
1137
1284
|
}
|
|
1138
1285
|
return value;
|
|
1139
1286
|
}
|
|
1140
|
-
function parseAlignSelf(alignSelf,
|
|
1287
|
+
function parseAlignSelf(alignSelf, builder) {
|
|
1141
1288
|
const allowed = new Set(["auto", "flex-start", "flex-end", "center", "stretch", "baseline"]);
|
|
1142
1289
|
let value;
|
|
1143
|
-
switch (alignSelf.type) {
|
|
1290
|
+
switch (alignSelf.value.type) {
|
|
1144
1291
|
case "normal":
|
|
1145
1292
|
case "auto":
|
|
1146
1293
|
value = "auto";
|
|
1147
1294
|
break;
|
|
1148
1295
|
case "stretch":
|
|
1149
|
-
value = alignSelf.type;
|
|
1296
|
+
value = alignSelf.value.type;
|
|
1150
1297
|
break;
|
|
1151
1298
|
case "baseline-position":
|
|
1152
1299
|
value = "baseline";
|
|
1153
1300
|
break;
|
|
1154
1301
|
case "self-position":
|
|
1155
|
-
value = alignSelf.value;
|
|
1302
|
+
value = alignSelf.value.value;
|
|
1156
1303
|
break;
|
|
1157
1304
|
default:
|
|
1158
1305
|
{
|
|
1159
|
-
alignSelf;
|
|
1306
|
+
alignSelf.value;
|
|
1160
1307
|
}
|
|
1161
1308
|
}
|
|
1162
1309
|
if (value && !allowed.has(value)) {
|
|
1163
|
-
|
|
1310
|
+
builder.addWarning("value", value);
|
|
1164
1311
|
return;
|
|
1165
1312
|
}
|
|
1166
1313
|
return value;
|
|
1167
1314
|
}
|
|
1168
|
-
function
|
|
1315
|
+
function parseFontWeightDeclaration(declaration, builder) {
|
|
1316
|
+
return parseFontWeight(declaration.value, builder);
|
|
1317
|
+
}
|
|
1318
|
+
function parseFontWeight(fontWeight, builder) {
|
|
1169
1319
|
switch (fontWeight.type) {
|
|
1170
1320
|
case "absolute":
|
|
1171
1321
|
if (fontWeight.value.type === "weight") {
|
|
@@ -1175,7 +1325,7 @@ function parseFontWeight(fontWeight, options) {
|
|
|
1175
1325
|
}
|
|
1176
1326
|
case "bolder":
|
|
1177
1327
|
case "lighter":
|
|
1178
|
-
|
|
1328
|
+
builder.addWarning("value", fontWeight.type);
|
|
1179
1329
|
return;
|
|
1180
1330
|
default:
|
|
1181
1331
|
{
|
|
@@ -1184,32 +1334,36 @@ function parseFontWeight(fontWeight, options) {
|
|
|
1184
1334
|
}
|
|
1185
1335
|
return;
|
|
1186
1336
|
}
|
|
1187
|
-
function parseTextShadow(
|
|
1337
|
+
function parseTextShadow(declaration, builder) {
|
|
1338
|
+
const [textShadow] = declaration.value;
|
|
1188
1339
|
if (!textShadow) {
|
|
1189
1340
|
return;
|
|
1190
1341
|
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1342
|
+
builder.addDescriptor("textShadowColor", parseColor(textShadow.color, builder));
|
|
1343
|
+
builder.addDescriptor("textShadowOffset.width", parseLength(textShadow.xOffset, builder));
|
|
1344
|
+
builder.addDescriptor("textShadowOffset.height", parseLength(textShadow.yOffset, builder));
|
|
1345
|
+
builder.addDescriptor("textShadowRadius", parseLength(textShadow.blur, builder));
|
|
1195
1346
|
}
|
|
1196
|
-
function parseTextDecorationStyle(
|
|
1347
|
+
function parseTextDecorationStyle(declaration, builder) {
|
|
1197
1348
|
const allowed = new Set(["solid", "double", "dotted", "dashed"]);
|
|
1198
|
-
if (allowed.has(
|
|
1199
|
-
return
|
|
1349
|
+
if (allowed.has(declaration.value)) {
|
|
1350
|
+
return declaration.value;
|
|
1200
1351
|
}
|
|
1201
|
-
|
|
1202
|
-
return
|
|
1352
|
+
builder.addWarning("value", declaration.value);
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
function parseTextDecorationLineDeclaration(declaration, builder) {
|
|
1356
|
+
return parseTextDecorationLine(declaration.value, builder);
|
|
1203
1357
|
}
|
|
1204
|
-
function parseTextDecorationLine(
|
|
1205
|
-
if (!Array.isArray(
|
|
1206
|
-
if (
|
|
1207
|
-
return
|
|
1358
|
+
function parseTextDecorationLine(value, builder) {
|
|
1359
|
+
if (!Array.isArray(value)) {
|
|
1360
|
+
if (value === "none") {
|
|
1361
|
+
return value;
|
|
1208
1362
|
}
|
|
1209
|
-
|
|
1363
|
+
builder.addWarning("value", value);
|
|
1210
1364
|
return;
|
|
1211
1365
|
}
|
|
1212
|
-
const set = new Set(
|
|
1366
|
+
const set = new Set(value);
|
|
1213
1367
|
if (set.has("underline")) {
|
|
1214
1368
|
if (set.has("line-through")) {
|
|
1215
1369
|
return "underline line-through";
|
|
@@ -1219,70 +1373,105 @@ function parseTextDecorationLine(textDecorationLine, options) {
|
|
|
1219
1373
|
} else if (set.has("line-through")) {
|
|
1220
1374
|
return "line-through";
|
|
1221
1375
|
}
|
|
1222
|
-
|
|
1376
|
+
builder.addWarning("value", value.join(" "));
|
|
1223
1377
|
return undefined;
|
|
1224
1378
|
}
|
|
1225
|
-
function
|
|
1379
|
+
function parsePosition({
|
|
1380
|
+
value
|
|
1381
|
+
}, builder) {
|
|
1382
|
+
if (value.type === "absolute" || value.type === "relative") {
|
|
1383
|
+
return value.type;
|
|
1384
|
+
}
|
|
1385
|
+
builder.addWarning("value", value.type);
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
function parseOverflow({
|
|
1389
|
+
value
|
|
1390
|
+
}, builder) {
|
|
1226
1391
|
const allowed = new Set(["visible", "hidden"]);
|
|
1227
|
-
if (allowed.has(
|
|
1228
|
-
return
|
|
1392
|
+
if (allowed.has(value.x)) {
|
|
1393
|
+
return value.x;
|
|
1229
1394
|
}
|
|
1230
|
-
|
|
1395
|
+
builder.addWarning("value", value.x);
|
|
1231
1396
|
return undefined;
|
|
1232
1397
|
}
|
|
1233
|
-
function
|
|
1398
|
+
function parseBorderStyleDeclaration(declaration, builder) {
|
|
1399
|
+
return parseBorderStyle(declaration.value, builder);
|
|
1400
|
+
}
|
|
1401
|
+
function parseBorderStyle(value, builder) {
|
|
1234
1402
|
const allowed = new Set(["solid", "dotted", "dashed"]);
|
|
1235
|
-
if (typeof
|
|
1236
|
-
if (allowed.has(
|
|
1237
|
-
return
|
|
1403
|
+
if (typeof value === "string") {
|
|
1404
|
+
if (allowed.has(value)) {
|
|
1405
|
+
return value;
|
|
1238
1406
|
} else {
|
|
1239
|
-
|
|
1407
|
+
builder.addWarning("value", value);
|
|
1240
1408
|
return undefined;
|
|
1241
1409
|
}
|
|
1242
|
-
} else if (
|
|
1243
|
-
return
|
|
1410
|
+
} else if (value.top === value.bottom && value.top === value.left && value.top === value.right && allowed.has(value.top)) {
|
|
1411
|
+
return value.top;
|
|
1244
1412
|
}
|
|
1245
|
-
|
|
1413
|
+
builder.addWarning("value", value.top);
|
|
1246
1414
|
return undefined;
|
|
1247
1415
|
}
|
|
1248
|
-
function
|
|
1249
|
-
|
|
1250
|
-
|
|
1416
|
+
function parseBorderBlockColor({
|
|
1417
|
+
value
|
|
1418
|
+
}, builder) {
|
|
1419
|
+
builder.addDescriptor("border-top-color", parseColor(value.start, builder));
|
|
1420
|
+
builder.addDescriptor("border-bottom-color", parseColor(value.end, builder));
|
|
1421
|
+
return;
|
|
1422
|
+
}
|
|
1423
|
+
function parseBorderBlockWidth(declaration, builder) {
|
|
1424
|
+
builder.addDescriptor("border-top-width", parseBorderSideWidth(declaration.value.start, builder));
|
|
1425
|
+
builder.addDescriptor("border-bottom-width", parseBorderSideWidth(declaration.value.end, builder));
|
|
1426
|
+
}
|
|
1427
|
+
function parseBorderSideWidthDeclaration(declaration, builder) {
|
|
1428
|
+
return parseBorderSideWidth(declaration.value, builder);
|
|
1429
|
+
}
|
|
1430
|
+
function parseBorderSideWidth(value, builder) {
|
|
1431
|
+
if (value.type === "length") {
|
|
1432
|
+
return parseLength(value.value, builder);
|
|
1251
1433
|
}
|
|
1252
|
-
|
|
1434
|
+
builder.addWarning("value", value.type);
|
|
1253
1435
|
return undefined;
|
|
1254
1436
|
}
|
|
1255
|
-
function parseVerticalAlign(
|
|
1256
|
-
|
|
1437
|
+
function parseVerticalAlign({
|
|
1438
|
+
value
|
|
1439
|
+
}, builder) {
|
|
1440
|
+
if (value.type === "length") {
|
|
1257
1441
|
return undefined;
|
|
1258
1442
|
}
|
|
1259
1443
|
const allowed = new Set(["auto", "top", "bottom", "middle"]);
|
|
1260
|
-
if (allowed.has(
|
|
1261
|
-
return
|
|
1444
|
+
if (allowed.has(value.value)) {
|
|
1445
|
+
return value.value;
|
|
1262
1446
|
}
|
|
1263
|
-
|
|
1447
|
+
builder.addWarning("value", value.value);
|
|
1264
1448
|
return undefined;
|
|
1265
1449
|
}
|
|
1266
|
-
function parseFontFamily(
|
|
1450
|
+
function parseFontFamily({
|
|
1451
|
+
value
|
|
1452
|
+
}) {
|
|
1267
1453
|
// React Native only allows one font family - better hope this is the right one :)
|
|
1268
|
-
return
|
|
1454
|
+
return value[0];
|
|
1455
|
+
}
|
|
1456
|
+
function parseLineHeightDeclaration(declaration, builder) {
|
|
1457
|
+
return parseLineHeight(declaration.value, builder);
|
|
1269
1458
|
}
|
|
1270
|
-
function parseLineHeight(
|
|
1271
|
-
switch (
|
|
1459
|
+
function parseLineHeight(value, builder) {
|
|
1460
|
+
switch (value.type) {
|
|
1272
1461
|
case "normal":
|
|
1273
1462
|
return undefined;
|
|
1274
1463
|
case "number":
|
|
1275
|
-
return [{}, "em", [
|
|
1464
|
+
return [{}, "em", [value.value], 1];
|
|
1276
1465
|
case "length":
|
|
1277
1466
|
{
|
|
1278
|
-
const length =
|
|
1467
|
+
const length = value.value;
|
|
1279
1468
|
switch (length.type) {
|
|
1280
1469
|
case "dimension":
|
|
1281
|
-
return parseLength(length,
|
|
1470
|
+
return parseLength(length, builder);
|
|
1282
1471
|
case "percentage":
|
|
1283
1472
|
case "calc":
|
|
1284
|
-
|
|
1285
|
-
return
|
|
1473
|
+
builder.addWarning("value", typeof length.value === "number" ? length.value : JSON.stringify(length.value));
|
|
1474
|
+
return;
|
|
1286
1475
|
default:
|
|
1287
1476
|
{
|
|
1288
1477
|
length;
|
|
@@ -1292,218 +1481,180 @@ function parseLineHeight(lineHeight, options) {
|
|
|
1292
1481
|
}
|
|
1293
1482
|
default:
|
|
1294
1483
|
{
|
|
1295
|
-
|
|
1484
|
+
value;
|
|
1296
1485
|
}
|
|
1297
1486
|
}
|
|
1298
1487
|
return;
|
|
1299
1488
|
}
|
|
1300
|
-
function
|
|
1301
|
-
|
|
1489
|
+
function parseFontSizeDeclaration(declaration, builder) {
|
|
1490
|
+
const fontSize = parseFontSize(declaration.value, builder);
|
|
1491
|
+
builder.addDescriptor("fontSize", fontSize);
|
|
1492
|
+
builder.addDescriptor("--__rn-css-em", fontSize);
|
|
1493
|
+
}
|
|
1494
|
+
function parseFontSize(value, builder) {
|
|
1495
|
+
switch (value.type) {
|
|
1302
1496
|
case "length":
|
|
1303
|
-
return parseLength(
|
|
1497
|
+
return parseLength(value.value, builder);
|
|
1304
1498
|
case "absolute":
|
|
1305
1499
|
case "relative":
|
|
1306
|
-
|
|
1500
|
+
builder.addWarning("value", value.value);
|
|
1307
1501
|
return undefined;
|
|
1308
1502
|
default:
|
|
1309
1503
|
{
|
|
1310
|
-
|
|
1504
|
+
value;
|
|
1311
1505
|
}
|
|
1312
1506
|
}
|
|
1313
1507
|
return;
|
|
1314
1508
|
}
|
|
1315
|
-
function
|
|
1316
|
-
|
|
1509
|
+
function parseFontStyleDeclaration(declaration, builder) {
|
|
1510
|
+
return parseFontStyle(declaration.value, builder);
|
|
1511
|
+
}
|
|
1512
|
+
function parseFontStyle(value, builder) {
|
|
1513
|
+
switch (value.type) {
|
|
1317
1514
|
case "normal":
|
|
1318
1515
|
case "italic":
|
|
1319
|
-
return
|
|
1516
|
+
return value.type;
|
|
1320
1517
|
case "oblique":
|
|
1321
|
-
|
|
1518
|
+
builder.addWarning("value", value.type);
|
|
1322
1519
|
return undefined;
|
|
1323
1520
|
default:
|
|
1324
1521
|
{
|
|
1325
|
-
|
|
1522
|
+
value;
|
|
1326
1523
|
}
|
|
1327
1524
|
}
|
|
1328
1525
|
return;
|
|
1329
1526
|
}
|
|
1330
|
-
function
|
|
1527
|
+
function parseFontVariantCapsDeclaration(declaration, builder) {
|
|
1528
|
+
return parseFontVariantCaps(declaration.value, builder);
|
|
1529
|
+
}
|
|
1530
|
+
function parseFontVariantCaps(value, builder) {
|
|
1331
1531
|
const allowed = new Set(["small-caps", "oldstyle-nums", "lining-nums", "tabular-nums", "proportional-nums"]);
|
|
1332
|
-
if (allowed.has(
|
|
1333
|
-
return
|
|
1532
|
+
if (allowed.has(value)) {
|
|
1533
|
+
return value;
|
|
1334
1534
|
}
|
|
1335
|
-
|
|
1535
|
+
builder.addWarning("value", value);
|
|
1336
1536
|
return undefined;
|
|
1337
1537
|
}
|
|
1338
|
-
function parseLengthOrCoercePercentageToRuntime(value,
|
|
1339
|
-
return parseLength(value,
|
|
1538
|
+
function parseLengthOrCoercePercentageToRuntime(value, builder) {
|
|
1539
|
+
return parseLength(value, builder);
|
|
1340
1540
|
}
|
|
1341
|
-
function parseGap(
|
|
1342
|
-
if (
|
|
1343
|
-
|
|
1541
|
+
function parseGap(declaration, builder) {
|
|
1542
|
+
if ("column" in declaration.value) {
|
|
1543
|
+
builder.addDescriptor("row-gap", parseGapValue(declaration.value.row, builder));
|
|
1544
|
+
builder.addDescriptor("column-gap", parseGapValue(declaration.value.column, builder));
|
|
1344
1545
|
return;
|
|
1546
|
+
} else {
|
|
1547
|
+
if (declaration.value.type === "normal") {
|
|
1548
|
+
builder.addWarning("value", declaration.value.type);
|
|
1549
|
+
return;
|
|
1550
|
+
}
|
|
1551
|
+
return parseLength(declaration.value.value, builder);
|
|
1345
1552
|
}
|
|
1346
|
-
return parseLength(value.value, options);
|
|
1347
1553
|
}
|
|
1348
|
-
function
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
if (token.type === "token" && (token.value.type === "ident" || token.value.type === "number")) {
|
|
1354
|
-
key = token.value.value.toString();
|
|
1355
|
-
continue;
|
|
1356
|
-
}
|
|
1357
|
-
} else {
|
|
1358
|
-
if (token.type !== "token") {
|
|
1359
|
-
const value = parseUnparsed(token, options);
|
|
1360
|
-
if (value === undefined) {
|
|
1361
|
-
return;
|
|
1362
|
-
}
|
|
1363
|
-
runtimeArgs[key] = value;
|
|
1364
|
-
key = undefined;
|
|
1365
|
-
} else {
|
|
1366
|
-
switch (token.value.type) {
|
|
1367
|
-
case "string":
|
|
1368
|
-
case "number":
|
|
1369
|
-
case "ident":
|
|
1370
|
-
{
|
|
1371
|
-
if (key) {
|
|
1372
|
-
runtimeArgs[key] = parseUnparsed(token, options);
|
|
1373
|
-
key = undefined;
|
|
1374
|
-
continue;
|
|
1375
|
-
} else {
|
|
1376
|
-
return;
|
|
1377
|
-
}
|
|
1378
|
-
}
|
|
1379
|
-
case "delim":
|
|
1380
|
-
case "comma":
|
|
1381
|
-
continue;
|
|
1382
|
-
case "function":
|
|
1383
|
-
case "at-keyword":
|
|
1384
|
-
case "hash":
|
|
1385
|
-
case "id-hash":
|
|
1386
|
-
case "unquoted-url":
|
|
1387
|
-
case "percentage":
|
|
1388
|
-
case "dimension":
|
|
1389
|
-
case "white-space":
|
|
1390
|
-
case "comment":
|
|
1391
|
-
case "colon":
|
|
1392
|
-
case "semicolon":
|
|
1393
|
-
case "include-match":
|
|
1394
|
-
case "dash-match":
|
|
1395
|
-
case "prefix-match":
|
|
1396
|
-
case "suffix-match":
|
|
1397
|
-
case "substring-match":
|
|
1398
|
-
case "cdo":
|
|
1399
|
-
case "cdc":
|
|
1400
|
-
case "parenthesis-block":
|
|
1401
|
-
case "square-bracket-block":
|
|
1402
|
-
case "curly-bracket-block":
|
|
1403
|
-
case "bad-url":
|
|
1404
|
-
case "bad-string":
|
|
1405
|
-
case "close-parenthesis":
|
|
1406
|
-
case "close-square-bracket":
|
|
1407
|
-
case "close-curly-bracket":
|
|
1408
|
-
return undefined;
|
|
1409
|
-
}
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1554
|
+
function parseGapValue(value, builder) {
|
|
1555
|
+
if (value.type === "normal") {
|
|
1556
|
+
return;
|
|
1557
|
+
} else {
|
|
1558
|
+
return parseLength(value.value, builder);
|
|
1412
1559
|
}
|
|
1413
|
-
return [{}, name, Object.entries(runtimeArgs)];
|
|
1414
1560
|
}
|
|
1415
|
-
function parseTextAlign(
|
|
1561
|
+
function parseTextAlign({
|
|
1562
|
+
value
|
|
1563
|
+
}, builder) {
|
|
1416
1564
|
const allowed = new Set(["auto", "left", "right", "center", "justify"]);
|
|
1417
|
-
if (allowed.has(
|
|
1418
|
-
return
|
|
1565
|
+
if (allowed.has(value)) {
|
|
1566
|
+
return value;
|
|
1419
1567
|
}
|
|
1420
|
-
|
|
1568
|
+
builder.addWarning("value", value);
|
|
1421
1569
|
return undefined;
|
|
1422
1570
|
}
|
|
1423
|
-
function parseBoxShadow(
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1571
|
+
function parseBoxShadow({
|
|
1572
|
+
value
|
|
1573
|
+
}, builder) {
|
|
1574
|
+
for (const [index, shadow] of value.entries()) {
|
|
1575
|
+
builder.addDescriptor(`boxShadow.[${index}].color`, parseColor(shadow.color, builder));
|
|
1576
|
+
builder.addDescriptor(`boxShadow.[${index}].offsetX`, parseLength(shadow.xOffset, builder));
|
|
1577
|
+
builder.addDescriptor(`boxShadow.[${index}].offsetY`, parseLength(shadow.yOffset, builder));
|
|
1578
|
+
builder.addDescriptor(`boxShadow.[${index}].blurRadius`, parseLength(shadow.blur, builder));
|
|
1579
|
+
builder.addDescriptor(`boxShadow.[${index}].spreadDistance`, parseLength(shadow.spread, builder));
|
|
1580
|
+
builder.addDescriptor(`boxShadow.[${index}].inset`, shadow.inset ? true : undefined);
|
|
1431
1581
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
// ["shadowOffset", "height"],
|
|
1440
|
-
// parseLength(boxShadow.yOffset, options),
|
|
1441
|
-
// );
|
|
1442
|
-
}
|
|
1443
|
-
function parseDisplay(display, options) {
|
|
1444
|
-
if (display.type === "keyword") {
|
|
1445
|
-
if (display.value === "none") {
|
|
1446
|
-
return display.value;
|
|
1582
|
+
}
|
|
1583
|
+
function parseDisplay({
|
|
1584
|
+
value
|
|
1585
|
+
}, builder) {
|
|
1586
|
+
if (value.type === "keyword") {
|
|
1587
|
+
if (value.value === "none") {
|
|
1588
|
+
return value.value;
|
|
1447
1589
|
} else {
|
|
1448
|
-
|
|
1590
|
+
builder.addWarning("value", value.value);
|
|
1591
|
+
return;
|
|
1449
1592
|
}
|
|
1450
|
-
} else
|
|
1451
|
-
if (
|
|
1452
|
-
switch (
|
|
1593
|
+
} else {
|
|
1594
|
+
if (value.outside === "block") {
|
|
1595
|
+
switch (value.inside.type) {
|
|
1453
1596
|
case "flow":
|
|
1454
|
-
if (
|
|
1455
|
-
|
|
1597
|
+
if (value.isListItem) {
|
|
1598
|
+
builder.addWarning("value", "list-item");
|
|
1456
1599
|
} else {
|
|
1457
|
-
|
|
1600
|
+
builder.addWarning("value", "block");
|
|
1458
1601
|
}
|
|
1602
|
+
return;
|
|
1603
|
+
case "flex":
|
|
1604
|
+
return value.inside.type;
|
|
1459
1605
|
case "flow-root":
|
|
1460
|
-
return options.addWarning("value", "flow-root");
|
|
1461
1606
|
case "table":
|
|
1462
|
-
return options.addWarning("value", display.inside.type);
|
|
1463
|
-
case "flex":
|
|
1464
|
-
return display.inside.type;
|
|
1465
1607
|
case "box":
|
|
1466
1608
|
case "grid":
|
|
1467
1609
|
case "ruby":
|
|
1468
|
-
|
|
1610
|
+
builder.addWarning("value", value.inside.type);
|
|
1611
|
+
return;
|
|
1469
1612
|
}
|
|
1470
1613
|
} else {
|
|
1471
|
-
switch (
|
|
1614
|
+
switch (value.inside.type) {
|
|
1472
1615
|
case "flow":
|
|
1473
|
-
|
|
1616
|
+
builder.addWarning("value", "inline");
|
|
1617
|
+
return;
|
|
1474
1618
|
case "flow-root":
|
|
1475
|
-
|
|
1619
|
+
builder.addWarning("value", "inline-block");
|
|
1620
|
+
return;
|
|
1476
1621
|
case "table":
|
|
1477
|
-
|
|
1622
|
+
builder.addWarning("value", "inline-table");
|
|
1623
|
+
return;
|
|
1478
1624
|
case "flex":
|
|
1479
|
-
|
|
1625
|
+
builder.addWarning("value", "inline-flex");
|
|
1626
|
+
return;
|
|
1480
1627
|
case "box":
|
|
1481
1628
|
case "grid":
|
|
1482
|
-
|
|
1629
|
+
builder.addWarning("value", "inline-grid");
|
|
1630
|
+
return;
|
|
1483
1631
|
case "ruby":
|
|
1484
|
-
|
|
1632
|
+
builder.addWarning("value", value.inside.type);
|
|
1633
|
+
return;
|
|
1485
1634
|
}
|
|
1486
1635
|
}
|
|
1487
1636
|
}
|
|
1488
|
-
return;
|
|
1489
1637
|
}
|
|
1490
|
-
function parseAspectRatio(
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
if (
|
|
1638
|
+
function parseAspectRatio({
|
|
1639
|
+
value
|
|
1640
|
+
}) {
|
|
1641
|
+
if (!value.ratio) {
|
|
1642
|
+
return;
|
|
1643
|
+
} else if (value.auto) {
|
|
1494
1644
|
return "auto";
|
|
1495
1645
|
} else {
|
|
1496
|
-
|
|
1646
|
+
const [width, height] = value.ratio;
|
|
1647
|
+
if (width === height) {
|
|
1497
1648
|
return 1;
|
|
1498
1649
|
} else {
|
|
1499
|
-
return
|
|
1650
|
+
return `${width}/${height}`;
|
|
1500
1651
|
}
|
|
1501
1652
|
}
|
|
1502
1653
|
}
|
|
1503
1654
|
function parseDimension({
|
|
1504
1655
|
unit,
|
|
1505
1656
|
value
|
|
1506
|
-
},
|
|
1657
|
+
}, builder) {
|
|
1507
1658
|
switch (unit) {
|
|
1508
1659
|
case "px":
|
|
1509
1660
|
return value;
|
|
@@ -1514,40 +1665,46 @@ function parseDimension({
|
|
|
1514
1665
|
return [{}, unit, [value / 100], 1];
|
|
1515
1666
|
default:
|
|
1516
1667
|
{
|
|
1517
|
-
|
|
1668
|
+
builder.addWarning("value", `${value}${unit}`);
|
|
1669
|
+
return;
|
|
1518
1670
|
}
|
|
1519
1671
|
}
|
|
1520
1672
|
}
|
|
1521
|
-
function parseUserSelect(
|
|
1673
|
+
function parseUserSelect({
|
|
1674
|
+
value
|
|
1675
|
+
}, builder) {
|
|
1522
1676
|
const allowed = ["auto", "text", "none", "contain", "all"];
|
|
1523
1677
|
if (allowed.includes(value)) {
|
|
1524
1678
|
return value;
|
|
1525
1679
|
} else {
|
|
1526
|
-
|
|
1680
|
+
builder.addWarning("value", value);
|
|
1681
|
+
return;
|
|
1527
1682
|
}
|
|
1528
1683
|
}
|
|
1529
|
-
function parseSVGPaint(
|
|
1684
|
+
function parseSVGPaint({
|
|
1685
|
+
value
|
|
1686
|
+
}, builder) {
|
|
1530
1687
|
if (value.type === "none") {
|
|
1531
1688
|
return "transparent";
|
|
1532
1689
|
} else if (value.type === "color") {
|
|
1533
|
-
return parseColor(value.value,
|
|
1690
|
+
return parseColor(value.value, builder);
|
|
1534
1691
|
}
|
|
1535
1692
|
return;
|
|
1536
1693
|
}
|
|
1537
1694
|
function round(number) {
|
|
1538
1695
|
return Math.round((number + Number.EPSILON) * 100) / 100;
|
|
1539
1696
|
}
|
|
1540
|
-
function parseDimensionPercentageFor_LengthValue(value,
|
|
1697
|
+
function parseDimensionPercentageFor_LengthValue(value, builder) {
|
|
1541
1698
|
if (value.type === "calc") {
|
|
1542
1699
|
return undefined;
|
|
1543
1700
|
} else if (value.type === "percentage") {
|
|
1544
1701
|
return `${value.value}%`;
|
|
1545
1702
|
} else {
|
|
1546
|
-
return parseLength(value.value,
|
|
1703
|
+
return parseLength(value.value, builder);
|
|
1547
1704
|
}
|
|
1548
1705
|
}
|
|
1549
1706
|
const allowAuto = new Set(["pointer-events"]);
|
|
1550
|
-
function parseEnv(value,
|
|
1707
|
+
function parseEnv(value, builder) {
|
|
1551
1708
|
switch (value.name.type) {
|
|
1552
1709
|
case "ua":
|
|
1553
1710
|
switch (value.name.value) {
|
|
@@ -1555,7 +1712,7 @@ function parseEnv(value, options) {
|
|
|
1555
1712
|
case "safe-area-inset-right":
|
|
1556
1713
|
case "safe-area-inset-bottom":
|
|
1557
1714
|
case "safe-area-inset-left":
|
|
1558
|
-
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback,
|
|
1715
|
+
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback, builder)], 1];
|
|
1559
1716
|
case "viewport-segment-width":
|
|
1560
1717
|
case "viewport-segment-height":
|
|
1561
1718
|
case "viewport-segment-top":
|
|
@@ -1569,28 +1726,28 @@ function parseEnv(value, options) {
|
|
|
1569
1726
|
}
|
|
1570
1727
|
return;
|
|
1571
1728
|
}
|
|
1572
|
-
function parseCalcFn(name, tokens,
|
|
1573
|
-
const args = parseCalcArguments(tokens,
|
|
1729
|
+
function parseCalcFn(name, tokens, builder) {
|
|
1730
|
+
const args = parseCalcArguments(tokens, builder);
|
|
1574
1731
|
if (args) {
|
|
1575
1732
|
return [{}, name, args];
|
|
1576
1733
|
}
|
|
1577
1734
|
return;
|
|
1578
1735
|
}
|
|
1579
|
-
function parseCalcArguments([...args],
|
|
1736
|
+
function parseCalcArguments([...args], builder) {
|
|
1580
1737
|
const parsed = [];
|
|
1581
1738
|
let mode;
|
|
1582
1739
|
for (const [currentIndex, arg] of args.entries()) {
|
|
1583
1740
|
switch (arg.type) {
|
|
1584
1741
|
case "env":
|
|
1585
1742
|
{
|
|
1586
|
-
parsed.push(parseEnv(arg.value,
|
|
1743
|
+
parsed.push(parseEnv(arg.value, builder));
|
|
1587
1744
|
break;
|
|
1588
1745
|
}
|
|
1589
1746
|
case "var":
|
|
1590
1747
|
case "function":
|
|
1591
1748
|
case "unresolved-color":
|
|
1592
1749
|
{
|
|
1593
|
-
const value = parseUnparsed(arg,
|
|
1750
|
+
const value = parseUnparsed(arg, builder);
|
|
1594
1751
|
if (value === undefined) {
|
|
1595
1752
|
return undefined;
|
|
1596
1753
|
}
|
|
@@ -1599,7 +1756,7 @@ function parseCalcArguments([...args], options) {
|
|
|
1599
1756
|
}
|
|
1600
1757
|
case "length":
|
|
1601
1758
|
{
|
|
1602
|
-
const value = parseLength(arg.value,
|
|
1759
|
+
const value = parseLength(arg.value, builder);
|
|
1603
1760
|
if (value !== undefined) {
|
|
1604
1761
|
parsed.push(value);
|
|
1605
1762
|
}
|
|
@@ -1625,13 +1782,13 @@ function parseCalcArguments([...args], options) {
|
|
|
1625
1782
|
}
|
|
1626
1783
|
break;
|
|
1627
1784
|
case "percentage":
|
|
1628
|
-
|
|
1785
|
+
mode ??= "percentage";
|
|
1629
1786
|
if (mode !== "percentage") return;
|
|
1630
1787
|
parsed.push(`${arg.value.value * 100}%`);
|
|
1631
1788
|
break;
|
|
1632
1789
|
case "number":
|
|
1633
1790
|
{
|
|
1634
|
-
|
|
1791
|
+
mode ??= "number";
|
|
1635
1792
|
if (mode !== "number") return;
|
|
1636
1793
|
parsed.push(arg.value.value);
|
|
1637
1794
|
break;
|
|
@@ -1644,6 +1801,7 @@ function parseCalcArguments([...args], options) {
|
|
|
1644
1801
|
*/
|
|
1645
1802
|
let closeParenthesisIndex = -1;
|
|
1646
1803
|
for (let index = args.length - 1; index > 0; index--) {
|
|
1804
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1647
1805
|
const value = args[index];
|
|
1648
1806
|
if (value.type === "token" && value.value.type === "close-parenthesis") {
|
|
1649
1807
|
closeParenthesisIndex = index;
|
|
@@ -1658,7 +1816,7 @@ function parseCalcArguments([...args], options) {
|
|
|
1658
1816
|
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
1659
1817
|
// Then drop the surrounding parenthesis
|
|
1660
1818
|
.slice(1, -1);
|
|
1661
|
-
parsed.push(parseCalcFn("calc", innerCalcArgs,
|
|
1819
|
+
parsed.push(parseCalcFn("calc", innerCalcArgs, builder));
|
|
1662
1820
|
break;
|
|
1663
1821
|
}
|
|
1664
1822
|
case "close-parenthesis":
|
|
@@ -1693,26 +1851,27 @@ function parseCalcArguments([...args], options) {
|
|
|
1693
1851
|
}
|
|
1694
1852
|
return parsed;
|
|
1695
1853
|
}
|
|
1696
|
-
function
|
|
1697
|
-
if (
|
|
1854
|
+
function parseTranslateProp(value, prop, builder) {
|
|
1855
|
+
if (value === "none") {
|
|
1698
1856
|
return 0;
|
|
1699
1857
|
}
|
|
1700
|
-
return parseLength(
|
|
1858
|
+
return parseLength(value[prop], builder);
|
|
1701
1859
|
}
|
|
1702
|
-
function
|
|
1703
|
-
if (translate === "none") {
|
|
1704
|
-
return 0;
|
|
1705
|
-
}
|
|
1706
|
-
return parseLength(translate[prop], options);
|
|
1707
|
-
}
|
|
1708
|
-
function parseUnresolvedColor(color, options) {
|
|
1860
|
+
function parseUnresolvedColor(color, builder) {
|
|
1709
1861
|
switch (color.type) {
|
|
1710
1862
|
case "rgb":
|
|
1711
|
-
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha,
|
|
1863
|
+
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha, builder)]];
|
|
1712
1864
|
case "hsl":
|
|
1713
|
-
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha,
|
|
1865
|
+
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha, builder)]];
|
|
1714
1866
|
case "light-dark":
|
|
1715
|
-
|
|
1867
|
+
{
|
|
1868
|
+
const extraRule = builder.extendRule({
|
|
1869
|
+
m: [["=", "prefers-color-scheme", "dark"]]
|
|
1870
|
+
});
|
|
1871
|
+
builder.addUnnamedDescriptor(reduceParseUnparsed(color.dark, builder), false, extraRule);
|
|
1872
|
+
builder.addExtraRule(extraRule);
|
|
1873
|
+
return reduceParseUnparsed(color.light, builder);
|
|
1874
|
+
}
|
|
1716
1875
|
default:
|
|
1717
1876
|
color;
|
|
1718
1877
|
}
|
|
@@ -1746,36 +1905,48 @@ function equal(a, b) {
|
|
|
1746
1905
|
function parseTime(time) {
|
|
1747
1906
|
return time.type === "milliseconds" ? time.value : time.value * 1000;
|
|
1748
1907
|
}
|
|
1749
|
-
function
|
|
1908
|
+
function parseSize2DDimensionPercentageDeclaration(declaration, builder) {
|
|
1909
|
+
return parseSize2DDimensionPercentage(declaration.value, builder);
|
|
1910
|
+
}
|
|
1911
|
+
function parseSize2DDimensionPercentage(value, builder) {
|
|
1912
|
+
return parseLength(value[0], builder);
|
|
1913
|
+
}
|
|
1914
|
+
function addTransitionValue(declaration, builder) {
|
|
1750
1915
|
switch (declaration.property) {
|
|
1751
1916
|
case "transition":
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
for (const
|
|
1755
|
-
|
|
1756
|
-
|
|
1917
|
+
{
|
|
1918
|
+
const grouped = {};
|
|
1919
|
+
for (const animation of declaration.value) {
|
|
1920
|
+
for (const [key, value] of Object.entries(animation)) {
|
|
1921
|
+
grouped[key] ??= [];
|
|
1922
|
+
grouped[key].push(value);
|
|
1923
|
+
}
|
|
1757
1924
|
}
|
|
1925
|
+
for (const [property, value] of Object.entries(grouped)) {
|
|
1926
|
+
addTransitionValue({
|
|
1927
|
+
property: `transition-${kebabCase(property)}`,
|
|
1928
|
+
value
|
|
1929
|
+
}, builder);
|
|
1930
|
+
}
|
|
1931
|
+
break;
|
|
1758
1932
|
}
|
|
1759
|
-
for (const [property, value] of Object.entries(grouped)) {
|
|
1760
|
-
addTransitionValue({
|
|
1761
|
-
property: `transition-${kebabCase(property)}`,
|
|
1762
|
-
value
|
|
1763
|
-
}, options);
|
|
1764
|
-
}
|
|
1765
|
-
break;
|
|
1766
1933
|
case "transition-property":
|
|
1767
1934
|
{
|
|
1768
|
-
|
|
1935
|
+
builder.addDescriptor(declaration.property, declaration.value.map(v => v.property).filter(v => v in parsers || v === "all" || v === "none").map(v => (0, _selectors.toRNProperty)(v)));
|
|
1936
|
+
return;
|
|
1769
1937
|
}
|
|
1770
1938
|
case "transition-duration":
|
|
1771
|
-
|
|
1939
|
+
builder.addDescriptor(declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1940
|
+
return;
|
|
1772
1941
|
case "transition-delay":
|
|
1773
|
-
|
|
1942
|
+
builder.addDescriptor(declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1943
|
+
return;
|
|
1774
1944
|
case "transition-timing-function":
|
|
1775
|
-
|
|
1945
|
+
builder.addDescriptor(declaration.property, (0, _keyframes.parseEasingFunction)(declaration.value));
|
|
1946
|
+
return;
|
|
1776
1947
|
}
|
|
1777
1948
|
}
|
|
1778
|
-
function addAnimationValue(declaration,
|
|
1949
|
+
function addAnimationValue(declaration, builder) {
|
|
1779
1950
|
switch (declaration.property) {
|
|
1780
1951
|
case "animation":
|
|
1781
1952
|
{
|
|
@@ -1790,48 +1961,48 @@ function addAnimationValue(declaration, options) {
|
|
|
1790
1961
|
addAnimationValue({
|
|
1791
1962
|
property: `animation-${kebabCase(property)}`,
|
|
1792
1963
|
value
|
|
1793
|
-
},
|
|
1964
|
+
}, builder);
|
|
1794
1965
|
}
|
|
1795
1966
|
break;
|
|
1796
1967
|
}
|
|
1797
1968
|
case "animation-delay":
|
|
1798
1969
|
{
|
|
1799
|
-
|
|
1970
|
+
builder.addDescriptor(declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1800
1971
|
break;
|
|
1801
1972
|
}
|
|
1802
1973
|
case "animation-direction":
|
|
1803
1974
|
{
|
|
1804
|
-
|
|
1975
|
+
builder.addDescriptor(declaration.property, declaration.value);
|
|
1805
1976
|
break;
|
|
1806
1977
|
}
|
|
1807
1978
|
case "animation-duration":
|
|
1808
1979
|
{
|
|
1809
|
-
|
|
1980
|
+
builder.addDescriptor(declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1810
1981
|
break;
|
|
1811
1982
|
}
|
|
1812
1983
|
case "animation-fill-mode":
|
|
1813
1984
|
{
|
|
1814
|
-
|
|
1985
|
+
builder.addDescriptor(declaration.property, declaration.value);
|
|
1815
1986
|
break;
|
|
1816
1987
|
}
|
|
1817
1988
|
case "animation-iteration-count":
|
|
1818
1989
|
{
|
|
1819
|
-
|
|
1990
|
+
builder.addDescriptor(declaration.property, (0, _keyframes.parseIterationCount)(declaration.value));
|
|
1820
1991
|
break;
|
|
1821
1992
|
}
|
|
1822
1993
|
case "animation-name":
|
|
1823
1994
|
{
|
|
1824
|
-
|
|
1995
|
+
builder.addDescriptor(declaration.property, declaration.value.map(v => v.type === "none" ? "none" : [{}, "animationName", [v.value], 1]));
|
|
1825
1996
|
break;
|
|
1826
1997
|
}
|
|
1827
1998
|
case "animation-play-state":
|
|
1828
1999
|
{
|
|
1829
|
-
|
|
2000
|
+
builder.addDescriptor(declaration.property, declaration.value);
|
|
1830
2001
|
break;
|
|
1831
2002
|
}
|
|
1832
2003
|
case "animation-timing-function":
|
|
1833
2004
|
{
|
|
1834
|
-
|
|
2005
|
+
builder.addDescriptor(declaration.property, (0, _keyframes.parseEasingFunction)(declaration.value));
|
|
1835
2006
|
break;
|
|
1836
2007
|
}
|
|
1837
2008
|
}
|
|
@@ -1839,5 +2010,86 @@ function addAnimationValue(declaration, options) {
|
|
|
1839
2010
|
function kebabCase(str) {
|
|
1840
2011
|
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1841
2012
|
}
|
|
1842
|
-
|
|
2013
|
+
function parseBackgroundImage(declaration, builder) {
|
|
2014
|
+
builder.addDescriptor("experimental_backgroundImage", declaration.value.flatMap(image => {
|
|
2015
|
+
switch (image.type) {
|
|
2016
|
+
case "gradient":
|
|
2017
|
+
{
|
|
2018
|
+
const gradient = parseGradient(image.value, builder);
|
|
2019
|
+
return gradient ? [gradient] : [];
|
|
2020
|
+
}
|
|
2021
|
+
case "none":
|
|
2022
|
+
return ["none"];
|
|
2023
|
+
}
|
|
2024
|
+
return [];
|
|
2025
|
+
}));
|
|
2026
|
+
return;
|
|
2027
|
+
}
|
|
2028
|
+
function parseGradient(gradient, builder) {
|
|
2029
|
+
switch (gradient.type) {
|
|
2030
|
+
case "linear":
|
|
2031
|
+
{
|
|
2032
|
+
return [{}, "@linear-gradient", [parseLineDirection(gradient.direction, builder), ...gradient.items.map(item => parseGradientItem(item, builder))]];
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
return;
|
|
2036
|
+
}
|
|
2037
|
+
function parseLineDirection(lineDirection, builder) {
|
|
2038
|
+
switch (lineDirection.type) {
|
|
2039
|
+
case "corner":
|
|
2040
|
+
return `to ${lineDirection.horizontal} ${lineDirection.vertical}`;
|
|
2041
|
+
case "horizontal":
|
|
2042
|
+
case "vertical":
|
|
2043
|
+
return `to ${lineDirection.value}`;
|
|
2044
|
+
case "angle":
|
|
2045
|
+
return parseAngle(lineDirection.value, builder);
|
|
2046
|
+
default:
|
|
2047
|
+
{
|
|
2048
|
+
lineDirection;
|
|
2049
|
+
}
|
|
2050
|
+
}
|
|
2051
|
+
return;
|
|
2052
|
+
}
|
|
2053
|
+
function parseGradientItem(item, builder) {
|
|
2054
|
+
switch (item.type) {
|
|
2055
|
+
case "color-stop":
|
|
2056
|
+
{
|
|
2057
|
+
const args = [parseColor(item.color, builder)];
|
|
2058
|
+
if (item.position) {
|
|
2059
|
+
args.push(parseLength(item.position, builder));
|
|
2060
|
+
}
|
|
2061
|
+
return [{}, "@colorStop", args, 1];
|
|
2062
|
+
}
|
|
2063
|
+
case "hint":
|
|
2064
|
+
return parseLength(item.value, builder);
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
function parseFilter(declaration, builder) {
|
|
2068
|
+
if (declaration.value.type === "none") {
|
|
2069
|
+
return "unset";
|
|
2070
|
+
}
|
|
2071
|
+
return declaration.value.value.map(value => {
|
|
2072
|
+
switch (value.type) {
|
|
2073
|
+
case "opacity":
|
|
2074
|
+
case "blur":
|
|
2075
|
+
case "brightness":
|
|
2076
|
+
case "contrast":
|
|
2077
|
+
case "grayscale":
|
|
2078
|
+
case "invert":
|
|
2079
|
+
case "saturate":
|
|
2080
|
+
case "sepia":
|
|
2081
|
+
return {
|
|
2082
|
+
[value.type]: parseLength(value.value, builder)
|
|
2083
|
+
};
|
|
2084
|
+
case "hue-rotate":
|
|
2085
|
+
return {
|
|
2086
|
+
[value.type]: parseAngle(value.value, builder)
|
|
2087
|
+
};
|
|
2088
|
+
case "drop-shadow":
|
|
2089
|
+
case "url":
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
}).filter(value => value !== undefined);
|
|
2093
|
+
}
|
|
2094
|
+
const namedColors = new Set(["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"]);
|
|
1843
2095
|
//# sourceMappingURL=declarations.js.map
|