react-native-css 2.1.2 → 3.0.0-nightly.4723140
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/{LICENSE.md → LICENSE} +6 -8
- package/README.md +10 -86
- package/dist/commonjs/babel/helpers.js +129 -0
- package/dist/commonjs/babel/helpers.js.map +1 -0
- package/dist/commonjs/babel/import-plugin.js +97 -0
- package/dist/commonjs/babel/import-plugin.js.map +1 -0
- package/dist/commonjs/babel/index.js +9 -0
- package/dist/commonjs/babel/index.js.map +1 -0
- package/dist/commonjs/compiler/add.js +175 -0
- package/dist/commonjs/compiler/add.js.map +1 -0
- package/dist/commonjs/compiler/compiler.js +466 -0
- package/dist/commonjs/compiler/compiler.js.map +1 -0
- package/dist/commonjs/compiler/compiler.types.js +4 -0
- package/dist/commonjs/compiler/compiler.types.js.map +1 -0
- package/dist/commonjs/compiler/container-query.js +63 -0
- package/dist/commonjs/compiler/container-query.js.map +1 -0
- package/dist/commonjs/compiler/declarations.js +1843 -0
- package/dist/commonjs/compiler/declarations.js.map +1 -0
- package/dist/commonjs/compiler/functions-web.js +44 -0
- package/dist/commonjs/compiler/functions-web.js.map +1 -0
- package/dist/commonjs/compiler/functions.js +59 -0
- package/dist/commonjs/compiler/functions.js.map +1 -0
- package/dist/commonjs/compiler/index.js +17 -0
- package/dist/commonjs/compiler/index.js.map +1 -0
- package/dist/commonjs/compiler/keyframes.js +69 -0
- package/dist/commonjs/compiler/keyframes.js.map +1 -0
- package/dist/commonjs/compiler/media-query.js +172 -0
- package/dist/commonjs/compiler/media-query.js.map +1 -0
- package/dist/commonjs/compiler/selectors.js +330 -0
- package/dist/commonjs/compiler/selectors.js.map +1 -0
- package/dist/commonjs/components/ActivityIndicator.js +20 -0
- package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
- package/dist/commonjs/components/SafeAreaProvider/index.js +41 -0
- package/dist/commonjs/components/SafeAreaProvider/index.js.map +1 -0
- package/dist/commonjs/components/SafeAreaProvider/index.web.js +13 -0
- package/dist/commonjs/components/SafeAreaProvider/index.web.js.map +1 -0
- package/dist/commonjs/components/Text.js +15 -0
- package/dist/commonjs/components/Text.js.map +1 -0
- package/dist/commonjs/components/TextInput.js +20 -0
- package/dist/commonjs/components/TextInput.js.map +1 -0
- package/dist/commonjs/components/View.js +15 -0
- package/dist/commonjs/components/View.js.map +1 -0
- package/dist/commonjs/components/index.js +36 -0
- package/dist/commonjs/components/index.js.map +1 -0
- package/dist/commonjs/doctor/index.js +6 -0
- package/dist/commonjs/doctor/index.js.map +1 -0
- package/dist/commonjs/index.js +17 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/jest/expect.d.js +2 -0
- package/dist/commonjs/jest/expect.d.js.map +1 -0
- package/dist/commonjs/jest/index.js +49 -0
- package/dist/commonjs/jest/index.js.map +1 -0
- package/dist/commonjs/jest/setup.js +3 -0
- package/dist/commonjs/jest/setup.js.map +1 -0
- package/dist/commonjs/jest/setupAfterEnv.js +15 -0
- package/dist/commonjs/jest/setupAfterEnv.js.map +1 -0
- package/dist/commonjs/metro/index.js +106 -0
- package/dist/commonjs/metro/index.js.map +1 -0
- package/dist/commonjs/metro/injection-code.js +12 -0
- package/dist/commonjs/metro/injection-code.js.map +1 -0
- package/dist/commonjs/metro/metro-transformer.js +21 -0
- package/dist/commonjs/metro/metro-transformer.js.map +1 -0
- package/dist/commonjs/metro/picocolors.js +71 -0
- package/dist/commonjs/metro/picocolors.js.map +1 -0
- package/dist/commonjs/metro/stringify.js +59 -0
- package/dist/commonjs/metro/stringify.js.map +1 -0
- package/dist/commonjs/metro/typescript.js +47 -0
- package/dist/commonjs/metro/typescript.js.map +1 -0
- package/dist/commonjs/package.json +1 -0
- package/dist/commonjs/runtime/index.js +17 -0
- package/dist/commonjs/runtime/index.js.map +1 -0
- package/dist/commonjs/runtime/native/api.js +90 -0
- package/dist/commonjs/runtime/native/api.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +116 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/guards.js +27 -0
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/index.js +74 -0
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js +91 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -0
- package/dist/commonjs/runtime/native/index.js +18 -0
- package/dist/commonjs/runtime/native/index.js.map +1 -0
- package/dist/commonjs/runtime/native/injection.js +80 -0
- package/dist/commonjs/runtime/native/injection.js.map +1 -0
- package/dist/commonjs/runtime/native/metro.js +6 -0
- package/dist/commonjs/runtime/native/metro.js.map +1 -0
- package/dist/commonjs/runtime/native/react/interaction.js +63 -0
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -0
- package/dist/commonjs/runtime/native/react/rules.js +257 -0
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js +158 -0
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -0
- package/dist/commonjs/runtime/native/react/usePassthrough.js +50 -0
- package/dist/commonjs/runtime/native/react/usePassthrough.js.map +1 -0
- package/dist/commonjs/runtime/native/reactivity.js +193 -0
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/animation.js +90 -0
- package/dist/commonjs/runtime/native/styles/animation.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calc.js +113 -0
- package/dist/commonjs/runtime/native/styles/calc.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/constants.js +8 -0
- package/dist/commonjs/runtime/native/styles/constants.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/defaults.js +69 -0
- package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +223 -0
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/resolve.js +96 -0
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthand.js +62 -0
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/text-shadow.js +13 -0
- package/dist/commonjs/runtime/native/styles/text-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/transform.js +17 -0
- package/dist/commonjs/runtime/native/styles/transform.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/units.js +46 -0
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/variables.js +57 -0
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -0
- package/dist/commonjs/runtime/runtime.js +17 -0
- package/dist/commonjs/runtime/runtime.js.map +1 -0
- package/dist/commonjs/runtime/runtime.native.js +17 -0
- package/dist/commonjs/runtime/runtime.native.js.map +1 -0
- package/dist/commonjs/runtime/runtime.types.js +6 -0
- package/dist/commonjs/runtime/runtime.types.js.map +1 -0
- package/dist/commonjs/runtime/utils/components.js +18 -0
- package/dist/commonjs/runtime/utils/components.js.map +1 -0
- package/dist/commonjs/runtime/utils/dot-notation.types.js +2 -0
- package/dist/commonjs/runtime/utils/dot-notation.types.js.map +1 -0
- package/dist/commonjs/runtime/utils/index.js +61 -0
- package/dist/commonjs/runtime/utils/index.js.map +1 -0
- package/dist/commonjs/runtime/utils/objects.js +71 -0
- package/dist/commonjs/runtime/utils/objects.js.map +1 -0
- package/dist/commonjs/runtime/utils/specificity.js +43 -0
- package/dist/commonjs/runtime/utils/specificity.js.map +1 -0
- package/dist/commonjs/runtime/utils/style-value.js +14 -0
- package/dist/commonjs/runtime/utils/style-value.js.map +1 -0
- package/dist/commonjs/runtime/utils/utils.types.js +6 -0
- package/dist/commonjs/runtime/utils/utils.types.js.map +1 -0
- package/dist/commonjs/runtime/web/api.js +68 -0
- package/dist/commonjs/runtime/web/api.js.map +1 -0
- package/dist/commonjs/runtime/web/assign-style.js +27 -0
- package/dist/commonjs/runtime/web/assign-style.js.map +1 -0
- package/dist/commonjs/runtime/web/index.js +17 -0
- package/dist/commonjs/runtime/web/index.js.map +1 -0
- package/dist/module/babel/helpers.js +120 -0
- package/dist/module/babel/helpers.js.map +1 -0
- package/dist/module/babel/import-plugin.js +93 -0
- package/dist/module/babel/import-plugin.js.map +1 -0
- package/dist/module/babel/index.js +9 -0
- package/dist/module/babel/index.js.map +1 -0
- package/dist/module/compiler/add.js +168 -0
- package/dist/module/compiler/add.js.map +1 -0
- package/dist/module/compiler/compiler.js +461 -0
- package/dist/module/compiler/compiler.js.map +1 -0
- package/dist/module/compiler/compiler.types.js +72 -0
- package/dist/module/compiler/compiler.types.js.map +1 -0
- package/dist/module/compiler/container-query.js +59 -0
- package/dist/module/compiler/container-query.js.map +1 -0
- package/dist/module/compiler/declarations.js +1834 -0
- package/dist/module/compiler/declarations.js.map +1 -0
- package/dist/module/compiler/functions-web.js +32 -0
- package/dist/module/compiler/functions-web.js.map +1 -0
- package/dist/module/compiler/functions.js +47 -0
- package/dist/module/compiler/functions.js.map +1 -0
- package/dist/module/compiler/index.js +9 -0
- package/dist/module/compiler/index.js.map +1 -0
- package/dist/module/compiler/keyframes.js +63 -0
- package/dist/module/compiler/keyframes.js.map +1 -0
- package/dist/module/compiler/media-query.js +166 -0
- package/dist/module/compiler/media-query.js.map +1 -0
- package/dist/module/compiler/selectors.js +325 -0
- package/dist/module/compiler/selectors.js.map +1 -0
- package/dist/module/components/ActivityIndicator.js +16 -0
- package/dist/module/components/ActivityIndicator.js.map +1 -0
- package/dist/module/components/SafeAreaProvider/index.js +36 -0
- package/dist/module/components/SafeAreaProvider/index.js.map +1 -0
- package/dist/module/components/SafeAreaProvider/index.web.js +4 -0
- package/dist/module/components/SafeAreaProvider/index.web.js.map +1 -0
- package/dist/module/components/Text.js +11 -0
- package/dist/module/components/Text.js.map +1 -0
- package/dist/module/components/TextInput.js +16 -0
- package/dist/module/components/TextInput.js.map +1 -0
- package/dist/module/components/View.js +11 -0
- package/dist/module/components/View.js.map +1 -0
- package/dist/module/components/index.js +6 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/doctor/index.js +4 -0
- package/dist/module/doctor/index.js.map +1 -0
- package/dist/module/index.js +4 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/jest/expect.d.js +2 -0
- package/dist/module/jest/expect.d.js.map +1 -0
- package/dist/module/jest/index.js +28 -0
- package/dist/module/jest/index.js.map +1 -0
- package/dist/module/jest/setup.js +3 -0
- package/dist/module/jest/setup.js.map +1 -0
- package/dist/module/jest/setupAfterEnv.js +15 -0
- package/dist/module/jest/setupAfterEnv.js.map +1 -0
- package/dist/module/metro/index.js +100 -0
- package/dist/module/metro/index.js.map +1 -0
- package/dist/module/metro/injection-code.js +8 -0
- package/dist/module/metro/injection-code.js.map +1 -0
- package/dist/module/metro/metro-transformer.js +17 -0
- package/dist/module/metro/metro-transformer.js.map +1 -0
- package/dist/module/metro/picocolors.js +67 -0
- package/dist/module/metro/picocolors.js.map +1 -0
- package/dist/module/metro/stringify.js +55 -0
- package/dist/module/metro/stringify.js.map +1 -0
- package/dist/module/metro/typescript.js +42 -0
- package/dist/module/metro/typescript.js.map +1 -0
- package/dist/module/package.json +1 -0
- package/dist/module/runtime/index.js +9 -0
- package/dist/module/runtime/index.js.map +1 -0
- package/dist/module/runtime/native/api.js +75 -0
- package/dist/module/runtime/native/api.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +110 -0
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -0
- package/dist/module/runtime/native/conditions/guards.js +23 -0
- package/dist/module/runtime/native/conditions/guards.js.map +1 -0
- package/dist/module/runtime/native/conditions/index.js +70 -0
- package/dist/module/runtime/native/conditions/index.js.map +1 -0
- package/dist/module/runtime/native/conditions/media-query.js +86 -0
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -0
- package/dist/module/runtime/native/index.js +6 -0
- package/dist/module/runtime/native/index.js.map +1 -0
- package/dist/module/runtime/native/injection.js +75 -0
- package/dist/module/runtime/native/injection.js.map +1 -0
- package/dist/module/runtime/native/metro.js +5 -0
- package/dist/module/runtime/native/metro.js.map +1 -0
- package/dist/module/runtime/native/react/interaction.js +59 -0
- package/dist/module/runtime/native/react/interaction.js.map +1 -0
- package/dist/module/runtime/native/react/rules.js +251 -0
- package/dist/module/runtime/native/react/rules.js.map +1 -0
- package/dist/module/runtime/native/react/useNativeCss.js +152 -0
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -0
- package/dist/module/runtime/native/react/usePassthrough.js +45 -0
- package/dist/module/runtime/native/react/usePassthrough.js.map +1 -0
- package/dist/module/runtime/native/reactivity.js +181 -0
- package/dist/module/runtime/native/reactivity.js.map +1 -0
- package/dist/module/runtime/native/styles/animation.js +85 -0
- package/dist/module/runtime/native/styles/animation.js.map +1 -0
- package/dist/module/runtime/native/styles/calc.js +108 -0
- package/dist/module/runtime/native/styles/calc.js.map +1 -0
- package/dist/module/runtime/native/styles/constants.js +4 -0
- package/dist/module/runtime/native/styles/constants.js.map +1 -0
- package/dist/module/runtime/native/styles/defaults.js +65 -0
- package/dist/module/runtime/native/styles/defaults.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +218 -0
- package/dist/module/runtime/native/styles/index.js.map +1 -0
- package/dist/module/runtime/native/styles/resolve.js +92 -0
- package/dist/module/runtime/native/styles/resolve.js.map +1 -0
- package/dist/module/runtime/native/styles/shorthand.js +57 -0
- package/dist/module/runtime/native/styles/shorthand.js.map +1 -0
- package/dist/module/runtime/native/styles/text-shadow.js +9 -0
- package/dist/module/runtime/native/styles/text-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/transform.js +12 -0
- package/dist/module/runtime/native/styles/transform.js.map +1 -0
- package/dist/module/runtime/native/styles/units.js +37 -0
- package/dist/module/runtime/native/styles/units.js.map +1 -0
- package/dist/module/runtime/native/styles/variables.js +53 -0
- package/dist/module/runtime/native/styles/variables.js.map +1 -0
- package/dist/module/runtime/runtime.js +4 -0
- package/dist/module/runtime/runtime.js.map +1 -0
- package/dist/module/runtime/runtime.native.js +4 -0
- package/dist/module/runtime/runtime.native.js.map +1 -0
- package/dist/module/runtime/runtime.types.js +4 -0
- package/dist/module/runtime/runtime.types.js.map +1 -0
- package/dist/module/runtime/utils/components.js +14 -0
- package/dist/module/runtime/utils/components.js.map +1 -0
- package/dist/module/runtime/utils/dot-notation.types.js +2 -0
- package/dist/module/runtime/utils/dot-notation.types.js.map +1 -0
- package/dist/module/runtime/utils/index.js +8 -0
- package/dist/module/runtime/utils/index.js.map +1 -0
- package/dist/module/runtime/utils/objects.js +64 -0
- package/dist/module/runtime/utils/objects.js.map +1 -0
- package/dist/module/runtime/utils/specificity.js +38 -0
- package/dist/module/runtime/utils/specificity.js.map +1 -0
- package/dist/module/runtime/utils/style-value.js +10 -0
- package/dist/module/runtime/utils/style-value.js.map +1 -0
- package/dist/module/runtime/utils/utils.types.js +4 -0
- package/dist/module/runtime/utils/utils.types.js.map +1 -0
- package/dist/module/runtime/web/api.js +59 -0
- package/dist/module/runtime/web/api.js.map +1 -0
- package/dist/module/runtime/web/assign-style.js +23 -0
- package/dist/module/runtime/web/assign-style.js.map +1 -0
- package/dist/module/runtime/web/index.js +4 -0
- package/dist/module/runtime/web/index.js.map +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts +3 -0
- package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -0
- package/dist/typescript/commonjs/package.json +1 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts +18 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts +6 -0
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/babel/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/add.d.ts +10 -0
- package/dist/typescript/commonjs/src/compiler/add.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +10 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +279 -0
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts +5 -0
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +28 -0
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/functions-web.d.ts +11 -0
- package/dist/typescript/commonjs/src/compiler/functions-web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/functions.d.ts +11 -0
- package/dist/typescript/commonjs/src/compiler/functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/index.d.ts +7 -0
- package/dist/typescript/commonjs/src/compiler/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +6 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +7 -0
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +18 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +3 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +13 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/View.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/doctor/index.d.ts +2 -0
- package/dist/typescript/commonjs/src/doctor/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/index.d.ts +2 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/index.d.ts +14 -0
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/setup.d.ts +1 -0
- package/dist/typescript/commonjs/src/jest/setup.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/setupAfterEnv.d.ts +1 -0
- package/dist/typescript/commonjs/src/jest/setupAfterEnv.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts +10 -0
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +2 -0
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +3 -0
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/picocolors.d.ts +27 -0
- package/dist/typescript/commonjs/src/metro/picocolors.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/stringify.d.ts +7 -0
- package/dist/typescript/commonjs/src/metro/stringify.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/metro/typescript.d.ts +2 -0
- package/dist/typescript/commonjs/src/metro/typescript.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/index.d.ts +7 -0
- package/dist/typescript/commonjs/src/runtime/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +17 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +7 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +16 -0
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/metro.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/metro.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +37 -0
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/react/usePassthrough.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/react/usePassthrough.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +63 -0
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts +20 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts +14 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts +7 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/runtime.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/runtime.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/runtime.native.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/runtime.native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts +62 -0
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/dot-notation.types.d.ts +23 -0
- package/dist/typescript/commonjs/src/runtime/utils/dot-notation.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/utils/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/utils.types.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/utils/utils.types.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts +10 -0
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/web/assign-style.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/web/assign-style.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts.map +1 -0
- package/dist/typescript/module/example/src/App.d.ts +3 -0
- package/dist/typescript/module/example/src/App.d.ts.map +1 -0
- package/dist/typescript/module/package.json +1 -0
- package/dist/typescript/module/src/babel/helpers.d.ts +18 -0
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/import-plugin.d.ts +6 -0
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/index.d.ts +1 -0
- package/dist/typescript/module/src/babel/index.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/add.d.ts +10 -0
- package/dist/typescript/module/src/compiler/add.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts +10 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +279 -0
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/container-query.d.ts +5 -0
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/declarations.d.ts +28 -0
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/functions-web.d.ts +11 -0
- package/dist/typescript/module/src/compiler/functions-web.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/functions.d.ts +11 -0
- package/dist/typescript/module/src/compiler/functions.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/index.d.ts +7 -0
- package/dist/typescript/module/src/compiler/index.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts +6 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/media-query.d.ts +7 -0
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +18 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +3 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts +4 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts.map +1 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts +2 -0
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Text.d.ts +8 -0
- package/dist/typescript/module/src/components/Text.d.ts.map +1 -0
- package/dist/typescript/module/src/components/TextInput.d.ts +13 -0
- package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/module/src/components/View.d.ts +8 -0
- package/dist/typescript/module/src/components/View.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +4 -0
- package/dist/typescript/module/src/components/index.d.ts.map +1 -0
- package/dist/typescript/module/src/doctor/index.d.ts +2 -0
- package/dist/typescript/module/src/doctor/index.d.ts.map +1 -0
- package/dist/typescript/module/src/index.d.ts +2 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/index.d.ts +14 -0
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/setup.d.ts +1 -0
- package/dist/typescript/module/src/jest/setup.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/setupAfterEnv.d.ts +1 -0
- package/dist/typescript/module/src/jest/setupAfterEnv.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/index.d.ts +10 -0
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/injection-code.d.ts +2 -0
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +3 -0
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/picocolors.d.ts +27 -0
- package/dist/typescript/module/src/metro/picocolors.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/stringify.d.ts +7 -0
- package/dist/typescript/module/src/metro/stringify.d.ts.map +1 -0
- package/dist/typescript/module/src/metro/typescript.d.ts +2 -0
- package/dist/typescript/module/src/metro/typescript.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/index.d.ts +7 -0
- package/dist/typescript/module/src/runtime/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts +17 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +7 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/index.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/injection.d.ts +16 -0
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/metro.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/metro.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +37 -0
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/react/usePassthrough.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/react/usePassthrough.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +63 -0
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts +20 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts +14 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts +12 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts +7 -0
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/runtime.d.ts +2 -0
- package/dist/typescript/module/src/runtime/runtime.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/runtime.native.d.ts +2 -0
- package/dist/typescript/module/src/runtime/runtime.native.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/runtime.types.d.ts +62 -0
- package/dist/typescript/module/src/runtime/runtime.types.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/components.d.ts +2 -0
- package/dist/typescript/module/src/runtime/utils/components.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/dot-notation.types.d.ts +23 -0
- package/dist/typescript/module/src/runtime/utils/dot-notation.types.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/utils/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/objects.d.ts +4 -0
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts +12 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts +3 -0
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/utils/utils.types.d.ts +5 -0
- package/dist/typescript/module/src/runtime/utils/utils.types.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/web/api.d.ts +10 -0
- package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/web/assign-style.d.ts +2 -0
- package/dist/typescript/module/src/runtime/web/assign-style.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts +3 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts.map +1 -0
- package/package.json +191 -47
- package/src/babel/helpers.ts +182 -0
- package/src/babel/import-plugin.ts +183 -0
- package/src/babel/index.ts +9 -0
- package/src/compiler/add.ts +257 -0
- package/src/compiler/compiler.ts +627 -0
- package/src/compiler/compiler.types.ts +372 -0
- package/src/compiler/container-query.ts +97 -0
- package/src/compiler/declarations.ts +3146 -0
- package/src/compiler/functions-web.ts +44 -0
- package/src/compiler/functions.ts +64 -0
- package/src/compiler/index.ts +7 -0
- package/src/compiler/keyframes.ts +100 -0
- package/src/compiler/media-query.ts +250 -0
- package/src/compiler/selectors.ts +473 -0
- package/src/components/ActivityIndicator.tsx +19 -0
- package/src/components/SafeAreaProvider/index.tsx +50 -0
- package/src/components/SafeAreaProvider/index.web.tsx +1 -0
- package/src/components/Text.tsx +15 -0
- package/src/components/TextInput.tsx +20 -0
- package/src/components/View.tsx +15 -0
- package/src/components/index.tsx +4 -0
- package/src/doctor/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/jest/expect.d.ts +1 -0
- package/src/jest/index.ts +40 -0
- package/src/jest/setup.ts +1 -0
- package/src/jest/setupAfterEnv.ts +13 -0
- package/src/metro/index.ts +137 -0
- package/src/metro/injection-code.ts +8 -0
- package/src/metro/metro-transformer.ts +31 -0
- package/src/metro/picocolors.ts +77 -0
- package/src/metro/stringify.ts +59 -0
- package/src/metro/typescript.ts +73 -0
- package/src/runtime/index.ts +7 -0
- package/src/runtime/native/api.ts +106 -0
- package/src/runtime/native/conditions/container-query.ts +157 -0
- package/src/runtime/native/conditions/guards.ts +37 -0
- package/src/runtime/native/conditions/index.ts +106 -0
- package/src/runtime/native/conditions/media-query.ts +92 -0
- package/src/runtime/native/index.ts +5 -0
- package/src/runtime/native/injection.ts +101 -0
- package/src/runtime/native/metro.ts +2 -0
- package/src/runtime/native/react/interaction.ts +90 -0
- package/src/runtime/native/react/rules.ts +333 -0
- package/src/runtime/native/react/useNativeCss.ts +200 -0
- package/src/runtime/native/react/usePassthrough.ts +51 -0
- package/src/runtime/native/reactivity.ts +266 -0
- package/src/runtime/native/styles/animation.ts +142 -0
- package/src/runtime/native/styles/calc.ts +120 -0
- package/src/runtime/native/styles/constants.ts +1 -0
- package/src/runtime/native/styles/defaults.ts +78 -0
- package/src/runtime/native/styles/index.ts +333 -0
- package/src/runtime/native/styles/resolve.ts +131 -0
- package/src/runtime/native/styles/shorthand.ts +101 -0
- package/src/runtime/native/styles/text-shadow.ts +17 -0
- package/src/runtime/native/styles/transform.ts +15 -0
- package/src/runtime/native/styles/units.ts +48 -0
- package/src/runtime/native/styles/variables.ts +72 -0
- package/src/runtime/runtime.native.ts +1 -0
- package/src/runtime/runtime.ts +1 -0
- package/src/runtime/runtime.types.ts +155 -0
- package/src/runtime/utils/components.ts +15 -0
- package/src/runtime/utils/dot-notation.types.ts +118 -0
- package/src/runtime/utils/index.ts +5 -0
- package/src/runtime/utils/objects.ts +82 -0
- package/src/runtime/utils/specificity.ts +44 -0
- package/src/runtime/utils/style-value.ts +12 -0
- package/src/runtime/utils/utils.types.ts +19 -0
- package/src/runtime/web/api.ts +88 -0
- package/src/runtime/web/assign-style.ts +26 -0
- package/src/runtime/web/index.ts +2 -0
- package/.babelrc +0 -17
- package/.editorconfig +0 -17
- package/.eslintignore +0 -3
- package/.eslintrc +0 -39
- package/.npmignore +0 -7
- package/build/index.js +0 -299
- package/build/utils.js +0 -61
- package/circle.yml +0 -31
- package/jsconfig.json +0 -9
- package/login.sh +0 -11
- package/src/index.js +0 -184
- package/src/utils.js +0 -32
- package/test/rnc.test.js +0 -258
- package/yarn.lock +0 -3333
|
@@ -0,0 +1,1843 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.parseCalcFn = parseCalcFn;
|
|
7
|
+
exports.parseDeclaration = parseDeclaration;
|
|
8
|
+
exports.parseLength = parseLength;
|
|
9
|
+
exports.parseScale = parseScale;
|
|
10
|
+
exports.parseTranslate = parseTranslate;
|
|
11
|
+
exports.parseUnresolvedColor = parseUnresolvedColor;
|
|
12
|
+
var _constants = require("../runtime/native/styles/constants.js");
|
|
13
|
+
var _styleValue = require("../runtime/utils/style-value.js");
|
|
14
|
+
var _keyframes = require("./keyframes.js");
|
|
15
|
+
var _selectors = require("./selectors.js");
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
// cSpell:ignore rcap,vmin,svmin,lvmin,dvmin,cqmin,vmax,svmax,lvmax,dvmax,cqmax,currentcolor,oklab,oklch,prophoto
|
|
18
|
+
|
|
19
|
+
const propertyRename = {
|
|
20
|
+
"margin-inline-start": "margin-start",
|
|
21
|
+
"margin-inline-end": "margin-end",
|
|
22
|
+
"padding-inline-start": "padding-start",
|
|
23
|
+
"padding-inline-end": "padding-end"
|
|
24
|
+
};
|
|
25
|
+
const validProperties = ["align-content", "align-items", "align-self", "animation", "animation-delay", "animation-direction", "animation-duration", "animation-fill-mode", "animation-iteration-count", "animation-name", "animation-play-state", "animation-timing-function", "aspect-ratio", "background-color", "block-size", "border", "border-block", "border-block-color", "border-block-end", "border-block-end-color", "border-block-end-width", "border-block-start", "border-block-start-color", "border-block-start-width", "border-block-width", "border-bottom", "border-bottom-color", "border-bottom-left-radius", "border-bottom-right-radius", "border-bottom-width", "border-color", "border-end-end-radius", "border-end-start-radius", "border-inline", "border-inline-color", "border-inline-end", "border-inline-end-color", "border-inline-end-width", "border-inline-start", "border-inline-start-color", "border-inline-start-width", "border-inline-width", "border-left", "border-left-color", "border-left-width", "border-radius", "border-right", "border-right-color", "border-right-width", "border-start-end-radius", "border-start-start-radius", "border-style", "border-top", "border-top-color", "border-top-left-radius", "border-top-right-radius", "border-top-width", "border-width", "bottom", "box-shadow", "caret-color", "color", "column-gap", "container", "container-name", "container-type", "display", "fill", "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow", "flex-shrink", "flex-wrap", "font", "font-family", "font-size", "font-style", "font-variant-caps", "font-weight", "gap", "height", "inline-size", "inset", "inset-block", "inset-block-end", "inset-block-start", "inset-inline", "inset-inline-end", "inset-inline-start", "justify-content", "left", "letter-spacing", "line-height", "margin", "margin-block", "margin-block-end", "margin-block-start", "margin-bottom", "margin-inline", "margin-inline-end", "margin-inline-start", "margin-left", "margin-right", "margin-top", "max-block-size", "max-height", "max-inline-size", "max-width", "min-block-size", "min-height", "min-inline-size", "min-width", "opacity", "overflow", "padding", "padding-block", "padding-block-end", "padding-block-start", "padding-bottom", "padding-inline", "padding-inline-end", "padding-inline-start", "padding-left", "padding-right", "padding-top", "pointer-events", "position", "right", "rotate", "row-gap", "scale", "stroke", "stroke-width", "text-align", "text-decoration", "text-decoration-color", "text-decoration-line", "text-decoration-style", "text-shadow", "text-transform", "top", "transform", "transition", "transition-delay", "transition-duration", "transition-property", "transition-timing-function", "translate", "user-select", "vertical-align", "width", "z-index"];
|
|
26
|
+
const validPropertiesLoose = new Set(validProperties);
|
|
27
|
+
function parseDeclaration(declaration, options, add, addWarning) {
|
|
28
|
+
if ("vendorPrefix" in declaration && declaration.vendorPrefix.length) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if ("value" in declaration && typeof declaration.value === "object" && "vendorPrefix" in declaration.value && Array.isArray(declaration.value.vendorPrefix) && declaration.value.vendorPrefix.length) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (declaration.property === "unparsed") {
|
|
35
|
+
return parseDeclarationUnparsed(declaration, options, add, addWarning);
|
|
36
|
+
} else if (declaration.property === "custom") {
|
|
37
|
+
return parseDeclarationCustom(declaration, options, add, addWarning);
|
|
38
|
+
}
|
|
39
|
+
if (!isValid(declaration)) {
|
|
40
|
+
return addWarning("property", declaration.property);
|
|
41
|
+
}
|
|
42
|
+
const parseOptions = {
|
|
43
|
+
...options,
|
|
44
|
+
add,
|
|
45
|
+
addWarning(value) {
|
|
46
|
+
return addWarning("value", declaration.property, value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function handleStyleShorthand(name, options) {
|
|
50
|
+
if (allEqual(...Object.values(options))) {
|
|
51
|
+
return add("style", name, Object.values(options)[0]);
|
|
52
|
+
} else {
|
|
53
|
+
for (const [name, value] of Object.entries(options)) {
|
|
54
|
+
add("style", name, value);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
switch (declaration.property) {
|
|
59
|
+
case "background-color":
|
|
60
|
+
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
61
|
+
case "opacity":
|
|
62
|
+
return add("style", declaration.property, declaration.value);
|
|
63
|
+
case "color":
|
|
64
|
+
return add("style", declaration.property, parseColor(declaration.value, parseOptions));
|
|
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
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
function buildAddWarning(addWarning, property) {
|
|
605
|
+
return function (type, value) {
|
|
606
|
+
if (type === "property") {
|
|
607
|
+
return addWarning(type, property);
|
|
608
|
+
} else if (type === "value") {
|
|
609
|
+
return addWarning(type, property, value);
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function parseDeclarationUnparsed(declaration, options, add, addWarning) {
|
|
614
|
+
let property = declaration.value.propertyId.property;
|
|
615
|
+
if (!isValid(declaration.value.propertyId)) {
|
|
616
|
+
return addWarning("property", property);
|
|
617
|
+
}
|
|
618
|
+
const parseOptions = {
|
|
619
|
+
...options,
|
|
620
|
+
add,
|
|
621
|
+
addWarning: buildAddWarning(addWarning, property)
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* React Native doesn't support all the logical properties
|
|
626
|
+
*/
|
|
627
|
+
if (propertyRename[declaration.value.propertyId.property]) {
|
|
628
|
+
property = propertyRename[declaration.value.propertyId.property];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Unparsed shorthand properties need to be parsed at runtime
|
|
633
|
+
*/
|
|
634
|
+
if (runtimeShorthands.has(property)) {
|
|
635
|
+
let args = parseUnparsed(declaration.value.value, parseOptions);
|
|
636
|
+
if (!(0, _styleValue.isStyleDescriptorArray)(args)) {
|
|
637
|
+
args = [args];
|
|
638
|
+
}
|
|
639
|
+
if (property === "animation") {
|
|
640
|
+
return add("style", "animation", [{}, `@${(0, _selectors.toRNProperty)(property)}`, args]);
|
|
641
|
+
} else {
|
|
642
|
+
return add("style", property, [{}, `@${(0, _selectors.toRNProperty)(property)}`, args, 1]);
|
|
643
|
+
}
|
|
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
|
+
} else {
|
|
666
|
+
return addWarning("property", declaration.value.name);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function isValid(declaration) {
|
|
670
|
+
return validPropertiesLoose.has(declaration.property);
|
|
671
|
+
}
|
|
672
|
+
function reduceParseUnparsed(tokenOrValues, options) {
|
|
673
|
+
const result = tokenOrValues.map(tokenOrValue => parseUnparsed(tokenOrValue, options)).filter(v => v !== undefined);
|
|
674
|
+
if (result.length === 0) {
|
|
675
|
+
return undefined;
|
|
676
|
+
} else {
|
|
677
|
+
return result;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
function unparsedFunction(token, options) {
|
|
681
|
+
const args = reduceParseUnparsed(token.value.arguments, options);
|
|
682
|
+
return [{}, token.value.name, args];
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* 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
|
|
688
|
+
*/
|
|
689
|
+
function parseUnparsed(tokenOrValue, options) {
|
|
690
|
+
if (tokenOrValue === undefined || tokenOrValue === null) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
if (typeof tokenOrValue === "string") {
|
|
694
|
+
if (tokenOrValue === "true") {
|
|
695
|
+
return true;
|
|
696
|
+
} else if (tokenOrValue === "false") {
|
|
697
|
+
return false;
|
|
698
|
+
} else {
|
|
699
|
+
return tokenOrValue;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
if (typeof tokenOrValue === "number") {
|
|
703
|
+
return round(tokenOrValue);
|
|
704
|
+
}
|
|
705
|
+
if (Array.isArray(tokenOrValue)) {
|
|
706
|
+
const args = reduceParseUnparsed(tokenOrValue, options);
|
|
707
|
+
if (!args) return;
|
|
708
|
+
if (args.length === 1) return args[0];
|
|
709
|
+
return args;
|
|
710
|
+
}
|
|
711
|
+
switch (tokenOrValue.type) {
|
|
712
|
+
case "unresolved-color":
|
|
713
|
+
{
|
|
714
|
+
return parseUnresolvedColor(tokenOrValue.value, options);
|
|
715
|
+
}
|
|
716
|
+
case "var":
|
|
717
|
+
{
|
|
718
|
+
const args = [tokenOrValue.value.name.ident.slice(2)];
|
|
719
|
+
const fallback = parseUnparsed(tokenOrValue.value.fallback, options);
|
|
720
|
+
if (fallback !== undefined) {
|
|
721
|
+
args.push(fallback);
|
|
722
|
+
}
|
|
723
|
+
return [{}, "var", args, 1];
|
|
724
|
+
}
|
|
725
|
+
case "function":
|
|
726
|
+
{
|
|
727
|
+
switch (tokenOrValue.value.name) {
|
|
728
|
+
case "translate":
|
|
729
|
+
case "rotate":
|
|
730
|
+
case "rotateX":
|
|
731
|
+
case "rotateY":
|
|
732
|
+
case "skewX":
|
|
733
|
+
case "skewY":
|
|
734
|
+
case "scale":
|
|
735
|
+
case "scaleX":
|
|
736
|
+
case "scaleY":
|
|
737
|
+
case "translateX":
|
|
738
|
+
case "translateY":
|
|
739
|
+
tokenOrValue.value.name = `@${tokenOrValue.value.name}`;
|
|
740
|
+
return unparsedFunction(tokenOrValue, options);
|
|
741
|
+
case "platformColor":
|
|
742
|
+
case "getPixelSizeForLayoutSize":
|
|
743
|
+
case "roundToNearestPixel":
|
|
744
|
+
case "pixelScale":
|
|
745
|
+
case "fontScale":
|
|
746
|
+
case "shadow":
|
|
747
|
+
case "rgb":
|
|
748
|
+
case "rgba":
|
|
749
|
+
case "hsl":
|
|
750
|
+
case "hsla":
|
|
751
|
+
return unparsedFunction(tokenOrValue, options);
|
|
752
|
+
case "hairlineWidth":
|
|
753
|
+
return [{}, tokenOrValue.value.name, []];
|
|
754
|
+
case "platformSelect":
|
|
755
|
+
case "fontScaleSelect":
|
|
756
|
+
case "pixelScaleSelect":
|
|
757
|
+
return parseRNRuntimeSpecificsFunction(tokenOrValue.value.name, tokenOrValue.value.arguments, options);
|
|
758
|
+
case "calc":
|
|
759
|
+
case "max":
|
|
760
|
+
case "min":
|
|
761
|
+
case "clamp":
|
|
762
|
+
return parseCalcFn(tokenOrValue.value.name, tokenOrValue.value.arguments, options);
|
|
763
|
+
default:
|
|
764
|
+
{
|
|
765
|
+
options.addWarning("function", tokenOrValue.value.name);
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
case "length":
|
|
771
|
+
return parseLength(tokenOrValue.value, options);
|
|
772
|
+
case "angle":
|
|
773
|
+
return parseAngle(tokenOrValue.value, options);
|
|
774
|
+
case "token":
|
|
775
|
+
switch (tokenOrValue.value.type) {
|
|
776
|
+
case "string":
|
|
777
|
+
case "number":
|
|
778
|
+
case "ident":
|
|
779
|
+
{
|
|
780
|
+
const value = tokenOrValue.value.value;
|
|
781
|
+
if (typeof value === "string") {
|
|
782
|
+
if (!options.allowAuto && value === "auto") {
|
|
783
|
+
return options.addWarning("value", value);
|
|
784
|
+
}
|
|
785
|
+
if (value === "inherit") {
|
|
786
|
+
return options.addWarning("value", value);
|
|
787
|
+
}
|
|
788
|
+
if (value === "true") {
|
|
789
|
+
return true;
|
|
790
|
+
} else if (value === "false") {
|
|
791
|
+
return false;
|
|
792
|
+
} else {
|
|
793
|
+
return value;
|
|
794
|
+
}
|
|
795
|
+
} else {
|
|
796
|
+
return value;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
case "function":
|
|
800
|
+
options.addWarning("value", tokenOrValue.value.value);
|
|
801
|
+
return;
|
|
802
|
+
case "percentage":
|
|
803
|
+
return `${round(tokenOrValue.value.value * 100)}%`;
|
|
804
|
+
case "dimension":
|
|
805
|
+
return parseDimension(tokenOrValue.value, options);
|
|
806
|
+
case "at-keyword":
|
|
807
|
+
case "hash":
|
|
808
|
+
case "id-hash":
|
|
809
|
+
case "unquoted-url":
|
|
810
|
+
case "delim":
|
|
811
|
+
case "white-space":
|
|
812
|
+
case "comment":
|
|
813
|
+
case "colon":
|
|
814
|
+
case "semicolon":
|
|
815
|
+
case "comma":
|
|
816
|
+
case "include-match":
|
|
817
|
+
case "dash-match":
|
|
818
|
+
case "prefix-match":
|
|
819
|
+
case "suffix-match":
|
|
820
|
+
case "substring-match":
|
|
821
|
+
case "cdo":
|
|
822
|
+
case "cdc":
|
|
823
|
+
case "parenthesis-block":
|
|
824
|
+
case "square-bracket-block":
|
|
825
|
+
case "curly-bracket-block":
|
|
826
|
+
case "bad-url":
|
|
827
|
+
case "bad-string":
|
|
828
|
+
case "close-parenthesis":
|
|
829
|
+
case "close-square-bracket":
|
|
830
|
+
case "close-curly-bracket":
|
|
831
|
+
return;
|
|
832
|
+
default:
|
|
833
|
+
{
|
|
834
|
+
tokenOrValue.value;
|
|
835
|
+
return;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
case "color":
|
|
839
|
+
return parseColor(tokenOrValue.value, options);
|
|
840
|
+
case "env":
|
|
841
|
+
return parseEnv(tokenOrValue.value, options);
|
|
842
|
+
case "time":
|
|
843
|
+
return parseTime(tokenOrValue.value);
|
|
844
|
+
case "url":
|
|
845
|
+
case "resolution":
|
|
846
|
+
case "dashed-ident":
|
|
847
|
+
case "animation-name":
|
|
848
|
+
return;
|
|
849
|
+
default:
|
|
850
|
+
{
|
|
851
|
+
tokenOrValue;
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
return;
|
|
855
|
+
}
|
|
856
|
+
function parseLength(length, options) {
|
|
857
|
+
const {
|
|
858
|
+
inlineRem = 14
|
|
859
|
+
} = options;
|
|
860
|
+
if (typeof length === "number") {
|
|
861
|
+
return length;
|
|
862
|
+
}
|
|
863
|
+
if ("unit" in length) {
|
|
864
|
+
switch (length.unit) {
|
|
865
|
+
case "px":
|
|
866
|
+
return length.value;
|
|
867
|
+
case "rem":
|
|
868
|
+
if (typeof inlineRem === "number") {
|
|
869
|
+
return length.value * inlineRem;
|
|
870
|
+
} else {
|
|
871
|
+
return [{}, "rem", [length.value]];
|
|
872
|
+
}
|
|
873
|
+
case "vw":
|
|
874
|
+
case "vh":
|
|
875
|
+
case "em":
|
|
876
|
+
return [{}, length.unit, [length.value], 1];
|
|
877
|
+
case "in":
|
|
878
|
+
case "cm":
|
|
879
|
+
case "mm":
|
|
880
|
+
case "q":
|
|
881
|
+
case "pt":
|
|
882
|
+
case "pc":
|
|
883
|
+
case "ex":
|
|
884
|
+
case "rex":
|
|
885
|
+
case "ch":
|
|
886
|
+
case "rch":
|
|
887
|
+
case "cap":
|
|
888
|
+
case "rcap":
|
|
889
|
+
case "ic":
|
|
890
|
+
case "ric":
|
|
891
|
+
case "lh":
|
|
892
|
+
case "rlh":
|
|
893
|
+
case "lvw":
|
|
894
|
+
case "svw":
|
|
895
|
+
case "dvw":
|
|
896
|
+
case "cqw":
|
|
897
|
+
case "lvh":
|
|
898
|
+
case "svh":
|
|
899
|
+
case "dvh":
|
|
900
|
+
case "cqh":
|
|
901
|
+
case "vi":
|
|
902
|
+
case "svi":
|
|
903
|
+
case "lvi":
|
|
904
|
+
case "dvi":
|
|
905
|
+
case "cqi":
|
|
906
|
+
case "vb":
|
|
907
|
+
case "svb":
|
|
908
|
+
case "lvb":
|
|
909
|
+
case "dvb":
|
|
910
|
+
case "cqb":
|
|
911
|
+
case "vmin":
|
|
912
|
+
case "svmin":
|
|
913
|
+
case "lvmin":
|
|
914
|
+
case "dvmin":
|
|
915
|
+
case "cqmin":
|
|
916
|
+
case "vmax":
|
|
917
|
+
case "svmax":
|
|
918
|
+
case "lvmax":
|
|
919
|
+
case "dvmax":
|
|
920
|
+
case "cqmax":
|
|
921
|
+
options.addWarning("value", `${length.value}${length.unit}`);
|
|
922
|
+
return undefined;
|
|
923
|
+
default:
|
|
924
|
+
{
|
|
925
|
+
length.unit;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
} else {
|
|
929
|
+
switch (length.type) {
|
|
930
|
+
case "calc":
|
|
931
|
+
{
|
|
932
|
+
// TODO: Add the calc polyfill
|
|
933
|
+
return undefined;
|
|
934
|
+
}
|
|
935
|
+
case "number":
|
|
936
|
+
{
|
|
937
|
+
return round(length.value);
|
|
938
|
+
}
|
|
939
|
+
case "percentage":
|
|
940
|
+
{
|
|
941
|
+
return `${round(length.value * 100)}%`;
|
|
942
|
+
}
|
|
943
|
+
case "dimension":
|
|
944
|
+
case "value":
|
|
945
|
+
{
|
|
946
|
+
return parseLength(length.value, options);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
952
|
+
function parseAngle(angle, options) {
|
|
953
|
+
if (typeof angle === "number") {
|
|
954
|
+
return `${angle}deg`;
|
|
955
|
+
}
|
|
956
|
+
switch (angle.type) {
|
|
957
|
+
case "deg":
|
|
958
|
+
case "rad":
|
|
959
|
+
return `${angle.value}${angle.type}`;
|
|
960
|
+
default:
|
|
961
|
+
options.addWarning("value", angle.value);
|
|
962
|
+
return undefined;
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
function parseSize(size, options, {
|
|
966
|
+
allowAuto = false
|
|
967
|
+
} = {}) {
|
|
968
|
+
switch (size.type) {
|
|
969
|
+
case "length-percentage":
|
|
970
|
+
return parseLength(size.value, options);
|
|
971
|
+
case "none":
|
|
972
|
+
return size.type;
|
|
973
|
+
case "auto":
|
|
974
|
+
if (allowAuto) {
|
|
975
|
+
return size.type;
|
|
976
|
+
} else {
|
|
977
|
+
options.addWarning("value", size.type);
|
|
978
|
+
return undefined;
|
|
979
|
+
}
|
|
980
|
+
case "min-content":
|
|
981
|
+
case "max-content":
|
|
982
|
+
case "fit-content":
|
|
983
|
+
case "fit-content-function":
|
|
984
|
+
case "stretch":
|
|
985
|
+
case "contain":
|
|
986
|
+
options.addWarning("value", size.type);
|
|
987
|
+
return undefined;
|
|
988
|
+
default:
|
|
989
|
+
{
|
|
990
|
+
size;
|
|
991
|
+
}
|
|
992
|
+
}
|
|
993
|
+
return;
|
|
994
|
+
}
|
|
995
|
+
function parseColorOrAuto(color, options) {
|
|
996
|
+
if (color.type === "auto") {
|
|
997
|
+
options.addWarning("value", `Invalid color value ${color.type}`);
|
|
998
|
+
return;
|
|
999
|
+
} else {
|
|
1000
|
+
return parseColor(color.value, options);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
function parseColor(color, options) {
|
|
1004
|
+
if (typeof color === "string") {
|
|
1005
|
+
// TODO: Could web system colors be mapped to native?
|
|
1006
|
+
return;
|
|
1007
|
+
}
|
|
1008
|
+
switch (color.type) {
|
|
1009
|
+
case "rgb":
|
|
1010
|
+
{
|
|
1011
|
+
// Hex is smaller than rgb, so we convert it
|
|
1012
|
+
const hexValues = [color.r.toString(16).padStart(2, "0"), color.g.toString(16).padStart(2, "0"), color.b.toString(16).padStart(2, "0")];
|
|
1013
|
+
if (color.alpha !== 1) {
|
|
1014
|
+
hexValues.push(Math.round(color.alpha * 255).toString(16).padStart(2, "0"));
|
|
1015
|
+
}
|
|
1016
|
+
return `#${hexValues.join("")}`;
|
|
1017
|
+
}
|
|
1018
|
+
case "hsl":
|
|
1019
|
+
return `hsla(${color.h}, ${color.s}, ${color.l}, ${color.alpha})`;
|
|
1020
|
+
case "currentcolor":
|
|
1021
|
+
options.addWarning("value", color.type);
|
|
1022
|
+
return;
|
|
1023
|
+
case "light-dark":
|
|
1024
|
+
case "lab":
|
|
1025
|
+
case "lch":
|
|
1026
|
+
case "oklab":
|
|
1027
|
+
case "oklch":
|
|
1028
|
+
case "srgb":
|
|
1029
|
+
case "srgb-linear":
|
|
1030
|
+
case "display-p3":
|
|
1031
|
+
case "a98-rgb":
|
|
1032
|
+
case "prophoto-rgb":
|
|
1033
|
+
case "rec2020":
|
|
1034
|
+
case "xyz-d50":
|
|
1035
|
+
case "xyz-d65":
|
|
1036
|
+
case "hwb":
|
|
1037
|
+
options.addWarning("value", `Invalid color unit ${color.type}`);
|
|
1038
|
+
return undefined;
|
|
1039
|
+
default:
|
|
1040
|
+
{
|
|
1041
|
+
color;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return;
|
|
1045
|
+
}
|
|
1046
|
+
function parseLengthPercentageOrAuto(lengthPercentageOrAuto, options, {
|
|
1047
|
+
allowAuto = false
|
|
1048
|
+
} = {}) {
|
|
1049
|
+
switch (lengthPercentageOrAuto.type) {
|
|
1050
|
+
case "auto":
|
|
1051
|
+
if (allowAuto) {
|
|
1052
|
+
return lengthPercentageOrAuto.type;
|
|
1053
|
+
} else {
|
|
1054
|
+
options.addWarning("value", lengthPercentageOrAuto.type);
|
|
1055
|
+
return undefined;
|
|
1056
|
+
}
|
|
1057
|
+
case "length-percentage":
|
|
1058
|
+
return parseLength(lengthPercentageOrAuto.value, options);
|
|
1059
|
+
default:
|
|
1060
|
+
{
|
|
1061
|
+
lengthPercentageOrAuto;
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
function parseJustifyContent(justifyContent, options) {
|
|
1067
|
+
const allowed = new Set(["flex-start", "flex-end", "center", "space-between", "space-around", "space-evenly"]);
|
|
1068
|
+
let value;
|
|
1069
|
+
switch (justifyContent.type) {
|
|
1070
|
+
case "normal":
|
|
1071
|
+
case "left":
|
|
1072
|
+
case "right":
|
|
1073
|
+
value = justifyContent.type;
|
|
1074
|
+
break;
|
|
1075
|
+
case "content-distribution":
|
|
1076
|
+
case "content-position":
|
|
1077
|
+
value = justifyContent.value;
|
|
1078
|
+
break;
|
|
1079
|
+
default:
|
|
1080
|
+
{
|
|
1081
|
+
justifyContent;
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
if (value && !allowed.has(value)) {
|
|
1085
|
+
options.addWarning("value", value);
|
|
1086
|
+
return;
|
|
1087
|
+
}
|
|
1088
|
+
return value;
|
|
1089
|
+
}
|
|
1090
|
+
function parseAlignContent(alignContent, options) {
|
|
1091
|
+
const allowed = new Set(["flex-start", "flex-end", "center", "stretch", "space-between", "space-around"]);
|
|
1092
|
+
let value;
|
|
1093
|
+
switch (alignContent.type) {
|
|
1094
|
+
case "normal":
|
|
1095
|
+
case "baseline-position":
|
|
1096
|
+
value = alignContent.type;
|
|
1097
|
+
break;
|
|
1098
|
+
case "content-distribution":
|
|
1099
|
+
case "content-position":
|
|
1100
|
+
value = alignContent.value;
|
|
1101
|
+
break;
|
|
1102
|
+
default:
|
|
1103
|
+
{
|
|
1104
|
+
alignContent;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
if (value && !allowed.has(value)) {
|
|
1108
|
+
options.addWarning("value", value);
|
|
1109
|
+
return;
|
|
1110
|
+
}
|
|
1111
|
+
return value;
|
|
1112
|
+
}
|
|
1113
|
+
function parseAlignItems(alignItems, options) {
|
|
1114
|
+
const allowed = new Set(["auto", "flex-start", "flex-end", "center", "stretch", "baseline"]);
|
|
1115
|
+
let value;
|
|
1116
|
+
switch (alignItems.type) {
|
|
1117
|
+
case "normal":
|
|
1118
|
+
value = "auto";
|
|
1119
|
+
break;
|
|
1120
|
+
case "stretch":
|
|
1121
|
+
value = alignItems.type;
|
|
1122
|
+
break;
|
|
1123
|
+
case "baseline-position":
|
|
1124
|
+
value = "baseline";
|
|
1125
|
+
break;
|
|
1126
|
+
case "self-position":
|
|
1127
|
+
value = alignItems.value;
|
|
1128
|
+
break;
|
|
1129
|
+
default:
|
|
1130
|
+
{
|
|
1131
|
+
alignItems;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
if (value && !allowed.has(value)) {
|
|
1135
|
+
options.addWarning("value", value);
|
|
1136
|
+
return;
|
|
1137
|
+
}
|
|
1138
|
+
return value;
|
|
1139
|
+
}
|
|
1140
|
+
function parseAlignSelf(alignSelf, options) {
|
|
1141
|
+
const allowed = new Set(["auto", "flex-start", "flex-end", "center", "stretch", "baseline"]);
|
|
1142
|
+
let value;
|
|
1143
|
+
switch (alignSelf.type) {
|
|
1144
|
+
case "normal":
|
|
1145
|
+
case "auto":
|
|
1146
|
+
value = "auto";
|
|
1147
|
+
break;
|
|
1148
|
+
case "stretch":
|
|
1149
|
+
value = alignSelf.type;
|
|
1150
|
+
break;
|
|
1151
|
+
case "baseline-position":
|
|
1152
|
+
value = "baseline";
|
|
1153
|
+
break;
|
|
1154
|
+
case "self-position":
|
|
1155
|
+
value = alignSelf.value;
|
|
1156
|
+
break;
|
|
1157
|
+
default:
|
|
1158
|
+
{
|
|
1159
|
+
alignSelf;
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
if (value && !allowed.has(value)) {
|
|
1163
|
+
options.addWarning("value", value);
|
|
1164
|
+
return;
|
|
1165
|
+
}
|
|
1166
|
+
return value;
|
|
1167
|
+
}
|
|
1168
|
+
function parseFontWeight(fontWeight, options) {
|
|
1169
|
+
switch (fontWeight.type) {
|
|
1170
|
+
case "absolute":
|
|
1171
|
+
if (fontWeight.value.type === "weight") {
|
|
1172
|
+
return fontWeight.value.value.toString();
|
|
1173
|
+
} else {
|
|
1174
|
+
return fontWeight.value.type;
|
|
1175
|
+
}
|
|
1176
|
+
case "bolder":
|
|
1177
|
+
case "lighter":
|
|
1178
|
+
options.addWarning("value", fontWeight.type);
|
|
1179
|
+
return;
|
|
1180
|
+
default:
|
|
1181
|
+
{
|
|
1182
|
+
fontWeight;
|
|
1183
|
+
}
|
|
1184
|
+
}
|
|
1185
|
+
return;
|
|
1186
|
+
}
|
|
1187
|
+
function parseTextShadow(add, [textShadow], options) {
|
|
1188
|
+
if (!textShadow) {
|
|
1189
|
+
return;
|
|
1190
|
+
}
|
|
1191
|
+
add("style", "textShadowColor", parseColor(textShadow.color, options));
|
|
1192
|
+
add("style", "textShadowOffset.width", parseLength(textShadow.xOffset, options));
|
|
1193
|
+
add("style", "textShadowOffset.height", parseLength(textShadow.yOffset, options));
|
|
1194
|
+
add("style", "textShadowRadius", parseLength(textShadow.blur, options));
|
|
1195
|
+
}
|
|
1196
|
+
function parseTextDecorationStyle(textDecorationStyle, options) {
|
|
1197
|
+
const allowed = new Set(["solid", "double", "dotted", "dashed"]);
|
|
1198
|
+
if (allowed.has(textDecorationStyle)) {
|
|
1199
|
+
return textDecorationStyle;
|
|
1200
|
+
}
|
|
1201
|
+
options.addWarning("value", textDecorationStyle);
|
|
1202
|
+
return undefined;
|
|
1203
|
+
}
|
|
1204
|
+
function parseTextDecorationLine(textDecorationLine, options) {
|
|
1205
|
+
if (!Array.isArray(textDecorationLine)) {
|
|
1206
|
+
if (textDecorationLine === "none") {
|
|
1207
|
+
return textDecorationLine;
|
|
1208
|
+
}
|
|
1209
|
+
options.addWarning("value", textDecorationLine);
|
|
1210
|
+
return;
|
|
1211
|
+
}
|
|
1212
|
+
const set = new Set(textDecorationLine);
|
|
1213
|
+
if (set.has("underline")) {
|
|
1214
|
+
if (set.has("line-through")) {
|
|
1215
|
+
return "underline line-through";
|
|
1216
|
+
} else {
|
|
1217
|
+
return "underline";
|
|
1218
|
+
}
|
|
1219
|
+
} else if (set.has("line-through")) {
|
|
1220
|
+
return "line-through";
|
|
1221
|
+
}
|
|
1222
|
+
options.addWarning("value", textDecorationLine.join(" "));
|
|
1223
|
+
return undefined;
|
|
1224
|
+
}
|
|
1225
|
+
function parseOverflow(overflow, options) {
|
|
1226
|
+
const allowed = new Set(["visible", "hidden"]);
|
|
1227
|
+
if (allowed.has(overflow)) {
|
|
1228
|
+
return overflow;
|
|
1229
|
+
}
|
|
1230
|
+
options.addWarning("value", overflow);
|
|
1231
|
+
return undefined;
|
|
1232
|
+
}
|
|
1233
|
+
function parseBorderStyle(borderStyle, options) {
|
|
1234
|
+
const allowed = new Set(["solid", "dotted", "dashed"]);
|
|
1235
|
+
if (typeof borderStyle === "string") {
|
|
1236
|
+
if (allowed.has(borderStyle)) {
|
|
1237
|
+
return borderStyle;
|
|
1238
|
+
} else {
|
|
1239
|
+
options.addWarning("value", borderStyle);
|
|
1240
|
+
return undefined;
|
|
1241
|
+
}
|
|
1242
|
+
} else if (borderStyle.top === borderStyle.bottom && borderStyle.top === borderStyle.left && borderStyle.top === borderStyle.right && allowed.has(borderStyle.top)) {
|
|
1243
|
+
return borderStyle.top;
|
|
1244
|
+
}
|
|
1245
|
+
options.addWarning("value", borderStyle.top);
|
|
1246
|
+
return undefined;
|
|
1247
|
+
}
|
|
1248
|
+
function parseBorderSideWidth(borderSideWidth, options) {
|
|
1249
|
+
if (borderSideWidth.type === "length") {
|
|
1250
|
+
return parseLength(borderSideWidth.value, options);
|
|
1251
|
+
}
|
|
1252
|
+
options.addWarning("value", borderSideWidth.type);
|
|
1253
|
+
return undefined;
|
|
1254
|
+
}
|
|
1255
|
+
function parseVerticalAlign(verticalAlign, options) {
|
|
1256
|
+
if (verticalAlign.type === "length") {
|
|
1257
|
+
return undefined;
|
|
1258
|
+
}
|
|
1259
|
+
const allowed = new Set(["auto", "top", "bottom", "middle"]);
|
|
1260
|
+
if (allowed.has(verticalAlign.value)) {
|
|
1261
|
+
return verticalAlign.value;
|
|
1262
|
+
}
|
|
1263
|
+
options.addWarning("value", verticalAlign.value);
|
|
1264
|
+
return undefined;
|
|
1265
|
+
}
|
|
1266
|
+
function parseFontFamily(fontFamily) {
|
|
1267
|
+
// React Native only allows one font family - better hope this is the right one :)
|
|
1268
|
+
return fontFamily[0];
|
|
1269
|
+
}
|
|
1270
|
+
function parseLineHeight(lineHeight, options) {
|
|
1271
|
+
switch (lineHeight.type) {
|
|
1272
|
+
case "normal":
|
|
1273
|
+
return undefined;
|
|
1274
|
+
case "number":
|
|
1275
|
+
return [{}, "em", [lineHeight.value], 1];
|
|
1276
|
+
case "length":
|
|
1277
|
+
{
|
|
1278
|
+
const length = lineHeight.value;
|
|
1279
|
+
switch (length.type) {
|
|
1280
|
+
case "dimension":
|
|
1281
|
+
return parseLength(length, options);
|
|
1282
|
+
case "percentage":
|
|
1283
|
+
case "calc":
|
|
1284
|
+
options.addWarning("value", length.value);
|
|
1285
|
+
return undefined;
|
|
1286
|
+
default:
|
|
1287
|
+
{
|
|
1288
|
+
length;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
return;
|
|
1292
|
+
}
|
|
1293
|
+
default:
|
|
1294
|
+
{
|
|
1295
|
+
lineHeight;
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
return;
|
|
1299
|
+
}
|
|
1300
|
+
function parseFontSize(fontSize, options) {
|
|
1301
|
+
switch (fontSize.type) {
|
|
1302
|
+
case "length":
|
|
1303
|
+
return parseLength(fontSize.value, options);
|
|
1304
|
+
case "absolute":
|
|
1305
|
+
case "relative":
|
|
1306
|
+
options.addWarning("value", fontSize.value);
|
|
1307
|
+
return undefined;
|
|
1308
|
+
default:
|
|
1309
|
+
{
|
|
1310
|
+
fontSize;
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1315
|
+
function parseFontStyle(fontStyle, options) {
|
|
1316
|
+
switch (fontStyle.type) {
|
|
1317
|
+
case "normal":
|
|
1318
|
+
case "italic":
|
|
1319
|
+
return fontStyle.type;
|
|
1320
|
+
case "oblique":
|
|
1321
|
+
options.addWarning("value", fontStyle.type);
|
|
1322
|
+
return undefined;
|
|
1323
|
+
default:
|
|
1324
|
+
{
|
|
1325
|
+
fontStyle;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
function parseFontVariantCaps(fontVariantCaps, options) {
|
|
1331
|
+
const allowed = new Set(["small-caps", "oldstyle-nums", "lining-nums", "tabular-nums", "proportional-nums"]);
|
|
1332
|
+
if (allowed.has(fontVariantCaps)) {
|
|
1333
|
+
return fontVariantCaps;
|
|
1334
|
+
}
|
|
1335
|
+
options.addWarning("value", fontVariantCaps);
|
|
1336
|
+
return undefined;
|
|
1337
|
+
}
|
|
1338
|
+
function parseLengthOrCoercePercentageToRuntime(value, options) {
|
|
1339
|
+
return parseLength(value, options);
|
|
1340
|
+
}
|
|
1341
|
+
function parseGap(value, options) {
|
|
1342
|
+
if (value.type === "normal") {
|
|
1343
|
+
options.addWarning("value", value.type);
|
|
1344
|
+
return;
|
|
1345
|
+
}
|
|
1346
|
+
return parseLength(value.value, options);
|
|
1347
|
+
}
|
|
1348
|
+
function parseRNRuntimeSpecificsFunction(name, args, options) {
|
|
1349
|
+
let key;
|
|
1350
|
+
const runtimeArgs = {};
|
|
1351
|
+
for (const token of args) {
|
|
1352
|
+
if (!key) {
|
|
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
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
return [{}, name, Object.entries(runtimeArgs)];
|
|
1414
|
+
}
|
|
1415
|
+
function parseTextAlign(textAlign, options) {
|
|
1416
|
+
const allowed = new Set(["auto", "left", "right", "center", "justify"]);
|
|
1417
|
+
if (allowed.has(textAlign)) {
|
|
1418
|
+
return textAlign;
|
|
1419
|
+
}
|
|
1420
|
+
options.addWarning("value", textAlign);
|
|
1421
|
+
return undefined;
|
|
1422
|
+
}
|
|
1423
|
+
function parseBoxShadow(boxShadows, options) {
|
|
1424
|
+
if (boxShadows.length > 1) {
|
|
1425
|
+
options.addWarning("value", "multiple box shadows");
|
|
1426
|
+
return;
|
|
1427
|
+
}
|
|
1428
|
+
const boxShadow = boxShadows[0];
|
|
1429
|
+
if (!boxShadow) {
|
|
1430
|
+
return;
|
|
1431
|
+
}
|
|
1432
|
+
options.add("style", "shadowColor", parseColor(boxShadow.color, options));
|
|
1433
|
+
options.add("style", "shadowRadius", parseLength(boxShadow.spread, options));
|
|
1434
|
+
// options.add("style",
|
|
1435
|
+
// ["shadowOffsetWidth"],
|
|
1436
|
+
// parseLength(boxShadow.xOffset, options, ["", ""),
|
|
1437
|
+
// );
|
|
1438
|
+
// options.add("style",
|
|
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;
|
|
1447
|
+
} else {
|
|
1448
|
+
return options.addWarning("value", display.value);
|
|
1449
|
+
}
|
|
1450
|
+
} else if (display.type === "pair") {
|
|
1451
|
+
if (display.outside === "block") {
|
|
1452
|
+
switch (display.inside.type) {
|
|
1453
|
+
case "flow":
|
|
1454
|
+
if (display.isListItem) {
|
|
1455
|
+
return options.addWarning("value", "list-item");
|
|
1456
|
+
} else {
|
|
1457
|
+
return options.addWarning("value", "block");
|
|
1458
|
+
}
|
|
1459
|
+
case "flow-root":
|
|
1460
|
+
return options.addWarning("value", "flow-root");
|
|
1461
|
+
case "table":
|
|
1462
|
+
return options.addWarning("value", display.inside.type);
|
|
1463
|
+
case "flex":
|
|
1464
|
+
return display.inside.type;
|
|
1465
|
+
case "box":
|
|
1466
|
+
case "grid":
|
|
1467
|
+
case "ruby":
|
|
1468
|
+
return options.addWarning("value", display.inside.type);
|
|
1469
|
+
}
|
|
1470
|
+
} else {
|
|
1471
|
+
switch (display.inside.type) {
|
|
1472
|
+
case "flow":
|
|
1473
|
+
return options.addWarning("value", "inline");
|
|
1474
|
+
case "flow-root":
|
|
1475
|
+
return options.addWarning("value", "inline-block");
|
|
1476
|
+
case "table":
|
|
1477
|
+
return options.addWarning("value", "inline-table");
|
|
1478
|
+
case "flex":
|
|
1479
|
+
return options.addWarning("value", "inline-flex");
|
|
1480
|
+
case "box":
|
|
1481
|
+
case "grid":
|
|
1482
|
+
return options.addWarning("value", "inline-grid");
|
|
1483
|
+
case "ruby":
|
|
1484
|
+
return options.addWarning("value", display.inside.type);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
return;
|
|
1489
|
+
}
|
|
1490
|
+
function parseAspectRatio(
|
|
1491
|
+
// This is missing types
|
|
1492
|
+
aspectRatio) {
|
|
1493
|
+
if (aspectRatio.auto) {
|
|
1494
|
+
return "auto";
|
|
1495
|
+
} else {
|
|
1496
|
+
if (aspectRatio.ratio[0] === aspectRatio.ratio[1]) {
|
|
1497
|
+
return 1;
|
|
1498
|
+
} else {
|
|
1499
|
+
return aspectRatio.ratio.join(" / ");
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
function parseDimension({
|
|
1504
|
+
unit,
|
|
1505
|
+
value
|
|
1506
|
+
}, options) {
|
|
1507
|
+
switch (unit) {
|
|
1508
|
+
case "px":
|
|
1509
|
+
return value;
|
|
1510
|
+
case "%":
|
|
1511
|
+
return `${value}%`;
|
|
1512
|
+
case "rnh":
|
|
1513
|
+
case "rnw":
|
|
1514
|
+
return [{}, unit, [value / 100], 1];
|
|
1515
|
+
default:
|
|
1516
|
+
{
|
|
1517
|
+
return options.addWarning("value", `${value}${unit}`);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
function parseUserSelect(value, options) {
|
|
1522
|
+
const allowed = ["auto", "text", "none", "contain", "all"];
|
|
1523
|
+
if (allowed.includes(value)) {
|
|
1524
|
+
return value;
|
|
1525
|
+
} else {
|
|
1526
|
+
return options.addWarning("value", value);
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
function parseSVGPaint(value, options) {
|
|
1530
|
+
if (value.type === "none") {
|
|
1531
|
+
return "transparent";
|
|
1532
|
+
} else if (value.type === "color") {
|
|
1533
|
+
return parseColor(value.value, options);
|
|
1534
|
+
}
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1537
|
+
function round(number) {
|
|
1538
|
+
return Math.round((number + Number.EPSILON) * 100) / 100;
|
|
1539
|
+
}
|
|
1540
|
+
function parseDimensionPercentageFor_LengthValue(value, options) {
|
|
1541
|
+
if (value.type === "calc") {
|
|
1542
|
+
return undefined;
|
|
1543
|
+
} else if (value.type === "percentage") {
|
|
1544
|
+
return `${value.value}%`;
|
|
1545
|
+
} else {
|
|
1546
|
+
return parseLength(value.value, options);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
const allowAuto = new Set(["pointer-events"]);
|
|
1550
|
+
function parseEnv(value, options) {
|
|
1551
|
+
switch (value.name.type) {
|
|
1552
|
+
case "ua":
|
|
1553
|
+
switch (value.name.value) {
|
|
1554
|
+
case "safe-area-inset-top":
|
|
1555
|
+
case "safe-area-inset-right":
|
|
1556
|
+
case "safe-area-inset-bottom":
|
|
1557
|
+
case "safe-area-inset-left":
|
|
1558
|
+
return [{}, "var", [`--react-native-css-${value.name.value}`, parseUnparsed(value.fallback, options)], 1];
|
|
1559
|
+
case "viewport-segment-width":
|
|
1560
|
+
case "viewport-segment-height":
|
|
1561
|
+
case "viewport-segment-top":
|
|
1562
|
+
case "viewport-segment-left":
|
|
1563
|
+
case "viewport-segment-bottom":
|
|
1564
|
+
case "viewport-segment-right":
|
|
1565
|
+
}
|
|
1566
|
+
break;
|
|
1567
|
+
case "custom":
|
|
1568
|
+
case "unknown":
|
|
1569
|
+
}
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
function parseCalcFn(name, tokens, options) {
|
|
1573
|
+
const args = parseCalcArguments(tokens, options);
|
|
1574
|
+
if (args) {
|
|
1575
|
+
return [{}, name, args];
|
|
1576
|
+
}
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
function parseCalcArguments([...args], options) {
|
|
1580
|
+
const parsed = [];
|
|
1581
|
+
let mode;
|
|
1582
|
+
for (const [currentIndex, arg] of args.entries()) {
|
|
1583
|
+
switch (arg.type) {
|
|
1584
|
+
case "env":
|
|
1585
|
+
{
|
|
1586
|
+
parsed.push(parseEnv(arg.value, options));
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
case "var":
|
|
1590
|
+
case "function":
|
|
1591
|
+
case "unresolved-color":
|
|
1592
|
+
{
|
|
1593
|
+
const value = parseUnparsed(arg, options);
|
|
1594
|
+
if (value === undefined) {
|
|
1595
|
+
return undefined;
|
|
1596
|
+
}
|
|
1597
|
+
parsed.push(value);
|
|
1598
|
+
break;
|
|
1599
|
+
}
|
|
1600
|
+
case "length":
|
|
1601
|
+
{
|
|
1602
|
+
const value = parseLength(arg.value, options);
|
|
1603
|
+
if (value !== undefined) {
|
|
1604
|
+
parsed.push(value);
|
|
1605
|
+
}
|
|
1606
|
+
break;
|
|
1607
|
+
}
|
|
1608
|
+
case "color":
|
|
1609
|
+
case "url":
|
|
1610
|
+
case "angle":
|
|
1611
|
+
case "time":
|
|
1612
|
+
case "resolution":
|
|
1613
|
+
case "dashed-ident":
|
|
1614
|
+
break;
|
|
1615
|
+
case "token":
|
|
1616
|
+
switch (arg.value.type) {
|
|
1617
|
+
case "delim":
|
|
1618
|
+
switch (arg.value.value) {
|
|
1619
|
+
case "+":
|
|
1620
|
+
case "-":
|
|
1621
|
+
case "*":
|
|
1622
|
+
case "/":
|
|
1623
|
+
parsed.push(arg.value.value);
|
|
1624
|
+
break;
|
|
1625
|
+
}
|
|
1626
|
+
break;
|
|
1627
|
+
case "percentage":
|
|
1628
|
+
if (!mode) mode = "percentage";
|
|
1629
|
+
if (mode !== "percentage") return;
|
|
1630
|
+
parsed.push(`${arg.value.value * 100}%`);
|
|
1631
|
+
break;
|
|
1632
|
+
case "number":
|
|
1633
|
+
{
|
|
1634
|
+
if (!mode) mode = "number";
|
|
1635
|
+
if (mode !== "number") return;
|
|
1636
|
+
parsed.push(arg.value.value);
|
|
1637
|
+
break;
|
|
1638
|
+
}
|
|
1639
|
+
case "parenthesis-block":
|
|
1640
|
+
{
|
|
1641
|
+
/**
|
|
1642
|
+
* If we have a parenthesis block, we just treat it as a nested calc function
|
|
1643
|
+
* Because there could be multiple parenthesis blocks, this is recursive
|
|
1644
|
+
*/
|
|
1645
|
+
let closeParenthesisIndex = -1;
|
|
1646
|
+
for (let index = args.length - 1; index > 0; index--) {
|
|
1647
|
+
const value = args[index];
|
|
1648
|
+
if (value.type === "token" && value.value.type === "close-parenthesis") {
|
|
1649
|
+
closeParenthesisIndex = index;
|
|
1650
|
+
break;
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
if (closeParenthesisIndex === -1) {
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
const innerCalcArgs = args
|
|
1657
|
+
// Extract the inner calcArgs including the parenthesis. This mutates args
|
|
1658
|
+
.splice(currentIndex, closeParenthesisIndex - currentIndex + 1)
|
|
1659
|
+
// Then drop the surrounding parenthesis
|
|
1660
|
+
.slice(1, -1);
|
|
1661
|
+
parsed.push(parseCalcFn("calc", innerCalcArgs, options));
|
|
1662
|
+
break;
|
|
1663
|
+
}
|
|
1664
|
+
case "close-parenthesis":
|
|
1665
|
+
case "string":
|
|
1666
|
+
case "function":
|
|
1667
|
+
case "ident":
|
|
1668
|
+
case "at-keyword":
|
|
1669
|
+
case "hash":
|
|
1670
|
+
case "id-hash":
|
|
1671
|
+
case "unquoted-url":
|
|
1672
|
+
case "dimension":
|
|
1673
|
+
case "white-space":
|
|
1674
|
+
case "comment":
|
|
1675
|
+
case "colon":
|
|
1676
|
+
case "semicolon":
|
|
1677
|
+
case "comma":
|
|
1678
|
+
case "include-match":
|
|
1679
|
+
case "dash-match":
|
|
1680
|
+
case "prefix-match":
|
|
1681
|
+
case "suffix-match":
|
|
1682
|
+
case "substring-match":
|
|
1683
|
+
case "cdo":
|
|
1684
|
+
case "cdc":
|
|
1685
|
+
case "square-bracket-block":
|
|
1686
|
+
case "curly-bracket-block":
|
|
1687
|
+
case "bad-url":
|
|
1688
|
+
case "bad-string":
|
|
1689
|
+
case "close-square-bracket":
|
|
1690
|
+
case "close-curly-bracket":
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
return parsed;
|
|
1695
|
+
}
|
|
1696
|
+
function parseTranslate(translate, prop, options) {
|
|
1697
|
+
if (translate === "none") {
|
|
1698
|
+
return 0;
|
|
1699
|
+
}
|
|
1700
|
+
return parseLength(translate[prop], options);
|
|
1701
|
+
}
|
|
1702
|
+
function parseScale(translate, prop, options) {
|
|
1703
|
+
if (translate === "none") {
|
|
1704
|
+
return 0;
|
|
1705
|
+
}
|
|
1706
|
+
return parseLength(translate[prop], options);
|
|
1707
|
+
}
|
|
1708
|
+
function parseUnresolvedColor(color, options) {
|
|
1709
|
+
switch (color.type) {
|
|
1710
|
+
case "rgb":
|
|
1711
|
+
return [{}, "rgba", [round(color.r * 255), round(color.g * 255), round(color.b * 255), parseUnparsed(color.alpha, options)]];
|
|
1712
|
+
case "hsl":
|
|
1713
|
+
return [{}, color.type, [color.h, color.s, color.l, parseUnparsed(color.alpha, options)]];
|
|
1714
|
+
case "light-dark":
|
|
1715
|
+
return undefined;
|
|
1716
|
+
default:
|
|
1717
|
+
color;
|
|
1718
|
+
}
|
|
1719
|
+
return;
|
|
1720
|
+
}
|
|
1721
|
+
function allEqual(...params) {
|
|
1722
|
+
return params.every((param, index, array) => {
|
|
1723
|
+
return index === 0 ? true : equal(array[0], param);
|
|
1724
|
+
});
|
|
1725
|
+
}
|
|
1726
|
+
function equal(a, b) {
|
|
1727
|
+
if (a === b) return true;
|
|
1728
|
+
if (typeof a !== typeof b) return false;
|
|
1729
|
+
if (a === null || b === null) return false;
|
|
1730
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
1731
|
+
if (a.length !== b.length) return false;
|
|
1732
|
+
for (let i = 0; i < a.length; i++) {
|
|
1733
|
+
if (!equal(a[i], b[i])) return false;
|
|
1734
|
+
}
|
|
1735
|
+
return true;
|
|
1736
|
+
}
|
|
1737
|
+
if (typeof a === "object" && typeof b === "object") {
|
|
1738
|
+
if (Object.keys(a).length !== Object.keys(b).length) return false;
|
|
1739
|
+
for (const key in a) {
|
|
1740
|
+
if (!equal(a[key], b[key])) return false;
|
|
1741
|
+
}
|
|
1742
|
+
return true;
|
|
1743
|
+
}
|
|
1744
|
+
return false;
|
|
1745
|
+
}
|
|
1746
|
+
function parseTime(time) {
|
|
1747
|
+
return time.type === "milliseconds" ? time.value : time.value * 1000;
|
|
1748
|
+
}
|
|
1749
|
+
function addTransitionValue(declaration, options) {
|
|
1750
|
+
switch (declaration.property) {
|
|
1751
|
+
case "transition":
|
|
1752
|
+
const grouped = {};
|
|
1753
|
+
for (const animation of declaration.value) {
|
|
1754
|
+
for (const [key, value] of Object.entries(animation)) {
|
|
1755
|
+
grouped[key] ??= [];
|
|
1756
|
+
grouped[key].push(value);
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
for (const [property, value] of Object.entries(grouped)) {
|
|
1760
|
+
addTransitionValue({
|
|
1761
|
+
property: `transition-${kebabCase(property)}`,
|
|
1762
|
+
value
|
|
1763
|
+
}, options);
|
|
1764
|
+
}
|
|
1765
|
+
break;
|
|
1766
|
+
case "transition-property":
|
|
1767
|
+
{
|
|
1768
|
+
return options.add("transition", declaration.property, declaration.value.map(v => v.property));
|
|
1769
|
+
}
|
|
1770
|
+
case "transition-duration":
|
|
1771
|
+
return options.add("transition", declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1772
|
+
case "transition-delay":
|
|
1773
|
+
return options.add("transition", declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1774
|
+
case "transition-timing-function":
|
|
1775
|
+
return options.add("transition", declaration.property, (0, _keyframes.parseEasingFunction)(declaration.value));
|
|
1776
|
+
}
|
|
1777
|
+
}
|
|
1778
|
+
function addAnimationValue(declaration, options) {
|
|
1779
|
+
switch (declaration.property) {
|
|
1780
|
+
case "animation":
|
|
1781
|
+
{
|
|
1782
|
+
const grouped = {};
|
|
1783
|
+
for (const animation of declaration.value) {
|
|
1784
|
+
for (const [key, value] of Object.entries(animation)) {
|
|
1785
|
+
grouped[key] ??= [];
|
|
1786
|
+
grouped[key].push(value);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
for (const [property, value] of Object.entries(grouped)) {
|
|
1790
|
+
addAnimationValue({
|
|
1791
|
+
property: `animation-${kebabCase(property)}`,
|
|
1792
|
+
value
|
|
1793
|
+
}, options);
|
|
1794
|
+
}
|
|
1795
|
+
break;
|
|
1796
|
+
}
|
|
1797
|
+
case "animation-delay":
|
|
1798
|
+
{
|
|
1799
|
+
options.add("animation", declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1800
|
+
break;
|
|
1801
|
+
}
|
|
1802
|
+
case "animation-direction":
|
|
1803
|
+
{
|
|
1804
|
+
options.add("animation", declaration.property, declaration.value);
|
|
1805
|
+
break;
|
|
1806
|
+
}
|
|
1807
|
+
case "animation-duration":
|
|
1808
|
+
{
|
|
1809
|
+
options.add("animation", declaration.property, declaration.value.map(t => parseTime(t)));
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1812
|
+
case "animation-fill-mode":
|
|
1813
|
+
{
|
|
1814
|
+
options.add("animation", declaration.property, declaration.value);
|
|
1815
|
+
break;
|
|
1816
|
+
}
|
|
1817
|
+
case "animation-iteration-count":
|
|
1818
|
+
{
|
|
1819
|
+
options.add("animation", declaration.property, (0, _keyframes.parseIterationCount)(declaration.value));
|
|
1820
|
+
break;
|
|
1821
|
+
}
|
|
1822
|
+
case "animation-name":
|
|
1823
|
+
{
|
|
1824
|
+
options.add("animation", declaration.property, declaration.value.map(v => v.type === "none" ? "none" : [{}, "animationName", [v.value], 1]));
|
|
1825
|
+
break;
|
|
1826
|
+
}
|
|
1827
|
+
case "animation-play-state":
|
|
1828
|
+
{
|
|
1829
|
+
options.add("animation", declaration.property, declaration.value);
|
|
1830
|
+
break;
|
|
1831
|
+
}
|
|
1832
|
+
case "animation-timing-function":
|
|
1833
|
+
{
|
|
1834
|
+
options.add("animation", declaration.property, (0, _keyframes.parseEasingFunction)(declaration.value));
|
|
1835
|
+
break;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
function kebabCase(str) {
|
|
1840
|
+
return str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs) => (ofs ? "-" : "") + $.toLowerCase());
|
|
1841
|
+
}
|
|
1842
|
+
const runtimeShorthands = new Set(["animation", "text-shadow", "transform"]);
|
|
1843
|
+
//# sourceMappingURL=declarations.js.map
|