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