react-native-css 3.0.0-nightly.fa5e95b → 3.0.0-preview.1
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 +15 -2
- package/dist/commonjs/compiler/atRules.js.map +1 -1
- package/dist/commonjs/compiler/compiler.js +13 -8
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +323 -176
- package/dist/commonjs/compiler/declarations.js.map +1 -1
- package/dist/commonjs/compiler/inheritance.test.js +12 -12
- 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 +63 -25
- 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 +24 -18
- 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 +10 -10
- package/dist/commonjs/runtime/native/api.js +29 -4
- 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 +7 -0
- package/dist/commonjs/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/index.js +6 -40
- package/dist/commonjs/runtime/native/conditions/index.js.map +1 -1
- package/dist/commonjs/runtime/native/conditions/media-query.js +16 -11
- package/dist/commonjs/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/commonjs/runtime/native/react/rules.js +26 -20
- package/dist/commonjs/runtime/native/react/rules.js.map +1 -1
- package/dist/commonjs/runtime/native/react/useNativeCss.js +2 -2
- package/dist/commonjs/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/commonjs/runtime/native/reactivity.js +12 -25
- 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 +29 -9
- 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/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 +11 -9
- 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 +18 -0
- 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 +29 -0
- package/dist/commonjs/style-collection/root.js.map +1 -0
- package/dist/module/compiler/atRules.js +15 -2
- package/dist/module/compiler/atRules.js.map +1 -1
- package/dist/module/compiler/compiler.js +13 -8
- 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 +314 -172
- package/dist/module/compiler/declarations.js.map +1 -1
- package/dist/module/compiler/inheritance.test.js +12 -12
- 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 +61 -23
- 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 +23 -18
- 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 +10 -10
- package/dist/module/runtime/native/api.js +23 -4
- 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 +7 -0
- package/dist/module/runtime/native/conditions/container-query.js.map +1 -1
- package/dist/module/runtime/native/conditions/index.js +6 -40
- package/dist/module/runtime/native/conditions/index.js.map +1 -1
- package/dist/module/runtime/native/conditions/media-query.js +17 -12
- package/dist/module/runtime/native/conditions/media-query.js.map +1 -1
- package/dist/module/runtime/native/react/rules.js +24 -19
- package/dist/module/runtime/native/react/rules.js.map +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js +1 -1
- package/dist/module/runtime/native/react/useNativeCss.js.map +1 -1
- package/dist/module/runtime/native/reactivity.js +11 -24
- 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 +30 -10
- 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/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 +12 -9
- 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 +18 -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 +25 -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 +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts +11 -13
- package/dist/typescript/commonjs/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/commonjs/src/compiler/declarations.d.ts +26 -17
- 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 +7 -7
- 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 +13 -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/runtime/native/api.d.ts +16 -2
- 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.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/conditions/index.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.map +1 -1
- package/dist/typescript/commonjs/src/runtime/native/reactivity.d.ts +1 -11
- 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 +9 -3
- 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 +1 -1
- package/dist/typescript/module/src/compiler/compiler.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/compiler.types.d.ts +11 -13
- package/dist/typescript/module/src/compiler/compiler.types.d.ts.map +1 -1
- package/dist/typescript/module/src/compiler/declarations.d.ts +26 -17
- 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 +7 -7
- 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 +13 -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/runtime/native/api.d.ts +16 -2
- 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.map +1 -1
- package/dist/typescript/module/src/runtime/native/conditions/index.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.map +1 -1
- package/dist/typescript/module/src/runtime/native/reactivity.d.ts +1 -11
- 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 +9 -3
- 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 +30 -15
- package/src/compiler/atRules.ts +16 -2
- package/src/compiler/compiler.ts +12 -10
- package/src/compiler/compiler.types.ts +11 -14
- package/src/compiler/declarations.ts +518 -215
- package/src/compiler/inheritance.test.ts +10 -10
- 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 +93 -33
- 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 +26 -17
- 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 +10 -10
- package/src/runtime/native/{api.ts → api.tsx} +34 -5
- package/src/runtime/native/conditions/attributes.ts +52 -0
- package/src/runtime/native/conditions/container-query.ts +5 -0
- package/src/runtime/native/conditions/index.ts +7 -59
- package/src/runtime/native/conditions/media-query.ts +18 -12
- package/src/runtime/native/react/rules.ts +27 -17
- package/src/runtime/native/react/useNativeCss.ts +1 -1
- package/src/runtime/native/reactivity.ts +13 -33
- package/src/runtime/native/reanimated.ts +22 -0
- package/src/runtime/native/styles/calculate-props.ts +30 -8
- 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/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 +14 -9
- 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 → api.tsx} +29 -3
- package/src/style-collection/index.ts +142 -0
- package/src/style-collection/root.ts +37 -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
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import type { SelectorList } from "lightningcss";
|
|
2
|
+
|
|
1
3
|
import {
|
|
2
4
|
isStyleDescriptorArray,
|
|
3
5
|
Specificity,
|
|
4
6
|
specificityCompareFn,
|
|
5
7
|
} from "../runtime/utils";
|
|
6
8
|
import type {
|
|
7
|
-
|
|
9
|
+
AnimationKeyframes,
|
|
8
10
|
AnimationRecord,
|
|
9
11
|
CompilerOptions,
|
|
10
12
|
ContainerQuery,
|
|
@@ -19,7 +21,11 @@ import type {
|
|
|
19
21
|
VariableRecord,
|
|
20
22
|
VariableValue,
|
|
21
23
|
} from "./compiler.types";
|
|
22
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
modifyRuleForPlaceholder,
|
|
26
|
+
modifyRuleForSelection,
|
|
27
|
+
} from "./pseudo-elements";
|
|
28
|
+
import { getClassNameSelectors, toRNProperty } from "./selector-builder";
|
|
23
29
|
|
|
24
30
|
type BuilderMode = "style" | "media" | "container" | "keyframes";
|
|
25
31
|
|
|
@@ -30,8 +36,10 @@ const staticDeclarations = new WeakMap<
|
|
|
30
36
|
|
|
31
37
|
const extraRules = new WeakMap<StyleRule, Partial<StyleRule>[]>();
|
|
32
38
|
|
|
39
|
+
const keywords = new Set(["unset"]);
|
|
40
|
+
|
|
33
41
|
export class StylesheetBuilder {
|
|
34
|
-
animationFrames?:
|
|
42
|
+
animationFrames?: AnimationKeyframes[];
|
|
35
43
|
animationDeclarations: StyleDeclaration[] = [];
|
|
36
44
|
|
|
37
45
|
stylesheet: ReactNativeCssStyleSheet = {};
|
|
@@ -48,6 +56,7 @@ export class StylesheetBuilder {
|
|
|
48
56
|
private ruleTemplate: StyleRule = {
|
|
49
57
|
s: [],
|
|
50
58
|
},
|
|
59
|
+
// Any default mapping should be included in the @prop parsing
|
|
51
60
|
private mapping: StyleRuleMapping = {},
|
|
52
61
|
public descriptorProperty?: string,
|
|
53
62
|
private shared: {
|
|
@@ -69,14 +78,25 @@ export class StylesheetBuilder {
|
|
|
69
78
|
warningValues: {},
|
|
70
79
|
warningFunctions: [],
|
|
71
80
|
},
|
|
72
|
-
private selectors
|
|
81
|
+
private selectors: SelectorList = [],
|
|
73
82
|
) {}
|
|
74
83
|
|
|
75
|
-
fork(
|
|
76
|
-
mode = this.mode,
|
|
77
|
-
selectors: NormalizeSelector[] | undefined = this.selectors,
|
|
78
|
-
): StylesheetBuilder {
|
|
84
|
+
fork(mode = this.mode, selectors: SelectorList = []): StylesheetBuilder {
|
|
79
85
|
this.shared.ruleOrder++;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* If we already have selectors and we are added more
|
|
89
|
+
* Then these must be nested selectors.
|
|
90
|
+
*
|
|
91
|
+
* We need to extrapolate out the selectors to their full values
|
|
92
|
+
*/
|
|
93
|
+
selectors =
|
|
94
|
+
this.selectors.length && selectors.length
|
|
95
|
+
? this.selectors.flatMap((selectorA) => {
|
|
96
|
+
return selectors.map((selectorB) => [...selectorA, ...selectorB]);
|
|
97
|
+
})
|
|
98
|
+
: [...this.selectors, ...selectors];
|
|
99
|
+
|
|
80
100
|
return new StylesheetBuilder(
|
|
81
101
|
this.options,
|
|
82
102
|
mode,
|
|
@@ -326,7 +346,10 @@ export class StylesheetBuilder {
|
|
|
326
346
|
const [delayed, usesVariables] = postProcessStyleFunction(value);
|
|
327
347
|
|
|
328
348
|
rule.d ??= [];
|
|
329
|
-
if (
|
|
349
|
+
if (
|
|
350
|
+
value[1].startsWith("animation") ||
|
|
351
|
+
value[1].startsWith("transition")
|
|
352
|
+
) {
|
|
330
353
|
rule.a ??= true;
|
|
331
354
|
}
|
|
332
355
|
|
|
@@ -391,17 +414,21 @@ export class StylesheetBuilder {
|
|
|
391
414
|
propPath = property;
|
|
392
415
|
}
|
|
393
416
|
|
|
394
|
-
if (
|
|
417
|
+
if (forceTuple && !Array.isArray(propPath)) {
|
|
418
|
+
propPath = [propPath];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (isStyleFunction(value) || Array.isArray(propPath)) {
|
|
395
422
|
if (delayed) {
|
|
396
423
|
declarations.push([value, propPath, 1]);
|
|
397
424
|
} else {
|
|
398
425
|
declarations.push([value, propPath]);
|
|
399
426
|
}
|
|
400
|
-
} else if (forceTuple || Array.isArray(propPath)) {
|
|
401
|
-
declarations.push([value, propPath]);
|
|
402
427
|
} else if (Array.isArray(value) && value.some(isStyleFunction)) {
|
|
403
428
|
declarations.push([value, propPath]);
|
|
404
|
-
} else {
|
|
429
|
+
} else if (typeof value === "string" && keywords.has(value)) {
|
|
430
|
+
declarations.push([value, propPath]);
|
|
431
|
+
} else if (typeof propPath === "string") {
|
|
405
432
|
let staticDeclarationRecord = staticDeclarations.get(declarations);
|
|
406
433
|
if (!staticDeclarationRecord) {
|
|
407
434
|
staticDeclarationRecord = {};
|
|
@@ -413,18 +440,35 @@ export class StylesheetBuilder {
|
|
|
413
440
|
}
|
|
414
441
|
|
|
415
442
|
applyRuleToSelectors(selectorList = this.selectors): void {
|
|
416
|
-
if (!selectorList
|
|
443
|
+
if (!selectorList.length) {
|
|
417
444
|
// If there are no selectors, we cannot apply the rule
|
|
418
445
|
return;
|
|
419
446
|
}
|
|
420
447
|
|
|
421
|
-
if (!this.rule.d && !this.rule.v) {
|
|
448
|
+
if (!this.rule.d && !this.rule.v && !this.rule.c) {
|
|
422
449
|
return;
|
|
423
450
|
}
|
|
424
451
|
|
|
425
|
-
|
|
452
|
+
const normalizedSelectors = getClassNameSelectors(
|
|
453
|
+
selectorList,
|
|
454
|
+
this.options,
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
for (const selector of normalizedSelectors) {
|
|
426
458
|
// We are going to be apply the current rule to n selectors, so we clone the rule
|
|
427
|
-
|
|
459
|
+
let rule: StyleRule | undefined = this.cloneRule(this.rule);
|
|
460
|
+
|
|
461
|
+
if (selector.type === "className" && selector.pseudoElementQuery) {
|
|
462
|
+
if (selector.pseudoElementQuery.includes("selection")) {
|
|
463
|
+
rule = modifyRuleForSelection(rule);
|
|
464
|
+
} else if (selector.pseudoElementQuery.includes("placeholder")) {
|
|
465
|
+
rule = modifyRuleForPlaceholder(rule);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
if (!rule) {
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
428
472
|
|
|
429
473
|
if (selector.type === "className") {
|
|
430
474
|
const {
|
|
@@ -436,6 +480,10 @@ export class StylesheetBuilder {
|
|
|
436
480
|
attributeQuery,
|
|
437
481
|
} = selector;
|
|
438
482
|
|
|
483
|
+
if (!className) {
|
|
484
|
+
continue; // No className, nothing to do
|
|
485
|
+
}
|
|
486
|
+
|
|
439
487
|
// Combine the specificity of the selector with the rule's specificity
|
|
440
488
|
for (let i = 0; i < specificity.length; i++) {
|
|
441
489
|
const spec = specificity[i];
|
|
@@ -459,14 +507,29 @@ export class StylesheetBuilder {
|
|
|
459
507
|
continue;
|
|
460
508
|
}
|
|
461
509
|
|
|
510
|
+
const [first, ...rest] = name.slice(2).split(".");
|
|
511
|
+
|
|
512
|
+
if (typeof first !== "string") {
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
|
|
462
516
|
const containerRule: StyleRule = {
|
|
463
517
|
// These are not "real" rules, so they use the lowest specificity
|
|
464
518
|
s: [0],
|
|
465
519
|
c: [name],
|
|
466
520
|
};
|
|
467
521
|
|
|
522
|
+
if (rest.length) {
|
|
523
|
+
containerRule.aq = rest.map((attr) => [
|
|
524
|
+
"a",
|
|
525
|
+
"className",
|
|
526
|
+
"*=",
|
|
527
|
+
attr,
|
|
528
|
+
]);
|
|
529
|
+
}
|
|
530
|
+
|
|
468
531
|
// Create rules for the parent classes
|
|
469
|
-
this.addRuleToRuleSet(
|
|
532
|
+
this.addRuleToRuleSet(first, containerRule);
|
|
470
533
|
}
|
|
471
534
|
}
|
|
472
535
|
|
|
@@ -495,25 +558,22 @@ export class StylesheetBuilder {
|
|
|
495
558
|
if (!this.rule.v) {
|
|
496
559
|
continue;
|
|
497
560
|
}
|
|
498
|
-
|
|
499
|
-
const { type, subtype } = selector;
|
|
500
|
-
|
|
561
|
+
const { type } = selector;
|
|
501
562
|
for (const [name, value] of this.rule.v) {
|
|
502
563
|
this.shared[type] ??= {};
|
|
503
564
|
this.shared[type][name] ??= [];
|
|
504
|
-
|
|
505
|
-
const variableValue: VariableValue =
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
: [value, [["=", "prefers-color-scheme", "dark"]]];
|
|
509
|
-
|
|
565
|
+
const mediaQueries = this.rule.m;
|
|
566
|
+
const variableValue: VariableValue = mediaQueries
|
|
567
|
+
? [value, [...mediaQueries]]
|
|
568
|
+
: [value];
|
|
510
569
|
// Append extra media queries if they exist
|
|
511
|
-
if (this.rule.m) {
|
|
512
|
-
variableValue[1] ??= [];
|
|
513
|
-
variableValue[1].push(...this.rule.m);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
570
|
this.shared[type][name].push(variableValue);
|
|
571
|
+
|
|
572
|
+
if (type === "rootVariables" && name === "__rn-css-em") {
|
|
573
|
+
const remName = "__rn-css-rem";
|
|
574
|
+
this.shared[type][remName] ??= [];
|
|
575
|
+
this.shared[type][remName].push(variableValue);
|
|
576
|
+
}
|
|
517
577
|
}
|
|
518
578
|
}
|
|
519
579
|
}
|
|
@@ -583,7 +643,7 @@ function postProcessStyleFunction(value: StyleDescriptor): [
|
|
|
583
643
|
let [shouldDelay, usesVariables] = postProcessStyleFunction(value[2]);
|
|
584
644
|
|
|
585
645
|
usesVariables ||= value[1] === "var";
|
|
586
|
-
shouldDelay ||= value[3] === 1;
|
|
646
|
+
shouldDelay ||= value[3] === 1 || usesVariables;
|
|
587
647
|
|
|
588
648
|
if (shouldDelay) {
|
|
589
649
|
return [true, usesVariables];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SupportsCondition } from "lightningcss";
|
|
2
|
+
|
|
3
|
+
export function supportsConditionValid(condition: SupportsCondition): boolean {
|
|
4
|
+
if (condition.type === "and") {
|
|
5
|
+
return condition.value.every((condition) => {
|
|
6
|
+
return supportsConditionValid(condition);
|
|
7
|
+
});
|
|
8
|
+
} else if (condition.type === "or") {
|
|
9
|
+
return condition.value.some((condition) => {
|
|
10
|
+
return supportsConditionValid(condition);
|
|
11
|
+
});
|
|
12
|
+
} else if (condition.type === "not") {
|
|
13
|
+
return !supportsConditionValid(condition.value);
|
|
14
|
+
} else if (condition.type === "declaration") {
|
|
15
|
+
return Boolean(
|
|
16
|
+
declarations[condition.propertyId.property]?.includes(condition.value),
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const declarations: Record<string, string[]> = {
|
|
24
|
+
// We don't actually support this, but its needed for Tailwind CSS
|
|
25
|
+
"-moz-orient": ["inline"],
|
|
26
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ActivityIndicator as RNActivityIndicator,
|
|
3
|
+
type ActivityIndicatorProps,
|
|
4
|
+
} from "react-native";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
useCssElement,
|
|
8
|
+
type StyledConfiguration,
|
|
9
|
+
type StyledProps,
|
|
10
|
+
} from "../runtime";
|
|
11
|
+
|
|
12
|
+
const mapping = {
|
|
13
|
+
className: {
|
|
14
|
+
target: "style",
|
|
15
|
+
nativeStyleMapping: {
|
|
16
|
+
color: "color",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
} satisfies StyledConfiguration<typeof RNActivityIndicator>;
|
|
20
|
+
|
|
21
|
+
export function ActivityIndicator(
|
|
22
|
+
props: StyledProps<ActivityIndicatorProps, typeof mapping>,
|
|
23
|
+
) {
|
|
24
|
+
return useCssElement(RNActivityIndicator, props, mapping);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default ActivityIndicator;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Button as RNButton, type ButtonProps } from "react-native";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useCssElement,
|
|
5
|
+
type StyledConfiguration,
|
|
6
|
+
type StyledProps,
|
|
7
|
+
} from "../runtime";
|
|
8
|
+
|
|
9
|
+
const mapping = {
|
|
10
|
+
className: {
|
|
11
|
+
target: false,
|
|
12
|
+
nativeStyleMapping: {
|
|
13
|
+
color: "color",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
} satisfies StyledConfiguration<typeof RNButton>;
|
|
17
|
+
|
|
18
|
+
export function Button(props: StyledProps<ButtonProps, typeof mapping>) {
|
|
19
|
+
return useCssElement(RNButton, props, mapping);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default Button;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FlatList as RNFlatList, type FlatListProps } from "react-native";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useCssElement,
|
|
5
|
+
type StyledConfiguration,
|
|
6
|
+
type StyledProps,
|
|
7
|
+
} from "../runtime";
|
|
8
|
+
|
|
9
|
+
const mapping = {
|
|
10
|
+
columnWrapperStyle: "columnWrapperStyle",
|
|
11
|
+
listFooterComponentClassName: "ListFooterComponentStyle",
|
|
12
|
+
listHeaderComponentClassName: "ListHeaderComponentStyle",
|
|
13
|
+
} satisfies StyledConfiguration<typeof RNFlatList>;
|
|
14
|
+
|
|
15
|
+
export function FlatList<ItemT>(
|
|
16
|
+
props: StyledProps<FlatListProps<ItemT>, typeof mapping>,
|
|
17
|
+
) {
|
|
18
|
+
return useCssElement(RNFlatList, props, mapping);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default FlatList;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Image as RNImage, type ImageProps } from "react-native";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useCssElement,
|
|
5
|
+
type StyledConfiguration,
|
|
6
|
+
type StyledProps,
|
|
7
|
+
} from "../runtime";
|
|
8
|
+
|
|
9
|
+
const mapping = {
|
|
10
|
+
className: "style",
|
|
11
|
+
} satisfies StyledConfiguration<typeof RNImage>;
|
|
12
|
+
|
|
13
|
+
export function Image(props: StyledProps<ImageProps, typeof mapping>) {
|
|
14
|
+
return useCssElement(RNImage, props, mapping);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Image;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Switch as RNSwitch, type SwitchProps } from "react-native";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useCssElement,
|
|
5
|
+
type StyledConfiguration,
|
|
6
|
+
type StyledProps,
|
|
7
|
+
} from "../runtime";
|
|
8
|
+
|
|
9
|
+
const mapping = {
|
|
10
|
+
className: "style",
|
|
11
|
+
} satisfies StyledConfiguration<typeof RNSwitch>;
|
|
12
|
+
|
|
13
|
+
export function Switch(props: StyledProps<SwitchProps, typeof mapping>) {
|
|
14
|
+
return useCssElement(RNSwitch, props, mapping);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default Switch;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TextInput as RNTextInput, type TextInputProps } from "react-native";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
useCssElement,
|
|
5
|
+
type StyledConfiguration,
|
|
6
|
+
type StyledProps,
|
|
7
|
+
} from "../runtime";
|
|
8
|
+
|
|
9
|
+
const mapping = {
|
|
10
|
+
className: "style",
|
|
11
|
+
} satisfies StyledConfiguration<typeof RNTextInput>;
|
|
12
|
+
|
|
13
|
+
export function TextInput(props: StyledProps<TextInputProps, typeof mapping>) {
|
|
14
|
+
return useCssElement(RNTextInput, props, mapping);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default TextInput;
|
package/src/components/index.tsx
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export * from "react-native";
|
|
2
2
|
|
|
3
|
+
export { ActivityIndicator } from "./ActivityIndicator";
|
|
4
|
+
export { Button } from "./Button";
|
|
5
|
+
export { FlatList } from "./FlatList";
|
|
6
|
+
export { Image } from "./Image";
|
|
7
|
+
export { Switch } from "./Switch";
|
|
3
8
|
export { Text } from "./Text";
|
|
9
|
+
export { TextInput } from "./TextInput";
|
|
4
10
|
export { View } from "./View";
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useContext, useMemo, type PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
SafeAreaProvider as OriginalSafeAreaProvider,
|
|
5
|
+
useSafeAreaInsets,
|
|
6
|
+
type SafeAreaProviderProps,
|
|
7
|
+
} from "react-native-safe-area-context";
|
|
8
|
+
|
|
9
|
+
import { VariableContext } from "../runtime/native/reactivity";
|
|
10
|
+
|
|
11
|
+
export * from "react-native-safe-area-context";
|
|
12
|
+
|
|
13
|
+
export function SafeAreaProvider({
|
|
14
|
+
children,
|
|
15
|
+
...props
|
|
16
|
+
}: SafeAreaProviderProps) {
|
|
17
|
+
return (
|
|
18
|
+
<OriginalSafeAreaProvider {...props}>
|
|
19
|
+
<SafeAreaEnv>{children}</SafeAreaEnv>
|
|
20
|
+
</OriginalSafeAreaProvider>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function SafeAreaEnv({ children }: PropsWithChildren) {
|
|
25
|
+
const insets = useSafeAreaInsets();
|
|
26
|
+
const parentVars = useContext(VariableContext);
|
|
27
|
+
|
|
28
|
+
const value = useMemo(
|
|
29
|
+
() => ({
|
|
30
|
+
...parentVars,
|
|
31
|
+
"--react-native-css-safe-area-inset-bottom": insets.bottom,
|
|
32
|
+
"--react-native-css-safe-area-inset-left": insets.left,
|
|
33
|
+
"--react-native-css-safe-area-inset-right": insets.right,
|
|
34
|
+
"--react-native-css-safe-area-inset-top": insets.top,
|
|
35
|
+
}),
|
|
36
|
+
[parentVars, insets],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return <VariableContext value={value}>{children}</VariableContext>;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-native-safe-area-context";
|
package/src/jest/index.ts
CHANGED
|
@@ -2,9 +2,10 @@ import { Appearance, Dimensions } from "react-native";
|
|
|
2
2
|
|
|
3
3
|
import { inspect } from "node:util";
|
|
4
4
|
|
|
5
|
-
import { compile, type CompilerOptions } from "
|
|
6
|
-
import { StyleCollection } from "
|
|
7
|
-
|
|
5
|
+
import { compile, type CompilerOptions } from "react-native-css/compiler";
|
|
6
|
+
import { StyleCollection } from "react-native-css/style-collection";
|
|
7
|
+
|
|
8
|
+
import { colorScheme, dimensions } from "../runtime/native/reactivity";
|
|
8
9
|
|
|
9
10
|
declare global {
|
|
10
11
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
@@ -20,7 +21,6 @@ export const testID = "react-native-css";
|
|
|
20
21
|
beforeEach(() => {
|
|
21
22
|
StyleCollection.styles.clear();
|
|
22
23
|
dimensions.set(Dimensions.get("window"));
|
|
23
|
-
rem.set(14);
|
|
24
24
|
Appearance.setColorScheme(null);
|
|
25
25
|
colorScheme.set(null);
|
|
26
26
|
});
|
|
@@ -32,21 +32,11 @@ const debugDefault = Boolean(
|
|
|
32
32
|
|
|
33
33
|
export function registerCSS(
|
|
34
34
|
css: string,
|
|
35
|
-
{
|
|
36
|
-
debug = debugDefault,
|
|
37
|
-
...options
|
|
38
|
-
}: CompilerOptions & { debug?: boolean } = {},
|
|
35
|
+
options: CompilerOptions & { debug?: boolean } = {},
|
|
39
36
|
) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
// Just log the rules
|
|
43
|
-
if (text.startsWith("[")) {
|
|
44
|
-
console.log(`Rules:\n---\n${text}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
: undefined;
|
|
37
|
+
const { debug = debugDefault } = options;
|
|
38
|
+
const compiled = compileWithAutoDebug(css, options);
|
|
48
39
|
|
|
49
|
-
const compiled = compile(css, { ...options, logger });
|
|
50
40
|
if (debug) {
|
|
51
41
|
console.log(
|
|
52
42
|
`Compiled:\n---\n${inspect(
|
|
@@ -63,3 +53,22 @@ export function registerCSS(
|
|
|
63
53
|
|
|
64
54
|
return compiled;
|
|
65
55
|
}
|
|
56
|
+
|
|
57
|
+
export function compileWithAutoDebug(
|
|
58
|
+
css: string,
|
|
59
|
+
{
|
|
60
|
+
debug = debugDefault,
|
|
61
|
+
...options
|
|
62
|
+
}: CompilerOptions & { debug?: boolean } = {},
|
|
63
|
+
) {
|
|
64
|
+
const logger = debug
|
|
65
|
+
? (text: string) => {
|
|
66
|
+
// Just log the rules
|
|
67
|
+
if (text.startsWith("[")) {
|
|
68
|
+
console.log(`Rules:\n---\n${text}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
: undefined;
|
|
72
|
+
|
|
73
|
+
return compile(css, { ...options, logger });
|
|
74
|
+
}
|
package/src/metro/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import connect from "connect";
|
|
|
6
6
|
import debug from "debug";
|
|
7
7
|
import type { MetroConfig } from "metro-config";
|
|
8
8
|
|
|
9
|
-
import type { CompilerOptions } from "../compiler";
|
|
9
|
+
import type { CompilerOptions, ReactNativeCssStyleSheet } from "../compiler";
|
|
10
10
|
import { compile } from "../compiler/compiler";
|
|
11
11
|
import { getNativeInjectionCode, getWebInjectionCode } from "./injection-code";
|
|
12
12
|
import { nativeResolver, webResolver } from "./resolver";
|
|
@@ -53,16 +53,18 @@ export function withReactNativeCSS<
|
|
|
53
53
|
const originalMiddleware = config.server?.enhanceMiddleware;
|
|
54
54
|
const originalResolver = config.resolver?.resolveRequest;
|
|
55
55
|
|
|
56
|
-
const poisonPillPath = "./poison.pill";
|
|
57
|
-
|
|
58
56
|
return {
|
|
59
57
|
...config,
|
|
60
58
|
transformerPath: require.resolve("./metro-transformer"),
|
|
59
|
+
transformer: {
|
|
60
|
+
...config.transformer,
|
|
61
|
+
reactNativeCSS: options,
|
|
62
|
+
},
|
|
61
63
|
resolver: {
|
|
62
64
|
...config.resolver,
|
|
63
65
|
sourceExts: [...(config?.resolver?.sourceExts || []), "css"],
|
|
64
66
|
resolveRequest: (context, moduleName, platform) => {
|
|
65
|
-
if (moduleName
|
|
67
|
+
if (moduleName.includes("poison.pill")) {
|
|
66
68
|
return { type: "empty" };
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -93,7 +95,10 @@ export function withReactNativeCSS<
|
|
|
93
95
|
if (!bundler.__react_native_css__patched) {
|
|
94
96
|
bundler.__react_native_css__patched = true;
|
|
95
97
|
|
|
96
|
-
const nativeCSSFiles = new Map
|
|
98
|
+
const nativeCSSFiles = new Map<
|
|
99
|
+
string,
|
|
100
|
+
[string, ReactNativeCssStyleSheet]
|
|
101
|
+
>();
|
|
97
102
|
const webCSSFiles = new Set<string>();
|
|
98
103
|
|
|
99
104
|
const nativeInjectionPath = require.resolve(
|
|
@@ -158,7 +163,7 @@ export function withReactNativeCSS<
|
|
|
158
163
|
// Let the transformer know that we will handle compilation
|
|
159
164
|
customTransformOptions: {
|
|
160
165
|
...transformOptions.customTransformOptions,
|
|
161
|
-
|
|
166
|
+
reactNativeCSS: options,
|
|
162
167
|
},
|
|
163
168
|
},
|
|
164
169
|
fileBuffer,
|
|
@@ -174,7 +179,7 @@ export function withReactNativeCSS<
|
|
|
174
179
|
next,
|
|
175
180
|
compile(next, {
|
|
176
181
|
hexColors: options?.hexColors,
|
|
177
|
-
}),
|
|
182
|
+
}).stylesheet(),
|
|
178
183
|
]);
|
|
179
184
|
|
|
180
185
|
watcher.emit("change", {
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* This is a hack around
|
|
2
|
+
* This is a hack around Metro's handling of bundles.
|
|
3
3
|
* When a component is inside a lazy() barrier, it is inside a different JS bundle.
|
|
4
4
|
* So when it updates, it only updates its local bundle, not the global one which contains the CSS files.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* This means that the CSS file will not be re-evaluated when a component in a different bundle updates,
|
|
7
|
+
* breaking tools like Tailwind CSS
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* which is included inside react-native-css's runtime.
|
|
11
|
-
*
|
|
12
|
-
* This is why both of these function add imports for the CSS files.
|
|
9
|
+
* To fix this, we force our code to always import the CSS files, so now the CSS files are in every bundle.
|
|
13
10
|
*/
|
|
14
|
-
|
|
15
11
|
export function getWebInjectionCode(filePaths: string[]) {
|
|
16
12
|
const importStatements = filePaths
|
|
17
13
|
.map((filePath) => `import "${filePath}";`)
|
|
@@ -27,12 +23,12 @@ export function getNativeInjectionCode(
|
|
|
27
23
|
const importStatements = cssFilePaths
|
|
28
24
|
.map((filePath) => `import "${filePath}";`)
|
|
29
25
|
.join("\n");
|
|
30
|
-
|
|
26
|
+
|
|
31
27
|
const contents = values
|
|
32
28
|
.map((value) => `StyleCollection.inject(${JSON.stringify(value)});`)
|
|
33
29
|
.join("\n");
|
|
34
30
|
|
|
35
31
|
return Buffer.from(
|
|
36
|
-
|
|
32
|
+
`import { StyleCollection } from "react-native-css/style-collection";\n${importStatements}\n${contents};export {};`,
|
|
37
33
|
);
|
|
38
34
|
}
|
|
@@ -1,31 +1,48 @@
|
|
|
1
|
+
import { unstable_transformerPath } from "@expo/metro-config";
|
|
1
2
|
import type {
|
|
2
3
|
JsTransformerConfig,
|
|
3
4
|
JsTransformOptions,
|
|
4
5
|
TransformResponse,
|
|
5
6
|
} from "metro-transform-worker";
|
|
6
7
|
|
|
8
|
+
import { compile, type CompilerOptions } from "../compiler";
|
|
9
|
+
import { getNativeInjectionCode } from "./injection-code";
|
|
10
|
+
|
|
7
11
|
const worker =
|
|
8
12
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
9
|
-
require(
|
|
13
|
+
require(unstable_transformerPath) as typeof import("metro-transform-worker");
|
|
10
14
|
|
|
11
|
-
export function transform(
|
|
15
|
+
export async function transform(
|
|
12
16
|
config: JsTransformerConfig,
|
|
13
17
|
projectRoot: string,
|
|
14
18
|
filePath: string,
|
|
15
19
|
data: Buffer,
|
|
16
|
-
options: JsTransformOptions
|
|
20
|
+
options: JsTransformOptions & {
|
|
21
|
+
reactNativeCSS?: CompilerOptions | undefined;
|
|
22
|
+
},
|
|
17
23
|
): Promise<TransformResponse> {
|
|
18
24
|
const isCss = options.type !== "asset" && /\.(s?css|sass)$/.test(filePath);
|
|
19
|
-
const skipCompile =
|
|
20
|
-
options.customTransformOptions &&
|
|
21
|
-
"reactNativeCSSCompile" in options.customTransformOptions &&
|
|
22
|
-
options.customTransformOptions.reactNativeCSSCompile === false;
|
|
23
25
|
|
|
24
|
-
if (
|
|
26
|
+
if (options.platform === "web" || !isCss) {
|
|
25
27
|
return worker.transform(config, projectRoot, filePath, data, options);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
const cssFile = (await worker.transform(config, projectRoot, filePath, data, {
|
|
31
|
+
...options,
|
|
32
|
+
platform: "web",
|
|
33
|
+
})) as TransformResponse & {
|
|
34
|
+
output: [{ data: { css: { code: Buffer } } }];
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const css = cssFile.output[0].data.css.code.toString();
|
|
38
|
+
|
|
39
|
+
const productionJS = compile(css, {
|
|
40
|
+
...options.reactNativeCSS,
|
|
41
|
+
filename: filePath,
|
|
42
|
+
projectRoot: projectRoot,
|
|
43
|
+
}).stylesheet();
|
|
44
|
+
|
|
45
|
+
data = Buffer.from(getNativeInjectionCode([], [productionJS]));
|
|
29
46
|
|
|
30
|
-
return worker.transform(config, projectRoot, filePath
|
|
47
|
+
return worker.transform(config, projectRoot, `${filePath}.js`, data, options);
|
|
31
48
|
}
|