react-native-css 3.0.0-nightly.4723140 → 3.0.0-nightly.61014be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -1
- package/dist/commonjs/babel/allowedModules.js +23 -0
- package/dist/commonjs/babel/allowedModules.js.map +1 -0
- package/dist/commonjs/babel/helpers.js +18 -122
- package/dist/commonjs/babel/helpers.js.map +1 -1
- package/dist/commonjs/babel/import-plugin.js +62 -58
- package/dist/commonjs/babel/import-plugin.js.map +1 -1
- package/dist/commonjs/babel/react-native-web.js +118 -0
- package/dist/commonjs/babel/react-native-web.js.map +1 -0
- package/dist/commonjs/babel/react-native.js +118 -0
- package/dist/commonjs/babel/react-native.js.map +1 -0
- package/dist/commonjs/compiler/atRules.js +101 -0
- package/dist/commonjs/compiler/atRules.js.map +1 -0
- package/dist/commonjs/compiler/attributes.test.js +20 -0
- package/dist/commonjs/compiler/attributes.test.js.map +1 -0
- package/dist/commonjs/compiler/compiler.js +143 -344
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/compiler.types.js.map +1 -1
- package/dist/commonjs/compiler/container-query.js +10 -10
- package/dist/commonjs/compiler/container-query.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +1233 -988
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +78 -0
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -0
- package/dist/commonjs/compiler/keyframes.js +15 -24
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/media-query.js +22 -22
- package/dist/commonjs/compiler/media-query.js.map +1 -1
- package/dist/commonjs/compiler/selectors.js +264 -184
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/split-by-delimiter.js +21 -0
- package/dist/commonjs/compiler/split-by-delimiter.js.map +1 -0
- package/dist/commonjs/compiler/stylesheet.js +385 -0
- package/dist/commonjs/compiler/stylesheet.js.map +1 -0
- package/dist/commonjs/components/Text.js +2 -0
- package/dist/commonjs/components/Text.js.map +1 -1
- package/dist/commonjs/components/View.js +2 -0
- package/dist/commonjs/components/View.js.map +1 -1
- package/dist/commonjs/index.js +11 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/jest/index.js +2 -18
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +111 -50
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/injection-code.js +24 -4
- package/dist/commonjs/metro/injection-code.js.map +1 -1
- package/dist/commonjs/metro/resolver.js +62 -0
- package/dist/commonjs/metro/resolver.js.map +1 -0
- package/dist/commonjs/metro/typescript.js +1 -1
- package/dist/commonjs/poison.pill.js +36 -0
- package/dist/commonjs/poison.pill.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/guards.js +10 -4
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +2 -0
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/index.js +11 -1
- package/dist/commonjs/runtime/native/index.js.map +1 -1
- package/dist/commonjs/runtime/native/injection.js +18 -0
- package/dist/commonjs/runtime/native/injection.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +23 -27
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +1 -5
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/animation.js +70 -72
- package/dist/commonjs/runtime/native/styles/animation.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/border.js +12 -0
- package/dist/commonjs/runtime/native/styles/border.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/box-shadow.js +40 -0
- package/dist/commonjs/runtime/native/styles/box-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calc.js +33 -61
- package/dist/commonjs/runtime/native/styles/calc.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/calculate-props.js +123 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/constants.js +2 -1
- package/dist/commonjs/runtime/native/styles/constants.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/filters.js +84 -0
- package/dist/commonjs/runtime/native/styles/filters.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +2 -110
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/platform-functions.js +46 -0
- package/dist/commonjs/runtime/native/styles/platform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/resolve.js +46 -13
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/shorthand.js +34 -17
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/transform.js +9 -3
- package/dist/commonjs/runtime/native/styles/transform.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/units.js +7 -4
- package/dist/commonjs/runtime/native/styles/units.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/variables.js +57 -36
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +18 -5
- package/dist/commonjs/runtime/utils/objects.js.map +1 -1
- package/dist/commonjs/runtime/utils/style-value.js +7 -0
- package/dist/commonjs/runtime/utils/style-value.js.map +1 -1
- package/dist/commonjs/runtime/web/index.js +1 -0
- package/dist/commonjs/runtime/web/index.js.map +1 -1
- package/dist/commonjs/runtime/web/metro.js +6 -0
- package/dist/commonjs/runtime/web/metro.js.map +1 -0
- package/dist/module/babel/allowedModules.js +19 -0
- package/dist/module/babel/allowedModules.js.map +1 -0
- package/dist/module/babel/helpers.js +17 -116
- package/dist/module/babel/helpers.js.map +1 -1
- package/dist/module/babel/import-plugin.js +63 -59
- package/dist/module/babel/import-plugin.js.map +1 -1
- package/dist/module/babel/react-native-web.js +112 -0
- package/dist/module/babel/react-native-web.js.map +1 -0
- package/dist/module/babel/react-native.js +112 -0
- package/dist/module/babel/react-native.js.map +1 -0
- package/dist/module/compiler/atRules.js +97 -0
- package/dist/module/compiler/atRules.js.map +1 -0
- package/dist/module/compiler/attributes.test.js +20 -0
- package/dist/module/compiler/attributes.test.js.map +1 -0
- package/dist/module/compiler/compiler.js +144 -345
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +0 -12
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/container-query.js +10 -10
- package/dist/module/compiler/container-query.js.map +1 -1
- package/dist/module/compiler/declarations.js +1172 -992
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +78 -0
- package/dist/module/compiler/inheritance.test.js.map +1 -0
- package/dist/module/compiler/keyframes.js +15 -24
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/media-query.js +22 -22
- package/dist/module/compiler/media-query.js.map +1 -1
- package/dist/module/compiler/selectors.js +264 -184
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/split-by-delimiter.js +17 -0
- package/dist/module/compiler/split-by-delimiter.js.map +1 -0
- package/dist/module/compiler/stylesheet.js +380 -0
- package/dist/module/compiler/stylesheet.js.map +1 -0
- package/dist/module/components/Text.js +1 -0
- package/dist/module/components/Text.js.map +1 -1
- package/dist/module/components/View.js +1 -0
- package/dist/module/components/View.js.map +1 -1
- package/dist/module/index.js +1 -0
- package/dist/module/index.js.map +1 -1
- package/dist/module/jest/index.js +3 -3
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +111 -50
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/injection-code.js +22 -3
- package/dist/module/metro/injection-code.js.map +1 -1
- package/dist/module/metro/resolver.js +57 -0
- package/dist/module/metro/resolver.js.map +1 -0
- package/dist/module/metro/typescript.js +1 -1
- package/dist/module/poison.pill.js +34 -0
- package/dist/module/poison.pill.js.map +1 -0
- package/dist/module/runtime/native/conditions/guards.js +10 -4
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +2 -0
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/index.js +1 -2
- package/dist/module/runtime/native/index.js.map +1 -1
- package/dist/module/runtime/native/injection.js +18 -0
- package/dist/module/runtime/native/injection.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +22 -27
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +1 -5
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/styles/animation.js +68 -71
- package/dist/module/runtime/native/styles/animation.js.map +1 -1
- package/dist/module/runtime/native/styles/border.js +8 -0
- package/dist/module/runtime/native/styles/border.js.map +1 -0
- package/dist/module/runtime/native/styles/box-shadow.js +35 -0
- package/dist/module/runtime/native/styles/box-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/calc.js +33 -62
- package/dist/module/runtime/native/styles/calc.js.map +1 -1
- package/dist/module/runtime/native/styles/calculate-props.js +118 -0
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -0
- package/dist/module/runtime/native/styles/constants.js +1 -0
- package/dist/module/runtime/native/styles/constants.js.map +1 -1
- package/dist/module/runtime/native/styles/filters.js +70 -0
- package/dist/module/runtime/native/styles/filters.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +2 -110
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/platform-functions.js +36 -0
- package/dist/module/runtime/native/styles/platform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/resolve.js +47 -14
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/shorthand.js +34 -17
- package/dist/module/runtime/native/styles/shorthand.js.map +1 -1
- package/dist/module/runtime/native/styles/transform.js +9 -3
- package/dist/module/runtime/native/styles/transform.js.map +1 -1
- package/dist/module/runtime/native/styles/units.js +7 -4
- package/dist/module/runtime/native/styles/units.js.map +1 -1
- package/dist/module/runtime/native/styles/variables.js +57 -36
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +16 -4
- package/dist/module/runtime/utils/objects.js.map +1 -1
- package/dist/module/runtime/utils/style-value.js +6 -0
- package/dist/module/runtime/utils/style-value.js.map +1 -1
- package/dist/module/runtime/web/index.js +2 -0
- package/dist/module/runtime/web/index.js.map +1 -1
- package/dist/module/runtime/web/metro.js +5 -0
- package/dist/module/runtime/web/metro.js.map +1 -0
- package/dist/typescript/commonjs/example/app.config.d.ts +4 -0
- package/dist/typescript/commonjs/example/app.config.d.ts.map +1 -0
- package/dist/typescript/commonjs/example/src/App.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/allowedModules.d.ts +2 -0
- package/dist/typescript/commonjs/src/babel/allowedModules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/helpers.d.ts +3 -8
- package/dist/typescript/commonjs/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts +8 -0
- package/dist/typescript/commonjs/src/babel/react-native-web.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/babel/react-native.d.ts +8 -0
- package/dist/typescript/commonjs/src/babel/react-native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts +34 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +27 -108
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +118 -25
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/inheritance.test.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts +5 -4
- package/dist/typescript/commonjs/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts +4 -4
- package/dist/typescript/commonjs/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +10 -5
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts +2 -0
- package/dist/typescript/commonjs/src/compiler/split-by-delimiter.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +54 -0
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Text.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts +1 -1
- package/dist/typescript/commonjs/src/components/View.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/jest/index.d.ts +2 -3
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts +5 -4
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +15 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/resolver.d.ts +4 -0
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/poison.pill.d.ts +2 -0
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +3 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +10 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/constants.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts +12 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts +3 -4
- package/dist/typescript/commonjs/src/runtime/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts +6 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts +3 -4
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts +0 -15
- package/dist/typescript/commonjs/src/runtime/runtime.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/components.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts +2 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts +3 -2
- package/dist/typescript/commonjs/src/runtime/utils/style-value.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/web/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/metro.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/web/metro.d.ts.map +1 -0
- package/dist/typescript/module/example/app.config.d.ts +4 -0
- package/dist/typescript/module/example/app.config.d.ts.map +1 -0
- package/dist/typescript/module/example/src/App.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/allowedModules.d.ts +2 -0
- package/dist/typescript/module/src/babel/allowedModules.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/helpers.d.ts +3 -8
- package/dist/typescript/module/src/babel/helpers.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/import-plugin.d.ts.map +1 -1
- package/dist/typescript/module/src/babel/react-native-web.d.ts +8 -0
- package/dist/typescript/module/src/babel/react-native-web.d.ts.map +1 -0
- package/dist/typescript/module/src/babel/react-native.d.ts +8 -0
- package/dist/typescript/module/src/babel/react-native.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts +34 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/attributes.test.d.ts +2 -0
- package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/compiler.d.ts +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +27 -108
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/container-query.d.ts +2 -2
- package/dist/typescript/module/src/compiler/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +118 -25
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts +2 -0
- package/dist/typescript/module/src/compiler/inheritance.test.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/keyframes.d.ts +5 -4
- package/dist/typescript/module/src/compiler/keyframes.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/media-query.d.ts +4 -4
- package/dist/typescript/module/src/compiler/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/selectors.d.ts +10 -5
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts +2 -0
- package/dist/typescript/module/src/compiler/split-by-delimiter.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +54 -0
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Text.d.ts +1 -1
- package/dist/typescript/module/src/components/Text.d.ts.map +1 -1
- package/dist/typescript/module/src/components/View.d.ts +1 -1
- package/dist/typescript/module/src/components/View.d.ts.map +1 -1
- package/dist/typescript/module/src/index.d.ts +1 -0
- package/dist/typescript/module/src/index.d.ts.map +1 -1
- package/dist/typescript/module/src/jest/index.d.ts +2 -3
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts +5 -4
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts +15 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/resolver.d.ts +4 -0
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -0
- package/dist/typescript/module/src/poison.pill.d.ts +2 -0
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/api.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/index.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +3 -2
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +10 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts +1 -0
- package/dist/typescript/module/src/runtime/native/styles/constants.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts +12 -0
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts +3 -4
- package/dist/typescript/module/src/runtime/native/styles/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts +6 -2
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts +3 -4
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/runtime.types.d.ts +0 -15
- package/dist/typescript/module/src/runtime/runtime.types.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/components.d.ts +1 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts +2 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts +3 -2
- package/dist/typescript/module/src/runtime/utils/style-value.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/index.d.ts +1 -0
- package/dist/typescript/module/src/runtime/web/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/metro.d.ts +2 -0
- package/dist/typescript/module/src/runtime/web/metro.d.ts.map +1 -0
- package/package.json +67 -13
- package/src/babel/allowedModules.ts +24 -0
- package/src/babel/helpers.ts +16 -158
- package/src/babel/import-plugin.ts +125 -132
- package/src/babel/react-native-web.ts +226 -0
- package/src/babel/react-native.ts +226 -0
- package/src/compiler/atRules.ts +144 -0
- package/src/compiler/attributes.test.ts +28 -0
- package/src/compiler/compiler.ts +154 -482
- package/src/compiler/compiler.types.ts +30 -135
- package/src/compiler/container-query.ts +12 -12
- package/src/compiler/declarations.ts +1789 -1971
- package/src/compiler/inheritance.test.ts +121 -0
- package/src/compiler/keyframes.ts +28 -42
- package/src/compiler/media-query.ts +27 -26
- package/src/compiler/selectors.ts +289 -271
- package/src/compiler/split-by-delimiter.ts +19 -0
- package/src/compiler/stylesheet.ts +546 -0
- package/src/components/Text.tsx +2 -0
- package/src/components/View.tsx +2 -0
- package/src/index.ts +2 -0
- package/src/jest/index.ts +6 -5
- package/src/metro/index.ts +161 -64
- package/src/metro/injection-code.ts +33 -3
- package/src/metro/resolver.ts +89 -0
- package/src/metro/typescript.ts +1 -1
- package/src/poison.pill.ts +32 -0
- package/src/runtime/native/conditions/guards.ts +12 -4
- package/src/runtime/native/conditions/media-query.ts +2 -0
- package/src/runtime/native/index.ts +1 -2
- package/src/runtime/native/injection.ts +30 -0
- package/src/runtime/native/react/rules.ts +26 -33
- package/src/runtime/native/reactivity.ts +3 -7
- package/src/runtime/native/styles/animation.ts +143 -104
- package/src/runtime/native/styles/border.ts +10 -0
- package/src/runtime/native/styles/box-shadow.ts +54 -0
- package/src/runtime/native/styles/calc.ts +37 -60
- package/src/runtime/native/styles/calculate-props.ts +165 -0
- package/src/runtime/native/styles/constants.ts +1 -0
- package/src/runtime/native/styles/filters.ts +98 -0
- package/src/runtime/native/styles/index.ts +2 -138
- package/src/runtime/native/styles/platform-functions.ts +50 -0
- package/src/runtime/native/styles/resolve.ts +91 -17
- package/src/runtime/native/styles/shorthand.ts +61 -41
- package/src/runtime/native/styles/transform.ts +10 -4
- package/src/runtime/native/styles/units.ts +9 -4
- package/src/runtime/native/styles/variables.ts +51 -35
- package/src/runtime/runtime.types.ts +0 -25
- package/src/runtime/utils/objects.ts +20 -5
- package/src/runtime/utils/style-value.ts +14 -2
- package/src/runtime/web/index.ts +3 -0
- package/src/runtime/web/metro.ts +2 -0
- package/types.d.ts +70 -0
- package/dist/commonjs/compiler/add.js +0 -175
- package/dist/commonjs/compiler/add.js.map +0 -1
- package/dist/commonjs/components/ActivityIndicator.js +0 -20
- package/dist/commonjs/components/ActivityIndicator.js.map +0 -1
- package/dist/commonjs/components/SafeAreaProvider/index.js +0 -41
- package/dist/commonjs/components/SafeAreaProvider/index.js.map +0 -1
- package/dist/commonjs/components/SafeAreaProvider/index.web.js +0 -13
- package/dist/commonjs/components/SafeAreaProvider/index.web.js.map +0 -1
- package/dist/commonjs/components/TextInput.js +0 -20
- package/dist/commonjs/components/TextInput.js.map +0 -1
- package/dist/module/compiler/add.js +0 -168
- package/dist/module/compiler/add.js.map +0 -1
- package/dist/module/components/ActivityIndicator.js +0 -16
- package/dist/module/components/ActivityIndicator.js.map +0 -1
- package/dist/module/components/SafeAreaProvider/index.js +0 -36
- package/dist/module/components/SafeAreaProvider/index.js.map +0 -1
- package/dist/module/components/SafeAreaProvider/index.web.js +0 -4
- package/dist/module/components/SafeAreaProvider/index.web.js.map +0 -1
- package/dist/module/components/TextInput.js +0 -16
- package/dist/module/components/TextInput.js.map +0 -1
- package/dist/typescript/commonjs/src/compiler/add.d.ts +0 -10
- package/dist/typescript/commonjs/src/compiler/add.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +0 -3
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts +0 -4
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts +0 -2
- package/dist/typescript/commonjs/src/components/SafeAreaProvider/index.web.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +0 -13
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/add.d.ts +0 -10
- package/dist/typescript/module/src/compiler/add.d.ts.map +0 -1
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +0 -3
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +0 -1
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts +0 -4
- package/dist/typescript/module/src/components/SafeAreaProvider/index.d.ts.map +0 -1
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts +0 -2
- package/dist/typescript/module/src/components/SafeAreaProvider/index.web.d.ts.map +0 -1
- package/dist/typescript/module/src/components/TextInput.d.ts +0 -13
- package/dist/typescript/module/src/components/TextInput.d.ts.map +0 -1
- package/src/compiler/add.ts +0 -257
- package/src/components/ActivityIndicator.tsx +0 -19
- package/src/components/SafeAreaProvider/index.tsx +0 -50
- package/src/components/SafeAreaProvider/index.web.tsx +0 -1
- package/src/components/TextInput.tsx +0 -20
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { isStyleDescriptorArray } from "../../utils";
|
|
2
|
+
import type { StyleFunctionResolver } from "./resolve";
|
|
3
|
+
import { shorthandHandler } from "./shorthand";
|
|
4
|
+
|
|
5
|
+
export const blur: StyleFunctionResolver = (resolveValue, value) => {
|
|
6
|
+
const args = resolveValue(value[2]);
|
|
7
|
+
return {
|
|
8
|
+
blur: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const brightness: StyleFunctionResolver = (resolveValue, value) => {
|
|
13
|
+
const args = resolveValue(value[2]);
|
|
14
|
+
return {
|
|
15
|
+
brightness: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const contrast: StyleFunctionResolver = (resolveValue, value) => {
|
|
20
|
+
const args = resolveValue(value[2]);
|
|
21
|
+
return {
|
|
22
|
+
contrast: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const grayscale: StyleFunctionResolver = (resolveValue, value) => {
|
|
27
|
+
const args = resolveValue(value[2]);
|
|
28
|
+
return {
|
|
29
|
+
grayscale: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const hueRotate: StyleFunctionResolver = (resolveValue, value) => {
|
|
34
|
+
const args = resolveValue(value[2]);
|
|
35
|
+
return {
|
|
36
|
+
hueRotate: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const invert: StyleFunctionResolver = (resolveValue, value) => {
|
|
41
|
+
const args = resolveValue(value[2]);
|
|
42
|
+
return {
|
|
43
|
+
invert: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const sepia: StyleFunctionResolver = (resolveValue, value) => {
|
|
48
|
+
const args = resolveValue(value[2]);
|
|
49
|
+
return {
|
|
50
|
+
sepia: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const saturate: StyleFunctionResolver = (resolveValue, value) => {
|
|
55
|
+
const args = resolveValue(value[2]);
|
|
56
|
+
return {
|
|
57
|
+
saturate: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const opacity: StyleFunctionResolver = (resolveValue, value) => {
|
|
62
|
+
const args = resolveValue(value[2]);
|
|
63
|
+
return {
|
|
64
|
+
hueRotate: (Array.isArray(args) ? args[0] : args) as unknown,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const color = ["color", "string"] as const;
|
|
69
|
+
const offsetX = ["offsetX", "number"] as const;
|
|
70
|
+
const offsetY = ["offsetY", "number"] as const;
|
|
71
|
+
const blurRadius = ["blurRadius", "number"] as const;
|
|
72
|
+
|
|
73
|
+
const handler = shorthandHandler(
|
|
74
|
+
[
|
|
75
|
+
[offsetX, offsetY, blurRadius, color],
|
|
76
|
+
[color, offsetX, offsetY],
|
|
77
|
+
[color, offsetX, offsetY, blurRadius],
|
|
78
|
+
[offsetX, offsetY, color],
|
|
79
|
+
[offsetX, offsetY, blurRadius, color],
|
|
80
|
+
],
|
|
81
|
+
[],
|
|
82
|
+
"object",
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
export const dropShadow: StyleFunctionResolver = (
|
|
86
|
+
resolveValue,
|
|
87
|
+
func,
|
|
88
|
+
get,
|
|
89
|
+
options,
|
|
90
|
+
) => {
|
|
91
|
+
const args = resolveValue(func[2]);
|
|
92
|
+
|
|
93
|
+
return isStyleDescriptorArray(args)
|
|
94
|
+
? {
|
|
95
|
+
dropShadow: handler(resolveValue, args, get, options),
|
|
96
|
+
}
|
|
97
|
+
: undefined;
|
|
98
|
+
};
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { InlineVariable, StyleRule } from "../../../compiler";
|
|
3
|
-
import {
|
|
4
|
-
applyValue,
|
|
5
|
-
Specificity as S,
|
|
6
|
-
specificityCompareFn,
|
|
7
|
-
} from "../../utils";
|
|
8
|
-
import type { RenderGuard } from "../conditions/guards";
|
|
3
|
+
import { specificityCompareFn } from "../../utils";
|
|
9
4
|
import { getInteractionHandler } from "../react/interaction";
|
|
10
5
|
import type { ComponentState, Config } from "../react/useNativeCss";
|
|
11
6
|
import {
|
|
@@ -17,10 +12,9 @@ import {
|
|
|
17
12
|
observable,
|
|
18
13
|
VAR_SYMBOL,
|
|
19
14
|
type Effect,
|
|
20
|
-
type Getter,
|
|
21
15
|
type VariableContextValue,
|
|
22
16
|
} from "../reactivity";
|
|
23
|
-
import {
|
|
17
|
+
import { calculateProps } from "./calculate-props";
|
|
24
18
|
|
|
25
19
|
export const stylesFamily = family(
|
|
26
20
|
(
|
|
@@ -45,136 +39,6 @@ export const stylesFamily = family(
|
|
|
45
39
|
},
|
|
46
40
|
);
|
|
47
41
|
|
|
48
|
-
function calculateProps(
|
|
49
|
-
get: Getter,
|
|
50
|
-
rules: Array<StyleRule | InlineVariable | VariableContextValue>,
|
|
51
|
-
) {
|
|
52
|
-
let normal: Record<string, any> | undefined;
|
|
53
|
-
let important: Record<string, any> | undefined;
|
|
54
|
-
|
|
55
|
-
const delayedStyles: (() => void)[] = [];
|
|
56
|
-
|
|
57
|
-
const guards: RenderGuard[] = [];
|
|
58
|
-
|
|
59
|
-
const inheritedVariables: VariableContextValue = {
|
|
60
|
-
[VAR_SYMBOL]: true,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const inlineVariables: InlineVariable = {
|
|
64
|
-
[VAR_SYMBOL]: "inline",
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
for (const rule of rules) {
|
|
68
|
-
if (VAR_SYMBOL in rule) {
|
|
69
|
-
if (typeof rule[VAR_SYMBOL] === "string") {
|
|
70
|
-
Object.assign(inlineVariables, rule);
|
|
71
|
-
} else {
|
|
72
|
-
Object.assign(inheritedVariables, rule);
|
|
73
|
-
}
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
if (rule.v) {
|
|
78
|
-
for (const variable of rule.v) {
|
|
79
|
-
inlineVariables[variable[0]] = variable[1];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (rule.d) {
|
|
84
|
-
let topLevelTarget = rule.s?.[S.Important]
|
|
85
|
-
? (important ??= {})
|
|
86
|
-
: (normal ??= {});
|
|
87
|
-
let target = topLevelTarget;
|
|
88
|
-
|
|
89
|
-
const ruleTarget = rule.target || "style";
|
|
90
|
-
|
|
91
|
-
if (typeof ruleTarget === "string") {
|
|
92
|
-
target = target[ruleTarget] ??= {};
|
|
93
|
-
} else if (ruleTarget) {
|
|
94
|
-
for (const path of ruleTarget) {
|
|
95
|
-
target = target[path] ??= {};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
for (const declaration of rule.d) {
|
|
100
|
-
if (!Array.isArray(declaration)) {
|
|
101
|
-
// Static styles
|
|
102
|
-
Object.assign(target, declaration);
|
|
103
|
-
} else {
|
|
104
|
-
// Dynamic styles
|
|
105
|
-
let value: any = declaration[0];
|
|
106
|
-
let propPath = declaration[1];
|
|
107
|
-
let prop = "";
|
|
108
|
-
|
|
109
|
-
if (typeof propPath === "string") {
|
|
110
|
-
if (propPath.startsWith("^")) {
|
|
111
|
-
propPath = propPath.slice(1);
|
|
112
|
-
target = topLevelTarget[propPath] ??= {};
|
|
113
|
-
}
|
|
114
|
-
prop = propPath;
|
|
115
|
-
} else {
|
|
116
|
-
for (prop of propPath) {
|
|
117
|
-
if (prop.startsWith("^")) {
|
|
118
|
-
prop = prop.slice(1);
|
|
119
|
-
target = topLevelTarget[prop] ??= {};
|
|
120
|
-
} else {
|
|
121
|
-
target = target[prop] ??= {};
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (Array.isArray(value)) {
|
|
127
|
-
const shouldDelay = declaration[2];
|
|
128
|
-
|
|
129
|
-
if (shouldDelay) {
|
|
130
|
-
/**
|
|
131
|
-
* We need to delay the resolution of this value until after all
|
|
132
|
-
* styles have been calculated. But another style might override
|
|
133
|
-
* this value. So we set a placeholder value and only override
|
|
134
|
-
* if the placeholder is preserved
|
|
135
|
-
*
|
|
136
|
-
* This also ensures the props exist, so setValue will properly
|
|
137
|
-
* mutate the props object and not create a new one
|
|
138
|
-
*/
|
|
139
|
-
const originalValue = value;
|
|
140
|
-
value = {};
|
|
141
|
-
delayedStyles.push(() => {
|
|
142
|
-
if (target[prop] === value) {
|
|
143
|
-
delete target[prop];
|
|
144
|
-
value = resolveValue(originalValue, get, {
|
|
145
|
-
inlineVariables,
|
|
146
|
-
inheritedVariables,
|
|
147
|
-
renderGuards: guards,
|
|
148
|
-
});
|
|
149
|
-
applyValue(target, prop, value);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
} else {
|
|
153
|
-
value = resolveValue(value, get, {
|
|
154
|
-
inlineVariables,
|
|
155
|
-
inheritedVariables,
|
|
156
|
-
renderGuards: guards,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
applyValue(target, prop, value);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
for (const delayedStyle of delayedStyles) {
|
|
168
|
-
delayedStyle();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
return {
|
|
172
|
-
normal,
|
|
173
|
-
guards,
|
|
174
|
-
important,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
42
|
export function getStyledProps(
|
|
179
43
|
state: ComponentState,
|
|
180
44
|
inline: Record<string, any> | undefined | null,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { PixelRatio, PlatformColor, StyleSheet } from "react-native";
|
|
2
|
+
|
|
3
|
+
import type { StyleFunctionResolver } from "./resolve";
|
|
4
|
+
|
|
5
|
+
export const platformColor: StyleFunctionResolver = (resolveValue, value) => {
|
|
6
|
+
const color: unknown = resolveValue(value[2]);
|
|
7
|
+
if (Array.isArray(color)) {
|
|
8
|
+
return PlatformColor(...(color as string[]));
|
|
9
|
+
} else if (typeof color === "string") {
|
|
10
|
+
return PlatformColor(color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const hairlineWidth: StyleFunctionResolver = () => {
|
|
17
|
+
return StyleSheet.hairlineWidth;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const pixelRatio: StyleFunctionResolver = () => {
|
|
21
|
+
return PixelRatio.get();
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const fontScale: StyleFunctionResolver = () => {
|
|
25
|
+
return PixelRatio.getFontScale();
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const pixelSizeForLayoutSize: StyleFunctionResolver = (
|
|
29
|
+
resolveValue,
|
|
30
|
+
value,
|
|
31
|
+
) => {
|
|
32
|
+
const size: unknown = resolveValue(value[2]);
|
|
33
|
+
if (typeof size === "number") {
|
|
34
|
+
return PixelRatio.getPixelSizeForLayoutSize(size);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const roundToNearestPixel: StyleFunctionResolver = (
|
|
41
|
+
resolveValue,
|
|
42
|
+
value,
|
|
43
|
+
) => {
|
|
44
|
+
const size: unknown = resolveValue(value[2]);
|
|
45
|
+
if (typeof size === "number") {
|
|
46
|
+
return PixelRatio.roundToNearestPixel(size);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return;
|
|
50
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
|
|
2
3
|
import type {
|
|
3
4
|
InlineVariable,
|
|
4
5
|
StyleDescriptor,
|
|
@@ -6,9 +7,32 @@ import type {
|
|
|
6
7
|
} from "../../../compiler";
|
|
7
8
|
import type { RenderGuard } from "../conditions/guards";
|
|
8
9
|
import { type Getter, type VariableContextValue } from "../reactivity";
|
|
9
|
-
import { animation } from "./animation";
|
|
10
|
+
import { animation, timingFunctionResolver } from "./animation";
|
|
11
|
+
import { border } from "./border";
|
|
12
|
+
import { boxShadow } from "./box-shadow";
|
|
10
13
|
import { calc } from "./calc";
|
|
14
|
+
import type { calculateProps } from "./calculate-props";
|
|
11
15
|
import { transformKeys } from "./defaults";
|
|
16
|
+
import {
|
|
17
|
+
blur,
|
|
18
|
+
brightness,
|
|
19
|
+
contrast,
|
|
20
|
+
dropShadow,
|
|
21
|
+
grayscale,
|
|
22
|
+
hueRotate,
|
|
23
|
+
invert,
|
|
24
|
+
opacity,
|
|
25
|
+
saturate,
|
|
26
|
+
sepia,
|
|
27
|
+
} from "./filters";
|
|
28
|
+
import {
|
|
29
|
+
fontScale,
|
|
30
|
+
hairlineWidth,
|
|
31
|
+
pixelRatio,
|
|
32
|
+
pixelSizeForLayoutSize,
|
|
33
|
+
platformColor,
|
|
34
|
+
roundToNearestPixel,
|
|
35
|
+
} from "./platform-functions";
|
|
12
36
|
import { textShadow } from "./text-shadow";
|
|
13
37
|
import { transform } from "./transform";
|
|
14
38
|
import { em, rem, vh, vw } from "./units";
|
|
@@ -17,24 +41,52 @@ import { varResolver } from "./variables";
|
|
|
17
41
|
export type SimpleResolveValue = (
|
|
18
42
|
value: StyleDescriptor,
|
|
19
43
|
castToArray?: boolean,
|
|
20
|
-
) =>
|
|
44
|
+
) => unknown;
|
|
21
45
|
|
|
22
46
|
export type StyleFunctionResolver = (
|
|
23
47
|
resolveValue: SimpleResolveValue,
|
|
24
48
|
value: StyleFunction,
|
|
25
49
|
get: Getter,
|
|
26
50
|
options: ResolveValueOptions,
|
|
27
|
-
) =>
|
|
51
|
+
) => unknown;
|
|
52
|
+
|
|
53
|
+
export type StyleResolver = (
|
|
54
|
+
resolveValue: SimpleResolveValue,
|
|
55
|
+
value: StyleDescriptor,
|
|
56
|
+
get: Getter,
|
|
57
|
+
options: ResolveValueOptions,
|
|
58
|
+
) => unknown;
|
|
28
59
|
|
|
29
60
|
const functions: Record<string, StyleFunctionResolver> = {
|
|
61
|
+
"@animation": animation,
|
|
62
|
+
"@border": border,
|
|
63
|
+
"@boxShadow": boxShadow,
|
|
64
|
+
"@textShadow": textShadow,
|
|
65
|
+
"@transform": transform,
|
|
66
|
+
"animationName": animation,
|
|
67
|
+
"cubic-bezier": timingFunctionResolver,
|
|
68
|
+
"steps": timingFunctionResolver,
|
|
69
|
+
"hue-rotate": hueRotate,
|
|
70
|
+
"drop-shadow": dropShadow,
|
|
71
|
+
blur,
|
|
72
|
+
brightness,
|
|
30
73
|
calc,
|
|
74
|
+
contrast,
|
|
31
75
|
em,
|
|
32
|
-
|
|
33
|
-
|
|
76
|
+
fontScale,
|
|
77
|
+
grayscale,
|
|
78
|
+
hairlineWidth,
|
|
79
|
+
invert,
|
|
80
|
+
opacity,
|
|
81
|
+
pixelRatio,
|
|
82
|
+
pixelSizeForLayoutSize,
|
|
83
|
+
platformColor,
|
|
34
84
|
rem,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
85
|
+
roundToNearestPixel,
|
|
86
|
+
saturate,
|
|
87
|
+
sepia,
|
|
88
|
+
vh,
|
|
89
|
+
vw,
|
|
38
90
|
};
|
|
39
91
|
|
|
40
92
|
export type ResolveValueOptions = {
|
|
@@ -43,6 +95,8 @@ export type ResolveValueOptions = {
|
|
|
43
95
|
inlineVariables?: InlineVariable | undefined;
|
|
44
96
|
renderGuards?: RenderGuard[];
|
|
45
97
|
variableHistory?: Set<string>;
|
|
98
|
+
/** Pass down to perform recursive calculations and avoid circular dependencies */
|
|
99
|
+
calculateProps?: typeof calculateProps;
|
|
46
100
|
};
|
|
47
101
|
|
|
48
102
|
export function resolveValue(
|
|
@@ -72,10 +126,9 @@ export function resolveValue(
|
|
|
72
126
|
}
|
|
73
127
|
|
|
74
128
|
if (isDescriptorArray(value)) {
|
|
75
|
-
value = value
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}) as StyleDescriptor[];
|
|
129
|
+
value = value
|
|
130
|
+
.map((d) => resolveValue(d, get, options))
|
|
131
|
+
.filter((d) => d !== undefined);
|
|
79
132
|
|
|
80
133
|
if (castToArray && !Array.isArray(value)) {
|
|
81
134
|
return [value];
|
|
@@ -99,19 +152,40 @@ export function resolveValue(
|
|
|
99
152
|
throw new Error(`Unknown function: ${name}`);
|
|
100
153
|
}
|
|
101
154
|
|
|
102
|
-
value = fn(
|
|
155
|
+
value = fn(
|
|
156
|
+
simpleResolve,
|
|
157
|
+
value as StyleFunction,
|
|
158
|
+
get,
|
|
159
|
+
options,
|
|
160
|
+
) as StyleDescriptor;
|
|
103
161
|
} else if (transformKeys.has(name)) {
|
|
104
162
|
// translate, rotate, scale, etc.
|
|
105
|
-
|
|
163
|
+
const args = value[2];
|
|
164
|
+
return simpleResolve(args, castToArray);
|
|
106
165
|
} else if (transformKeys.has(name.slice(1))) {
|
|
107
166
|
// @translate, @rotate, @scale, etc.
|
|
108
|
-
return { [name.slice(1)]: simpleResolve(value[2], castToArray)
|
|
167
|
+
return { [name.slice(1)]: simpleResolve(value[2], castToArray) };
|
|
109
168
|
} else {
|
|
110
|
-
|
|
169
|
+
let args = simpleResolve(value[2], castToArray);
|
|
170
|
+
|
|
111
171
|
if (args === undefined) {
|
|
112
172
|
return;
|
|
113
173
|
} else if (Array.isArray(args)) {
|
|
114
|
-
|
|
174
|
+
let joinedArgs = args
|
|
175
|
+
.map((arg: unknown) => {
|
|
176
|
+
if (Array.isArray(arg)) {
|
|
177
|
+
return arg.flat().join(" ");
|
|
178
|
+
}
|
|
179
|
+
return arg;
|
|
180
|
+
})
|
|
181
|
+
.join(", ");
|
|
182
|
+
|
|
183
|
+
if (name === "radial-gradient") {
|
|
184
|
+
// Nativewind / Tailwind CSS hack which can force the 'in oklab' color space
|
|
185
|
+
joinedArgs = joinedArgs.replace("in oklab, ", "");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
value = `${name}(${joinedArgs})`;
|
|
115
189
|
} else {
|
|
116
190
|
value = `${name}(${args})`;
|
|
117
191
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import
|
|
2
|
+
import { setDeepPath } from "../../utils/objects";
|
|
3
|
+
import { isStyleDescriptorArray } from "../../utils/style-value";
|
|
4
|
+
import { ShortHandSymbol } from "./constants";
|
|
3
5
|
import { defaultValues } from "./defaults";
|
|
4
|
-
import type {
|
|
6
|
+
import type { StyleResolver } from "./resolve";
|
|
5
7
|
|
|
6
8
|
type ShorthandType =
|
|
7
9
|
| "string"
|
|
8
10
|
| "number"
|
|
9
11
|
| "length"
|
|
10
12
|
| "color"
|
|
11
|
-
| Readonly<string[]>;
|
|
13
|
+
| Readonly<(string | Function)[]>;
|
|
12
14
|
|
|
13
15
|
type ShorthandRequiredValue =
|
|
14
16
|
| readonly [string | readonly string[], ShorthandType]
|
|
@@ -20,33 +22,37 @@ type ShorthandDefaultValue = readonly [
|
|
|
20
22
|
any,
|
|
21
23
|
];
|
|
22
24
|
|
|
23
|
-
export const ShortHandSymbol = Symbol();
|
|
24
|
-
|
|
25
25
|
export function shorthandHandler(
|
|
26
26
|
mappings: ShorthandRequiredValue[][],
|
|
27
27
|
defaults: ShorthandDefaultValue[],
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return
|
|
39
|
-
}
|
|
28
|
+
returnType: "shorthandObject" | "tuples" | "object" = "shorthandObject",
|
|
29
|
+
): StyleResolver {
|
|
30
|
+
return (resolve, value, __, { castToArray }) => {
|
|
31
|
+
let args = isStyleDescriptorArray(value)
|
|
32
|
+
? resolve(value)
|
|
33
|
+
: Array.isArray(value)
|
|
34
|
+
? resolve(value[2])
|
|
35
|
+
: value;
|
|
36
|
+
|
|
37
|
+
if (!Array.isArray(args)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
args = args.flat();
|
|
42
|
+
|
|
43
|
+
if (!Array.isArray(args)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
40
46
|
|
|
41
47
|
const match = mappings.find((mapping) => {
|
|
42
48
|
return (
|
|
43
|
-
|
|
49
|
+
args.length === mapping.length &&
|
|
44
50
|
mapping.every((map, index) => {
|
|
45
51
|
const type = map[1];
|
|
46
|
-
const value =
|
|
52
|
+
const value = args[index];
|
|
47
53
|
|
|
48
54
|
if (Array.isArray(type)) {
|
|
49
|
-
return type.includes(value);
|
|
55
|
+
return type.includes(value) || type.includes(typeof value);
|
|
50
56
|
}
|
|
51
57
|
|
|
52
58
|
switch (type) {
|
|
@@ -70,32 +76,46 @@ export function shorthandHandler(
|
|
|
70
76
|
|
|
71
77
|
const seenDefaults = new Set(defaults);
|
|
72
78
|
|
|
73
|
-
|
|
74
|
-
[
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
const tuples = [
|
|
80
|
+
...match.map((map, index): [unknown, ShorthandRequiredValue[0]] => {
|
|
81
|
+
if (map.length === 3) {
|
|
82
|
+
seenDefaults.delete(map);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
let value = args[index];
|
|
86
|
+
if (castToArray && value && !Array.isArray(value)) {
|
|
87
|
+
value = [value];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return [value, map[0]];
|
|
91
|
+
}),
|
|
92
|
+
...Array.from(seenDefaults).map(
|
|
93
|
+
(map): [unknown, ShorthandRequiredValue[0]] => {
|
|
88
94
|
let value = defaultValues[map[2]] ?? map[2];
|
|
89
95
|
if (castToArray && value && !Array.isArray(value)) {
|
|
90
96
|
value = [value];
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
return [value, map[0]];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
},
|
|
101
|
+
),
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
if (returnType === "shorthandObject" || returnType === "object") {
|
|
105
|
+
const target: Record<string, unknown> =
|
|
106
|
+
returnType === "shorthandObject" ? { [ShortHandSymbol]: true } : {};
|
|
107
|
+
|
|
108
|
+
for (const [value, prop] of tuples) {
|
|
109
|
+
if (typeof prop === "string") {
|
|
110
|
+
target[prop] = value;
|
|
111
|
+
} else {
|
|
112
|
+
setDeepPath(target, prop, value);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return target;
|
|
117
|
+
} else {
|
|
118
|
+
return tuples;
|
|
119
|
+
}
|
|
98
120
|
};
|
|
99
|
-
|
|
100
|
-
return resolveFn;
|
|
101
121
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
1
|
import type { StyleFunctionResolver } from "./resolve";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -9,7 +8,14 @@ export const transform: StyleFunctionResolver = (
|
|
|
9
8
|
resolveValue,
|
|
10
9
|
transformDescriptor,
|
|
11
10
|
) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
const transforms = resolveValue(transformDescriptor[2]);
|
|
12
|
+
|
|
13
|
+
if (Array.isArray(transforms)) {
|
|
14
|
+
return transforms.filter((transform) => transform !== undefined) as unknown;
|
|
15
|
+
} else if (transforms) {
|
|
16
|
+
// If it's a single transform, wrap it in an array
|
|
17
|
+
return [transforms];
|
|
18
|
+
} else {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
15
21
|
};
|
|
@@ -3,18 +3,23 @@ import { rem as remObs, vh as vhObs, vw as vwObs } from "../reactivity";
|
|
|
3
3
|
import type { StyleFunctionResolver } from "./resolve";
|
|
4
4
|
|
|
5
5
|
export const em: StyleFunctionResolver = (resolve, func) => {
|
|
6
|
-
let value = func[2]
|
|
6
|
+
let value = func[2];
|
|
7
7
|
|
|
8
8
|
if (!value) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const emValue = resolve([{}, "var", ["__rn-css-em"]]);
|
|
13
|
+
|
|
14
|
+
if (typeof emValue !== "number") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
13
18
|
return round(Number(value) * emValue);
|
|
14
19
|
};
|
|
15
20
|
|
|
16
21
|
export const vw: StyleFunctionResolver = (_, func, get) => {
|
|
17
|
-
const value = func[2]
|
|
22
|
+
const value = func[2];
|
|
18
23
|
|
|
19
24
|
if (typeof value !== "number") {
|
|
20
25
|
return;
|
|
@@ -24,7 +29,7 @@ export const vw: StyleFunctionResolver = (_, func, get) => {
|
|
|
24
29
|
};
|
|
25
30
|
|
|
26
31
|
export const vh: StyleFunctionResolver = (_, func, get) => {
|
|
27
|
-
const value = func[2]
|
|
32
|
+
const value = func[2];
|
|
28
33
|
|
|
29
34
|
if (typeof value !== "number") {
|
|
30
35
|
return;
|
|
@@ -34,7 +39,7 @@ export const vh: StyleFunctionResolver = (_, func, get) => {
|
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
export const rem: StyleFunctionResolver = (_, func, get) => {
|
|
37
|
-
const value = func[2]
|
|
42
|
+
const value = func[2];
|
|
38
43
|
|
|
39
44
|
if (typeof value !== "number") {
|
|
40
45
|
return;
|