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
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
2
|
import type { ComponentType } from "react";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { applyShorthand } from "../../utils";
|
|
5
5
|
import { StyleCollection } from "../injection";
|
|
6
|
-
import {
|
|
7
|
-
import type {
|
|
6
|
+
import { weakFamily } from "../reactivity";
|
|
7
|
+
import type { StyleFunctionResolver } from "./resolve";
|
|
8
8
|
import { shorthandHandler } from "./shorthand";
|
|
9
9
|
|
|
10
|
-
const name = ["
|
|
11
|
-
const delay = ["
|
|
12
|
-
const duration = ["
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const name = ["animationName", "string", "none"] as const;
|
|
11
|
+
const delay = ["animationDelay", "number", 0] as const;
|
|
12
|
+
const duration = ["animationDuration", "number", 0] as const;
|
|
13
|
+
const iteration = [
|
|
14
|
+
"animationIterationCount",
|
|
15
|
+
["number", "infinite"],
|
|
16
|
+
1,
|
|
17
|
+
] as const;
|
|
18
|
+
const fill = [
|
|
19
|
+
"animationFillMode",
|
|
20
|
+
["none", "forwards", "backwards", "both"],
|
|
21
|
+
"none",
|
|
22
|
+
] as const;
|
|
23
|
+
const playState = [
|
|
24
|
+
"animationPlayState",
|
|
25
|
+
["running", "paused"],
|
|
26
|
+
"running",
|
|
27
|
+
] as const;
|
|
16
28
|
const direction = [
|
|
17
|
-
"
|
|
29
|
+
"animationDirection",
|
|
18
30
|
["normal", "reverse", "alternate", "alternate-reverse"],
|
|
19
31
|
"normal",
|
|
20
32
|
] as const;
|
|
21
|
-
const
|
|
22
|
-
"
|
|
23
|
-
["linear", "ease", "ease-in", "ease-out", "ease-in-out"],
|
|
33
|
+
const timingFunction = [
|
|
34
|
+
"animationTimingFunction",
|
|
35
|
+
["linear", "ease", "ease-in", "ease-out", "ease-in-out", "object"],
|
|
24
36
|
"ease",
|
|
25
37
|
] as const;
|
|
26
38
|
|
|
@@ -29,100 +41,24 @@ export const animationShorthand = shorthandHandler(
|
|
|
29
41
|
[name],
|
|
30
42
|
[duration, name],
|
|
31
43
|
[name, duration],
|
|
44
|
+
[name, duration, iteration],
|
|
45
|
+
[name, duration, timingFunction, iteration],
|
|
32
46
|
[duration, delay, name],
|
|
33
47
|
[duration, delay, iteration, name],
|
|
34
|
-
[duration, delay, iteration,
|
|
35
|
-
[name, duration,
|
|
48
|
+
[duration, delay, iteration, timingFunction, name],
|
|
49
|
+
[name, duration, timingFunction, delay, iteration, fill],
|
|
36
50
|
],
|
|
37
|
-
[
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Get a stable reference to the StyleProp observer.
|
|
50
|
-
* We can use that as a WeakKey
|
|
51
|
-
*/
|
|
52
|
-
return get(
|
|
53
|
-
animationFamily(get, {
|
|
54
|
-
name,
|
|
55
|
-
resolveValue,
|
|
56
|
-
inheritedVariables,
|
|
57
|
-
}),
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
type AnimationFamilyOptions = {
|
|
62
|
-
name: StyleDescriptor;
|
|
63
|
-
resolveValue: SimpleResolveValue;
|
|
64
|
-
inheritedVariables: any;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const animationFamily = weakFamily(
|
|
68
|
-
(_: Getter, options: AnimationFamilyOptions) => {
|
|
69
|
-
const { name: nameDescriptor, resolveValue } = options;
|
|
70
|
-
|
|
71
|
-
return observable((get) => {
|
|
72
|
-
const names = resolveValue(nameDescriptor);
|
|
73
|
-
|
|
74
|
-
if (!Array.isArray(names)) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return names.map((name: string) => {
|
|
79
|
-
const keyframes = get(StyleCollection.keyframes(name));
|
|
80
|
-
|
|
81
|
-
const animation: Record<string, any> = {};
|
|
82
|
-
|
|
83
|
-
for (const [progress, declarations] of keyframes) {
|
|
84
|
-
const result: Record<string, any> = {};
|
|
85
|
-
|
|
86
|
-
// This code needs to match calculateProps
|
|
87
|
-
// TODO: Refactor this to use the same code
|
|
88
|
-
for (const declaration of declarations) {
|
|
89
|
-
let target = result;
|
|
90
|
-
|
|
91
|
-
if (!Array.isArray(declaration)) {
|
|
92
|
-
// Static styles
|
|
93
|
-
Object.assign(target, declaration);
|
|
94
|
-
} else {
|
|
95
|
-
// Dynamic styles
|
|
96
|
-
let value: any = declaration[0];
|
|
97
|
-
let propPath = declaration[1];
|
|
98
|
-
let prop: string | undefined = "";
|
|
99
|
-
|
|
100
|
-
if (typeof propPath === "string") {
|
|
101
|
-
prop = propPath;
|
|
102
|
-
} else {
|
|
103
|
-
prop = propPath[0];
|
|
104
|
-
|
|
105
|
-
for (
|
|
106
|
-
let i = 0;
|
|
107
|
-
i < propPath.length - 2 && typeof prop === "string";
|
|
108
|
-
i++
|
|
109
|
-
) {
|
|
110
|
-
target = target[prop] ??= {};
|
|
111
|
-
prop = propPath[i + 1];
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
value = resolveValue(value);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
animation[progress] = result;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return animation;
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
},
|
|
51
|
+
[
|
|
52
|
+
name,
|
|
53
|
+
delay,
|
|
54
|
+
direction,
|
|
55
|
+
duration,
|
|
56
|
+
fill,
|
|
57
|
+
iteration,
|
|
58
|
+
playState,
|
|
59
|
+
timingFunction,
|
|
60
|
+
],
|
|
61
|
+
"tuples",
|
|
126
62
|
);
|
|
127
63
|
|
|
128
64
|
export const animatedComponentFamily = weakFamily(
|
|
@@ -140,3 +76,106 @@ export const animatedComponentFamily = weakFamily(
|
|
|
140
76
|
return createAnimatedComponent(component);
|
|
141
77
|
},
|
|
142
78
|
);
|
|
79
|
+
|
|
80
|
+
export const animation: StyleFunctionResolver = (
|
|
81
|
+
resolveValue,
|
|
82
|
+
value,
|
|
83
|
+
get,
|
|
84
|
+
options,
|
|
85
|
+
) => {
|
|
86
|
+
const animationShortHandTuples = animationShorthand(
|
|
87
|
+
resolveValue,
|
|
88
|
+
value,
|
|
89
|
+
get,
|
|
90
|
+
options,
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
if (!Array.isArray(animationShortHandTuples)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
animationShortHandTuples.pop();
|
|
98
|
+
|
|
99
|
+
const nameTuple = animationShortHandTuples.find(
|
|
100
|
+
(tuple) => tuple[1] === "animationName",
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const name = nameTuple?.[0];
|
|
104
|
+
|
|
105
|
+
if (!nameTuple || typeof name !== "string") {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const keyframes = get(StyleCollection.keyframes(name));
|
|
110
|
+
|
|
111
|
+
const animation: Record<string, any> = {};
|
|
112
|
+
for (const [progress, declarations] of keyframes) {
|
|
113
|
+
animation[progress] ??= {};
|
|
114
|
+
|
|
115
|
+
const props = options.calculateProps?.(
|
|
116
|
+
get,
|
|
117
|
+
// Cast this into a StyleRule[]
|
|
118
|
+
[{ s: [0], d: declarations }],
|
|
119
|
+
options.renderGuards,
|
|
120
|
+
options.inheritedVariables,
|
|
121
|
+
options.inlineVariables,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
if (!props) {
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (props.normal) {
|
|
129
|
+
Object.assign(animation[progress], props.normal);
|
|
130
|
+
}
|
|
131
|
+
if (props.important) {
|
|
132
|
+
Object.assign(animation[progress], props.important);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
animation[progress] = animation[progress].style;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
nameTuple[0] = animation;
|
|
139
|
+
|
|
140
|
+
return applyShorthand(animationShortHandTuples);
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const advancedTimingFunctions: Record<
|
|
144
|
+
string,
|
|
145
|
+
() => (...args: any[]) => unknown
|
|
146
|
+
> = {
|
|
147
|
+
"cubic-bezier": () => {
|
|
148
|
+
return (
|
|
149
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
150
|
+
).cubicBezier;
|
|
151
|
+
},
|
|
152
|
+
"steps": () => {
|
|
153
|
+
return (
|
|
154
|
+
require("react-native-reanimated") as typeof import("react-native-reanimated")
|
|
155
|
+
).steps;
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const timingFunctionResolver: StyleFunctionResolver = (
|
|
160
|
+
resolveValue,
|
|
161
|
+
value,
|
|
162
|
+
) => {
|
|
163
|
+
const name = value[1];
|
|
164
|
+
const resolver = advancedTimingFunctions[name];
|
|
165
|
+
|
|
166
|
+
if (!resolver) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const args = resolveValue(value[2]);
|
|
171
|
+
|
|
172
|
+
if (!Array.isArray(args)) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const fn = resolver();
|
|
177
|
+
|
|
178
|
+
const result = fn(...args);
|
|
179
|
+
|
|
180
|
+
return result;
|
|
181
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { shorthandHandler } from "./shorthand";
|
|
2
|
+
|
|
3
|
+
const width = ["borderWidth", "number"] as const;
|
|
4
|
+
const style = ["borderStyle", "string"] as const;
|
|
5
|
+
const color = ["borderColor", "color", "color"] as const;
|
|
6
|
+
|
|
7
|
+
export const border = shorthandHandler(
|
|
8
|
+
[[width, style, color], [style, color], [width, style], [style]],
|
|
9
|
+
[],
|
|
10
|
+
);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { isStyleDescriptorArray } from "../../utils";
|
|
2
|
+
import type { StyleFunctionResolver } from "./resolve";
|
|
3
|
+
import { shorthandHandler } from "./shorthand";
|
|
4
|
+
|
|
5
|
+
const color = ["color", "string"] as const;
|
|
6
|
+
const offsetX = ["offsetX", "number"] as const;
|
|
7
|
+
const offsetY = ["offsetY", "number"] as const;
|
|
8
|
+
const blurRadius = ["blurRadius", "number"] as const;
|
|
9
|
+
const spreadDistance = ["spreadDistance", "number"] as const;
|
|
10
|
+
// const inset = ["inset", "string"] as const;
|
|
11
|
+
|
|
12
|
+
const handler = shorthandHandler(
|
|
13
|
+
[
|
|
14
|
+
[offsetX, offsetY, blurRadius, spreadDistance, color],
|
|
15
|
+
[color, offsetX, offsetY],
|
|
16
|
+
[color, offsetX, offsetY, blurRadius],
|
|
17
|
+
[color, offsetX, offsetY, blurRadius, spreadDistance],
|
|
18
|
+
[offsetX, offsetY, color],
|
|
19
|
+
[offsetX, offsetY, blurRadius, color],
|
|
20
|
+
],
|
|
21
|
+
[],
|
|
22
|
+
"object",
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
export const boxShadow: StyleFunctionResolver = (
|
|
26
|
+
resolveValue,
|
|
27
|
+
func,
|
|
28
|
+
get,
|
|
29
|
+
options,
|
|
30
|
+
) => {
|
|
31
|
+
const args = resolveValue(func[2]);
|
|
32
|
+
|
|
33
|
+
if (!isStyleDescriptorArray(args)) {
|
|
34
|
+
return args;
|
|
35
|
+
} else {
|
|
36
|
+
return args.flatMap((shadows) => {
|
|
37
|
+
if (shadows === undefined) {
|
|
38
|
+
return [];
|
|
39
|
+
} else if (isStyleDescriptorArray(shadows)) {
|
|
40
|
+
if (shadows.length === 0) {
|
|
41
|
+
return [];
|
|
42
|
+
} else if (Array.isArray(shadows[0])) {
|
|
43
|
+
return shadows
|
|
44
|
+
.map((shadow) => handler(resolveValue, shadow, get, options))
|
|
45
|
+
.filter((v) => v !== undefined);
|
|
46
|
+
} else {
|
|
47
|
+
return handler(resolveValue, shadows, get, options);
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
return handler(resolveValue, shadows, get, options);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
+
import { isStyleDescriptorArray } from "../../utils";
|
|
2
3
|
import type { StyleFunctionResolver } from "./resolve";
|
|
3
4
|
|
|
4
5
|
const calcPrecedence: Record<string, number> = {
|
|
@@ -13,73 +14,49 @@ export const calc: StyleFunctionResolver = (resolveValue, func) => {
|
|
|
13
14
|
const values: number[] = [];
|
|
14
15
|
const ops: string[] = [];
|
|
15
16
|
|
|
16
|
-
const args = func[2];
|
|
17
|
-
|
|
17
|
+
const args = resolveValue(func[2]);
|
|
18
|
+
|
|
19
|
+
if (!isStyleDescriptorArray(args)) return;
|
|
18
20
|
|
|
19
21
|
for (let token of args) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
switch (typeof value) {
|
|
33
|
-
case "number": {
|
|
34
|
-
if (!mode) mode = "number";
|
|
35
|
-
if (mode !== "number") return;
|
|
36
|
-
values.push(value);
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
case "string": {
|
|
40
|
-
if (!value.endsWith("%")) {
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
if (!mode) mode = "percentage";
|
|
44
|
-
if (mode !== "percentage") return;
|
|
45
|
-
values.push(Number.parseFloat(value.slice(0, -1)));
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
default:
|
|
49
|
-
return;
|
|
22
|
+
if (typeof token === "number") {
|
|
23
|
+
if (!mode) mode = "number";
|
|
24
|
+
if (mode !== "number") return;
|
|
25
|
+
values.push(token);
|
|
26
|
+
continue;
|
|
27
|
+
} else if (typeof token === "string") {
|
|
28
|
+
if (token === "(") {
|
|
29
|
+
ops.push(token);
|
|
30
|
+
} else if (token === ")") {
|
|
31
|
+
// Resolve all values within the brackets
|
|
32
|
+
while (ops.length && ops[ops.length - 1] !== "(") {
|
|
33
|
+
applyCalcOperator(ops.pop()!, values.pop(), values.pop(), values);
|
|
50
34
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
ops.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} else {
|
|
66
|
-
// This means we have an operator
|
|
67
|
-
while (
|
|
68
|
-
ops.length &&
|
|
69
|
-
ops[ops.length - 1] &&
|
|
70
|
-
// @ts-ignore
|
|
71
|
-
calcPrecedence[ops[ops.length - 1]] >= calcPrecedence[token]
|
|
72
|
-
) {
|
|
73
|
-
applyCalcOperator(ops.pop()!, values.pop()!, values.pop()!, values);
|
|
74
|
-
}
|
|
75
|
-
ops.push(token);
|
|
35
|
+
ops.pop();
|
|
36
|
+
} else if (token.endsWith("%")) {
|
|
37
|
+
if (!mode) mode = "percentage";
|
|
38
|
+
if (mode !== "percentage") return;
|
|
39
|
+
values.push(Number.parseFloat(token.slice(0, -1)));
|
|
40
|
+
} else {
|
|
41
|
+
// This means we have an operator
|
|
42
|
+
while (
|
|
43
|
+
ops.length &&
|
|
44
|
+
ops[ops.length - 1] &&
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
calcPrecedence[ops[ops.length - 1]] >= calcPrecedence[token]
|
|
47
|
+
) {
|
|
48
|
+
applyCalcOperator(ops.pop()!, values.pop(), values.pop(), values);
|
|
76
49
|
}
|
|
50
|
+
ops.push(token);
|
|
77
51
|
}
|
|
52
|
+
} else {
|
|
53
|
+
// We got something unexpected
|
|
54
|
+
return;
|
|
78
55
|
}
|
|
79
56
|
}
|
|
80
57
|
|
|
81
58
|
while (ops.length) {
|
|
82
|
-
applyCalcOperator(ops.pop()!, values.pop()
|
|
59
|
+
applyCalcOperator(ops.pop()!, values.pop(), values.pop(), values);
|
|
83
60
|
}
|
|
84
61
|
|
|
85
62
|
if (!mode) return;
|
|
@@ -101,8 +78,8 @@ export const calc: StyleFunctionResolver = (resolveValue, func) => {
|
|
|
101
78
|
|
|
102
79
|
function applyCalcOperator(
|
|
103
80
|
operator: string,
|
|
104
|
-
b
|
|
105
|
-
a
|
|
81
|
+
b = 0, // These are reversed because we pop them off the stack
|
|
82
|
+
a = 0,
|
|
106
83
|
values: number[],
|
|
107
84
|
) {
|
|
108
85
|
switch (operator) {
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import type {
|
|
3
|
+
InlineVariable,
|
|
4
|
+
StyleDeclaration,
|
|
5
|
+
StyleRule,
|
|
6
|
+
} from "../../../compiler";
|
|
7
|
+
import { applyValue, Specificity as S } from "../../utils";
|
|
8
|
+
import type { RenderGuard } from "../conditions/guards";
|
|
9
|
+
import {
|
|
10
|
+
VAR_SYMBOL,
|
|
11
|
+
type Getter,
|
|
12
|
+
type VariableContextValue,
|
|
13
|
+
} from "../reactivity";
|
|
14
|
+
import { resolveValue } from "./resolve";
|
|
15
|
+
|
|
16
|
+
export function calculateProps(
|
|
17
|
+
get: Getter,
|
|
18
|
+
rules: (StyleRule | InlineVariable | VariableContextValue)[],
|
|
19
|
+
guards: RenderGuard[] = [],
|
|
20
|
+
inheritedVariables: VariableContextValue = {
|
|
21
|
+
[VAR_SYMBOL]: true,
|
|
22
|
+
},
|
|
23
|
+
inlineVariables: InlineVariable = {
|
|
24
|
+
[VAR_SYMBOL]: "inline",
|
|
25
|
+
},
|
|
26
|
+
) {
|
|
27
|
+
let normal: Record<string, any> | undefined;
|
|
28
|
+
let important: Record<string, any> | undefined;
|
|
29
|
+
|
|
30
|
+
const delayedStyles: (() => void)[] = [];
|
|
31
|
+
|
|
32
|
+
for (const rule of rules) {
|
|
33
|
+
if (VAR_SYMBOL in rule) {
|
|
34
|
+
if (typeof rule[VAR_SYMBOL] === "string") {
|
|
35
|
+
Object.assign(inlineVariables, rule);
|
|
36
|
+
} else {
|
|
37
|
+
Object.assign(inheritedVariables, rule);
|
|
38
|
+
}
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (rule.v) {
|
|
43
|
+
for (const variable of rule.v) {
|
|
44
|
+
inlineVariables[variable[0]] = variable[1];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (rule.d) {
|
|
49
|
+
let topLevelTarget = rule.s?.[S.Important]
|
|
50
|
+
? (important ??= {})
|
|
51
|
+
: (normal ??= {});
|
|
52
|
+
let target = topLevelTarget;
|
|
53
|
+
|
|
54
|
+
const ruleTarget = rule.target || "style";
|
|
55
|
+
|
|
56
|
+
if (typeof ruleTarget === "string") {
|
|
57
|
+
target = target[ruleTarget] ??= {};
|
|
58
|
+
} else if (ruleTarget) {
|
|
59
|
+
for (const path of ruleTarget) {
|
|
60
|
+
target = target[path] ??= {};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
applyDeclarations(
|
|
65
|
+
get,
|
|
66
|
+
rule.d,
|
|
67
|
+
inlineVariables,
|
|
68
|
+
inheritedVariables,
|
|
69
|
+
delayedStyles,
|
|
70
|
+
guards,
|
|
71
|
+
target,
|
|
72
|
+
topLevelTarget,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
for (const delayedStyle of delayedStyles) {
|
|
78
|
+
delayedStyle();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
normal,
|
|
83
|
+
guards,
|
|
84
|
+
important,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function applyDeclarations(
|
|
89
|
+
get: Getter,
|
|
90
|
+
declarations: StyleDeclaration[],
|
|
91
|
+
inlineVariables: InlineVariable,
|
|
92
|
+
inheritedVariables: VariableContextValue,
|
|
93
|
+
delayedStyles: (() => void)[] = [],
|
|
94
|
+
guards: RenderGuard[] = [],
|
|
95
|
+
target: Record<string, any> = {},
|
|
96
|
+
topLevelTarget = target,
|
|
97
|
+
) {
|
|
98
|
+
for (const declaration of declarations) {
|
|
99
|
+
if (!Array.isArray(declaration)) {
|
|
100
|
+
// Static styles
|
|
101
|
+
Object.assign(target, declaration);
|
|
102
|
+
} else {
|
|
103
|
+
// Dynamic styles
|
|
104
|
+
let value: any = declaration[0];
|
|
105
|
+
let propPath = declaration[1];
|
|
106
|
+
let prop = "";
|
|
107
|
+
|
|
108
|
+
if (typeof propPath === "string") {
|
|
109
|
+
if (propPath.startsWith("^")) {
|
|
110
|
+
propPath = propPath.slice(1);
|
|
111
|
+
target = topLevelTarget[propPath] ??= {};
|
|
112
|
+
}
|
|
113
|
+
prop = propPath;
|
|
114
|
+
} else {
|
|
115
|
+
for (prop of propPath) {
|
|
116
|
+
if (prop.startsWith("^")) {
|
|
117
|
+
prop = prop.slice(1);
|
|
118
|
+
target = topLevelTarget[prop] ??= {};
|
|
119
|
+
} else {
|
|
120
|
+
target = target[prop] ??= {};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (Array.isArray(value)) {
|
|
126
|
+
const shouldDelay = declaration[2];
|
|
127
|
+
|
|
128
|
+
if (shouldDelay) {
|
|
129
|
+
/**
|
|
130
|
+
* We need to delay the resolution of this value until after all
|
|
131
|
+
* styles have been calculated. But another style might override
|
|
132
|
+
* this value. So we set a placeholder value and only override
|
|
133
|
+
* if the placeholder is preserved
|
|
134
|
+
*
|
|
135
|
+
* This also ensures the props exist, so setValue will properly
|
|
136
|
+
* mutate the props object and not create a new one
|
|
137
|
+
*/
|
|
138
|
+
const originalValue = value;
|
|
139
|
+
value = {};
|
|
140
|
+
delayedStyles.push(() => {
|
|
141
|
+
if (target[prop] === value) {
|
|
142
|
+
delete target[prop];
|
|
143
|
+
value = resolveValue(originalValue, get, {
|
|
144
|
+
inlineVariables,
|
|
145
|
+
inheritedVariables,
|
|
146
|
+
renderGuards: guards,
|
|
147
|
+
calculateProps,
|
|
148
|
+
});
|
|
149
|
+
applyValue(target, prop, value);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
} else {
|
|
153
|
+
value = resolveValue(value, get, {
|
|
154
|
+
inlineVariables,
|
|
155
|
+
inheritedVariables,
|
|
156
|
+
renderGuards: guards,
|
|
157
|
+
calculateProps,
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
applyValue(target, prop, value);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|