react-native-css 3.0.0-nightly.df0f885 → 3.0.0-preview.0
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 +13 -8
- package/dist/commonjs/compiler/compiler.js.map +1 -1
- package/dist/commonjs/compiler/declarations.js +238 -154
- 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 +100 -43
- 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 -17
- 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 +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 +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 -21
- 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/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 +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 +234 -150
- 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 +99 -42
- 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 +22 -16
- 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 +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 +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 -20
- 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/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 +4 -4
- 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 +16 -18
- 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 +16 -12
- 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 +16 -6
- 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 +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.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 -9
- 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 +4 -4
- 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 +16 -18
- 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 +16 -12
- 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 +16 -6
- 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 +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.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 -9
- 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 +31 -15
- package/src/compiler/atRules.ts +17 -3
- package/src/compiler/compiler.ts +12 -10
- package/src/compiler/compiler.types.ts +11 -14
- package/src/compiler/declarations.ts +423 -194
- 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 +145 -57
- 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 +25 -15
- 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 +3 -1
- 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 -29
- 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/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
|
@@ -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: {
|
|
@@ -57,25 +66,37 @@ export class StylesheetBuilder {
|
|
|
57
66
|
animations?: AnimationRecord;
|
|
58
67
|
rem: number;
|
|
59
68
|
ruleOrder: number;
|
|
69
|
+
warningProperty?: string;
|
|
60
70
|
warningProperties: string[];
|
|
61
|
-
warningValues:
|
|
71
|
+
warningValues: Record<string, unknown[]>;
|
|
62
72
|
warningFunctions: string[];
|
|
63
73
|
} = {
|
|
64
74
|
ruleSets: {},
|
|
65
75
|
rem: 14,
|
|
66
76
|
ruleOrder: 0,
|
|
67
77
|
warningProperties: [],
|
|
68
|
-
warningValues:
|
|
78
|
+
warningValues: {},
|
|
69
79
|
warningFunctions: [],
|
|
70
80
|
},
|
|
71
|
-
private selectors
|
|
81
|
+
private selectors: SelectorList = [],
|
|
72
82
|
) {}
|
|
73
83
|
|
|
74
|
-
fork(
|
|
75
|
-
mode = this.mode,
|
|
76
|
-
selectors: NormalizeSelector[] | undefined = this.selectors,
|
|
77
|
-
): StylesheetBuilder {
|
|
84
|
+
fork(mode = this.mode, selectors: SelectorList = []): StylesheetBuilder {
|
|
78
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
|
+
|
|
79
100
|
return new StylesheetBuilder(
|
|
80
101
|
this.options,
|
|
81
102
|
mode,
|
|
@@ -172,8 +193,14 @@ export class StylesheetBuilder {
|
|
|
172
193
|
);
|
|
173
194
|
}
|
|
174
195
|
|
|
196
|
+
setWarningProperty(property: string) {
|
|
197
|
+
this.shared.warningProperty = property;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
addWarning(type: "property" | "value", property: string): void;
|
|
201
|
+
addWarning(type: "style", property: string, value: unknown): void;
|
|
175
202
|
addWarning(
|
|
176
|
-
type: "property" | "
|
|
203
|
+
type: "property" | "style" | "value",
|
|
177
204
|
property: string,
|
|
178
205
|
value?: unknown,
|
|
179
206
|
): void {
|
|
@@ -181,21 +208,49 @@ export class StylesheetBuilder {
|
|
|
181
208
|
case "property":
|
|
182
209
|
this.shared.warningProperties.push(property);
|
|
183
210
|
break;
|
|
184
|
-
case "value":
|
|
185
|
-
|
|
211
|
+
case "value": {
|
|
212
|
+
value = property;
|
|
213
|
+
property = this.shared.warningProperty ?? "";
|
|
214
|
+
|
|
215
|
+
if (!property) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
this.shared.warningValues[property] ??= [];
|
|
220
|
+
this.shared.warningValues[property]?.push(value);
|
|
186
221
|
break;
|
|
187
|
-
|
|
188
|
-
|
|
222
|
+
}
|
|
223
|
+
case "style":
|
|
224
|
+
this.shared.warningValues[property] ??= [];
|
|
225
|
+
this.shared.warningValues[property]?.push(value);
|
|
189
226
|
break;
|
|
190
227
|
}
|
|
191
228
|
}
|
|
192
229
|
|
|
193
230
|
getWarnings() {
|
|
194
|
-
|
|
195
|
-
properties
|
|
196
|
-
values
|
|
197
|
-
functions
|
|
198
|
-
};
|
|
231
|
+
const result: {
|
|
232
|
+
properties?: string[];
|
|
233
|
+
values?: Record<string, unknown[]>;
|
|
234
|
+
functions?: string[];
|
|
235
|
+
} = {};
|
|
236
|
+
|
|
237
|
+
if (this.shared.warningProperties.length) {
|
|
238
|
+
result.properties = this.shared.warningProperties;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (Object.keys(this.shared.warningValues).length) {
|
|
242
|
+
result.values = this.shared.warningValues;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (this.shared.warningFunctions.length) {
|
|
246
|
+
result.functions = this.shared.warningFunctions;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return result;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
addMapping(mapping: StyleRuleMapping) {
|
|
253
|
+
this.mapping = { ...this.mapping, ...mapping };
|
|
199
254
|
}
|
|
200
255
|
|
|
201
256
|
newRule(mapping = this.mapping, { important = false } = {}) {
|
|
@@ -291,7 +346,10 @@ export class StylesheetBuilder {
|
|
|
291
346
|
const [delayed, usesVariables] = postProcessStyleFunction(value);
|
|
292
347
|
|
|
293
348
|
rule.d ??= [];
|
|
294
|
-
if (
|
|
349
|
+
if (
|
|
350
|
+
value[1].startsWith("animation") ||
|
|
351
|
+
value[1].startsWith("transition")
|
|
352
|
+
) {
|
|
295
353
|
rule.a ??= true;
|
|
296
354
|
}
|
|
297
355
|
|
|
@@ -331,43 +389,46 @@ export class StylesheetBuilder {
|
|
|
331
389
|
}
|
|
332
390
|
|
|
333
391
|
private pushDescriptor(
|
|
334
|
-
|
|
392
|
+
rawProperty: string,
|
|
335
393
|
value: StyleDescriptor,
|
|
336
394
|
declarations: StyleDeclaration[],
|
|
337
395
|
forceTuple = false,
|
|
338
396
|
delayed = false,
|
|
339
397
|
) {
|
|
340
|
-
property = toRNProperty(
|
|
398
|
+
const property = toRNProperty(rawProperty);
|
|
341
399
|
|
|
342
|
-
let propPath: string | string[] =
|
|
343
|
-
this.mapping[property] ?? this.mapping["*"]
|
|
400
|
+
let propPath: string | string[] | undefined =
|
|
401
|
+
this.mapping[rawProperty] ?? this.mapping[property] ?? this.mapping["*"];
|
|
344
402
|
|
|
345
403
|
if (Array.isArray(propPath)) {
|
|
346
|
-
const first = propPath
|
|
347
|
-
|
|
348
|
-
if (!first) {
|
|
349
|
-
// This should not happen, but if it does, we skip the property
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
404
|
+
const [first, second] = propPath;
|
|
352
405
|
|
|
353
|
-
if (propPath.length ===
|
|
354
|
-
propPath =
|
|
406
|
+
if (propPath.length === 2 && first === "*" && second) {
|
|
407
|
+
propPath = second;
|
|
355
408
|
} else {
|
|
356
409
|
forceTuple = true;
|
|
357
410
|
}
|
|
411
|
+
} else if (propPath) {
|
|
412
|
+
forceTuple = true;
|
|
413
|
+
} else {
|
|
414
|
+
propPath = property;
|
|
358
415
|
}
|
|
359
416
|
|
|
360
|
-
if (
|
|
417
|
+
if (forceTuple && !Array.isArray(propPath)) {
|
|
418
|
+
propPath = [propPath];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
if (isStyleFunction(value) || Array.isArray(propPath)) {
|
|
361
422
|
if (delayed) {
|
|
362
423
|
declarations.push([value, propPath, 1]);
|
|
363
424
|
} else {
|
|
364
425
|
declarations.push([value, propPath]);
|
|
365
426
|
}
|
|
366
|
-
} else if (forceTuple || Array.isArray(propPath)) {
|
|
367
|
-
declarations.push([value, propPath]);
|
|
368
427
|
} else if (Array.isArray(value) && value.some(isStyleFunction)) {
|
|
369
428
|
declarations.push([value, propPath]);
|
|
370
|
-
} else {
|
|
429
|
+
} else if (typeof value === "string" && keywords.has(value)) {
|
|
430
|
+
declarations.push([value, propPath]);
|
|
431
|
+
} else if (typeof propPath === "string") {
|
|
371
432
|
let staticDeclarationRecord = staticDeclarations.get(declarations);
|
|
372
433
|
if (!staticDeclarationRecord) {
|
|
373
434
|
staticDeclarationRecord = {};
|
|
@@ -379,18 +440,35 @@ export class StylesheetBuilder {
|
|
|
379
440
|
}
|
|
380
441
|
|
|
381
442
|
applyRuleToSelectors(selectorList = this.selectors): void {
|
|
382
|
-
if (!selectorList
|
|
443
|
+
if (!selectorList.length) {
|
|
383
444
|
// If there are no selectors, we cannot apply the rule
|
|
384
445
|
return;
|
|
385
446
|
}
|
|
386
447
|
|
|
387
|
-
if (!this.rule.d && !this.rule.v) {
|
|
448
|
+
if (!this.rule.d && !this.rule.v && !this.rule.c) {
|
|
388
449
|
return;
|
|
389
450
|
}
|
|
390
451
|
|
|
391
|
-
|
|
452
|
+
const normalizedSelectors = getClassNameSelectors(
|
|
453
|
+
selectorList,
|
|
454
|
+
this.options,
|
|
455
|
+
);
|
|
456
|
+
|
|
457
|
+
for (const selector of normalizedSelectors) {
|
|
392
458
|
// We are going to be apply the current rule to n selectors, so we clone the rule
|
|
393
|
-
|
|
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
|
+
}
|
|
394
472
|
|
|
395
473
|
if (selector.type === "className") {
|
|
396
474
|
const {
|
|
@@ -402,6 +480,10 @@ export class StylesheetBuilder {
|
|
|
402
480
|
attributeQuery,
|
|
403
481
|
} = selector;
|
|
404
482
|
|
|
483
|
+
if (!className) {
|
|
484
|
+
continue; // No className, nothing to do
|
|
485
|
+
}
|
|
486
|
+
|
|
405
487
|
// Combine the specificity of the selector with the rule's specificity
|
|
406
488
|
for (let i = 0; i < specificity.length; i++) {
|
|
407
489
|
const spec = specificity[i];
|
|
@@ -425,14 +507,29 @@ export class StylesheetBuilder {
|
|
|
425
507
|
continue;
|
|
426
508
|
}
|
|
427
509
|
|
|
510
|
+
const [first, ...rest] = name.slice(2).split(".");
|
|
511
|
+
|
|
512
|
+
if (typeof first !== "string") {
|
|
513
|
+
continue;
|
|
514
|
+
}
|
|
515
|
+
|
|
428
516
|
const containerRule: StyleRule = {
|
|
429
517
|
// These are not "real" rules, so they use the lowest specificity
|
|
430
518
|
s: [0],
|
|
431
519
|
c: [name],
|
|
432
520
|
};
|
|
433
521
|
|
|
522
|
+
if (rest.length) {
|
|
523
|
+
containerRule.aq = rest.map((attr) => [
|
|
524
|
+
"a",
|
|
525
|
+
"className",
|
|
526
|
+
"*=",
|
|
527
|
+
attr,
|
|
528
|
+
]);
|
|
529
|
+
}
|
|
530
|
+
|
|
434
531
|
// Create rules for the parent classes
|
|
435
|
-
this.addRuleToRuleSet(
|
|
532
|
+
this.addRuleToRuleSet(first, containerRule);
|
|
436
533
|
}
|
|
437
534
|
}
|
|
438
535
|
|
|
@@ -461,24 +558,15 @@ export class StylesheetBuilder {
|
|
|
461
558
|
if (!this.rule.v) {
|
|
462
559
|
continue;
|
|
463
560
|
}
|
|
464
|
-
|
|
465
|
-
const { type, subtype } = selector;
|
|
466
|
-
|
|
561
|
+
const { type } = selector;
|
|
467
562
|
for (const [name, value] of this.rule.v) {
|
|
468
563
|
this.shared[type] ??= {};
|
|
469
564
|
this.shared[type][name] ??= [];
|
|
470
|
-
|
|
471
|
-
const variableValue: VariableValue =
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
: [value, [["=", "prefers-color-scheme", "dark"]]];
|
|
475
|
-
|
|
565
|
+
const mediaQueries = this.rule.m;
|
|
566
|
+
const variableValue: VariableValue = mediaQueries
|
|
567
|
+
? [value, [...mediaQueries]]
|
|
568
|
+
: [value];
|
|
476
569
|
// Append extra media queries if they exist
|
|
477
|
-
if (this.rule.m) {
|
|
478
|
-
variableValue[1] ??= [];
|
|
479
|
-
variableValue[1].push(...this.rule.m);
|
|
480
|
-
}
|
|
481
|
-
|
|
482
570
|
this.shared[type][name].push(variableValue);
|
|
483
571
|
}
|
|
484
572
|
}
|
|
@@ -549,7 +637,7 @@ function postProcessStyleFunction(value: StyleDescriptor): [
|
|
|
549
637
|
let [shouldDelay, usesVariables] = postProcessStyleFunction(value[2]);
|
|
550
638
|
|
|
551
639
|
usesVariables ||= value[1] === "var";
|
|
552
|
-
shouldDelay ||= value[3] === 1;
|
|
640
|
+
shouldDelay ||= value[3] === 1 || usesVariables;
|
|
553
641
|
|
|
554
642
|
if (shouldDelay) {
|
|
555
643
|
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,8 +2,9 @@ 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 "
|
|
5
|
+
import { compile, type CompilerOptions } from "react-native-css/compiler";
|
|
6
|
+
import { StyleCollection } from "react-native-css/style-collection";
|
|
7
|
+
|
|
7
8
|
import { colorScheme, dimensions, rem } from "../runtime/native/reactivity";
|
|
8
9
|
|
|
9
10
|
declare global {
|
|
@@ -32,21 +33,11 @@ const debugDefault = Boolean(
|
|
|
32
33
|
|
|
33
34
|
export function registerCSS(
|
|
34
35
|
css: string,
|
|
35
|
-
{
|
|
36
|
-
debug = debugDefault,
|
|
37
|
-
...options
|
|
38
|
-
}: CompilerOptions & { debug?: boolean } = {},
|
|
36
|
+
options: CompilerOptions & { debug?: boolean } = {},
|
|
39
37
|
) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
// Just log the rules
|
|
43
|
-
if (text.startsWith("[")) {
|
|
44
|
-
console.log(`Rules:\n---\n${text}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
: undefined;
|
|
38
|
+
const { debug = debugDefault } = options;
|
|
39
|
+
const compiled = compileWithAutoDebug(css, options);
|
|
48
40
|
|
|
49
|
-
const compiled = compile(css, { ...options, logger });
|
|
50
41
|
if (debug) {
|
|
51
42
|
console.log(
|
|
52
43
|
`Compiled:\n---\n${inspect(
|
|
@@ -63,3 +54,22 @@ export function registerCSS(
|
|
|
63
54
|
|
|
64
55
|
return compiled;
|
|
65
56
|
}
|
|
57
|
+
|
|
58
|
+
export function compileWithAutoDebug(
|
|
59
|
+
css: string,
|
|
60
|
+
{
|
|
61
|
+
debug = debugDefault,
|
|
62
|
+
...options
|
|
63
|
+
}: CompilerOptions & { debug?: boolean } = {},
|
|
64
|
+
) {
|
|
65
|
+
const logger = debug
|
|
66
|
+
? (text: string) => {
|
|
67
|
+
// Just log the rules
|
|
68
|
+
if (text.startsWith("[")) {
|
|
69
|
+
console.log(`Rules:\n---\n${text}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
: undefined;
|
|
73
|
+
|
|
74
|
+
return compile(css, { ...options, logger });
|
|
75
|
+
}
|
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", {
|