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,54 +1,53 @@
|
|
|
1
1
|
/* eslint-disable */
|
|
2
|
-
import type { Selector,
|
|
2
|
+
import type { Selector, SelectorList } from "lightningcss";
|
|
3
3
|
|
|
4
4
|
import { Specificity } from "../runtime/utils/specificity";
|
|
5
5
|
import type {
|
|
6
6
|
AttributeQuery,
|
|
7
7
|
AttrSelectorOperator,
|
|
8
|
-
|
|
8
|
+
CompilerOptions,
|
|
9
|
+
ContainerQuery,
|
|
9
10
|
MediaCondition,
|
|
11
|
+
PseudoClassesQuery,
|
|
10
12
|
SpecificityArray,
|
|
11
|
-
StyleRule,
|
|
12
13
|
} from "./compiler.types";
|
|
13
14
|
|
|
14
15
|
export type NormalizeSelector =
|
|
16
|
+
| ClassNameSelector
|
|
15
17
|
| {
|
|
16
18
|
type: "rootVariables" | "universalVariables";
|
|
17
19
|
subtype: "light" | "dark";
|
|
18
|
-
}
|
|
19
|
-
| {
|
|
20
|
-
type: "className";
|
|
21
|
-
specificity: SpecificityArray;
|
|
22
|
-
classNames: ([string] | [string, Partial<StyleRule>])[];
|
|
23
20
|
};
|
|
24
21
|
|
|
22
|
+
type ClassNameSelector = {
|
|
23
|
+
type: "className";
|
|
24
|
+
specificity: SpecificityArray;
|
|
25
|
+
className: string;
|
|
26
|
+
mediaQuery?: MediaCondition[];
|
|
27
|
+
containerQuery?: ContainerQuery[];
|
|
28
|
+
pseudoClassesQuery?: PseudoClassesQuery;
|
|
29
|
+
attributeQuery?: AttributeQuery[];
|
|
30
|
+
};
|
|
31
|
+
|
|
25
32
|
/**
|
|
26
33
|
* Turns a CSS selector into a `react-native-css` selector.
|
|
27
34
|
*/
|
|
28
35
|
export function getSelectors(
|
|
29
|
-
extractedStyle: StyleRule,
|
|
30
36
|
selectorList: SelectorList,
|
|
31
|
-
|
|
37
|
+
isDarkMode: boolean,
|
|
38
|
+
options: CompilerOptions,
|
|
32
39
|
selectors: NormalizeSelector[] = [],
|
|
33
|
-
mediaQuery: MediaCondition[] = [],
|
|
34
40
|
) {
|
|
35
41
|
for (let cssSelector of selectorList) {
|
|
36
42
|
// Ignore `:is()`, and just process its selectors
|
|
37
43
|
if (isIsPseudoClass(cssSelector)) {
|
|
38
|
-
getSelectors(
|
|
39
|
-
extractedStyle,
|
|
40
|
-
cssSelector[0].selectors,
|
|
41
|
-
collection,
|
|
42
|
-
selectors,
|
|
43
|
-
);
|
|
44
|
+
getSelectors(cssSelector[0].selectors, isDarkMode, options, selectors);
|
|
44
45
|
} else if (
|
|
45
46
|
// Matches: :root {}
|
|
46
47
|
isRootVariableSelector(cssSelector)
|
|
47
48
|
) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
isDarkModeMediaQuery(extractedStyle.m?.[0])
|
|
51
|
-
) {
|
|
49
|
+
// Matches: @media(prefers-dark-mode) { :root {} }
|
|
50
|
+
if (isDarkMode) {
|
|
52
51
|
selectors.push({
|
|
53
52
|
type: "rootVariables",
|
|
54
53
|
subtype: "dark",
|
|
@@ -61,77 +60,60 @@ export function getSelectors(
|
|
|
61
60
|
}
|
|
62
61
|
} else if (
|
|
63
62
|
// Matches: .dark:root {} || :root[class~="dark"]
|
|
64
|
-
isRootDarkVariableSelector(cssSelector
|
|
63
|
+
isRootDarkVariableSelector(cssSelector)
|
|
65
64
|
) {
|
|
66
65
|
selectors.push({
|
|
67
66
|
type: "rootVariables",
|
|
68
67
|
subtype: "dark",
|
|
69
68
|
});
|
|
70
69
|
} else if (
|
|
71
|
-
// Matches
|
|
70
|
+
// Matches @media(prefers-dark-mode) { * {} }
|
|
71
|
+
isDarkMode &&
|
|
72
72
|
isDefaultVariableSelector(cssSelector)
|
|
73
|
-
) {
|
|
74
|
-
if (
|
|
75
|
-
// Matches @media(prefers-dark-mode) { * {} }
|
|
76
|
-
isDarkModeMediaQuery(extractedStyle.m?.[0])
|
|
77
|
-
) {
|
|
78
|
-
selectors.push({
|
|
79
|
-
type: "universalVariables",
|
|
80
|
-
subtype: "dark",
|
|
81
|
-
});
|
|
82
|
-
} else {
|
|
83
|
-
selectors.push({
|
|
84
|
-
type: "universalVariables",
|
|
85
|
-
subtype: "light",
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
} else if (
|
|
89
|
-
// Matches: .dark * {}
|
|
90
|
-
isDarkUniversalSelector(cssSelector, collection)
|
|
91
73
|
) {
|
|
92
74
|
selectors.push({
|
|
93
75
|
type: "universalVariables",
|
|
94
76
|
subtype: "dark",
|
|
95
77
|
});
|
|
96
78
|
} else if (
|
|
97
|
-
// Matches:
|
|
98
|
-
|
|
99
|
-
) {
|
|
100
|
-
const [_, __, third, ...rest] = cssSelector;
|
|
101
|
-
|
|
102
|
-
getSelectors(extractedStyle, [[third!, ...rest]], collection, selectors, [
|
|
103
|
-
["=", "prefers-color-scheme", "dark"],
|
|
104
|
-
]);
|
|
105
|
-
} else if (
|
|
106
|
-
// Matches: <selector>:is(.dark *) {}
|
|
107
|
-
isDarkClassSelector(cssSelector, collection)
|
|
79
|
+
// Matches: * {}
|
|
80
|
+
isDefaultVariableSelector(cssSelector)
|
|
108
81
|
) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
82
|
+
selectors.push({
|
|
83
|
+
type: "universalVariables",
|
|
84
|
+
subtype: "light",
|
|
85
|
+
});
|
|
86
|
+
// } else if (
|
|
87
|
+
// // Matches: .dark * {}
|
|
88
|
+
// isDarkUniversalSelector(cssSelector)
|
|
89
|
+
// ) {
|
|
90
|
+
// selectors.push({
|
|
91
|
+
// type: "universalVariables",
|
|
92
|
+
// subtype: "dark",
|
|
93
|
+
// });
|
|
94
|
+
// } else if (
|
|
95
|
+
// // Matches: .dark <selector> {}
|
|
96
|
+
// isDarkClassLegacySelector(cssSelector, collection)
|
|
97
|
+
// ) {
|
|
98
|
+
// const [_, __, third, ...rest] = cssSelector;
|
|
99
|
+
|
|
100
|
+
// getSelectors(extractedStyle, [[third!, ...rest]], collection, selectors, [
|
|
101
|
+
// ["=", "prefers-color-scheme", "dark"],
|
|
102
|
+
// ]);
|
|
103
|
+
// } else if (
|
|
104
|
+
// // Matches: <selector>:is(.dark *) {}
|
|
105
|
+
// isDarkClassSelector(cssSelector, collection)
|
|
106
|
+
// ) {
|
|
107
|
+
// const [first] = cssSelector;
|
|
108
|
+
|
|
109
|
+
// getSelectors(extractedStyle, [[first!]], collection, selectors, [
|
|
110
|
+
// ["=", "prefers-color-scheme", "dark"],
|
|
111
|
+
// ]);
|
|
114
112
|
} else {
|
|
115
|
-
const selector =
|
|
116
|
-
{
|
|
117
|
-
type: "className",
|
|
118
|
-
specificity: [],
|
|
119
|
-
classNames: [],
|
|
120
|
-
},
|
|
121
|
-
cssSelector,
|
|
122
|
-
collection,
|
|
123
|
-
mediaQuery,
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
if (selector === null || selector.classNames.length === 0) {
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
113
|
+
const selector = classNameSelector(cssSelector, options);
|
|
129
114
|
|
|
130
|
-
if (selector
|
|
131
|
-
|
|
132
|
-
lastClass[1] ??= {};
|
|
133
|
-
lastClass[1].m ??= [];
|
|
134
|
-
lastClass[1].m.push(...mediaQuery);
|
|
115
|
+
if (selector === null) {
|
|
116
|
+
continue;
|
|
135
117
|
}
|
|
136
118
|
|
|
137
119
|
selectors.push(selector);
|
|
@@ -141,18 +123,58 @@ export function getSelectors(
|
|
|
141
123
|
return selectors;
|
|
142
124
|
}
|
|
143
125
|
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
let
|
|
126
|
+
function classNameSelector(
|
|
127
|
+
selector: Selector,
|
|
128
|
+
options: CompilerOptions,
|
|
129
|
+
): ClassNameSelector | null {
|
|
130
|
+
let primaryClassName: string | undefined;
|
|
131
|
+
const specificity: SpecificityArray = [];
|
|
132
|
+
let mediaQuery: MediaCondition[] | undefined;
|
|
133
|
+
let containerQuery: ContainerQuery[] | undefined;
|
|
134
|
+
let attributeQuery: AttributeQuery[] | undefined;
|
|
135
|
+
let pseudoClassesQuery: PseudoClassesQuery | undefined;
|
|
136
|
+
|
|
137
|
+
let currentContainerQuery: ContainerQuery | undefined;
|
|
138
|
+
|
|
139
|
+
let isInClassBlock = false;
|
|
140
|
+
let newBlock = false;
|
|
141
|
+
|
|
142
|
+
function getAttributeQuery() {
|
|
143
|
+
if (newBlock) {
|
|
144
|
+
currentContainerQuery ??= {};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (currentContainerQuery) {
|
|
148
|
+
if (!currentContainerQuery.a) {
|
|
149
|
+
currentContainerQuery.a = [];
|
|
150
|
+
}
|
|
151
|
+
return currentContainerQuery.a;
|
|
152
|
+
} else {
|
|
153
|
+
attributeQuery ??= [];
|
|
154
|
+
return attributeQuery;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function getPseudoClassesQuery() {
|
|
159
|
+
if (newBlock) {
|
|
160
|
+
currentContainerQuery ??= {};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (currentContainerQuery) {
|
|
164
|
+
if (!currentContainerQuery.p) {
|
|
165
|
+
currentContainerQuery.p = {};
|
|
166
|
+
}
|
|
167
|
+
return currentContainerQuery.p;
|
|
168
|
+
} else {
|
|
169
|
+
pseudoClassesQuery ??= {};
|
|
170
|
+
return pseudoClassesQuery;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
151
173
|
|
|
152
174
|
/*
|
|
153
|
-
* Loop over each token
|
|
175
|
+
* Loop over each token in reverse order.
|
|
154
176
|
*/
|
|
155
|
-
for (const component of
|
|
177
|
+
for (const component of selector.reverse()) {
|
|
156
178
|
switch (component.type) {
|
|
157
179
|
case "universal":
|
|
158
180
|
case "namespace":
|
|
@@ -161,25 +183,101 @@ function reduceSelector(
|
|
|
161
183
|
case "pseudo-element":
|
|
162
184
|
// We don't support these selectors at all
|
|
163
185
|
return null;
|
|
164
|
-
case "
|
|
165
|
-
if (
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
186
|
+
case "class": {
|
|
187
|
+
if (!primaryClassName) {
|
|
188
|
+
primaryClassName = component.name;
|
|
189
|
+
} else if (isInClassBlock) {
|
|
190
|
+
getAttributeQuery().unshift(["a", "className", "*=", component.name]);
|
|
191
|
+
} else if (component.name !== options.selectorPrefix) {
|
|
192
|
+
if (currentContainerQuery?.n) {
|
|
193
|
+
getAttributeQuery().unshift([
|
|
194
|
+
"a",
|
|
195
|
+
"className",
|
|
196
|
+
"*=",
|
|
197
|
+
component.name,
|
|
198
|
+
]);
|
|
199
|
+
} else {
|
|
200
|
+
currentContainerQuery ??= {};
|
|
201
|
+
currentContainerQuery.n = component.name;
|
|
202
|
+
|
|
203
|
+
containerQuery ??= [];
|
|
204
|
+
containerQuery.unshift(currentContainerQuery);
|
|
173
205
|
}
|
|
206
|
+
}
|
|
174
207
|
|
|
175
|
-
|
|
176
|
-
|
|
208
|
+
isInClassBlock = true;
|
|
209
|
+
newBlock = false;
|
|
210
|
+
|
|
211
|
+
specificity[Specificity.ClassName] =
|
|
212
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
213
|
+
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
case "pseudo-class": {
|
|
217
|
+
specificity[Specificity.ClassName] =
|
|
218
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
219
|
+
|
|
220
|
+
// if (component.kind === "is") {
|
|
221
|
+
// if (isDarkUniversalSelector(component.selectors[0]!, collection)) {
|
|
222
|
+
// const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
223
|
+
// lastGroup[1] ??= {};
|
|
224
|
+
// lastGroup[1].m ??= [];
|
|
225
|
+
// lastGroup[1].m.push(["=", "prefers-color-scheme", "dark"]);
|
|
226
|
+
// break;
|
|
227
|
+
// }
|
|
228
|
+
// }
|
|
229
|
+
|
|
230
|
+
switch (component.kind) {
|
|
231
|
+
case "hover": {
|
|
232
|
+
getPseudoClassesQuery().h = 1;
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
case "active": {
|
|
236
|
+
getPseudoClassesQuery().a = 1;
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
case "focus": {
|
|
240
|
+
getPseudoClassesQuery().f = 1;
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
case "disabled": {
|
|
244
|
+
getAttributeQuery().push(["a", "disabled"]);
|
|
245
|
+
break;
|
|
246
|
+
}
|
|
247
|
+
case "empty": {
|
|
248
|
+
getAttributeQuery().push(["a", "children", "!"]);
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
default: {
|
|
252
|
+
// We don't support other pseudo-classes
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
177
255
|
}
|
|
256
|
+
break;
|
|
257
|
+
}
|
|
258
|
+
case "attribute": {
|
|
259
|
+
// We don't support attribute selectors as standalone selectors
|
|
260
|
+
// Except for a top level [dir] selector
|
|
261
|
+
// if (classNames.length === 0) {
|
|
262
|
+
// if (
|
|
263
|
+
// component.name === "dir" &&
|
|
264
|
+
// component.operation?.operator === "equal"
|
|
265
|
+
// ) {
|
|
266
|
+
// mediaQuery ??= [];
|
|
267
|
+
// mediaQuery.push(["!!", component.operation.value]);
|
|
268
|
+
// break;
|
|
269
|
+
// }
|
|
270
|
+
|
|
271
|
+
// // Ignore any other attributes that are not part of a class selector
|
|
272
|
+
// return null;
|
|
273
|
+
// }
|
|
178
274
|
|
|
179
275
|
// Turn attribute selectors into AttributeConditions
|
|
180
|
-
|
|
181
|
-
(
|
|
276
|
+
specificity[Specificity.ClassName] =
|
|
277
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
182
278
|
|
|
279
|
+
// [data-*] are turned into `dataSet` queries
|
|
280
|
+
// Everything else is turned into `attribute` queries
|
|
183
281
|
const attributeQuery: AttributeQuery = component.name.startsWith(
|
|
184
282
|
"data-",
|
|
185
283
|
)
|
|
@@ -218,10 +316,7 @@ function reduceSelector(
|
|
|
218
316
|
}
|
|
219
317
|
}
|
|
220
318
|
|
|
221
|
-
|
|
222
|
-
lastGroup[1] ??= {};
|
|
223
|
-
lastGroup[1].aq ??= [];
|
|
224
|
-
lastGroup[1].aq.push(attributeQuery);
|
|
319
|
+
getAttributeQuery().push(attributeQuery);
|
|
225
320
|
break;
|
|
226
321
|
}
|
|
227
322
|
case "type": {
|
|
@@ -231,108 +326,39 @@ function reduceSelector(
|
|
|
231
326
|
*
|
|
232
327
|
* NOTE: We ignore specificity for this
|
|
233
328
|
*/
|
|
234
|
-
if (component.name
|
|
235
|
-
|
|
329
|
+
if (component.name === options.selectorPrefix) {
|
|
330
|
+
break;
|
|
236
331
|
}
|
|
237
|
-
|
|
332
|
+
return null;
|
|
238
333
|
}
|
|
239
334
|
case "combinator": {
|
|
240
335
|
// We only support the descendant combinator
|
|
241
|
-
if (component.value
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
case "class": {
|
|
247
|
-
acc.specificity[Specificity.ClassName] =
|
|
248
|
-
(acc.specificity[Specificity.ClassName] ?? 0) + 1;
|
|
249
|
-
|
|
250
|
-
switch (previousType) {
|
|
251
|
-
// <something> .class
|
|
252
|
-
case undefined:
|
|
253
|
-
case "combinator": {
|
|
254
|
-
if (component.name === collection.selectorPrefix?.slice(1)) {
|
|
255
|
-
// If the name matches the selectorPrefix, just ignore it!
|
|
256
|
-
// E.g .dark .myClass
|
|
257
|
-
break;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
acc.classNames.push([component.name]);
|
|
261
|
-
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
// .class.otherClass
|
|
265
|
-
case "class": {
|
|
266
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
267
|
-
lastGroup[1] ??= {};
|
|
268
|
-
lastGroup[1].aq ??= [];
|
|
269
|
-
lastGroup[1].aq.push(["a", "className", "*=", component.name]);
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
default: {
|
|
273
|
-
return null;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
break;
|
|
277
|
-
}
|
|
278
|
-
case "pseudo-class": {
|
|
279
|
-
acc.specificity[Specificity.ClassName] =
|
|
280
|
-
(acc.specificity[Specificity.ClassName] ?? 0) + 1;
|
|
281
|
-
|
|
282
|
-
if (component.kind === "is") {
|
|
283
|
-
if (isDarkUniversalSelector(component.selectors[0]!, collection)) {
|
|
284
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
285
|
-
lastGroup[1] ??= {};
|
|
286
|
-
lastGroup[1].m ??= [];
|
|
287
|
-
lastGroup[1].m.push(["=", "prefers-color-scheme", "dark"]);
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
336
|
+
if (component.value === "descendant") {
|
|
337
|
+
isInClassBlock = false;
|
|
338
|
+
newBlock = true;
|
|
339
|
+
currentContainerQuery = undefined;
|
|
340
|
+
break;
|
|
290
341
|
}
|
|
291
342
|
|
|
292
|
-
|
|
293
|
-
case "hover": {
|
|
294
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
295
|
-
lastGroup[1] ??= {};
|
|
296
|
-
lastGroup[1].p ??= {};
|
|
297
|
-
lastGroup[1].p.h = 1;
|
|
298
|
-
break;
|
|
299
|
-
}
|
|
300
|
-
case "active": {
|
|
301
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
302
|
-
lastGroup[1] ??= {};
|
|
303
|
-
lastGroup[1].p ??= {};
|
|
304
|
-
lastGroup[1].p.a = 1;
|
|
305
|
-
break;
|
|
306
|
-
}
|
|
307
|
-
case "focus": {
|
|
308
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
309
|
-
lastGroup[1] ??= {};
|
|
310
|
-
lastGroup[1].p ??= {};
|
|
311
|
-
lastGroup[1].p.f = 1;
|
|
312
|
-
break;
|
|
313
|
-
}
|
|
314
|
-
case "disabled": {
|
|
315
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
316
|
-
lastGroup[1] ??= {};
|
|
317
|
-
lastGroup[1].aq ??= [];
|
|
318
|
-
lastGroup[1].aq.push(["a", "disabled"]);
|
|
319
|
-
break;
|
|
320
|
-
}
|
|
321
|
-
case "empty": {
|
|
322
|
-
const lastGroup = acc.classNames[acc.classNames.length - 1]!;
|
|
323
|
-
lastGroup[1] ??= {};
|
|
324
|
-
lastGroup[1].aq ??= [];
|
|
325
|
-
lastGroup[1].aq.push(["a", "children", "!"]);
|
|
326
|
-
break;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
343
|
+
return null;
|
|
329
344
|
}
|
|
330
345
|
}
|
|
346
|
+
}
|
|
331
347
|
|
|
332
|
-
|
|
348
|
+
if (!primaryClassName) {
|
|
349
|
+
// No class name found, return null
|
|
350
|
+
return null;
|
|
333
351
|
}
|
|
334
352
|
|
|
335
|
-
return
|
|
353
|
+
return {
|
|
354
|
+
type: "className",
|
|
355
|
+
specificity: specificity,
|
|
356
|
+
className: primaryClassName,
|
|
357
|
+
mediaQuery,
|
|
358
|
+
containerQuery,
|
|
359
|
+
pseudoClassesQuery,
|
|
360
|
+
attributeQuery,
|
|
361
|
+
};
|
|
336
362
|
}
|
|
337
363
|
|
|
338
364
|
function isIsPseudoClass(
|
|
@@ -345,62 +371,62 @@ function isIsPseudoClass(
|
|
|
345
371
|
);
|
|
346
372
|
}
|
|
347
373
|
|
|
348
|
-
function isDarkModeMediaQuery(query?: MediaCondition): boolean {
|
|
349
|
-
|
|
374
|
+
// function isDarkModeMediaQuery(query?: MediaCondition): boolean {
|
|
375
|
+
// if (!query) return false;
|
|
350
376
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
}
|
|
377
|
+
// return (
|
|
378
|
+
// query[0] === "=" &&
|
|
379
|
+
// query[1] === "prefers-color-scheme" &&
|
|
380
|
+
// query[2] === "dark"
|
|
381
|
+
// );
|
|
382
|
+
// }
|
|
357
383
|
|
|
358
384
|
// Matches: <selector>:is(.dark *)
|
|
359
|
-
function isDarkClassSelector(
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
385
|
+
// function isDarkClassSelector(
|
|
386
|
+
// [first, second, third]: Selector,
|
|
387
|
+
// collection: CompilerCollection,
|
|
388
|
+
// ) {
|
|
389
|
+
// if (!collection.darkMode) {
|
|
390
|
+
// return false;
|
|
391
|
+
// }
|
|
392
|
+
|
|
393
|
+
// return (
|
|
394
|
+
// first &&
|
|
395
|
+
// second &&
|
|
396
|
+
// !third &&
|
|
397
|
+
// first.type === "class" &&
|
|
398
|
+
// second.type === "pseudo-class" &&
|
|
399
|
+
// second.kind === "is" &&
|
|
400
|
+
// second.selectors.length === 1 &&
|
|
401
|
+
// second.selectors[0]?.length === 3 &&
|
|
402
|
+
// second.selectors[0][0]?.type === "class" &&
|
|
403
|
+
// second.selectors[0][0].name === collection.darkMode &&
|
|
404
|
+
// second.selectors[0][1]?.type === "combinator" &&
|
|
405
|
+
// second.selectors[0][1].value === "descendant" &&
|
|
406
|
+
// second.selectors[0][2]?.type === "universal"
|
|
407
|
+
// );
|
|
408
|
+
// }
|
|
383
409
|
|
|
384
410
|
// Matches: .dark <selector> {}
|
|
385
|
-
function isDarkClassLegacySelector(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
) {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
411
|
+
// function isDarkClassLegacySelector(
|
|
412
|
+
// [first, second, third]: Selector,
|
|
413
|
+
// collection: CompilerCollection,
|
|
414
|
+
// ) {
|
|
415
|
+
// if (!collection.darkMode) {
|
|
416
|
+
// return false;
|
|
417
|
+
// }
|
|
418
|
+
|
|
419
|
+
// return (
|
|
420
|
+
// first &&
|
|
421
|
+
// second &&
|
|
422
|
+
// third &&
|
|
423
|
+
// first.type === "class" &&
|
|
424
|
+
// first.name === collection.darkMode &&
|
|
425
|
+
// second.type === "combinator" &&
|
|
426
|
+
// second.value === "descendant" &&
|
|
427
|
+
// third.type === "class"
|
|
428
|
+
// );
|
|
429
|
+
// }
|
|
404
430
|
|
|
405
431
|
// Matches: :root {}
|
|
406
432
|
function isRootVariableSelector([first, second]: Selector) {
|
|
@@ -415,19 +441,12 @@ function isDefaultVariableSelector([first, second]: Selector) {
|
|
|
415
441
|
}
|
|
416
442
|
|
|
417
443
|
// Matches: .dark:root {}
|
|
418
|
-
function isRootDarkVariableSelector(
|
|
419
|
-
[first, second]: Selector,
|
|
420
|
-
collection: CompilerCollection,
|
|
421
|
-
) {
|
|
422
|
-
if (!collection.darkMode) {
|
|
423
|
-
return false;
|
|
424
|
-
}
|
|
444
|
+
function isRootDarkVariableSelector([first, second]: Selector) {
|
|
425
445
|
return (
|
|
426
446
|
first &&
|
|
427
447
|
second &&
|
|
428
448
|
// .dark:root {}
|
|
429
449
|
((first.type === "class" &&
|
|
430
|
-
first.name === collection.darkMode &&
|
|
431
450
|
second.type === "pseudo-class" &&
|
|
432
451
|
second.kind === "root") ||
|
|
433
452
|
// :root[class~=dark] {}
|
|
@@ -436,30 +455,29 @@ function isRootDarkVariableSelector(
|
|
|
436
455
|
second.type === "attribute" &&
|
|
437
456
|
second.name === "class" &&
|
|
438
457
|
second.operation &&
|
|
439
|
-
second.operation.value === collection.darkMode &&
|
|
440
458
|
["includes", "equal"].includes(second.operation.operator)))
|
|
441
459
|
);
|
|
442
460
|
}
|
|
443
461
|
|
|
444
462
|
// Matches: .dark * {}
|
|
445
|
-
function isDarkUniversalSelector(
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
+
// function isDarkUniversalSelector(
|
|
464
|
+
// [first, second, third]: Selector,
|
|
465
|
+
// collection: CompilerCollection,
|
|
466
|
+
// ) {
|
|
467
|
+
// if (!collection.darkMode) {
|
|
468
|
+
// return false;
|
|
469
|
+
// }
|
|
470
|
+
// return (
|
|
471
|
+
// first &&
|
|
472
|
+
// second &&
|
|
473
|
+
// third &&
|
|
474
|
+
// first.type === "class" &&
|
|
475
|
+
// first.name === collection.darkMode &&
|
|
476
|
+
// second.type === "combinator" &&
|
|
477
|
+
// second.value === "descendant" &&
|
|
478
|
+
// third.type === "universal"
|
|
479
|
+
// );
|
|
480
|
+
// }
|
|
463
481
|
|
|
464
482
|
export function toRNProperty<T extends string>(str: T) {
|
|
465
483
|
return str
|