react-native-css 3.0.0-nightly.75f8b74 → 3.0.0-nightly.9c84741
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/dist/commonjs/compiler/atRules.js +16 -3
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +37 -21
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +255 -154
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +15 -15
- package/dist/commonjs/compiler/inheritance.test.js.map +1 -1
- package/dist/commonjs/compiler/keyframes.js +1 -1
- package/dist/commonjs/compiler/keyframes.js.map +1 -1
- package/dist/commonjs/compiler/pseudo-elements.js +49 -0
- package/dist/commonjs/compiler/pseudo-elements.js.map +1 -0
- package/dist/commonjs/compiler/selector-builder.js +501 -0
- package/dist/commonjs/compiler/selector-builder.js.map +1 -0
- package/dist/commonjs/compiler/selectors.js +10 -6
- package/dist/commonjs/compiler/selectors.js.map +1 -1
- package/dist/commonjs/compiler/stylesheet.js +137 -46
- package/dist/commonjs/compiler/stylesheet.js.map +1 -1
- package/dist/commonjs/compiler/supports.js +27 -0
- package/dist/commonjs/compiler/supports.js.map +1 -0
- package/dist/commonjs/components/ActivityIndicator.js +22 -0
- package/dist/commonjs/components/ActivityIndicator.js.map +1 -0
- package/dist/commonjs/components/Button.js +22 -0
- package/dist/commonjs/components/Button.js.map +1 -0
- package/dist/commonjs/components/FlatList.js +19 -0
- package/dist/commonjs/components/FlatList.js.map +1 -0
- package/dist/commonjs/components/Image.js +17 -0
- package/dist/commonjs/components/Image.js.map +1 -0
- package/dist/commonjs/components/Switch.js +17 -0
- package/dist/commonjs/components/Switch.js.map +1 -0
- package/dist/commonjs/components/TextInput.js +17 -0
- package/dist/commonjs/components/TextInput.js.map +1 -0
- package/dist/commonjs/components/index.js +48 -0
- package/dist/commonjs/components/index.js.map +1 -1
- package/dist/commonjs/components/react-native-safe-area-context.js +17 -0
- package/dist/commonjs/components/react-native-safe-area-context.js.map +1 -0
- package/dist/commonjs/components/react-native-safe-area-context.native.js +53 -0
- package/dist/commonjs/components/react-native-safe-area-context.native.js.map +1 -0
- package/dist/commonjs/jest/index.js +30 -12
- package/dist/commonjs/jest/index.js.map +1 -1
- package/dist/commonjs/metro/index.js +7 -4
- package/dist/commonjs/metro/index.js.map +1 -1
- package/dist/commonjs/metro/injection-code.js +5 -10
- package/dist/commonjs/metro/injection-code.js.map +1 -1
- package/dist/commonjs/metro/metro-transformer.js +18 -8
- package/dist/commonjs/metro/metro-transformer.js.map +1 -1
- package/dist/commonjs/metro/resolver.js +3 -0
- package/dist/commonjs/metro/resolver.js.map +1 -1
- package/dist/commonjs/poison.pill.js +14 -11
- package/dist/commonjs/poison.pill.js.map +1 -1
- package/dist/commonjs/runtime/native/api.js +8 -2
- package/dist/commonjs/runtime/native/api.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/attributes.js +42 -0
- package/dist/commonjs/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js +28 -21
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/guards.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +12 -46
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +26 -21
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/react/interaction.js +10 -10
- package/dist/commonjs/runtime/native/react/interaction.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +33 -27
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +3 -2
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +12 -12
- package/dist/commonjs/runtime/native/reactivity.js.map +1 -1
- package/dist/commonjs/runtime/native/reanimated.js +17 -0
- package/dist/commonjs/runtime/native/reanimated.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/calculate-props.js +63 -38
- package/dist/commonjs/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/defaults.js +1 -1
- package/dist/commonjs/runtime/native/styles/defaults.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/functions/animation-timing.js +34 -0
- package/dist/commonjs/runtime/native/styles/functions/animation-timing.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/calc.js +125 -0
- package/dist/commonjs/runtime/native/styles/functions/calc.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{filters.js → functions/filters.js} +3 -3
- package/dist/commonjs/runtime/native/styles/functions/filters.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js +83 -0
- package/dist/commonjs/runtime/native/styles/functions/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js +32 -0
- package/dist/commonjs/runtime/native/styles/functions/numeric-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +3 -3
- package/dist/commonjs/runtime/native/styles/functions/platform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/string-functions.js +23 -0
- package/dist/commonjs/runtime/native/styles/functions/string-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js +121 -0
- package/dist/commonjs/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/index.js +12 -12
- package/dist/commonjs/runtime/native/styles/index.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/resolve.js +21 -44
- package/dist/commonjs/runtime/native/styles/resolve.js.map +1 -1
- package/dist/commonjs/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/commonjs/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{animation.js → shorthands/animation.js} +6 -37
- package/dist/commonjs/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{border.js → shorthands/border.js} +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js +50 -0
- package/dist/commonjs/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/shorthands/index.js +61 -0
- package/dist/commonjs/runtime/native/styles/shorthands/index.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +2 -2
- package/dist/commonjs/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
- package/dist/commonjs/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
- package/dist/commonjs/runtime/native/styles/shorthands/transform.js.map +1 -0
- 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 +3 -2
- package/dist/commonjs/runtime/native/styles/variables.js.map +1 -1
- package/dist/commonjs/runtime/utils/objects.js +14 -6
- package/dist/commonjs/runtime/utils/objects.js.map +1 -1
- package/dist/commonjs/runtime/utils/specificity.js +2 -1
- package/dist/commonjs/runtime/utils/specificity.js.map +1 -1
- package/dist/commonjs/runtime/web/api.js.map +1 -1
- package/dist/commonjs/style-collection/index.js +110 -0
- package/dist/commonjs/style-collection/index.js.map +1 -0
- package/dist/commonjs/style-collection/root.js +28 -0
- package/dist/commonjs/style-collection/root.js.map +1 -0
- package/dist/module/compiler/atRules.js +16 -3
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +37 -21
- package/dist/module/compiler/compiler.js.map +1 -1
- package/dist/module/compiler/compiler.types.js +1 -1
- package/dist/module/compiler/compiler.types.js.map +1 -1
- package/dist/module/compiler/declarations.js +250 -150
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +15 -15
- package/dist/module/compiler/inheritance.test.js.map +1 -1
- package/dist/module/compiler/keyframes.js +1 -1
- package/dist/module/compiler/keyframes.js.map +1 -1
- package/dist/module/compiler/pseudo-elements.js +44 -0
- package/dist/module/compiler/pseudo-elements.js.map +1 -0
- package/dist/module/compiler/selector-builder.js +496 -0
- package/dist/module/compiler/selector-builder.js.map +1 -0
- package/dist/module/compiler/selectors.js +10 -6
- package/dist/module/compiler/selectors.js.map +1 -1
- package/dist/module/compiler/stylesheet.js +136 -45
- package/dist/module/compiler/stylesheet.js.map +1 -1
- package/dist/module/compiler/supports.js +23 -0
- package/dist/module/compiler/supports.js.map +1 -0
- package/dist/module/components/ActivityIndicator.js +17 -0
- package/dist/module/components/ActivityIndicator.js.map +1 -0
- package/dist/module/components/Button.js +17 -0
- package/dist/module/components/Button.js.map +1 -0
- package/dist/module/components/FlatList.js +14 -0
- package/dist/module/components/FlatList.js.map +1 -0
- package/dist/module/components/Image.js +12 -0
- package/dist/module/components/Image.js.map +1 -0
- package/dist/module/components/Switch.js +12 -0
- package/dist/module/components/Switch.js.map +1 -0
- package/dist/module/components/TextInput.js +12 -0
- package/dist/module/components/TextInput.js.map +1 -0
- package/dist/module/components/index.js +6 -0
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/react-native-safe-area-context.js +4 -0
- package/dist/module/components/react-native-safe-area-context.js.map +1 -0
- package/dist/module/components/react-native-safe-area-context.native.js +36 -0
- package/dist/module/components/react-native-safe-area-context.native.js.map +1 -0
- package/dist/module/jest/index.js +28 -10
- package/dist/module/jest/index.js.map +1 -1
- package/dist/module/metro/index.js +7 -4
- package/dist/module/metro/index.js.map +1 -1
- package/dist/module/metro/injection-code.js +5 -10
- package/dist/module/metro/injection-code.js.map +1 -1
- package/dist/module/metro/metro-transformer.js +18 -8
- package/dist/module/metro/metro-transformer.js.map +1 -1
- package/dist/module/metro/resolver.js +3 -0
- package/dist/module/metro/resolver.js.map +1 -1
- package/dist/module/poison.pill.js +14 -11
- package/dist/module/poison.pill.js.map +1 -1
- package/dist/module/runtime/native/api.js +2 -1
- package/dist/module/runtime/native/api.js.map +1 -1
- package/dist/module/runtime/native/conditions/attributes.js +38 -0
- package/dist/module/runtime/native/conditions/attributes.js.map +1 -0
- package/dist/module/runtime/native/conditions/container-query.js +28 -21
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/guards.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +12 -46
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +27 -22
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/react/interaction.js +10 -10
- package/dist/module/runtime/native/react/interaction.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +31 -26
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +2 -1
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +11 -11
- package/dist/module/runtime/native/reactivity.js.map +1 -1
- package/dist/module/runtime/native/reanimated.js +13 -0
- package/dist/module/runtime/native/reanimated.js.map +1 -0
- package/dist/module/runtime/native/styles/calculate-props.js +64 -39
- package/dist/module/runtime/native/styles/calculate-props.js.map +1 -1
- package/dist/module/runtime/native/styles/defaults.js +1 -1
- package/dist/module/runtime/native/styles/defaults.js.map +1 -1
- package/dist/module/runtime/native/styles/functions/animation-timing.js +30 -0
- package/dist/module/runtime/native/styles/functions/animation-timing.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/calc.js +120 -0
- package/dist/module/runtime/native/styles/functions/calc.js.map +1 -0
- package/dist/module/runtime/native/styles/{filters.js → functions/filters.js} +2 -2
- package/dist/module/runtime/native/styles/functions/filters.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/index.js +10 -0
- package/dist/module/runtime/native/styles/functions/index.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/numeric-functions.js +25 -0
- package/dist/module/runtime/native/styles/functions/numeric-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/{platform-functions.js → functions/platform-functions.js} +1 -1
- package/dist/module/runtime/native/styles/functions/platform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/string-functions.js +18 -0
- package/dist/module/runtime/native/styles/functions/string-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js +114 -0
- package/dist/module/runtime/native/styles/functions/transform-functions.js.map +1 -0
- package/dist/module/runtime/native/styles/index.js +12 -12
- package/dist/module/runtime/native/styles/index.js.map +1 -1
- package/dist/module/runtime/native/styles/resolve.js +20 -44
- package/dist/module/runtime/native/styles/resolve.js.map +1 -1
- package/dist/module/runtime/native/styles/{shorthand.js → shorthands/_handler.js} +5 -5
- package/dist/module/runtime/native/styles/shorthands/_handler.js.map +1 -0
- package/dist/module/runtime/native/styles/{animation.js → shorthands/animation.js} +3 -34
- package/dist/module/runtime/native/styles/shorthands/animation.js.map +1 -0
- package/dist/module/runtime/native/styles/{border.js → shorthands/border.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/border.js.map +1 -0
- package/dist/module/runtime/native/styles/{box-shadow.js → shorthands/box-shadow.js} +16 -6
- package/dist/module/runtime/native/styles/shorthands/box-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/shorthands/index.js +8 -0
- package/dist/module/runtime/native/styles/shorthands/index.js.map +1 -0
- package/dist/module/runtime/native/styles/{text-shadow.js → shorthands/text-shadow.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/text-shadow.js.map +1 -0
- package/dist/module/runtime/native/styles/{transform.js → shorthands/transform.js} +1 -1
- package/dist/module/runtime/native/styles/shorthands/transform.js.map +1 -0
- 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 +2 -1
- package/dist/module/runtime/native/styles/variables.js.map +1 -1
- package/dist/module/runtime/utils/objects.js +14 -6
- package/dist/module/runtime/utils/objects.js.map +1 -1
- package/dist/module/runtime/utils/specificity.js +2 -1
- package/dist/module/runtime/utils/specificity.js.map +1 -1
- package/dist/module/runtime/web/api.js.map +1 -1
- package/dist/module/style-collection/index.js +95 -0
- package/dist/module/style-collection/index.js.map +1 -0
- package/dist/module/style-collection/root.js +24 -0
- package/dist/module/style-collection/root.js.map +1 -0
- package/dist/typescript/commonjs/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +16 -17
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +18 -19
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts +4 -0
- package/dist/typescript/commonjs/src/compiler/pseudo-elements.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts +24 -0
- package/dist/typescript/commonjs/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/commonjs/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts +23 -9
- package/dist/typescript/commonjs/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/supports.d.ts +3 -0
- package/dist/typescript/commonjs/src/compiler/supports.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts +13 -0
- package/dist/typescript/commonjs/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Button.d.ts +13 -0
- package/dist/typescript/commonjs/src/components/Button.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/FlatList.d.ts +10 -0
- package/dist/typescript/commonjs/src/components/FlatList.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Image.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/Image.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/Switch.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/Switch.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts +8 -0
- package/dist/typescript/commonjs/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/components/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts +2 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts +4 -0
- package/dist/typescript/commonjs/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/jest/index.d.ts +20 -3
- package/dist/typescript/commonjs/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts +4 -7
- package/dist/typescript/commonjs/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts +4 -1
- package/dist/typescript/commonjs/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts +3 -1
- package/dist/typescript/commonjs/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/commonjs/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/commonjs/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/react/rules.d.ts +2 -2
- 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 +2 -1
- package/dist/typescript/commonjs/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/defaults.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts +8 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts +6 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/commonjs/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts +1 -1
- package/dist/typescript/commonjs/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/style-collection/index.d.ts +14 -0
- package/dist/typescript/commonjs/src/style-collection/index.d.ts.map +1 -0
- package/dist/typescript/commonjs/src/style-collection/root.d.ts +11 -0
- package/dist/typescript/commonjs/src/style-collection/root.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/atRules.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts +9 -2
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +16 -17
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +18 -19
- package/dist/typescript/module/src/compiler/declarations.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts +4 -0
- package/dist/typescript/module/src/compiler/pseudo-elements.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts +24 -0
- package/dist/typescript/module/src/compiler/selector-builder.d.ts.map +1 -0
- package/dist/typescript/module/src/compiler/selectors.d.ts +3 -2
- package/dist/typescript/module/src/compiler/selectors.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/stylesheet.d.ts +23 -9
- package/dist/typescript/module/src/compiler/stylesheet.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/supports.d.ts +3 -0
- package/dist/typescript/module/src/compiler/supports.d.ts.map +1 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts +13 -0
- package/dist/typescript/module/src/components/ActivityIndicator.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Button.d.ts +13 -0
- package/dist/typescript/module/src/components/Button.d.ts.map +1 -0
- package/dist/typescript/module/src/components/FlatList.d.ts +10 -0
- package/dist/typescript/module/src/components/FlatList.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Image.d.ts +8 -0
- package/dist/typescript/module/src/components/Image.d.ts.map +1 -0
- package/dist/typescript/module/src/components/Switch.d.ts +8 -0
- package/dist/typescript/module/src/components/Switch.d.ts.map +1 -0
- package/dist/typescript/module/src/components/TextInput.d.ts +8 -0
- package/dist/typescript/module/src/components/TextInput.d.ts.map +1 -0
- package/dist/typescript/module/src/components/index.d.ts +6 -0
- package/dist/typescript/module/src/components/index.d.ts.map +1 -1
- package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts +2 -0
- package/dist/typescript/module/src/components/react-native-safe-area-context.d.ts.map +1 -0
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts +4 -0
- package/dist/typescript/module/src/components/react-native-safe-area-context.native.d.ts.map +1 -0
- package/dist/typescript/module/src/jest/index.d.ts +20 -3
- package/dist/typescript/module/src/jest/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/index.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/injection-code.d.ts +4 -7
- package/dist/typescript/module/src/metro/injection-code.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts +4 -1
- package/dist/typescript/module/src/metro/metro-transformer.d.ts.map +1 -1
- package/dist/typescript/module/src/metro/resolver.d.ts.map +1 -1
- package/dist/typescript/module/src/poison.pill.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts +3 -1
- package/dist/typescript/module/src/runtime/native/api.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/conditions/attributes.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts +3 -3
- package/dist/typescript/module/src/runtime/native/conditions/container-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/guards.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/index.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/conditions/media-query.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts +2 -2
- package/dist/typescript/module/src/runtime/native/react/interaction.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/react/rules.d.ts +2 -2
- 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 +2 -1
- package/dist/typescript/module/src/runtime/native/react/useNativeCss.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +2 -10
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/reanimated.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts +1 -1
- package/dist/typescript/module/src/runtime/native/styles/calculate-props.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/defaults.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/animation-timing.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/calc.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{filters.d.ts → functions/filters.d.ts} +1 -1
- package/dist/typescript/module/src/runtime/native/styles/functions/filters.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts +8 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/numeric-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{platform-functions.d.ts → functions/platform-functions.d.ts} +2 -2
- package/dist/typescript/module/src/runtime/native/styles/functions/platform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/string-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts +5 -0
- package/dist/typescript/module/src/runtime/native/styles/functions/transform-functions.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/resolve.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/{shorthand.d.ts → shorthands/_handler.d.ts} +2 -2
- package/dist/typescript/module/src/runtime/native/styles/shorthands/_handler.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts +4 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/animation.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/border.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts +3 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/box-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts +6 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/index.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts +2 -0
- package/dist/typescript/module/src/runtime/native/styles/shorthands/text-shadow.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/{transform.d.ts → shorthands/transform.d.ts} +1 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthands/transform.d.ts.map +1 -0
- package/dist/typescript/module/src/runtime/native/styles/units.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/native/styles/variables.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/objects.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts +1 -0
- package/dist/typescript/module/src/runtime/utils/specificity.d.ts.map +1 -1
- package/dist/typescript/module/src/runtime/web/api.d.ts +1 -1
- package/dist/typescript/module/src/runtime/web/api.d.ts.map +1 -1
- package/dist/typescript/module/src/style-collection/index.d.ts +14 -0
- package/dist/typescript/module/src/style-collection/index.d.ts.map +1 -0
- package/dist/typescript/module/src/style-collection/root.d.ts +11 -0
- package/dist/typescript/module/src/style-collection/root.d.ts.map +1 -0
- package/package.json +32 -16
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/compiler.ts +40 -33
- package/src/compiler/compiler.types.ts +18 -19
- package/src/compiler/declarations.ts +447 -192
- package/src/compiler/inheritance.test.ts +13 -13
- package/src/compiler/keyframes.ts +1 -1
- package/src/compiler/pseudo-elements.ts +54 -0
- package/src/compiler/selector-builder.ts +586 -0
- package/src/compiler/selectors.ts +20 -6
- package/src/compiler/stylesheet.ts +188 -53
- package/src/compiler/supports.ts +26 -0
- package/src/components/ActivityIndicator.tsx +27 -0
- package/src/components/Button.tsx +22 -0
- package/src/components/FlatList.tsx +21 -0
- package/src/components/Image.tsx +17 -0
- package/src/components/Switch.tsx +17 -0
- package/src/components/TextInput.tsx +17 -0
- package/src/components/index.tsx +6 -0
- package/src/components/react-native-safe-area-context.native.tsx +40 -0
- package/src/components/react-native-safe-area-context.tsx +1 -0
- package/src/jest/index.ts +35 -10
- package/src/metro/index.ts +12 -7
- package/src/metro/injection-code.ts +6 -10
- package/src/metro/metro-transformer.ts +27 -10
- package/src/metro/resolver.ts +8 -0
- package/src/poison.pill.ts +15 -11
- package/src/runtime/native/api.ts +3 -1
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +27 -22
- package/src/runtime/native/conditions/guards.ts +1 -2
- package/src/runtime/native/conditions/index.ts +14 -66
- package/src/runtime/native/conditions/media-query.ts +29 -25
- package/src/runtime/native/react/interaction.ts +12 -12
- package/src/runtime/native/react/rules.ts +34 -24
- package/src/runtime/native/react/useNativeCss.ts +4 -1
- package/src/runtime/native/reactivity.ts +14 -21
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/styles/calculate-props.ts +71 -39
- package/src/runtime/native/styles/defaults.ts +1 -0
- package/src/runtime/native/styles/functions/animation-timing.ts +44 -0
- package/src/runtime/native/styles/functions/calc.ts +121 -0
- package/src/runtime/native/styles/{filters.ts → functions/filters.ts} +3 -3
- package/src/runtime/native/styles/functions/index.ts +7 -0
- package/src/runtime/native/styles/functions/numeric-functions.ts +38 -0
- package/src/runtime/native/styles/{platform-functions.ts → functions/platform-functions.ts} +2 -2
- package/src/runtime/native/styles/functions/string-functions.ts +22 -0
- package/src/runtime/native/styles/functions/transform-functions.ts +84 -0
- package/src/runtime/native/styles/index.ts +12 -12
- package/src/runtime/native/styles/resolve.ts +20 -63
- package/src/runtime/native/styles/{shorthand.ts → shorthands/_handler.ts} +5 -5
- package/src/runtime/native/styles/{animation.ts → shorthands/animation.ts} +4 -62
- package/src/runtime/native/styles/{border.ts → shorthands/border.ts} +1 -1
- package/src/runtime/native/styles/shorthands/box-shadow.ts +74 -0
- package/src/runtime/native/styles/shorthands/index.ts +5 -0
- package/src/runtime/native/styles/{text-shadow.ts → shorthands/text-shadow.ts} +1 -1
- package/src/runtime/native/styles/{transform.ts → shorthands/transform.ts} +4 -2
- package/src/runtime/native/styles/units.ts +8 -4
- package/src/runtime/native/styles/variables.ts +5 -5
- package/src/runtime/utils/objects.ts +16 -4
- package/src/runtime/utils/specificity.ts +1 -0
- package/src/runtime/web/api.ts +1 -1
- package/src/style-collection/index.ts +142 -0
- package/src/style-collection/root.ts +35 -0
- package/dist/commonjs/compiler/attributes.test.js +0 -20
- package/dist/commonjs/compiler/attributes.test.js.map +0 -1
- package/dist/commonjs/doctor/index.js +0 -6
- package/dist/commonjs/doctor/index.js.map +0 -1
- package/dist/commonjs/runtime/native/injection.js +0 -98
- package/dist/commonjs/runtime/native/injection.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/animation.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/border.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/box-shadow.js +0 -40
- package/dist/commonjs/runtime/native/styles/box-shadow.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/calc.js +0 -85
- package/dist/commonjs/runtime/native/styles/calc.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/filters.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/platform-functions.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/shorthand.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/text-shadow.js.map +0 -1
- package/dist/commonjs/runtime/native/styles/transform.js.map +0 -1
- package/dist/module/compiler/attributes.test.js +0 -20
- package/dist/module/compiler/attributes.test.js.map +0 -1
- package/dist/module/doctor/index.js +0 -4
- package/dist/module/doctor/index.js.map +0 -1
- package/dist/module/runtime/native/injection.js +0 -93
- package/dist/module/runtime/native/injection.js.map +0 -1
- package/dist/module/runtime/native/styles/animation.js.map +0 -1
- package/dist/module/runtime/native/styles/border.js.map +0 -1
- package/dist/module/runtime/native/styles/box-shadow.js.map +0 -1
- package/dist/module/runtime/native/styles/calc.js +0 -79
- package/dist/module/runtime/native/styles/calc.js.map +0 -1
- package/dist/module/runtime/native/styles/filters.js.map +0 -1
- package/dist/module/runtime/native/styles/platform-functions.js.map +0 -1
- package/dist/module/runtime/native/styles/shorthand.js.map +0 -1
- package/dist/module/runtime/native/styles/text-shadow.js.map +0 -1
- package/dist/module/runtime/native/styles/transform.js.map +0 -1
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts +0 -2
- package/dist/typescript/commonjs/src/compiler/attributes.test.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/doctor/index.d.ts +0 -2
- package/dist/typescript/commonjs/src/doctor/index.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts +0 -16
- package/dist/typescript/commonjs/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts +0 -9
- package/dist/typescript/commonjs/src/runtime/native/styles/animation.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/border.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts +0 -3
- package/dist/typescript/commonjs/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts +0 -3
- package/dist/typescript/commonjs/src/runtime/native/styles/calc.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/filters.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/shorthand.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts +0 -2
- package/dist/typescript/commonjs/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
- package/dist/typescript/commonjs/src/runtime/native/styles/transform.d.ts.map +0 -1
- package/dist/typescript/module/src/compiler/attributes.test.d.ts +0 -2
- package/dist/typescript/module/src/compiler/attributes.test.d.ts.map +0 -1
- package/dist/typescript/module/src/doctor/index.d.ts +0 -2
- package/dist/typescript/module/src/doctor/index.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/injection.d.ts +0 -16
- package/dist/typescript/module/src/runtime/native/injection.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts +0 -9
- package/dist/typescript/module/src/runtime/native/styles/animation.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/styles/border.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts +0 -3
- package/dist/typescript/module/src/runtime/native/styles/box-shadow.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts +0 -3
- package/dist/typescript/module/src/runtime/native/styles/calc.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/filters.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/platform-functions.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/shorthand.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts +0 -2
- package/dist/typescript/module/src/runtime/native/styles/text-shadow.d.ts.map +0 -1
- package/dist/typescript/module/src/runtime/native/styles/transform.d.ts.map +0 -1
- package/src/compiler/attributes.test.ts +0 -28
- package/src/doctor/index.ts +0 -1
- package/src/runtime/native/injection.ts +0 -131
- package/src/runtime/native/styles/box-shadow.ts +0 -54
- package/src/runtime/native/styles/calc.ts +0 -97
|
@@ -0,0 +1,586 @@
|
|
|
1
|
+
import type { AttrOperation, Selector, SelectorList } from "lightningcss";
|
|
2
|
+
|
|
3
|
+
import { Specificity } from "../runtime/utils";
|
|
4
|
+
import type {
|
|
5
|
+
AttributeQuery,
|
|
6
|
+
AttrSelectorOperator,
|
|
7
|
+
CompilerOptions,
|
|
8
|
+
ContainerQuery,
|
|
9
|
+
MediaCondition,
|
|
10
|
+
PseudoClassesQuery,
|
|
11
|
+
SpecificityArray,
|
|
12
|
+
} from "./compiler.types";
|
|
13
|
+
|
|
14
|
+
interface ReactNativeClassNameSelector {
|
|
15
|
+
type: "className";
|
|
16
|
+
specificity: SpecificityArray;
|
|
17
|
+
className: string;
|
|
18
|
+
mediaQuery?: MediaCondition[];
|
|
19
|
+
containerQuery?: ContainerQuery[];
|
|
20
|
+
pseudoClassesQuery?: PseudoClassesQuery;
|
|
21
|
+
attributeQuery?: AttributeQuery[];
|
|
22
|
+
pseudoElementQuery?: string[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface ReactNativeGlobalSelector {
|
|
26
|
+
type: "rootVariables" | "universalVariables";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type PartialSelector = Partial<ReactNativeClassNameSelector> & {
|
|
30
|
+
type: "className";
|
|
31
|
+
specificity: SpecificityArray;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const containerQueryMap = new WeakMap<WeakKey, ContainerQuery[]>();
|
|
35
|
+
const attributeQueryMap = new WeakMap<WeakKey, AttributeQuery[]>();
|
|
36
|
+
const mediaQueryMap = new WeakMap<WeakKey, MediaCondition[]>();
|
|
37
|
+
const pseudoClassesQueryMap = new WeakMap<WeakKey, PseudoClassesQuery>();
|
|
38
|
+
|
|
39
|
+
type ContainerQueryWithSpecificity = ContainerQuery & {
|
|
40
|
+
specificity: SpecificityArray;
|
|
41
|
+
m?: MediaCondition;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export function getClassNameSelectors(
|
|
45
|
+
selectors: SelectorList,
|
|
46
|
+
options: CompilerOptions = {},
|
|
47
|
+
specificity: SpecificityArray = [0],
|
|
48
|
+
root: PartialSelector = {
|
|
49
|
+
type: "className",
|
|
50
|
+
specificity: [],
|
|
51
|
+
},
|
|
52
|
+
) {
|
|
53
|
+
if (!selectors.length) {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return selectors.flatMap(
|
|
58
|
+
(selector): (ReactNativeGlobalSelector | PartialSelector)[] => {
|
|
59
|
+
if (isRootVariableSelector(selector)) {
|
|
60
|
+
return [{ type: "rootVariables" }];
|
|
61
|
+
} else if (isUniversalSelector(selector)) {
|
|
62
|
+
return [{ type: "universalVariables" }];
|
|
63
|
+
} else {
|
|
64
|
+
return (
|
|
65
|
+
parseComponents(
|
|
66
|
+
selector.reverse(),
|
|
67
|
+
options,
|
|
68
|
+
root,
|
|
69
|
+
root,
|
|
70
|
+
specificity,
|
|
71
|
+
) ?? []
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function parseComponents(
|
|
79
|
+
[component, ...rest]: Selector,
|
|
80
|
+
options: CompilerOptions,
|
|
81
|
+
root: PartialSelector,
|
|
82
|
+
ref: PartialSelector | ContainerQuery,
|
|
83
|
+
specificity: SpecificityArray,
|
|
84
|
+
): PartialSelector[] | null {
|
|
85
|
+
if (!component || Array.isArray(component.type)) {
|
|
86
|
+
// Merge the specificity with the root specificity
|
|
87
|
+
for (let i = 0; i < specificity.length; i++) {
|
|
88
|
+
const value = specificity[i];
|
|
89
|
+
if (value !== undefined) {
|
|
90
|
+
root.specificity[i] = (root.specificity[i] ?? 0) + value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Return the root
|
|
95
|
+
return [root];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
switch (component.type) {
|
|
99
|
+
case "id": // #id
|
|
100
|
+
case "namespace": // @namespace
|
|
101
|
+
case "universal": // * - universal selector
|
|
102
|
+
return null;
|
|
103
|
+
case "type": {
|
|
104
|
+
// div, span
|
|
105
|
+
if (
|
|
106
|
+
component.name === options.selectorPrefix ||
|
|
107
|
+
component.name === "html"
|
|
108
|
+
) {
|
|
109
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
110
|
+
} else {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
case "nesting":
|
|
115
|
+
// &
|
|
116
|
+
// The SelectorList should be flattened, so we can skip these
|
|
117
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
118
|
+
case "combinator": {
|
|
119
|
+
// We only support the descendant combinator
|
|
120
|
+
if (component.value === "descendant") {
|
|
121
|
+
// Switch to now parsing a container query
|
|
122
|
+
ref = {};
|
|
123
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
case "pseudo-element": {
|
|
129
|
+
switch (component.kind) {
|
|
130
|
+
case "selection":
|
|
131
|
+
case "placeholder": {
|
|
132
|
+
specificity[Specificity.PseudoElements] =
|
|
133
|
+
(specificity[Specificity.PseudoElements] ?? 0) + 1;
|
|
134
|
+
root.pseudoElementQuery ??= [];
|
|
135
|
+
root.pseudoElementQuery.push(component.kind);
|
|
136
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
137
|
+
}
|
|
138
|
+
default: {
|
|
139
|
+
return [];
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
case "pseudo-class": {
|
|
144
|
+
switch (component.kind) {
|
|
145
|
+
case "hover": {
|
|
146
|
+
getPseudoClassesQuery(ref).h = 1;
|
|
147
|
+
specificity[Specificity.PseudoClass] =
|
|
148
|
+
(specificity[Specificity.PseudoClass] ?? 0) + 1;
|
|
149
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
150
|
+
}
|
|
151
|
+
case "active": {
|
|
152
|
+
getPseudoClassesQuery(ref).a = 1;
|
|
153
|
+
specificity[Specificity.PseudoClass] =
|
|
154
|
+
(specificity[Specificity.PseudoClass] ?? 0) + 1;
|
|
155
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
156
|
+
}
|
|
157
|
+
case "focus": {
|
|
158
|
+
getPseudoClassesQuery(ref).f = 1;
|
|
159
|
+
specificity[Specificity.PseudoClass] =
|
|
160
|
+
(specificity[Specificity.PseudoClass] ?? 0) + 1;
|
|
161
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
162
|
+
}
|
|
163
|
+
case "disabled": {
|
|
164
|
+
getAttributeQuery(ref).push(["a", "disabled"]);
|
|
165
|
+
specificity[Specificity.PseudoClass] =
|
|
166
|
+
(specificity[Specificity.PseudoClass] ?? 0) + 1;
|
|
167
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
168
|
+
}
|
|
169
|
+
case "empty": {
|
|
170
|
+
getAttributeQuery(ref).push(["a", "children", "!"]);
|
|
171
|
+
specificity[Specificity.PseudoClass] =
|
|
172
|
+
(specificity[Specificity.PseudoClass] ?? 0) + 1;
|
|
173
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
174
|
+
}
|
|
175
|
+
case "where":
|
|
176
|
+
case "is": {
|
|
177
|
+
// Now get the selectors inside the `is` or `where` pseudo-class
|
|
178
|
+
const isWhereContainerQueries = component.selectors.flatMap(
|
|
179
|
+
(selector) => {
|
|
180
|
+
return parseIsWhereComponents(component.kind, selector) ?? [];
|
|
181
|
+
},
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
// Remember we're looping in reverse order,
|
|
185
|
+
// So `rest` contains the selectors BEFORE this one
|
|
186
|
+
const parents = parseComponents(
|
|
187
|
+
rest,
|
|
188
|
+
options,
|
|
189
|
+
root,
|
|
190
|
+
ref,
|
|
191
|
+
specificity,
|
|
192
|
+
);
|
|
193
|
+
|
|
194
|
+
if (!parents) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// Each parent selector should be combined with each pseudo-class selector
|
|
199
|
+
return parents.flatMap((parent) => {
|
|
200
|
+
const originalParent = { ...parent };
|
|
201
|
+
|
|
202
|
+
return isWhereContainerQueries.map((containerQuery) => {
|
|
203
|
+
const { specificity, m, ...query } = containerQuery;
|
|
204
|
+
parent = { ...originalParent };
|
|
205
|
+
parent.specificity = [...originalParent.specificity];
|
|
206
|
+
|
|
207
|
+
if (m && m.length > 1) {
|
|
208
|
+
parent.mediaQuery = originalParent.mediaQuery
|
|
209
|
+
? [["&", [...originalParent.mediaQuery, m]]]
|
|
210
|
+
: [m];
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (component.kind === "is") {
|
|
214
|
+
for (let i = 0; i < specificity.length; i++) {
|
|
215
|
+
const value = specificity[i];
|
|
216
|
+
if (value !== undefined) {
|
|
217
|
+
parent.specificity[i] =
|
|
218
|
+
(parent.specificity[i] ?? 0) + value;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (query.a || query.p || query.n !== undefined) {
|
|
224
|
+
parent.containerQuery = [
|
|
225
|
+
...(originalParent.containerQuery ?? []),
|
|
226
|
+
];
|
|
227
|
+
parent.containerQuery.push(query);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return parent;
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
default: {
|
|
235
|
+
return [];
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
case "attribute": {
|
|
240
|
+
if (component.name === "dir") {
|
|
241
|
+
if (!component.operation) {
|
|
242
|
+
return [];
|
|
243
|
+
}
|
|
244
|
+
const operator = operatorMap[component.operation.operator];
|
|
245
|
+
|
|
246
|
+
if (operator !== "=") {
|
|
247
|
+
return [];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
getMediaQuery(ref).push([operator, "dir", component.operation.value]);
|
|
251
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
252
|
+
} else {
|
|
253
|
+
// specificity[Specificity.ClassName] =
|
|
254
|
+
// (specificity[Specificity.ClassName] ?? 0) + 1;
|
|
255
|
+
const attributeQuery: AttributeQuery = component.name.startsWith(
|
|
256
|
+
"data-",
|
|
257
|
+
)
|
|
258
|
+
? // [data-*] are turned into `dataSet` queries
|
|
259
|
+
["d", toRNProperty(component.name.replace("data-", ""))]
|
|
260
|
+
: // Everything else is turned into `attribute` queries
|
|
261
|
+
["a", toRNProperty(component.name)];
|
|
262
|
+
if (component.operation) {
|
|
263
|
+
let operator: AttrSelectorOperator | undefined;
|
|
264
|
+
switch (component.operation.operator) {
|
|
265
|
+
case "equal":
|
|
266
|
+
operator = "=";
|
|
267
|
+
break;
|
|
268
|
+
case "includes":
|
|
269
|
+
operator = "~=";
|
|
270
|
+
break;
|
|
271
|
+
case "dash-match":
|
|
272
|
+
operator = "|=";
|
|
273
|
+
break;
|
|
274
|
+
case "prefix":
|
|
275
|
+
operator = "^=";
|
|
276
|
+
break;
|
|
277
|
+
case "substring":
|
|
278
|
+
operator = "*=";
|
|
279
|
+
break;
|
|
280
|
+
case "suffix":
|
|
281
|
+
operator = "$=";
|
|
282
|
+
break;
|
|
283
|
+
default:
|
|
284
|
+
component.operation.operator satisfies never;
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
if (operator) {
|
|
288
|
+
// Append the operator onto the attribute query
|
|
289
|
+
attributeQuery.push(operator, component.operation.value);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
getAttributeQuery(ref).push(attributeQuery);
|
|
293
|
+
specificity[Specificity.ClassName] =
|
|
294
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
295
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
case "class": {
|
|
299
|
+
if (component.name === options.selectorPrefix) {
|
|
300
|
+
// Skip this one
|
|
301
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
302
|
+
} else if (!isContainerQuery(ref) && !ref.className) {
|
|
303
|
+
ref.className = component.name;
|
|
304
|
+
specificity[Specificity.ClassName] =
|
|
305
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
306
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
307
|
+
} else if (!isContainerQuery(ref)) {
|
|
308
|
+
// Only the first className is used, the rest are attribute queries
|
|
309
|
+
getAttributeQuery(ref).unshift([
|
|
310
|
+
"a",
|
|
311
|
+
"className",
|
|
312
|
+
"*=",
|
|
313
|
+
component.name,
|
|
314
|
+
]);
|
|
315
|
+
} else {
|
|
316
|
+
let containerQueries = containerQueryMap.get(root);
|
|
317
|
+
if (!containerQueries) {
|
|
318
|
+
containerQueries = [];
|
|
319
|
+
root.containerQuery = containerQueries;
|
|
320
|
+
containerQueryMap.set(root, containerQueries);
|
|
321
|
+
}
|
|
322
|
+
if (!ref.n) {
|
|
323
|
+
containerQueries.unshift(ref);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
ref.n = ref.n ? `${ref.n}.${component.name}` : `g:${component.name}`;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
specificity[Specificity.ClassName] =
|
|
330
|
+
(specificity[Specificity.ClassName] ?? 0) + 1;
|
|
331
|
+
return parseComponents(rest, options, root, ref, specificity);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function parseIsWhereComponents(
|
|
337
|
+
type: "is" | "where",
|
|
338
|
+
selector: Selector,
|
|
339
|
+
index = 0,
|
|
340
|
+
queries?: ContainerQueryWithSpecificity[],
|
|
341
|
+
): ContainerQueryWithSpecificity[] | null {
|
|
342
|
+
const component = selector[index];
|
|
343
|
+
|
|
344
|
+
if (!component || Array.isArray(component.type)) {
|
|
345
|
+
return queries ?? [];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
switch (component.type) {
|
|
349
|
+
// These are not allowed in `is()` or `where()`
|
|
350
|
+
case "id": // #id
|
|
351
|
+
case "namespace": // @namespace
|
|
352
|
+
case "type": // div, span
|
|
353
|
+
case "nesting": // &
|
|
354
|
+
case "pseudo-element": // ::selection, ::placeholder, etc
|
|
355
|
+
return null;
|
|
356
|
+
case "combinator": {
|
|
357
|
+
// We only support the descendant combinator
|
|
358
|
+
if (component.value === "descendant") {
|
|
359
|
+
// Each "block" is a new container query
|
|
360
|
+
const children = parseIsWhereComponents(type, selector, index + 1);
|
|
361
|
+
return children && queries ? [...queries, ...children] : children;
|
|
362
|
+
}
|
|
363
|
+
return null;
|
|
364
|
+
}
|
|
365
|
+
case "universal": {
|
|
366
|
+
// * - universal selector
|
|
367
|
+
if (index !== selector.length - 1) {
|
|
368
|
+
// We only accept it in the last position
|
|
369
|
+
return null;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// This was the only component, so we return the ref
|
|
373
|
+
if (selector.length === 1) {
|
|
374
|
+
return queries ?? [{ specificity: [] }];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
const previous = selector[index - 1];
|
|
378
|
+
|
|
379
|
+
// If the previous component is not a descendant combinator,
|
|
380
|
+
if (
|
|
381
|
+
!previous ||
|
|
382
|
+
previous.type !== "combinator" ||
|
|
383
|
+
previous.value !== "descendant"
|
|
384
|
+
) {
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
389
|
+
}
|
|
390
|
+
case "pseudo-class": {
|
|
391
|
+
// const specificity = ref.specificity;
|
|
392
|
+
|
|
393
|
+
// specificity[Specificity.ClassName] =
|
|
394
|
+
// (specificity[Specificity.ClassName] ?? 0) + 1;
|
|
395
|
+
switch (component.kind) {
|
|
396
|
+
case "dir": {
|
|
397
|
+
queries ??= [{ specificity: [] }];
|
|
398
|
+
queries.forEach((query) => {
|
|
399
|
+
getMediaQuery(query).push(["=", "dir", component.direction]);
|
|
400
|
+
});
|
|
401
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
402
|
+
}
|
|
403
|
+
case "hover": {
|
|
404
|
+
queries ??= [{ specificity: [] }];
|
|
405
|
+
queries.forEach((query) => {
|
|
406
|
+
getPseudoClassesQuery(query).h = 1;
|
|
407
|
+
});
|
|
408
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
409
|
+
}
|
|
410
|
+
case "active": {
|
|
411
|
+
queries ??= [{ specificity: [] }];
|
|
412
|
+
queries.forEach((query) => {
|
|
413
|
+
getPseudoClassesQuery(query).a = 1;
|
|
414
|
+
});
|
|
415
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
416
|
+
}
|
|
417
|
+
case "focus": {
|
|
418
|
+
queries ??= [{ specificity: [] }];
|
|
419
|
+
queries.forEach((query) => {
|
|
420
|
+
getPseudoClassesQuery(query).f = 1;
|
|
421
|
+
});
|
|
422
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
423
|
+
}
|
|
424
|
+
case "disabled": {
|
|
425
|
+
queries ??= [{ specificity: [] }];
|
|
426
|
+
queries.forEach((query) => {
|
|
427
|
+
getAttributeQuery(query).push(["a", "disabled"]);
|
|
428
|
+
});
|
|
429
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
430
|
+
}
|
|
431
|
+
case "empty": {
|
|
432
|
+
queries ??= [{ specificity: [] }];
|
|
433
|
+
queries.forEach((query) => {
|
|
434
|
+
getAttributeQuery(query).push(["a", "children", "!"]);
|
|
435
|
+
});
|
|
436
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
437
|
+
}
|
|
438
|
+
case "where":
|
|
439
|
+
case "is": {
|
|
440
|
+
// Now get the selectors inside the `is` or `where` pseudo-class
|
|
441
|
+
queries = component.selectors.flatMap((selector) => {
|
|
442
|
+
return parseIsWhereComponents(type, selector, 0, queries) ?? [];
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
446
|
+
}
|
|
447
|
+
default: {
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
case "attribute": {
|
|
453
|
+
if (component.name === "dir") {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (type !== "where") {
|
|
458
|
+
// specificity[Specificity.ClassName] =
|
|
459
|
+
// (specificity[Specificity.ClassName] ?? 0) + 1;
|
|
460
|
+
}
|
|
461
|
+
const attributeQuery: AttributeQuery = component.name.startsWith("data-")
|
|
462
|
+
? // [data-*] are turned into `dataSet` queries
|
|
463
|
+
["d", toRNProperty(component.name.replace("data-", ""))]
|
|
464
|
+
: // Everything else is turned into `attribute` queries
|
|
465
|
+
["a", toRNProperty(component.name)];
|
|
466
|
+
if (component.operation) {
|
|
467
|
+
const operator = operatorMap[component.operation.operator];
|
|
468
|
+
// Append the operator onto the attribute query
|
|
469
|
+
attributeQuery.push(operator, component.operation.value);
|
|
470
|
+
}
|
|
471
|
+
queries ??= [{ specificity: [] }];
|
|
472
|
+
for (const query of queries) {
|
|
473
|
+
if (type === "is") {
|
|
474
|
+
query.specificity[Specificity.ClassName] =
|
|
475
|
+
(query.specificity[Specificity.ClassName] ?? 0) + 1;
|
|
476
|
+
}
|
|
477
|
+
getAttributeQuery(query).push(attributeQuery);
|
|
478
|
+
}
|
|
479
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
480
|
+
}
|
|
481
|
+
case "class": {
|
|
482
|
+
// In `is` and `where` selectors, the ref will always be a container query
|
|
483
|
+
queries ??= [{ specificity: [] }];
|
|
484
|
+
for (const query of queries) {
|
|
485
|
+
if (type === "is") {
|
|
486
|
+
query.specificity[Specificity.ClassName] =
|
|
487
|
+
(query.specificity[Specificity.ClassName] ?? 0) + 1;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
query.n = query.n
|
|
491
|
+
? `${query.n}.${component.name}`
|
|
492
|
+
: `g:${component.name}`;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
return parseIsWhereComponents(type, selector, index + 1, queries);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
function isContainerQuery(
|
|
501
|
+
value: PartialSelector | ContainerQuery,
|
|
502
|
+
): value is ContainerQuery {
|
|
503
|
+
return !("type" in value);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
function getPseudoClassesQuery(key: PartialSelector | ContainerQuery) {
|
|
507
|
+
let pseudoClassesQuery = pseudoClassesQueryMap.get(key);
|
|
508
|
+
if (!pseudoClassesQuery) {
|
|
509
|
+
if ("type" in key) {
|
|
510
|
+
pseudoClassesQuery = {};
|
|
511
|
+
key.pseudoClassesQuery = pseudoClassesQuery;
|
|
512
|
+
} else {
|
|
513
|
+
key.p ??= {};
|
|
514
|
+
pseudoClassesQuery = key.p;
|
|
515
|
+
}
|
|
516
|
+
pseudoClassesQueryMap.set(key, pseudoClassesQuery);
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
return pseudoClassesQuery;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
function getAttributeQuery(
|
|
523
|
+
key: PartialSelector | ContainerQuery,
|
|
524
|
+
): AttributeQuery[] {
|
|
525
|
+
let attributeQuery = attributeQueryMap.get(key);
|
|
526
|
+
if (!attributeQuery) {
|
|
527
|
+
if ("type" in key) {
|
|
528
|
+
attributeQuery = [];
|
|
529
|
+
key.attributeQuery = attributeQuery;
|
|
530
|
+
} else {
|
|
531
|
+
key.a ??= [];
|
|
532
|
+
attributeQuery = key.a;
|
|
533
|
+
}
|
|
534
|
+
attributeQueryMap.set(key, attributeQuery);
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
return attributeQuery;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function getMediaQuery(
|
|
541
|
+
key: PartialSelector | ContainerQuery,
|
|
542
|
+
): MediaCondition[] {
|
|
543
|
+
let mediaQuery = mediaQueryMap.get(key);
|
|
544
|
+
if (!mediaQuery) {
|
|
545
|
+
if ("type" in key) {
|
|
546
|
+
mediaQuery = [];
|
|
547
|
+
key.mediaQuery = mediaQuery;
|
|
548
|
+
} else {
|
|
549
|
+
mediaQuery = [];
|
|
550
|
+
key.m ??= ["&", mediaQuery];
|
|
551
|
+
}
|
|
552
|
+
mediaQueryMap.set(key, mediaQuery);
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return mediaQuery;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
function isRootVariableSelector([first, second]: Selector) {
|
|
559
|
+
return (
|
|
560
|
+
first && !second && first.type === "pseudo-class" && first.kind === "root"
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
function isUniversalSelector([first, second]: Selector) {
|
|
565
|
+
return first && first.type === "universal" && !second;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
export function toRNProperty<T extends string>(str: T) {
|
|
569
|
+
return str
|
|
570
|
+
.replace(/^-rn-/, "")
|
|
571
|
+
.replace(/-./g, (x) => x[1]?.toUpperCase() ?? "") as CamelCase<T>;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
type CamelCase<S extends string> =
|
|
575
|
+
S extends `${infer P1}-${infer P2}${infer P3}`
|
|
576
|
+
? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}`
|
|
577
|
+
: Lowercase<S>;
|
|
578
|
+
|
|
579
|
+
const operatorMap: Record<AttrOperation["operator"], AttrSelectorOperator> = {
|
|
580
|
+
"equal": "=",
|
|
581
|
+
"includes": "~=",
|
|
582
|
+
"dash-match": "|=",
|
|
583
|
+
"prefix": "^=",
|
|
584
|
+
"substring": "*=",
|
|
585
|
+
"suffix": "$=",
|
|
586
|
+
};
|
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
PseudoClassesQuery,
|
|
12
12
|
SpecificityArray,
|
|
13
13
|
} from "./compiler.types";
|
|
14
|
+
import { StylesheetBuilder } from "./stylesheet";
|
|
14
15
|
|
|
15
16
|
export type NormalizeSelector =
|
|
16
17
|
| ClassNameSelector
|
|
@@ -35,13 +36,13 @@ type ClassNameSelector = {
|
|
|
35
36
|
export function getSelectors(
|
|
36
37
|
selectorList: SelectorList,
|
|
37
38
|
isDarkMode: boolean,
|
|
38
|
-
|
|
39
|
+
builder: StylesheetBuilder,
|
|
39
40
|
selectors: NormalizeSelector[] = [],
|
|
40
41
|
) {
|
|
41
42
|
for (let cssSelector of selectorList) {
|
|
42
|
-
// Ignore `:is()`, and just process its selectors
|
|
43
|
-
if (isIsPseudoClass(cssSelector)) {
|
|
44
|
-
getSelectors(cssSelector[0].selectors, isDarkMode,
|
|
43
|
+
// Ignore `:is()` & `:where()`, and just process its selectors
|
|
44
|
+
if (isIsPseudoClass(cssSelector) || isWherePseudoClass(cssSelector)) {
|
|
45
|
+
getSelectors(cssSelector[0].selectors, isDarkMode, builder, selectors);
|
|
45
46
|
} else if (
|
|
46
47
|
// Matches: :root {}
|
|
47
48
|
isRootVariableSelector(cssSelector)
|
|
@@ -110,7 +111,7 @@ export function getSelectors(
|
|
|
110
111
|
// ["=", "prefers-color-scheme", "dark"],
|
|
111
112
|
// ]);
|
|
112
113
|
} else {
|
|
113
|
-
const selector = classNameSelector(cssSelector,
|
|
114
|
+
const selector = classNameSelector(cssSelector, builder.getOptions());
|
|
114
115
|
|
|
115
116
|
if (selector === null) {
|
|
116
117
|
continue;
|
|
@@ -178,11 +179,12 @@ function classNameSelector(
|
|
|
178
179
|
switch (component.type) {
|
|
179
180
|
case "universal":
|
|
180
181
|
case "namespace":
|
|
181
|
-
case "nesting":
|
|
182
182
|
case "id":
|
|
183
183
|
case "pseudo-element":
|
|
184
184
|
// We don't support these selectors at all
|
|
185
185
|
return null;
|
|
186
|
+
case "nesting":
|
|
187
|
+
continue;
|
|
186
188
|
case "class": {
|
|
187
189
|
if (!primaryClassName) {
|
|
188
190
|
primaryClassName = component.name;
|
|
@@ -371,6 +373,18 @@ function isIsPseudoClass(
|
|
|
371
373
|
);
|
|
372
374
|
}
|
|
373
375
|
|
|
376
|
+
function isWherePseudoClass(
|
|
377
|
+
selector: Selector,
|
|
378
|
+
): selector is [
|
|
379
|
+
{ type: "pseudo-class"; kind: "where"; selectors: Selector[] },
|
|
380
|
+
] {
|
|
381
|
+
return (
|
|
382
|
+
selector.length === 1 &&
|
|
383
|
+
selector[0]?.type === "pseudo-class" &&
|
|
384
|
+
selector[0].kind === "where"
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
374
388
|
// function isDarkModeMediaQuery(query?: MediaCondition): boolean {
|
|
375
389
|
// if (!query) return false;
|
|
376
390
|
|